aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2016-12-21 15:52:25 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-01-04 17:15:34 +1100
commit7edaf63587aace2729f70144d6ff5e9c3a3766c4 (patch)
treef153c4afb01a5743051653978ecc0d33cfb8ce0f /hw
parent8c0ec758fdec8cd5aa60f1f9cf4ca653717991f9 (diff)
downloadskiboot-7edaf63587aace2729f70144d6ff5e9c3a3766c4.zip
skiboot-7edaf63587aace2729f70144d6ff5e9c3a3766c4.tar.gz
skiboot-7edaf63587aace2729f70144d6ff5e9c3a3766c4.tar.bz2
console: add helper to create serial console nodes
The creation of /ibm,skiboot/console/serial@<xyz> nodes is pretty much identical across the various OPAL console drivers. This patch moves it into a helper function as a cleanup. Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/fsp/fsp-console.c24
-rw-r--r--hw/lpc-uart.c16
2 files changed, 10 insertions, 30 deletions
diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c
index 46ac28b..8fd18d1 100644
--- a/hw/fsp/fsp-console.c
+++ b/hw/fsp/fsp-console.c
@@ -917,37 +917,29 @@ void fsp_console_reset(void)
void fsp_console_add_nodes(void)
{
+ struct dt_node *opal_event;
unsigned int i;
- struct dt_node *consoles, *opal_event;
- consoles = dt_new(opal_node, "consoles");
- dt_add_property_cells(consoles, "#address-cells", 1);
- dt_add_property_cells(consoles, "#size-cells", 0);
+ opal_event = dt_find_by_name(opal_node, "event");
+
for (i = 0; i < MAX_SERIAL; i++) {
struct fsp_serial *fs = &fsp_serials[i];
struct dt_node *fs_node;
- char name[32];
+ const char *type;
if (fs->log_port || !fs->available)
continue;
- snprintf(name, sizeof(name), "serial@%d", i);
- fs_node = dt_new(consoles, name);
if (fs->rsrc_id == 0xffff)
- dt_add_property_string(fs_node, "compatible",
- "ibm,opal-console-raw");
+ type = "raw";
else
- dt_add_property_string(fs_node, "compatible",
- "ibm,opal-console-hvsi");
- dt_add_property_cells(fs_node,
- "#write-buffer-size", SER_BUF_DATA_SIZE);
- dt_add_property_cells(fs_node, "reg", i);
- dt_add_property_string(fs_node, "device_type", "serial");
+ type = "hvsi";
+
+ fs_node = add_opal_console_node(i, type, SER_BUF_DATA_SIZE);
fs->irq = opal_dynamic_event_alloc();
dt_add_property_cells(fs_node, "interrupts", ilog2(fs->irq));
- opal_event = dt_find_by_name(opal_node, "event");
if (opal_event)
dt_add_property_cells(fs_node, "interrupt-parent",
opal_event->phandle);
diff --git a/hw/lpc-uart.c b/hw/lpc-uart.c
index 6693265..2383ff5 100644
--- a/hw/lpc-uart.c
+++ b/hw/lpc-uart.c
@@ -420,20 +420,8 @@ void uart_setup_linux_passthrough(void)
void uart_setup_opal_console(void)
{
- struct dt_node *con, *consoles;
-
- /* Create OPAL console node */
- consoles = dt_new(opal_node, "consoles");
- assert(consoles);
- dt_add_property_cells(consoles, "#address-cells", 1);
- dt_add_property_cells(consoles, "#size-cells", 0);
-
- con = dt_new_addr(consoles, "serial", 0);
- assert(con);
- dt_add_property_string(con, "compatible", "ibm,opal-console-raw");
- dt_add_property_cells(con, "#write-buffer-size", INMEM_CON_OUT_LEN);
- dt_add_property_cells(con, "reg", 0);
- dt_add_property_string(con, "device_type", "serial");
+ /* Add the opal console node */
+ add_opal_console_node(0, "raw", OUT_BUF_SIZE);
dt_add_property_string(dt_chosen, "linux,stdout-path",
"/ibm,opal/consoles/serial@0");