summaryrefslogtreecommitdiffstats
path: root/drivers/pci/search.c
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2014-05-23 01:07:43 +0200
committerBjorn Helgaas <bhelgaas@google.com>2014-05-28 23:20:31 +0200
commit31c2b8153c58f11ddb80dfd392c16f13c2d709c6 (patch)
tree7ceb946ee75079ed1552f9a60e471a97bb3fa72b /drivers/pci/search.c
parentPCI: Convert pci_dev_flags definitions to bit shifts (diff)
downloadlinux-31c2b8153c58f11ddb80dfd392c16f13c2d709c6.tar.xz
linux-31c2b8153c58f11ddb80dfd392c16f13c2d709c6.zip
PCI: Add support for DMA alias quirks
Some devices are broken and use a requester ID other than their physical devfn. Add a byte, using an existing gap in the pci_dev structure, to store an alternate "alias" devfn. A bit in the dev_flags tells us when this is valid. We then add the alias as one more step in the pci_for_each_dma_alias() iterator. Tested-by: George Spelvin <linux@horizon.com> Tested-by: Pat Erley <pat-lkml@erley.org> Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/search.c')
-rw-r--r--drivers/pci/search.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index 5601cdb8bbb3..2c19f3f40621 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -37,6 +37,17 @@ int pci_for_each_dma_alias(struct pci_dev *pdev,
if (ret)
return ret;
+ /*
+ * If the device is broken and uses an alias requester ID for
+ * DMA, iterate over that too.
+ */
+ if (unlikely(pdev->dev_flags & PCI_DEV_FLAGS_DMA_ALIAS_DEVFN)) {
+ ret = fn(pdev, PCI_DEVID(pdev->bus->number,
+ pdev->dma_alias_devfn), data);
+ if (ret)
+ return ret;
+ }
+
for (bus = pdev->bus; !pci_is_root_bus(bus); bus = bus->parent) {
struct pci_dev *tmp;