[coreboot-gerrit] New patch to review for coreboot: 30655ad Add console wrapper for UART driver
Marc Jones (marc.jones@se-eng.com)
gerrit at coreboot.org
Fri Dec 19 07:27:29 CET 2014
Marc Jones (marc.jones at se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7872
-gerrit
commit 30655ad8a5a89f4a0833cb249795571d620449a2
Author: Vadim Bendebury <vbendeb at chromium.org>
Date: Wed Apr 23 13:11:40 2014 -0700
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
Change-Id: Id1fe73d29f2a3c722bd77180beebaedb9bf7d6a1
Signed-off-by: Vadim Bendebury <vbendeb at chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/196660
Reviewed-by: Stefan Reinauer <reinauer at chromium.org>
(cherry picked from commit 94a36ad79a96f83d283c0fd073b05f98ae48820c)
Signed-off-by: Marc Jones <marc.jones at se-eng.com>
---
src/console/uart_wrapper.c | 28 ++++++++++++++++++++++++++++
src/include/console/console.h | 14 ++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/src/console/uart_wrapper.c b/src/console/uart_wrapper.c
new file mode 100644
index 0000000..0454cfc
--- /dev/null
+++ b/src/console/uart_wrapper.c
@@ -0,0 +1,28 @@
+/*
+ * This file is part of the coreboot project.
+ * Copyright 2014 Google Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <console/console.h>
+#include <console/uart.h>
+
+static const struct console_driver uart_console __console = {
+ .init = uart_init,
+ .tx_byte = uart_tx_byte,
+ .tx_flush = uart_tx_flush,
+ .rx_byte = uart_rx_byte,
+ .tst_byte = uart_can_rx_byte,
+};
diff --git a/src/include/console/console.h b/src/include/console/console.h
index 9e98bfc..e3fb5dd 100644
--- a/src/include/console/console.h
+++ b/src/include/console/console.h
@@ -24,6 +24,20 @@
#include <rules.h>
#include <console/post_codes.h>
+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[];
+
#ifndef __ROMCC__
void post_code(u8 value);
#if CONFIG_CMOS_POST_EXTRA
More information about the coreboot-gerrit
mailing list