Felix Held has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/40412 )
Change subject: soc/amd/common/psp: refactor psp_print_cmd_status parameters ......................................................................
soc/amd/common/psp: refactor psp_print_cmd_status parameters
psp_print_cmd_status only needs data from the mbox buffer header and not the whole buffer. This avoids type casts when the buffer type isn't mbox_default_buffer.
BUG=b:153677737
Change-Id: I8688b66fefe89fc4f3ce2207d4360ceb2dbaef12 Signed-off-by: Felix Held felix-coreboot@felixheld.de --- M src/soc/amd/common/block/psp/psp.c M src/soc/amd/common/block/psp/psp_def.h M src/soc/amd/common/block/psp/psp_smm.c 3 files changed, 11 insertions(+), 11 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/12/40412/1
diff --git a/src/soc/amd/common/block/psp/psp.c b/src/soc/amd/common/block/psp/psp.c index 479c28b..5f33c82 100644 --- a/src/soc/amd/common/block/psp/psp.c +++ b/src/soc/amd/common/block/psp/psp.c @@ -39,19 +39,19 @@ } }
-static u32 rd_resp_sts(struct mbox_default_buffer *buffer) +static u32 rd_resp_sts(struct mbox_buffer_header *header) { - return read32(&buffer->header.status); + return read32(&header->status); }
/* * Print meaningful status to the console. Caller only passes a pointer to a - * buffer if it's expected to contain its own status. + * buffer header if it's expected to contain its own status. */ -void psp_print_cmd_status(int cmd_status, struct mbox_default_buffer *buffer) +void psp_print_cmd_status(int cmd_status, struct mbox_buffer_header *header) { - if (buffer && rd_resp_sts(buffer)) - printk(BIOS_DEBUG, "buffer status=0x%x ", rd_resp_sts(buffer)); + if (header && rd_resp_sts(header)) + printk(BIOS_DEBUG, "buffer status=0x%x ", rd_resp_sts(header));
if (cmd_status) printk(BIOS_DEBUG, "%s\n", status_to_string(cmd_status)); @@ -77,7 +77,7 @@ cmd_status = send_psp_command(MBOX_BIOS_CMD_DRAM_INFO, &buffer);
/* buffer's status shouldn't change but report it if it does */ - psp_print_cmd_status(cmd_status, &buffer); + psp_print_cmd_status(cmd_status, &buffer.header);
return cmd_status; } @@ -101,7 +101,7 @@ cmd_status = send_psp_command(MBOX_BIOS_CMD_BOOT_DONE, &buffer);
/* buffer's status shouldn't change but report it if it does */ - psp_print_cmd_status(cmd_status, &buffer); + psp_print_cmd_status(cmd_status, &buffer.header); }
BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_BOOT, BS_ON_ENTRY, diff --git a/src/soc/amd/common/block/psp/psp_def.h b/src/soc/amd/common/block/psp/psp_def.h index 7772ca6..7bdec21 100644 --- a/src/soc/amd/common/block/psp/psp_def.h +++ b/src/soc/amd/common/block/psp/psp_def.h @@ -109,7 +109,7 @@ #define PSP_INIT_TIMEOUT 10000 /* 10 seconds */ #define PSP_CMD_TIMEOUT 1000 /* 1 second */
-void psp_print_cmd_status(int cmd_status, struct mbox_default_buffer *buffer); +void psp_print_cmd_status(int cmd_status, struct mbox_buffer_header *header);
/* This command needs to be implemented by the generation specific code. */ int send_psp_command(u32 command, void *buffer); diff --git a/src/soc/amd/common/block/psp/psp_smm.c b/src/soc/amd/common/block/psp/psp_smm.c index 26a056d..6cd89bc 100644 --- a/src/soc/amd/common/block/psp/psp_smm.c +++ b/src/soc/amd/common/block/psp/psp_smm.c @@ -72,7 +72,7 @@ clear_smm_flag();
/* buffer's status shouldn't change but report it if it does */ - psp_print_cmd_status(cmd_status, (struct mbox_default_buffer *)&buffer); + psp_print_cmd_status(cmd_status, &buffer.header);
return cmd_status; } @@ -101,5 +101,5 @@ clear_smm_flag();
/* buffer's status shouldn't change but report it if it does */ - psp_print_cmd_status(cmd_status, (struct mbox_default_buffer *)buffer); + psp_print_cmd_status(cmd_status, &buffer->header); }