coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
rtc.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #define __SIMPLE_DEVICE__
4 
5 #include <console/console.h>
6 #include <device/pci_def.h>
7 #include <device/pci_ops.h>
8 #include <security/vboot/vbnv.h>
9 #include <pc80/mc146818rtc.h>
10 #include <elog.h>
11 #include "pmutil.h"
12 #include "rtc.h"
13 
14 #define PCH_LPC_DEV PCI_DEV(0, 0x1f, 0)
15 
16 int rtc_failure(void)
17 {
19 }
20 
21 void sb_rtc_init(void)
22 {
23  int rtc_failed = rtc_failure();
24 
25  if (rtc_failed) {
26  if (CONFIG(ELOG))
29  ~RTC_BATTERY_DEAD, 0);
30  }
31 
32  printk(BIOS_DEBUG, "RTC: failed = 0x%x\n", rtc_failed);
33 
35 }
36 
38 {
39  return rtc_failure();
40 }
#define ELOG_TYPE_RTC_RESET
Definition: elog.h:139
#define printk(level,...)
Definition: stdlib.h:16
int elog_add_event(u8 event_type)
Definition: elog.c:863
@ CONFIG
Definition: dsi_common.h:201
static __always_inline void pci_update_config8(const struct device *dev, u16 reg, u8 mask, u8 or)
Definition: pci_ops.h:88
static __always_inline u8 pci_read_config8(const struct device *dev, u16 reg)
Definition: pci_ops.h:46
#define RTC_BATTERY_DEAD
Definition: pmc.h:61
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128
void cmos_init(bool invalid)
Definition: mc146818rtc.c:156
#define D31F0_GEN_PMCON_3
Definition: pmutil.h:12
static int rtc_failed(uint32_t gen_pmcon_b)
Definition: pmutil.c:169
#define PCH_LPC_DEV
Definition: rtc.c:14
int vbnv_cmos_failed(void)
Definition: rtc.c:37
void sb_rtc_init(void)
Definition: rtc.c:21
int rtc_failure(void)
Definition: rtc.c:16