summaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 19:31:34 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 19:31:34 -0700
commit3a2c5dad6c4d4551effba477f4f45fa5feb1293f (patch)
tree1e1f1ab67279c46c3e6aed1c4041880f58ec5dae /drivers/pci/pci.c
parent2242d5eff17cf91110a3c44747f9f2e1a938cbda (diff)
parenta491913ff22c2b69d937d14296db6fa34dbff068 (diff)
downloadop-kernel-dev-3a2c5dad6c4d4551effba477f4f45fa5feb1293f.zip
op-kernel-dev-3a2c5dad6c4d4551effba477f4f45fa5feb1293f.tar.gz
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: PCI: remove unused resource assignment in pci_read_bridge_bases() PCI hotplug: shpchp: message refinement PCI hotplug: shpchp: replace printk with dev_printk PCI: add routines for debugging and handling lost interrupts PCI hotplug: pciehp: message refinement PCI: fix ARI code to be compatible with mixed ARI/non-ARI systems PCI hotplug: cpqphp: fix kernel NULL pointer dereference
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r--drivers/pci/pci.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 533aeb5..21f2ac6 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1309,27 +1309,32 @@ void pci_enable_ari(struct pci_dev *dev)
int pos;
u32 cap;
u16 ctrl;
+ struct pci_dev *bridge;
- if (!dev->is_pcie)
+ if (!dev->is_pcie || dev->devfn)
return;
- if (dev->pcie_type != PCI_EXP_TYPE_ROOT_PORT &&
- dev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM)
+ pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ARI);
+ if (!pos)
return;
- pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
+ bridge = dev->bus->self;
+ if (!bridge || !bridge->is_pcie)
+ return;
+
+ pos = pci_find_capability(bridge, PCI_CAP_ID_EXP);
if (!pos)
return;
- pci_read_config_dword(dev, pos + PCI_EXP_DEVCAP2, &cap);
+ pci_read_config_dword(bridge, pos + PCI_EXP_DEVCAP2, &cap);
if (!(cap & PCI_EXP_DEVCAP2_ARI))
return;
- pci_read_config_word(dev, pos + PCI_EXP_DEVCTL2, &ctrl);
+ pci_read_config_word(bridge, pos + PCI_EXP_DEVCTL2, &ctrl);
ctrl |= PCI_EXP_DEVCTL2_ARI;
- pci_write_config_word(dev, pos + PCI_EXP_DEVCTL2, ctrl);
+ pci_write_config_word(bridge, pos + PCI_EXP_DEVCTL2, ctrl);
- dev->ari_enabled = 1;
+ bridge->ari_enabled = 1;
}
int
OpenPOWER on IntegriCloud