[coreboot-gerrit] Change in coreboot[master]: WIP soc/amd/common: Add PSP command to load fw blobs

Marshall Dawson (Code Review) gerrit at coreboot.org
Mon Oct 16 23:55:37 CEST 2017


Marshall Dawson has uploaded this change for review. ( https://review.coreboot.org/22056


Change subject: WIP soc/amd/common: Add PSP command to load fw blobs
......................................................................

WIP soc/amd/common: Add PSP command to load fw blobs

An upcoming PSP firmware change will allow coreboot to load the two
SMU firmware blobs (one runs in SRAM and the other in DRAM).  The
traditional method is for the PSP to control most of the process,
e.g. loading the SRAM version prio to releasing the x86 reset.

Add a new command that can instruct the PSP to load the firmware blob
from a location in the flash.

The definition for commands 19 and 1a differ from others in that they
do not use a command/response buffer.  Instead, the PSP will look in
the command/response pointer registers directly for the blob's
address.

BUG=b:66339938

Change-Id: I8431af341930f45ac74f471628b4dc4ede7735f4
Signed-off-by: Marshall Dawson <marshalldawson3rd at gmail.com>
---
M src/soc/amd/common/block/include/amdblocks/psp.h
M src/soc/amd/common/block/psp/psp.c
2 files changed, 30 insertions(+), 0 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/56/22056/1

diff --git a/src/soc/amd/common/block/include/amdblocks/psp.h b/src/soc/amd/common/block/include/amdblocks/psp.h
index 42b9fb7..d52a4e6 100644
--- a/src/soc/amd/common/block/include/amdblocks/psp.h
+++ b/src/soc/amd/common/block/include/amdblocks/psp.h
@@ -31,6 +31,8 @@
 #define MBOX_BIOS_CMD_CLEAR_S3_STS 0x07
 #define MBOX_BIOS_CMD_C3_DATA_INFO 0x08
 #define MBOX_BIOS_CMD_NOP          0x09
+#define MBOX_BIOS_CMD_SMU_FW       0x19
+#define MBOX_BIOS_CMD_SMU_FW2      0x1a
 #define MBOX_BIOS_CMD_ABORT        0xfe
 
 /* generic PSP interface status */
@@ -78,6 +80,7 @@
 #define PSPSTS_SEND_ERROR   4
 #define PSPSTS_INIT_TIMEOUT 5
 #define PSPSTS_CMD_TIMEOUT  6
+#define PSPSTS_INVALID_BLOB 7
 
 #if !defined(__SIMPLE_DEVICE__)
 #include <device/device.h>
@@ -93,5 +96,6 @@
 
 /* BIOS-to-PSP functions return 0 if successful, else negative value */
 int psp_notify_dram(void);
+int psp_load_blob(u32 type, void *addr);
 
 #endif /* __AMD_PSP_H__ */
diff --git a/src/soc/amd/common/block/psp/psp.c b/src/soc/amd/common/block/psp/psp.c
index 788de2c..0f83c31 100644
--- a/src/soc/amd/common/block/psp/psp.c
+++ b/src/soc/amd/common/block/psp/psp.c
@@ -199,3 +199,29 @@
 
 	return cmd_status;
 }
+
+/*
+ * Tell the PSP to load a firmware blob from a location in the BIOS image.
+ */
+int psp_load_blob(u32 type, void *addr)
+{
+	int cmd_status;
+
+	/* only two types currently supported */
+	if (type != MBOX_BIOS_CMD_SMU_FW && type != MBOX_BIOS_CMD_SMU_FW2) {
+		printk(BIOS_ERR, "BUG: Invalid PSP blob type %x\n", type);
+		return PSPSTS_INVALID_BLOB;
+	}
+
+	printk(BIOS_DEBUG, "PSP: Load blob type %x from @%p... ", type, addr);
+
+	/* Blob commands use the buffer registers as data, not pointer to buf */
+	cmd_status = send_psp_command(type, addr);
+
+	if (cmd_status)
+		printk(BIOS_DEBUG, "%s\n", status_to_string(cmd_status));
+	else
+		printk(BIOS_DEBUG, "OK\n");
+
+	return cmd_status;
+}

-- 
To view, visit https://review.coreboot.org/22056
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8431af341930f45ac74f471628b4dc4ede7735f4
Gerrit-Change-Number: 22056
Gerrit-PatchSet: 1
Gerrit-Owner: Marshall Dawson <marshalldawson3rd at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20171016/dc5adb23/attachment-0001.html>


More information about the coreboot-gerrit mailing list