summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2020-09-27 13:57:04 +0200
committerPatrick Georgi <pgeorgi@google.com>2020-10-26 06:48:45 +0000
commit308c1b79768a0cb1c48a150f8a75da71dec99b5f (patch)
tree060cf02fa1ec95e1b069c26587974e35af5b9f22 /src
parente836d1121474c46c41a18425df421232ff3d3a21 (diff)
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 <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/45765 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Marc Jones <marc@marcjonesconsulting.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r--src/console/init.c25
1 files changed, 5 insertions, 20 deletions
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 <option.h>
#include <version.h>
-/* 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)