soc/amd/picasso: Die if the workbuf is missing two boots in a row

BUG=b:169199392
TEST=Corrupt vboot signature to force an error, see that the system
halts instead of rebooting forever.
BRANCH=Zork

Signed-off-by: Martin Roth <martinroth@chromium.org>
Change-Id: I949f94e78d25720f6cd7e81de8d030084e267f29
Reviewed-on: https://review.coreboot.org/c/coreboot/+/45964
Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Martin Roth 2020-10-02 14:51:40 -06:00 committed by Edward O'Callaghan
parent eb7fc4aead
commit fc33235f82
2 changed files with 11 additions and 2 deletions

View File

@ -22,6 +22,7 @@ bootblock-y += tsc_freq.c
bootblock-y += gpio.c bootblock-y += gpio.c
bootblock-y += smi_util.c bootblock-y += smi_util.c
bootblock-y += config.c bootblock-y += config.c
bootblock-y += pmutil.c
bootblock-y += reset.c bootblock-y += reset.c
romstage-y += i2c.c romstage-y += i2c.c

View File

@ -17,6 +17,7 @@
#include <amdblocks/amd_pci_mmconf.h> #include <amdblocks/amd_pci_mmconf.h>
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <security/vboot/symbols.h> #include <security/vboot/symbols.h>
#include <security/vboot/vbnv.h>
/* vboot includes directory may not be in include path if vboot is not enabled */ /* vboot includes directory may not be in include path if vboot is not enabled */
#if CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK) #if CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK)
@ -134,10 +135,17 @@ void bootblock_soc_init(void)
#if CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK) #if CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK)
if (*(uint32_t *)_vboot2_work != VB2_SHARED_DATA_MAGIC) { if (*(uint32_t *)_vboot2_work != VB2_SHARED_DATA_MAGIC) {
/*
* If the system has already been rebooted once, but still returns here,
* instead of rebooting to verstage again, assume that the system is in
* a reboot loop, so halt instead.
*/
if ((!vbnv_cmos_failed()) && cmos_read(CMOS_RECOVERY_BYTE) ==
CMOS_RECOVERY_MAGIC_VAL)
die("Error: Reboot into recovery was unsuccessful. Halting.");
printk(BIOS_ERR, "ERROR: VBOOT workbuf not valid.\n"); printk(BIOS_ERR, "ERROR: VBOOT workbuf not valid.\n");
printk(BIOS_DEBUG, "Signature: %#08x\n", *(uint32_t *)_vboot2_work); printk(BIOS_DEBUG, "Signature: %#08x\n", *(uint32_t *)_vboot2_work);
cmos_init(0); cmos_init(0);
cmos_write(CMOS_RECOVERY_MAGIC_VAL, CMOS_RECOVERY_BYTE); cmos_write(CMOS_RECOVERY_MAGIC_VAL, CMOS_RECOVERY_BYTE);
warm_reset(); warm_reset();