Patchwork [01/26] pci: replace the magic, 256, for the maximum of slot

login
register
mail settings
Submitter Isaku Yamahata
Date March 16, 2011, 9:29 a.m.
Message ID <e499c6ed1ba01c0fc0c2c8fc23f813cb4e5368e0.1300266238.git.yamahata@valinux.co.jp>
Download mbox | patch
Permalink /patch/87208/
State New
Headers show

Comments

Isaku Yamahata - March 16, 2011, 9:29 a.m.
Introduce symbol PCI_SLOT_MAX for the maximum of slot.
and replace the magic, 256.

Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/pci.h           |    1 +
 hw/pci_internals.h |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

Patch

diff --git a/hw/pci.h b/hw/pci.h
index 113e556..7d56337 100644
--- 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 */
diff --git a/hw/pci_internals.h b/hw/pci_internals.h
index e3c93a3..efaefcd 100644
--- a/hw/pci_internals.h
+++ b/hw/pci_internals.h
@@ -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;