diff options
author | 2018-04-04 13:27:37 -0500 | |
---|---|---|
committer | 2018-04-04 13:27:37 -0500 | |
commit | 09baca98411f4688be6e2deb312ffa2c42474b59 (patch) | |
tree | 87873d08e8a6c6893c52b1499aeb13d3e2c87488 | |
parent | Merge branch 'pci/aer' (diff) | |
parent | PCI/ASPM: Don't warn if already in common clock mode (diff) | |
download | linux-rng-09baca98411f4688be6e2deb312ffa2c42474b59.tar.xz linux-rng-09baca98411f4688be6e2deb312ffa2c42474b59.zip |
Merge branch 'pci/aspm'
- skip ASPM common clock warning if BIOS already configured it (Sinan
Kaya)
- fix ASPM Coverity warning about threshold_ns (Gustavo A. R. Silva)
* pci/aspm:
PCI/ASPM: Don't warn if already in common clock mode
PCI/ASPM: Declare threshold_ns as u32, not u64
-rw-r--r-- | drivers/pci/pcie/aspm.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 57feef2ecfe7..95a2f222b64e 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -228,6 +228,24 @@ static void pcie_aspm_configure_common_clock(struct pcie_link_state *link) if (!(reg16 & PCI_EXP_LNKSTA_SLC)) same_clock = 0; + /* Port might be already in common clock mode */ + pcie_capability_read_word(parent, PCI_EXP_LNKCTL, ®16); + if (same_clock && (reg16 & PCI_EXP_LNKCTL_CCC)) { + bool consistent = true; + + list_for_each_entry(child, &linkbus->devices, bus_list) { + pcie_capability_read_word(child, PCI_EXP_LNKCTL, + ®16); + if (!(reg16 & PCI_EXP_LNKCTL_CCC)) { + consistent = false; + break; + } + } + if (consistent) + return; + pci_warn(parent, "ASPM: current common clock configuration is broken, reconfiguring\n"); + } + /* Configure downstream component, all functions */ list_for_each_entry(child, &linkbus->devices, bus_list) { pcie_capability_read_word(child, PCI_EXP_LNKCTL, ®16); @@ -322,7 +340,7 @@ static u32 calc_l1ss_pwron(struct pci_dev *pdev, u32 scale, u32 val) static void encode_l12_threshold(u32 threshold_us, u32 *scale, u32 *value) { - u64 threshold_ns = threshold_us * 1000; + u32 threshold_ns = threshold_us * 1000; /* See PCIe r3.1, sec 7.33.3 and sec 6.18 */ if (threshold_ns < 32) { |