soc/intel/baytrail: refactor rtc failure checking
In order to prepare for checking RTC failure in the early boot paths move the rtc failure calculation to pmutil.c and add a helper function to determine if failure occurred. BUG=b:63054105 Change-Id: I1d90cc557225ddbba1787bf95eae0de623af487e Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/21555 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
parent
d1fc8c1343
commit
64b4bddcbc
|
@ -26,6 +26,7 @@ ramstage-y += gpio.c
|
||||||
romstage-y += reset.c
|
romstage-y += reset.c
|
||||||
ramstage-y += reset.c
|
ramstage-y += reset.c
|
||||||
ramstage-y += cpu.c
|
ramstage-y += cpu.c
|
||||||
|
romstage-y += pmutil.c
|
||||||
ramstage-y += pmutil.c
|
ramstage-y += pmutil.c
|
||||||
smm-y += pmutil.c
|
smm-y += pmutil.c
|
||||||
smm-y += smihandler.c
|
smm-y += smihandler.c
|
||||||
|
|
|
@ -288,6 +288,9 @@ void southcluster_log_state(void);
|
||||||
static inline void southcluster_log_state(void) {}
|
static inline void southcluster_log_state(void) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Return non-zero when RTC failure happened. */
|
||||||
|
int rtc_failure(void);
|
||||||
|
|
||||||
#endif /* !defined(__ASSEMBLER__) && !defined(__ACPI__) */
|
#endif /* !defined(__ASSEMBLER__) && !defined(__ACPI__) */
|
||||||
|
|
||||||
#endif /* _BAYTRAIL_PMC_H_ */
|
#endif /* _BAYTRAIL_PMC_H_ */
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <arch/io.h>
|
#include <arch/io.h>
|
||||||
|
#include <cbmem.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
|
|
||||||
#include <soc/iomap.h>
|
#include <soc/iomap.h>
|
||||||
|
@ -22,7 +23,7 @@
|
||||||
#include <soc/pci_devs.h>
|
#include <soc/pci_devs.h>
|
||||||
#include <soc/pmc.h>
|
#include <soc/pmc.h>
|
||||||
|
|
||||||
#if defined(__SMM__)
|
#if defined(__SIMPLE_DEVICE__)
|
||||||
|
|
||||||
static const device_t pcu_dev = PCI_DEV(0, PCU_DEV, 0);
|
static const device_t pcu_dev = PCI_DEV(0, PCU_DEV, 0);
|
||||||
|
|
||||||
|
@ -358,3 +359,22 @@ void clear_pmc_status(void)
|
||||||
write32((u32 *)(PMC_BASE_ADDRESS + GEN_PMCON1), gen_pmcon1 & ~RPS);
|
write32((u32 *)(PMC_BASE_ADDRESS + GEN_PMCON1), gen_pmcon1 & ~RPS);
|
||||||
write32((u32 *)(PMC_BASE_ADDRESS + PRSTS), prsts);
|
write32((u32 *)(PMC_BASE_ADDRESS + PRSTS), prsts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int rtc_failure(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;
|
||||||
|
}
|
||||||
|
|
|
@ -125,23 +125,7 @@ static void sc_read_resources(device_t dev)
|
||||||
|
|
||||||
static void sc_rtc_init(void)
|
static void sc_rtc_init(void)
|
||||||
{
|
{
|
||||||
uint32_t gen_pmcon1;
|
cmos_init(rtc_failure());
|
||||||
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");
|
|
||||||
}
|
|
||||||
|
|
||||||
cmos_init(rtc_fail);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue