Martin Roth | 4b34193 | 2020-10-06 15:29:28 -0600 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <amdblocks/reset.h> |
| 4 | #include <console/console.h> |
| 5 | #include <pc80/mc146818rtc.h> |
| 6 | #include <security/vboot/vbnv.h> |
| 7 | #include <security/vboot/symbols.h> |
| 8 | #include <soc/psp_transfer.h> |
| 9 | #include <2struct.h> |
| 10 | |
| 11 | void verify_psp_transfer_buf(void) |
| 12 | { |
| 13 | if (*(uint32_t *)_vboot2_work == VB2_SHARED_DATA_MAGIC) { |
| 14 | cmos_write(0x00, CMOS_RECOVERY_BYTE); |
| 15 | return; |
| 16 | } |
| 17 | |
| 18 | /* |
| 19 | * If CMOS is valid and the system has already been rebooted once, but |
| 20 | * still returns here, instead of rebooting to verstage again, assume |
| 21 | * that the system is in a reboot loop and halt. |
| 22 | */ |
| 23 | if ((!vbnv_cmos_failed()) && cmos_read(CMOS_RECOVERY_BYTE) == |
| 24 | CMOS_RECOVERY_MAGIC_VAL) |
| 25 | die("Error: Reboot into recovery was unsuccessful. Halting."); |
| 26 | |
| 27 | printk(BIOS_ERR, "ERROR: VBOOT workbuf not valid.\n"); |
| 28 | printk(BIOS_DEBUG, "Signature: %#08x\n", *(uint32_t *)_vboot2_work); |
| 29 | cmos_init(0); |
| 30 | cmos_write(CMOS_RECOVERY_MAGIC_VAL, CMOS_RECOVERY_BYTE); |
| 31 | warm_reset(); |
| 32 | } |