aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorSimon Glass2018-11-15 18:43:49 -0700
committerTom Rini2018-11-26 08:25:32 -0500
commit4d8d3056f885b518c0d1d0b5a793d9bf4b579496 (patch)
tree538a76ff30da67b8fc6ae0a27e6392f9e732e39c /common
parent734e207c5e3ced07f4077ad46460d52912374f2a (diff)
spl: Add support for logging in SPL and TPL
It is sometimes useful to log information in SPL and TPL. Add support for this. Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/Kconfig36
-rw-r--r--common/Makefile4
-rw-r--r--common/spl/spl.c7
3 files changed, 43 insertions, 4 deletions
diff --git a/common/Kconfig b/common/Kconfig
index ba460d9150d..68e4ddfb4ab 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -299,6 +299,10 @@ config SPL_LOGLEVEL
int
default LOGLEVEL
+config TPL_LOGLEVEL
+ int
+ default LOGLEVEL
+
config SILENT_CONSOLE
bool "Support a silent console"
help
@@ -505,6 +509,24 @@ config SPL_LOG_MAX_LEVEL
6 - detail
7 - debug
+config TPL_LOG_MAX_LEVEL
+ int "Maximum log level to record in TPL"
+ depends on TPL_LOG
+ default 3
+ help
+ This selects the maximum log level that will be recorded. Any value
+ higher than this will be ignored. If possible log statements below
+ this level will be discarded at build time. Levels:
+
+ 0 - panic
+ 1 - critical
+ 2 - error
+ 3 - warning
+ 4 - note
+ 5 - info
+ 6 - detail
+ 7 - debug
+
config LOG_CONSOLE
bool "Allow log output to the console"
depends on LOG
@@ -515,9 +537,19 @@ config LOG_CONSOLE
log message is shown - other details like level, category, file and
line number are omitted.
-config LOG_SPL_CONSOLE
+config SPL_LOG_CONSOLE
+ bool "Allow log output to the console in SPL"
+ depends on SPL_LOG
+ default y
+ help
+ Enables a log driver which writes log records to the console.
+ Generally the console is the serial port or LCD display. Only the
+ log message is shown - other details like level, category, file and
+ line number are omitted.
+
+config TPL_LOG_CONSOLE
bool "Allow log output to the console in SPL"
- depends on LOG_SPL
+ depends on TPL_LOG
default y
help
Enables a log driver which writes log records to the console.
diff --git a/common/Makefile b/common/Makefile
index bbe2a6e2390..a1edb7cb177 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -122,8 +122,8 @@ obj-y += cli.o
obj-$(CONFIG_FSL_DDR_INTERACTIVE) += cli_simple.o cli_readline.o
obj-$(CONFIG_DFU_OVER_USB) += dfu.o
obj-y += command.o
-obj-$(CONFIG_$(SPL_)LOG) += log.o
-obj-$(CONFIG_$(SPL_)LOG_CONSOLE) += log_console.o
+obj-$(CONFIG_$(SPL_TPL_)LOG) += log.o
+obj-$(CONFIG_$(SPL_TPL_)LOG_CONSOLE) += log_console.o
obj-y += s_record.o
obj-$(CONFIG_CMD_LOADB) += xyzModem.o
obj-$(CONFIG_$(SPL_TPL_)YMODEM_SUPPORT) += xyzModem.o
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 12f9359c0ac..740182a8be6 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -336,6 +336,13 @@ static int spl_common_init(bool setup_malloc)
return ret;
}
bootstage_mark_name(BOOTSTAGE_ID_START_SPL, "spl");
+#if CONFIG_IS_ENABLED(LOG)
+ ret = log_init();
+ if (ret) {
+ debug("%s: Failed to set up logging\n", __func__);
+ return ret;
+ }
+#endif
if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
ret = fdtdec_setup();
if (ret) {