| .. | .. |
|---|
| 2 | 2 | #ifndef DRIVERS_PCI_H |
|---|
| 3 | 3 | #define DRIVERS_PCI_H |
|---|
| 4 | 4 | |
|---|
| 5 | | -#include <linux/android_kabi.h> |
|---|
| 6 | 5 | #include <linux/pci.h> |
|---|
| 6 | +#include <linux/android_kabi.h> |
|---|
| 7 | + |
|---|
| 8 | +/* Number of possible devfns: 0.0 to 1f.7 inclusive */ |
|---|
| 9 | +#define MAX_NR_DEVFNS 256 |
|---|
| 7 | 10 | |
|---|
| 8 | 11 | #define PCI_FIND_CAP_TTL 48 |
|---|
| 9 | 12 | |
|---|
| .. | .. |
|---|
| 13 | 16 | extern bool pci_early_dump; |
|---|
| 14 | 17 | |
|---|
| 15 | 18 | bool pcie_cap_has_lnkctl(const struct pci_dev *dev); |
|---|
| 19 | +bool pcie_cap_has_rtctl(const struct pci_dev *dev); |
|---|
| 16 | 20 | |
|---|
| 17 | 21 | /* Functions internal to the PCI core code */ |
|---|
| 18 | 22 | |
|---|
| .. | .. |
|---|
| 40 | 44 | int pci_bridge_secondary_bus_reset(struct pci_dev *dev); |
|---|
| 41 | 45 | int pci_bus_error_reset(struct pci_dev *dev); |
|---|
| 42 | 46 | |
|---|
| 47 | +#define PCI_PM_D2_DELAY 200 /* usec; see PCIe r4.0, sec 5.9.1 */ |
|---|
| 48 | +#define PCI_PM_D3HOT_WAIT 10 /* msec */ |
|---|
| 49 | +#define PCI_PM_D3COLD_WAIT 100 /* msec */ |
|---|
| 50 | + |
|---|
| 51 | +/* |
|---|
| 52 | + * Following exit from Conventional Reset, devices must be ready within 1 sec |
|---|
| 53 | + * (PCIe r6.0 sec 6.6.1). A D3cold to D0 transition implies a Conventional |
|---|
| 54 | + * Reset (PCIe r6.0 sec 5.8). |
|---|
| 55 | + */ |
|---|
| 56 | +#define PCI_RESET_WAIT 1000 /* msec */ |
|---|
| 57 | +/* |
|---|
| 58 | + * Devices may extend the 1 sec period through Request Retry Status completions |
|---|
| 59 | + * (PCIe r6.0 sec 2.3.1). The spec does not provide an upper limit, but 60 sec |
|---|
| 60 | + * ought to be enough for any device to become responsive. |
|---|
| 61 | + */ |
|---|
| 62 | +#define PCIE_RESET_READY_POLL_MS 60000 /* msec */ |
|---|
| 63 | + |
|---|
| 43 | 64 | /** |
|---|
| 44 | 65 | * struct pci_platform_pm_ops - Firmware PM callbacks |
|---|
| 66 | + * |
|---|
| 67 | + * @bridge_d3: Does the bridge allow entering into D3 |
|---|
| 45 | 68 | * |
|---|
| 46 | 69 | * @is_manageable: returns 'true' if given device is power manageable by the |
|---|
| 47 | 70 | * platform firmware |
|---|
| .. | .. |
|---|
| 49 | 72 | * @set_state: invokes the platform firmware to set the device's power state |
|---|
| 50 | 73 | * |
|---|
| 51 | 74 | * @get_state: queries the platform firmware for a device's current power state |
|---|
| 75 | + * |
|---|
| 76 | + * @refresh_state: asks the platform to refresh the device's power state data |
|---|
| 52 | 77 | * |
|---|
| 53 | 78 | * @choose_state: returns PCI power state of given device preferred by the |
|---|
| 54 | 79 | * platform; to be used during system-wide transitions from a |
|---|
| .. | .. |
|---|
| 64 | 89 | * these callbacks are mandatory. |
|---|
| 65 | 90 | */ |
|---|
| 66 | 91 | struct pci_platform_pm_ops { |
|---|
| 92 | + bool (*bridge_d3)(struct pci_dev *dev); |
|---|
| 67 | 93 | bool (*is_manageable)(struct pci_dev *dev); |
|---|
| 68 | 94 | int (*set_state)(struct pci_dev *dev, pci_power_t state); |
|---|
| 69 | 95 | pci_power_t (*get_state)(struct pci_dev *dev); |
|---|
| 96 | + void (*refresh_state)(struct pci_dev *dev); |
|---|
| 70 | 97 | pci_power_t (*choose_state)(struct pci_dev *dev); |
|---|
| 71 | 98 | int (*set_wakeup)(struct pci_dev *dev, bool enable); |
|---|
| 72 | 99 | bool (*need_resume)(struct pci_dev *dev); |
|---|
| .. | .. |
|---|
| 74 | 101 | |
|---|
| 75 | 102 | int pci_set_platform_pm(const struct pci_platform_pm_ops *ops); |
|---|
| 76 | 103 | void pci_update_current_state(struct pci_dev *dev, pci_power_t state); |
|---|
| 77 | | -void pci_power_up(struct pci_dev *dev); |
|---|
| 104 | +void pci_refresh_power_state(struct pci_dev *dev); |
|---|
| 105 | +int pci_power_up(struct pci_dev *dev); |
|---|
| 78 | 106 | void pci_disable_enabled_device(struct pci_dev *dev); |
|---|
| 79 | 107 | int pci_finish_runtime_suspend(struct pci_dev *dev); |
|---|
| 108 | +void pcie_clear_device_status(struct pci_dev *dev); |
|---|
| 80 | 109 | void pcie_clear_root_pme_status(struct pci_dev *dev); |
|---|
| 110 | +bool pci_check_pme_status(struct pci_dev *dev); |
|---|
| 111 | +void pci_pme_wakeup_bus(struct pci_bus *bus); |
|---|
| 81 | 112 | int __pci_pme_wakeup(struct pci_dev *dev, void *ign); |
|---|
| 82 | 113 | void pci_pme_restore(struct pci_dev *dev); |
|---|
| 83 | | -bool pci_dev_keep_suspended(struct pci_dev *dev); |
|---|
| 114 | +bool pci_dev_need_resume(struct pci_dev *dev); |
|---|
| 115 | +void pci_dev_adjust_pme(struct pci_dev *dev); |
|---|
| 84 | 116 | void pci_dev_complete_resume(struct pci_dev *pci_dev); |
|---|
| 85 | 117 | void pci_config_pm_runtime_get(struct pci_dev *dev); |
|---|
| 86 | 118 | void pci_config_pm_runtime_put(struct pci_dev *dev); |
|---|
| .. | .. |
|---|
| 90 | 122 | void pci_free_cap_save_buffers(struct pci_dev *dev); |
|---|
| 91 | 123 | bool pci_bridge_d3_possible(struct pci_dev *dev); |
|---|
| 92 | 124 | void pci_bridge_d3_update(struct pci_dev *dev); |
|---|
| 125 | +int pci_bridge_wait_for_secondary_bus(struct pci_dev *dev, char *reset_type, |
|---|
| 126 | + int timeout); |
|---|
| 93 | 127 | |
|---|
| 94 | 128 | static inline void pci_wakeup_event(struct pci_dev *dev) |
|---|
| 95 | 129 | { |
|---|
| .. | .. |
|---|
| 111 | 145 | return !pci_has_subordinate(pci_dev) || pci_dev->bridge_d3; |
|---|
| 112 | 146 | } |
|---|
| 113 | 147 | |
|---|
| 148 | +static inline bool pcie_downstream_port(const struct pci_dev *dev) |
|---|
| 149 | +{ |
|---|
| 150 | + int type = pci_pcie_type(dev); |
|---|
| 151 | + |
|---|
| 152 | + return type == PCI_EXP_TYPE_ROOT_PORT || |
|---|
| 153 | + type == PCI_EXP_TYPE_DOWNSTREAM || |
|---|
| 154 | + type == PCI_EXP_TYPE_PCIE_BRIDGE; |
|---|
| 155 | +} |
|---|
| 156 | + |
|---|
| 114 | 157 | int pci_vpd_init(struct pci_dev *dev); |
|---|
| 115 | 158 | void pci_vpd_release(struct pci_dev *dev); |
|---|
| 116 | 159 | void pcie_vpd_create_sysfs_dev_files(struct pci_dev *dev); |
|---|
| 117 | 160 | void pcie_vpd_remove_sysfs_dev_files(struct pci_dev *dev); |
|---|
| 161 | + |
|---|
| 162 | +/* PCI Virtual Channel */ |
|---|
| 163 | +int pci_save_vc_state(struct pci_dev *dev); |
|---|
| 164 | +void pci_restore_vc_state(struct pci_dev *dev); |
|---|
| 165 | +void pci_allocate_vc_save_buffers(struct pci_dev *dev); |
|---|
| 118 | 166 | |
|---|
| 119 | 167 | /* PCI /proc functions */ |
|---|
| 120 | 168 | #ifdef CONFIG_PROC_FS |
|---|
| .. | .. |
|---|
| 144 | 192 | |
|---|
| 145 | 193 | extern raw_spinlock_t pci_lock; |
|---|
| 146 | 194 | |
|---|
| 147 | | -extern unsigned int pci_pm_d3_delay; |
|---|
| 195 | +extern unsigned int pci_pm_d3hot_delay; |
|---|
| 148 | 196 | |
|---|
| 149 | 197 | #ifdef CONFIG_PCI_MSI |
|---|
| 150 | 198 | void pci_no_msi(void); |
|---|
| .. | .. |
|---|
| 189 | 237 | extern const struct device_type pci_dev_type; |
|---|
| 190 | 238 | extern const struct attribute_group *pci_bus_groups[]; |
|---|
| 191 | 239 | |
|---|
| 240 | +extern unsigned long pci_hotplug_io_size; |
|---|
| 241 | +extern unsigned long pci_hotplug_mmio_size; |
|---|
| 242 | +extern unsigned long pci_hotplug_mmio_pref_size; |
|---|
| 243 | +extern unsigned long pci_hotplug_bus_size; |
|---|
| 192 | 244 | |
|---|
| 193 | 245 | /** |
|---|
| 194 | 246 | * pci_match_one_device - Tell if a PCI device structure has a matching |
|---|
| .. | .. |
|---|
| 229 | 281 | pci_bar_mem64, /* A 64-bit memory BAR */ |
|---|
| 230 | 282 | }; |
|---|
| 231 | 283 | |
|---|
| 284 | +struct device *pci_get_host_bridge_device(struct pci_dev *dev); |
|---|
| 285 | +void pci_put_host_bridge_device(struct device *dev); |
|---|
| 286 | + |
|---|
| 232 | 287 | int pci_configure_extended_tags(struct pci_dev *dev, void *ign); |
|---|
| 233 | 288 | bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *pl, |
|---|
| 234 | 289 | int crs_timeout); |
|---|
| .. | .. |
|---|
| 249 | 304 | |
|---|
| 250 | 305 | void pci_reassigndev_resource_alignment(struct pci_dev *dev); |
|---|
| 251 | 306 | void pci_disable_bridge_window(struct pci_dev *dev); |
|---|
| 307 | +struct pci_bus *pci_bus_get(struct pci_bus *bus); |
|---|
| 308 | +void pci_bus_put(struct pci_bus *bus); |
|---|
| 252 | 309 | |
|---|
| 253 | | -/* PCIe link information */ |
|---|
| 254 | | -#define PCIE_SPEED2STR(speed) \ |
|---|
| 255 | | - ((speed) == PCIE_SPEED_16_0GT ? "16 GT/s" : \ |
|---|
| 256 | | - (speed) == PCIE_SPEED_8_0GT ? "8 GT/s" : \ |
|---|
| 257 | | - (speed) == PCIE_SPEED_5_0GT ? "5 GT/s" : \ |
|---|
| 258 | | - (speed) == PCIE_SPEED_2_5GT ? "2.5 GT/s" : \ |
|---|
| 259 | | - "Unknown speed") |
|---|
| 310 | +/* PCIe link information from Link Capabilities 2 */ |
|---|
| 311 | +#define PCIE_LNKCAP2_SLS2SPEED(lnkcap2) \ |
|---|
| 312 | + ((lnkcap2) & PCI_EXP_LNKCAP2_SLS_32_0GB ? PCIE_SPEED_32_0GT : \ |
|---|
| 313 | + (lnkcap2) & PCI_EXP_LNKCAP2_SLS_16_0GB ? PCIE_SPEED_16_0GT : \ |
|---|
| 314 | + (lnkcap2) & PCI_EXP_LNKCAP2_SLS_8_0GB ? PCIE_SPEED_8_0GT : \ |
|---|
| 315 | + (lnkcap2) & PCI_EXP_LNKCAP2_SLS_5_0GB ? PCIE_SPEED_5_0GT : \ |
|---|
| 316 | + (lnkcap2) & PCI_EXP_LNKCAP2_SLS_2_5GB ? PCIE_SPEED_2_5GT : \ |
|---|
| 317 | + PCI_SPEED_UNKNOWN) |
|---|
| 260 | 318 | |
|---|
| 261 | 319 | /* PCIe speed to Mb/s reduced by encoding overhead */ |
|---|
| 262 | 320 | #define PCIE_SPEED2MBS_ENC(speed) \ |
|---|
| 263 | | - ((speed) == PCIE_SPEED_16_0GT ? 16000*128/130 : \ |
|---|
| 321 | + ((speed) == PCIE_SPEED_32_0GT ? 32000*128/130 : \ |
|---|
| 322 | + (speed) == PCIE_SPEED_16_0GT ? 16000*128/130 : \ |
|---|
| 264 | 323 | (speed) == PCIE_SPEED_8_0GT ? 8000*128/130 : \ |
|---|
| 265 | 324 | (speed) == PCIE_SPEED_5_0GT ? 5000*8/10 : \ |
|---|
| 266 | 325 | (speed) == PCIE_SPEED_2_5GT ? 2500*8/10 : \ |
|---|
| 267 | 326 | 0) |
|---|
| 268 | 327 | |
|---|
| 328 | +const char *pci_speed_string(enum pci_bus_speed speed); |
|---|
| 269 | 329 | enum pci_bus_speed pcie_get_speed_cap(struct pci_dev *dev); |
|---|
| 270 | 330 | enum pcie_link_width pcie_get_width_cap(struct pci_dev *dev); |
|---|
| 271 | 331 | u32 pcie_bandwidth_capable(struct pci_dev *dev, enum pci_bus_speed *speed, |
|---|
| 272 | 332 | enum pcie_link_width *width); |
|---|
| 273 | 333 | void __pcie_print_link_status(struct pci_dev *dev, bool verbose); |
|---|
| 334 | +void pcie_report_downtraining(struct pci_dev *dev); |
|---|
| 335 | +void pcie_update_link_speed(struct pci_bus *bus, u16 link_status); |
|---|
| 274 | 336 | |
|---|
| 275 | 337 | /* Single Root I/O Virtualization */ |
|---|
| 276 | 338 | struct pci_sriov { |
|---|
| .. | .. |
|---|
| 303 | 365 | ANDROID_KABI_RESERVE(4); |
|---|
| 304 | 366 | }; |
|---|
| 305 | 367 | |
|---|
| 306 | | -/* pci_dev priv_flags */ |
|---|
| 307 | | -#define PCI_DEV_DISCONNECTED 0 |
|---|
| 308 | | -#define PCI_DEV_ADDED 1 |
|---|
| 368 | +/** |
|---|
| 369 | + * pci_dev_set_io_state - Set the new error state if possible. |
|---|
| 370 | + * |
|---|
| 371 | + * @dev - pci device to set new error_state |
|---|
| 372 | + * @new - the state we want dev to be in |
|---|
| 373 | + * |
|---|
| 374 | + * If the device is experiencing perm_failure, it has to remain in that state. |
|---|
| 375 | + * Any other transition is allowed. |
|---|
| 376 | + * |
|---|
| 377 | + * Returns true if state has been changed to the requested state. |
|---|
| 378 | + */ |
|---|
| 379 | +static inline bool pci_dev_set_io_state(struct pci_dev *dev, |
|---|
| 380 | + pci_channel_state_t new) |
|---|
| 381 | +{ |
|---|
| 382 | + pci_channel_state_t old; |
|---|
| 383 | + |
|---|
| 384 | + switch (new) { |
|---|
| 385 | + case pci_channel_io_perm_failure: |
|---|
| 386 | + xchg(&dev->error_state, pci_channel_io_perm_failure); |
|---|
| 387 | + return true; |
|---|
| 388 | + case pci_channel_io_frozen: |
|---|
| 389 | + old = cmpxchg(&dev->error_state, pci_channel_io_normal, |
|---|
| 390 | + pci_channel_io_frozen); |
|---|
| 391 | + return old != pci_channel_io_perm_failure; |
|---|
| 392 | + case pci_channel_io_normal: |
|---|
| 393 | + old = cmpxchg(&dev->error_state, pci_channel_io_frozen, |
|---|
| 394 | + pci_channel_io_normal); |
|---|
| 395 | + return old != pci_channel_io_perm_failure; |
|---|
| 396 | + default: |
|---|
| 397 | + return false; |
|---|
| 398 | + } |
|---|
| 399 | +} |
|---|
| 309 | 400 | |
|---|
| 310 | 401 | static inline int pci_dev_set_disconnected(struct pci_dev *dev, void *unused) |
|---|
| 311 | 402 | { |
|---|
| 312 | | - set_bit(PCI_DEV_DISCONNECTED, &dev->priv_flags); |
|---|
| 403 | + pci_dev_set_io_state(dev, pci_channel_io_perm_failure); |
|---|
| 404 | + |
|---|
| 313 | 405 | return 0; |
|---|
| 314 | 406 | } |
|---|
| 315 | 407 | |
|---|
| 316 | 408 | static inline bool pci_dev_is_disconnected(const struct pci_dev *dev) |
|---|
| 317 | 409 | { |
|---|
| 318 | | - return test_bit(PCI_DEV_DISCONNECTED, &dev->priv_flags); |
|---|
| 410 | + return dev->error_state == pci_channel_io_perm_failure; |
|---|
| 319 | 411 | } |
|---|
| 412 | + |
|---|
| 413 | +/* pci_dev priv_flags */ |
|---|
| 414 | +#define PCI_DEV_ADDED 0 |
|---|
| 415 | +#define PCI_DPC_RECOVERED 1 |
|---|
| 416 | +#define PCI_DPC_RECOVERING 2 |
|---|
| 320 | 417 | |
|---|
| 321 | 418 | static inline void pci_dev_assign_added(struct pci_dev *dev, bool added) |
|---|
| 322 | 419 | { |
|---|
| .. | .. |
|---|
| 356 | 453 | void aer_print_error(struct pci_dev *dev, struct aer_err_info *info); |
|---|
| 357 | 454 | #endif /* CONFIG_PCIEAER */ |
|---|
| 358 | 455 | |
|---|
| 456 | +#ifdef CONFIG_PCIE_DPC |
|---|
| 457 | +void pci_save_dpc_state(struct pci_dev *dev); |
|---|
| 458 | +void pci_restore_dpc_state(struct pci_dev *dev); |
|---|
| 459 | +void pci_dpc_init(struct pci_dev *pdev); |
|---|
| 460 | +void dpc_process_error(struct pci_dev *pdev); |
|---|
| 461 | +pci_ers_result_t dpc_reset_link(struct pci_dev *pdev); |
|---|
| 462 | +bool pci_dpc_recovered(struct pci_dev *pdev); |
|---|
| 463 | +#else |
|---|
| 464 | +static inline void pci_save_dpc_state(struct pci_dev *dev) {} |
|---|
| 465 | +static inline void pci_restore_dpc_state(struct pci_dev *dev) {} |
|---|
| 466 | +static inline void pci_dpc_init(struct pci_dev *pdev) {} |
|---|
| 467 | +static inline bool pci_dpc_recovered(struct pci_dev *pdev) { return false; } |
|---|
| 468 | +#endif |
|---|
| 469 | + |
|---|
| 359 | 470 | #ifdef CONFIG_PCI_ATS |
|---|
| 471 | +/* Address Translation Service */ |
|---|
| 472 | +void pci_ats_init(struct pci_dev *dev); |
|---|
| 360 | 473 | void pci_restore_ats_state(struct pci_dev *dev); |
|---|
| 361 | 474 | #else |
|---|
| 362 | | -static inline void pci_restore_ats_state(struct pci_dev *dev) |
|---|
| 363 | | -{ |
|---|
| 364 | | -} |
|---|
| 475 | +static inline void pci_ats_init(struct pci_dev *d) { } |
|---|
| 476 | +static inline void pci_restore_ats_state(struct pci_dev *dev) { } |
|---|
| 365 | 477 | #endif /* CONFIG_PCI_ATS */ |
|---|
| 478 | + |
|---|
| 479 | +#ifdef CONFIG_PCI_PRI |
|---|
| 480 | +void pci_pri_init(struct pci_dev *dev); |
|---|
| 481 | +void pci_restore_pri_state(struct pci_dev *pdev); |
|---|
| 482 | +#else |
|---|
| 483 | +static inline void pci_pri_init(struct pci_dev *dev) { } |
|---|
| 484 | +static inline void pci_restore_pri_state(struct pci_dev *pdev) { } |
|---|
| 485 | +#endif |
|---|
| 486 | + |
|---|
| 487 | +#ifdef CONFIG_PCI_PASID |
|---|
| 488 | +void pci_pasid_init(struct pci_dev *dev); |
|---|
| 489 | +void pci_restore_pasid_state(struct pci_dev *pdev); |
|---|
| 490 | +#else |
|---|
| 491 | +static inline void pci_pasid_init(struct pci_dev *dev) { } |
|---|
| 492 | +static inline void pci_restore_pasid_state(struct pci_dev *pdev) { } |
|---|
| 493 | +#endif |
|---|
| 366 | 494 | |
|---|
| 367 | 495 | #ifdef CONFIG_PCI_IOV |
|---|
| 368 | 496 | int pci_iov_init(struct pci_dev *dev); |
|---|
| .. | .. |
|---|
| 372 | 500 | resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev, int resno); |
|---|
| 373 | 501 | void pci_restore_iov_state(struct pci_dev *dev); |
|---|
| 374 | 502 | int pci_iov_bus_range(struct pci_bus *bus); |
|---|
| 375 | | - |
|---|
| 503 | +extern const struct attribute_group sriov_dev_attr_group; |
|---|
| 376 | 504 | #else |
|---|
| 377 | 505 | static inline int pci_iov_init(struct pci_dev *dev) |
|---|
| 378 | 506 | { |
|---|
| .. | .. |
|---|
| 411 | 539 | return resource_alignment(res); |
|---|
| 412 | 540 | } |
|---|
| 413 | 541 | |
|---|
| 414 | | -void pci_enable_acs(struct pci_dev *dev); |
|---|
| 542 | +void pci_acs_init(struct pci_dev *dev); |
|---|
| 415 | 543 | #ifdef CONFIG_PCI_QUIRKS |
|---|
| 416 | 544 | int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags); |
|---|
| 417 | 545 | int pci_dev_specific_enable_acs(struct pci_dev *dev); |
|---|
| .. | .. |
|---|
| 433 | 561 | #endif |
|---|
| 434 | 562 | |
|---|
| 435 | 563 | /* PCI error reporting and recovery */ |
|---|
| 436 | | -void pcie_do_fatal_recovery(struct pci_dev *dev, u32 service); |
|---|
| 437 | | -void pcie_do_nonfatal_recovery(struct pci_dev *dev); |
|---|
| 564 | +pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, |
|---|
| 565 | + pci_channel_state_t state, |
|---|
| 566 | + pci_ers_result_t (*reset_subordinates)(struct pci_dev *pdev)); |
|---|
| 438 | 567 | |
|---|
| 439 | 568 | bool pcie_wait_for_link(struct pci_dev *pdev, bool active); |
|---|
| 440 | 569 | #ifdef CONFIG_PCIEASPM |
|---|
| .. | .. |
|---|
| 449 | 578 | static inline void pcie_aspm_powersave_config_link(struct pci_dev *pdev) { } |
|---|
| 450 | 579 | #endif |
|---|
| 451 | 580 | |
|---|
| 452 | | -#ifdef CONFIG_PCIEASPM_DEBUG |
|---|
| 453 | | -void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev); |
|---|
| 454 | | -void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev); |
|---|
| 581 | +#ifdef CONFIG_PCIE_ECRC |
|---|
| 582 | +void pcie_set_ecrc_checking(struct pci_dev *dev); |
|---|
| 583 | +void pcie_ecrc_get_policy(char *str); |
|---|
| 455 | 584 | #else |
|---|
| 456 | | -static inline void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev) { } |
|---|
| 457 | | -static inline void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev) { } |
|---|
| 585 | +static inline void pcie_set_ecrc_checking(struct pci_dev *dev) { } |
|---|
| 586 | +static inline void pcie_ecrc_get_policy(char *str) { } |
|---|
| 458 | 587 | #endif |
|---|
| 459 | 588 | |
|---|
| 460 | 589 | #ifdef CONFIG_PCIE_PTM |
|---|
| .. | .. |
|---|
| 503 | 632 | int of_pci_parse_bus_range(struct device_node *node, struct resource *res); |
|---|
| 504 | 633 | int of_get_pci_domain_nr(struct device_node *node); |
|---|
| 505 | 634 | int of_pci_get_max_link_speed(struct device_node *node); |
|---|
| 635 | +void pci_set_of_node(struct pci_dev *dev); |
|---|
| 636 | +void pci_release_of_node(struct pci_dev *dev); |
|---|
| 637 | +void pci_set_bus_of_node(struct pci_bus *bus); |
|---|
| 638 | +void pci_release_bus_of_node(struct pci_bus *bus); |
|---|
| 639 | + |
|---|
| 640 | +int devm_of_pci_bridge_init(struct device *dev, struct pci_host_bridge *bridge); |
|---|
| 506 | 641 | |
|---|
| 507 | 642 | #else |
|---|
| 508 | 643 | static inline int |
|---|
| .. | .. |
|---|
| 522 | 657 | { |
|---|
| 523 | 658 | return -EINVAL; |
|---|
| 524 | 659 | } |
|---|
| 525 | | -#endif /* CONFIG_OF */ |
|---|
| 526 | 660 | |
|---|
| 527 | | -#if defined(CONFIG_OF_ADDRESS) |
|---|
| 528 | | -int devm_of_pci_get_host_bridge_resources(struct device *dev, |
|---|
| 529 | | - unsigned char busno, unsigned char bus_max, |
|---|
| 530 | | - struct list_head *resources, resource_size_t *io_base); |
|---|
| 531 | | -#else |
|---|
| 532 | | -static inline int devm_of_pci_get_host_bridge_resources(struct device *dev, |
|---|
| 533 | | - unsigned char busno, unsigned char bus_max, |
|---|
| 534 | | - struct list_head *resources, resource_size_t *io_base) |
|---|
| 661 | +static inline void pci_set_of_node(struct pci_dev *dev) { } |
|---|
| 662 | +static inline void pci_release_of_node(struct pci_dev *dev) { } |
|---|
| 663 | +static inline void pci_set_bus_of_node(struct pci_bus *bus) { } |
|---|
| 664 | +static inline void pci_release_bus_of_node(struct pci_bus *bus) { } |
|---|
| 665 | + |
|---|
| 666 | +static inline int devm_of_pci_bridge_init(struct device *dev, struct pci_host_bridge *bridge) |
|---|
| 535 | 667 | { |
|---|
| 536 | | - return -EINVAL; |
|---|
| 668 | + return 0; |
|---|
| 537 | 669 | } |
|---|
| 538 | | -#endif |
|---|
| 670 | + |
|---|
| 671 | +#endif /* CONFIG_OF */ |
|---|
| 539 | 672 | |
|---|
| 540 | 673 | #ifdef CONFIG_PCIEAER |
|---|
| 541 | 674 | void pci_no_aer(void); |
|---|
| .. | .. |
|---|
| 543 | 676 | void pci_aer_exit(struct pci_dev *dev); |
|---|
| 544 | 677 | extern const struct attribute_group aer_stats_attr_group; |
|---|
| 545 | 678 | void pci_aer_clear_fatal_status(struct pci_dev *dev); |
|---|
| 546 | | -void pci_aer_clear_device_status(struct pci_dev *dev); |
|---|
| 679 | +int pci_aer_clear_status(struct pci_dev *dev); |
|---|
| 680 | +int pci_aer_raw_clear_status(struct pci_dev *dev); |
|---|
| 547 | 681 | #else |
|---|
| 548 | 682 | static inline void pci_no_aer(void) { } |
|---|
| 549 | 683 | static inline void pci_aer_init(struct pci_dev *d) { } |
|---|
| 550 | 684 | static inline void pci_aer_exit(struct pci_dev *d) { } |
|---|
| 551 | 685 | static inline void pci_aer_clear_fatal_status(struct pci_dev *dev) { } |
|---|
| 552 | | -static inline void pci_aer_clear_device_status(struct pci_dev *dev) { } |
|---|
| 686 | +static inline int pci_aer_clear_status(struct pci_dev *dev) { return -EINVAL; } |
|---|
| 687 | +static inline int pci_aer_raw_clear_status(struct pci_dev *dev) { return -EINVAL; } |
|---|
| 688 | +#endif |
|---|
| 689 | + |
|---|
| 690 | +#ifdef CONFIG_ACPI |
|---|
| 691 | +int pci_acpi_program_hp_params(struct pci_dev *dev); |
|---|
| 692 | +#else |
|---|
| 693 | +static inline int pci_acpi_program_hp_params(struct pci_dev *dev) |
|---|
| 694 | +{ |
|---|
| 695 | + return -ENODEV; |
|---|
| 696 | +} |
|---|
| 697 | +#endif |
|---|
| 698 | + |
|---|
| 699 | +#ifdef CONFIG_PCIEASPM |
|---|
| 700 | +extern const struct attribute_group aspm_ctrl_attr_group; |
|---|
| 553 | 701 | #endif |
|---|
| 554 | 702 | |
|---|
| 555 | 703 | #endif /* DRIVERS_PCI_H */ |
|---|