pci: replace the magic, 256, for the maximum of devfn
authorIsaku Yamahata <yamahata@valinux.co.jp>
Thu, 27 Jan 2011 06:56:35 +0000 (15:56 +0900)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 28 Mar 2011 16:34:22 +0000 (18:34 +0200)
Introduce symbol PCI_SLOT_MAX for the # of slots,
and replace the magic, 256.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/pci.h
hw/pci_internals.h

index 113e556e2d2c2594ae8d613b3ea51f9bb905b538..7d56337c2bab69ce09bbd82a666891d88ac55f7c 100644 (file)
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -16,6 +16,7 @@
 #define PCI_DEVFN(slot, func)   ((((slot) & 0x1f) << 3) | ((func) & 0x07))
 #define PCI_SLOT(devfn)         (((devfn) >> 3) & 0x1f)
 #define PCI_FUNC(devfn)         ((devfn) & 0x07)
+#define PCI_SLOT_MAX            32
 #define PCI_FUNC_MAX            8
 
 /* Class, Vendor and Device IDs from Linux's pci_ids.h */
index e3c93a3cc58397202e1ba88b17c1bb4854eef1ed..efaefcded8a41e1b8f64551623ee3d1bc516231c 100644 (file)
@@ -22,7 +22,7 @@ struct PCIBus {
     pci_hotplug_fn hotplug;
     DeviceState *hotplug_qdev;
     void *irq_opaque;
-    PCIDevice *devices[256];
+    PCIDevice *devices[PCI_SLOT_MAX * PCI_FUNC_MAX];
     PCIDevice *parent_dev;
     target_phys_addr_t mem_base;