pci-acpi.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
  24. {
  25. struct pci_bus *pbus = pdev->bus;
  26. /* Find a PCI root bus */
  27. while (!pci_is_root_bus(pbus))
  28. pbus = pbus->parent;
  29. return ACPI_HANDLE(pbus->bridge);
  30. }
  31. static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
  32. {
  33. struct device *dev;
  34. if (pci_is_root_bus(pbus))
  35. dev = pbus->bridge;
  36. else {
  37. /* If pbus is a virtual bus, there is no bridge to it */
  38. if (!pbus->self)
  39. return NULL;
  40. dev = &pbus->self->dev;
  41. }
  42. return ACPI_HANDLE(dev);
  43. }
  44. struct acpi_pci_root;
  45. struct acpi_pci_root_ops;
  46. struct acpi_pci_root_info {
  47. struct acpi_pci_root *root;
  48. struct acpi_device *bridge;
  49. struct acpi_pci_root_ops *ops;
  50. struct list_head resources;
  51. char name[16];
  52. };
  53. struct acpi_pci_root_ops {
  54. struct pci_ops *pci_ops;
  55. int (*init_info)(struct acpi_pci_root_info *info);
  56. void (*release_info)(struct acpi_pci_root_info *info);
  57. int (*prepare_resources)(struct acpi_pci_root_info *info);
  58. };
  59. extern int acpi_pci_probe_root_resources(struct acpi_pci_root_info *info);
  60. extern struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,
  61. struct acpi_pci_root_ops *ops,
  62. struct acpi_pci_root_info *info,
  63. void *sd);
  64. void acpi_pci_add_bus(struct pci_bus *bus);
  65. void acpi_pci_remove_bus(struct pci_bus *bus);
  66. #ifdef CONFIG_ACPI_PCI_SLOT
  67. void acpi_pci_slot_init(void);
  68. void acpi_pci_slot_enumerate(struct pci_bus *bus);
  69. void acpi_pci_slot_remove(struct pci_bus *bus);
  70. #else
  71. static inline void acpi_pci_slot_init(void) { }
  72. static inline void acpi_pci_slot_enumerate(struct pci_bus *bus) { }
  73. static inline void acpi_pci_slot_remove(struct pci_bus *bus) { }
  74. #endif
  75. #ifdef CONFIG_HOTPLUG_PCI_ACPI
  76. void acpiphp_init(void);
  77. void acpiphp_enumerate_slots(struct pci_bus *bus);
  78. void acpiphp_remove_slots(struct pci_bus *bus);
  79. void acpiphp_check_host_bridge(struct acpi_device *adev);
  80. #else
  81. static inline void acpiphp_init(void) { }
  82. static inline void acpiphp_enumerate_slots(struct pci_bus *bus) { }
  83. static inline void acpiphp_remove_slots(struct pci_bus *bus) { }
  84. static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { }
  85. #endif
  86. extern const u8 pci_acpi_dsm_uuid[];
  87. #define DEVICE_LABEL_DSM 0x07
  88. #define RESET_DELAY_DSM 0x08
  89. #define FUNCTION_DELAY_DSM 0x09
  90. #else /* CONFIG_ACPI */
  91. static inline void acpi_pci_add_bus(struct pci_bus *bus) { }
  92. static inline void acpi_pci_remove_bus(struct pci_bus *bus) { }
  93. #endif /* CONFIG_ACPI */
  94. #ifdef CONFIG_ACPI_APEI
  95. extern bool aer_acpi_firmware_first(void);
  96. #else
  97. static inline bool aer_acpi_firmware_first(void) { return false; }
  98. #endif
  99. #endif /* _PCI_ACPI_H_ */