int atrtcclock_disable = 0;
+static int rtc_century = 0;
static int rtc_reg = -1;
static u_char rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF;
static u_char rtc_statusb = RTCSB_24HR;
#endif
}
+static int
+rtc_acpi_century_get(void)
+{
+#ifdef DEV_ACPI
+ ACPI_TABLE_FADT *fadt;
+ vm_paddr_t physaddr;
+ int century;
+
+ physaddr = acpi_find_table(ACPI_SIG_FADT);
+ if (physaddr == 0)
+ return (0);
+
+ fadt = acpi_map_table(physaddr, ACPI_SIG_FADT);
+ if (fadt == NULL)
+ return (0);
+
+ century = fadt->Century;
+ acpi_unmap_table(fadt);
+
+ return (century);
+#else
+ return (0);
+#endif
+}
+
static int
atrtc_probe(device_t dev)
{
device_set_desc(dev, "AT realtime clock");
return (BUS_PROBE_LOW_PRIORITY);
}
+ rtc_century = rtc_acpi_century_get();
return (result);
}
rtcout_locked(RTC_DAY, bct.day);
rtcout_locked(RTC_MONTH, bct.mon);
rtcout_locked(RTC_YEAR, bct.year & 0xff);
-#ifdef USE_RTC_CENTURY
- rtcout_locked(RTC_CENTURY, bct.year >> 8);
-#endif
+ if (rtc_century)
+ rtcout_locked(rtc_century, bct.year >> 8);
/*
* Re-enable RTC updates and interrupts.
bct.day = rtcin_locked(RTC_DAY);
bct.mon = rtcin_locked(RTC_MONTH);
bct.year = rtcin_locked(RTC_YEAR);
-#ifdef USE_RTC_CENTURY
- bct.year |= rtcin_locked(RTC_CENTURY) << 8;
-#endif
+ if (rtc_century)
+ bct.year |= rtcin_locked(rtc_century) << 8;
mtx_unlock_spin(&atrtc_lock);
mtx_unlock(&atrtc_time_lock);
/* dow is unused in timespec conversion and we have no nsec info. */