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