summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2014-06-04 13:48:18 +0200
committerAlexander Graf <agraf@suse.de>2014-06-27 13:48:27 +0200
commit79c0ff2cae1f24cb7e041ac2dbdcc329d2a86ba2 (patch)
tree22b3858cdc3775067ac8c6966cdafc82a054abab
parent9a321e92343891e30f6fe8bfaad40454ae358bfb (diff)
downloadfocaccia-qemu-79c0ff2cae1f24cb7e041ac2dbdcc329d2a86ba2.tar.gz
focaccia-qemu-79c0ff2cae1f24cb7e041ac2dbdcc329d2a86ba2.zip
PPC: e500: Only create dt entries for existing serial ports
When the user specifies -nodefaults he can tell us that he doesn't want any
serial ports spawned by default. While we do honor that wish, we still create
device tree entries for those non-existent devices.

Make device tree generation depend on whether the device is actually available.

Signed-off-by: Alexander Graf <agraf@suse.de>
-rw-r--r--hw/ppc/e500.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index a973c18d88..bb2e75fe1b 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -316,10 +316,15 @@ static int ppce500_load_device_tree(MachineState *machine,
      * device it finds in the dt as serial output device. And we generate
      * devices in reverse order to the dt.
      */
-    dt_serial_create(fdt, MPC8544_SERIAL1_REGS_OFFSET,
-                     soc, mpic, "serial1", 1, false);
-    dt_serial_create(fdt, MPC8544_SERIAL0_REGS_OFFSET,
-                     soc, mpic, "serial0", 0, true);
+    if (serial_hds[1]) {
+        dt_serial_create(fdt, MPC8544_SERIAL1_REGS_OFFSET,
+                         soc, mpic, "serial1", 1, false);
+    }
+
+    if (serial_hds[0]) {
+        dt_serial_create(fdt, MPC8544_SERIAL0_REGS_OFFSET,
+                         soc, mpic, "serial0", 0, true);
+    }
 
     snprintf(gutil, sizeof(gutil), "%s/global-utilities@%llx", soc,
              MPC8544_UTIL_OFFSET);