From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=60233 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ot1sZ-000123-3E for qemu-devel@nongnu.org; Tue, 07 Sep 2010 13:22:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ot1sR-0004L5-0B for qemu-devel@nongnu.org; Tue, 07 Sep 2010 13:22:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12119) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ot1sQ-0004Ky-Oo for qemu-devel@nongnu.org; Tue, 07 Sep 2010 13:22:34 -0400 Date: Tue, 7 Sep 2010 20:16:33 +0300 From: "Michael S. Tsirkin" Message-ID: <20100907171632.GB18374@redhat.com> References: <20100824132525.GA19469@kt> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100824132525.GA19469@kt> Subject: [Qemu-devel] Re: [PATCH 1/4] PCI: define PCIBUS_MAX_DEVICES and PCI_FUNCTIONS_PER_DEVICE in pci.h List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ken CC Cc: yamahata@valinux.co.jp, avi@redhat.com, kvm@vger.kernel.org, qemu-devel@nongnu.org On Tue, Aug 24, 2010 at 09:25:26PM +0800, Ken CC wrote: > 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 PCI_FUNCTIONS_PER_DEVICE is same as PCI_FUNC_MAX. Why do we need another macro? > /* Class, Vendor and Device IDs from Linux's pci_ids.h */ > #include "pci_ids.h"