summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2012-05-02 10:39:01 +0200
committerAndreas Färber <afaerber@suse.de>2012-06-18 15:14:38 +0200
commitf968fc6892daf02865cce8af277cc755be690eda (patch)
tree13d6cd12332f91ad9d935e3e0f160528888c334b /hw
parent0d936928ef87ca1bb7b41b5b89c400c699a7691c (diff)
downloadqemu-f968fc6892daf02865cce8af277cc755be690eda.tar.gz
qemu-f968fc6892daf02865cce8af277cc755be690eda.tar.bz2
qemu-f968fc6892daf02865cce8af277cc755be690eda.zip
qdev: Connect busses with their parent devices
This makes SysBus part of the root hierarchy and all busses children of their respective parent DeviceState. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw')
-rw-r--r--hw/qdev.c4
-rw-r--r--hw/sysbus.c3
2 files changed, 7 insertions, 0 deletions
diff --git a/hw/qdev.c b/hw/qdev.c
index 63012b5252..dc46e7bd10 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -404,6 +404,7 @@ static void do_qbus_create_inplace(BusState *bus, const char *typename,
if (parent) {
QLIST_INSERT_HEAD(&parent->child_bus, bus, sibling);
parent->num_child_bus++;
+ object_property_add_child(OBJECT(parent), bus->name, OBJECT(bus), NULL);
} else if (bus != sysbus_get_default()) {
/* TODO: once all bus devices are qdevified,
only reset handler for main_system_bus should be registered here. */
@@ -656,6 +657,9 @@ static void device_initfn(Object *obj)
class = object_class_get_parent(class);
} while (class != object_class_by_name(TYPE_DEVICE));
qdev_prop_set_globals(dev);
+
+ object_property_add_link(OBJECT(dev), "parent_bus", TYPE_BUS,
+ (Object **)&dev->parent_bus, NULL);
}
/* Unlink device from bus and free the structure. */
diff --git a/hw/sysbus.c b/hw/sysbus.c
index 2347f510bd..9d8b1eaf7d 100644
--- a/hw/sysbus.c
+++ b/hw/sysbus.c
@@ -275,6 +275,9 @@ static void main_system_bus_create(void)
qbus_create_inplace(main_system_bus, TYPE_SYSTEM_BUS, NULL,
"main-system-bus");
main_system_bus->glib_allocated = true;
+ object_property_add_child(container_get(qdev_get_machine(),
+ "/unattached"),
+ "sysbus", OBJECT(main_system_bus), NULL);
}
BusState *sysbus_get_default(void)