1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2008 Poul-Henning Kamp 5 * Copyright (c) 2010 Alexander Motin <mav@FreeBSD.org> 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30 #include <sys/cdefs.h> 31 __FBSDID("$FreeBSD$"); 32 33 #include "opt_acpi.h" 34 #include "opt_isa.h" 35 36 #include <sys/param.h> 37 #include <sys/systm.h> 38 #include <sys/bus.h> 39 #include <sys/clock.h> 40 #include <sys/lock.h> 41 #include <sys/mutex.h> 42 #include <sys/kdb.h> 43 #include <sys/kernel.h> 44 #include <sys/module.h> 45 #include <sys/proc.h> 46 #include <sys/rman.h> 47 #include <sys/timeet.h> 48 49 #include <isa/rtc.h> 50 #ifdef DEV_ISA 51 #include <isa/isareg.h> 52 #include <isa/isavar.h> 53 #endif 54 #include <machine/intr_machdep.h> 55 #include "clock_if.h" 56 #ifdef DEV_ACPI 57 #include <contrib/dev/acpica/include/acpi.h> 58 #include <contrib/dev/acpica/include/accommon.h> 59 #include <dev/acpica/acpivar.h> 60 #include <machine/md_var.h> 61 #endif 62 63 /* tunable to detect a power loss of the rtc */ 64 static bool atrtc_power_lost = false; 65 SYSCTL_BOOL(_machdep, OID_AUTO, atrtc_power_lost, CTLFLAG_RD, &atrtc_power_lost, 66 false, "RTC lost power on last power cycle (probably caused by an emtpy cmos battery)"); 67 68 /* 69 * atrtc_lock protects low-level access to individual hardware registers. 70 * atrtc_time_lock protects the entire sequence of accessing multiple registers 71 * to read or write the date and time. 72 */ 73 static struct mtx atrtc_lock; 74 MTX_SYSINIT(atrtc_lock_init, &atrtc_lock, "atrtc", MTX_SPIN); 75 76 /* Force RTC enabled/disabled. */ 77 static int atrtc_enabled = -1; 78 TUNABLE_INT("hw.atrtc.enabled", &atrtc_enabled); 79 80 struct mtx atrtc_time_lock; 81 MTX_SYSINIT(atrtc_time_lock_init, &atrtc_time_lock, "atrtc_time", MTX_DEF); 82 83 int atrtcclock_disable = 0; 84 85 static int rtc_century = 0; 86 static int rtc_reg = -1; 87 static u_char rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF; 88 static u_char rtc_statusb = RTCSB_24HR; 89 90 #ifdef DEV_ACPI 91 #define _COMPONENT ACPI_TIMER 92 ACPI_MODULE_NAME("ATRTC") 93 #endif 94 95 /* 96 * RTC support routines 97 */ 98 99 static inline u_char 100 rtcin_locked(int reg) 101 { 102 103 if (rtc_reg != reg) { 104 inb(0x84); 105 outb(IO_RTC, reg); 106 rtc_reg = reg; 107 inb(0x84); 108 } 109 return (inb(IO_RTC + 1)); 110 } 111 112 static inline void 113 rtcout_locked(int reg, u_char val) 114 { 115 116 if (rtc_reg != reg) { 117 inb(0x84); 118 outb(IO_RTC, reg); 119 rtc_reg = reg; 120 inb(0x84); 121 } 122 outb(IO_RTC + 1, val); 123 inb(0x84); 124 } 125 126 int 127 rtcin(int reg) 128 { 129 u_char val; 130 131 mtx_lock_spin(&atrtc_lock); 132 val = rtcin_locked(reg); 133 mtx_unlock_spin(&atrtc_lock); 134 return (val); 135 } 136 137 void 138 writertc(int reg, u_char val) 139 { 140 141 mtx_lock_spin(&atrtc_lock); 142 rtcout_locked(reg, val); 143 mtx_unlock_spin(&atrtc_lock); 144 } 145 146 static void 147 atrtc_start(void) 148 { 149 150 mtx_lock_spin(&atrtc_lock); 151 rtcout_locked(RTC_STATUSA, rtc_statusa); 152 rtcout_locked(RTC_STATUSB, RTCSB_24HR); 153 mtx_unlock_spin(&atrtc_lock); 154 } 155 156 static void 157 atrtc_rate(unsigned rate) 158 { 159 160 rtc_statusa = RTCSA_DIVIDER | rate; 161 writertc(RTC_STATUSA, rtc_statusa); 162 } 163 164 static void 165 atrtc_enable_intr(void) 166 { 167 168 rtc_statusb |= RTCSB_PINTR; 169 mtx_lock_spin(&atrtc_lock); 170 rtcout_locked(RTC_STATUSB, rtc_statusb); 171 rtcin_locked(RTC_INTR); 172 mtx_unlock_spin(&atrtc_lock); 173 } 174 175 static void 176 atrtc_disable_intr(void) 177 { 178 179 rtc_statusb &= ~RTCSB_PINTR; 180 mtx_lock_spin(&atrtc_lock); 181 rtcout_locked(RTC_STATUSB, rtc_statusb); 182 rtcin_locked(RTC_INTR); 183 mtx_unlock_spin(&atrtc_lock); 184 } 185 186 void 187 atrtc_restore(void) 188 { 189 190 /* Restore all of the RTC's "status" (actually, control) registers. */ 191 mtx_lock_spin(&atrtc_lock); 192 rtcin_locked(RTC_STATUSA); /* dummy to get rtc_reg set */ 193 rtcout_locked(RTC_STATUSB, RTCSB_24HR); 194 rtcout_locked(RTC_STATUSA, rtc_statusa); 195 rtcout_locked(RTC_STATUSB, rtc_statusb); 196 rtcin_locked(RTC_INTR); 197 mtx_unlock_spin(&atrtc_lock); 198 } 199 200 /********************************************************************** 201 * RTC driver for subr_rtc 202 */ 203 204 struct atrtc_softc { 205 int port_rid, intr_rid; 206 struct resource *port_res; 207 struct resource *intr_res; 208 void *intr_handler; 209 struct eventtimer et; 210 #ifdef DEV_ACPI 211 ACPI_HANDLE acpi_handle; 212 #endif 213 }; 214 215 static int 216 rtc_start(struct eventtimer *et, sbintime_t first, sbintime_t period) 217 { 218 219 atrtc_rate(max(fls(period + (period >> 1)) - 17, 1)); 220 atrtc_enable_intr(); 221 return (0); 222 } 223 224 static int 225 rtc_stop(struct eventtimer *et) 226 { 227 228 atrtc_disable_intr(); 229 return (0); 230 } 231 232 /* 233 * This routine receives statistical clock interrupts from the RTC. 234 * As explained above, these occur at 128 interrupts per second. 235 * When profiling, we receive interrupts at a rate of 1024 Hz. 236 * 237 * This does not actually add as much overhead as it sounds, because 238 * when the statistical clock is active, the hardclock driver no longer 239 * needs to keep (inaccurate) statistics on its own. This decouples 240 * statistics gathering from scheduling interrupts. 241 * 242 * The RTC chip requires that we read status register C (RTC_INTR) 243 * to acknowledge an interrupt, before it will generate the next one. 244 * Under high interrupt load, rtcintr() can be indefinitely delayed and 245 * the clock can tick immediately after the read from RTC_INTR. In this 246 * case, the mc146818A interrupt signal will not drop for long enough 247 * to register with the 8259 PIC. If an interrupt is missed, the stat 248 * clock will halt, considerably degrading system performance. This is 249 * why we use 'while' rather than a more straightforward 'if' below. 250 * Stat clock ticks can still be lost, causing minor loss of accuracy 251 * in the statistics, but the stat clock will no longer stop. 252 */ 253 static int 254 rtc_intr(void *arg) 255 { 256 struct atrtc_softc *sc = (struct atrtc_softc *)arg; 257 int flag = 0; 258 259 while (rtcin(RTC_INTR) & RTCIR_PERIOD) { 260 flag = 1; 261 if (sc->et.et_active) 262 sc->et.et_event_cb(&sc->et, sc->et.et_arg); 263 } 264 return(flag ? FILTER_HANDLED : FILTER_STRAY); 265 } 266 267 #ifdef DEV_ACPI 268 /* 269 * ACPI RTC CMOS address space handler 270 */ 271 #define ATRTC_LAST_REG 0x40 272 273 static void 274 rtcin_region(int reg, void *buf, int len) 275 { 276 u_char *ptr = buf; 277 278 /* Drop lock after each IO as intr and settime have greater priority */ 279 while (len-- > 0) 280 *ptr++ = rtcin(reg++) & 0xff; 281 } 282 283 static void 284 rtcout_region(int reg, const void *buf, int len) 285 { 286 const u_char *ptr = buf; 287 288 while (len-- > 0) 289 writertc(reg++, *ptr++); 290 } 291 292 static bool 293 atrtc_check_cmos_access(bool is_read, ACPI_PHYSICAL_ADDRESS addr, UINT32 len) 294 { 295 296 /* Block address space wrapping on out-of-bound access */ 297 if (addr >= ATRTC_LAST_REG || addr + len > ATRTC_LAST_REG) 298 return (false); 299 300 if (is_read) { 301 /* Reading 0x0C will muck with interrupts */ 302 if (addr <= RTC_INTR && addr + len > RTC_INTR) 303 return (false); 304 } else { 305 /* 306 * Allow single-byte writes to alarm registers and 307 * multi-byte writes to addr >= 0x30, else deny. 308 */ 309 if (!((len == 1 && (addr == RTC_SECALRM || 310 addr == RTC_MINALRM || 311 addr == RTC_HRSALRM)) || 312 addr >= 0x30)) 313 return (false); 314 } 315 return (true); 316 } 317 318 static ACPI_STATUS 319 atrtc_acpi_cmos_handler(UINT32 func, ACPI_PHYSICAL_ADDRESS addr, 320 UINT32 bitwidth, UINT64 *value, void *context, void *region_context) 321 { 322 device_t dev = context; 323 UINT32 bytewidth = howmany(bitwidth, 8); 324 bool is_read = func == ACPI_READ; 325 326 /* ACPICA is very verbose on CMOS handler failures, so we, too */ 327 #define CMOS_HANDLER_ERR(fmt, ...) \ 328 device_printf(dev, "ACPI [SystemCMOS] handler: " fmt, ##__VA_ARGS__) 329 330 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); 331 332 if (value == NULL) { 333 CMOS_HANDLER_ERR("NULL parameter\n"); 334 return (AE_BAD_PARAMETER); 335 } 336 if (bitwidth == 0 || (bitwidth & 0x07) != 0) { 337 CMOS_HANDLER_ERR("Invalid bitwidth: %u\n", bitwidth); 338 return (AE_BAD_PARAMETER); 339 } 340 if (!atrtc_check_cmos_access(is_read, addr, bytewidth)) { 341 CMOS_HANDLER_ERR("%s access rejected: addr=%#04jx, len=%u\n", 342 is_read ? "Read" : "Write", (uintmax_t)addr, bytewidth); 343 return (AE_BAD_PARAMETER); 344 } 345 346 switch (func) { 347 case ACPI_READ: 348 rtcin_region(addr, value, bytewidth); 349 break; 350 case ACPI_WRITE: 351 rtcout_region(addr, value, bytewidth); 352 break; 353 default: 354 CMOS_HANDLER_ERR("Invalid function: %u\n", func); 355 return (AE_BAD_PARAMETER); 356 } 357 358 ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev), 359 "ACPI RTC CMOS %s access: addr=%#04x, len=%u, val=%*D\n", 360 is_read ? "read" : "write", (unsigned)addr, bytewidth, 361 bytewidth, value, " "); 362 363 return (AE_OK); 364 } 365 366 static int 367 atrtc_reg_acpi_cmos_handler(device_t dev) 368 { 369 struct atrtc_softc *sc = device_get_softc(dev); 370 371 ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); 372 373 /* Don't handle address space events if driver is disabled. */ 374 if (acpi_disabled("atrtc")) 375 return (ENXIO); 376 377 if (ACPI_FAILURE(AcpiGetHandle(ACPI_ROOT_OBJECT, "\\_SB_", &sc->acpi_handle))) { 378 return (ENXIO); 379 } 380 381 if (sc->acpi_handle == NULL || 382 ACPI_FAILURE(AcpiInstallAddressSpaceHandler(sc->acpi_handle, 383 ACPI_ADR_SPACE_CMOS, atrtc_acpi_cmos_handler, NULL, dev))) { 384 sc->acpi_handle = NULL; 385 device_printf(dev, 386 "Can't register ACPI CMOS address space handler\n"); 387 return (ENXIO); 388 } 389 390 return (0); 391 } 392 393 static int 394 atrtc_unreg_acpi_cmos_handler(device_t dev) 395 { 396 struct atrtc_softc *sc = device_get_softc(dev); 397 398 ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); 399 400 if (sc->acpi_handle != NULL) 401 AcpiRemoveAddressSpaceHandler(sc->acpi_handle, 402 ACPI_ADR_SPACE_CMOS, atrtc_acpi_cmos_handler); 403 404 return (0); 405 } 406 #endif /* DEV_ACPI */ 407 408 /* 409 * Attach to the ISA PnP descriptors for the timer and realtime clock. 410 */ 411 static struct isa_pnp_id atrtc_ids[] = { 412 { 0x000bd041 /* PNP0B00 */, "AT realtime clock" }, 413 { 0 } 414 }; 415 416 static bool 417 atrtc_acpi_disabled(void) 418 { 419 #ifdef DEV_ACPI 420 uint16_t flags; 421 422 if (!acpi_get_fadt_bootflags(&flags)) 423 return (false); 424 return ((flags & ACPI_FADT_NO_CMOS_RTC) != 0); 425 #else 426 return (false); 427 #endif 428 } 429 430 static int 431 rtc_acpi_century_get(void) 432 { 433 #ifdef DEV_ACPI 434 ACPI_TABLE_FADT *fadt; 435 vm_paddr_t physaddr; 436 int century; 437 438 physaddr = acpi_find_table(ACPI_SIG_FADT); 439 if (physaddr == 0) 440 return (0); 441 442 fadt = acpi_map_table(physaddr, ACPI_SIG_FADT); 443 if (fadt == NULL) 444 return (0); 445 446 century = fadt->Century; 447 acpi_unmap_table(fadt); 448 449 return (century); 450 #else 451 return (0); 452 #endif 453 } 454 455 static int 456 atrtc_probe(device_t dev) 457 { 458 int result; 459 460 if ((atrtc_enabled == -1 && atrtc_acpi_disabled()) || 461 (atrtc_enabled == 0)) 462 return (ENXIO); 463 464 result = ISA_PNP_PROBE(device_get_parent(dev), dev, atrtc_ids); 465 /* ENOENT means no PnP-ID, device is hinted. */ 466 if (result == ENOENT) { 467 device_set_desc(dev, "AT realtime clock"); 468 return (BUS_PROBE_LOW_PRIORITY); 469 } 470 rtc_century = rtc_acpi_century_get(); 471 return (result); 472 } 473 474 static int 475 atrtc_attach(device_t dev) 476 { 477 struct atrtc_softc *sc; 478 rman_res_t s; 479 int i; 480 481 sc = device_get_softc(dev); 482 sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->port_rid, 483 IO_RTC, IO_RTC + 1, 2, RF_ACTIVE); 484 if (sc->port_res == NULL) 485 device_printf(dev, "Warning: Couldn't map I/O.\n"); 486 atrtc_start(); 487 clock_register(dev, 1000000); 488 bzero(&sc->et, sizeof(struct eventtimer)); 489 if (!atrtcclock_disable && 490 (resource_int_value(device_get_name(dev), device_get_unit(dev), 491 "clock", &i) != 0 || i != 0)) { 492 sc->intr_rid = 0; 493 while (bus_get_resource(dev, SYS_RES_IRQ, sc->intr_rid, 494 &s, NULL) == 0 && s != 8) 495 sc->intr_rid++; 496 sc->intr_res = bus_alloc_resource(dev, SYS_RES_IRQ, 497 &sc->intr_rid, 8, 8, 1, RF_ACTIVE); 498 if (sc->intr_res == NULL) { 499 device_printf(dev, "Can't map interrupt.\n"); 500 return (0); 501 } else if ((bus_setup_intr(dev, sc->intr_res, INTR_TYPE_CLK, 502 rtc_intr, NULL, sc, &sc->intr_handler))) { 503 device_printf(dev, "Can't setup interrupt.\n"); 504 return (0); 505 } else { 506 /* Bind IRQ to BSP to avoid live migration. */ 507 bus_bind_intr(dev, sc->intr_res, 0); 508 } 509 sc->et.et_name = "RTC"; 510 sc->et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_POW2DIV; 511 sc->et.et_quality = 0; 512 sc->et.et_frequency = 32768; 513 sc->et.et_min_period = 0x00080000; 514 sc->et.et_max_period = 0x80000000; 515 sc->et.et_start = rtc_start; 516 sc->et.et_stop = rtc_stop; 517 sc->et.et_priv = dev; 518 et_register(&sc->et); 519 } 520 return(0); 521 } 522 523 static int 524 atrtc_isa_attach(device_t dev) 525 { 526 527 return (atrtc_attach(dev)); 528 } 529 530 #ifdef DEV_ACPI 531 static int 532 atrtc_acpi_attach(device_t dev) 533 { 534 int ret; 535 536 ret = atrtc_attach(dev); 537 if (ret) 538 return (ret); 539 540 (void)atrtc_reg_acpi_cmos_handler(dev); 541 542 return (0); 543 } 544 545 static int 546 atrtc_acpi_detach(device_t dev) 547 { 548 549 (void)atrtc_unreg_acpi_cmos_handler(dev); 550 return (0); 551 } 552 #endif /* DEV_ACPI */ 553 554 static int 555 atrtc_resume(device_t dev) 556 { 557 558 atrtc_restore(); 559 return(0); 560 } 561 562 static int 563 atrtc_settime(device_t dev __unused, struct timespec *ts) 564 { 565 struct bcd_clocktime bct; 566 567 clock_ts_to_bcd(ts, &bct, false); 568 clock_dbgprint_bcd(dev, CLOCK_DBG_WRITE, &bct); 569 570 mtx_lock(&atrtc_time_lock); 571 mtx_lock_spin(&atrtc_lock); 572 573 /* Disable RTC updates and interrupts. */ 574 rtcout_locked(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR); 575 576 /* Write all the time registers. */ 577 rtcout_locked(RTC_SEC, bct.sec); 578 rtcout_locked(RTC_MIN, bct.min); 579 rtcout_locked(RTC_HRS, bct.hour); 580 rtcout_locked(RTC_WDAY, bct.dow + 1); 581 rtcout_locked(RTC_DAY, bct.day); 582 rtcout_locked(RTC_MONTH, bct.mon); 583 rtcout_locked(RTC_YEAR, bct.year & 0xff); 584 if (rtc_century) 585 rtcout_locked(rtc_century, bct.year >> 8); 586 587 /* 588 * Re-enable RTC updates and interrupts. 589 */ 590 rtcout_locked(RTC_STATUSB, rtc_statusb); 591 rtcin_locked(RTC_INTR); 592 593 mtx_unlock_spin(&atrtc_lock); 594 mtx_unlock(&atrtc_time_lock); 595 596 return (0); 597 } 598 599 static int 600 atrtc_gettime(device_t dev, struct timespec *ts) 601 { 602 struct bcd_clocktime bct; 603 604 /* Look if we have a RTC present and the time is valid */ 605 if (!(rtcin(RTC_STATUSD) & RTCSD_PWR)) { 606 atrtc_power_lost = true; 607 device_printf(dev, "WARNING: Battery failure indication\n"); 608 return (EINVAL); 609 } 610 611 /* 612 * wait for time update to complete 613 * If RTCSA_TUP is zero, we have at least 244us before next update. 614 * This is fast enough on most hardware, but a refinement would be 615 * to make sure that no more than 240us pass after we start reading, 616 * and try again if so. 617 */ 618 mtx_lock(&atrtc_time_lock); 619 while (rtcin(RTC_STATUSA) & RTCSA_TUP) 620 continue; 621 mtx_lock_spin(&atrtc_lock); 622 bct.sec = rtcin_locked(RTC_SEC); 623 bct.min = rtcin_locked(RTC_MIN); 624 bct.hour = rtcin_locked(RTC_HRS); 625 bct.day = rtcin_locked(RTC_DAY); 626 bct.mon = rtcin_locked(RTC_MONTH); 627 bct.year = rtcin_locked(RTC_YEAR); 628 if (rtc_century) 629 bct.year |= rtcin_locked(rtc_century) << 8; 630 mtx_unlock_spin(&atrtc_lock); 631 mtx_unlock(&atrtc_time_lock); 632 /* dow is unused in timespec conversion and we have no nsec info. */ 633 bct.dow = 0; 634 bct.nsec = 0; 635 clock_dbgprint_bcd(dev, CLOCK_DBG_READ, &bct); 636 return (clock_bcd_to_ts(&bct, ts, false)); 637 } 638 639 static device_method_t atrtc_isa_methods[] = { 640 /* Device interface */ 641 DEVMETHOD(device_probe, atrtc_probe), 642 DEVMETHOD(device_attach, atrtc_isa_attach), 643 DEVMETHOD(device_detach, bus_generic_detach), 644 DEVMETHOD(device_shutdown, bus_generic_shutdown), 645 DEVMETHOD(device_suspend, bus_generic_suspend), 646 /* XXX stop statclock? */ 647 DEVMETHOD(device_resume, atrtc_resume), 648 649 /* clock interface */ 650 DEVMETHOD(clock_gettime, atrtc_gettime), 651 DEVMETHOD(clock_settime, atrtc_settime), 652 { 0, 0 } 653 }; 654 655 static driver_t atrtc_isa_driver = { 656 "atrtc", 657 atrtc_isa_methods, 658 sizeof(struct atrtc_softc), 659 }; 660 661 #ifdef DEV_ACPI 662 static device_method_t atrtc_acpi_methods[] = { 663 /* Device interface */ 664 DEVMETHOD(device_probe, atrtc_probe), 665 DEVMETHOD(device_attach, atrtc_acpi_attach), 666 DEVMETHOD(device_detach, atrtc_acpi_detach), 667 /* XXX stop statclock? */ 668 DEVMETHOD(device_resume, atrtc_resume), 669 670 /* clock interface */ 671 DEVMETHOD(clock_gettime, atrtc_gettime), 672 DEVMETHOD(clock_settime, atrtc_settime), 673 { 0, 0 } 674 }; 675 676 static driver_t atrtc_acpi_driver = { 677 "atrtc", 678 atrtc_acpi_methods, 679 sizeof(struct atrtc_softc), 680 }; 681 #endif /* DEV_ACPI */ 682 683 DRIVER_MODULE(atrtc, isa, atrtc_isa_driver, 0, 0); 684 #ifdef DEV_ACPI 685 DRIVER_MODULE(atrtc, acpi, atrtc_acpi_driver, 0, 0); 686 #endif 687 ISA_PNP_INFO(atrtc_ids); 688