From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ken CC Subject: [PATCH 1/4] PCI: define PCIBUS_MAX_DEVICES and PCI_FUNCTIONS_PER_DEVICE in pci.h Date: Tue, 24 Aug 2010 21:25:26 +0800 Message-ID: <20100824132525.GA19469@kt> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: qemu-devel@nongnu.org, mst@redhat.com To: avi@redhat.com, yamahata@valinux.co.jp, kvm@vger.kernel.org Return-path: Received: from mail-qw0-f46.google.com ([209.85.216.46]:35136 "EHLO mail-qw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755082Ab0HXNZd (ORCPT ); Tue, 24 Aug 2010 09:25:33 -0400 Received: by qwh6 with SMTP id 6so6075468qwh.19 for ; Tue, 24 Aug 2010 06:25:32 -0700 (PDT) Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: And update the max function number used in struct PCIBus{} to PCIBUS_MAX_FUNCTIONS = PCI_FUNCTIONS_PER_DEVICE * PCIBUS_MAX_DEVICES TODO: according to Avi Kivity, PCIBus.devices[] should be renamed to functions[] Signed-off-by: Ken CC --- hw/pci.c | 2 +- hw/pci.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 70dbace..9234fe3 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -47,7 +47,7 @@ struct PCIBus { pci_hotplug_fn hotplug; DeviceState *hotplug_qdev; void *irq_opaque; - PCIDevice *devices[256]; + PCIDevice *devices[PCIBUS_MAX_DEVICES * PCI_FUNCTIONS_PER_DEVICE]; PCIDevice *parent_dev; target_phys_addr_t mem_base; diff --git a/hw/pci.h b/hw/pci.h index ccb99d0..eb97b76 100644 --- a/hw/pci.h +++ b/hw/pci.h @@ -17,6 +17,8 @@ struct kvm_irq_routing_entry; #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) #define PCI_FUNC(devfn) ((devfn) & 0x07) #define PCI_FUNC_MAX 8 +#define PCI_FUNCTIONS_PER_DEVICE 8 +#define PCIBUS_MAX_DEVICES 32 /* Class, Vendor and Device IDs from Linux's pci_ids.h */ #include "pci_ids.h"