coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
psp_def.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef __AMD_PSP_DEF_H__
4 #define __AMD_PSP_DEF_H__
5 
6 #include <types.h>
7 #include <commonlib/helpers.h>
8 #include <amdblocks/psp.h>
9 
10 /* x86 to PSP commands */
11 #define MBOX_BIOS_CMD_SMM_INFO 0x02
12 #define MBOX_BIOS_CMD_SX_INFO 0x03
13 #define MBOX_BIOS_CMD_SX_INFO_SLEEP_TYPE_MAX 0x07
14 #define MBOX_BIOS_CMD_RSM_INFO 0x04
15 #define MBOX_BIOS_CMD_PSP_QUERY 0x05
16 #define MBOX_BIOS_CMD_BOOT_DONE 0x06
17 #define MBOX_BIOS_CMD_CLEAR_S3_STS 0x07
18 #define MBOX_BIOS_CMD_S3_DATA_INFO 0x08
19 #define MBOX_BIOS_CMD_NOP 0x09
20 #define MBOX_BIOS_CMD_SET_SPL_FUSE 0x2d
21 #define MBOX_BIOS_CMD_QUERY_SPL_FUSE 0x47
22 #define MBOX_BIOS_CMD_ABORT 0xfe
23 
24 /* x86 to PSP commands, v1-only */
25 #define MBOX_BIOS_CMD_DRAM_INFO 0x01
26 #define MBOX_BIOS_CMD_SMU_FW 0x19
27 #define MBOX_BIOS_CMD_SMU_FW2 0x1a
28 
29 #define CORE_2_PSP_MSG_38_OFFSET 0x10998
30 #define CORE_2_PSP_MSG_38_FUSE_SPL BIT(12)
31 
32 /* command/response format, BIOS builds this in memory
33  * mbox_buffer_header: generic header
34  * mbox_buffer: command-specific buffer format
35  *
36  * AMD reference code aligns and pads all buffers to 32 bytes.
37  */
39  u32 size; /* total size of buffer */
40  u32 status; /* command status, filled by PSP if applicable */
42 
43 /*
44  * command-specific buffer definitions: see NDA document #54267
45  * The following commands need a buffer definition if they are to be used.
46  * All other commands will work with the default buffer.
47  * MBOX_BIOS_CMD_SMM_INFO MBOX_BIOS_CMD_PSP_QUERY
48  * MBOX_BIOS_CMD_SX_INFO MBOX_BIOS_CMD_S3_DATA_INFO
49  * MBOX_BIOS_CMD_RSM_INFO
50  */
51 
52 struct mbox_default_buffer { /* command-response buffer unused by command */
54 } __attribute__((packed, aligned(32)));
55 
57  uint64_t smm_base; /* TSEG base */
58  uint64_t smm_mask; /* TSEG mask */
59  uint64_t psp_smm_data_region; /* PSP region in SMM space */
60  uint64_t psp_smm_data_length; /* PSP region length in SMM space */
62 #if CONFIG(SOC_AMD_COMMON_BLOCK_PSP_GEN2)
63  struct smm_register_info smm_reg_info;
64 #endif
67 } __packed;
68 
71  struct smm_req_buffer req;
72 } __attribute__((packed, aligned(32)));
73 
77 } __attribute__((packed, aligned(32)));
78 
82 } __attribute__((packed, aligned(32)));
83 
84 #define PSP_INIT_TIMEOUT 10000 /* 10 seconds */
85 #define PSP_CMD_TIMEOUT 1000 /* 1 second */
86 
87 void psp_print_cmd_status(int cmd_status, struct mbox_buffer_header *header);
88 
89 /* This command needs to be implemented by the generation specific code. */
90 int send_psp_command(u32 command, void *buffer);
91 
92 enum cb_err soc_read_c2p38(uint32_t *msg_38_value);
93 
94 #endif /* __AMD_PSP_DEF_H__ */
struct arm64_kernel_header header
Definition: fit_payload.c:30
cb_err
coreboot error codes
Definition: cb_err.h:15
enum cb_err soc_read_c2p38(uint32_t *msg_38_value)
Definition: psp_gen2.c:120
int send_psp_command(u32 command, void *buffer)
Definition: psp_gen1.c:115
struct mbox_buffer_header __packed
void psp_print_cmd_status(int cmd_status, struct mbox_buffer_header *header)
Definition: psp.c:47
u8 buffer[C2P_BUFFER_MAXSIZE]
Definition: psp_smm.c:18
unsigned int uint32_t
Definition: stdint.h:14
uint32_t u32
Definition: stdint.h:51
unsigned long long uint64_t
Definition: stdint.h:17
uint8_t u8
Definition: stdint.h:45
struct mbox_buffer_header header
Definition: psp_def.h:80
struct mbox_buffer_header header
Definition: psp_def.h:70
struct smm_req_buffer req
Definition: psp_def.h:71
struct mbox_buffer_header header
Definition: psp_def.h:75
struct mbox_buffer_header header
Definition: psp_def.h:53
uint64_t smm_mask
Definition: psp_def.h:58
uint64_t psp_smm_data_length
Definition: psp_def.h:60
uint64_t psp_smm_data_region
Definition: psp_def.h:59
struct smm_trigger_info smm_trig_info
Definition: psp_def.h:61
uint64_t psp_mbox_smm_flag_address
Definition: psp_def.h:66
uint64_t psp_mbox_smm_buffer_address
Definition: psp_def.h:65
uint64_t smm_base
Definition: psp_def.h:57