Attention is currently required from: Patrick Rudolph. Tim Wawrzynczak has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/56668 )
Change subject: soc/intel/cannonlake: Clear RTC_BATTERY_DEAD ......................................................................
soc/intel/cannonlake: Clear RTC_BATTERY_DEAD
Normally for vboot-enabled x86 board, the VBNV region is stored in CMOS and backed up to flash (RW_NVRAM). However, on the very first boot after a flash of the full SPI image (so RW_NVRAM is empty and RTC_BATTERY_DEAD is set), if coreboot persistently requests recovery before FSP-M finishes (which clears RTC_BATTERY_DEAD towards the end of its execution), then vbnv_cmos_failed() will still return 1. Therefore, immediately after reading (and returning 1 if set) RTC_BATTERY_DEAD, it is cleared. This prevents an infinite boot loop when trying to set the recovery mode bit.
Note that this was the behavior for previous generations of Intel PMC programming as well (see southbridge/intel, soc/skylake, soc/broadwell, etc).
BUG=b:181678769
Change-Id: I54f519edb9f4295f83a581db9cb43f5ae5d0d483 Signed-off-by: Tim Wawrzynczak twawrzynczak@chromium.org --- M src/soc/intel/cannonlake/pmutil.c 1 file changed, 18 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/68/56668/1
diff --git a/src/soc/intel/cannonlake/pmutil.c b/src/soc/intel/cannonlake/pmutil.c index a79d262..6baa926 100644 --- a/src/soc/intel/cannonlake/pmutil.c +++ b/src/soc/intel/cannonlake/pmutil.c @@ -178,6 +178,22 @@ return !!(gen_pmcon_b & RTC_BATTERY_DEAD); }
+static void clear_rtc_failed(void) +{ + clrbits8(pmc_mmio_regs() + GEN_PMCON_B, RTC_BATTERY_DEAD); +} + +static int check_rtc_failed(uint32_t gen_pmcon_b) +{ + const int failed = rtc_failed(gen_pmcon_b); + if (failed) { + clear_rtc_failed(); + printk(BIOS_DEBUG, "rtc_failed = 0x%x\n", failed); + } + + return failed; +} + int soc_get_rtc_failed(void) { const struct chipset_power_state *ps; @@ -185,12 +201,12 @@ if (acpi_pm_state_for_rtc(&ps) < 0) return 1;
- return rtc_failed(ps->gen_pmcon_b); + return check_rtc_failed(ps->gen_pmcon_b); }
int vbnv_cmos_failed(void) { - return rtc_failed(read32(pmc_mmio_regs() + GEN_PMCON_B)); + return check_rtc_failed(read32(pmc_mmio_regs() + GEN_PMCON_B)); }
static inline int deep_s3_enabled(void)