blob: 3fbc4ef608549b14bc894018c196a57a47934a99 [file] [log] [blame]
Martin Roth4b341932020-10-06 15:29:28 -06001/* SPDX-License-Identifier: GPL-2.0-only */
2
3#include <amdblocks/reset.h>
Martin Roth0f3ef702020-10-06 18:11:12 -06004#include <bl_uapp/bl_syscall_public.h>
Martin Roth4b341932020-10-06 15:29:28 -06005#include <console/console.h>
6#include <pc80/mc146818rtc.h>
7#include <security/vboot/vbnv.h>
8#include <security/vboot/symbols.h>
9#include <soc/psp_transfer.h>
10#include <2struct.h>
11
12void verify_psp_transfer_buf(void)
13{
14 if (*(uint32_t *)_vboot2_work == VB2_SHARED_DATA_MAGIC) {
15 cmos_write(0x00, CMOS_RECOVERY_BYTE);
16 return;
17 }
18
19 /*
20 * If CMOS is valid and the system has already been rebooted once, but
21 * still returns here, instead of rebooting to verstage again, assume
22 * that the system is in a reboot loop and halt.
23 */
24 if ((!vbnv_cmos_failed()) && cmos_read(CMOS_RECOVERY_BYTE) ==
25 CMOS_RECOVERY_MAGIC_VAL)
26 die("Error: Reboot into recovery was unsuccessful. Halting.");
27
28 printk(BIOS_ERR, "ERROR: VBOOT workbuf not valid.\n");
29 printk(BIOS_DEBUG, "Signature: %#08x\n", *(uint32_t *)_vboot2_work);
30 cmos_init(0);
31 cmos_write(CMOS_RECOVERY_MAGIC_VAL, CMOS_RECOVERY_BYTE);
32 warm_reset();
33}
Martin Roth0f3ef702020-10-06 18:11:12 -060034
35void show_psp_transfer_info(void)
36{
37 struct transfer_info_struct *info = (struct transfer_info_struct *)
38 (void *)(uintptr_t)_transfer_buffer;
39
40 if (info->magic_val == TRANSFER_MAGIC_VAL) {
41 if ((info->psp_info & PSP_INFO_VALID) == 0) {
42 printk(BIOS_INFO, "No PSP info found in transfer buffer.\n");
43 return;
44 }
45
46 printk(BIOS_INFO, "PSP boot mode: %s\n",
47 info->psp_info & PSP_INFO_PRODUCTION_MODE ?
48 "Production" : "Development");
49 printk(BIOS_INFO, "Silicon level: %s\n",
50 info->psp_info & PSP_INFO_PRODUCTION_SILICON ?
51 "Production" : "Pre-Production");
52 }
53}