From d1e8873e08043d78ff0c39a036c9d4ece60288f2 Mon Sep 17 00:00:00 2001 From: Felix Held Date: Tue, 1 Oct 2024 12:40:48 +0200 Subject: soc/amd/common/psp: add and call PSP SMI SPI RPMC function stubs In the case where the x86 owns the SPI controller and the RPMC feature is used, the PSP will send an SMI to the x86 side for it to send the RPMC increment monotonic counter and RPMC request monotonic counter commands to the SPI flash and return the result to the PSP. Add stubs as handlers for those two PSP SMI commands. Change-Id: If6091d2b0002f817922cac4cba373f0f981b646e Signed-off-by: Felix Held Reviewed-on: https://review.coreboot.org/c/coreboot/+/84702 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) Reviewed-by: Ana Cabral --- src/soc/amd/common/block/psp/psp_smi.c | 8 ++++++++ src/soc/amd/common/block/psp/psp_smi_flash.c | 14 ++++++++++++++ src/soc/amd/common/block/psp/psp_smi_flash.h | 2 ++ 3 files changed, 24 insertions(+) (limited to 'src') diff --git a/src/soc/amd/common/block/psp/psp_smi.c b/src/soc/amd/common/block/psp/psp_smi.c index ccd03793c9..5a1a4b9e46 100644 --- a/src/soc/amd/common/block/psp/psp_smi.c +++ b/src/soc/amd/common/block/psp/psp_smi.c @@ -14,6 +14,8 @@ #define MBOX_PSP_CMD_SPI_READ 0x84 #define MBOX_PSP_CMD_SPI_WRITE 0x85 #define MBOX_PSP_CMD_SPI_ERASE 0x86 +#define MBOX_PSP_CMD_SPI_RPMC_INC_MC 0x88 +#define MBOX_PSP_CMD_SPI_RPMC_REQ_MC 0x89 extern struct { uint8_t buffer[P2C_BUFFER_MAXSIZE]; @@ -154,6 +156,12 @@ static void handle_psp_command(void) case MBOX_PSP_CMD_SPI_ERASE: status = psp_smi_spi_erase(buffer); break; + case MBOX_PSP_CMD_SPI_RPMC_INC_MC: + status = psp_smi_spi_rpmc_inc_mc(buffer); + break; + case MBOX_PSP_CMD_SPI_RPMC_REQ_MC: + status = psp_smi_spi_rpmc_req_mc(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 index ab9bc6c7f2..d78db48ddc 100644 --- a/src/soc/amd/common/block/psp/psp_smi_flash.c +++ b/src/soc/amd/common/block/psp/psp_smi_flash.c @@ -269,3 +269,17 @@ enum mbox_p2c_status psp_smi_spi_erase(struct mbox_default_buffer *buffer) return MBOX_PSP_SUCCESS; } + +enum mbox_p2c_status psp_smi_spi_rpmc_inc_mc(struct mbox_default_buffer *buffer) +{ + printk(BIOS_SPEW, "PSP: SPI RPMC increment monotonic counter request\n"); + + return MBOX_PSP_UNSUPPORTED; +} + +enum mbox_p2c_status psp_smi_spi_rpmc_req_mc(struct mbox_default_buffer *buffer) +{ + printk(BIOS_SPEW, "PSP: SPI RPMC request monotonic counter request\n"); + + return MBOX_PSP_UNSUPPORTED; +} diff --git a/src/soc/amd/common/block/psp/psp_smi_flash.h b/src/soc/amd/common/block/psp/psp_smi_flash.h index c9c6a1c9ce..344c9fb429 100644 --- a/src/soc/amd/common/block/psp/psp_smi_flash.h +++ b/src/soc/amd/common/block/psp/psp_smi_flash.h @@ -66,3 +66,5 @@ 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); +enum mbox_p2c_status psp_smi_spi_rpmc_inc_mc(struct mbox_default_buffer *buffer); +enum mbox_p2c_status psp_smi_spi_rpmc_req_mc(struct mbox_default_buffer *buffer); -- cgit v1.2.3