blob: 9ab63a4f0bc506e008d3f856fcf997dfbc6d5426 [file] [log] [blame]
Jingle Hsue07ea4c2020-07-01 18:26:49 +08001/* SPDX-License-Identifier: GPL-2.0-only */
2
3/*
4 * Helper functions for dealing with power management registers
5 * and the differences between PCH variants.
6 */
7
8#include <intelblocks/rtc.h>
9#include <soc/pmc.h>
10#include <soc/pci_devs.h>
11#include <device/pci.h>
12#include <console/console.h>
13
14int soc_get_rtc_failed(void)
15{
16 uint32_t pmcon_b = pci_s_read_config32(PCH_DEV_PMC, GEN_PMCON_B);
17 int rtc_fail = !!(pmcon_b & RTC_BATTERY_DEAD);
18
19 if (rtc_fail)
20 printk(BIOS_ERR, "%s: RTC battery dead or removed\n", __func__);
21
22 return rtc_fail;
23}