Get rid of MAXIMUM_CONSOLE_LOGLEVEL; compile all messages into the coreboot binary

This option has never had much if any use. It solved a problem over 10
years ago that resulted from an argument over the value or lack thereof
of including all the debug strings in a coreboot image. The answer is
in: it's a good idea to maintain the capability to print all messages,
for many reasons.

This option is  also misleading people, as in a recent discussion, to
believe that log messges are controlled at build time in a way they are
not. For the record, from this day forward, we can print messages at all
log levels and the default log level is set at boot time, as directed by
DEFAULT_CONSOLE_LOGLEVEL. You can set the default to 0 at build time and
if you are having trouble override it in CMOS and get more messages.

Besides, a quick glance shows it's always set to max (9 in this case) in
the very few cases (1) in which it is set.

Change-Id: I60c4cdaf4dcd318b841a6d6c70546417c5626f21
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Reviewed-on: http://review.coreboot.org/3188
Tested-by: build bot (Jenkins)
This commit is contained in:
Ronald G. Minnich 2013-05-03 18:25:27 +02:00
parent c5e036a043
commit 711a6fde0d
5 changed files with 1 additions and 121 deletions

View File

@ -408,11 +408,6 @@ machine.
Use new \textit{chip\_configure} method for configuring (nonpci) Use new \textit{chip\_configure} method for configuring (nonpci)
devices. Set to \texttt{1} for all AMD64 mainboards. devices. Set to \texttt{1} for all AMD64 mainboards.
\item \begin{verbatim}CONFIG_MAXIMUM_CONSOLE_LOGLEVEL\end{verbatim}
Errors or log messages up to this level can be printed. Default is
\texttt{8}, minimum is \texttt{0}, maximum is \texttt{10}.
\item \begin{verbatim}CONFIG_DEFAULT_CONSOLE_LOGLEVEL\end{verbatim} \item \begin{verbatim}CONFIG_DEFAULT_CONSOLE_LOGLEVEL\end{verbatim}
Console will log at this level unless changed. Default is \texttt{7}, Console will log at this level unless changed. Default is \texttt{7},

View File

@ -250,119 +250,40 @@ config CONSOLE_CAR_BUFFER_SIZE
in the DCACHE based RAM to keep console output before it can be in the DCACHE based RAM to keep console output before it can be
saved in a CBMEM buffer. 3K bytes should be enough even for the saved in a CBMEM buffer. 3K bytes should be enough even for the
BIOS_SPEW level. BIOS_SPEW level.
choice
prompt "Maximum console log level"
default MAXIMUM_CONSOLE_LOGLEVEL_8
config MAXIMUM_CONSOLE_LOGLEVEL_8
bool "8: SPEW"
help
Way too many details.
config MAXIMUM_CONSOLE_LOGLEVEL_7
bool "7: DEBUG"
help
Debug-level messages.
config MAXIMUM_CONSOLE_LOGLEVEL_6
bool "6: INFO"
help
Informational messages.
config MAXIMUM_CONSOLE_LOGLEVEL_5
bool "5: NOTICE"
help
Normal but significant conditions.
config MAXIMUM_CONSOLE_LOGLEVEL_4
bool "4: WARNING"
help
Warning conditions.
config MAXIMUM_CONSOLE_LOGLEVEL_3
bool "3: ERR"
help
Error conditions.
config MAXIMUM_CONSOLE_LOGLEVEL_2
bool "2: CRIT"
help
Critical conditions.
config MAXIMUM_CONSOLE_LOGLEVEL_1
bool "1: ALERT"
help
Action must be taken immediately.
config MAXIMUM_CONSOLE_LOGLEVEL_0
bool "0: EMERG"
help
System is unusable.
endchoice
config MAXIMUM_CONSOLE_LOGLEVEL
int
default 0 if MAXIMUM_CONSOLE_LOGLEVEL_0
default 1 if MAXIMUM_CONSOLE_LOGLEVEL_1
default 2 if MAXIMUM_CONSOLE_LOGLEVEL_2
default 3 if MAXIMUM_CONSOLE_LOGLEVEL_3
default 4 if MAXIMUM_CONSOLE_LOGLEVEL_4
default 5 if MAXIMUM_CONSOLE_LOGLEVEL_5
default 6 if MAXIMUM_CONSOLE_LOGLEVEL_6
default 7 if MAXIMUM_CONSOLE_LOGLEVEL_7
default 8 if MAXIMUM_CONSOLE_LOGLEVEL_8
help
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"
depends on (MAXIMUM_CONSOLE_LOGLEVEL_8)
help help
Way too many details. Way too many details.
config DEFAULT_CONSOLE_LOGLEVEL_7 config DEFAULT_CONSOLE_LOGLEVEL_7
bool "7: DEBUG" bool "7: DEBUG"
depends on (MAXIMUM_CONSOLE_LOGLEVEL_8 || MAXIMUM_CONSOLE_LOGLEVEL_7)
help help
Debug-level messages. Debug-level messages.
config DEFAULT_CONSOLE_LOGLEVEL_6 config DEFAULT_CONSOLE_LOGLEVEL_6
bool "6: INFO" bool "6: INFO"
depends on (MAXIMUM_CONSOLE_LOGLEVEL_8 || MAXIMUM_CONSOLE_LOGLEVEL_7 ||\
MAXIMUM_CONSOLE_LOGLEVEL_6)
help help
Informational messages. Informational messages.
config DEFAULT_CONSOLE_LOGLEVEL_5 config DEFAULT_CONSOLE_LOGLEVEL_5
bool "5: NOTICE" bool "5: NOTICE"
depends on (MAXIMUM_CONSOLE_LOGLEVEL_8 || MAXIMUM_CONSOLE_LOGLEVEL_7 ||\
MAXIMUM_CONSOLE_LOGLEVEL_6 || MAXIMUM_CONSOLE_LOGLEVEL_5)
help help
Normal but significant conditions. Normal but significant conditions.
config DEFAULT_CONSOLE_LOGLEVEL_4 config DEFAULT_CONSOLE_LOGLEVEL_4
bool "4: WARNING" 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 help
Warning conditions. Warning conditions.
config DEFAULT_CONSOLE_LOGLEVEL_3 config DEFAULT_CONSOLE_LOGLEVEL_3
bool "3: ERR" 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 help
Error conditions. Error conditions.
config DEFAULT_CONSOLE_LOGLEVEL_2 config DEFAULT_CONSOLE_LOGLEVEL_2
bool "2: CRIT" 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 help
Critical conditions. Critical conditions.
config DEFAULT_CONSOLE_LOGLEVEL_1 config DEFAULT_CONSOLE_LOGLEVEL_1
bool "1: ALERT" 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 help
Action must be taken immediately. Action must be taken immediately.
config DEFAULT_CONSOLE_LOGLEVEL_0 config DEFAULT_CONSOLE_LOGLEVEL_0

View File

@ -86,41 +86,11 @@ static inline void printk(int LEVEL, const char *fmt, ...) {
#else /* defined(__PRE_RAM__) && !CONFIG_EARLY_CONSOLE */ #else /* defined(__PRE_RAM__) && !CONFIG_EARLY_CONSOLE */
#undef WE_CLEANED_UP_ALL_SIDE_EFFECTS
/* We saw some strange effects in the past like coreboot crashing while
* disabling cache as ram for a maximum console log level of 6 and above while
* it worked fine without. In order to catch such issues reliably we are
* always doing a function call to do_printk with the full number of arguments.
* Our favorite reason to do it this way was:
* disable_car();
* printk(BIOS_DEBUG, "CAR disabled\n"); // oops, garbage stack pointer
* move_stack();
* This slightly increases the code size and some unprinted strings will end
* up in the final coreboot binary (most of them compressed). If you want to
* avoid this, do a
* #define WE_CLEANED_UP_ALL_SIDE_EFFECTS
*/
#ifdef WE_CLEANED_UP_ALL_SIDE_EFFECTS
#define printk(LEVEL, fmt, args...) \ #define printk(LEVEL, fmt, args...) \
do { \ do { \
if (CONFIG_MAXIMUM_CONSOLE_LOGLEVEL >= LEVEL) { \
do_printk(LEVEL, fmt, ##args); \ do_printk(LEVEL, fmt, ##args); \
} \
} while(0) } while(0)
#else
#define printk(LEVEL, fmt, args...) \
do { \
if (CONFIG_MAXIMUM_CONSOLE_LOGLEVEL >= LEVEL) { \
do_printk(LEVEL, fmt, ##args); \
} else { \
do_printk(BIOS_NEVER, fmt, ##args); \
} \
} while(0)
#endif
#endif /* defined(__PRE_RAM__) && !CONFIG_EARLY_CONSOLE */ #endif /* defined(__PRE_RAM__) && !CONFIG_EARLY_CONSOLE */
#define print_emerg(STR) printk(BIOS_EMERG, "%s", (STR)) #define print_emerg(STR) printk(BIOS_EMERG, "%s", (STR))

View File

@ -93,10 +93,6 @@ config DEFAULT_CONSOLE_LOGLEVEL
int int
default 9 default 9
config MAXIMUM_CONSOLE_LOGLEVEL
int
default 9
config MAINBOARD_POWER_ON_AFTER_POWER_FAIL config MAINBOARD_POWER_ON_AFTER_POWER_FAIL
bool bool
default y default y

View File

@ -596,8 +596,6 @@ while true ; do
-C|--config) shift; configureonly=1;; -C|--config) shift; configureonly=1;;
-l|--loglevel) shift -l|--loglevel) shift
customizing="${customizing}, loglevel $1" customizing="${customizing}, loglevel $1"
configoptions="${configoptions}CONFIG_MAXIMUM_CONSOLE_LOGLEVEL_$1=y\n"
configoptions="${configoptions}CONFIG_MAXIMUM_CONSOLE_LOGLEVEL=$1\n"
configoptions="${configoptions}CONFIG_DEFAULT_CONSOLE_LOGLEVEL_$1=y\n" configoptions="${configoptions}CONFIG_DEFAULT_CONSOLE_LOGLEVEL_$1=y\n"
configoptions="${configoptions}CONFIG_DEFAULT_CONSOLE_LOGLEVEL=$1\n" configoptions="${configoptions}CONFIG_DEFAULT_CONSOLE_LOGLEVEL=$1\n"
shift;; shift;;