Attention is currently required from: ritul guru.
Hello ritul guru,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/83756?usp=email
to review the following change.
Change subject: [WIP] soc/amd/common/psp: add and call PSP SMI SPI access function stubs ......................................................................
[WIP] soc/amd/common/psp: add and call PSP SMI SPI access function stubs
Add stub functions for the SPI flash access from the PSP SMI handler and call them for the corresponding P2C mailbox commands.
Parts of this patch are taken from CB:65523.
Document #55758 Rev. 2.04 was used as a reference.
Test=TODO, but when selecting SOC_AMD_COMMON_BLOCK_PSP_SMI, Mandolin still builds
Signed-off-by: Felix Held felix-coreboot@felixheld.de Signed-off-by: Ritul Guru ritul.bits@gmail.com Change-Id: Iedbc9d41eb0d4e8d81eeba9c01281161eb839991 --- M src/soc/amd/common/block/psp/Makefile.mk M src/soc/amd/common/block/psp/psp_def.h M src/soc/amd/common/block/psp/psp_smi.c A src/soc/amd/common/block/psp/psp_smi_flash.c 4 files changed, 49 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/56/83756/1
diff --git a/src/soc/amd/common/block/psp/Makefile.mk b/src/soc/amd/common/block/psp/Makefile.mk index c16a73b..b72343c 100644 --- a/src/soc/amd/common/block/psp/Makefile.mk +++ b/src/soc/amd/common/block/psp/Makefile.mk @@ -5,6 +5,7 @@ ramstage-y += psp.c smm-y += psp.c smm-$(CONFIG_SOC_AMD_COMMON_BLOCK_PSP_SMI) += psp_smi.c +smm-$(CONFIG_SOC_AMD_COMMON_BLOCK_PSP_SMI) += psp_smi_flash.c smm-y += psp_smm.c
bootblock-y += psp_efs.c diff --git a/src/soc/amd/common/block/psp/psp_def.h b/src/soc/amd/common/block/psp/psp_def.h index d58aa0b..c2b2fca 100644 --- a/src/soc/amd/common/block/psp/psp_def.h +++ b/src/soc/amd/common/block/psp/psp_def.h @@ -133,4 +133,9 @@
void enable_psp_smi(void);
+enum mbox_p2c_status psp_smi_spi_get_info(struct mbox_default_buffer *buffer); +enum mbox_p2c_status psp_smi_spi_read(struct mbox_default_buffer *buffer); +enum mbox_p2c_status psp_smi_spi_write(struct mbox_default_buffer *buffer); +enum mbox_p2c_status psp_smi_spi_erase(struct mbox_default_buffer *buffer); + #endif /* __AMD_PSP_DEF_H__ */ diff --git a/src/soc/amd/common/block/psp/psp_smi.c b/src/soc/amd/common/block/psp/psp_smi.c index b5a8cf4..43e82d4 100644 --- a/src/soc/amd/common/block/psp/psp_smi.c +++ b/src/soc/amd/common/block/psp/psp_smi.c @@ -8,6 +8,12 @@ #include <types.h> #include "psp_def.h"
+/* PSP to x86 commands */ +#define MBOX_PSP_CMD_SPI_INFO 0x83 +#define MBOX_PSP_CMD_SPI_READ 0x84 +#define MBOX_PSP_CMD_SPI_WRITE 0x85 +#define MBOX_PSP_CMD_SPI_ERASE 0x86 + extern struct { u8 buffer[P2C_BUFFER_MAXSIZE]; } __aligned(32) p2c_buffer; @@ -126,6 +132,7 @@ { enum mbox_p2c_status status; u32 cmd; + struct mbox_default_buffer *const buffer = get_psp_command_buffer();
status = check_psp_command(); if (status != MBOX_PSP_SUCCESS) @@ -134,6 +141,18 @@ cmd = get_psp_command();
switch (cmd) { + case MBOX_PSP_CMD_SPI_INFO: + status = psp_smi_spi_get_info(buffer); + break; + case MBOX_PSP_CMD_SPI_READ: + status = psp_smi_spi_read(buffer); + break; + case MBOX_PSP_CMD_SPI_WRITE: + status = psp_smi_spi_write(buffer); + break; + case MBOX_PSP_CMD_SPI_ERASE: + status = psp_smi_spi_erase(buffer); + break; default: printk(BIOS_ERR, "PSP: Unknown command %d\n", cmd); status = MBOX_PSP_UNSUPPORTED; diff --git a/src/soc/amd/common/block/psp/psp_smi_flash.c b/src/soc/amd/common/block/psp/psp_smi_flash.c new file mode 100644 index 0000000..b624b7b --- /dev/null +++ b/src/soc/amd/common/block/psp/psp_smi_flash.c @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <types.h> +#include "psp_def.h" + +enum mbox_p2c_status psp_smi_spi_get_info(struct mbox_default_buffer *buffer) +{ + return MBOX_PSP_UNSUPPORTED; +} + +enum mbox_p2c_status psp_smi_spi_read(struct mbox_default_buffer *buffer) +{ + return MBOX_PSP_UNSUPPORTED; +} + +enum mbox_p2c_status psp_smi_spi_write(struct mbox_default_buffer *buffer) +{ + return MBOX_PSP_UNSUPPORTED; +} + +enum mbox_p2c_status psp_smi_spi_erase(struct mbox_default_buffer *buffer) +{ + return MBOX_PSP_UNSUPPORTED; +}