From 90f6cd35673b10535227db0b2b5fa8379804933f Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Wed, 23 Apr 2014 13:11:40 -0700 Subject: Add console wrapper for UART driver Coreboot is designed to have a single serial console at most, on top of that it may have a CBMEM (virtual) console. Matters are complicated by the fact that console interface is different between bootblock and later stages. A linker list of console driver descriptors is used to allow to determine the set and type of console drivers at compile time. Even though the upstream seems to have done away with this approach, which does not seem the best idea. As an alternative this patch introduces a common wrapper which different UART drivers can plug in into. The driver exports a single API which can be used both directly (in bootblock) and through the wrapper (in later stages). The existing drivers can be adjusted to fit this scheme one by one. The common UART driver API also aligns fine with the upstream approach. BUG=chrome-os-partner:27784 TEST=none yet Original-Change-Id: Id1fe73d29f2a3c722bd77180beebaedb9bf7d6a1 Original-Signed-off-by: Vadim Bendebury Original-Reviewed-on: https://chromium-review.googlesource.com/196660 Original-Reviewed-by: Stefan Reinauer (cherry picked from commit 94a36ad79a96f83d283c0fd073b05f98ae48820c) Signed-off-by: Marc Jones Change-Id: Id1fe73d29f2a3c722bd77180beebaedb9bf7d6a1 Reviewed-on: http://review.coreboot.org/7872 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/include/console/console.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/include/console') diff --git a/src/include/console/console.h b/src/include/console/console.h index b5de7d7f44..b0971e5323 100644 --- a/src/include/console/console.h +++ b/src/include/console/console.h @@ -26,6 +26,20 @@ #include #ifndef __ROMCC__ +struct console_driver { + void (*init)(int); + void (*tx_byte)(int, unsigned char byte); + void (*tx_flush)(int); + unsigned char (*rx_byte)(int); + int (*tst_byte)(void); +}; + +#define __console __attribute__((used, __section__ (".rodata.console_drivers"))) + +/* Defined by the linker... */ +extern struct console_driver console_drivers[]; +extern struct console_driver econsole_drivers[]; + void post_code(u8 value); #if CONFIG_CMOS_POST_EXTRA void post_log_extra(u32 value); -- cgit v1.2.3