From 4ecd42f9b52cd01b659c21f62e5ca2e79f5da4ab Mon Sep 17 00:00:00 2001 From: Julien Viard de Galbert Date: Tue, 20 Feb 2018 15:01:27 +0100 Subject: console: Introduce a way for mainboard to override the loglevel This change adds a config option to allow mainboard to override the console loglevel. When the option is set, the platform has to define the function get_console_loglevel returning a valid loglevel value. This allows a mainboard to sample a GPIO to switch the loglevel value between different environments (qualification vs production) without re-flashing. Change-Id: Id6cc72b8fe5c4c50a6f83ce80e6440b078eec6e2 Signed-off-by: Julien Viard de Galbert Reviewed-on: https://review.coreboot.org/23712 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth Reviewed-by: Nico Huber --- src/include/console/console.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/include/console') diff --git a/src/include/console/console.h b/src/include/console/console.h index aa935e4579..1ecf89c288 100644 --- a/src/include/console/console.h +++ b/src/include/console/console.h @@ -64,6 +64,18 @@ void do_putchar(unsigned char byte); #define printk(LEVEL, fmt, args...) \ do { do_printk(LEVEL, fmt, ##args); } while (0) +#if IS_ENABLED(CONFIG_CONSOLE_OVERRIDE_LOGLEVEL) +/* + * This function should be implemented at mainboard level. + * The returned value will _replace_ the loglevel value; + */ +int get_console_loglevel(void); +#else +static inline int get_console_loglevel(void) +{ + return CONFIG_DEFAULT_CONSOLE_LOGLEVEL; +} +#endif #else static inline void console_init(void) {} static inline int console_log_level(int msg_level) { return 0; } -- cgit v1.2.3