@@ -5265,6 +5265,35 @@ int pcie_bandwidth_capable(struct pci_dev *dev, enum pci_bus_speed *speed,
EXPORT_SYMBOL(pcie_bandwidth_capable);
/**
+ * pcie_print_link_status - Reports the PCI device's link speed and width.
+ * @dev: PCI device to query
+ *
+ * This function checks whether the PCI device current speed and width are equal
+ * to the maximum PCI device capabilities.
+ */
+void pcie_print_link_status(struct pci_dev *dev)
+{
+ enum pcie_link_width width, width_cap;
+ struct pci_dev *limiting_dev = NULL;
+ enum pci_bus_speed speed, speed_cap;
+ int bw, bw_cap;
+
+ bw_cap = pcie_bandwidth_capable(dev, &speed_cap, &width_cap);
+ pcie_bandwidth_available(dev, &speed, &width, &bw, &limiting_dev);
+
+ if (bw >= bw_cap)
+ pci_info(dev, "%d Mb/s available bandwidth (%s x%d link)\n",
+ bw, PCIE_SPEED2STR(speed), width);
+ else
+ pci_info(dev, "%d Mb/s available bandwidth (capable of %d Mb/s, %s x%d link)\n",
+ bw, bw_cap, PCIE_SPEED2STR(speed_cap), width_cap);
+ if (limiting_dev && strcmp(pci_name(limiting_dev), pci_name(dev)))
+ pci_info(dev, "Bandwidth limited by device at %s\n",
+ pci_name(limiting_dev));
+}
+EXPORT_SYMBOL(pcie_print_link_status);
+
+/**
* pci_select_bars - Make BAR mask from the type of resource
* @dev: the PCI device for which BAR mask is made
* @flags: resource type mask to be selected
@@ -1105,6 +1105,7 @@ int pcie_bandwidth_available(struct pci_dev *dev, enum pci_bus_speed *speed,
int pcie_get_width_cap(struct pci_dev *dev, enum pcie_link_width *width);
int pcie_bandwidth_capable(struct pci_dev *dev, enum pci_bus_speed *speed,
enum pcie_link_width *width);
+void pcie_print_link_status(struct pci_dev *dev);
void pcie_flr(struct pci_dev *dev);
int __pci_reset_function_locked(struct pci_dev *dev);
int pci_reset_function(struct pci_dev *dev);