From 7f3d442abb2a8ff6f6728527ab7665fd79fd60cd Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Wed, 3 Oct 2012 19:01:57 -0700 Subject: SMM: Avoid use of global variables in SMI handler Using global variables with the TSEG is a bad idea because they are not relocated properly right now. Instead make the variables static and add accessor functions for the rest of SMM to use. At the same time drop the tcg/smi1 pointers as they are not setup or ever used. (the debug output is added back in a subsequent commit) Change-Id: If0b2d47df4e482ead71bf713c1ef748da840073b Signed-off-by: Duncan Laurie Reviewed-on: http://review.coreboot.org/1764 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich --- src/mainboard/samsung/lumpy/mainboard_smi.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/mainboard/samsung/lumpy') diff --git a/src/mainboard/samsung/lumpy/mainboard_smi.c b/src/mainboard/samsung/lumpy/mainboard_smi.c index 2d396b03b8..4e73a57938 100644 --- a/src/mainboard/samsung/lumpy/mainboard_smi.c +++ b/src/mainboard/samsung/lumpy/mainboard_smi.c @@ -29,17 +29,12 @@ #include #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; } -- cgit v1.2.3