From 308c1b79768a0cb1c48a150f8a75da71dec99b5f Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Sun, 27 Sep 2020 13:57:04 +0200 Subject: console/init: Drop CONSOLE_LEVEL_CONST We limited the configurability of the debug level to stages that have a `.data` section. This is not really a requirement, because a `.bss` section should suffice and we always have that now. We want to make the debug level configurable early but also want to avoid calling get_option() early, as an error therein could result in no console output at all. Hence, we compromise and start using get_option() from the second console init on. TEST=Booted QEMU once with `debug_level=Debug` and once with `debug_level=Notice`. On the second boot, most messages vanished for all stages but the bootblock. Change-Id: I11484fc32dcbba8d31772bd0b82785f17b2fba11 Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/c/coreboot/+/45765 Reviewed-by: Angel Pons Reviewed-by: Marc Jones Tested-by: build bot (Jenkins) --- src/console/init.c | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) (limited to 'src/console/init.c') diff --git a/src/console/init.c b/src/console/init.c index 1dba9ad664..c59807785c 100644 --- a/src/console/init.c +++ b/src/console/init.c @@ -8,40 +8,25 @@ #include #include -/* Mutable console log level only allowed when RAM comes online. */ -#define CONSOLE_LEVEL_CONST !ENV_STAGE_HAS_DATA_SECTION +#define FIRST_CONSOLE (ENV_BOOTBLOCK || (CONFIG(NO_BOOTBLOCK_CONSOLE) && ENV_ROMSTAGE)) static int console_inited; -static int console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL; +static int console_loglevel; static inline int get_log_level(void) { if (console_inited == 0) return -1; - if (CONSOLE_LEVEL_CONST) - return get_console_loglevel(); return console_loglevel; } -static inline void set_log_level(int new_level) -{ - if (CONSOLE_LEVEL_CONST) - return; - - console_loglevel = new_level; -} - static void init_log_level(void) { - int debug_level = get_console_loglevel(); - - if (CONSOLE_LEVEL_CONST) - return; - - get_option(&debug_level, "debug_level"); + console_loglevel = get_console_loglevel(); - set_log_level(debug_level); + if (!FIRST_CONSOLE) + get_option(&console_loglevel, "debug_level"); } int console_log_level(int msg_level) -- cgit v1.2.3