Skip to content

Commit d3694d4

Browse files
committed
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>
1 parent bd6fb76 commit d3694d4

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎drivers/pci/access.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,9 +485,13 @@ static inline bool pcie_cap_has_lnkctl(const struct pci_dev *dev)
485485
int type = pci_pcie_type(dev);
486486

487487
return pcie_cap_version(dev) > 1 ||
488-
type == PCI_EXP_TYPE_ROOT_PORT ||
489488
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;
491495
}
492496

493497
static inline bool pcie_cap_has_sltctl(const struct pci_dev *dev)

0 commit comments

Comments
 (0)