diff options
author | Oliver O'Halloran <oohall@gmail.com> | 2016-12-21 15:52:25 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-01-04 17:15:34 +1100 |
commit | 7edaf63587aace2729f70144d6ff5e9c3a3766c4 (patch) | |
tree | f153c4afb01a5743051653978ecc0d33cfb8ce0f /hw/fsp | |
parent | 8c0ec758fdec8cd5aa60f1f9cf4ca653717991f9 (diff) | |
download | skiboot-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/fsp')
-rw-r--r-- | hw/fsp/fsp-console.c | 24 |
1 files changed, 8 insertions, 16 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); |