aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/pci.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index bd52ca4c2893..d4d71fae6233 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1366,6 +1366,20 @@ void pci_enable_ari(struct pci_dev *dev)
1366 bridge->ari_enabled = 1; 1366 bridge->ari_enabled = 1;
1367} 1367}
1368 1368
1369/**
1370 * pci_swizzle_interrupt_pin - swizzle INTx for device behind bridge
1371 * @dev: the PCI device
1372 * @pin: the INTx pin (1=INTA, 2=INTB, 3=INTD, 4=INTD)
1373 *
1374 * Perform INTx swizzling for a device behind one level of bridge. This is
1375 * required by section 9.1 of the PCI-to-PCI bridge specification for devices
1376 * behind bridges on add-in cards.
1377 */
1378u8 pci_swizzle_interrupt_pin(struct pci_dev *dev, u8 pin)
1379{
1380 return (((pin - 1) + PCI_SLOT(dev->devfn)) % 4) + 1;
1381}
1382
1369int 1383int
1370pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge) 1384pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge)
1371{ 1385{
@@ -1376,7 +1390,7 @@ pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge)
1376 return -1; 1390 return -1;
1377 1391
1378 while (dev->bus->self) { 1392 while (dev->bus->self) {
1379 pin = (((pin - 1) + PCI_SLOT(dev->devfn)) % 4) + 1; 1393 pin = pci_swizzle_interrupt_pin(dev, pin);
1380 dev = dev->bus->self; 1394 dev = dev->bus->self;
1381 } 1395 }
1382 *bridge = dev; 1396 *bridge = dev;