From b2d25967142437a82da150d0134923e3fd783dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Mon, 27 Jan 2014 15:09:13 +0200 Subject: console: Unify do_printk() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I6c50e47d9d2d0d1f42beee477e49b2a0054d1786 Signed-off-by: Kyösti Mälkki Reviewed-on: http://review.coreboot.org/5332 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- src/arch/armv7/early_console.c | 21 +-------------------- src/arch/x86/lib/romstage_console.c | 25 ------------------------- src/console/Makefile.inc | 8 +++----- src/console/init.c | 4 ++++ src/console/printk.c | 9 ++++++--- 5 files changed, 14 insertions(+), 53 deletions(-) diff --git a/src/arch/armv7/early_console.c b/src/arch/armv7/early_console.c index 7614531..a85f554 100644 --- a/src/arch/armv7/early_console.c +++ b/src/arch/armv7/early_console.c @@ -20,7 +20,6 @@ #include #include #include -#include /* FIXME: need to make console driver more generic */ void console_tx_byte(unsigned char byte) @@ -36,27 +35,9 @@ void console_tx_byte(unsigned char byte) #endif } -static void _console_tx_flush(void) +void console_tx_flush(void) { #if CONFIG_CONSOLE_SERIAL uart_tx_flush(); #endif } - -int do_printk(int msg_level, const char *fmt, ...) -{ - va_list args; - int i; - - if (msg_level > console_loglevel) { - return 0; - } - - va_start(args, fmt); - i = vtxprintf(console_tx_byte, fmt, args); - va_end(args); - - _console_tx_flush(); - - return i; -} diff --git a/src/arch/x86/lib/romstage_console.c b/src/arch/x86/lib/romstage_console.c index 0337245..c80cf8c 100644 --- a/src/arch/x86/lib/romstage_console.c +++ b/src/arch/x86/lib/romstage_console.c @@ -17,14 +17,12 @@ * MA 02110-1301 USA */ -#include #include #include #include #include #include #include -#include void console_tx_byte(unsigned char byte) { @@ -60,26 +58,3 @@ void console_tx_flush(void) usb_tx_flush(0); #endif } - -int do_printk(int msg_level, const char *fmt, ...) -{ - va_list args; - int i; - - if (msg_level > console_loglevel) { - return 0; - } - -#if CONFIG_SQUELCH_EARLY_SMP - if (!boot_cpu()) - return 0; -#endif - - va_start(args, fmt); - i = vtxprintf(console_tx_byte, fmt, args); - va_end(args); - - console_tx_flush(); - - return i; -} diff --git a/src/console/Makefile.inc b/src/console/Makefile.inc index f8bbf22..ef917da 100644 --- a/src/console/Makefile.inc +++ b/src/console/Makefile.inc @@ -1,19 +1,17 @@ -ramstage-y += printk.c +ramstage-y += vtxprintf.c printk.c vsprintf.c ramstage-y += init.c console.c -ramstage-y += vtxprintf.c -ramstage-y += vsprintf.c ramstage-y += post.c ramstage-y += die.c smm-$(CONFIG_DEBUG_SMI) += vtxprintf.c printk.c smm-$(CONFIG_SMM_TSEG) += die.c -romstage-$(CONFIG_EARLY_CONSOLE) += vtxprintf.c +romstage-$(CONFIG_EARLY_CONSOLE) += vtxprintf.c printk.c romstage-$(CONFIG_EARLY_CONSOLE) += init.c console.c romstage-y += post.c romstage-y += die.c -bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += vtxprintf.c +bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += vtxprintf.c printk.c bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += init.c console.c bootblock-y += die.c diff --git a/src/console/init.c b/src/console/init.c index 28934e7..c6ceab5 100644 --- a/src/console/init.c +++ b/src/console/init.c @@ -29,6 +29,10 @@ #include #endif +#if !defined(__PRE_RAM__) +int console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL; +#endif + void console_init(void) { #if !defined(__PRE_RAM__) diff --git a/src/console/printk.c b/src/console/printk.c index e24c752..7ea8c06 100644 --- a/src/console/printk.c +++ b/src/console/printk.c @@ -5,14 +5,12 @@ * */ +#include #include #include #include #include -int console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL; -int default_console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL; - DECLARE_SPIN_LOCK(console_lock) int do_printk(int msg_level, const char *fmt, ...) @@ -24,6 +22,11 @@ int do_printk(int msg_level, const char *fmt, ...) return 0; } +#if CONFIG_SQUELCH_EARLY_SMP && defined(__PRE_RAM__) + if (!boot_cpu()) + return 0; +#endif + DISABLE_TRACE; spin_lock(&console_lock); -- cgit v1.1