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