pci-acpi.h 2.6 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7 8 9 10
/*
 * File		pci-acpi.h
 *
 * Copyright (C) 2004 Intel
 * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com)
 */

#ifndef _PCI_ACPI_H_
#define _PCI_ACPI_H_

11 12
#include <linux/acpi.h>

L
Linus Torvalds 已提交
13
#ifdef CONFIG_ACPI
14 15 16 17 18
extern acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev);
static inline acpi_status pci_acpi_remove_bus_pm_notifier(struct acpi_device *dev)
{
	return acpi_remove_pm_notifier(dev);
}
19 20
extern acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev,
					     struct pci_dev *pci_dev);
21 22 23 24
static inline acpi_status pci_acpi_remove_pm_notifier(struct acpi_device *dev)
{
	return acpi_remove_pm_notifier(dev);
}
25
extern phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle);
26

27 28
static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
{
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 38 39

static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
{
40 41 42 43
	struct device *dev;

	if (pci_is_root_bus(pbus))
		dev = pbus->bridge;
44 45 46 47 48
	else {
		/* If pbus is a virtual bus, there is no bridge to it */
		if (!pbus->self)
			return NULL;

49
		dev = &pbus->self->dev;
50
	}
51

52
	return ACPI_HANDLE(dev);
53
}
54 55 56

void acpi_pci_add_bus(struct pci_bus *bus);
void acpi_pci_remove_bus(struct pci_bus *bus);
57 58 59

#ifdef	CONFIG_ACPI_PCI_SLOT
void acpi_pci_slot_init(void);
60
void acpi_pci_slot_enumerate(struct pci_bus *bus);
61 62 63
void acpi_pci_slot_remove(struct pci_bus *bus);
#else
static inline void acpi_pci_slot_init(void) { }
64
static inline void acpi_pci_slot_enumerate(struct pci_bus *bus) { }
65 66 67
static inline void acpi_pci_slot_remove(struct pci_bus *bus) { }
#endif

68 69
#ifdef	CONFIG_HOTPLUG_PCI_ACPI
void acpiphp_init(void);
70
void acpiphp_enumerate_slots(struct pci_bus *bus);
71
void acpiphp_remove_slots(struct pci_bus *bus);
72
void acpiphp_check_host_bridge(struct acpi_device *adev);
73 74
#else
static inline void acpiphp_init(void) { }
75
static inline void acpiphp_enumerate_slots(struct pci_bus *bus) { }
76
static inline void acpiphp_remove_slots(struct pci_bus *bus) { }
77
static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { }
78 79
#endif

80 81
extern const u8 pci_acpi_dsm_uuid[];
#define DEVICE_LABEL_DSM	0x07
82 83
#define RESET_DELAY_DSM		0x08
#define FUNCTION_DELAY_DSM	0x09
84

85 86 87 88
#else	/* CONFIG_ACPI */
static inline void acpi_pci_add_bus(struct pci_bus *bus) { }
static inline void acpi_pci_remove_bus(struct pci_bus *bus) { }
#endif	/* CONFIG_ACPI */
L
Linus Torvalds 已提交
89

90 91 92 93 94 95
#ifdef CONFIG_ACPI_APEI
extern bool aer_acpi_firmware_first(void);
#else
static inline bool aer_acpi_firmware_first(void) { return false; }
#endif

L
Linus Torvalds 已提交
96
#endif	/* _PCI_ACPI_H_ */