summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/console/uart_wrapper.c28
-rw-r--r--src/include/console/console.h14
2 files changed, 42 insertions, 0 deletions
diff --git a/src/console/uart_wrapper.c b/src/console/uart_wrapper.c
new file mode 100644
index 0000000000..0454cfc213
--- /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 b5de7d7f44..b0971e5323 100644
--- a/src/include/console/console.h
+++ b/src/include/console/console.h
@@ -26,6 +26,20 @@
#include <console/loglevel.h>
#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);