- fix SMM code relocation race
authorStefan Reinauer <stepan@coresystems.de>
Sun, 1 Aug 2010 15:41:14 +0000 (15:41 +0000)
committerStefan Reinauer <stepan@openbios.org>
Sun, 1 Aug 2010 15:41:14 +0000 (15:41 +0000)
- make SMM relocation debugging Kconfig accessible
Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Patrick Georgi <patrick.georgi@coresystems.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5676 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

src/Kconfig
src/cpu/x86/smm/smmrelocate.S
src/southbridge/intel/i82801dx/i82801dx.h
src/southbridge/intel/i82801dx/i82801dx_smi.c
src/southbridge/intel/i82801gx/i82801gx_smi.c

index 461087d170ec2ac87ca7f838cbe253ae57a69f68..61135c0d5649f6c4b066dadc438a83c14b787148 100644 (file)
@@ -560,6 +560,18 @@ config DEBUG_SMI
 
          If unsure, say N.
 
+config DEBUG_SMM_RELOCATION
+       bool "Debug SMM relocation code"
+       default n
+       depends on HAVE_SMI_HANDLER
+       help
+         This option enables additional SMM handler relocation related
+         debug messages.
+
+         Note: This option will increase the size of the coreboot image.
+
+         If unsure, say N.
+
 config X86EMU_DEBUG
        bool "Output verbose x86emu debug messages"
        default n
index 50a8f28c3faa6d0f94dda7c191a30df75f884cfc..e795359783d7d5902e1833504bf78f287dbe379d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the coreboot project.
  *
- * Copyright (C) 2008 coresystems GmbH
+ * Copyright (C) 2008-2010 coresystems GmbH
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
 
 // FIXME: Is this piece of code southbridge specific, or
 // can it be cleaned up so this include is not required?
-// It's needed right now because we get our PM_BASE from
+// It's needed right now because we get our DEFAULT_PMBASE from
 // here.
+#if defined(CONFIG_SOUTHBRIDGE_INTEL_I82801GX)
 #include "../../../southbridge/intel/i82801gx/i82801gx.h"
-
-#undef DEBUG_SMM_RELOCATION
-//#define DEBUG_SMM_RELOCATION
+#elif defined(CONFIG_SOUTHBRIDGE_INTEL_I82801DX)
+#include "../../../southbridge/intel/i82801dx/i82801dx.h"
+#else
+#error "Southbridge needs SMM handler support."
+#endif
 
 #define LAPIC_ID 0xfee00020
 
@@ -125,7 +128,7 @@ smm_relocate:
        addr32 movl %eax, (%ebx)
 
 
-       /* The next section of code is hardware specific */
+       /* The next section of code is potentially southbridge specific */
 
        /* Clear SMI status */
        movw $(DEFAULT_PMBASE + 0x34), %dx
@@ -143,8 +146,9 @@ smm_relocate:
        orl $(1 << 1), %eax
        outl %eax, %dx
 
-       /* End of hardware specific section. */
-#ifdef DEBUG_SMM_RELOCATION
+       /* End of southbridge specific section. */
+
+#if defined(CONFIG_DEBUG_SMM_RELOCATION) && CONFIG_DEBUG_SMM_RELOCATION
        /* print [SMM-x] so we can determine if CPUx went to SMM */
        movw $CONFIG_TTYS0_BASE, %dx
        mov $'[', %al
index 1b995b12040c90a01c7e86c384c7b5db0c6e1dca..cbdbc963af78fa7d70d86cfde6518992189f0b22 100644 (file)
@@ -86,6 +86,7 @@ extern void i82801dx_enable(device_t dev);
 #define PCICMD          0x04
 #define PMBASE          0x40
 #define   PMBASE_ADDR  0x0400
+#define   DEFAULT_PMBASE PMBASE_ADDR
 #define ACPI_CNTL       0x44
 #define BIOS_CNTL       0x4E
 #define GPIO_BASE       0x58
index e63fb501f226d8af41a1b5227167b189a58c4845..55d8a70965b6d1e55ebb8b6d6db84f6d66ddfa98 100644 (file)
@@ -335,11 +335,13 @@ static void smm_install(void)
 
 void smm_init(void)
 {
-       // FIXME is this a race condition?
-       smm_relocate();
+       /* Put SMM code to 0xa0000 */
        smm_install();
 
-       // We're done. Make sure SMIs can happen!
+       /* Put relocation code to 0x38000 and relocate SMBASE */
+       smm_relocate();
+
+       /* We're done. Make sure SMIs can happen! */
        smi_set_eos();
 }
 
index 0d15ca50f5ca222b9decfee1d021773c02718e75..39d5c4dca2e89a94fa9e1c3e65008746709072b5 100644 (file)
@@ -335,11 +335,13 @@ static void smm_install(void)
 
 void smm_init(void)
 {
-       // FIXME is this a race condition?
-       smm_relocate();
+       /* Put SMM code to 0xa0000 */
        smm_install();
 
-       // We're done. Make sure SMIs can happen!
+       /* Put relocation code to 0x38000 and relocate SMBASE */
+       smm_relocate();
+
+       /* We're done. Make sure SMIs can happen! */
        smi_set_eos();
 }