[coreboot-gerrit] Patch set updated for coreboot: 51c6758 console: Remove DEBUG_SMI temporarily

Kyösti Mälkki (kyosti.malkki@gmail.com) gerrit at coreboot.org
Wed Feb 5 18:17:24 CET 2014


Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5142

-gerrit

commit 51c67586ae42d3c29227d38b17d5a3b32c7329b8
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date:   Sun Jan 26 11:32:51 2014 +0200

    console: Remove DEBUG_SMI temporarily
    
    Existing code compiled serial communication in SMM even when DEBUG_SMI
    was not selected, if serial console was enabled.
    
    Followup will re-enable DEBUG_SMI output with tighter security policy
    and possibly wider support for consoles.
    
    Change-Id: Ic5e25cd7453cb2243f7ac592b093fba752a299f7
    Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
 src/console/Makefile.inc             |  3 +-
 src/cpu/x86/smm/Makefile.inc         |  2 --
 src/cpu/x86/smm/smihandler.c         |  3 +-
 src/cpu/x86/smm/smiutil.c            | 67 ------------------------------------
 src/cpu/x86/smm/smm_module_handler.c |  4 +++
 src/include/console/console.h        |  1 +
 src/mainboard/lenovo/x60/dock.c      |  3 ++
 7 files changed, 11 insertions(+), 72 deletions(-)

diff --git a/src/console/Makefile.inc b/src/console/Makefile.inc
index 62be1d2..54d59cd 100644
--- a/src/console/Makefile.inc
+++ b/src/console/Makefile.inc
@@ -5,8 +5,7 @@ ramstage-y += vsprintf.c
 ramstage-y += post.c
 ramstage-y += die.c
 
-smm-y += printk.c
-smm-y += vtxprintf.c
+smm-$(CONFIG_DEBUG_SMI) += vtxprintf.c printk.c
 smm-$(CONFIG_SMM_TSEG) += die.c
 
 romstage-$(CONFIG_EARLY_CONSOLE) += vtxprintf.c
diff --git a/src/cpu/x86/smm/Makefile.inc b/src/cpu/x86/smm/Makefile.inc
index b595a36..06ba2a3 100644
--- a/src/cpu/x86/smm/Makefile.inc
+++ b/src/cpu/x86/smm/Makefile.inc
@@ -21,7 +21,6 @@ ifeq ($(CONFIG_SMM_MODULES),y)
 smmstub-y += smm_stub.S
 smmstub-y += smm_module_header.c
 
-smm-y += smiutil.c
 smm-y += smm_module_header.c
 smm-y += smm_module_handler.c
 
@@ -79,7 +78,6 @@ SMM_LDSCRIPT := smm.ld
 endif
 
 smm-y += smihandler.c
-smm-y += smiutil.c
 
 $(obj)/cpu/x86/smm/smm.o: $$(smm-objs) $(LIBGCC_FILE_NAME)
 	$(CC) $(LDFLAGS) -nostdlib -r -o $@ -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,--start-group $(smm-objs) $(LIBGCC_FILE_NAME) -Wl,--end-group
diff --git a/src/cpu/x86/smm/smihandler.c b/src/cpu/x86/smm/smihandler.c
index fc30909..e8f79fe 100644
--- a/src/cpu/x86/smm/smihandler.c
+++ b/src/cpu/x86/smm/smihandler.c
@@ -148,8 +148,9 @@ void smi_handler(u32 smm_revision)
 
 	node=nodeid();
 
+#if CONFIG_DEBUG_SMI
 	console_init();
-
+#endif
 	printk(BIOS_SPEW, "\nSMI# #%d\n", node);
 
 	switch (smm_revision) {
diff --git a/src/cpu/x86/smm/smiutil.c b/src/cpu/x86/smm/smiutil.c
deleted file mode 100644
index 13ee12e..0000000
--- a/src/cpu/x86/smm/smiutil.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2008-2009 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
- * published by the Free Software Foundation; version 2 of
- * the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-
-#include <arch/io.h>
-#include <cpu/x86/cache.h>
-#include <cpu/x86/smm.h>
-#include <console/console.h>
-#include <console/vtxprintf.h>
-
-#if CONFIG_CONSOLE_SERIAL8250MEM
-static u32 serial8250mem_base_address = 0;
-#endif
-
-void console_tx_flush(void)
-{
-}
-
-void console_tx_byte(unsigned char byte)
-{
-	if (byte == '\n')
-		console_tx_byte('\r');
-
-#if CONFIG_CONSOLE_SERIAL8250MEM
-	if (serial8250mem_base_address)
-		uart8250_mem_tx_byte(serial8250mem_base_address, byte);
-#endif
-#if CONFIG_CONSOLE_SERIAL8250
-	uart8250_tx_byte(CONFIG_TTYS0_BASE, byte);
-#endif
-#if CONFIG_CONSOLE_NE2K
-	ne2k_append_data(&byte, 1, CONFIG_CONSOLE_NE2K_IO_PORT);
-#endif
-}
-
-void console_init(void)
-{
-#if CONFIG_DEBUG_SMI
-	console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL;
-#if CONFIG_CONSOLE_SERIAL8250
-	uart_init();
-#endif
-#if CONFIG_CONSOLE_SERIAL8250MEM
-	serial8250mem_base_address = uart_mem_init();
-#endif
-#else
-	console_loglevel = 1;
-#endif
-}
-
diff --git a/src/cpu/x86/smm/smm_module_handler.c b/src/cpu/x86/smm/smm_module_handler.c
index 444e335..cbfdf79 100644
--- a/src/cpu/x86/smm/smm_module_handler.c
+++ b/src/cpu/x86/smm/smm_module_handler.c
@@ -121,7 +121,9 @@ void smm_handler_start(void *arg, int cpu, const struct smm_runtime *runtime)
 		smm_runtime = runtime;
 
 	if (cpu >= CONFIG_MAX_CPUS) {
+#if CONFIG_DEBUG_SMI
 		console_init();
+#endif
 		printk(BIOS_CRIT,
 		       "Invalid CPU number assigned in SMM stub: %d\n", cpu);
 		return;
@@ -141,7 +143,9 @@ void smm_handler_start(void *arg, int cpu, const struct smm_runtime *runtime)
 
 	smi_backup_pci_address();
 
+#if CONFIG_DEBUG_SMI
 	console_init();
+#endif
 
 	printk(BIOS_SPEW, "\nSMI# #%d\n", cpu);
 
diff --git a/src/include/console/console.h b/src/include/console/console.h
index c5f5297..78307a3 100644
--- a/src/include/console/console.h
+++ b/src/include/console/console.h
@@ -89,6 +89,7 @@ int do_printk(int msg_level, const char *fmt, ...) __attribute__((format(printf,
 void hexdump32(char LEVEL, const void *d, int len);
 
 #if defined(__BOOT_BLOCK__) && !CONFIG_BOOTBLOCK_CONSOLE || \
+    defined(__SMM__) && !CONFIG_DEBUG_SMI || \
     (defined(__PRE_RAM__) && !defined(__BOOT_BLOCK__)) && !CONFIG_EARLY_CONSOLE
 
 static inline void printk(int LEVEL, const char *fmt, ...);
diff --git a/src/mainboard/lenovo/x60/dock.c b/src/mainboard/lenovo/x60/dock.c
index 1b15a6c..a880263 100644
--- a/src/mainboard/lenovo/x60/dock.c
+++ b/src/mainboard/lenovo/x60/dock.c
@@ -237,7 +237,10 @@ int dock_connect(void)
 
 	dock_write_register(0x07, 0x03);
 	dock_write_register(0x30, 0x01);
+#if !defined(__SMM__) || CONFIG_DEBUG_SMI
+	/* FIXME: Do not touch consoles outside the dock. */
 	console_init();
+#endif
 	return 0;
 }
 



More information about the coreboot-gerrit mailing list