Message ID | 403b897354aed55caff4704662baacec5cd0b802.1350677361.git.jbaron@redhat.com |
---|---|
State | New |
Headers | show |
On Fri, Oct 19, 2012 at 04:43:28PM -0400, Jason Baron wrote: > From: Isaku Yamahata <yamahata@valinux.co.jp> > > pci capability must be in PCI space. > It can't lay in PCIe extended config space. > > Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> > Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> > Signed-off-by: Jason Baron <jbaron@redhat.com> Applied, thanks! > --- > hw/pci.c | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/hw/pci.c b/hw/pci.c > index 2ca6ff6..b1b105d 100644 > --- a/hw/pci.c > +++ b/hw/pci.c > @@ -1644,16 +1644,16 @@ PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name) > return pci_create_simple_multifunction(bus, devfn, false, name); > } > > -static int pci_find_space(PCIDevice *pdev, uint8_t size) > +static uint8_t pci_find_space(PCIDevice *pdev, uint8_t size) > { > - int config_size = pci_config_size(pdev); > int offset = PCI_CONFIG_HEADER_SIZE; > int i; > - for (i = PCI_CONFIG_HEADER_SIZE; i < config_size; ++i) > + for (i = PCI_CONFIG_HEADER_SIZE; i < PCI_CONFIG_SPACE_SIZE; ++i) { > if (pdev->used[i]) > offset = i + 1; > else if (i - offset + 1 == size) > return offset; > + } > return 0; > } > > -- > 1.7.1
diff --git a/hw/pci.c b/hw/pci.c index 2ca6ff6..b1b105d 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -1644,16 +1644,16 @@ PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name) return pci_create_simple_multifunction(bus, devfn, false, name); } -static int pci_find_space(PCIDevice *pdev, uint8_t size) +static uint8_t pci_find_space(PCIDevice *pdev, uint8_t size) { - int config_size = pci_config_size(pdev); int offset = PCI_CONFIG_HEADER_SIZE; int i; - for (i = PCI_CONFIG_HEADER_SIZE; i < config_size; ++i) + for (i = PCI_CONFIG_HEADER_SIZE; i < PCI_CONFIG_SPACE_SIZE; ++i) { if (pdev->used[i]) offset = i + 1; else if (i - offset + 1 == size) return offset; + } return 0; }