Index: sys/x86/isa/atrtc.c =================================================================== --- sys/x86/isa/atrtc.c +++ sys/x86/isa/atrtc.c @@ -32,6 +32,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_acpi.h" #include "opt_isa.h" #include @@ -55,6 +56,10 @@ #include #include "clock_if.h" +#ifdef DEV_ACPI +#include +#endif + /* * clock_lock protects low-level access to individual hardware registers. * atrtc_time_lock protects the entire sequence of accessing multiple registers @@ -241,11 +246,42 @@ { 0 } }; +static bool +atrtc_acpi_disabled(void) +{ +#ifdef DEV_ACPI + ACPI_TABLE_FADT *fadt; + vm_paddr_t physaddr; + uint16_t flags; + + physaddr = acpi_find_table(ACPI_SIG_FADT); + if (physaddr == 0) + return (false); + + fadt = acpi_map_table(physaddr, ACPI_SIG_FADT); + if (fadt == NULL) { + printf("at_rtc: unable to map FADT ACPI table\n"); + return (false); + } + + flags = fadt->BootFlags; + acpi_unmap_table(fadt); + + if (flags & ACPI_FADT_NO_CMOS_RTC) + return (true); +#endif + + return (false); +} + static int atrtc_probe(device_t dev) { int result; - + + if (atrtc_acpi_disabled()) + return (ENXIO); + result = ISA_PNP_PROBE(device_get_parent(dev), dev, atrtc_ids); /* ENOENT means no PnP-ID, device is hinted. */ if (result == ENOENT) {