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 <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>


git-svn-id: svn://coreboot.org/repository/coreboot-v3@786 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
Carl-Daniel Hailfinger 2008-08-18 20:13:11 +00:00
parent 1b5c399508
commit 0c255e108b
3 changed files with 15 additions and 9 deletions

View file

@ -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();
//

View file

@ -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)));

View file

@ -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