MCPcopy Create free account
hub / github.com/F-Stack/f-stack / atrtc_check_cmos_access

Function atrtc_check_cmos_access

freebsd/x86/isa/atrtc.c:288–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286}
287
288static bool
289atrtc_check_cmos_access(bool is_read, ACPI_PHYSICAL_ADDRESS addr, UINT32 len)
290{
291
292 /* Block address space wrapping on out-of-bound access */
293 if (addr >= ATRTC_LAST_REG || addr + len > ATRTC_LAST_REG)
294 return (false);
295
296 if (is_read) {
297 /* Reading 0x0C will muck with interrupts */
298 if (addr <= RTC_INTR && addr + len > RTC_INTR)
299 return (false);
300 } else {
301 /*
302 * Allow single-byte writes to alarm registers and
303 * multi-byte writes to addr >= 0x30, else deny.
304 */
305 if (!((len == 1 && (addr == RTC_SECALRM ||
306 addr == RTC_MINALRM ||
307 addr == RTC_HRSALRM)) ||
308 addr >= 0x30))
309 return (false);
310 }
311 return (true);
312}
313
314static ACPI_STATUS
315atrtc_acpi_cmos_handler(UINT32 func, ACPI_PHYSICAL_ADDRESS addr,

Callers 1

atrtc_acpi_cmos_handlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected