Richard Spiegel has uploaded this change for review. ( https://review.coreboot.org/25740
Change subject: soc/amd/common/block/include/amdblocks/psp.h: Define mailbox buffers ......................................................................
soc/amd/common/block/include/amdblocks/psp.h: Define mailbox buffers
The Platform Security Processor use predefined buffers to some of the commands, though not all (some commands are just command and status, which forms the header of any command). This buffer is placed in a memory area called the mailbox, and its address is passed to the psp through special registers. Commands that don't need a special buffer use the default buffer, which only contains the header. Define the special buffers, and create a union of them, including the default buffer.
BUG=b:77940747 TEST=None.
Change-Id: I6143d7e85476061395962b95ad8864ac32a1d4a3 Signed-off-by: Richard Spiegel richard.spiegel@silverbackltd.com --- M src/soc/amd/common/block/include/amdblocks/psp.h 1 file changed, 64 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/40/25740/1
diff --git a/src/soc/amd/common/block/include/amdblocks/psp.h b/src/soc/amd/common/block/include/amdblocks/psp.h index 4c9878a..ad76990 100644 --- a/src/soc/amd/common/block/include/amdblocks/psp.h +++ b/src/soc/amd/common/block/include/amdblocks/psp.h @@ -29,7 +29,7 @@ #define MBOX_BIOS_CMD_PSP_QUERY 0x05 #define MBOX_BIOS_CMD_BOOT_DONE 0x06 #define MBOX_BIOS_CMD_CLEAR_S3_STS 0x07 -#define MBOX_BIOS_CMD_C3_DATA_INFO 0x08 +#define MBOX_BIOS_CMD_S3_DATA_INFO 0x08 #define MBOX_BIOS_CMD_NOP 0x09 #define MBOX_BIOS_CMD_SMU_FW 0x19 #define MBOX_BIOS_CMD_SMU_FW2 0x1a @@ -64,13 +64,72 @@ u32 status; /* command status, filled by PSP if applicable */ } __packed;
-/* command-specific buffer definitions: see NDA document #54267 - * todo: create new definitions here for additional c2p_mbox_command commands - */ +/* command-specific buffer definitions: see NDA document #54267 */
struct mbox_default_buffer { /* command-response buffer unused by command */ struct mbox_buffer_header header; -} __attribute__((packed,aligned(32))); +} __attribute__((packed, aligned(32))); + +struct smm_trigger_buffer { + u64 address; + u32 address_type; + u32 value_width; + u32 value_and_mask; + u32 value_or_mask; +} __packed; + +struct smm_req_buffer { + u64 smm_base; + u64 smm_length; + u64 psp_data_region; + u64 psp_data_length; + struct smm_trigger_buffer trigger; +} __packed; + +/* command-response buffer used by command MBOX_BIOS_CMD_SMM_INFO */ +struct mbox_smm_buffer { + struct mbox_buffer_header header; + struct smm_req_buffer buffer; +} __attribute__((packed, aligned(32))); + +/* command-response buffer used by command MBOX_BIOS_CMD_SX_INFO */ +struct mbox_sx_buffer { + struct mbox_buffer_header header; + u8 SleepType; +} __attribute__((packed, aligned(32))); + +/* command-response buffer used by command MBOX_BIOS_CMD_RSM_INFO */ +struct mbox_rsm_buffer { + struct mbox_buffer_header header; + u64 vector_address; + u64 vector_length; +} __attribute__((packed, aligned(32))); + +/* command-response buffer used by command MBOX_BIOS_CMD_PSP_QUERY */ +struct mbox_psp_query_buffer { + struct mbox_buffer_header header; + u32 capabilities; +} __attribute__((packed, aligned(32))); + +struct s3_data_req_buffer { + u64 s3_restore_buffer_base; + u64 s3_restore_buffer_size; +} __packed; + +/* command-response buffer used by command MBOX_BIOS_CMD_S3_DATA_INFO */ +struct mbox_s3_data_buffer { + struct mbox_buffer_header header; + s3_data_req_buffer request; +} __attribute__((packed, aligned(32))); + +union mbox_buffer { + mbox_default_buffer default; + mbox_smm_buffer smm; + mbox_sx_buffer sx; + mbox_rsm_buffer resume; + mbox_psp_query_buffer query; + mbox_s3_data_buffer s3_data; +};
/* send_psp_command() error codes */ #define PSPSTS_SUCCESS 0