From 9d8adc0e3a923e1d201d50344f94a9176e5ec939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Sun, 4 Dec 2016 22:17:37 +0200 Subject: x86 SMM: Fix use with RELOCATABLE_RAMSTAGE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The value for _size was not evaluated correctly if ramstage is relocated, make the calculation runtime. While touching it, move symbol declarations to header file. Change-Id: I4402315945771acf1c86a81cac6d43f1fe99a2a2 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/17784 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/southbridge/intel/i82801dx/smi.c | 6 ++---- src/southbridge/intel/i82801gx/smi.c | 6 ++---- src/southbridge/intel/i82801ix/smi.c | 6 ++---- 3 files changed, 6 insertions(+), 12 deletions(-) (limited to 'src/southbridge') diff --git a/src/southbridge/intel/i82801dx/smi.c b/src/southbridge/intel/i82801dx/smi.c index 71ef5fd8ee..93e28452e0 100644 --- a/src/southbridge/intel/i82801dx/smi.c +++ b/src/southbridge/intel/i82801dx/smi.c @@ -25,9 +25,6 @@ #include #include "i82801dx.h" -extern unsigned char _binary_smm_start; -extern unsigned char _binary_smm_size; - /* I945 */ #define SMRAM 0x90 #define D_OPEN (1 << 6) @@ -321,7 +318,8 @@ static void smm_install(void) D_OPEN | G_SMRAME | C_BASE_SEG); /* copy the real SMM handler */ - memcpy((void *)0xa0000, &_binary_smm_start, (size_t)&_binary_smm_size); + memcpy((void *)0xa0000, _binary_smm_start, + _binary_smm_end - _binary_smm_start); wbinvd(); /* close the SMM memory window and enable normal SMM */ diff --git a/src/southbridge/intel/i82801gx/smi.c b/src/southbridge/intel/i82801gx/smi.c index 3487aabd56..c9d4cd92ca 100644 --- a/src/southbridge/intel/i82801gx/smi.c +++ b/src/southbridge/intel/i82801gx/smi.c @@ -25,9 +25,6 @@ #include #include "i82801gx.h" -extern unsigned char _binary_smm_start; -extern unsigned char _binary_smm_size; - /* I945 */ #define SMRAM 0x9d #define D_OPEN (1 << 6) @@ -345,7 +342,8 @@ static void smm_install(void) D_OPEN | G_SMRAME | C_BASE_SEG); /* copy the real SMM handler */ - memcpy((void *)0xa0000, &_binary_smm_start, (size_t)&_binary_smm_size); + memcpy((void *)0xa0000, _binary_smm_start, + _binary_smm_end - _binary_smm_start); wbinvd(); } diff --git a/src/southbridge/intel/i82801ix/smi.c b/src/southbridge/intel/i82801ix/smi.c index 358a1a9ee7..421746df7e 100644 --- a/src/southbridge/intel/i82801ix/smi.c +++ b/src/southbridge/intel/i82801ix/smi.c @@ -26,9 +26,6 @@ #include #include "i82801ix.h" -extern unsigned char _binary_smm_start; -extern unsigned char _binary_smm_size; - /* I945/GM45 */ #define SMRAM 0x9d #define D_OPEN (1 << 6) @@ -344,7 +341,8 @@ static void smm_install(void) D_OPEN | G_SMRAME | C_BASE_SEG); /* copy the real SMM handler */ - memcpy((void *)0xa0000, &_binary_smm_start, (size_t)&_binary_smm_size); + memcpy((void *)0xa0000, _binary_smm_start, + _binary_smm_end - _binary_smm_start); wbinvd(); } -- cgit v1.2.3