[coreboot-gerrit] Change in coreboot[master]: amd/stoneyridge: Check SMI command address before reading

Marshall Dawson (Code Review) gerrit at coreboot.org
Thu Sep 28 18:27:46 CEST 2017


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


Change subject: amd/stoneyridge: Check SMI command address before reading
......................................................................

amd/stoneyridge: Check SMI command address before reading

Use the currently programmed address of the SMI pommand port before
checking the passed command.  This ensures we're reading the right
port in case the port was relocated without our knowledge.

Change-Id: I8a3ca285d3a9afd4a107cd471c202abf03f372ac
Signed-off-by: Marshall Dawson <marshalldawson3rd at gmail.com>
---
M src/soc/amd/stoneyridge/Makefile.inc
M src/soc/amd/stoneyridge/smi_util.c
M src/soc/amd/stoneyridge/smihandler.c
3 files changed, 8 insertions(+), 2 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/44/21744/1

diff --git a/src/soc/amd/stoneyridge/Makefile.inc b/src/soc/amd/stoneyridge/Makefile.inc
index 28b3244..9041c46 100644
--- a/src/soc/amd/stoneyridge/Makefile.inc
+++ b/src/soc/amd/stoneyridge/Makefile.inc
@@ -94,6 +94,7 @@
 smm-y += smi_util.c
 smm-y += tsc_freq.c
 smm-y += uart.c
+smm-y += southbridge.c
 
 CPPFLAGS_common += -I$(src)/soc/amd/stoneyridge
 CPPFLAGS_common += -I$(src)/soc/amd/stoneyridge/include
diff --git a/src/soc/amd/stoneyridge/smi_util.c b/src/soc/amd/stoneyridge/smi_util.c
index 68e792c..833e6e3 100644
--- a/src/soc/amd/stoneyridge/smi_util.c
+++ b/src/soc/amd/stoneyridge/smi_util.c
@@ -6,6 +6,7 @@
  */
 
 #include <console/console.h>
+#include <soc/southbridge.h>
 #include <soc/smi.h>
 
 static void configure_smi(uint8_t smi_num, uint8_t mode)
@@ -73,3 +74,8 @@
 {
 	configure_smi(SMITYPE_SMI_CMD_PORT, SMI_MODE_SMI);
 }
+
+uint16_t pm_acpi_smi_cmd_port(void)
+{
+	return pm_read16(PM_ACPI_SMI_CMD);
+}
diff --git a/src/soc/amd/stoneyridge/smihandler.c b/src/soc/amd/stoneyridge/smihandler.c
index 45dada5..c3c85e3 100644
--- a/src/soc/amd/stoneyridge/smihandler.c
+++ b/src/soc/amd/stoneyridge/smihandler.c
@@ -5,7 +5,6 @@
  * Subject to the GNU GPL v2, or (at your option) any later version.
  */
 
-
 #include <console/console.h>
 #include <cpu/x86/smm.h>
 #include <delay.h>
@@ -27,7 +26,7 @@
 static void sb_apmc_smi_handler(void)
 {
 	u32 reg32;
-	const uint8_t cmd = inb(APM_CNT);
+	const uint8_t cmd = inb(pm_acpi_smi_cmd_port());
 
 	switch (cmd) {
 	case APM_CNT_ACPI_ENABLE:

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

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8a3ca285d3a9afd4a107cd471c202abf03f372ac
Gerrit-Change-Number: 21744
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/20170928/e7586f1d/attachment.html>


More information about the coreboot-gerrit mailing list