diff options
author | Peter Crosthwaite <crosthwaitepeter@gmail.com> | 2016-01-21 14:15:03 +0000 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2019-11-29 19:28:25 -0600 |
commit | 78ef992a30eb19fcc3f0dac6a7366afbf7c87492 (patch) | |
tree | 05f93157fd7983a0d8f154f1e177a99296553cdb /hw/core | |
parent | 9ae7282cddfffcfa0c81876f7f890e8f7076f62d (diff) | |
download | hqemu-78ef992a30eb19fcc3f0dac6a7366afbf7c87492.zip hqemu-78ef992a30eb19fcc3f0dac6a7366afbf7c87492.tar.gz |
qdev: get_child_bus(): Use QOM lookup if available
qbus_realize() adds busses as a QOM child of the device in addition to
adding it to the qdev bus list. Change get_child_bus() to use the QOM
child if it is available. This takes priority over the bus-list, but
the child object is checked for type correctness.
This prepares support for aliasing of buses. The use case is SoCs,
where a SoC container needs to present buses to the board level, but
the buses are implemented by controller IP we already model as self
contained qbus-containing devices.
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Acked-by: Alistair Francis <alistair.francis@xilinx.com>
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/core')
-rw-r--r-- | hw/core/qdev.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 44bf790..655f5d5 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -580,6 +580,12 @@ void qdev_pass_gpios(DeviceState *dev, DeviceState *container, BusState *qdev_get_child_bus(DeviceState *dev, const char *name) { BusState *bus; + Object *child = object_resolve_path_component(OBJECT(dev), name); + + bus = (BusState *)object_dynamic_cast(child, TYPE_BUS); + if (bus) { + return bus; + } QLIST_FOREACH(bus, &dev->child_bus, sibling) { if (strcmp(name, bus->name) == 0) { |