pci-acpi.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * File pci-acpi.h
  3. *
  4. * Copyright (C) 2004 Intel
  5. * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com)
  6. */
  7. #ifndef _PCI_ACPI_H_
  8. #define _PCI_ACPI_H_
  9. #include <linux/acpi.h>
  10. #ifdef CONFIG_ACPI
  11. extern acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev);
  12. static inline acpi_status pci_acpi_remove_bus_pm_notifier(struct acpi_device *dev)
  13. {
  14. return acpi_remove_pm_notifier(dev);
  15. }
  16. extern acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev,
  17. struct pci_dev *pci_dev);
  18. static inline acpi_status pci_acpi_remove_pm_notifier(struct acpi_device *dev)
  19. {
  20. return acpi_remove_pm_notifier(dev);
  21. }
  22. extern phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle);
  23. struct pci_ecam_ops;
  24. extern int pci_mcfg_lookup(struct acpi_pci_root *root, struct resource *cfgres,
  25. struct pci_ecam_ops **ecam_ops);
  26. static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
  27. {
  28. struct pci_bus *pbus = pdev->bus;
  29. /* Find a PCI root bus */
  30. while (!pci_is_root_bus(pbus))
  31. pbus = pbus->parent;
  32. return ACPI_HANDLE(pbus->bridge);
  33. }
  34. static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
  35. {
  36. struct device *dev;
  37. if (pci_is_root_bus(pbus))
  38. dev = pbus->bridge;
  39. else {
  40. /* If pbus is a virtual bus, there is no bridge to it */
  41. if (!pbus->self)
  42. return NULL;
  43. dev = &pbus->self->dev;
  44. }
  45. return ACPI_HANDLE(dev);
  46. }
  47. struct acpi_pci_root;
  48. struct acpi_pci_root_ops;
  49. struct acpi_pci_root_info {
  50. struct acpi_pci_root *root;
  51. struct acpi_device *bridge;
  52. struct acpi_pci_root_ops *ops;
  53. struct list_head resources;
  54. char name[16];
  55. };
  56. struct acpi_pci_root_ops {
  57. struct pci_ops *pci_ops;
  58. int (*init_info)(struct acpi_pci_root_info *info);
  59. void (*release_info)(struct acpi_pci_root_info *info);
  60. int (*prepare_resources)(struct acpi_pci_root_info *info);
  61. };
  62. extern int acpi_pci_probe_root_resources(struct acpi_pci_root_info *info);
  63. extern struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,
  64. struct acpi_pci_root_ops *ops,
  65. struct acpi_pci_root_info *info,
  66. void *sd);
  67. void acpi_pci_add_bus(struct pci_bus *bus);
  68. void acpi_pci_remove_bus(struct pci_bus *bus);
  69. #ifdef CONFIG_ACPI_PCI_SLOT
  70. void acpi_pci_slot_init(void);
  71. void acpi_pci_slot_enumerate(struct pci_bus *bus);
  72. void acpi_pci_slot_remove(struct pci_bus *bus);
  73. #else
  74. static inline void acpi_pci_slot_init(void) { }
  75. static inline void acpi_pci_slot_enumerate(struct pci_bus *bus) { }
  76. static inline void acpi_pci_slot_remove(struct pci_bus *bus) { }
  77. #endif
  78. #ifdef CONFIG_HOTPLUG_PCI_ACPI
  79. void acpiphp_init(void);
  80. void acpiphp_enumerate_slots(struct pci_bus *bus);
  81. void acpiphp_remove_slots(struct pci_bus *bus);
  82. void acpiphp_check_host_bridge(struct acpi_device *adev);
  83. #else
  84. static inline void acpiphp_init(void) { }
  85. static inline void acpiphp_enumerate_slots(struct pci_bus *bus) { }
  86. static inline void acpiphp_remove_slots(struct pci_bus *bus) { }
  87. static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { }
  88. #endif
  89. extern const guid_t pci_acpi_dsm_guid;
  90. #define DEVICE_LABEL_DSM 0x07
  91. #define RESET_DELAY_DSM 0x08
  92. #define FUNCTION_DELAY_DSM 0x09
  93. #else /* CONFIG_ACPI */
  94. static inline void acpi_pci_add_bus(struct pci_bus *bus) { }
  95. static inline void acpi_pci_remove_bus(struct pci_bus *bus) { }
  96. #endif /* CONFIG_ACPI */
  97. #ifdef CONFIG_ACPI_APEI
  98. extern bool aer_acpi_firmware_first(void);
  99. #else
  100. static inline bool aer_acpi_firmware_first(void) { return false; }
  101. #endif
  102. #endif /* _PCI_ACPI_H_ */