From patchwork Tue Oct 13 14:51:30 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: Maximum/default console log level for kconfig Date: Tue, 13 Oct 2009 14:51:30 -0000 From: Myles Watson X-Patchwork-Id: 397 Message-Id: <2831fecf0910130751p5f867e25l1935629f9bcd27d3@mail.gmail.com> To: Uwe Hermann Cc: coreboot@coreboot.org On Mon, Oct 12, 2009 at 4:17 PM, Uwe Hermann wrote: > On Mon, Oct 12, 2009 at 02:09:03PM -0600, Myles Watson wrote: >> >> > +config MAXIMUM_CONSOLE_LOGLEVEL_8 >> >> > +        bool "8: BIOS_SPEW" >> BIOS_SPEW is 9, not 8.  Could you fix it? > > Hm, nope, I think all Config.lb files are wrong here, they should use 8. > #define BIOS_DEBUG      7   /* debug-level messages                 */ > #define BIOS_SPEW       8   /* Way too many details                 */ > > Using 9 has the same effect as using 8 I guess. Nope. Spew messages don't show up anymore. LOGLEVEL = 8: coreboot-2.3" Tue Oct 13 07:40:07 MDT 2009 starting... Copying coreboot to RAM. Jumping to image. Check fallback/coreboot_ram Stage: load fallback/coreboot_ram @ 1048576/106496 bytes, enter @ 100000 Stage: done loading. Jumping to image. coreboot-2.3 Tue Oct 13 07:40:07 MDT 2009 booting... LOGLEVEL = 9: coreboot-2.3" Tue Oct 13 07:43:57 MDT 2009 starting... Copying coreboot to RAM. Jumping to image. Check CBFS header at fffeffe0 magic is 4f524243 Found CBFS header at fffeffe0 Check fallback/coreboot_ram Stage: load fallback/coreboot_ram @ 1048576/106496 bytes, enter @ 100000 Stage: done loading. Jumping to image. Attached patch fixes it. There's a strange mix of comparisons, which makes it harder to tell what's going on. There are also lots of functions that do these checks. Hopefully I didn't miss any. I checked a few values with console_debug.diff. While I was fooling with it, I made Kconfig ensure that MAXIMUM_CONSOLE_LOGLEVEL >= DEFAULT_CONSOLE_LOGLEVEL to minimize the number of test cases I needed. Signed-off-by: Myles Watson Thanks, Myles Acked-by: Stefan Reinauer Acked-by: Uwe Hermann Index: svn/src/console/printk.c =================================================================== --- svn.orig/src/console/printk.c +++ svn/src/console/printk.c @@ -37,9 +37,12 @@ int do_printk(int msg_level, const char } spin_lock(&console_lock); + console_tx_byte('0'+msg_level); + console_tx_byte(':'); + console_tx_byte(' '); va_start(args, fmt); - i = vtxprintf(console_tx_byte, fmt, args); + i = 3 + vtxprintf(console_tx_byte, fmt, args); va_end(args); console_tx_flush(); Index: svn/src/arch/i386/lib/console_print.c =================================================================== --- svn.orig/src/arch/i386/lib/console_print.c +++ svn/src/arch/i386/lib/console_print.c @@ -52,6 +52,9 @@ static void __console_tx_string(int logl { if (ASM_CONSOLE_LOGLEVEL >= loglevel) { unsigned char ch; + __console_tx_byte('0'+loglevel); + __console_tx_byte(':'); + __console_tx_byte(' '); while((ch = *str++) != '\0') { __console_tx_byte(ch); } Index: svn/src/arch/i386/lib/console_printk.c =================================================================== --- svn.orig/src/arch/i386/lib/console_printk.c +++ svn/src/arch/i386/lib/console_printk.c @@ -48,15 +48,15 @@ extern int do_printk(int msg_level, cons #define printk_spew(fmt, arg...) do_printk(BIOS_EMERG , "", ##arg) #endif -#define print_emerg(STR) printk_emerg ("%s", (STR)) -#define print_alert(STR) printk_alert ("%s", (STR)) -#define print_crit(STR) printk_crit ("%s", (STR)) -#define print_err(STR) printk_err ("%s", (STR)) -#define print_warning(STR) printk_warning("%s", (STR)) -#define print_notice(STR) printk_notice ("%s", (STR)) -#define print_info(STR) printk_info ("%s", (STR)) -#define print_debug(STR) printk_debug ("%s", (STR)) -#define print_spew(STR) printk_spew ("%s", (STR)) +#define print_emerg(STR) printk_emerg ("0: %s", (STR)) +#define print_alert(STR) printk_alert ("1: %s", (STR)) +#define print_crit(STR) printk_crit ("2: %s", (STR)) +#define print_err(STR) printk_err ("3: %s", (STR)) +#define print_warning(STR) printk_warning("4: %s", (STR)) +#define print_notice(STR) printk_notice ("5: %s", (STR)) +#define print_info(STR) printk_info ("6: %s", (STR)) +#define print_debug(STR) printk_debug ("7: %s", (STR)) +#define print_spew(STR) printk_spew ("8: %s", (STR)) #define print_emerg_char(CH) printk_emerg ("%c", (CH)) #define print_alert_char(CH) printk_alert ("%c", (CH)) Index: svn/src/arch/i386/lib/printk_init.c =================================================================== --- svn.orig/src/arch/i386/lib/printk_init.c +++ svn/src/arch/i386/lib/printk_init.c @@ -38,8 +38,12 @@ int do_printk(int msg_level, const char return 0; } + console_tx_byte('0'+msg_level); + console_tx_byte(':'); + console_tx_byte(' '); + va_start(args, fmt); - i = vtxprintf(console_tx_byte, fmt, args); + i = 3 + vtxprintf(console_tx_byte, fmt, args); va_end(args); return i;