diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2013-08-27 11:54:40 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2013-08-28 13:28:22 -0400 |
commit | d3694d4fa3f44f6a295f8ab064937c8a1549d174 (patch) | |
tree | 84ef7e23578a22d0819f5f2064bf813e071d43eb | |
parent | bd6fb762b595fb83758ae50d3610223244234a2d (diff) |
PCI: Allow PCIe Capability link-related register access for switches
Every PCIe device has a link, except Root Complex Integrated Endpoints
and Root Complex Event Collectors. Previously we didn't give access
to PCIe capability link-related registers for Upstream Ports, Downstream
Ports, and Bridges, so attempts to read PCI_EXP_LNKCTL incorrectly
returned zero. See PCIe spec r3.0, sec 7.8 and 1.3.2.3.
Reference: http://lkml.kernel.org/r/979A8436335E3744ADCD3A9F2A2B68A52AD136BE@SJEXCHMB10.corp.ad.broadcom.com
Reported-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-By: Jiang Liu <jiang.liu@huawei.com>
-rw-r--r-- | drivers/pci/access.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/pci/access.c b/drivers/pci/access.c index 1cc23661f79b..e26c3bd9aca4 100644 --- a/drivers/pci/access.c +++ b/drivers/pci/access.c | |||
@@ -485,9 +485,13 @@ static inline bool pcie_cap_has_lnkctl(const struct pci_dev *dev) | |||
485 | int type = pci_pcie_type(dev); | 485 | int type = pci_pcie_type(dev); |
486 | 486 | ||
487 | return pcie_cap_version(dev) > 1 || | 487 | return pcie_cap_version(dev) > 1 || |
488 | type == PCI_EXP_TYPE_ROOT_PORT || | ||
489 | type == PCI_EXP_TYPE_ENDPOINT || | 488 | type == PCI_EXP_TYPE_ENDPOINT || |
490 | type == PCI_EXP_TYPE_LEG_END; | 489 | type == PCI_EXP_TYPE_LEG_END || |
490 | type == PCI_EXP_TYPE_ROOT_PORT || | ||
491 | type == PCI_EXP_TYPE_UPSTREAM || | ||
492 | type == PCI_EXP_TYPE_DOWNSTREAM || | ||
493 | type == PCI_EXP_TYPE_PCI_BRIDGE || | ||
494 | type == PCI_EXP_TYPE_PCIE_BRIDGE; | ||
491 | } | 495 | } |
492 | 496 | ||
493 | static inline bool pcie_cap_has_sltctl(const struct pci_dev *dev) | 497 | static inline bool pcie_cap_has_sltctl(const struct pci_dev *dev) |