0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _CPCI_HOTPLUG_H
0015 #define _CPCI_HOTPLUG_H
0016
0017 #include <linux/types.h>
0018 #include <linux/pci.h>
0019 #include <linux/pci_hotplug.h>
0020
0021
0022 #define HS_CSR_INS 0x0080
0023 #define HS_CSR_EXT 0x0040
0024 #define HS_CSR_PI 0x0030
0025 #define HS_CSR_LOO 0x0008
0026 #define HS_CSR_PIE 0x0004
0027 #define HS_CSR_EIM 0x0002
0028 #define HS_CSR_DHA 0x0001
0029
0030 struct slot {
0031 u8 number;
0032 unsigned int devfn;
0033 struct pci_bus *bus;
0034 struct pci_dev *dev;
0035 unsigned int latch_status:1;
0036 unsigned int adapter_status:1;
0037 unsigned int extracting;
0038 struct hotplug_slot hotplug_slot;
0039 struct list_head slot_list;
0040 };
0041
0042 struct cpci_hp_controller_ops {
0043 int (*query_enum)(void);
0044 int (*enable_irq)(void);
0045 int (*disable_irq)(void);
0046 int (*check_irq)(void *dev_id);
0047 int (*hardware_test)(struct slot *slot, u32 value);
0048 u8 (*get_power)(struct slot *slot);
0049 int (*set_power)(struct slot *slot, int value);
0050 };
0051
0052 struct cpci_hp_controller {
0053 unsigned int irq;
0054 unsigned long irq_flags;
0055 char *devname;
0056 void *dev_id;
0057 char *name;
0058 struct cpci_hp_controller_ops *ops;
0059 };
0060
0061 static inline const char *slot_name(struct slot *slot)
0062 {
0063 return hotplug_slot_name(&slot->hotplug_slot);
0064 }
0065
0066 static inline struct slot *to_slot(struct hotplug_slot *hotplug_slot)
0067 {
0068 return container_of(hotplug_slot, struct slot, hotplug_slot);
0069 }
0070
0071 int cpci_hp_register_controller(struct cpci_hp_controller *controller);
0072 int cpci_hp_unregister_controller(struct cpci_hp_controller *controller);
0073 int cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last);
0074 int cpci_hp_unregister_bus(struct pci_bus *bus);
0075 int cpci_hp_start(void);
0076 int cpci_hp_stop(void);
0077
0078
0079 extern int cpci_debug;
0080
0081
0082
0083
0084
0085 u8 cpci_get_attention_status(struct slot *slot);
0086 u8 cpci_get_latch_status(struct slot *slot);
0087 u8 cpci_get_adapter_status(struct slot *slot);
0088 u16 cpci_get_hs_csr(struct slot *slot);
0089 int cpci_set_attention_status(struct slot *slot, int status);
0090 int cpci_check_and_clear_ins(struct slot *slot);
0091 int cpci_check_ext(struct slot *slot);
0092 int cpci_clear_ext(struct slot *slot);
0093 int cpci_led_on(struct slot *slot);
0094 int cpci_led_off(struct slot *slot);
0095 int cpci_configure_slot(struct slot *slot);
0096 int cpci_unconfigure_slot(struct slot *slot);
0097
0098 #ifdef CONFIG_HOTPLUG_PCI_CPCI
0099 int cpci_hotplug_init(int debug);
0100 #else
0101 static inline int cpci_hotplug_init(int debug) { return 0; }
0102 #endif
0103
0104 #endif