console: only allow console messages after initialization
The console subsystem allows printk() to be called prior to the drivers and/or infrastructure is completely set up. In those situations don't allow messages to be added until the console is completely initialized. BUG=b:73898539 Change-Id: Idc3840132d7f95f8e22045d7484c528d828bb0de Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/24917 Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Furquan Shaikh <furquan@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
277f4b9974
commit
60320182d0
|
@ -14,6 +14,7 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <arch/early_variables.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <console/uart.h>
|
#include <console/uart.h>
|
||||||
#include <console/streams.h>
|
#include <console/streams.h>
|
||||||
|
@ -29,10 +30,13 @@
|
||||||
#define CONSOLE_LEVEL_CONST 0
|
#define CONSOLE_LEVEL_CONST 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static int console_inited CAR_GLOBAL;
|
||||||
static int console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL;
|
static int console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL;
|
||||||
|
|
||||||
static inline int get_log_level(void)
|
static inline int get_log_level(void)
|
||||||
{
|
{
|
||||||
|
if (car_get_var(console_inited) == 0)
|
||||||
|
return -1;
|
||||||
if (CONSOLE_LEVEL_CONST)
|
if (CONSOLE_LEVEL_CONST)
|
||||||
return get_console_loglevel();
|
return get_console_loglevel();
|
||||||
|
|
||||||
|
@ -74,6 +78,8 @@ asmlinkage void console_init(void)
|
||||||
|
|
||||||
console_hw_init();
|
console_hw_init();
|
||||||
|
|
||||||
|
car_set_var(console_inited, 1);
|
||||||
|
|
||||||
printk(BIOS_NOTICE, "\n\ncoreboot-%s%s %s " ENV_STRING " starting...\n",
|
printk(BIOS_NOTICE, "\n\ncoreboot-%s%s %s " ENV_STRING " starting...\n",
|
||||||
coreboot_version, coreboot_extra_version, coreboot_build);
|
coreboot_version, coreboot_extra_version, coreboot_build);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue