diff options
author | Yinghai Lu <yinghai@kernel.org> | 2014-11-11 15:09:46 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-11-13 17:43:42 -0500 |
commit | 7a1562d4f2d01721ad07c3a326db7512077ceea9 (patch) | |
tree | 4b146df04163b8de218cdaa9ae79b49ac7735355 | |
parent | 2801f7252d5be3f4f3886c2a5890284232801afe (diff) |
PCI: Apply _HPX Link Control settings to all devices with a link
Previously we applied _HPX type 2 record Link Control register settings
only to bridges with a subordinate bus. But it's better to apply them to
all devices with a link because if the subordinate bus has not been
allocated yet, we won't apply settings to the device.
Use pcie_cap_has_lnkctl() to determine whether the device has a Link
Control register instead of looking at dev->subordinate.
[bhelgaas: changelog]
Fixes: 6cd33649fa83 ("PCI: Add pci_configure_device() during enumeration")
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r-- | drivers/pci/access.c | 2 | ||||
-rw-r--r-- | drivers/pci/pci.h | 2 | ||||
-rw-r--r-- | drivers/pci/probe.c | 2 |
3 files changed, 4 insertions, 2 deletions
diff --git a/drivers/pci/access.c b/drivers/pci/access.c index d292d7cb3417..49dd766852ba 100644 --- a/drivers/pci/access.c +++ b/drivers/pci/access.c | |||
@@ -444,7 +444,7 @@ static inline int pcie_cap_version(const struct pci_dev *dev) | |||
444 | return pcie_caps_reg(dev) & PCI_EXP_FLAGS_VERS; | 444 | return pcie_caps_reg(dev) & PCI_EXP_FLAGS_VERS; |
445 | } | 445 | } |
446 | 446 | ||
447 | static inline bool pcie_cap_has_lnkctl(const struct pci_dev *dev) | 447 | bool pcie_cap_has_lnkctl(const struct pci_dev *dev) |
448 | { | 448 | { |
449 | int type = pci_pcie_type(dev); | 449 | int type = pci_pcie_type(dev); |
450 | 450 | ||
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 0601890db22d..4a3902d8e6fe 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -6,6 +6,8 @@ | |||
6 | 6 | ||
7 | extern const unsigned char pcie_link_speed[]; | 7 | extern const unsigned char pcie_link_speed[]; |
8 | 8 | ||
9 | bool pcie_cap_has_lnkctl(const struct pci_dev *dev); | ||
10 | |||
9 | /* Functions internal to the PCI core code */ | 11 | /* Functions internal to the PCI core code */ |
10 | 12 | ||
11 | int pci_create_sysfs_dev_files(struct pci_dev *pdev); | 13 | int pci_create_sysfs_dev_files(struct pci_dev *pdev); |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 5ed99309c758..6244b1834dfe 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -1323,7 +1323,7 @@ static void program_hpp_type2(struct pci_dev *dev, struct hpp_type2 *hpp) | |||
1323 | ~hpp->pci_exp_devctl_and, hpp->pci_exp_devctl_or); | 1323 | ~hpp->pci_exp_devctl_and, hpp->pci_exp_devctl_or); |
1324 | 1324 | ||
1325 | /* Initialize Link Control Register */ | 1325 | /* Initialize Link Control Register */ |
1326 | if (dev->subordinate) | 1326 | if (pcie_cap_has_lnkctl(dev)) |
1327 | pcie_capability_clear_and_set_word(dev, PCI_EXP_LNKCTL, | 1327 | pcie_capability_clear_and_set_word(dev, PCI_EXP_LNKCTL, |
1328 | ~hpp->pci_exp_lnkctl_and, hpp->pci_exp_lnkctl_or); | 1328 | ~hpp->pci_exp_lnkctl_and, hpp->pci_exp_lnkctl_or); |
1329 | 1329 | ||