#include <linux/version.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0))
+#include <linux/pci.h>
+#include <linux/pci_hotplug.h>
#ifndef PTR_ERR_OR_ZERO
#define PTR_ERR_OR_ZERO(p) PTR_RET(p)
return f->f_dentry->d_inode;
}
+#ifndef HAVE_PCIE_LINK_WIDTH
/* These values come from the PCI Express Spec */
enum pcie_link_width {
PCIE_LNK_WIDTH_RESRV = 0x00,
PCIE_LNK_X32 = 0x20,
PCIE_LNK_WIDTH_UNKNOWN = 0xFF,
};
+#endif
-/* Based on the PCI Hotplug Spec, but some values are made up by us */
-enum pci_bus_speed {
- PCI_SPEED_33MHz = 0x00,
- PCI_SPEED_66MHz = 0x01,
- PCI_SPEED_66MHz_PCIX = 0x02,
- PCI_SPEED_100MHz_PCIX = 0x03,
- PCI_SPEED_133MHz_PCIX = 0x04,
- PCI_SPEED_66MHz_PCIX_ECC = 0x05,
- PCI_SPEED_100MHz_PCIX_ECC = 0x06,
- PCI_SPEED_133MHz_PCIX_ECC = 0x07,
- PCI_SPEED_66MHz_PCIX_266 = 0x09,
- PCI_SPEED_100MHz_PCIX_266 = 0x0a,
- PCI_SPEED_133MHz_PCIX_266 = 0x0b,
- AGP_UNKNOWN = 0x0c,
- AGP_1X = 0x0d,
- AGP_2X = 0x0e,
- AGP_4X = 0x0f,
- AGP_8X = 0x10,
- PCI_SPEED_66MHz_PCIX_533 = 0x11,
- PCI_SPEED_100MHz_PCIX_533 = 0x12,
- PCI_SPEED_133MHz_PCIX_533 = 0x13,
- PCIE_SPEED_2_5GT = 0x14,
- PCIE_SPEED_5_0GT = 0x15,
- PCIE_SPEED_8_0GT = 0x16,
- PCI_SPEED_UNKNOWN = 0xff,
-};
+extern const unsigned char pcie_link_speed[];
+#define pcie_get_minimum_link LINUX_BACKPORT(pcie_get_minimum_link)
+int pcie_get_minimum_link(struct pci_dev *dev, enum pci_bus_speed *speed,
+ enum pcie_link_width *width);
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)) */
-
#endif /* LINUX_3_12_COMPAT_H */