Skip to content

Commit

Permalink
qdev: get_child_bus(): Use QOM lookup if available
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
pcrost authored and pm215 committed Jan 21, 2016
1 parent 3c9331c commit f698c8b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hw/core/qdev.c
Expand Up @@ -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) {
Expand Down

0 comments on commit f698c8b

Please sign in to comment.