]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
pci_bridge: user-friendly default bus name
authorMichael S. Tsirkin <mst@redhat.com>
Sun, 19 Feb 2012 23:34:01 +0000 (01:34 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 15 Mar 2012 15:04:58 +0000 (17:04 +0200)
For a pci bridge device, if we don't override
the name with custom code, the bus will be addressed as
<id>.0, where id is the id specified by the user.

Since PCI Bridge devices have a single bus each, we don't need
the index: address the bus using the parent device name.
This is better since this way users don't care about
our internal bus/device distinctions.

As far as I could see, we only have built-in
bridges at this point which always override the
name. So this change will only affect ioh3420.c.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/pci_bridge.c

index fea3873943d9881dfa619b88ef167310d1faefed..eeee8a6ad05883eca250929da0d128d7c9ab91e3 100644 (file)
@@ -314,6 +314,16 @@ int pci_bridge_initfn(PCIDevice *dev)
     pci_set_word(dev->config + PCI_SEC_STATUS,
                  PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK);
 
+    /*
+     * If we don't specify the name, the bus will be addressed as <id>.0, where
+     * id is the device id.
+     * Since PCI Bridge devices have a single bus each, we don't need the index:
+     * let users address the bus using the device name.
+     */
+    if (!br->bus_name && dev->qdev.id && *dev->qdev.id) {
+           br->bus_name = dev->qdev.id;
+    }
+
     qbus_create_inplace(&sec_bus->qbus, &pci_bus_info, &dev->qdev,
                         br->bus_name);
     sec_bus->parent_dev = dev;