Change console code to emit SPEW with DEFAULT_CONSOLE_LOGLEVEL==8.

Make MAXIMUM_CONSOLE_LOGLEVEL >= DEFAULT_CONSOLE_LOGLEVEL.

Signed-off-by: Myles Watson <mylesgw@gmail.com>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4794 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Myles Watson 2009-10-16 19:29:45 +00:00
parent 04000f4642
commit 0364618fe8
8 changed files with 103 additions and 103 deletions

View File

@ -11,14 +11,14 @@ static void __console_tx_nibble(unsigned nibble)
static void __console_tx_char(int loglevel, unsigned char byte) static void __console_tx_char(int loglevel, unsigned char byte)
{ {
if (ASM_CONSOLE_LOGLEVEL > loglevel) { if (ASM_CONSOLE_LOGLEVEL >= loglevel) {
uart_tx_byte(byte); uart_tx_byte(byte);
} }
} }
static void __console_tx_hex8(int loglevel, unsigned char value) 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 >> 4U) & 0x0fU);
__console_tx_nibble(value & 0x0fU); __console_tx_nibble(value & 0x0fU);
} }
@ -26,7 +26,7 @@ static void __console_tx_hex8(int loglevel, unsigned char value)
static void __console_tx_hex16(int loglevel, unsigned short value) 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 >> 12U) & 0x0fU);
__console_tx_nibble((value >> 8U) & 0x0fU); __console_tx_nibble((value >> 8U) & 0x0fU);
__console_tx_nibble((value >> 4U) & 0x0fU); __console_tx_nibble((value >> 4U) & 0x0fU);
@ -36,7 +36,7 @@ static void __console_tx_hex16(int loglevel, unsigned short value)
static void __console_tx_hex32(int loglevel, unsigned int value) 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 >> 28U) & 0x0fU);
__console_tx_nibble((value >> 24U) & 0x0fU); __console_tx_nibble((value >> 24U) & 0x0fU);
__console_tx_nibble((value >> 20U) & 0x0fU); __console_tx_nibble((value >> 20U) & 0x0fU);
@ -50,7 +50,7 @@ static void __console_tx_hex32(int loglevel, unsigned int value)
static void __console_tx_string(int loglevel, const char *str) static void __console_tx_string(int loglevel, const char *str)
{ {
if (ASM_CONSOLE_LOGLEVEL > loglevel) { if (ASM_CONSOLE_LOGLEVEL >= loglevel) {
unsigned char ch; unsigned char ch;
while((ch = *str++) != '\0') { while((ch = *str++) != '\0') {
__console_tx_byte(ch); __console_tx_byte(ch);

View File

@ -11,39 +11,39 @@ extern int do_printk(int msg_level, const char *fmt, ...);
#define printk_debug(fmt, arg...) do_printk(BIOS_DEBUG ,fmt, ##arg) #define printk_debug(fmt, arg...) do_printk(BIOS_DEBUG ,fmt, ##arg)
#define printk_spew(fmt, arg...) do_printk(BIOS_SPEW ,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 #undef printk_emerg
#define printk_emerg(fmt, arg...) do_printk(BIOS_EMERG , "", ##arg) #define printk_emerg(fmt, arg...) do_printk(BIOS_EMERG , "", ##arg)
#endif #endif
#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_ALERT #if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_ALERT
#undef printk_alert #undef printk_alert
#define printk_alert(fmt, arg...) do_printk(BIOS_EMERG , "", ##arg) #define printk_alert(fmt, arg...) do_printk(BIOS_EMERG , "", ##arg)
#endif #endif
#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_CRIT #if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_CRIT
#undef printk_crit #undef printk_crit
#define printk_crit(fmt, arg...) do_printk(BIOS_EMERG , "", ##arg) #define printk_crit(fmt, arg...) do_printk(BIOS_EMERG , "", ##arg)
#endif #endif
#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_ERR #if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_ERR
#undef printk_err #undef printk_err
#define printk_err(fmt, arg...) do_printk(BIOS_EMERG , "", ##arg) #define printk_err(fmt, arg...) do_printk(BIOS_EMERG , "", ##arg)
#endif #endif
#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_WARNING #if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_WARNING
#undef printk_warning #undef printk_warning
#define printk_warning(fmt, arg...) do_printk(BIOS_EMERG , "", ##arg) #define printk_warning(fmt, arg...) do_printk(BIOS_EMERG , "", ##arg)
#endif #endif
#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_NOTICE #if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_NOTICE
#undef printk_notice #undef printk_notice
#define printk_notice(fmt, arg...) do_printk(BIOS_EMERG , "", ##arg) #define printk_notice(fmt, arg...) do_printk(BIOS_EMERG , "", ##arg)
#endif #endif
#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_INFO #if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_INFO
#undef printk_info #undef printk_info
#define printk_info(fmt, arg...) do_printk(BIOS_EMERG , "", ##arg) #define printk_info(fmt, arg...) do_printk(BIOS_EMERG , "", ##arg)
#endif #endif
#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_DEBUG #if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_DEBUG
#undef printk_debug #undef printk_debug
#define printk_debug(fmt, arg...) do_printk(BIOS_EMERG , "", ##arg) #define printk_debug(fmt, arg...) do_printk(BIOS_EMERG , "", ##arg)
#endif #endif
#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_SPEW #if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_SPEW
#undef printk_spew #undef printk_spew
#define printk_spew(fmt, arg...) do_printk(BIOS_EMERG , "", ##arg) #define printk_spew(fmt, arg...) do_printk(BIOS_EMERG , "", ##arg)
#endif #endif

View File

@ -34,7 +34,7 @@ int do_printk(int msg_level, const char *fmt, ...)
va_list args; va_list args;
int i; int i;
if (msg_level >= console_loglevel) { if (msg_level > console_loglevel) {
return 0; return 0;
} }

View File

@ -79,45 +79,45 @@ config CONSOLE_VGA_ONBOARD_AT_FIRST
If not selected, the last adapter found will be used. If not selected, the last adapter found will be used.
choice choice
prompt "Maximum console log level" prompt "Maximum console log level"
default MAXIMUM_CONSOLE_LOGLEVEL_8 default MAXIMUM_CONSOLE_LOGLEVEL_8
config MAXIMUM_CONSOLE_LOGLEVEL_8 config MAXIMUM_CONSOLE_LOGLEVEL_8
bool "8: SPEW" bool "8: SPEW"
help help
Way too many details. Way too many details.
config MAXIMUM_CONSOLE_LOGLEVEL_7 config MAXIMUM_CONSOLE_LOGLEVEL_7
bool "7: DEBUG" bool "7: DEBUG"
help help
Debug-level messages. Debug-level messages.
config MAXIMUM_CONSOLE_LOGLEVEL_6 config MAXIMUM_CONSOLE_LOGLEVEL_6
bool "6: INFO" bool "6: INFO"
help help
Informational messages. Informational messages.
config MAXIMUM_CONSOLE_LOGLEVEL_5 config MAXIMUM_CONSOLE_LOGLEVEL_5
bool "5: NOTICE" bool "5: NOTICE"
help help
Normal but significant conditions. Normal but significant conditions.
config MAXIMUM_CONSOLE_LOGLEVEL_4 config MAXIMUM_CONSOLE_LOGLEVEL_4
bool "4: WARNING" bool "4: WARNING"
help help
Warning conditions. Warning conditions.
config MAXIMUM_CONSOLE_LOGLEVEL_3 config MAXIMUM_CONSOLE_LOGLEVEL_3
bool "3: ERR" bool "3: ERR"
help help
Error conditions. Error conditions.
config MAXIMUM_CONSOLE_LOGLEVEL_2 config MAXIMUM_CONSOLE_LOGLEVEL_2
bool "2: CRIT" bool "2: CRIT"
help help
Critical conditions. Critical conditions.
config MAXIMUM_CONSOLE_LOGLEVEL_1 config MAXIMUM_CONSOLE_LOGLEVEL_1
bool "1: ALERT" bool "1: ALERT"
help help
Action must be taken immediately. Action must be taken immediately.
config MAXIMUM_CONSOLE_LOGLEVEL_0 config MAXIMUM_CONSOLE_LOGLEVEL_0
bool "0: EMERG" bool "0: EMERG"
help help
System is unusable. System is unusable.
endchoice endchoice
@ -136,45 +136,65 @@ config MAXIMUM_CONSOLE_LOGLEVEL
Map the log level config names to an integer. Map the log level config names to an integer.
choice choice
prompt "Default console log level" prompt "Default console log level"
default DEFAULT_CONSOLE_LOGLEVEL_8 default DEFAULT_CONSOLE_LOGLEVEL_8
config DEFAULT_CONSOLE_LOGLEVEL_8 config DEFAULT_CONSOLE_LOGLEVEL_8
bool "8: SPEW" bool "8: SPEW"
help depends on (MAXIMUM_CONSOLE_LOGLEVEL_8)
Way too many details. help
Way too many details.
config DEFAULT_CONSOLE_LOGLEVEL_7 config DEFAULT_CONSOLE_LOGLEVEL_7
bool "7: DEBUG" bool "7: DEBUG"
help depends on (MAXIMUM_CONSOLE_LOGLEVEL_8 || MAXIMUM_CONSOLE_LOGLEVEL_7)
Debug-level messages. help
Debug-level messages.
config DEFAULT_CONSOLE_LOGLEVEL_6 config DEFAULT_CONSOLE_LOGLEVEL_6
bool "6: INFO" bool "6: INFO"
help depends on (MAXIMUM_CONSOLE_LOGLEVEL_8 || MAXIMUM_CONSOLE_LOGLEVEL_7 ||\
Informational messages. MAXIMUM_CONSOLE_LOGLEVEL_6)
help
Informational messages.
config DEFAULT_CONSOLE_LOGLEVEL_5 config DEFAULT_CONSOLE_LOGLEVEL_5
bool "5: NOTICE" bool "5: NOTICE"
help depends on (MAXIMUM_CONSOLE_LOGLEVEL_8 || MAXIMUM_CONSOLE_LOGLEVEL_7 ||\
Normal but significant conditions. MAXIMUM_CONSOLE_LOGLEVEL_6 || MAXIMUM_CONSOLE_LOGLEVEL_5)
help
Normal but significant conditions.
config DEFAULT_CONSOLE_LOGLEVEL_4 config DEFAULT_CONSOLE_LOGLEVEL_4
bool "4: WARNING" bool "4: WARNING"
help depends on (MAXIMUM_CONSOLE_LOGLEVEL_8 || MAXIMUM_CONSOLE_LOGLEVEL_7 ||\
Warning conditions. MAXIMUM_CONSOLE_LOGLEVEL_6 || MAXIMUM_CONSOLE_LOGLEVEL_5 ||\
MAXIMUM_CONSOLE_LOGLEVEL_4)
help
Warning conditions.
config DEFAULT_CONSOLE_LOGLEVEL_3 config DEFAULT_CONSOLE_LOGLEVEL_3
bool "3: ERR" bool "3: ERR"
help depends on (MAXIMUM_CONSOLE_LOGLEVEL_8 || MAXIMUM_CONSOLE_LOGLEVEL_7 ||\
Error conditions. MAXIMUM_CONSOLE_LOGLEVEL_6 || MAXIMUM_CONSOLE_LOGLEVEL_5 ||\
MAXIMUM_CONSOLE_LOGLEVEL_4 || MAXIMUM_CONSOLE_LOGLEVEL_3)
help
Error conditions.
config DEFAULT_CONSOLE_LOGLEVEL_2 config DEFAULT_CONSOLE_LOGLEVEL_2
bool "2: CRIT" bool "2: CRIT"
help depends on (MAXIMUM_CONSOLE_LOGLEVEL_8 || MAXIMUM_CONSOLE_LOGLEVEL_7 ||\
Critical conditions. 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 config DEFAULT_CONSOLE_LOGLEVEL_1
bool "1: ALERT" bool "1: ALERT"
help depends on (MAXIMUM_CONSOLE_LOGLEVEL_8 || MAXIMUM_CONSOLE_LOGLEVEL_7 ||\
Action must be taken immediately. 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 config DEFAULT_CONSOLE_LOGLEVEL_0
bool "0: EMERG" bool "0: EMERG"
help help
System is unusable. System is unusable.
endchoice endchoice

View File

@ -81,11 +81,3 @@ void post_code(uint8_t value)
outb(value, 0x80); outb(value, 0x80);
#endif #endif
} }
/* Report a fatal error */
void __attribute__((noreturn)) die(const char *msg)
{
printk_emerg("%s", msg);
post_code(0xff);
while (1); /* Halt */
}

View File

@ -32,7 +32,7 @@ int do_printk(int msg_level, const char *fmt, ...)
va_list args; va_list args;
int i; int i;
if (msg_level >= console_loglevel) { if (msg_level > console_loglevel) {
return 0; return 0;
} }

View File

@ -41,39 +41,39 @@ int do_printk(int msg_level, const char *fmt, ...) __attribute__((format(printf,
#define printk_debug(fmt, arg...) do_printk(BIOS_DEBUG ,fmt, ##arg) #define printk_debug(fmt, arg...) do_printk(BIOS_DEBUG ,fmt, ##arg)
#define printk_spew(fmt, arg...) do_printk(BIOS_SPEW ,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 #undef printk_emerg
#define printk_emerg(fmt, arg...) do {} while(0) #define printk_emerg(fmt, arg...) do {} while(0)
#endif #endif
#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_ALERT #if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_ALERT
#undef printk_alert #undef printk_alert
#define printk_alert(fmt, arg...) do {} while(0) #define printk_alert(fmt, arg...) do {} while(0)
#endif #endif
#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_CRIT #if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_CRIT
#undef printk_crit #undef printk_crit
#define printk_crit(fmt, arg...) do {} while(0) #define printk_crit(fmt, arg...) do {} while(0)
#endif #endif
#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_ERR #if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_ERR
#undef printk_err #undef printk_err
#define printk_err(fmt, arg...) do {} while(0) #define printk_err(fmt, arg...) do {} while(0)
#endif #endif
#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_WARNING #if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_WARNING
#undef printk_warning #undef printk_warning
#define printk_warning(fmt, arg...) do {} while(0) #define printk_warning(fmt, arg...) do {} while(0)
#endif #endif
#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_NOTICE #if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_NOTICE
#undef printk_notice #undef printk_notice
#define printk_notice(fmt, arg...) do {} while(0) #define printk_notice(fmt, arg...) do {} while(0)
#endif #endif
#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_INFO #if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_INFO
#undef printk_info #undef printk_info
#define printk_info(fmt, arg...) do {} while(0) #define printk_info(fmt, arg...) do {} while(0)
#endif #endif
#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_DEBUG #if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_DEBUG
#undef printk_debug #undef printk_debug
#define printk_debug(fmt, arg...) do {} while(0) #define printk_debug(fmt, arg...) do {} while(0)
#endif #endif
#if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL <= BIOS_SPEW #if CONFIG_MAXIMUM_CONSOLE_LOGLEVEL < BIOS_SPEW
#undef printk_spew #undef printk_spew
#define printk_spew(fmt, arg...) do {} while(0) #define printk_spew(fmt, arg...) do {} while(0)
#endif #endif

View File

@ -3,21 +3,9 @@
/* Safe for inclusion in assembly */ /* 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 #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 #define ASM_CONSOLE_LOGLEVEL CONFIG_MAXIMUM_CONSOLE_LOGLEVEL
#endif #endif
#endif
#define BIOS_EMERG 0 /* system is unusable */ #define BIOS_EMERG 0 /* system is unusable */
#define BIOS_ALERT 1 /* action must be taken immediately */ #define BIOS_ALERT 1 /* action must be taken immediately */