soc/intel/pantherlake: Remove soc_info.[hc] interface
[coreboot2.git] / src / southbridge / intel / common / rtc.c
blob933ac6349ff1e0a016187513a30ce93b931893d7
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>
8 #include <elog.h>
9 #include <pc80/mc146818rtc.h>
10 #include <security/vboot/vbnv.h>
12 #include "pmutil.h"
13 #include "rtc.h"
15 #define PCH_LPC_DEV PCI_DEV(0, 0x1f, 0)
17 int rtc_failure(void)
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();
26 if (rtc_failed) {
27 if (CONFIG(ELOG))
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)
40 return rtc_failure();