Debian Codegraph @

src/soc/amd/common/block/psp/spl_fuse.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <bootstate.h>
4 #include <console/console.h>
5 #include <types.h>
6 #include "psp_def.h"
7
8 static void psp_set_spl_fuse(void *unused)
9 {
10 int cmd_status = 0;
11 uint32_t c2p38 = 0;
12 struct mbox_cmd_late_spl_buffer buffer = {
13 .header = {
14 .size = sizeof(buffer)
15 }
16 };
17
18 if (soc_read_c2p38(&c2p38) != CB_SUCCESS) {
19 printk(BIOS_ERR, "PSP: Failed to get base address.\n");
20 return;
21 }
22
23 if (c2p38 & CORE_2_PSP_MSG_38_FUSE_SPL) {
24 printk(BIOS_DEBUG, "PSP: SPL Fusing may be updated.\n");
25 } else {
26 printk(BIOS_DEBUG, "PSP: SPL Fusing not currently required.\n");
27 return;
28 }
29
30 if (c2p38 & CORE_2_PSP_MSG_38_SPL_FUSE_ERROR) {
31 printk(BIOS_ERR, "PSP: SPL Table does not meet fuse requirements.\n");
32 return;
33 }
34
35 if (c2p38 & CORE_2_PSP_MSG_38_SPL_ENTRY_ERROR) {
36 printk(BIOS_ERR, "PSP: Critical SPL entry missing or current firmware does"
37 " not meet requirements.\n");
38 return;
39 }
40
41 if (c2p38 & CORE_2_PSP_MSG_38_SPL_ENTRY_MISSING) {
42 printk(BIOS_ERR, "PSP: Table of critical SPL values is missing.\n");
43 return;
44 }
45
46 if (!CONFIG(PERFORM_SPL_FUSING))
47 return;
48
49 printk(BIOS_DEBUG, "PSP: SPL Fusing Update Requested.\n");
50 cmd_status = send_psp_command(MBOX_BIOS_CMD_SET_SPL_FUSE, &buffer);
51 psp_print_cmd_status(cmd_status, NULL);
52 }
53
54 BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_LOAD, BS_ON_ENTRY, psp_set_spl_fuse, NULL);