[coreboot] New patch to review for coreboot: 83a49f7 SMM: Add heap region and move C handler higher in region

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Tue Jul 24 00:12:40 CEST 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/1308

-gerrit

commit 83a49f79e7339b011063e346b9f96765b2805160
Author: Duncan Laurie <dlaurie at chromium.org>
Date:   Sat Jun 23 15:09:34 2012 -0700

    SMM: Add heap region and move C handler higher in region
    
    In order to support SPI and ELOG drivers the SMM region
    needs to be able to be larger than the previous allocation
    below 0x7400.  Now that we have support for 4M TSEG we do
    not need to live in this region.
    
    This change adds a 16KB heap region abofe the save state area
    at TSEG+64KB and moves the C handler above this.
    
    The heap region is then available for malloc and the C handler
    can grow to support flash and event log features.
    
    While updating the memory map comment in assembly stub I also
    added a pause instruction to the cpu spin lock as this was
    added to the C code in latest upstream rebase.
    
    Dump sympbols from smm.elf binary to see the new regions:
    
    00010000 B _heap
    00014000 B _eheap
    00014000 T _smm_c_handler_start
    0001b240 T _smm_c_handler_end
    
    Change-Id: I45f0ab4df1fdef3b626f877094a58587476ac634
    Signed-off-by: Duncan Laurie <dlaurie at chromium.org>
---
 src/cpu/x86/smm/smm_tseg.ld       |   45 +++++++++++++++++++++++-------------
 src/cpu/x86/smm/smmhandler_tseg.S |    9 +++++-
 2 files changed, 36 insertions(+), 18 deletions(-)

diff --git a/src/cpu/x86/smm/smm_tseg.ld b/src/cpu/x86/smm/smm_tseg.ld
index 016b5a0..6def972 100644
--- a/src/cpu/x86/smm/smm_tseg.ld
+++ b/src/cpu/x86/smm/smm_tseg.ld
@@ -10,6 +10,34 @@ SECTIONS
 	.handler (.): {
 		/* Assembler stub */
 		*(.handler)
+	}
+
+	/* We are using the TSEG interleaved to stuff the SMM handlers
+	 * for all CPU cores in there. The jump table redirects the execution
+	 * to the actual SMM handler
+	 */
+	. = 0x8000 - (( CPUS - 1) * 0x400);
+	.jumptable : {
+		*(.jumptable)
+	}
+
+	/* Data used in early SMM TSEG handler. */
+	. = 0x8400;
+	.earlydata : {
+		*(.earlydata)
+	}
+
+	/* 16KB for the heap at 64KB */
+	. = 0x10000;
+	.heap : {
+		_heap = .;
+		. = 0x4000;
+		_eheap = .;
+	}
+
+	. = ALIGN(0x4000);
+	.smm_c_handler : {
+		_smm_c_handler_start = .;
 
 		/* C code of the SMM handler */
 		*(.text);
@@ -29,25 +57,10 @@ SECTIONS
 		 . = ALIGN(4);
 		*(.bss)
 		*(.sbss)
-
-		/* What is this? */
 		*(COMMON)
 		 . = ALIGN(4);
-	}
 
-	/* We are using the TSEG interleaved to stuff the SMM handlers
-	 * for all CPU cores in there. The jump table redirects the execution
-	 * to the actual SMM handler
-	 */
-	. = 0x8000 - (( CPUS - 1) * 0x400);
-	.jumptable : {
-		*(.jumptable)
-	}
-
-	/* Data used in early SMM TSEG handler. */
-	. = 0x8400;
-	.earlydata : {
-		*(.earlydata)
+		_smm_c_handler_end = .;
 	}
 
 	/DISCARD/ : {
diff --git a/src/cpu/x86/smm/smmhandler_tseg.S b/src/cpu/x86/smm/smmhandler_tseg.S
index 8fdd75f..c61a611 100644
--- a/src/cpu/x86/smm/smmhandler_tseg.S
+++ b/src/cpu/x86/smm/smmhandler_tseg.S
@@ -20,7 +20,11 @@
  */
 
 /*
- * +--------------------------------+ 0xffff
+ * +--------------------------------+
+ * | SMM Handler C Code             |
+ * +--------------------------------+ 0x14000
+ * | SMM Handler Heap               |
+ * +--------------------------------+ 0x10000
  * |  Save State Map Node 0         |
  * |  Save State Map Node 1         |
  * |  Save State Map Node 2         |
@@ -39,7 +43,7 @@
  * | ...                            |
  * +--------------------------------+ 0x7400
  * |                                |
- * | SMM Handler                    |
+ * | SMM Handler Assembly Stub      |
  * |                                |
  * +--------------------------------+ TSEG
  *
@@ -91,6 +95,7 @@ smm_handler_start:
 
 	/* If we did not get the lock, wait for release */
 wait_for_unlock:
+	pause
 	addr32	movw (%ebx), %ax
 	cmpw	$SMI_LOCKED, %ax
 	je	wait_for_unlock




More information about the coreboot mailing list