]> git.proxmox.com Git - qemu.git/commitdiff
qdev: put all devices under /machine
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 28 Mar 2012 14:34:12 +0000 (16:34 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 2 Apr 2012 20:04:15 +0000 (15:04 -0500)
Avoid cluttering too much the QOM root.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/piix_pci.c
hw/ppc_prep.c
hw/qdev-monitor.c
hw/qdev.c
hw/qdev.h

index 90175654243cae676e73011afe7fad116d04f1e5..179d9a6bb9edd9cdf7769b39cf6646c60983c8ac 100644 (file)
@@ -276,7 +276,7 @@ static PCIBus *i440fx_common_init(const char *device_name,
     b = pci_bus_new(&s->busdev.qdev, NULL, pci_address_space,
                     address_space_io, 0);
     s->bus = b;
-    object_property_add_child(object_get_root(), "i440fx", OBJECT(dev), NULL);
+    object_property_add_child(qdev_get_machine(), "i440fx", OBJECT(dev), NULL);
     qdev_init_nofail(dev);
 
     d = pci_create_simple(b, 0, device_name);
index 86c93364dda5df35924c916cb4573050c95fec73..9d8e6592e1b6b0ddecda033f50be5fd76290857e 100644 (file)
@@ -615,7 +615,7 @@ static void ppc_prep_init (ram_addr_t ram_size,
     sys = sysbus_from_qdev(dev);
     pcihost = DO_UPCAST(PCIHostState, busdev, sys);
     pcihost->address_space = get_system_memory();
-    object_property_add_child(object_get_root(), "raven", OBJECT(dev), NULL);
+    object_property_add_child(qdev_get_machine(), "raven", OBJECT(dev), NULL);
     qdev_init_nofail(dev);
     pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci.0");
     if (pci_bus == NULL) {
index 031cb83e1a497620e21d2c382e5d290f498d2531..4783366cf4b9ba71b26a83e1e39d522ba6020983 100644 (file)
@@ -180,7 +180,7 @@ static Object *qdev_get_peripheral(void)
     static Object *dev;
 
     if (dev == NULL) {
-        dev = container_get("/peripheral");
+        dev = container_get("/machine/peripheral");
     }
 
     return dev;
@@ -191,7 +191,7 @@ static Object *qdev_get_peripheral_anon(void)
     static Object *dev;
 
     if (dev == NULL) {
-        dev = container_get("/peripheral-anon");
+        dev = container_get("/machine/peripheral-anon");
     }
 
     return dev;
index f5c716e87a50c87a55f2a64cd62abd5f9a4063f7..0d3c0fc49c1be6c8cdd7c409ed44f69fb7012aa1 100644 (file)
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -157,7 +157,7 @@ int qdev_init(DeviceState *dev)
         static int unattached_count = 0;
         gchar *name = g_strdup_printf("device[%d]", unattached_count++);
 
-        object_property_add_child(container_get("/unattached"), name,
+        object_property_add_child(container_get("/machine/unattached"), name,
                                   OBJECT(dev), NULL);
         g_free(name);
     }
@@ -668,6 +668,17 @@ void device_reset(DeviceState *dev)
     }
 }
 
+Object *qdev_get_machine(void)
+{
+    static Object *dev;
+
+    if (dev == NULL) {
+        dev = container_get("/machine");
+    }
+
+    return dev;
+}
+
 static TypeInfo device_type_info = {
     .name = TYPE_DEVICE,
     .parent = TYPE_OBJECT,
index 9cc3f984b20855132595f9e0e9371a4d10db6502..a8df42f6fafd1276cc59cfe8e58ffc6c74ed54b6 100644 (file)
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -349,6 +349,8 @@ BusInfo *qdev_get_bus_info(DeviceState *dev);
 
 Property *qdev_get_props(DeviceState *dev);
 
+Object *qdev_get_machine(void);
+
 /* FIXME: make this a link<> */
 void qdev_set_parent_bus(DeviceState *dev, BusState *bus);