summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc')
-rw-r--r--src/soc/amd/common/block/psp/Makefile.mk1
-rw-r--r--src/soc/amd/common/block/psp/psp_def.h5
-rw-r--r--src/soc/amd/common/block/psp/psp_smi.c19
-rw-r--r--src/soc/amd/common/block/psp/psp_smi_flash.c33
4 files changed, 58 insertions, 0 deletions
diff --git a/src/soc/amd/common/block/psp/Makefile.mk b/src/soc/amd/common/block/psp/Makefile.mk
index c16a73b698..b72343c365 100644
--- a/src/soc/amd/common/block/psp/Makefile.mk
+++ b/src/soc/amd/common/block/psp/Makefile.mk
@@ -5,6 +5,7 @@ romstage-y += psp.c
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 d58aa0b82e..c2b2fca8d8 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 @@ enum cb_err soc_read_c2p38(uint32_t *msg_38_value);
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 e6cc1dc96c..66e84d13a6 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 @@ static void handle_psp_command(void)
{
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 @@ static void handle_psp_command(void)
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 0000000000..54edf1446b
--- /dev/null
+++ b/src/soc/amd/common/block/psp/psp_smi_flash.c
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <console/console.h>
+#include <types.h>
+#include "psp_def.h"
+
+enum mbox_p2c_status psp_smi_spi_get_info(struct mbox_default_buffer *buffer)
+{
+ printk(BIOS_SPEW, "PSP: SPI info request\n");
+
+ return MBOX_PSP_UNSUPPORTED;
+}
+
+enum mbox_p2c_status psp_smi_spi_read(struct mbox_default_buffer *buffer)
+{
+ printk(BIOS_SPEW, "PSP: SPI read request\n");
+
+ return MBOX_PSP_UNSUPPORTED;
+}
+
+enum mbox_p2c_status psp_smi_spi_write(struct mbox_default_buffer *buffer)
+{
+ printk(BIOS_SPEW, "PSP: SPI write request\n");
+
+ return MBOX_PSP_UNSUPPORTED;
+}
+
+enum mbox_p2c_status psp_smi_spi_erase(struct mbox_default_buffer *buffer)
+{
+ printk(BIOS_SPEW, "PSP: SPI erase request\n");
+
+ return MBOX_PSP_UNSUPPORTED;
+}