Johnny Lin has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/45684 )
Change subject: console: Add config EARLY_OVERRIDE_LOGLEVEL for overriding early log level ......................................................................
console: Add config EARLY_OVERRIDE_LOGLEVEL for overriding early log level
For early boot stages before POSTCAR it can override log level by get_option(), default set to n. Make init_log_level() set log level for all stages because get_log_level() is called by printk so avoid calling an overridden function in case it impacts performance.
Tested=On OCP Delta Lake, log level can be overridden by get_option().
Change-Id: I532a88722c8e003b8e187a9714d26104c8ed8c6c Signed-off-by: Johnny Lin johnny_lin@wiwynn.com --- M src/console/Kconfig M src/console/init.c 2 files changed, 12 insertions(+), 8 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/45684/1
diff --git a/src/console/Kconfig b/src/console/Kconfig index bad6c56..9a5d87b 100644 --- a/src/console/Kconfig +++ b/src/console/Kconfig @@ -309,6 +309,13 @@ help Send coreboot debug output to a System76 embedded controller.
+config EARLY_OVERRIDE_LOGLEVEL + bool + default n + help + Set to "y" when the platform overrides the log level by get_option() + during early boot stages before POSTCAR. + config CONSOLE_OVERRIDE_LOGLEVEL bool help diff --git a/src/console/init.c b/src/console/init.c index 1dba9ad..a060683 100644 --- a/src/console/init.c +++ b/src/console/init.c @@ -12,21 +12,21 @@ #define CONSOLE_LEVEL_CONST !ENV_STAGE_HAS_DATA_SECTION
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(); + if (CONSOLE_LEVEL_CONST && !CONFIG(EARLY_OVERRIDE_LOGLEVEL)) + return CONFIG_DEFAULT_CONSOLE_LOGLEVEL;
return console_loglevel; }
static inline void set_log_level(int new_level) { - if (CONSOLE_LEVEL_CONST) + if (CONSOLE_LEVEL_CONST && !CONFIG(EARLY_OVERRIDE_LOGLEVEL)) return;
console_loglevel = new_level; @@ -34,10 +34,7 @@
static void init_log_level(void) { - int debug_level = get_console_loglevel(); - - if (CONSOLE_LEVEL_CONST) - return; + int debug_level = CONFIG_DEFAULT_CONSOLE_LOGLEVEL;
get_option(&debug_level, "debug_level");