soc/amd/picasso: If psp_verstage is in RO, don't reset on error

If there's already been an error and PSP_verstage is booting to RO,
don't reset the system.  It may be that the error is fatal, but if the
system is stuck, don't intentionally force it into a reboot loop.

BUG=None
TEST=Force an error, still boots to RO instead of going into a boot loop

Signed-off-by: Martin Roth <martinroth@chromium.org>
Change-Id: Ibb6794fefe9d482850ca31b1d3b0d145fcd8bb8f
Reviewed-on: https://review.coreboot.org/c/coreboot/+/44652
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Martin Roth 2020-08-20 17:25:37 -06:00 committed by Aaron Durbin
parent 7452a2fdef
commit c9689e0591
1 changed files with 14 additions and 8 deletions

View File

@ -29,6 +29,16 @@ static void reboot_into_recovery(struct vb2_context *ctx, uint32_t subcode)
subcode += PSP_VBOOT_ERROR_SUBCODE; subcode += PSP_VBOOT_ERROR_SUBCODE;
svc_write_postcode(subcode); svc_write_postcode(subcode);
/*
* If there's an error but the PSP_verstage is already booting to RO,
* don't reset the system. It may be that the error is fatal, but if
* the system is stuck, don't intentionally force it into a reboot loop.
*/
if (ctx->flags & VB2_CONTEXT_RECOVERY_MODE) {
printk(BIOS_ERR, "Already in recovery mode. Staying in RO.\n");
return;
}
vb2api_fail(ctx, VB2_RECOVERY_RO_UNSPECIFIED, (int)subcode); vb2api_fail(ctx, VB2_RECOVERY_RO_UNSPECIFIED, (int)subcode);
vboot_save_data(ctx); vboot_save_data(ctx);
@ -231,21 +241,20 @@ void Main(void)
verstage_main(); verstage_main();
vb2api_relocate(_vboot2_work, _vboot2_work, VB2_FIRMWARE_WORKBUF_RECOMMENDED_SIZE, ctx = vboot_get_context();
&ctx);
retval = check_cmos_recovery(); retval = check_cmos_recovery();
if (retval) if (retval)
goto err; reboot_into_recovery(ctx, retval);
post_code(POSTCODE_SAVE_BUFFERS); post_code(POSTCODE_SAVE_BUFFERS);
retval = save_buffers(&ctx); retval = save_buffers(&ctx);
if (retval) if (retval)
goto err; reboot_into_recovery(ctx, retval);
post_code(POSTCODE_UPDATE_BOOT_REGION); post_code(POSTCODE_UPDATE_BOOT_REGION);
retval = update_boot_region(ctx); retval = update_boot_region(ctx);
if (retval) if (retval)
goto err; reboot_into_recovery(ctx, retval);
post_code(POSTCODE_UNMAP_SPI_ROM); post_code(POSTCODE_UNMAP_SPI_ROM);
if (boot_dev.base) { if (boot_dev.base) {
@ -260,9 +269,6 @@ void Main(void)
printk(BIOS_DEBUG, "Leaving verstage on PSP\n"); printk(BIOS_DEBUG, "Leaving verstage on PSP\n");
svc_exit(retval); svc_exit(retval);
err:
reboot_into_recovery(ctx, retval);
} }
const struct region_device *boot_device_ro(void) const struct region_device *boot_device_ro(void)