[coreboot] Patch set updated for coreboot: f6a4b00 SMM: Fix mainboard SMI handlers to not use global variables

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Thu Nov 8 20:31:40 CET 2012


Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1767

-gerrit

commit f6a4b0045713c9e29f76cb29848193ad1924cab6
Author: Duncan Laurie <dlaurie at chromium.org>
Date:   Wed Oct 3 19:16:08 2012 -0700

    SMM: Fix mainboard SMI handlers to not use global variables
    
    This changes all the current boards based on bd82x6x to use
    the new accessor functions for GNVS and pmbase instead of
    expecting a global variable.
    
    Change-Id: I6155045e3c59d60f57f691aecc13393b1ad04512
    Signed-off-by: Duncan Laurie <dlaurie at chromium.org>
---
 src/mainboard/intel/emeraldlake2/mainboard_smi.c |  7 +------
 src/mainboard/samsung/lumpy/mainboard_smi.c      | 12 +++---------
 src/mainboard/samsung/stumpy/mainboard_smi.c     |  7 +------
 3 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/src/mainboard/intel/emeraldlake2/mainboard_smi.c b/src/mainboard/intel/emeraldlake2/mainboard_smi.c
index 340562a..03c505b 100644
--- a/src/mainboard/intel/emeraldlake2/mainboard_smi.c
+++ b/src/mainboard/intel/emeraldlake2/mainboard_smi.c
@@ -27,17 +27,12 @@
 #include <northbridge/intel/sandybridge/sandybridge.h>
 #include <cpu/intel/model_206ax/model_206ax.h>
 
-/* The southbridge SMI handler checks whether gnvs has a
- * valid pointer before calling the trap handler
- */
-extern global_nvs_t *gnvs;
-
 int mainboard_io_trap_handler(int smif)
 {
 	switch (smif) {
 	case 0x99:
 		printk(BIOS_DEBUG, "Sample\n");
-		gnvs->smif = 0;
+		smm_get_gnvs()->smif = 0;
 		break;
 	default:
 		return 0;
diff --git a/src/mainboard/samsung/lumpy/mainboard_smi.c b/src/mainboard/samsung/lumpy/mainboard_smi.c
index 2d396b0..4e73a57 100644
--- a/src/mainboard/samsung/lumpy/mainboard_smi.c
+++ b/src/mainboard/samsung/lumpy/mainboard_smi.c
@@ -29,17 +29,12 @@
 #include <ec/smsc/mec1308/ec.h>
 #include "ec.h"
 
-/* The southbridge SMI handler checks whether gnvs has a
- * valid pointer before calling the trap handler
- */
-extern global_nvs_t *gnvs;
-
 int mainboard_io_trap_handler(int smif)
 {
 	switch (smif) {
 	case 0x99:
 		printk(BIOS_DEBUG, "Sample\n");
-		gnvs->smif = 0;
+		smm_get_gnvs()->smif = 0;
 		break;
 	default:
 		return 0;
@@ -59,7 +54,6 @@ static u8 mainboard_smi_ec(void)
 {
 	u8 cmd;
 	u32 pm1_cnt;
-	extern u16 pmbase; /* Set in southbridge SMI handler */
 
 	cmd = read_ec_command_byte(EC_GET_SMI_CAUSE);
 
@@ -68,9 +62,9 @@ static u8 mainboard_smi_ec(void)
 		printk(BIOS_DEBUG, "LID CLOSED, SHUTDOWN\n");
 
 		/* Go to S5 */
-		pm1_cnt = inl(pmbase + PM1_CNT);
+		pm1_cnt = inl(smm_get_pmbase() + PM1_CNT);
 		pm1_cnt |= (0xf << 10);
-		outl(pm1_cnt, pmbase + PM1_CNT);
+		outl(pm1_cnt, smm_get_pmbase() + PM1_CNT);
 		break;
 	}
 
diff --git a/src/mainboard/samsung/stumpy/mainboard_smi.c b/src/mainboard/samsung/stumpy/mainboard_smi.c
index 0b3024b..660bb31 100644
--- a/src/mainboard/samsung/stumpy/mainboard_smi.c
+++ b/src/mainboard/samsung/stumpy/mainboard_smi.c
@@ -30,17 +30,12 @@
 /* Include romstage serial for SIO helper functions */
 #include <superio/ite/it8772f/early_serial.c>
 
-/* The southbridge SMI handler checks whether gnvs has a
- * valid pointer before calling the trap handler
- */
-extern global_nvs_t *gnvs;
-
 int mainboard_io_trap_handler(int smif)
 {
 	switch (smif) {
 	case 0x99:
 		printk(BIOS_DEBUG, "Sample\n");
-		gnvs->smif = 0;
+		smm_get_gnvs()->smif = 0;
 		break;
 	default:
 		return 0;




More information about the coreboot mailing list