diff options
| author | Bjorn Helgaas <bhelgaas@google.com> | 2018-01-31 11:13:07 -0500 |
|---|---|---|
| committer | Bjorn Helgaas <helgaas@kernel.org> | 2018-01-31 11:13:07 -0500 |
| commit | 01f095e46ba3a91b06709170c19bc3936e872541 (patch) | |
| tree | 8e4e3504b81b9ebee4561ac42f55b734449b73ae /include/linux | |
| parent | 6a436fa81252b3a302d61133c784472a237b6dd7 (diff) | |
| parent | 0aa0f5d1084ca1cc302e3c2025065a2a2182bb08 (diff) | |
Merge branch 'pci/trivial' into next
* pci/trivial:
PCI: Clean up whitespace in linux/pci.h, pci/pci.h
PCI: Tidy up pci/probe.c comments
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/pci.h | 411 |
1 files changed, 195 insertions, 216 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h index 656989b00666..a1e10ba7b612 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -48,17 +48,17 @@ | |||
| 48 | * In the interest of not exposing interfaces to user-space unnecessarily, | 48 | * In the interest of not exposing interfaces to user-space unnecessarily, |
| 49 | * the following kernel-only defines are being added here. | 49 | * the following kernel-only defines are being added here. |
| 50 | */ | 50 | */ |
| 51 | #define PCI_DEVID(bus, devfn) ((((u16)(bus)) << 8) | (devfn)) | 51 | #define PCI_DEVID(bus, devfn) ((((u16)(bus)) << 8) | (devfn)) |
| 52 | /* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */ | 52 | /* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */ |
| 53 | #define PCI_BUS_NUM(x) (((x) >> 8) & 0xff) | 53 | #define PCI_BUS_NUM(x) (((x) >> 8) & 0xff) |
| 54 | 54 | ||
| 55 | /* pci_slot represents a physical slot */ | 55 | /* pci_slot represents a physical slot */ |
| 56 | struct pci_slot { | 56 | struct pci_slot { |
| 57 | struct pci_bus *bus; /* The bus this slot is on */ | 57 | struct pci_bus *bus; /* Bus this slot is on */ |
| 58 | struct list_head list; /* node in list of slots on this bus */ | 58 | struct list_head list; /* Node in list of slots */ |
| 59 | struct hotplug_slot *hotplug; /* Hotplug info (migrate over time) */ | 59 | struct hotplug_slot *hotplug; /* Hotplug info (move here) */ |
| 60 | unsigned char number; /* PCI_SLOT(pci_dev->devfn) */ | 60 | unsigned char number; /* PCI_SLOT(pci_dev->devfn) */ |
| 61 | struct kobject kobj; | 61 | struct kobject kobj; |
| 62 | }; | 62 | }; |
| 63 | 63 | ||
| 64 | static inline const char *pci_slot_name(const struct pci_slot *slot) | 64 | static inline const char *pci_slot_name(const struct pci_slot *slot) |
| @@ -72,9 +72,7 @@ enum pci_mmap_state { | |||
| 72 | pci_mmap_mem | 72 | pci_mmap_mem |
| 73 | }; | 73 | }; |
| 74 | 74 | ||
| 75 | /* | 75 | /* For PCI devices, the region numbers are assigned this way: */ |
| 76 | * For PCI devices, the region numbers are assigned this way: | ||
| 77 | */ | ||
| 78 | enum { | 76 | enum { |
| 79 | /* #0-5: standard PCI resources */ | 77 | /* #0-5: standard PCI resources */ |
| 80 | PCI_STD_RESOURCES, | 78 | PCI_STD_RESOURCES, |
| @@ -83,23 +81,23 @@ enum { | |||
| 83 | /* #6: expansion ROM resource */ | 81 | /* #6: expansion ROM resource */ |
| 84 | PCI_ROM_RESOURCE, | 82 | PCI_ROM_RESOURCE, |
| 85 | 83 | ||
| 86 | /* device specific resources */ | 84 | /* Device-specific resources */ |
| 87 | #ifdef CONFIG_PCI_IOV | 85 | #ifdef CONFIG_PCI_IOV |
| 88 | PCI_IOV_RESOURCES, | 86 | PCI_IOV_RESOURCES, |
| 89 | PCI_IOV_RESOURCE_END = PCI_IOV_RESOURCES + PCI_SRIOV_NUM_BARS - 1, | 87 | PCI_IOV_RESOURCE_END = PCI_IOV_RESOURCES + PCI_SRIOV_NUM_BARS - 1, |
| 90 | #endif | 88 | #endif |
| 91 | 89 | ||
| 92 | /* resources assigned to buses behind the bridge */ | 90 | /* Resources assigned to buses behind the bridge */ |
| 93 | #define PCI_BRIDGE_RESOURCE_NUM 4 | 91 | #define PCI_BRIDGE_RESOURCE_NUM 4 |
| 94 | 92 | ||
| 95 | PCI_BRIDGE_RESOURCES, | 93 | PCI_BRIDGE_RESOURCES, |
| 96 | PCI_BRIDGE_RESOURCE_END = PCI_BRIDGE_RESOURCES + | 94 | PCI_BRIDGE_RESOURCE_END = PCI_BRIDGE_RESOURCES + |
| 97 | PCI_BRIDGE_RESOURCE_NUM - 1, | 95 | PCI_BRIDGE_RESOURCE_NUM - 1, |
| 98 | 96 | ||
| 99 | /* total resources associated with a PCI device */ | 97 | /* Total resources associated with a PCI device */ |
| 100 | PCI_NUM_RESOURCES, | 98 | PCI_NUM_RESOURCES, |
| 101 | 99 | ||
| 102 | /* preserve this for compatibility */ | 100 | /* Preserve this for compatibility */ |
| 103 | DEVICE_COUNT_RESOURCE = PCI_NUM_RESOURCES, | 101 | DEVICE_COUNT_RESOURCE = PCI_NUM_RESOURCES, |
| 104 | }; | 102 | }; |
| 105 | 103 | ||
| @@ -152,9 +150,10 @@ static inline const char *pci_power_name(pci_power_t state) | |||
| 152 | #define PCI_PM_D3COLD_WAIT 100 | 150 | #define PCI_PM_D3COLD_WAIT 100 |
| 153 | #define PCI_PM_BUS_WAIT 50 | 151 | #define PCI_PM_BUS_WAIT 50 |
| 154 | 152 | ||
| 155 | /** The pci_channel state describes connectivity between the CPU and | 153 | /** |
| 156 | * the pci device. If some PCI bus between here and the pci device | 154 | * The pci_channel state describes connectivity between the CPU and |
| 157 | * has crashed or locked up, this info is reflected here. | 155 | * the PCI device. If some PCI bus between here and the PCI device |
| 156 | * has crashed or locked up, this info is reflected here. | ||
| 158 | */ | 157 | */ |
| 159 | typedef unsigned int __bitwise pci_channel_state_t; | 158 | typedef unsigned int __bitwise pci_channel_state_t; |
| 160 | 159 | ||
| @@ -184,9 +183,7 @@ enum pcie_reset_state { | |||
| 184 | 183 | ||
| 185 | typedef unsigned short __bitwise pci_dev_flags_t; | 184 | typedef unsigned short __bitwise pci_dev_flags_t; |
| 186 | enum pci_dev_flags { | 185 | enum pci_dev_flags { |
| 187 | /* INTX_DISABLE in PCI_COMMAND register disables MSI | 186 | /* INTX_DISABLE in PCI_COMMAND register disables MSI too */ |
| 188 | * generation too. | ||
| 189 | */ | ||
| 190 | PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) (1 << 0), | 187 | PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) (1 << 0), |
| 191 | /* Device configuration is irrevocably lost if disabled into D3 */ | 188 | /* Device configuration is irrevocably lost if disabled into D3 */ |
| 192 | PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) (1 << 1), | 189 | PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) (1 << 1), |
| @@ -202,7 +199,7 @@ enum pci_dev_flags { | |||
| 202 | PCI_DEV_FLAGS_NO_PM_RESET = (__force pci_dev_flags_t) (1 << 7), | 199 | PCI_DEV_FLAGS_NO_PM_RESET = (__force pci_dev_flags_t) (1 << 7), |
| 203 | /* Get VPD from function 0 VPD */ | 200 | /* Get VPD from function 0 VPD */ |
| 204 | PCI_DEV_FLAGS_VPD_REF_F0 = (__force pci_dev_flags_t) (1 << 8), | 201 | PCI_DEV_FLAGS_VPD_REF_F0 = (__force pci_dev_flags_t) (1 << 8), |
| 205 | /* a non-root bridge where translation occurs, stop alias search here */ | 202 | /* A non-root bridge where translation occurs, stop alias search here */ |
| 206 | PCI_DEV_FLAGS_BRIDGE_XLATE_ROOT = (__force pci_dev_flags_t) (1 << 9), | 203 | PCI_DEV_FLAGS_BRIDGE_XLATE_ROOT = (__force pci_dev_flags_t) (1 << 9), |
| 207 | /* Do not use FLR even if device advertises PCI_AF_CAP */ | 204 | /* Do not use FLR even if device advertises PCI_AF_CAP */ |
| 208 | PCI_DEV_FLAGS_NO_FLR_RESET = (__force pci_dev_flags_t) (1 << 10), | 205 | PCI_DEV_FLAGS_NO_FLR_RESET = (__force pci_dev_flags_t) (1 << 10), |
| @@ -222,17 +219,17 @@ enum pci_bus_flags { | |||
| 222 | PCI_BUS_FLAGS_NO_AERSID = (__force pci_bus_flags_t) 4, | 219 | PCI_BUS_FLAGS_NO_AERSID = (__force pci_bus_flags_t) 4, |
| 223 | }; | 220 | }; |
| 224 | 221 | ||
| 225 | /* These values come from the PCI Express Spec */ | 222 | /* Values from Link Status register, PCIe r3.1, sec 7.8.8 */ |
| 226 | enum pcie_link_width { | 223 | enum pcie_link_width { |
| 227 | PCIE_LNK_WIDTH_RESRV = 0x00, | 224 | PCIE_LNK_WIDTH_RESRV = 0x00, |
| 228 | PCIE_LNK_X1 = 0x01, | 225 | PCIE_LNK_X1 = 0x01, |
| 229 | PCIE_LNK_X2 = 0x02, | 226 | PCIE_LNK_X2 = 0x02, |
| 230 | PCIE_LNK_X4 = 0x04, | 227 | PCIE_LNK_X4 = 0x04, |
| 231 | PCIE_LNK_X8 = 0x08, | 228 | PCIE_LNK_X8 = 0x08, |
| 232 | PCIE_LNK_X12 = 0x0C, | 229 | PCIE_LNK_X12 = 0x0c, |
| 233 | PCIE_LNK_X16 = 0x10, | 230 | PCIE_LNK_X16 = 0x10, |
| 234 | PCIE_LNK_X32 = 0x20, | 231 | PCIE_LNK_X32 = 0x20, |
| 235 | PCIE_LNK_WIDTH_UNKNOWN = 0xFF, | 232 | PCIE_LNK_WIDTH_UNKNOWN = 0xff, |
| 236 | }; | 233 | }; |
| 237 | 234 | ||
| 238 | /* Based on the PCI Hotplug Spec, but some values are made up by us */ | 235 | /* Based on the PCI Hotplug Spec, but some values are made up by us */ |
| @@ -263,15 +260,15 @@ enum pci_bus_speed { | |||
| 263 | }; | 260 | }; |
| 264 | 261 | ||
| 265 | struct pci_cap_saved_data { | 262 | struct pci_cap_saved_data { |
| 266 | u16 cap_nr; | 263 | u16 cap_nr; |
| 267 | bool cap_extended; | 264 | bool cap_extended; |
| 268 | unsigned int size; | 265 | unsigned int size; |
| 269 | u32 data[0]; | 266 | u32 data[0]; |
| 270 | }; | 267 | }; |
| 271 | 268 | ||
| 272 | struct pci_cap_saved_state { | 269 | struct pci_cap_saved_state { |
| 273 | struct hlist_node next; | 270 | struct hlist_node next; |
| 274 | struct pci_cap_saved_data cap; | 271 | struct pci_cap_saved_data cap; |
| 275 | }; | 272 | }; |
| 276 | 273 | ||
| 277 | struct irq_affinity; | 274 | struct irq_affinity; |
| @@ -280,19 +277,17 @@ struct pci_vpd; | |||
| 280 | struct pci_sriov; | 277 | struct pci_sriov; |
| 281 | struct pci_ats; | 278 | struct pci_ats; |
| 282 | 279 | ||
| 283 | /* | 280 | /* The pci_dev structure describes PCI devices */ |
| 284 | * The pci_dev structure is used to describe PCI devices. | ||
| 285 | */ | ||
| 286 | struct pci_dev { | 281 | struct pci_dev { |
| 287 | struct list_head bus_list; /* node in per-bus list */ | 282 | struct list_head bus_list; /* Node in per-bus list */ |
| 288 | struct pci_bus *bus; /* bus this device is on */ | 283 | struct pci_bus *bus; /* Bus this device is on */ |
| 289 | struct pci_bus *subordinate; /* bus this device bridges to */ | 284 | struct pci_bus *subordinate; /* Bus this device bridges to */ |
| 290 | 285 | ||
| 291 | void *sysdata; /* hook for sys-specific extension */ | 286 | void *sysdata; /* Hook for sys-specific extension */ |
| 292 | struct proc_dir_entry *procent; /* device entry in /proc/bus/pci */ | 287 | struct proc_dir_entry *procent; /* Device entry in /proc/bus/pci */ |
| 293 | struct pci_slot *slot; /* Physical slot this device is in */ | 288 | struct pci_slot *slot; /* Physical slot this device is in */ |
| 294 | 289 | ||
| 295 | unsigned int devfn; /* encoded device & function index */ | 290 | unsigned int devfn; /* Encoded device & function index */ |
| 296 | unsigned short vendor; | 291 | unsigned short vendor; |
| 297 | unsigned short device; | 292 | unsigned short device; |
| 298 | unsigned short subsystem_vendor; | 293 | unsigned short subsystem_vendor; |
| @@ -307,12 +302,12 @@ struct pci_dev { | |||
| 307 | u8 msi_cap; /* MSI capability offset */ | 302 | u8 msi_cap; /* MSI capability offset */ |
| 308 | u8 msix_cap; /* MSI-X capability offset */ | 303 | u8 msix_cap; /* MSI-X capability offset */ |
| 309 | u8 pcie_mpss:3; /* PCIe Max Payload Size Supported */ | 304 | u8 pcie_mpss:3; /* PCIe Max Payload Size Supported */ |
| 310 | u8 rom_base_reg; /* which config register controls the ROM */ | 305 | u8 rom_base_reg; /* Config register controlling ROM */ |
| 311 | u8 pin; /* which interrupt pin this device uses */ | 306 | u8 pin; /* Interrupt pin this device uses */ |
| 312 | u16 pcie_flags_reg; /* cached PCIe Capabilities Register */ | 307 | u16 pcie_flags_reg; /* Cached PCIe Capabilities Register */ |
| 313 | unsigned long *dma_alias_mask;/* mask of enabled devfn aliases */ | 308 | unsigned long *dma_alias_mask;/* Mask of enabled devfn aliases */ |
| 314 | 309 | ||
| 315 | struct pci_driver *driver; /* which driver has allocated this device */ | 310 | struct pci_driver *driver; /* Driver bound to this device */ |
| 316 | u64 dma_mask; /* Mask of the bits of bus address this | 311 | u64 dma_mask; /* Mask of the bits of bus address this |
| 317 | device implements. Normally this is | 312 | device implements. Normally this is |
| 318 | 0xffffffff. You only need to change | 313 | 0xffffffff. You only need to change |
| @@ -321,9 +316,9 @@ struct pci_dev { | |||
| 321 | 316 | ||
| 322 | struct device_dma_parameters dma_parms; | 317 | struct device_dma_parameters dma_parms; |
| 323 | 318 | ||
| 324 | pci_power_t current_state; /* Current operating state. In ACPI-speak, | 319 | pci_power_t current_state; /* Current operating state. In ACPI, |
| 325 | this is D0-D3, D0 being fully functional, | 320 | this is D0-D3, D0 being fully |
| 326 | and D3 being off. */ | 321 | functional, and D3 being off. */ |
| 327 | u8 pm_cap; /* PM capability offset */ | 322 | u8 pm_cap; /* PM capability offset */ |
| 328 | unsigned int pme_support:5; /* Bitmask of states from which PME# | 323 | unsigned int pme_support:5; /* Bitmask of states from which PME# |
| 329 | can be generated */ | 324 | can be generated */ |
| @@ -334,10 +329,10 @@ struct pci_dev { | |||
| 334 | unsigned int no_d3cold:1; /* D3cold is forbidden */ | 329 | unsigned int no_d3cold:1; /* D3cold is forbidden */ |
| 335 | unsigned int bridge_d3:1; /* Allow D3 for bridge */ | 330 | unsigned int bridge_d3:1; /* Allow D3 for bridge */ |
| 336 | unsigned int d3cold_allowed:1; /* D3cold is allowed by user */ | 331 | unsigned int d3cold_allowed:1; /* D3cold is allowed by user */ |
| 337 | unsigned int mmio_always_on:1; /* disallow turning off io/mem | 332 | unsigned int mmio_always_on:1; /* Disallow turning off io/mem |
| 338 | decoding during bar sizing */ | 333 | decoding during BAR sizing */ |
| 339 | unsigned int wakeup_prepared:1; | 334 | unsigned int wakeup_prepared:1; |
| 340 | unsigned int runtime_d3cold:1; /* whether go through runtime | 335 | unsigned int runtime_d3cold:1; /* Whether go through runtime |
| 341 | D3cold, not set for devices | 336 | D3cold, not set for devices |
| 342 | powered on/off by the | 337 | powered on/off by the |
| 343 | corresponding bridge */ | 338 | corresponding bridge */ |
| @@ -354,10 +349,10 @@ struct pci_dev { | |||
| 354 | supported from root to here */ | 349 | supported from root to here */ |
| 355 | #endif | 350 | #endif |
| 356 | 351 | ||
| 357 | pci_channel_state_t error_state; /* current connectivity state */ | 352 | pci_channel_state_t error_state; /* Current connectivity state */ |
| 358 | struct device dev; /* Generic device interface */ | 353 | struct device dev; /* Generic device interface */ |
| 359 | 354 | ||
| 360 | int cfg_size; /* Size of configuration space */ | 355 | int cfg_size; /* Size of config space */ |
| 361 | 356 | ||
| 362 | /* | 357 | /* |
| 363 | * Instead of touching interrupt line and base address registers | 358 | * Instead of touching interrupt line and base address registers |
| @@ -366,47 +361,47 @@ struct pci_dev { | |||
| 366 | unsigned int irq; | 361 | unsigned int irq; |
| 367 | struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */ | 362 | struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */ |
| 368 | 363 | ||
| 369 | bool match_driver; /* Skip attaching driver */ | 364 | bool match_driver; /* Skip attaching driver */ |
| 370 | /* These fields are used by common fixups */ | 365 | |
| 371 | unsigned int transparent:1; /* Subtractive decode PCI bridge */ | 366 | unsigned int transparent:1; /* Subtractive decode bridge */ |
| 372 | unsigned int multifunction:1;/* Part of multi-function device */ | 367 | unsigned int multifunction:1; /* Multi-function device */ |
| 373 | /* keep track of device state */ | 368 | |
| 374 | unsigned int is_added:1; | 369 | unsigned int is_added:1; |
| 375 | unsigned int is_busmaster:1; /* device is busmaster */ | 370 | unsigned int is_busmaster:1; /* Is busmaster */ |
| 376 | unsigned int no_msi:1; /* device may not use msi */ | 371 | unsigned int no_msi:1; /* May not use MSI */ |
| 377 | unsigned int no_64bit_msi:1; /* device may only use 32-bit MSIs */ | 372 | unsigned int no_64bit_msi:1; /* May only use 32-bit MSIs */ |
| 378 | unsigned int block_cfg_access:1; /* config space access is blocked */ | 373 | unsigned int block_cfg_access:1; /* Config space access blocked */ |
| 379 | unsigned int broken_parity_status:1; /* Device generates false positive parity */ | 374 | unsigned int broken_parity_status:1; /* Generates false positive parity */ |
| 380 | unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */ | 375 | unsigned int irq_reroute_variant:2; /* Needs IRQ rerouting variant */ |
| 381 | unsigned int msi_enabled:1; | 376 | unsigned int msi_enabled:1; |
| 382 | unsigned int msix_enabled:1; | 377 | unsigned int msix_enabled:1; |
| 383 | unsigned int ari_enabled:1; /* ARI forwarding */ | 378 | unsigned int ari_enabled:1; /* ARI forwarding */ |
| 384 | unsigned int ats_enabled:1; /* Address Translation Service */ | 379 | unsigned int ats_enabled:1; /* Address Translation Svc */ |
| 385 | unsigned int pasid_enabled:1; /* Process Address Space ID */ | 380 | unsigned int pasid_enabled:1; /* Process Address Space ID */ |
| 386 | unsigned int pri_enabled:1; /* Page Request Interface */ | 381 | unsigned int pri_enabled:1; /* Page Request Interface */ |
| 387 | unsigned int is_managed:1; | 382 | unsigned int is_managed:1; |
| 388 | unsigned int needs_freset:1; /* Dev requires fundamental reset */ | 383 | unsigned int needs_freset:1; /* Requires fundamental reset */ |
| 389 | unsigned int state_saved:1; | 384 | unsigned int state_saved:1; |
| 390 | unsigned int is_physfn:1; | 385 | unsigned int is_physfn:1; |
| 391 | unsigned int is_virtfn:1; | 386 | unsigned int is_virtfn:1; |
| 392 | unsigned int reset_fn:1; | 387 | unsigned int reset_fn:1; |
| 393 | unsigned int is_hotplug_bridge:1; | 388 | unsigned int is_hotplug_bridge:1; |
| 394 | unsigned int is_thunderbolt:1; /* Thunderbolt controller */ | 389 | unsigned int is_thunderbolt:1; /* Thunderbolt controller */ |
| 395 | unsigned int __aer_firmware_first_valid:1; | 390 | unsigned int __aer_firmware_first_valid:1; |
| 396 | unsigned int __aer_firmware_first:1; | 391 | unsigned int __aer_firmware_first:1; |
| 397 | unsigned int broken_intx_masking:1; /* INTx masking can't be used */ | 392 | unsigned int broken_intx_masking:1; /* INTx masking can't be used */ |
| 398 | unsigned int io_window_1k:1; /* Intel P2P bridge 1K I/O windows */ | 393 | unsigned int io_window_1k:1; /* Intel bridge 1K I/O windows */ |
| 399 | unsigned int irq_managed:1; | 394 | unsigned int irq_managed:1; |
| 400 | unsigned int has_secondary_link:1; | 395 | unsigned int has_secondary_link:1; |
| 401 | unsigned int non_compliant_bars:1; /* broken BARs; ignore them */ | 396 | unsigned int non_compliant_bars:1; /* Broken BARs; ignore them */ |
| 402 | unsigned int is_probed:1; /* device probing in progress */ | 397 | unsigned int is_probed:1; /* Device probing in progress */ |
| 403 | pci_dev_flags_t dev_flags; | 398 | pci_dev_flags_t dev_flags; |
| 404 | atomic_t enable_cnt; /* pci_enable_device has been called */ | 399 | atomic_t enable_cnt; /* pci_enable_device has been called */ |
| 405 | 400 | ||
| 406 | u32 saved_config_space[16]; /* config space saved at suspend time */ | 401 | u32 saved_config_space[16]; /* Config space saved at suspend time */ |
| 407 | struct hlist_head saved_cap_space; | 402 | struct hlist_head saved_cap_space; |
| 408 | struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */ | 403 | struct bin_attribute *rom_attr; /* Attribute descriptor for sysfs ROM entry */ |
| 409 | int rom_attr_enabled; /* has display of the rom attribute been enabled? */ | 404 | int rom_attr_enabled; /* Display of ROM attribute enabled? */ |
| 410 | struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */ | 405 | struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */ |
| 411 | struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; /* sysfs file for WC mapping of resources */ | 406 | struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; /* sysfs file for WC mapping of resources */ |
| 412 | 407 | ||
| @@ -421,12 +416,12 @@ struct pci_dev { | |||
| 421 | struct pci_vpd *vpd; | 416 | struct pci_vpd *vpd; |
| 422 | #ifdef CONFIG_PCI_ATS | 417 | #ifdef CONFIG_PCI_ATS |
| 423 | union { | 418 | union { |
| 424 | struct pci_sriov *sriov; /* SR-IOV capability related */ | 419 | struct pci_sriov *sriov; /* PF: SR-IOV info */ |
| 425 | struct pci_dev *physfn; /* the PF this VF is associated with */ | 420 | struct pci_dev *physfn; /* VF: related PF */ |
| 426 | }; | 421 | }; |
| 427 | u16 ats_cap; /* ATS Capability offset */ | 422 | u16 ats_cap; /* ATS Capability offset */ |
| 428 | u8 ats_stu; /* ATS Smallest Translation Unit */ | 423 | u8 ats_stu; /* ATS Smallest Translation Unit */ |
| 429 | atomic_t ats_ref_cnt; /* number of VFs with ATS enabled */ | 424 | atomic_t ats_ref_cnt; /* Number of VFs with ATS enabled */ |
| 430 | #endif | 425 | #endif |
| 431 | #ifdef CONFIG_PCI_PRI | 426 | #ifdef CONFIG_PCI_PRI |
| 432 | u32 pri_reqs_alloc; /* Number of PRI requests allocated */ | 427 | u32 pri_reqs_alloc; /* Number of PRI requests allocated */ |
| @@ -434,11 +429,11 @@ struct pci_dev { | |||
| 434 | #ifdef CONFIG_PCI_PASID | 429 | #ifdef CONFIG_PCI_PASID |
| 435 | u16 pasid_features; | 430 | u16 pasid_features; |
| 436 | #endif | 431 | #endif |
| 437 | phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */ | 432 | phys_addr_t rom; /* Physical address if not from BAR */ |
| 438 | size_t romlen; /* Length of ROM if it's not from the BAR */ | 433 | size_t romlen; /* Length if not from BAR */ |
| 439 | char *driver_override; /* Driver name to force a match */ | 434 | char *driver_override; /* Driver name to force a match */ |
| 440 | 435 | ||
| 441 | unsigned long priv_flags; /* Private flags for the pci driver */ | 436 | unsigned long priv_flags; /* Private flags for the PCI driver */ |
| 442 | }; | 437 | }; |
| 443 | 438 | ||
| 444 | static inline struct pci_dev *pci_physfn(struct pci_dev *dev) | 439 | static inline struct pci_dev *pci_physfn(struct pci_dev *dev) |
| @@ -461,26 +456,26 @@ static inline int pci_channel_offline(struct pci_dev *pdev) | |||
| 461 | } | 456 | } |
| 462 | 457 | ||
| 463 | struct pci_host_bridge { | 458 | struct pci_host_bridge { |
| 464 | struct device dev; | 459 | struct device dev; |
| 465 | struct pci_bus *bus; /* root bus */ | 460 | struct pci_bus *bus; /* Root bus */ |
| 466 | struct pci_ops *ops; | 461 | struct pci_ops *ops; |
| 467 | void *sysdata; | 462 | void *sysdata; |
| 468 | int busnr; | 463 | int busnr; |
| 469 | struct list_head windows; /* resource_entry */ | 464 | struct list_head windows; /* resource_entry */ |
| 470 | u8 (*swizzle_irq)(struct pci_dev *, u8 *); /* platform IRQ swizzler */ | 465 | u8 (*swizzle_irq)(struct pci_dev *, u8 *); /* Platform IRQ swizzler */ |
| 471 | int (*map_irq)(const struct pci_dev *, u8, u8); | 466 | int (*map_irq)(const struct pci_dev *, u8, u8); |
| 472 | void (*release_fn)(struct pci_host_bridge *); | 467 | void (*release_fn)(struct pci_host_bridge *); |
| 473 | void *release_data; | 468 | void *release_data; |
| 474 | struct msi_controller *msi; | 469 | struct msi_controller *msi; |
| 475 | unsigned int ignore_reset_delay:1; /* for entire hierarchy */ | 470 | unsigned int ignore_reset_delay:1; /* For entire hierarchy */ |
| 476 | unsigned int no_ext_tags:1; /* no Extended Tags */ | 471 | unsigned int no_ext_tags:1; /* No Extended Tags */ |
| 477 | /* Resource alignment requirements */ | 472 | /* Resource alignment requirements */ |
| 478 | resource_size_t (*align_resource)(struct pci_dev *dev, | 473 | resource_size_t (*align_resource)(struct pci_dev *dev, |
| 479 | const struct resource *res, | 474 | const struct resource *res, |
| 480 | resource_size_t start, | 475 | resource_size_t start, |
| 481 | resource_size_t size, | 476 | resource_size_t size, |
| 482 | resource_size_t align); | 477 | resource_size_t align); |
| 483 | unsigned long private[0] ____cacheline_aligned; | 478 | unsigned long private[0] ____cacheline_aligned; |
| 484 | }; | 479 | }; |
| 485 | 480 | ||
| 486 | #define to_pci_host_bridge(n) container_of(n, struct pci_host_bridge, dev) | 481 | #define to_pci_host_bridge(n) container_of(n, struct pci_host_bridge, dev) |
| @@ -502,8 +497,8 @@ void pci_free_host_bridge(struct pci_host_bridge *bridge); | |||
| 502 | struct pci_host_bridge *pci_find_host_bridge(struct pci_bus *bus); | 497 | struct pci_host_bridge *pci_find_host_bridge(struct pci_bus *bus); |
| 503 | 498 | ||
| 504 | void pci_set_host_bridge_release(struct pci_host_bridge *bridge, | 499 | void pci_set_host_bridge_release(struct pci_host_bridge *bridge, |
| 505 | void (*release_fn)(struct pci_host_bridge *), | 500 | void (*release_fn)(struct pci_host_bridge *), |
| 506 | void *release_data); | 501 | void *release_data); |
| 507 | 502 | ||
| 508 | int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge); | 503 | int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge); |
| 509 | 504 | ||
| @@ -523,32 +518,32 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge); | |||
| 523 | #define PCI_SUBTRACTIVE_DECODE 0x1 | 518 | #define PCI_SUBTRACTIVE_DECODE 0x1 |
| 524 | 519 | ||
| 525 | struct pci_bus_resource { | 520 | struct pci_bus_resource { |
| 526 | struct list_head list; | 521 | struct list_head list; |
| 527 | struct resource *res; | 522 | struct resource *res; |
| 528 | unsigned int flags; | 523 | unsigned int flags; |
| 529 | }; | 524 | }; |
| 530 | 525 | ||
| 531 | #define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ | 526 | #define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ |
| 532 | 527 | ||
| 533 | struct pci_bus { | 528 | struct pci_bus { |
| 534 | struct list_head node; /* node in list of buses */ | 529 | struct list_head node; /* Node in list of buses */ |
| 535 | struct pci_bus *parent; /* parent bus this bridge is on */ | 530 | struct pci_bus *parent; /* Parent bus this bridge is on */ |
| 536 | struct list_head children; /* list of child buses */ | 531 | struct list_head children; /* List of child buses */ |
| 537 | struct list_head devices; /* list of devices on this bus */ | 532 | struct list_head devices; /* List of devices on this bus */ |
| 538 | struct pci_dev *self; /* bridge device as seen by parent */ | 533 | struct pci_dev *self; /* Bridge device as seen by parent */ |
| 539 | struct list_head slots; /* list of slots on this bus; | 534 | struct list_head slots; /* List of slots on this bus; |
| 540 | protected by pci_slot_mutex */ | 535 | protected by pci_slot_mutex */ |
| 541 | struct resource *resource[PCI_BRIDGE_RESOURCE_NUM]; | 536 | struct resource *resource[PCI_BRIDGE_RESOURCE_NUM]; |
| 542 | struct list_head resources; /* address space routed to this bus */ | 537 | struct list_head resources; /* Address space routed to this bus */ |
| 543 | struct resource busn_res; /* bus numbers routed to this bus */ | 538 | struct resource busn_res; /* Bus numbers routed to this bus */ |
| 544 | 539 | ||
| 545 | struct pci_ops *ops; /* configuration access functions */ | 540 | struct pci_ops *ops; /* Configuration access functions */ |
| 546 | struct msi_controller *msi; /* MSI controller */ | 541 | struct msi_controller *msi; /* MSI controller */ |
| 547 | void *sysdata; /* hook for sys-specific extension */ | 542 | void *sysdata; /* Hook for sys-specific extension */ |
| 548 | struct proc_dir_entry *procdir; /* directory entry in /proc/bus/pci */ | 543 | struct proc_dir_entry *procdir; /* Directory entry in /proc/bus/pci */ |
| 549 | 544 | ||
| 550 | unsigned char number; /* bus number */ | 545 | unsigned char number; /* Bus number */ |
| 551 | unsigned char primary; /* number of primary bridge */ | 546 | unsigned char primary; /* Number of primary bridge */ |
| 552 | unsigned char max_bus_speed; /* enum pci_bus_speed */ | 547 | unsigned char max_bus_speed; /* enum pci_bus_speed */ |
| 553 | unsigned char cur_bus_speed; /* enum pci_bus_speed */ | 548 | unsigned char cur_bus_speed; /* enum pci_bus_speed */ |
| 554 | #ifdef CONFIG_PCI_DOMAINS_GENERIC | 549 | #ifdef CONFIG_PCI_DOMAINS_GENERIC |
| @@ -557,12 +552,12 @@ struct pci_bus { | |||
| 557 | 552 | ||
| 558 | char name[48]; | 553 | char name[48]; |
| 559 | 554 | ||
| 560 | unsigned short bridge_ctl; /* manage NO_ISA/FBB/et al behaviors */ | 555 | unsigned short bridge_ctl; /* Manage NO_ISA/FBB/et al behaviors */ |
| 561 | pci_bus_flags_t bus_flags; /* inherited by child buses */ | 556 | pci_bus_flags_t bus_flags; /* Inherited by child buses */ |
| 562 | struct device *bridge; | 557 | struct device *bridge; |
| 563 | struct device dev; | 558 | struct device dev; |
| 564 | struct bin_attribute *legacy_io; /* legacy I/O for this bus */ | 559 | struct bin_attribute *legacy_io; /* Legacy I/O for this bus */ |
| 565 | struct bin_attribute *legacy_mem; /* legacy mem */ | 560 | struct bin_attribute *legacy_mem; /* Legacy mem */ |
| 566 | unsigned int is_added:1; | 561 | unsigned int is_added:1; |
| 567 | }; | 562 | }; |
| 568 | 563 | ||
| @@ -619,9 +614,7 @@ static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) | |||
| 619 | static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) { return false; } | 614 | static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) { return false; } |
| 620 | #endif | 615 | #endif |
| 621 | 616 | ||
| 622 | /* | 617 | /* Error values that may be returned by PCI functions */ |
| 623 | * Error values that may be returned by PCI functions. | ||
| 624 | */ | ||
| 625 | #define PCIBIOS_SUCCESSFUL 0x00 | 618 | #define PCIBIOS_SUCCESSFUL 0x00 |
| 626 | #define PCIBIOS_FUNC_NOT_SUPPORTED 0x81 | 619 | #define PCIBIOS_FUNC_NOT_SUPPORTED 0x81 |
| 627 | #define PCIBIOS_BAD_VENDOR_ID 0x83 | 620 | #define PCIBIOS_BAD_VENDOR_ID 0x83 |
| @@ -630,9 +623,7 @@ static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) { return false; | |||
| 630 | #define PCIBIOS_SET_FAILED 0x88 | 623 | #define PCIBIOS_SET_FAILED 0x88 |
| 631 | #define PCIBIOS_BUFFER_TOO_SMALL 0x89 | 624 | #define PCIBIOS_BUFFER_TOO_SMALL 0x89 |
| 632 | 625 | ||
| 633 | /* | 626 | /* Translate above to generic errno for passing back through non-PCI code */ |
| 634 | * Translate above to generic errno for passing back through non-PCI code. | ||
| 635 | */ | ||
| 636 | static inline int pcibios_err_to_errno(int err) | 627 | static inline int pcibios_err_to_errno(int err) |
| 637 | { | 628 | { |
| 638 | if (err <= PCIBIOS_SUCCESSFUL) | 629 | if (err <= PCIBIOS_SUCCESSFUL) |
| @@ -682,13 +673,13 @@ typedef u32 pci_bus_addr_t; | |||
| 682 | #endif | 673 | #endif |
| 683 | 674 | ||
| 684 | struct pci_bus_region { | 675 | struct pci_bus_region { |
| 685 | pci_bus_addr_t start; | 676 | pci_bus_addr_t start; |
| 686 | pci_bus_addr_t end; | 677 | pci_bus_addr_t end; |
| 687 | }; | 678 | }; |
| 688 | 679 | ||
| 689 | struct pci_dynids { | 680 | struct pci_dynids { |
| 690 | spinlock_t lock; /* protects list, index */ | 681 | spinlock_t lock; /* Protects list, index */ |
| 691 | struct list_head list; /* for IDs added at runtime */ | 682 | struct list_head list; /* For IDs added at runtime */ |
| 692 | }; | 683 | }; |
| 693 | 684 | ||
| 694 | 685 | ||
| @@ -702,13 +693,13 @@ struct pci_dynids { | |||
| 702 | typedef unsigned int __bitwise pci_ers_result_t; | 693 | typedef unsigned int __bitwise pci_ers_result_t; |
| 703 | 694 | ||
| 704 | enum pci_ers_result { | 695 | enum pci_ers_result { |
| 705 | /* no result/none/not supported in device driver */ | 696 | /* No result/none/not supported in device driver */ |
| 706 | PCI_ERS_RESULT_NONE = (__force pci_ers_result_t) 1, | 697 | PCI_ERS_RESULT_NONE = (__force pci_ers_result_t) 1, |
| 707 | 698 | ||
| 708 | /* Device driver can recover without slot reset */ | 699 | /* Device driver can recover without slot reset */ |
| 709 | PCI_ERS_RESULT_CAN_RECOVER = (__force pci_ers_result_t) 2, | 700 | PCI_ERS_RESULT_CAN_RECOVER = (__force pci_ers_result_t) 2, |
| 710 | 701 | ||
| 711 | /* Device driver wants slot to be reset. */ | 702 | /* Device driver wants slot to be reset */ |
| 712 | PCI_ERS_RESULT_NEED_RESET = (__force pci_ers_result_t) 3, | 703 | PCI_ERS_RESULT_NEED_RESET = (__force pci_ers_result_t) 3, |
| 713 | 704 | ||
| 714 | /* Device has completely failed, is unrecoverable */ | 705 | /* Device has completely failed, is unrecoverable */ |
| @@ -744,27 +735,27 @@ struct pci_error_handlers { | |||
| 744 | 735 | ||
| 745 | struct module; | 736 | struct module; |
| 746 | struct pci_driver { | 737 | struct pci_driver { |
| 747 | struct list_head node; | 738 | struct list_head node; |
| 748 | const char *name; | 739 | const char *name; |
| 749 | const struct pci_device_id *id_table; /* must be non-NULL for probe to be called */ | 740 | const struct pci_device_id *id_table; /* Must be non-NULL for probe to be called */ |
| 750 | int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */ | 741 | int (*probe)(struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */ |
| 751 | void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ | 742 | void (*remove)(struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ |
| 752 | int (*suspend) (struct pci_dev *dev, pm_message_t state); /* Device suspended */ | 743 | int (*suspend)(struct pci_dev *dev, pm_message_t state); /* Device suspended */ |
| 753 | int (*suspend_late) (struct pci_dev *dev, pm_message_t state); | 744 | int (*suspend_late)(struct pci_dev *dev, pm_message_t state); |
| 754 | int (*resume_early) (struct pci_dev *dev); | 745 | int (*resume_early)(struct pci_dev *dev); |
| 755 | int (*resume) (struct pci_dev *dev); /* Device woken up */ | 746 | int (*resume) (struct pci_dev *dev); /* Device woken up */ |
| 756 | void (*shutdown) (struct pci_dev *dev); | 747 | void (*shutdown) (struct pci_dev *dev); |
| 757 | int (*sriov_configure) (struct pci_dev *dev, int num_vfs); /* PF pdev */ | 748 | int (*sriov_configure) (struct pci_dev *dev, int num_vfs); /* On PF */ |
| 758 | const struct pci_error_handlers *err_handler; | 749 | const struct pci_error_handlers *err_handler; |
| 759 | const struct attribute_group **groups; | 750 | const struct attribute_group **groups; |
| 760 | struct device_driver driver; | 751 | struct device_driver driver; |
| 761 | struct pci_dynids dynids; | 752 | struct pci_dynids dynids; |
| 762 | }; | 753 | }; |
| 763 | 754 | ||
| 764 | #define to_pci_driver(drv) container_of(drv, struct pci_driver, driver) | 755 | #define to_pci_driver(drv) container_of(drv, struct pci_driver, driver) |
| 765 | 756 | ||
| 766 | /** | 757 | /** |
| 767 | * PCI_DEVICE - macro used to describe a specific pci device | 758 | * PCI_DEVICE - macro used to describe a specific PCI device |
| 768 | * @vend: the 16 bit PCI Vendor ID | 759 | * @vend: the 16 bit PCI Vendor ID |
| 769 | * @dev: the 16 bit PCI Device ID | 760 | * @dev: the 16 bit PCI Device ID |
| 770 | * | 761 | * |
| @@ -777,7 +768,7 @@ struct pci_driver { | |||
| 777 | .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID | 768 | .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID |
| 778 | 769 | ||
| 779 | /** | 770 | /** |
| 780 | * PCI_DEVICE_SUB - macro used to describe a specific pci device with subsystem | 771 | * PCI_DEVICE_SUB - macro used to describe a specific PCI device with subsystem |
| 781 | * @vend: the 16 bit PCI Vendor ID | 772 | * @vend: the 16 bit PCI Vendor ID |
| 782 | * @dev: the 16 bit PCI Device ID | 773 | * @dev: the 16 bit PCI Device ID |
| 783 | * @subvend: the 16 bit PCI Subvendor ID | 774 | * @subvend: the 16 bit PCI Subvendor ID |
| @@ -791,7 +782,7 @@ struct pci_driver { | |||
| 791 | .subvendor = (subvend), .subdevice = (subdev) | 782 | .subvendor = (subvend), .subdevice = (subdev) |
| 792 | 783 | ||
| 793 | /** | 784 | /** |
| 794 | * PCI_DEVICE_CLASS - macro used to describe a specific pci device class | 785 | * PCI_DEVICE_CLASS - macro used to describe a specific PCI device class |
| 795 | * @dev_class: the class, subclass, prog-if triple for this device | 786 | * @dev_class: the class, subclass, prog-if triple for this device |
| 796 | * @dev_class_mask: the class mask for this device | 787 | * @dev_class_mask: the class mask for this device |
| 797 | * | 788 | * |
| @@ -805,7 +796,7 @@ struct pci_driver { | |||
| 805 | .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID | 796 | .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID |
| 806 | 797 | ||
| 807 | /** | 798 | /** |
| 808 | * PCI_VDEVICE - macro used to describe a specific pci device in short form | 799 | * PCI_VDEVICE - macro used to describe a specific PCI device in short form |
| 809 | * @vend: the vendor name | 800 | * @vend: the vendor name |
| 810 | * @dev: the 16 bit PCI Device ID | 801 | * @dev: the 16 bit PCI Device ID |
| 811 | * | 802 | * |
| @@ -814,22 +805,21 @@ struct pci_driver { | |||
| 814 | * to PCI_ANY_ID. The macro allows the next field to follow as the device | 805 | * to PCI_ANY_ID. The macro allows the next field to follow as the device |
| 815 | * private data. | 806 | * private data. |
| 816 | */ | 807 | */ |
| 817 | |||
| 818 | #define PCI_VDEVICE(vend, dev) \ | 808 | #define PCI_VDEVICE(vend, dev) \ |
| 819 | .vendor = PCI_VENDOR_ID_##vend, .device = (dev), \ | 809 | .vendor = PCI_VENDOR_ID_##vend, .device = (dev), \ |
| 820 | .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0 | 810 | .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0 |
| 821 | 811 | ||
| 822 | enum { | 812 | enum { |
| 823 | PCI_REASSIGN_ALL_RSRC = 0x00000001, /* ignore firmware setup */ | 813 | PCI_REASSIGN_ALL_RSRC = 0x00000001, /* Ignore firmware setup */ |
| 824 | PCI_REASSIGN_ALL_BUS = 0x00000002, /* reassign all bus numbers */ | 814 | PCI_REASSIGN_ALL_BUS = 0x00000002, /* Reassign all bus numbers */ |
| 825 | PCI_PROBE_ONLY = 0x00000004, /* use existing setup */ | 815 | PCI_PROBE_ONLY = 0x00000004, /* Use existing setup */ |
| 826 | PCI_CAN_SKIP_ISA_ALIGN = 0x00000008, /* don't do ISA alignment */ | 816 | PCI_CAN_SKIP_ISA_ALIGN = 0x00000008, /* Don't do ISA alignment */ |
| 827 | PCI_ENABLE_PROC_DOMAINS = 0x00000010, /* enable domains in /proc */ | 817 | PCI_ENABLE_PROC_DOMAINS = 0x00000010, /* Enable domains in /proc */ |
| 828 | PCI_COMPAT_DOMAIN_0 = 0x00000020, /* ... except domain 0 */ | 818 | PCI_COMPAT_DOMAIN_0 = 0x00000020, /* ... except domain 0 */ |
| 829 | PCI_SCAN_ALL_PCIE_DEVS = 0x00000040, /* scan all, not just dev 0 */ | 819 | PCI_SCAN_ALL_PCIE_DEVS = 0x00000040, /* Scan all, not just dev 0 */ |
| 830 | }; | 820 | }; |
| 831 | 821 | ||
| 832 | /* these external functions are only available when PCI support is enabled */ | 822 | /* These external functions are only available when PCI support is enabled */ |
| 833 | #ifdef CONFIG_PCI | 823 | #ifdef CONFIG_PCI |
| 834 | 824 | ||
| 835 | extern unsigned int pci_flags; | 825 | extern unsigned int pci_flags; |
| @@ -842,11 +832,11 @@ static inline int pci_has_flag(int flag) { return pci_flags & flag; } | |||
| 842 | void pcie_bus_configure_settings(struct pci_bus *bus); | 832 | void pcie_bus_configure_settings(struct pci_bus *bus); |
| 843 | 833 | ||
| 844 | enum pcie_bus_config_types { | 834 | enum pcie_bus_config_types { |
| 845 | PCIE_BUS_TUNE_OFF, /* don't touch MPS at all */ | 835 | PCIE_BUS_TUNE_OFF, /* Don't touch MPS at all */ |
| 846 | PCIE_BUS_DEFAULT, /* ensure MPS matches upstream bridge */ | 836 | PCIE_BUS_DEFAULT, /* Ensure MPS matches upstream bridge */ |
| 847 | PCIE_BUS_SAFE, /* use largest MPS boot-time devices support */ | 837 | PCIE_BUS_SAFE, /* Use largest MPS boot-time devices support */ |
| 848 | PCIE_BUS_PERFORMANCE, /* use MPS and MRRS for best performance */ | 838 | PCIE_BUS_PERFORMANCE, /* Use MPS and MRRS for best performance */ |
| 849 | PCIE_BUS_PEER2PEER, /* set MPS = 128 for all devices */ | 839 | PCIE_BUS_PEER2PEER, /* Set MPS = 128 for all devices */ |
| 850 | }; | 840 | }; |
| 851 | 841 | ||
| 852 | extern enum pcie_bus_config_types pcie_bus_config; | 842 | extern enum pcie_bus_config_types pcie_bus_config; |
| @@ -855,7 +845,7 @@ extern struct bus_type pci_bus_type; | |||
| 855 | 845 | ||
| 856 | /* Do NOT directly access these two variables, unless you are arch-specific PCI | 846 | /* Do NOT directly access these two variables, unless you are arch-specific PCI |
| 857 | * code, or PCI core code. */ | 847 | * code, or PCI core code. */ |
| 858 | extern struct list_head pci_root_buses; /* list of all known PCI buses */ | 848 | extern struct list_head pci_root_buses; /* List of all known PCI buses */ |
| 859 | /* Some device drivers need know if PCI is initiated */ | 849 | /* Some device drivers need know if PCI is initiated */ |
| 860 | int no_pci_devices(void); | 850 | int no_pci_devices(void); |
| 861 | 851 | ||
| @@ -893,8 +883,8 @@ int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax); | |||
| 893 | int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax); | 883 | int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax); |
| 894 | void pci_bus_release_busn_res(struct pci_bus *b); | 884 | void pci_bus_release_busn_res(struct pci_bus *b); |
| 895 | struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, | 885 | struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, |
| 896 | struct pci_ops *ops, void *sysdata, | 886 | struct pci_ops *ops, void *sysdata, |
| 897 | struct list_head *resources); | 887 | struct list_head *resources); |
| 898 | int pci_scan_root_bus_bridge(struct pci_host_bridge *bridge); | 888 | int pci_scan_root_bus_bridge(struct pci_host_bridge *bridge); |
| 899 | struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, | 889 | struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, |
| 900 | int busnr); | 890 | int busnr); |
| @@ -951,10 +941,10 @@ int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap); | |||
| 951 | struct pci_bus *pci_find_next_bus(const struct pci_bus *from); | 941 | struct pci_bus *pci_find_next_bus(const struct pci_bus *from); |
| 952 | 942 | ||
| 953 | struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, | 943 | struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, |
| 954 | struct pci_dev *from); | 944 | struct pci_dev *from); |
| 955 | struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, | 945 | struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, |
| 956 | unsigned int ss_vendor, unsigned int ss_device, | 946 | unsigned int ss_vendor, unsigned int ss_device, |
| 957 | struct pci_dev *from); | 947 | struct pci_dev *from); |
| 958 | struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); | 948 | struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); |
| 959 | struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus, | 949 | struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus, |
| 960 | unsigned int devfn); | 950 | unsigned int devfn); |
| @@ -1030,7 +1020,7 @@ static inline int pcie_capability_clear_dword(struct pci_dev *dev, int pos, | |||
| 1030 | return pcie_capability_clear_and_set_dword(dev, pos, clear, 0); | 1020 | return pcie_capability_clear_and_set_dword(dev, pos, clear, 0); |
| 1031 | } | 1021 | } |
| 1032 | 1022 | ||
| 1033 | /* user-space driven config access */ | 1023 | /* User-space driven config access */ |
| 1034 | int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val); | 1024 | int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val); |
| 1035 | int pci_user_read_config_word(struct pci_dev *dev, int where, u16 *val); | 1025 | int pci_user_read_config_word(struct pci_dev *dev, int where, u16 *val); |
| 1036 | int pci_user_read_config_dword(struct pci_dev *dev, int where, u32 *val); | 1026 | int pci_user_read_config_dword(struct pci_dev *dev, int where, u32 *val); |
| @@ -1172,7 +1162,7 @@ unsigned int pci_rescan_bus(struct pci_bus *bus); | |||
| 1172 | void pci_lock_rescan_remove(void); | 1162 | void pci_lock_rescan_remove(void); |
| 1173 | void pci_unlock_rescan_remove(void); | 1163 | void pci_unlock_rescan_remove(void); |
| 1174 | 1164 | ||
| 1175 | /* Vital product data routines */ | 1165 | /* Vital Product Data routines */ |
| 1176 | ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf); | 1166 | ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf); |
| 1177 | ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void *buf); | 1167 | ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void *buf); |
| 1178 | int pci_set_vpd_size(struct pci_dev *dev, size_t len); | 1168 | int pci_set_vpd_size(struct pci_dev *dev, size_t len); |
| @@ -1257,9 +1247,7 @@ static inline pci_bus_addr_t pci_bus_address(struct pci_dev *pdev, int bar) | |||
| 1257 | int __must_check __pci_register_driver(struct pci_driver *, struct module *, | 1247 | int __must_check __pci_register_driver(struct pci_driver *, struct module *, |
| 1258 | const char *mod_name); | 1248 | const char *mod_name); |
| 1259 | 1249 | ||
| 1260 | /* | 1250 | /* pci_register_driver() must be a macro so KBUILD_MODNAME can be expanded */ |
| 1261 | * pci_register_driver must be a macro so that KBUILD_MODNAME can be expanded | ||
| 1262 | */ | ||
| 1263 | #define pci_register_driver(driver) \ | 1251 | #define pci_register_driver(driver) \ |
| 1264 | __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) | 1252 | __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) |
| 1265 | 1253 | ||
| @@ -1274,8 +1262,7 @@ void pci_unregister_driver(struct pci_driver *dev); | |||
| 1274 | * use this macro once, and calling it replaces module_init() and module_exit() | 1262 | * use this macro once, and calling it replaces module_init() and module_exit() |
| 1275 | */ | 1263 | */ |
| 1276 | #define module_pci_driver(__pci_driver) \ | 1264 | #define module_pci_driver(__pci_driver) \ |
| 1277 | module_driver(__pci_driver, pci_register_driver, \ | 1265 | module_driver(__pci_driver, pci_register_driver, pci_unregister_driver) |
| 1278 | pci_unregister_driver) | ||
| 1279 | 1266 | ||
| 1280 | /** | 1267 | /** |
| 1281 | * builtin_pci_driver() - Helper macro for registering a PCI driver | 1268 | * builtin_pci_driver() - Helper macro for registering a PCI driver |
| @@ -1314,10 +1301,10 @@ resource_size_t pcibios_iov_resource_alignment(struct pci_dev *dev, int resno); | |||
| 1314 | int pci_set_vga_state(struct pci_dev *pdev, bool decode, | 1301 | int pci_set_vga_state(struct pci_dev *pdev, bool decode, |
| 1315 | unsigned int command_bits, u32 flags); | 1302 | unsigned int command_bits, u32 flags); |
| 1316 | 1303 | ||
| 1317 | #define PCI_IRQ_LEGACY (1 << 0) /* allow legacy interrupts */ | 1304 | #define PCI_IRQ_LEGACY (1 << 0) /* Allow legacy interrupts */ |
| 1318 | #define PCI_IRQ_MSI (1 << 1) /* allow MSI interrupts */ | 1305 | #define PCI_IRQ_MSI (1 << 1) /* Allow MSI interrupts */ |
| 1319 | #define PCI_IRQ_MSIX (1 << 2) /* allow MSI-X interrupts */ | 1306 | #define PCI_IRQ_MSIX (1 << 2) /* Allow MSI-X interrupts */ |
| 1320 | #define PCI_IRQ_AFFINITY (1 << 3) /* auto-assign affinity */ | 1307 | #define PCI_IRQ_AFFINITY (1 << 3) /* Auto-assign affinity */ |
| 1321 | #define PCI_IRQ_ALL_TYPES \ | 1308 | #define PCI_IRQ_ALL_TYPES \ |
| 1322 | (PCI_IRQ_LEGACY | PCI_IRQ_MSI | PCI_IRQ_MSIX) | 1309 | (PCI_IRQ_LEGACY | PCI_IRQ_MSI | PCI_IRQ_MSIX) |
| 1323 | 1310 | ||
| @@ -1336,8 +1323,8 @@ int pci_set_vga_state(struct pci_dev *pdev, bool decode, | |||
| 1336 | #define pci_pool_free(pool, vaddr, addr) dma_pool_free(pool, vaddr, addr) | 1323 | #define pci_pool_free(pool, vaddr, addr) dma_pool_free(pool, vaddr, addr) |
| 1337 | 1324 | ||
| 1338 | struct msix_entry { | 1325 | struct msix_entry { |
| 1339 | u32 vector; /* kernel uses to write allocated vector */ | 1326 | u32 vector; /* Kernel uses to write allocated vector */ |
| 1340 | u16 entry; /* driver uses to specify entry, OS writes */ | 1327 | u16 entry; /* Driver uses to specify entry, OS writes */ |
| 1341 | }; | 1328 | }; |
| 1342 | 1329 | ||
| 1343 | #ifdef CONFIG_PCI_MSI | 1330 | #ifdef CONFIG_PCI_MSI |
| @@ -1377,10 +1364,10 @@ static inline int pci_msi_enabled(void) { return 0; } | |||
| 1377 | static inline int pci_enable_msi(struct pci_dev *dev) | 1364 | static inline int pci_enable_msi(struct pci_dev *dev) |
| 1378 | { return -ENOSYS; } | 1365 | { return -ENOSYS; } |
| 1379 | static inline int pci_enable_msix_range(struct pci_dev *dev, | 1366 | static inline int pci_enable_msix_range(struct pci_dev *dev, |
| 1380 | struct msix_entry *entries, int minvec, int maxvec) | 1367 | struct msix_entry *entries, int minvec, int maxvec) |
| 1381 | { return -ENOSYS; } | 1368 | { return -ENOSYS; } |
| 1382 | static inline int pci_enable_msix_exact(struct pci_dev *dev, | 1369 | static inline int pci_enable_msix_exact(struct pci_dev *dev, |
| 1383 | struct msix_entry *entries, int nvec) | 1370 | struct msix_entry *entries, int nvec) |
| 1384 | { return -ENOSYS; } | 1371 | { return -ENOSYS; } |
| 1385 | 1372 | ||
| 1386 | static inline int | 1373 | static inline int |
| @@ -1545,9 +1532,9 @@ static inline int acpi_pci_bus_find_domain_nr(struct pci_bus *bus) | |||
| 1545 | int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent); | 1532 | int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent); |
| 1546 | #endif | 1533 | #endif |
| 1547 | 1534 | ||
| 1548 | /* some architectures require additional setup to direct VGA traffic */ | 1535 | /* Some architectures require additional setup to direct VGA traffic */ |
| 1549 | typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode, | 1536 | typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode, |
| 1550 | unsigned int command_bits, u32 flags); | 1537 | unsigned int command_bits, u32 flags); |
| 1551 | void pci_register_set_vga_state(arch_set_vga_state_t func); | 1538 | void pci_register_set_vga_state(arch_set_vga_state_t func); |
| 1552 | 1539 | ||
| 1553 | static inline int | 1540 | static inline int |
| @@ -1586,10 +1573,9 @@ static inline void pci_clear_flags(int flags) { } | |||
| 1586 | static inline int pci_has_flag(int flag) { return 0; } | 1573 | static inline int pci_has_flag(int flag) { return 0; } |
| 1587 | 1574 | ||
| 1588 | /* | 1575 | /* |
| 1589 | * If the system does not have PCI, clearly these return errors. Define | 1576 | * If the system does not have PCI, clearly these return errors. Define |
| 1590 | * these as simple inline functions to avoid hair in drivers. | 1577 | * these as simple inline functions to avoid hair in drivers. |
| 1591 | */ | 1578 | */ |
| 1592 | |||
| 1593 | #define _PCI_NOP(o, s, t) \ | 1579 | #define _PCI_NOP(o, s, t) \ |
| 1594 | static inline int pci_##o##_config_##s(struct pci_dev *dev, \ | 1580 | static inline int pci_##o##_config_##s(struct pci_dev *dev, \ |
| 1595 | int where, t val) \ | 1581 | int where, t val) \ |
| @@ -1735,8 +1721,10 @@ int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct vm_area_struct *vma); | |||
| 1735 | #define pci_root_bus_fwnode(bus) NULL | 1721 | #define pci_root_bus_fwnode(bus) NULL |
| 1736 | #endif | 1722 | #endif |
| 1737 | 1723 | ||
| 1738 | /* these helpers provide future and backwards compatibility | 1724 | /* |
| 1739 | * for accessing popular PCI BAR info */ | 1725 | * These helpers provide future and backwards compatibility |
| 1726 | * for accessing popular PCI BAR info | ||
| 1727 | */ | ||
| 1740 | #define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start) | 1728 | #define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start) |
| 1741 | #define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end) | 1729 | #define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end) |
| 1742 | #define pci_resource_flags(dev, bar) ((dev)->resource[(bar)].flags) | 1730 | #define pci_resource_flags(dev, bar) ((dev)->resource[(bar)].flags) |
| @@ -1748,7 +1736,8 @@ int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct vm_area_struct *vma); | |||
| 1748 | (pci_resource_end((dev), (bar)) - \ | 1736 | (pci_resource_end((dev), (bar)) - \ |
| 1749 | pci_resource_start((dev), (bar)) + 1)) | 1737 | pci_resource_start((dev), (bar)) + 1)) |
| 1750 | 1738 | ||
| 1751 | /* Similar to the helpers above, these manipulate per-pci_dev | 1739 | /* |
| 1740 | * Similar to the helpers above, these manipulate per-pci_dev | ||
| 1752 | * driver-specific data. They are really just a wrapper around | 1741 | * driver-specific data. They are really just a wrapper around |
| 1753 | * the generic device structure functions of these calls. | 1742 | * the generic device structure functions of these calls. |
| 1754 | */ | 1743 | */ |
| @@ -1762,16 +1751,14 @@ static inline void pci_set_drvdata(struct pci_dev *pdev, void *data) | |||
| 1762 | dev_set_drvdata(&pdev->dev, data); | 1751 | dev_set_drvdata(&pdev->dev, data); |
| 1763 | } | 1752 | } |
| 1764 | 1753 | ||
| 1765 | /* If you want to know what to call your pci_dev, ask this function. | ||
| 1766 | * Again, it's a wrapper around the generic device. | ||
| 1767 | */ | ||
| 1768 | static inline const char *pci_name(const struct pci_dev *pdev) | 1754 | static inline const char *pci_name(const struct pci_dev *pdev) |
| 1769 | { | 1755 | { |
| 1770 | return dev_name(&pdev->dev); | 1756 | return dev_name(&pdev->dev); |
| 1771 | } | 1757 | } |
| 1772 | 1758 | ||
| 1773 | 1759 | ||
| 1774 | /* Some archs don't want to expose struct resource to userland as-is | 1760 | /* |
| 1761 | * Some archs don't want to expose struct resource to userland as-is | ||
| 1775 | * in sysfs and /proc | 1762 | * in sysfs and /proc |
| 1776 | */ | 1763 | */ |
| 1777 | #ifdef HAVE_ARCH_PCI_RESOURCE_TO_USER | 1764 | #ifdef HAVE_ARCH_PCI_RESOURCE_TO_USER |
| @@ -1790,16 +1777,16 @@ static inline void pci_resource_to_user(const struct pci_dev *dev, int bar, | |||
| 1790 | 1777 | ||
| 1791 | 1778 | ||
| 1792 | /* | 1779 | /* |
| 1793 | * The world is not perfect and supplies us with broken PCI devices. | 1780 | * The world is not perfect and supplies us with broken PCI devices. |
| 1794 | * For at least a part of these bugs we need a work-around, so both | 1781 | * For at least a part of these bugs we need a work-around, so both |
| 1795 | * generic (drivers/pci/quirks.c) and per-architecture code can define | 1782 | * generic (drivers/pci/quirks.c) and per-architecture code can define |
| 1796 | * fixup hooks to be called for particular buggy devices. | 1783 | * fixup hooks to be called for particular buggy devices. |
| 1797 | */ | 1784 | */ |
| 1798 | 1785 | ||
| 1799 | struct pci_fixup { | 1786 | struct pci_fixup { |
| 1800 | u16 vendor; /* You can use PCI_ANY_ID here of course */ | 1787 | u16 vendor; /* Or PCI_ANY_ID */ |
| 1801 | u16 device; /* You can use PCI_ANY_ID here of course */ | 1788 | u16 device; /* Or PCI_ANY_ID */ |
| 1802 | u32 class; /* You can use PCI_ANY_ID here too */ | 1789 | u32 class; /* Or PCI_ANY_ID */ |
| 1803 | unsigned int class_shift; /* should be 0, 8, 16 */ | 1790 | unsigned int class_shift; /* should be 0, 8, 16 */ |
| 1804 | void (*hook)(struct pci_dev *dev); | 1791 | void (*hook)(struct pci_dev *dev); |
| 1805 | }; | 1792 | }; |
| @@ -1841,23 +1828,19 @@ enum pci_fixup_pass { | |||
| 1841 | #define DECLARE_PCI_FIXUP_CLASS_RESUME(vendor, device, class, \ | 1828 | #define DECLARE_PCI_FIXUP_CLASS_RESUME(vendor, device, class, \ |
| 1842 | class_shift, hook) \ | 1829 | class_shift, hook) \ |
| 1843 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ | 1830 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ |
| 1844 | resume##hook, vendor, device, class, \ | 1831 | resume##hook, vendor, device, class, class_shift, hook) |
| 1845 | class_shift, hook) | ||
| 1846 | #define DECLARE_PCI_FIXUP_CLASS_RESUME_EARLY(vendor, device, class, \ | 1832 | #define DECLARE_PCI_FIXUP_CLASS_RESUME_EARLY(vendor, device, class, \ |
| 1847 | class_shift, hook) \ | 1833 | class_shift, hook) \ |
| 1848 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ | 1834 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ |
| 1849 | resume_early##hook, vendor, device, \ | 1835 | resume_early##hook, vendor, device, class, class_shift, hook) |
| 1850 | class, class_shift, hook) | ||
| 1851 | #define DECLARE_PCI_FIXUP_CLASS_SUSPEND(vendor, device, class, \ | 1836 | #define DECLARE_PCI_FIXUP_CLASS_SUSPEND(vendor, device, class, \ |
| 1852 | class_shift, hook) \ | 1837 | class_shift, hook) \ |
| 1853 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ | 1838 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ |
| 1854 | suspend##hook, vendor, device, class, \ | 1839 | suspend##hook, vendor, device, class, class_shift, hook) |
| 1855 | class_shift, hook) | ||
| 1856 | #define DECLARE_PCI_FIXUP_CLASS_SUSPEND_LATE(vendor, device, class, \ | 1840 | #define DECLARE_PCI_FIXUP_CLASS_SUSPEND_LATE(vendor, device, class, \ |
| 1857 | class_shift, hook) \ | 1841 | class_shift, hook) \ |
| 1858 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend_late, \ | 1842 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend_late, \ |
| 1859 | suspend_late##hook, vendor, device, \ | 1843 | suspend_late##hook, vendor, device, class, class_shift, hook) |
| 1860 | class, class_shift, hook) | ||
| 1861 | 1844 | ||
| 1862 | #define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ | 1845 | #define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ |
| 1863 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ | 1846 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ |
| @@ -1873,20 +1856,16 @@ enum pci_fixup_pass { | |||
| 1873 | hook, vendor, device, PCI_ANY_ID, 0, hook) | 1856 | hook, vendor, device, PCI_ANY_ID, 0, hook) |
| 1874 | #define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \ | 1857 | #define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \ |
| 1875 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ | 1858 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ |
| 1876 | resume##hook, vendor, device, \ | 1859 | resume##hook, vendor, device, PCI_ANY_ID, 0, hook) |
| 1877 | PCI_ANY_ID, 0, hook) | ||
| 1878 | #define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \ | 1860 | #define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \ |
| 1879 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ | 1861 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ |
| 1880 | resume_early##hook, vendor, device, \ | 1862 | resume_early##hook, vendor, device, PCI_ANY_ID, 0, hook) |
| 1881 | PCI_ANY_ID, 0, hook) | ||
| 1882 | #define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \ | 1863 | #define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \ |
| 1883 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ | 1864 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ |
| 1884 | suspend##hook, vendor, device, \ | 1865 | suspend##hook, vendor, device, PCI_ANY_ID, 0, hook) |
| 1885 | PCI_ANY_ID, 0, hook) | ||
| 1886 | #define DECLARE_PCI_FIXUP_SUSPEND_LATE(vendor, device, hook) \ | 1866 | #define DECLARE_PCI_FIXUP_SUSPEND_LATE(vendor, device, hook) \ |
| 1887 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend_late, \ | 1867 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend_late, \ |
| 1888 | suspend_late##hook, vendor, device, \ | 1868 | suspend_late##hook, vendor, device, PCI_ANY_ID, 0, hook) |
| 1889 | PCI_ANY_ID, 0, hook) | ||
| 1890 | 1869 | ||
| 1891 | #ifdef CONFIG_PCI_QUIRKS | 1870 | #ifdef CONFIG_PCI_QUIRKS |
| 1892 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); | 1871 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); |
| @@ -2122,7 +2101,7 @@ static inline u16 pci_vpd_lrdt_size(const u8 *lrdt) | |||
| 2122 | */ | 2101 | */ |
| 2123 | static inline u16 pci_vpd_lrdt_tag(const u8 *lrdt) | 2102 | static inline u16 pci_vpd_lrdt_tag(const u8 *lrdt) |
| 2124 | { | 2103 | { |
| 2125 | return (u16)(lrdt[0] & PCI_VPD_LRDT_TIN_MASK); | 2104 | return (u16)(lrdt[0] & PCI_VPD_LRDT_TIN_MASK); |
| 2126 | } | 2105 | } |
| 2127 | 2106 | ||
| 2128 | /** | 2107 | /** |
| @@ -2207,7 +2186,7 @@ static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus) | |||
| 2207 | return bus ? bus->dev.of_node : NULL; | 2186 | return bus ? bus->dev.of_node : NULL; |
| 2208 | } | 2187 | } |
| 2209 | 2188 | ||
| 2210 | #else /* CONFIG_OF */ | 2189 | #else /* CONFIG_OF */ |
| 2211 | static inline void pci_set_of_node(struct pci_dev *dev) { } | 2190 | static inline void pci_set_of_node(struct pci_dev *dev) { } |
| 2212 | static inline void pci_release_of_node(struct pci_dev *dev) { } | 2191 | static inline void pci_release_of_node(struct pci_dev *dev) { } |
| 2213 | static inline void pci_set_bus_of_node(struct pci_bus *bus) { } | 2192 | static inline void pci_set_bus_of_node(struct pci_bus *bus) { } |
| @@ -2216,7 +2195,7 @@ static inline struct device_node * | |||
| 2216 | pci_device_to_OF_node(const struct pci_dev *pdev) { return NULL; } | 2195 | pci_device_to_OF_node(const struct pci_dev *pdev) { return NULL; } |
| 2217 | static inline struct irq_domain * | 2196 | static inline struct irq_domain * |
| 2218 | pci_host_bridge_of_msi_domain(struct pci_bus *bus) { return NULL; } | 2197 | pci_host_bridge_of_msi_domain(struct pci_bus *bus) { return NULL; } |
| 2219 | #endif /* CONFIG_OF */ | 2198 | #endif /* CONFIG_OF */ |
| 2220 | 2199 | ||
| 2221 | #ifdef CONFIG_ACPI | 2200 | #ifdef CONFIG_ACPI |
| 2222 | struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus); | 2201 | struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus); |
| @@ -2241,7 +2220,7 @@ int pci_for_each_dma_alias(struct pci_dev *pdev, | |||
| 2241 | int (*fn)(struct pci_dev *pdev, | 2220 | int (*fn)(struct pci_dev *pdev, |
| 2242 | u16 alias, void *data), void *data); | 2221 | u16 alias, void *data), void *data); |
| 2243 | 2222 | ||
| 2244 | /* helper functions for operation of device flag */ | 2223 | /* Helper functions for operation of device flag */ |
| 2245 | static inline void pci_set_dev_assigned(struct pci_dev *pdev) | 2224 | static inline void pci_set_dev_assigned(struct pci_dev *pdev) |
| 2246 | { | 2225 | { |
| 2247 | pdev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED; | 2226 | pdev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED; |
| @@ -2288,7 +2267,7 @@ static inline bool pci_is_thunderbolt_attached(struct pci_dev *pdev) | |||
| 2288 | return false; | 2267 | return false; |
| 2289 | } | 2268 | } |
| 2290 | 2269 | ||
| 2291 | /* provide the legacy pci_dma_* API */ | 2270 | /* Provide the legacy pci_dma_* API */ |
| 2292 | #include <linux/pci-dma-compat.h> | 2271 | #include <linux/pci-dma-compat.h> |
| 2293 | 2272 | ||
| 2294 | #define pci_printk(level, pdev, fmt, arg...) \ | 2273 | #define pci_printk(level, pdev, fmt, arg...) \ |
