Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107521222
D33667.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D33667.diff
View Options
diff --git a/sys/x86/isa/atrtc.c b/sys/x86/isa/atrtc.c
--- a/sys/x86/isa/atrtc.c
+++ b/sys/x86/isa/atrtc.c
@@ -79,6 +79,7 @@
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;
@@ -420,6 +421,31 @@
#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)
{
@@ -435,6 +461,7 @@
device_set_desc(dev, "AT realtime clock");
return (BUS_PROBE_LOW_PRIORITY);
}
+ rtc_century = rtc_acpi_century_get();
return (result);
}
@@ -548,9 +575,8 @@
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.
@@ -592,9 +618,8 @@
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. */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 16, 9:27 AM (20 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15823321
Default Alt Text
D33667.diff (1 KB)
Attached To
Mode
D33667: atrtc: reads Century field from FADT table
Attached
Detach File
Event Timeline
Log In to Comment