[coreboot-gerrit] New patch to review for coreboot: c39de9e x86: Initialize drivers in SMM context if needed

Marc Jones (marc.jones@se-eng.com) gerrit at coreboot.org
Tue Jan 6 00:19:03 CET 2015


Marc Jones (marc.jones at se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8134

-gerrit

commit c39de9efe0fa9c9876ccec69e965be2de69d1b48
Author: David Hendricks <dhendrix at chromium.org>
Date:   Thu Jun 19 15:39:29 2014 -0700

    x86: Initialize drivers in SMM context if needed
    
    This adds a block in the SMI handler to call init functions for
    drivers which may be used in SMM. A static variable is used to
    ensure the init functions are only called once.
    
    BUG=chrome-os-partner:29580
    BRANCH=mccloud
    TEST=Built and booted on mccloud, system no longer hangs when
    pressing power button at the dev mode screen. Also tested on parrot.
    
    Original-Signed-off-by: David Hendricks <dhendrix at chromium.org>
    Original-Change-Id: I225f572f7b3072bec2bc06aac3fb50d90a2e30ee
    Original-Reviewed-on: https://chromium-review.googlesource.com/204764
    Original-Reviewed-by: Aaron Durbin <adurbin at chromium.org>
    (cherry picked from commit 9315c485deb5f24df753e2d69f4819b2cb6accc2)
    Signed-off-by: Marc Jones <marc.jones at se-eng.com>
    
    Change-Id: I8d2b21765c35c7ac7746986d5334dca17dcd6861
---
 src/cpu/x86/smm/smihandler.c         | 14 ++++++++++++++
 src/cpu/x86/smm/smm_module_handler.c | 14 ++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/src/cpu/x86/smm/smihandler.c b/src/cpu/x86/smm/smihandler.c
index c864df2..bd03030 100644
--- a/src/cpu/x86/smm/smihandler.c
+++ b/src/cpu/x86/smm/smihandler.c
@@ -24,6 +24,12 @@
 #include <cpu/x86/cache.h>
 #include <cpu/x86/smm.h>
 
+#if CONFIG_SPI_FLASH_SMM
+#include <spi-generic.h>
+#endif
+
+static int do_driver_init = 1;
+
 #if !CONFIG_SMM_TSEG /* TSEG handler locks in assembly */
 typedef enum { SMI_LOCKED, SMI_UNLOCKED } smi_semaphore;
 
@@ -184,6 +190,14 @@ void smi_handler(u32 smm_revision)
 		return;
 	}
 
+	/* Allow drivers to initialize variables in SMM context. */
+	if (do_driver_init) {
+#if CONFIG_SPI_FLASH_SMM
+		spi_init();
+#endif
+		do_driver_init = 0;
+	}
+
 	/* Call chipset specific SMI handlers. */
 	if (cpu_smi_handler)
 		cpu_smi_handler(node, &state_save);
diff --git a/src/cpu/x86/smm/smm_module_handler.c b/src/cpu/x86/smm/smm_module_handler.c
index 79863d8..8c0e804 100644
--- a/src/cpu/x86/smm/smm_module_handler.c
+++ b/src/cpu/x86/smm/smm_module_handler.c
@@ -22,6 +22,12 @@
 #include <cpu/x86/smm.h>
 #include <rmodule.h>
 
+#if CONFIG_SPI_FLASH_SMM
+#include <spi-generic.h>
+#endif
+
+static int do_driver_init = 1;
+
 typedef enum { SMI_LOCKED, SMI_UNLOCKED } smi_semaphore;
 
 /* SMI multiprocessing semaphore */
@@ -154,6 +160,14 @@ void asmlinkage smm_handler_start(void *arg)
 
 	printk(BIOS_SPEW, "\nSMI# #%d\n", cpu);
 
+	/* Allow drivers to initialize variables in SMM context. */
+	if (do_driver_init) {
+#if CONFIG_SPI_FLASH_SMM
+		spi_init();
+#endif
+		do_driver_init = 0;
+	}
+
 	cpu_smi_handler();
 	northbridge_smi_handler();
 	southbridge_smi_handler();



More information about the coreboot-gerrit mailing list