PCI: Reject BAR above 4GB if dma_addr_t is too small

We can only handle BARs above 4GB if dma_addr_t (not resource_size_t) is 64
bits wide.  If we have a 64-bit resource_size_t and a 32-bit dma_addr_t,
we can't deal with BARs above 4GB.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
Bjorn Helgaas 2014-04-29 18:33:09 -06:00
parent 23b13bc76f
commit d1a313e4b6

View File

@ -253,7 +253,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
goto out; goto out;
} }
if ((sizeof(resource_size_t) < 8) && l) { if ((sizeof(dma_addr_t) < 8) && l) {
/* Address above 32-bit boundary; disable the BAR */ /* Address above 32-bit boundary; disable the BAR */
pci_write_config_dword(dev, pos, 0); pci_write_config_dword(dev, pos, 0);
pci_write_config_dword(dev, pos + 4, 0); pci_write_config_dword(dev, pos + 4, 0);