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 8 #ifndef _PCI_ACPI_H_ 9 #define _PCI_ACPI_H_ 10 11 #include <linux/acpi.h> 12 13 #ifdef CONFIG_ACPI 14 extern acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev, 15 struct pci_bus *pci_bus); 16 extern acpi_status pci_acpi_remove_bus_pm_notifier(struct acpi_device *dev); 17 extern acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev, 18 struct pci_dev *pci_dev); 19 extern acpi_status pci_acpi_remove_pm_notifier(struct acpi_device *dev); 20 extern phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle); 21 acpi_find_root_bridge_handle(struct pci_dev * pdev)22static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) 23 { 24 struct pci_bus *pbus = pdev->bus; 25 26 /* Find a PCI root bus */ 27 while (!pci_is_root_bus(pbus)) 28 pbus = pbus->parent; 29 30 return DEVICE_ACPI_HANDLE(pbus->bridge); 31 } 32 acpi_pci_get_bridge_handle(struct pci_bus * pbus)33static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus) 34 { 35 struct device *dev; 36 37 if (pci_is_root_bus(pbus)) 38 dev = pbus->bridge; 39 else 40 dev = &pbus->self->dev; 41 42 return DEVICE_ACPI_HANDLE(dev); 43 } 44 45 void acpi_pci_add_bus(struct pci_bus *bus); 46 void acpi_pci_remove_bus(struct pci_bus *bus); 47 48 #ifdef CONFIG_ACPI_PCI_SLOT 49 void acpi_pci_slot_init(void); 50 void acpi_pci_slot_enumerate(struct pci_bus *bus, acpi_handle handle); 51 void acpi_pci_slot_remove(struct pci_bus *bus); 52 #else acpi_pci_slot_init(void)53static inline void acpi_pci_slot_init(void) { } acpi_pci_slot_enumerate(struct pci_bus * bus,acpi_handle handle)54static inline void acpi_pci_slot_enumerate(struct pci_bus *bus, 55 acpi_handle handle) { } acpi_pci_slot_remove(struct pci_bus * bus)56static inline void acpi_pci_slot_remove(struct pci_bus *bus) { } 57 #endif 58 59 #ifdef CONFIG_HOTPLUG_PCI_ACPI 60 void acpiphp_init(void); 61 void acpiphp_enumerate_slots(struct pci_bus *bus, acpi_handle handle); 62 void acpiphp_remove_slots(struct pci_bus *bus); 63 void acpiphp_check_host_bridge(acpi_handle handle); 64 #else acpiphp_init(void)65static inline void acpiphp_init(void) { } acpiphp_enumerate_slots(struct pci_bus * bus,acpi_handle handle)66static inline void acpiphp_enumerate_slots(struct pci_bus *bus, 67 acpi_handle handle) { } acpiphp_remove_slots(struct pci_bus * bus)68static inline void acpiphp_remove_slots(struct pci_bus *bus) { } acpiphp_check_host_bridge(acpi_handle handle)69static inline void acpiphp_check_host_bridge(acpi_handle handle) { } 70 #endif 71 72 #else /* CONFIG_ACPI */ acpi_pci_add_bus(struct pci_bus * bus)73static inline void acpi_pci_add_bus(struct pci_bus *bus) { } acpi_pci_remove_bus(struct pci_bus * bus)74static inline void acpi_pci_remove_bus(struct pci_bus *bus) { } 75 #endif /* CONFIG_ACPI */ 76 77 #ifdef CONFIG_ACPI_APEI 78 extern bool aer_acpi_firmware_first(void); 79 #else aer_acpi_firmware_first(void)80static inline bool aer_acpi_firmware_first(void) { return false; } 81 #endif 82 83 #endif /* _PCI_ACPI_H_ */ 84