1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef _PCI_HOTPLUG_H
15#define _PCI_HOTPLUG_H
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38struct hotplug_slot_ops {
39 int (*enable_slot) (struct hotplug_slot *slot);
40 int (*disable_slot) (struct hotplug_slot *slot);
41 int (*set_attention_status) (struct hotplug_slot *slot, u8 value);
42 int (*hardware_test) (struct hotplug_slot *slot, u32 value);
43 int (*get_power_status) (struct hotplug_slot *slot, u8 *value);
44 int (*get_attention_status) (struct hotplug_slot *slot, u8 *value);
45 int (*get_latch_status) (struct hotplug_slot *slot, u8 *value);
46 int (*get_adapter_status) (struct hotplug_slot *slot, u8 *value);
47 int (*reset_slot) (struct hotplug_slot *slot, int probe);
48};
49
50
51
52
53
54
55
56
57
58struct hotplug_slot {
59 const struct hotplug_slot_ops *ops;
60
61
62 struct list_head slot_list;
63 struct pci_slot *pci_slot;
64 struct module *owner;
65 const char *mod_name;
66};
67
68static inline const char *hotplug_slot_name(const struct hotplug_slot *slot)
69{
70 return pci_slot_name(slot->pci_slot);
71}
72
73int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *pbus, int nr,
74 const char *name, struct module *owner,
75 const char *mod_name);
76int __pci_hp_initialize(struct hotplug_slot *slot, struct pci_bus *bus, int nr,
77 const char *name, struct module *owner,
78 const char *mod_name);
79int pci_hp_add(struct hotplug_slot *slot);
80
81void pci_hp_del(struct hotplug_slot *slot);
82void pci_hp_destroy(struct hotplug_slot *slot);
83void pci_hp_deregister(struct hotplug_slot *slot);
84
85
86#define pci_hp_register(slot, pbus, devnr, name) \
87 __pci_hp_register(slot, pbus, devnr, name, THIS_MODULE, KBUILD_MODNAME)
88#define pci_hp_initialize(slot, bus, nr, name) \
89 __pci_hp_initialize(slot, bus, nr, name, THIS_MODULE, KBUILD_MODNAME)
90
91#ifdef CONFIG_ACPI
92#include <linux/acpi.h>
93bool pciehp_is_native(struct pci_dev *bridge);
94int acpi_get_hp_hw_control_from_firmware(struct pci_dev *bridge);
95bool shpchp_is_native(struct pci_dev *bridge);
96int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle);
97int acpi_pci_detect_ejectable(acpi_handle handle);
98#else
99static inline int acpi_get_hp_hw_control_from_firmware(struct pci_dev *bridge)
100{
101 return 0;
102}
103static inline bool pciehp_is_native(struct pci_dev *bridge) { return true; }
104static inline bool shpchp_is_native(struct pci_dev *bridge) { return true; }
105#endif
106
107static inline bool hotplug_is_native(struct pci_dev *bridge)
108{
109 return pciehp_is_native(bridge) || shpchp_is_native(bridge);
110}
111#endif
112