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 <hungte@chromium.org>
Reviewed-on: http://review.coreboot.org/2300
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
This commit is contained in:
Hung-Te Lin 2013-02-06 21:51:15 +08:00 committed by David Hendricks
parent f7fcb2056f
commit 580fa2bf31
5 changed files with 22 additions and 10 deletions

View File

@ -10,7 +10,7 @@ ramstage-y += memcpy.c
ramstage-y += ebda.c ramstage-y += ebda.c
ramstage-y += rom_media.c ramstage-y += rom_media.c
romstage-y += romstage_console.c romstage-$(CONFIG_EARLY_CONSOLE) += romstage_console.c
romstage-y += cbfs_and_run.c romstage-y += cbfs_and_run.c
romstage-y += memset.c romstage-y += memset.c
romstage-y += memcpy.c romstage-y += memcpy.c

View File

@ -9,14 +9,13 @@ smm-y += printk.c
smm-y += vtxprintf.c smm-y += vtxprintf.c
smm-$(CONFIG_SMM_TSEG) += die.c smm-$(CONFIG_SMM_TSEG) += die.c
romstage-y += vtxprintf.c romstage-$(CONFIG_EARLY_CONSOLE) += vtxprintf.c
romstage-$(CONFIG_EARLY_CONSOLE) += console.c romstage-y += console.c
romstage-y += post.c romstage-y += post.c
romstage-y += die.c romstage-y += die.c
# TODO Add vtxprintf.c only when early console is required. bootblock-$(CONFIG_EARLY_CONSOLE) += vtxprintf.c
bootblock-y += vtxprintf.c bootblock-y += console.c
bootblock-$(CONFIG_EARLY_CONSOLE) += console.c
bootblock-y += die.c bootblock-y += die.c
ramstage-$(CONFIG_CONSOLE_SERIAL8250) += uart8250_console.c ramstage-$(CONFIG_CONSOLE_SERIAL8250) += uart8250_console.c

View File

@ -99,10 +99,10 @@ int console_tst_byte(void)
#else // __PRE_RAM__ ^^^ NOT defined vvv defined #else // __PRE_RAM__ ^^^ NOT defined vvv defined
#include <uart.h>
void console_init(void) void console_init(void)
{ {
#if CONFIG_EARLY_CONSOLE
#if CONFIG_USBDEBUG #if CONFIG_USBDEBUG
enable_usbdebug(CONFIG_USBDEBUG_DEFAULT_PORT); enable_usbdebug(CONFIG_USBDEBUG_DEFAULT_PORT);
early_usbdebug_init(); early_usbdebug_init();
@ -127,5 +127,7 @@ void console_init(void)
COREBOOT_BUILD COREBOOT_BUILD
" starting...\n"; " starting...\n";
print_info(console_test); print_info(console_test);
#endif /* CONFIG_EARLY_CONSOLE */
} }
#endif #endif

View File

@ -74,6 +74,15 @@ void mainboard_post(u8 value);
void __attribute__ ((noreturn)) die(const char *msg); void __attribute__ ((noreturn)) die(const char *msg);
int do_printk(int msg_level, const char *fmt, ...) __attribute__((format(printf, 2, 3))); 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 #undef WE_CLEANED_UP_ALL_SIDE_EFFECTS
/* We saw some strange effects in the past like coreboot crashing while /* 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 * 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) } while(0)
#endif #endif
#endif /* defined(__PRE_RAM__) && !CONFIG_EARLY_CONSOLE */
#define print_emerg(STR) printk(BIOS_EMERG, "%s", (STR)) #define print_emerg(STR) printk(BIOS_EMERG, "%s", (STR))
#define print_alert(STR) printk(BIOS_ALERT, "%s", (STR)) #define print_alert(STR) printk(BIOS_ALERT, "%s", (STR))
#define print_crit(STR) printk(BIOS_CRIT, "%s", (STR)) #define print_crit(STR) printk(BIOS_CRIT, "%s", (STR))

View File

@ -26,7 +26,7 @@
#ifndef UART_H #ifndef UART_H
#define UART_H #define UART_H
#if CONFIG_CONSOLE_SERIAL8250 #if CONFIG_CONSOLE_SERIAL8250 || CONFIG_CONSOLE_SERIAL8250MEM
#include <uart8250.h> #include <uart8250.h>
#endif #endif
@ -34,7 +34,7 @@
#include <cpu/samsung/exynos5-common/uart.h> #include <cpu/samsung/exynos5-common/uart.h>
#endif #endif
#ifndef __ROMCC__ #if !defined(__ROMCC__) && CONFIG_CONSOLE_SERIAL_UART
unsigned char uart_rx_byte(void); unsigned char uart_rx_byte(void);
void uart_tx_byte(unsigned char data); void uart_tx_byte(unsigned char data);
void uart_tx_flush(void); void uart_tx_flush(void);