0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _PCI_HOTPLUG_H
0015 #define _PCI_HOTPLUG_H
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 struct hotplug_slot_ops {
0039 int (*enable_slot) (struct hotplug_slot *slot);
0040 int (*disable_slot) (struct hotplug_slot *slot);
0041 int (*set_attention_status) (struct hotplug_slot *slot, u8 value);
0042 int (*hardware_test) (struct hotplug_slot *slot, u32 value);
0043 int (*get_power_status) (struct hotplug_slot *slot, u8 *value);
0044 int (*get_attention_status) (struct hotplug_slot *slot, u8 *value);
0045 int (*get_latch_status) (struct hotplug_slot *slot, u8 *value);
0046 int (*get_adapter_status) (struct hotplug_slot *slot, u8 *value);
0047 int (*reset_slot) (struct hotplug_slot *slot, bool probe);
0048 };
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058 struct hotplug_slot {
0059 const struct hotplug_slot_ops *ops;
0060
0061
0062 struct list_head slot_list;
0063 struct pci_slot *pci_slot;
0064 struct module *owner;
0065 const char *mod_name;
0066 };
0067
0068 static inline const char *hotplug_slot_name(const struct hotplug_slot *slot)
0069 {
0070 return pci_slot_name(slot->pci_slot);
0071 }
0072
0073 int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *pbus, int nr,
0074 const char *name, struct module *owner,
0075 const char *mod_name);
0076 int __pci_hp_initialize(struct hotplug_slot *slot, struct pci_bus *bus, int nr,
0077 const char *name, struct module *owner,
0078 const char *mod_name);
0079 int pci_hp_add(struct hotplug_slot *slot);
0080
0081 void pci_hp_del(struct hotplug_slot *slot);
0082 void pci_hp_destroy(struct hotplug_slot *slot);
0083 void pci_hp_deregister(struct hotplug_slot *slot);
0084
0085
0086 #define pci_hp_register(slot, pbus, devnr, name) \
0087 __pci_hp_register(slot, pbus, devnr, name, THIS_MODULE, KBUILD_MODNAME)
0088 #define pci_hp_initialize(slot, bus, nr, name) \
0089 __pci_hp_initialize(slot, bus, nr, name, THIS_MODULE, KBUILD_MODNAME)
0090
0091 #ifdef CONFIG_ACPI
0092 #include <linux/acpi.h>
0093 bool pciehp_is_native(struct pci_dev *bridge);
0094 int acpi_get_hp_hw_control_from_firmware(struct pci_dev *bridge);
0095 bool shpchp_is_native(struct pci_dev *bridge);
0096 int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle);
0097 int acpi_pci_detect_ejectable(acpi_handle handle);
0098 #else
0099 static inline int acpi_get_hp_hw_control_from_firmware(struct pci_dev *bridge)
0100 {
0101 return 0;
0102 }
0103 static inline bool pciehp_is_native(struct pci_dev *bridge) { return true; }
0104 static inline bool shpchp_is_native(struct pci_dev *bridge) { return true; }
0105 #endif
0106
0107 static inline bool hotplug_is_native(struct pci_dev *bridge)
0108 {
0109 return pciehp_is_native(bridge) || shpchp_is_native(bridge);
0110 }
0111 #endif