aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pci.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r--include/linux/pci.h64
1 files changed, 43 insertions, 21 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c133ccfa002e..e72ca8dd6241 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -261,6 +261,9 @@ enum pci_bus_speed {
261 PCI_SPEED_UNKNOWN = 0xff, 261 PCI_SPEED_UNKNOWN = 0xff,
262}; 262};
263 263
264enum pci_bus_speed pcie_get_speed_cap(struct pci_dev *dev);
265enum pcie_link_width pcie_get_width_cap(struct pci_dev *dev);
266
264struct pci_cap_saved_data { 267struct pci_cap_saved_data {
265 u16 cap_nr; 268 u16 cap_nr;
266 bool cap_extended; 269 bool cap_extended;
@@ -299,6 +302,7 @@ struct pci_dev {
299 u8 hdr_type; /* PCI header type (`multi' flag masked out) */ 302 u8 hdr_type; /* PCI header type (`multi' flag masked out) */
300#ifdef CONFIG_PCIEAER 303#ifdef CONFIG_PCIEAER
301 u16 aer_cap; /* AER capability offset */ 304 u16 aer_cap; /* AER capability offset */
305 struct aer_stats *aer_stats; /* AER stats for this device */
302#endif 306#endif
303 u8 pcie_cap; /* PCIe capability offset */ 307 u8 pcie_cap; /* PCIe capability offset */
304 u8 msi_cap; /* MSI capability offset */ 308 u8 msi_cap; /* MSI capability offset */
@@ -350,6 +354,7 @@ struct pci_dev {
350 unsigned int ltr_path:1; /* Latency Tolerance Reporting 354 unsigned int ltr_path:1; /* Latency Tolerance Reporting
351 supported from root to here */ 355 supported from root to here */
352#endif 356#endif
357 unsigned int eetlp_prefix_path:1; /* End-to-End TLP Prefix */
353 358
354 pci_channel_state_t error_state; /* Current connectivity state */ 359 pci_channel_state_t error_state; /* Current connectivity state */
355 struct device dev; /* Generic device interface */ 360 struct device dev; /* Generic device interface */
@@ -387,6 +392,7 @@ struct pci_dev {
387 unsigned int is_virtfn:1; 392 unsigned int is_virtfn:1;
388 unsigned int reset_fn:1; 393 unsigned int reset_fn:1;
389 unsigned int is_hotplug_bridge:1; 394 unsigned int is_hotplug_bridge:1;
395 unsigned int shpc_managed:1; /* SHPC owned by shpchp */
390 unsigned int is_thunderbolt:1; /* Thunderbolt controller */ 396 unsigned int is_thunderbolt:1; /* Thunderbolt controller */
391 unsigned int __aer_firmware_first_valid:1; 397 unsigned int __aer_firmware_first_valid:1;
392 unsigned int __aer_firmware_first:1; 398 unsigned int __aer_firmware_first:1;
@@ -818,6 +824,21 @@ struct pci_driver {
818 .vendor = PCI_VENDOR_ID_##vend, .device = (dev), \ 824 .vendor = PCI_VENDOR_ID_##vend, .device = (dev), \
819 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0 825 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0
820 826
827/**
828 * PCI_DEVICE_DATA - macro used to describe a specific PCI device in very short form
829 * @vend: the vendor name (without PCI_VENDOR_ID_ prefix)
830 * @dev: the device name (without PCI_DEVICE_ID_<vend>_ prefix)
831 * @data: the driver data to be filled
832 *
833 * This macro is used to create a struct pci_device_id that matches a
834 * specific PCI device. The subvendor, and subdevice fields will be set
835 * to PCI_ANY_ID.
836 */
837#define PCI_DEVICE_DATA(vend, dev, data) \
838 .vendor = PCI_VENDOR_ID_##vend, .device = PCI_DEVICE_ID_##vend##_##dev, \
839 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0, \
840 .driver_data = (kernel_ulong_t)(data)
841
821enum { 842enum {
822 PCI_REASSIGN_ALL_RSRC = 0x00000001, /* Ignore firmware setup */ 843 PCI_REASSIGN_ALL_RSRC = 0x00000001, /* Ignore firmware setup */
823 PCI_REASSIGN_ALL_BUS = 0x00000002, /* Reassign all bus numbers */ 844 PCI_REASSIGN_ALL_BUS = 0x00000002, /* Reassign all bus numbers */
@@ -1088,20 +1109,17 @@ u32 pcie_bandwidth_available(struct pci_dev *dev, struct pci_dev **limiting_dev,
1088 enum pci_bus_speed *speed, 1109 enum pci_bus_speed *speed,
1089 enum pcie_link_width *width); 1110 enum pcie_link_width *width);
1090void pcie_print_link_status(struct pci_dev *dev); 1111void pcie_print_link_status(struct pci_dev *dev);
1112bool pcie_has_flr(struct pci_dev *dev);
1091int pcie_flr(struct pci_dev *dev); 1113int pcie_flr(struct pci_dev *dev);
1092int __pci_reset_function_locked(struct pci_dev *dev); 1114int __pci_reset_function_locked(struct pci_dev *dev);
1093int pci_reset_function(struct pci_dev *dev); 1115int pci_reset_function(struct pci_dev *dev);
1094int pci_reset_function_locked(struct pci_dev *dev); 1116int pci_reset_function_locked(struct pci_dev *dev);
1095int pci_try_reset_function(struct pci_dev *dev); 1117int pci_try_reset_function(struct pci_dev *dev);
1096int pci_probe_reset_slot(struct pci_slot *slot); 1118int pci_probe_reset_slot(struct pci_slot *slot);
1097int pci_reset_slot(struct pci_slot *slot);
1098int pci_try_reset_slot(struct pci_slot *slot);
1099int pci_probe_reset_bus(struct pci_bus *bus); 1119int pci_probe_reset_bus(struct pci_bus *bus);
1100int pci_reset_bus(struct pci_bus *bus); 1120int pci_reset_bus(struct pci_dev *dev);
1101int pci_try_reset_bus(struct pci_bus *bus);
1102void pci_reset_secondary_bus(struct pci_dev *dev); 1121void pci_reset_secondary_bus(struct pci_dev *dev);
1103void pcibios_reset_secondary_bus(struct pci_dev *dev); 1122void pcibios_reset_secondary_bus(struct pci_dev *dev);
1104int pci_reset_bridge_secondary_bus(struct pci_dev *dev);
1105void pci_update_resource(struct pci_dev *dev, int resno); 1123void pci_update_resource(struct pci_dev *dev, int resno);
1106int __must_check pci_assign_resource(struct pci_dev *dev, int i); 1124int __must_check pci_assign_resource(struct pci_dev *dev, int i);
1107int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align); 1125int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align);
@@ -1121,7 +1139,6 @@ int pci_enable_rom(struct pci_dev *pdev);
1121void pci_disable_rom(struct pci_dev *pdev); 1139void pci_disable_rom(struct pci_dev *pdev);
1122void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); 1140void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);
1123void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); 1141void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom);
1124size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size);
1125void __iomem __must_check *pci_platform_rom(struct pci_dev *pdev, size_t *size); 1142void __iomem __must_check *pci_platform_rom(struct pci_dev *pdev, size_t *size);
1126 1143
1127/* Power management related routines */ 1144/* Power management related routines */
@@ -1469,13 +1486,9 @@ static inline bool pcie_aspm_support_enabled(void) { return false; }
1469#endif 1486#endif
1470 1487
1471#ifdef CONFIG_PCIEAER 1488#ifdef CONFIG_PCIEAER
1472void pci_no_aer(void);
1473bool pci_aer_available(void); 1489bool pci_aer_available(void);
1474int pci_aer_init(struct pci_dev *dev);
1475#else 1490#else
1476static inline void pci_no_aer(void) { }
1477static inline bool pci_aer_available(void) { return false; } 1491static inline bool pci_aer_available(void) { return false; }
1478static inline int pci_aer_init(struct pci_dev *d) { return -ENODEV; }
1479#endif 1492#endif
1480 1493
1481#ifdef CONFIG_PCIE_ECRC 1494#ifdef CONFIG_PCIE_ECRC
@@ -1796,7 +1809,11 @@ struct pci_fixup {
1796 u16 device; /* Or PCI_ANY_ID */ 1809 u16 device; /* Or PCI_ANY_ID */
1797 u32 class; /* Or PCI_ANY_ID */ 1810 u32 class; /* Or PCI_ANY_ID */
1798 unsigned int class_shift; /* should be 0, 8, 16 */ 1811 unsigned int class_shift; /* should be 0, 8, 16 */
1812#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
1813 int hook_offset;
1814#else
1799 void (*hook)(struct pci_dev *dev); 1815 void (*hook)(struct pci_dev *dev);
1816#endif
1800}; 1817};
1801 1818
1802enum pci_fixup_pass { 1819enum pci_fixup_pass {
@@ -1810,12 +1827,28 @@ enum pci_fixup_pass {
1810 pci_fixup_suspend_late, /* pci_device_suspend_late() */ 1827 pci_fixup_suspend_late, /* pci_device_suspend_late() */
1811}; 1828};
1812 1829
1830#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
1831#define __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \
1832 class_shift, hook) \
1833 __ADDRESSABLE(hook) \
1834 asm(".section " #sec ", \"a\" \n" \
1835 ".balign 16 \n" \
1836 ".short " #vendor ", " #device " \n" \
1837 ".long " #class ", " #class_shift " \n" \
1838 ".long " #hook " - . \n" \
1839 ".previous \n");
1840#define DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \
1841 class_shift, hook) \
1842 __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \
1843 class_shift, hook)
1844#else
1813/* Anonymous variables would be nice... */ 1845/* Anonymous variables would be nice... */
1814#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \ 1846#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \
1815 class_shift, hook) \ 1847 class_shift, hook) \
1816 static const struct pci_fixup __PASTE(__pci_fixup_##name,__LINE__) __used \ 1848 static const struct pci_fixup __PASTE(__pci_fixup_##name,__LINE__) __used \
1817 __attribute__((__section__(#section), aligned((sizeof(void *))))) \ 1849 __attribute__((__section__(#section), aligned((sizeof(void *))))) \
1818 = { vendor, device, class, class_shift, hook }; 1850 = { vendor, device, class, class_shift, hook };
1851#endif
1819 1852
1820#define DECLARE_PCI_FIXUP_CLASS_EARLY(vendor, device, class, \ 1853#define DECLARE_PCI_FIXUP_CLASS_EARLY(vendor, device, class, \
1821 class_shift, hook) \ 1854 class_shift, hook) \
@@ -1877,20 +1910,9 @@ enum pci_fixup_pass {
1877 1910
1878#ifdef CONFIG_PCI_QUIRKS 1911#ifdef CONFIG_PCI_QUIRKS
1879void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1912void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
1880int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags);
1881int pci_dev_specific_enable_acs(struct pci_dev *dev);
1882#else 1913#else
1883static inline void pci_fixup_device(enum pci_fixup_pass pass, 1914static inline void pci_fixup_device(enum pci_fixup_pass pass,
1884 struct pci_dev *dev) { } 1915 struct pci_dev *dev) { }
1885static inline int pci_dev_specific_acs_enabled(struct pci_dev *dev,
1886 u16 acs_flags)
1887{
1888 return -ENOTTY;
1889}
1890static inline int pci_dev_specific_enable_acs(struct pci_dev *dev)
1891{
1892 return -ENOTTY;
1893}
1894#endif 1916#endif
1895 1917
1896void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); 1918void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);