On Mon, Oct 12, 2009 at 4:17 PM, Uwe Hermann <[email protected]> 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 <[email protected]>

Thanks,
Myles
Index: svn/src/include/console/console.h
===================================================================
--- svn.orig/src/include/console/console.h
+++ svn/src/include/console/console.h
@@ -41,39 +41,39 @@ int do_printk(int msg_level, const char 
 #define printk_debug(fmt, arg...)   do_printk(BIOS_DEBUG   ,fmt, ##arg)
 #define printk_spew(fmt, arg...)    do_printk(BIOS_SPEW    ,fmt, ##arg)
 
-#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_EMERG
+#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_EMERG
 #undef  printk_emerg
 #define printk_emerg(fmt, arg...)   do {} while(0)
 #endif
-#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_ALERT
+#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_ALERT
 #undef  printk_alert
 #define printk_alert(fmt, arg...)   do {} while(0)
 #endif
-#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_CRIT
+#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_CRIT
 #undef  printk_crit
 #define printk_crit(fmt, arg...)    do {} while(0)
 #endif
-#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_ERR
+#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_ERR
 #undef  printk_err
 #define printk_err(fmt, arg...)     do {} while(0)
 #endif
-#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_WARNING
+#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_WARNING
 #undef  printk_warning
 #define printk_warning(fmt, arg...) do {} while(0)
 #endif
-#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_NOTICE
+#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_NOTICE
 #undef  printk_notice
 #define printk_notice(fmt, arg...)  do {} while(0)
 #endif
-#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_INFO
+#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_INFO
 #undef  printk_info
 #define printk_info(fmt, arg...)    do {} while(0)
 #endif
-#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_DEBUG
+#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_DEBUG
 #undef  printk_debug
 #define printk_debug(fmt, arg...)   do {} while(0)
 #endif
-#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_SPEW
+#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_SPEW
 #undef  printk_spew
 #define printk_spew(fmt, arg...)    do {} while(0)
 #endif
Index: svn/src/console/printk.c
===================================================================
--- svn.orig/src/console/printk.c
+++ svn/src/console/printk.c
@@ -32,7 +32,7 @@ int do_printk(int msg_level, const char 
 	va_list args;
 	int i;
 
-	if (msg_level >= console_loglevel) {
+	if (msg_level > console_loglevel) {
 		return 0;
 	}
 
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
@@ -11,14 +11,14 @@ static void __console_tx_nibble(unsigned
 
 static void __console_tx_char(int loglevel, unsigned char byte)
 {
-	if (ASM_CONSOLE_LOGLEVEL > loglevel) {
+	if (ASM_CONSOLE_LOGLEVEL >= loglevel) {
 		uart_tx_byte(byte);
 	}
 }
 
 static void __console_tx_hex8(int loglevel, unsigned char value)
 {
-	if (ASM_CONSOLE_LOGLEVEL > loglevel) {
+	if (ASM_CONSOLE_LOGLEVEL >= loglevel) {
 		__console_tx_nibble((value >>  4U) & 0x0fU);
 		__console_tx_nibble(value & 0x0fU);
 	}
@@ -26,7 +26,7 @@ static void __console_tx_hex8(int loglev
 
 static void __console_tx_hex16(int loglevel, unsigned short value)
 {
-	if (ASM_CONSOLE_LOGLEVEL > loglevel) {
+	if (ASM_CONSOLE_LOGLEVEL >= loglevel) {
 		__console_tx_nibble((value >> 12U) & 0x0fU);
 		__console_tx_nibble((value >>  8U) & 0x0fU);
 		__console_tx_nibble((value >>  4U) & 0x0fU);
@@ -36,7 +36,7 @@ static void __console_tx_hex16(int logle
 
 static void __console_tx_hex32(int loglevel, unsigned int value)
 {
-	if (ASM_CONSOLE_LOGLEVEL > loglevel) {
+	if (ASM_CONSOLE_LOGLEVEL >= loglevel) {
 		__console_tx_nibble((value >> 28U) & 0x0fU);
 		__console_tx_nibble((value >> 24U) & 0x0fU);
 		__console_tx_nibble((value >> 20U) & 0x0fU);
@@ -50,7 +50,7 @@ static void __console_tx_hex32(int logle
 
 static void __console_tx_string(int loglevel, const char *str)
 {
-	if (ASM_CONSOLE_LOGLEVEL > loglevel) {
+	if (ASM_CONSOLE_LOGLEVEL >= loglevel) {
 		unsigned char ch;
 		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
@@ -11,39 +11,39 @@ extern int do_printk(int msg_level, cons
 #define printk_debug(fmt, arg...)   do_printk(BIOS_DEBUG   ,fmt, ##arg)
 #define printk_spew(fmt, arg...)    do_printk(BIOS_SPEW    ,fmt, ##arg)
 
-#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_EMERG
+#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_EMERG
 #undef  printk_emerg
 #define printk_emerg(fmt, arg...)   do_printk(BIOS_EMERG   , "", ##arg)
 #endif
-#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_ALERT
+#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_ALERT
 #undef  printk_alert
 #define printk_alert(fmt, arg...)   do_printk(BIOS_EMERG   , "", ##arg)
 #endif
-#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_CRIT
+#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_CRIT
 #undef  printk_crit
 #define printk_crit(fmt, arg...)    do_printk(BIOS_EMERG   , "", ##arg)
 #endif
-#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_ERR
+#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_ERR
 #undef  printk_err
 #define printk_err(fmt, arg...)     do_printk(BIOS_EMERG   , "", ##arg)
 #endif
-#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_WARNING
+#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_WARNING
 #undef  printk_warning
 #define printk_warning(fmt, arg...) do_printk(BIOS_EMERG   , "", ##arg)
 #endif
-#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_NOTICE
+#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_NOTICE
 #undef  printk_notice
 #define printk_notice(fmt, arg...)  do_printk(BIOS_EMERG   , "", ##arg)
 #endif
-#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_INFO
+#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_INFO
 #undef  printk_info
 #define printk_info(fmt, arg...)    do_printk(BIOS_EMERG   , "", ##arg)
 #endif
-#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_DEBUG
+#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_DEBUG
 #undef  printk_debug
 #define printk_debug(fmt, arg...)   do_printk(BIOS_EMERG   , "", ##arg)
 #endif
-#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_SPEW
+#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_SPEW
 #undef  printk_spew
 #define printk_spew(fmt, arg...)    do_printk(BIOS_EMERG   , "", ##arg)
 #endif
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
@@ -34,7 +34,7 @@ int do_printk(int msg_level, const char 
 	va_list args;
 	int i;
 
-	if (msg_level >= console_loglevel) {
+	if (msg_level > console_loglevel) {
 		return 0;
 	}
 
Index: svn/src/console/Kconfig
===================================================================
--- svn.orig/src/console/Kconfig
+++ svn/src/console/Kconfig
@@ -141,34 +141,54 @@ choice
 
 config DEFAULT_CONSOLE_LOGLEVEL_8
         bool "8: SPEW"
+	depends on (MAXIMUM_CONSOLE_LOGLEVEL >= 8)
         help
           Way too many details.
 config DEFAULT_CONSOLE_LOGLEVEL_7
         bool "7: DEBUG"
+	depends on (MAXIMUM_CONSOLE_LOGLEVEL_8 || MAXIMUM_CONSOLE_LOGLEVEL_7)
         help
           Debug-level messages.
 config DEFAULT_CONSOLE_LOGLEVEL_6
         bool "6: INFO"
+	depends on (MAXIMUM_CONSOLE_LOGLEVEL_8 || MAXIMUM_CONSOLE_LOGLEVEL_7 ||\
+		    MAXIMUM_CONSOLE_LOGLEVEL_6)
         help
           Informational messages.
 config DEFAULT_CONSOLE_LOGLEVEL_5
         bool "5: NOTICE"
+	depends on (MAXIMUM_CONSOLE_LOGLEVEL_8 || MAXIMUM_CONSOLE_LOGLEVEL_7 ||\
+		    MAXIMUM_CONSOLE_LOGLEVEL_6 || MAXIMUM_CONSOLE_LOGLEVEL_5)
         help
           Normal but significant conditions.
 config DEFAULT_CONSOLE_LOGLEVEL_4
         bool "4: WARNING"
+	depends on (MAXIMUM_CONSOLE_LOGLEVEL_8 || MAXIMUM_CONSOLE_LOGLEVEL_7 ||\
+		    MAXIMUM_CONSOLE_LOGLEVEL_6 || MAXIMUM_CONSOLE_LOGLEVEL_5 ||\
+		    MAXIMUM_CONSOLE_LOGLEVEL_4)
         help
           Warning conditions.
 config DEFAULT_CONSOLE_LOGLEVEL_3
         bool "3: ERR"
+	depends on (MAXIMUM_CONSOLE_LOGLEVEL_8 || MAXIMUM_CONSOLE_LOGLEVEL_7 ||\
+		    MAXIMUM_CONSOLE_LOGLEVEL_6 || MAXIMUM_CONSOLE_LOGLEVEL_5 ||\
+		    MAXIMUM_CONSOLE_LOGLEVEL_4 || MAXIMUM_CONSOLE_LOGLEVEL_3)
         help
           Error conditions.
 config DEFAULT_CONSOLE_LOGLEVEL_2
         bool "2: CRIT"
+	depends on (MAXIMUM_CONSOLE_LOGLEVEL_8 || MAXIMUM_CONSOLE_LOGLEVEL_7 ||\
+		    MAXIMUM_CONSOLE_LOGLEVEL_6 || MAXIMUM_CONSOLE_LOGLEVEL_5 ||\
+		    MAXIMUM_CONSOLE_LOGLEVEL_4 || MAXIMUM_CONSOLE_LOGLEVEL_3 ||\
+		    MAXIMUM_CONSOLE_LOGLEVEL_2)
         help
           Critical conditions.
 config DEFAULT_CONSOLE_LOGLEVEL_1
         bool "1: ALERT"
+	depends on (MAXIMUM_CONSOLE_LOGLEVEL_8 || MAXIMUM_CONSOLE_LOGLEVEL_7 ||\
+		    MAXIMUM_CONSOLE_LOGLEVEL_6 || MAXIMUM_CONSOLE_LOGLEVEL_5 ||\
+		    MAXIMUM_CONSOLE_LOGLEVEL_4 || MAXIMUM_CONSOLE_LOGLEVEL_3 ||\
+		    MAXIMUM_CONSOLE_LOGLEVEL_2 || MAXIMUM_CONSOLE_LOGLEVEL_1)
         help
           Action must be taken immediately.
 config DEFAULT_CONSOLE_LOGLEVEL_0
Index: svn/src/include/console/loglevel.h
===================================================================
--- svn.orig/src/include/console/loglevel.h
+++ svn/src/include/console/loglevel.h
@@ -3,21 +3,9 @@
 
 /* Safe for inclusion in assembly */
 
-#ifndef CONFIG_MAXIMUM_CONSOLE_LOGLEVEL
-#define CONFIG_MAXIMUM_CONSOLE_LOGLEVEL 8
-#endif
-
-#ifndef CONFIG_DEFAULT_CONSOLE_LOGLEVEL
-#define CONFIG_DEFAULT_CONSOLE_LOGLEVEL 8 /* anything MORE serious than BIOS_SPEW */
-#endif
-
 #ifndef ASM_CONSOLE_LOGLEVEL
-#if (CONFIG_DEFAULT_CONSOLE_LOGLEVEL <= CONFIG_MAXIMUM_CONSOLE_LOGLEVEL)
-#define ASM_CONSOLE_LOGLEVEL CONFIG_DEFAULT_CONSOLE_LOGLEVEL
-#else
 #define ASM_CONSOLE_LOGLEVEL CONFIG_MAXIMUM_CONSOLE_LOGLEVEL
 #endif
-#endif
 
 #define BIOS_EMERG      0   /* system is unusable                   */
 #define BIOS_ALERT      1   /* action must be taken immediately     */
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;
-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to