Patchwork [12/14] pci: give pci devices a default name.

login
register
mail settings
Submitter Anthony Liguori
Date Sept. 16, 2011, 4 p.m.
Message ID <1316188834-13675-13-git-send-email-aliguori@us.ibm.com>
Download mbox | patch
Permalink /patch/114970/
State New
Headers show

Comments

Anthony Liguori - Sept. 16, 2011, 4 p.m.
Bus names are derived from names so now that PCI devices have a name, they also
have different bus names.

pc_piix relies on the bus name (*sigh*) so we need to update it.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 hw/pc_piix.c |    6 ++++--
 hw/pci.c     |    3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

Patch

diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index 960589a..8f0ebd6 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -181,8 +181,10 @@  static void pc_init1(MemoryRegion *system_memory,
         } else {
             dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1);
         }
-        idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0");
-        idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1");
+        idebus[0] = qdev_get_child_bus(&dev->qdev,
+                                       "::i440fx::i440fx.0::slot[1.1].0");
+        idebus[1] = qdev_get_child_bus(&dev->qdev,
+                                       "::i440fx::i440fx.0::slot[1.1].1");
     } else {
         for(i = 0; i < MAX_IDE_BUS; i++) {
             ISADevice *dev;
diff --git a/hw/pci.c b/hw/pci.c
index abad900..b889ac3 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -1736,7 +1736,8 @@  PCIDevice *pci_create_multifunction(PCIBus *bus, int devfn, bool multifunction,
 
     devfn = pci_assign_devfn(bus, devfn, name);
 
-    dev = qdev_create(&bus->qbus, name, NULL);
+    dev = qdev_create(&bus->qbus, name, "::slot[%d.%d]",
+                      (devfn >> 3) & 0x1F, (devfn & 0x7));
 
     qdev_prop_set_uint32(dev, "addr", devfn);
     qdev_prop_set_bit(dev, "multifunction", multifunction);