提交 f968fc68 编写于 作者: A Anthony Liguori 提交者: Andreas Färber

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: NAnthony Liguori <aliguori@us.ibm.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: NAndreas Färber <afaerber@suse.de>
上级 0d936928
......@@ -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. */
......
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册