Martin Roth has uploaded this change for review.

View Change

Console: Allow console UART to be enabled without serial console

Currently, when we disable serial console, the serial console uart
remains uninitialized. This patch allows coreboot to still set up
the UART, even if we're not sending the console to it.

BUG=b:74392237
TEST=Verify UART still works, even with coreboot console disabled

Signed-off-by: Martin Roth <martinroth@chromium.org>
Change-Id: Ic0942634ab8a9fcafdc1ea099721c127202e9f9a
---
M src/console/Kconfig
M src/drivers/uart/Kconfig
M src/include/console/uart.h
3 files changed, 28 insertions(+), 8 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/80/33380/1
diff --git a/src/console/Kconfig b/src/console/Kconfig
index 61ba667..da769d3 100644
--- a/src/console/Kconfig
+++ b/src/console/Kconfig
@@ -33,6 +33,7 @@
bool "Serial port console output"
default y
depends on DRIVERS_UART
+ select ENABLE_UART
help
Send coreboot debug output to a serial port.

@@ -47,7 +48,7 @@
specific UART has to be used (e.g. when the platform code
performs dangerous configurations).

-if CONSOLE_SERIAL
+if ENABLE_UART

comment "I/O mapped, 8250-compatible"
depends on DRIVERS_UART_8250IO
@@ -79,13 +80,13 @@
Map the COM port number to the respective I/O port.

comment "Serial port base address = 0x3f8"
-depends on UART_FOR_CONSOLE = 0
+depends on UART_FOR_CONSOLE = 0 && DRIVERS_UART_8250IO
comment "Serial port base address = 0x2f8"
-depends on UART_FOR_CONSOLE = 1
+depends on UART_FOR_CONSOLE = 1 && DRIVERS_UART_8250IO
comment "Serial port base address = 0x3e8"
-depends on UART_FOR_CONSOLE = 2
+depends on UART_FOR_CONSOLE = 2 && DRIVERS_UART_8250IO
comment "Serial port base address = 0x2e8"
-depends on UART_FOR_CONSOLE = 3
+depends on UART_FOR_CONSOLE = 3 && DRIVERS_UART_8250IO

config UART_OVERRIDE_BAUDRATE
boolean
@@ -156,7 +157,7 @@
default 3
depends on DRIVERS_UART_8250IO || DRIVERS_UART_8250MEM

-endif # CONSOLE_SERIAL
+endif # ENABLE_UART

config SPKMODEM
bool "spkmodem (console on speaker) console output"
diff --git a/src/drivers/uart/Kconfig b/src/drivers/uart/Kconfig
index 1f23a19..9b242fd 100644
--- a/src/drivers/uart/Kconfig
+++ b/src/drivers/uart/Kconfig
@@ -1,6 +1,21 @@
config DRIVERS_UART
bool

+config ENABLE_UART
+ def_bool n
+
+config ENABLE_UART_WITHOUT_CONSOLE
+ bool "Always configure primary UART"
+ depends on DRIVERS_UART
+ select ENABLE_UART
+ help
+ The primary UART has previously only been set up when the serial console
+ is enabled.
+ Selecting this choice will configure the console UART even if the serial
+ console is disabled.
+
+ Select the UART in the console menu
+
config DRIVERS_UART_8250IO
# FIXME: Shouldn't have a prompt, should default to n, and
# should be selected by boards that have it instead.
diff --git a/src/include/console/uart.h b/src/include/console/uart.h
index aed67c2..6bd88ae 100644
--- a/src/include/console/uart.h
+++ b/src/include/console/uart.h
@@ -67,11 +67,16 @@
(ENV_BOOTBLOCK || ENV_ROMSTAGE || ENV_RAMSTAGE || ENV_VERSTAGE || \
ENV_POSTCAR || (ENV_SMM && CONFIG(DEBUG_SMI))))

-#if __CONSOLE_SERIAL_ENABLE__
+#if CONFIG(ENABLE_UART)
static inline void __uart_init(void)
{
uart_init(CONFIG_UART_FOR_CONSOLE);
}
+#else
+static inline void __uart_init(void) {}
+#endif
+
+#if __CONSOLE_SERIAL_ENABLE__
static inline void __uart_tx_byte(u8 data)
{
uart_tx_byte(CONFIG_UART_FOR_CONSOLE, data);
@@ -81,7 +86,6 @@
uart_tx_flush(CONFIG_UART_FOR_CONSOLE);
}
#else
-static inline void __uart_init(void) {}
static inline void __uart_tx_byte(u8 data) {}
static inline void __uart_tx_flush(void) {}
#endif

To view, visit change 33380. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ic0942634ab8a9fcafdc1ea099721c127202e9f9a
Gerrit-Change-Number: 33380
Gerrit-PatchSet: 1
Gerrit-Owner: Martin Roth <martinroth@google.com>
Gerrit-MessageType: newchange