diff options
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r-- | drivers/pci/pci.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index d068f11d08a7..c9d8e3c837de 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -5556,9 +5556,13 @@ enum pci_bus_speed pcie_get_speed_cap(struct pci_dev *dev) | |||
5556 | u32 lnkcap2, lnkcap; | 5556 | u32 lnkcap2, lnkcap; |
5557 | 5557 | ||
5558 | /* | 5558 | /* |
5559 | * PCIe r4.0 sec 7.5.3.18 recommends using the Supported Link | 5559 | * Link Capabilities 2 was added in PCIe r3.0, sec 7.8.18. The |
5560 | * Speeds Vector in Link Capabilities 2 when supported, falling | 5560 | * implementation note there recommends using the Supported Link |
5561 | * back to Max Link Speed in Link Capabilities otherwise. | 5561 | * Speeds Vector in Link Capabilities 2 when supported. |
5562 | * | ||
5563 | * Without Link Capabilities 2, i.e., prior to PCIe r3.0, software | ||
5564 | * should use the Supported Link Speeds field in Link Capabilities, | ||
5565 | * where only 2.5 GT/s and 5.0 GT/s speeds were defined. | ||
5562 | */ | 5566 | */ |
5563 | pcie_capability_read_dword(dev, PCI_EXP_LNKCAP2, &lnkcap2); | 5567 | pcie_capability_read_dword(dev, PCI_EXP_LNKCAP2, &lnkcap2); |
5564 | if (lnkcap2) { /* PCIe r3.0-compliant */ | 5568 | if (lnkcap2) { /* PCIe r3.0-compliant */ |
@@ -5574,16 +5578,10 @@ enum pci_bus_speed pcie_get_speed_cap(struct pci_dev *dev) | |||
5574 | } | 5578 | } |
5575 | 5579 | ||
5576 | pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &lnkcap); | 5580 | pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &lnkcap); |
5577 | if (lnkcap) { | 5581 | if ((lnkcap & PCI_EXP_LNKCAP_SLS) == PCI_EXP_LNKCAP_SLS_5_0GB) |
5578 | if (lnkcap & PCI_EXP_LNKCAP_SLS_16_0GB) | 5582 | return PCIE_SPEED_5_0GT; |
5579 | return PCIE_SPEED_16_0GT; | 5583 | else if ((lnkcap & PCI_EXP_LNKCAP_SLS) == PCI_EXP_LNKCAP_SLS_2_5GB) |
5580 | else if (lnkcap & PCI_EXP_LNKCAP_SLS_8_0GB) | 5584 | return PCIE_SPEED_2_5GT; |
5581 | return PCIE_SPEED_8_0GT; | ||
5582 | else if (lnkcap & PCI_EXP_LNKCAP_SLS_5_0GB) | ||
5583 | return PCIE_SPEED_5_0GT; | ||
5584 | else if (lnkcap & PCI_EXP_LNKCAP_SLS_2_5GB) | ||
5585 | return PCIE_SPEED_2_5GT; | ||
5586 | } | ||
5587 | 5585 | ||
5588 | return PCI_SPEED_UNKNOWN; | 5586 | return PCI_SPEED_UNKNOWN; |
5589 | } | 5587 | } |