|
@@ -5190,6 +5190,24 @@ enum pci_bus_speed pcie_get_speed_cap(struct pci_dev *dev)
|
|
|
return PCI_SPEED_UNKNOWN;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * pcie_get_width_cap - query for the PCI device's link width capability
|
|
|
+ * @dev: PCI device to query
|
|
|
+ *
|
|
|
+ * Query the PCI device width capability. Return the maximum link width
|
|
|
+ * supported by the device.
|
|
|
+ */
|
|
|
+enum pcie_link_width pcie_get_width_cap(struct pci_dev *dev)
|
|
|
+{
|
|
|
+ u32 lnkcap;
|
|
|
+
|
|
|
+ pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &lnkcap);
|
|
|
+ if (lnkcap)
|
|
|
+ return (lnkcap & PCI_EXP_LNKCAP_MLW) >> 4;
|
|
|
+
|
|
|
+ return PCIE_LNK_WIDTH_UNKNOWN;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* pci_select_bars - Make BAR mask from the type of resource
|
|
|
* @dev: the PCI device for which BAR mask is made
|