From 0c255e108ba972cf8cf43777c20b13ccea744f36 Mon Sep 17 00:00:00 2001 From: Carl-Daniel Hailfinger Date: Mon, 18 Aug 2008 20:13:11 +0000 Subject: [PATCH] Move console log level management to global variable infrastructure. The existing code does not work due to the characteristics of stage1. This has been broken since r729. Signed-off-by: Carl-Daniel Hailfinger Acked-by: Ronald G. Minnich git-svn-id: svn://coreboot.org/repository/coreboot-v3@786 f3766cd6-281f-0410-b1cd-43a5c92072e9 --- arch/x86/stage1.c | 11 ++++++----- include/console.h | 2 ++ lib/console.c | 11 +++++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/arch/x86/stage1.c b/arch/x86/stage1.c index a15943e5cc..be33ee6589 100644 --- a/arch/x86/stage1.c +++ b/arch/x86/stage1.c @@ -89,6 +89,12 @@ void global_vars_init(struct global_vars *globvars) { memset(globvars, 0, sizeof(struct global_vars)); *(struct global_vars **)(bottom_of_stack() - sizeof(struct global_vars *)) = globvars; +#ifdef CONFIG_CONSOLE_BUFFER + /* Initialize the printk buffer. */ + printk_buffer_init(); +#endif + console_loglevel_init(); + } void dump_mem_range(int msg_level, unsigned char *buf, int size) @@ -163,11 +169,6 @@ void __attribute__((stdcall)) stage1_main(u32 bist) */ global_vars_init(&globvars); -#ifdef CONFIG_CONSOLE_BUFFER - /* Initialize the printk buffer. NEVER run this on an AP! */ - printk_buffer_init(); -#endif - hardware_stage1(); // diff --git a/include/console.h b/include/console.h index a5d87164f2..68d359fefc 100644 --- a/include/console.h +++ b/include/console.h @@ -37,6 +37,7 @@ void console_tx_byte(unsigned char byte, void *arg); void console_tx_flush(void); unsigned char console_rx_byte(void); int console_tst_byte(void); +void console_loglevel_init(void); #ifdef CONFIG_CONSOLE_BUFFER void printk_buffer_init(void); void printk_buffer_move(void *newaddr, int newsize); @@ -69,6 +70,7 @@ struct global_vars { #ifdef CONFIG_CONSOLE_BUFFER struct printk_buffer *printk_buffer; #endif + unsigned int loglevel; }; int printk(int msg_level, const char *fmt, ...) __attribute__((format (printf, 2, 3))); diff --git a/lib/console.c b/lib/console.c index 6557638578..4a21a8efcf 100644 --- a/lib/console.c +++ b/lib/console.c @@ -8,8 +8,6 @@ int vtxprintf(void (*)(unsigned char, void *arg), void *arg, const char *, va_list); -static unsigned int loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL; - /** * set the console log level * There are no invalid settings, although there are ones that @@ -21,7 +19,7 @@ void set_loglevel(unsigned int level) { if (level > BIOS_SPEW) printk(BIOS_ALWAYS, "Warning: ridiculous log level setting: %d (max %d)\n", level, BIOS_SPEW); - loglevel = level; + global_vars()->loglevel = level; } /** @@ -31,7 +29,12 @@ void set_loglevel(unsigned int level) { */ static unsigned int console_loglevel(void) { - return loglevel; + return global_vars()->loglevel; +} + +void console_loglevel_init(void) +{ + set_loglevel(CONFIG_DEFAULT_CONSOLE_LOGLEVEL); } #ifdef CONFIG_CONSOLE_BUFFER