pci: pci capability must be in PCI space
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> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
e26631b746
commit
b56d701f1d
6
hw/pci.c
6
hw/pci.c
@ -1678,16 +1678,16 @@ PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)
|
|||||||
return pci_create_simple_multifunction(bus, devfn, false, 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 offset = PCI_CONFIG_HEADER_SIZE;
|
||||||
int i;
|
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])
|
if (pdev->used[i])
|
||||||
offset = i + 1;
|
offset = i + 1;
|
||||||
else if (i - offset + 1 == size)
|
else if (i - offset + 1 == size)
|
||||||
return offset;
|
return offset;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user