| 286 | } |
| 287 | |
| 288 | static bool |
| 289 | atrtc_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 | |
| 314 | static ACPI_STATUS |
| 315 | atrtc_acpi_cmos_handler(UINT32 func, ACPI_PHYSICAL_ADDRESS addr, |
no outgoing calls
no test coverage detected