aboutsummaryrefslogtreecommitdiff
path: root/src/soc/intel/fsp_baytrail/pmutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/intel/fsp_baytrail/pmutil.c')
-rw-r--r--src/soc/intel/fsp_baytrail/pmutil.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/soc/intel/fsp_baytrail/pmutil.c b/src/soc/intel/fsp_baytrail/pmutil.c
index 33ecc09488..402842eb74 100644
--- a/src/soc/intel/fsp_baytrail/pmutil.c
+++ b/src/soc/intel/fsp_baytrail/pmutil.c
@@ -15,14 +15,16 @@
#include <stdint.h>
#include <arch/io.h>
+#include <cbmem.h>
#include <console/console.h>
#include <soc/iomap.h>
#include <soc/lpc.h>
#include <soc/pci_devs.h>
#include <soc/pmc.h>
+#include <security/vboot/vbnv.h>
-#if defined(__SMM__)
+#if defined(__SIMPLE_DEVICE__)
static const pci_devfn_t pcu_dev = PCI_DEV(0, PCU_DEV, 0);
@@ -31,7 +33,7 @@ static inline pci_devfn_t get_pcu_dev(void)
return pcu_dev;
}
-#else /* !__SMM__ */
+#else /* !__SIMPLE_DEVICE__ */
#include <device/device.h>
#include <device/pci.h>
@@ -358,3 +360,22 @@ void clear_pmc_status(void)
write32((u32 *)(PMC_BASE_ADDRESS + GEN_PMCON1), gen_pmcon1 & ~RPS);
write32((u32 *)(PMC_BASE_ADDRESS + PRSTS), prsts);
}
+
+int vbnv_cmos_failed(void)
+{
+ uint32_t gen_pmcon1;
+ int rtc_fail;
+ struct chipset_power_state *ps = cbmem_find(CBMEM_ID_POWER_STATE);
+
+ if (ps != NULL)
+ gen_pmcon1 = ps->gen_pmcon1;
+ else
+ gen_pmcon1 = read32((u32 *)(PMC_BASE_ADDRESS + GEN_PMCON1));
+
+ rtc_fail = !!(gen_pmcon1 & RPS);
+
+ if (rtc_fail)
+ printk(BIOS_DEBUG, "RTC failure.\n");
+
+ return rtc_fail;
+}