1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #define __SIMPLE_DEVICE__
5 #include <console/console.h>
6 #include <device/pci_ops.h>
7 #include <device/pci_type.h>
9 #include <pc80/mc146818rtc.h>
10 #include <security/vboot/vbnv.h>
15 #define PCH_LPC_DEV PCI_DEV(0, 0x1f, 0)
19 return !!(pci_read_config8(PCH_LPC_DEV
, D31F0_GEN_PMCON_3
) & RTC_BATTERY_DEAD
);
22 void sb_rtc_init(void)
24 int rtc_failed
= rtc_failure();
28 elog_add_event(ELOG_TYPE_RTC_RESET
);
29 pci_update_config8(PCH_LPC_DEV
, D31F0_GEN_PMCON_3
,
30 ~RTC_BATTERY_DEAD
, 0);
33 printk(BIOS_DEBUG
, "RTC: failed = 0x%x\n", rtc_failed
);
35 cmos_init(rtc_failed
);
38 int vbnv_cmos_failed(void)