Page MenuHomeFreeBSD

atrtc: reads Century field from FADT table
ClosedPublic

Authored by austin.zhang_dell.com on Dec 27 2021, 8:27 AM.

Details

Summary

from UEFI spec https://uefi.org/specs/ACPI/6.4/05_ACPI_Software_Programming_Model/ACPI_Software_Programming_Model.html#fixed-acpi-description-table-fadt
it described FADT->Century field as:
"The RTC CMOS RAM index to the century of data value (hundred and thousand year decimals). If this field contains a zero, then the RTC centenary feature is not supported.
If this field has a non-zero value, then this field contains an index into RTC RAM space that OSPM can use to program the centenary field."

We should use this field to decide whether need to program CENTURY register of CMOS RTC device

Test Plan

w/o patch, CMOS RTC century can't be written by date command

root@freebsd-zhanga28:~/workspace # date 199901011101
Fri Jan  1 11:01:00 UTC 1999
root@freebsd-zhanga28:~/workspace # date ; ./a.out
Fri Jan  1 11:01:04 UTC 1999
Date and Time info from CMOS:
2099-1-1-11:1:4

with this patch, CMOS RTC century can be correctly updated by date command

root@freebsd-zhanga28:~/workspace # date 199901011221
Fri Jan  1 12:21:00 UTC 1999
root@freebsd-zhanga28:~/workspace # date ; ./a.out
Fri Jan  1 12:21:03 UTC 1999
Date and Time info from CMOS:
1999-1-1-12:21:4

Diff Detail

Repository
rG FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.