[coreboot-gerrit] Change in coreboot[master]: (WIP) soc/amd/common: Add PSP BIOS SMI info cmd

frank vibrans (Code Review) gerrit at coreboot.org
Thu Oct 12 18:36:41 CEST 2017


frank vibrans has uploaded this change for review. ( https://review.coreboot.org/21990


Change subject: (WIP) soc/amd/common: Add PSP BIOS SMI info cmd
......................................................................

(WIP) soc/amd/common: Add PSP BIOS SMI info cmd

Add BIOS SMI info command to PSP BIOS-to-PSP communications path.  Gives
PSP information about its buffer in SMM space and how to generate an SMI
for PSP-to-BIOS communications.

Change-Id: I70d15ec6cd3a0bab12d8d284032c24cdaaa50cb3
Signed-off-by: Frank Vibrans <frank.vibrans at scarletltd.com>
---
M src/soc/amd/common/block/include/amdblocks/psp.h
M src/soc/amd/common/block/psp/psp.c
2 files changed, 56 insertions(+), 0 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/90/21990/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..96b1a11 100644
--- a/src/soc/amd/common/block/include/amdblocks/psp.h
+++ b/src/soc/amd/common/block/include/amdblocks/psp.h
@@ -70,6 +70,29 @@
 	struct mbox_buffer_header header;
 } __attribute__((packed,aligned(32)));
 
+/* Buffer layout for BIOS command SMM info
+ */
+struct smm_trigger_info {
+	u64 address;
+	u32 address_type;
+	u32 value_width;
+	u32 value_and_mask;
+	u32 value_or_mask;
+} __attribute__((packed));
+
+struct smm_req_buffer {
+	u64 smm_base;
+	u64 smm_length;
+	u64 psp_smm_data_base;
+	u64 psp_smm_data_length;
+	struct smm_trigger_info smm_trig_info;
+} __attribute__((packed));
+
+struct mbox_smm_info_buffer {
+	struct mbox_buffer_header header;
+	struct smm_req_buffer req;
+} __attribute__((packed));
+
 /* send_psp_command() error codes */
 #define PSPSTS_SUCCESS      0
 #define PSPSTS_NOBASE       1
@@ -93,5 +116,7 @@
 
 /* BIOS-to-PSP functions return 0 if successful, else negative value */
 int psp_notify_dram(void);
+int psp_notify_smm_info(uintptr_t base, size_t length, uintptr_t psp_data_base,
+		size_t psp_data_length, struct smm_trigger_info *smm_trig_info);
 
 #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..ae90621 100644
--- a/src/soc/amd/common/block/psp/psp.c
+++ b/src/soc/amd/common/block/psp/psp.c
@@ -13,6 +13,7 @@
  * GNU General Public License for more details.
  */
 
+#include <stddef.h>
 #include <arch/io.h>
 #include <timer.h>
 #include <device/pci_def.h>
@@ -199,3 +200,33 @@
 
 	return cmd_status;
 }
+
+/*
+ * Inform the PSP of the system's System Management Mode settings. This
+ * function is called when the system is in SMM.
+ */
+int psp_notify_smm_info(uintptr_t base, size_t length, uintptr_t psp_data_base,
+		size_t psp_data_length, struct smm_trigger_info *smm_trig_info)
+{
+	struct mbox_smm_info_buffer buffer;
+	int cmd_status;
+
+	printk(BIOS_DEBUG, "PSP: Notify SMM info... ");
+
+	buffer.header.size = sizeof(struct mbox_smm_info_buffer);
+	buffer.header.status = 0;
+	buffer.req.smm_base = base;
+	buffer.req.smm_length = length;
+	buffer.req.psp_smm_data_base = psp_data_base;
+	buffer.req.psp_smm_data_length = psp_data_length;
+	buffer.req.smm_trig_info = *smm_trig_info;
+
+	cmd_status = send_psp_command(MBOX_BIOS_CMD_SMM_INFO, &buffer);
+
+	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/21990
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I70d15ec6cd3a0bab12d8d284032c24cdaaa50cb3
Gerrit-Change-Number: 21990
Gerrit-PatchSet: 1
Gerrit-Owner: frank vibrans <frank.vibrans at scarletltd.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20171012/e315ef6e/attachment-0001.html>


More information about the coreboot-gerrit mailing list