From 580fa2bf316d4796e5ed76cbbd3e454479fb0688 Mon Sep 17 00:00:00 2001 From: Hung-Te Lin Date: Wed, 6 Feb 2013 21:51:15 +0800 Subject: console: Only print romstage messages with EARLY_CONSOLE enabled. Revise console source file dependency (especially for EARLY_CONSOLE) and interpret printk/console_init according to EARLY_CONSOLE setting (no-ops if EARLY_CONSOLE is not defined). Verified to boot on x86/qemu and armv7/snow. Disabling EARLY_CONSOLE correctly stops romstage messages on x86/qemu (armv7/snow needs more changes to work). Change-Id: Idbbd3a26bc1135c9d3ae282aad486961fb60e0ea Signed-off-by: Hung-Te Lin Reviewed-on: http://review.coreboot.org/2300 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: David Hendricks --- src/include/console/console.h | 11 +++++++++++ src/include/uart.h | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src/include') diff --git a/src/include/console/console.h b/src/include/console/console.h index edd49e0f84..496571b6fa 100644 --- a/src/include/console/console.h +++ b/src/include/console/console.h @@ -74,6 +74,15 @@ void mainboard_post(u8 value); void __attribute__ ((noreturn)) die(const char *msg); int do_printk(int msg_level, const char *fmt, ...) __attribute__((format(printf, 2, 3))); +#if defined(__PRE_RAM__) && !CONFIG_EARLY_CONSOLE + +static inline void printk(int LEVEL, const char *fmt, ...); +static inline void printk(int LEVEL, const char *fmt, ...) { + /* Do nothing. */ +} + +#else /* defined(__PRE_RAM__) && !CONFIG_EARLY_CONSOLE */ + #undef WE_CLEANED_UP_ALL_SIDE_EFFECTS /* We saw some strange effects in the past like coreboot crashing while * disabling cache as ram for a maximum console log level of 6 and above while @@ -109,6 +118,8 @@ int do_printk(int msg_level, const char *fmt, ...) __attribute__((format(printf, } while(0) #endif +#endif /* defined(__PRE_RAM__) && !CONFIG_EARLY_CONSOLE */ + #define print_emerg(STR) printk(BIOS_EMERG, "%s", (STR)) #define print_alert(STR) printk(BIOS_ALERT, "%s", (STR)) #define print_crit(STR) printk(BIOS_CRIT, "%s", (STR)) diff --git a/src/include/uart.h b/src/include/uart.h index 2a72575871..e42449653f 100644 --- a/src/include/uart.h +++ b/src/include/uart.h @@ -26,7 +26,7 @@ #ifndef UART_H #define UART_H -#if CONFIG_CONSOLE_SERIAL8250 +#if CONFIG_CONSOLE_SERIAL8250 || CONFIG_CONSOLE_SERIAL8250MEM #include #endif @@ -34,7 +34,7 @@ #include #endif -#ifndef __ROMCC__ +#if !defined(__ROMCC__) && CONFIG_CONSOLE_SERIAL_UART unsigned char uart_rx_byte(void); void uart_tx_byte(unsigned char data); void uart_tx_flush(void); -- cgit v1.2.3