[Skiboot] [PATCH v2 10/14] console: define a opal_con_ops each driver

Oliver O'Halloran oohall at gmail.com
Tue Dec 20 17:03:41 AEDT 2016


Define the structures for each driver required to use the new
opal_con_ops interface.

Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 core/console.c       |  9 +++++++++
 hw/fsp/fsp-console.c | 15 +++++++++++++++
 hw/lpc-uart.c        |  9 +++++++++
 include/console.h    |  5 +++++
 4 files changed, 38 insertions(+)

diff --git a/core/console.c b/core/console.c
index 85ca462988ca..dc632151049b 100644
--- a/core/console.c
+++ b/core/console.c
@@ -462,3 +462,12 @@ void dummy_console_add_nodes(void)
 
 	opal_add_poller(dummy_console_poll, NULL);
 }
+
+struct opal_con_ops dummy_opal_con = {
+	.name = "Dummy Console",
+	.init = dummy_console_add_nodes,
+	.read = dummy_console_read,
+	.write = dummy_console_write,
+	.space = dummy_console_write_buffer_space,
+	.flush = dummy_console_flush,
+};
diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c
index 8a88f2876aa8..b0fefb6bdd76 100644
--- a/hw/fsp/fsp-console.c
+++ b/hw/fsp/fsp-console.c
@@ -818,6 +818,21 @@ void fsp_console_init(void)
 	op_display(OP_LOG, OP_MOD_FSPCON, 0x0005);
 }
 
+static int64_t fsp_console_flush(int64_t terminal __unused)
+{
+	/* FIXME: There's probably something we can do here... */
+	return OPAL_PARAMETER;
+}
+
+struct opal_con_ops fsp_opal_con = {
+	.name = "FSP OPAL console",
+	.init = NULL, /* all the required setup is done in fsp_console_init() */
+	.read = fsp_console_read,
+	.write = fsp_console_write,
+	.space = fsp_console_write_buffer_space,
+	.flush = fsp_console_flush,
+};
+
 static void flush_all_input(void)
 {
 	unsigned int i;
diff --git a/hw/lpc-uart.c b/hw/lpc-uart.c
index cc7f808bb920..4b068b72b2e8 100644
--- a/hw/lpc-uart.c
+++ b/hw/lpc-uart.c
@@ -462,6 +462,15 @@ void uart_setup_opal_console(void)
 	opal_add_poller(uart_console_poll, NULL);
 }
 
+struct opal_con_ops uart_opal_con = {
+	.name = "OPAL UART console",
+	.init = uart_setup_opal_console,
+	.read = uart_opal_read,
+	.write = uart_opal_write,
+	.space = uart_opal_write_buffer_space,
+	.flush = uart_opal_flush,
+};
+
 static bool uart_init_hw(unsigned int speed, unsigned int clock)
 {
 	unsigned int dll = (clock / 16) / speed;
diff --git a/include/console.h b/include/console.h
index 41be064f27cb..c2e31ce4b665 100644
--- a/include/console.h
+++ b/include/console.h
@@ -99,4 +99,9 @@ extern void dummy_console_add_nodes(void);
 struct dt_node *add_opal_console_node(int index, const char *type,
 	uint32_t write_buffer_size);
 
+/* OPAL console drivers */
+extern struct opal_con_ops uart_opal_con;
+extern struct opal_con_ops fsp_opal_con;
+extern struct opal_con_ops dummy_opal_con;
+
 #endif /* __CONSOLE_H */
-- 
2.7.4



More information about the Skiboot mailing list