diff options
Diffstat (limited to 'drivers/pci/hotplug/pciehp.h')
-rw-r--r-- | drivers/pci/hotplug/pciehp.h | 101 |
1 files changed, 38 insertions, 63 deletions
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index b505515a07ae..e4524cf02427 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h | |||
@@ -44,11 +44,17 @@ extern int pciehp_poll_time; | |||
44 | extern int pciehp_debug; | 44 | extern int pciehp_debug; |
45 | extern int pciehp_force; | 45 | extern int pciehp_force; |
46 | 46 | ||
47 | /*#define dbg(format, arg...) do { if (pciehp_debug) printk(KERN_DEBUG "%s: " format, MY_NAME , ## arg); } while (0)*/ | 47 | #define dbg(format, arg...) \ |
48 | #define dbg(format, arg...) do { if (pciehp_debug) printk("%s: " format, MY_NAME , ## arg); } while (0) | 48 | do { \ |
49 | #define err(format, arg...) printk(KERN_ERR "%s: " format, MY_NAME , ## arg) | 49 | if (pciehp_debug) \ |
50 | #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg) | 50 | printk("%s: " format, MY_NAME , ## arg); \ |
51 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) | 51 | } while (0) |
52 | #define err(format, arg...) \ | ||
53 | printk(KERN_ERR "%s: " format, MY_NAME , ## arg) | ||
54 | #define info(format, arg...) \ | ||
55 | printk(KERN_INFO "%s: " format, MY_NAME , ## arg) | ||
56 | #define warn(format, arg...) \ | ||
57 | printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) | ||
52 | 58 | ||
53 | #define SLOT_NAME_SIZE 10 | 59 | #define SLOT_NAME_SIZE 10 |
54 | struct slot { | 60 | struct slot { |
@@ -113,8 +119,6 @@ struct controller { | |||
113 | #define POWERON_STATE 3 | 119 | #define POWERON_STATE 3 |
114 | #define POWEROFF_STATE 4 | 120 | #define POWEROFF_STATE 4 |
115 | 121 | ||
116 | #define PCI_TO_PCI_BRIDGE_CLASS 0x00060400 | ||
117 | |||
118 | /* Error messages */ | 122 | /* Error messages */ |
119 | #define INTERLOCK_OPEN 0x00000002 | 123 | #define INTERLOCK_OPEN 0x00000002 |
120 | #define ADD_NOT_SUPPORTED 0x00000003 | 124 | #define ADD_NOT_SUPPORTED 0x00000003 |
@@ -126,10 +130,6 @@ struct controller { | |||
126 | #define WRONG_BUS_FREQUENCY 0x0000000D | 130 | #define WRONG_BUS_FREQUENCY 0x0000000D |
127 | #define POWER_FAILURE 0x0000000E | 131 | #define POWER_FAILURE 0x0000000E |
128 | 132 | ||
129 | #define REMOVE_NOT_SUPPORTED 0x00000003 | ||
130 | |||
131 | #define DISABLE_CARD 1 | ||
132 | |||
133 | /* Field definitions in Slot Capabilities Register */ | 133 | /* Field definitions in Slot Capabilities Register */ |
134 | #define ATTN_BUTTN_PRSN 0x00000001 | 134 | #define ATTN_BUTTN_PRSN 0x00000001 |
135 | #define PWR_CTRL_PRSN 0x00000002 | 135 | #define PWR_CTRL_PRSN 0x00000002 |
@@ -145,38 +145,21 @@ struct controller { | |||
145 | #define PWR_LED(cap) (cap & PWR_LED_PRSN) | 145 | #define PWR_LED(cap) (cap & PWR_LED_PRSN) |
146 | #define HP_SUPR_RM(cap) (cap & HP_SUPR_RM_SUP) | 146 | #define HP_SUPR_RM(cap) (cap & HP_SUPR_RM_SUP) |
147 | 147 | ||
148 | /* | 148 | extern int pciehp_event_start_thread(void); |
149 | * error Messages | 149 | extern void pciehp_event_stop_thread(void); |
150 | */ | 150 | extern int pciehp_enable_slot(struct slot *slot); |
151 | #define msg_initialization_err "Initialization failure, error=%d\n" | 151 | extern int pciehp_disable_slot(struct slot *slot); |
152 | #define msg_button_on "PCI slot #%s - powering on due to button press.\n" | ||
153 | #define msg_button_off "PCI slot #%s - powering off due to button press.\n" | ||
154 | #define msg_button_cancel "PCI slot #%s - action canceled due to button press.\n" | ||
155 | #define msg_button_ignore "PCI slot #%s - button press ignored. (action in progress...)\n" | ||
156 | |||
157 | /* controller functions */ | ||
158 | extern int pciehp_event_start_thread (void); | ||
159 | extern void pciehp_event_stop_thread (void); | ||
160 | extern int pciehp_enable_slot (struct slot *slot); | ||
161 | extern int pciehp_disable_slot (struct slot *slot); | ||
162 | |||
163 | extern u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl); | 152 | extern u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl); |
164 | extern u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl); | 153 | extern u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl); |
165 | extern u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl); | 154 | extern u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl); |
166 | extern u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl); | 155 | extern u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl); |
167 | /* extern void long_delay (int delay); */ | 156 | extern int pciehp_configure_device(struct slot *p_slot); |
168 | 157 | extern int pciehp_unconfigure_device(struct slot *p_slot); | |
169 | /* pci functions */ | 158 | int pcie_init(struct controller *ctrl, struct pcie_device *dev); |
170 | extern int pciehp_configure_device (struct slot *p_slot); | ||
171 | extern int pciehp_unconfigure_device (struct slot *p_slot); | ||
172 | |||
173 | |||
174 | 159 | ||
175 | /* Global variables */ | 160 | /* Global variables */ |
176 | extern struct controller *pciehp_ctrl_list; | 161 | extern struct controller *pciehp_ctrl_list; |
177 | 162 | ||
178 | /* Inline functions */ | ||
179 | |||
180 | static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device) | 163 | static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device) |
181 | { | 164 | { |
182 | struct slot *slot; | 165 | struct slot *slot; |
@@ -192,8 +175,6 @@ static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device) | |||
192 | 175 | ||
193 | static inline int wait_for_ctrl_irq(struct controller *ctrl) | 176 | static inline int wait_for_ctrl_irq(struct controller *ctrl) |
194 | { | 177 | { |
195 | int retval = 0; | ||
196 | |||
197 | DECLARE_WAITQUEUE(wait, current); | 178 | DECLARE_WAITQUEUE(wait, current); |
198 | 179 | ||
199 | add_wait_queue(&ctrl->queue, &wait); | 180 | add_wait_queue(&ctrl->queue, &wait); |
@@ -205,44 +186,38 @@ static inline int wait_for_ctrl_irq(struct controller *ctrl) | |||
205 | 186 | ||
206 | remove_wait_queue(&ctrl->queue, &wait); | 187 | remove_wait_queue(&ctrl->queue, &wait); |
207 | if (signal_pending(current)) | 188 | if (signal_pending(current)) |
208 | retval = -EINTR; | 189 | return -EINTR; |
209 | 190 | ||
210 | return retval; | 191 | return 0; |
211 | } | 192 | } |
212 | 193 | ||
213 | int pcie_init(struct controller *ctrl, struct pcie_device *dev); | ||
214 | |||
215 | struct hpc_ops { | 194 | struct hpc_ops { |
216 | int (*power_on_slot) (struct slot *slot); | 195 | int (*power_on_slot)(struct slot *slot); |
217 | int (*power_off_slot) (struct slot *slot); | 196 | int (*power_off_slot)(struct slot *slot); |
218 | int (*get_power_status) (struct slot *slot, u8 *status); | 197 | int (*get_power_status)(struct slot *slot, u8 *status); |
219 | int (*get_attention_status) (struct slot *slot, u8 *status); | 198 | int (*get_attention_status)(struct slot *slot, u8 *status); |
220 | int (*set_attention_status) (struct slot *slot, u8 status); | 199 | int (*set_attention_status)(struct slot *slot, u8 status); |
221 | int (*get_latch_status) (struct slot *slot, u8 *status); | 200 | int (*get_latch_status)(struct slot *slot, u8 *status); |
222 | int (*get_adapter_status) (struct slot *slot, u8 *status); | 201 | int (*get_adapter_status)(struct slot *slot, u8 *status); |
223 | 202 | int (*get_max_bus_speed)(struct slot *slot, enum pci_bus_speed *speed); | |
224 | int (*get_max_bus_speed) (struct slot *slot, enum pci_bus_speed *speed); | 203 | int (*get_cur_bus_speed)(struct slot *slot, enum pci_bus_speed *speed); |
225 | int (*get_cur_bus_speed) (struct slot *slot, enum pci_bus_speed *speed); | 204 | int (*get_max_lnk_width)(struct slot *slot, enum pcie_link_width *val); |
226 | 205 | int (*get_cur_lnk_width)(struct slot *slot, enum pcie_link_width *val); | |
227 | int (*get_max_lnk_width) (struct slot *slot, enum pcie_link_width *value); | 206 | int (*query_power_fault)(struct slot *slot); |
228 | int (*get_cur_lnk_width) (struct slot *slot, enum pcie_link_width *value); | 207 | void (*green_led_on)(struct slot *slot); |
229 | 208 | void (*green_led_off)(struct slot *slot); | |
230 | int (*query_power_fault) (struct slot *slot); | 209 | void (*green_led_blink)(struct slot *slot); |
231 | void (*green_led_on) (struct slot *slot); | 210 | void (*release_ctlr)(struct controller *ctrl); |
232 | void (*green_led_off) (struct slot *slot); | 211 | int (*check_lnk_status)(struct controller *ctrl); |
233 | void (*green_led_blink) (struct slot *slot); | ||
234 | void (*release_ctlr) (struct controller *ctrl); | ||
235 | int (*check_lnk_status) (struct controller *ctrl); | ||
236 | }; | 212 | }; |
237 | 213 | ||
238 | |||
239 | #ifdef CONFIG_ACPI | 214 | #ifdef CONFIG_ACPI |
240 | #include <acpi/acpi.h> | 215 | #include <acpi/acpi.h> |
241 | #include <acpi/acpi_bus.h> | 216 | #include <acpi/acpi_bus.h> |
242 | #include <acpi/actypes.h> | 217 | #include <acpi/actypes.h> |
243 | #include <linux/pci-acpi.h> | 218 | #include <linux/pci-acpi.h> |
244 | 219 | ||
245 | #define pciehp_get_hp_hw_control_from_firmware(dev) \ | 220 | #define pciehp_get_hp_hw_control_from_firmware(dev) \ |
246 | pciehp_acpi_get_hp_hw_control_from_firmware(dev) | 221 | pciehp_acpi_get_hp_hw_control_from_firmware(dev) |
247 | static inline int pciehp_get_hp_params_from_firmware(struct pci_dev *dev, | 222 | static inline int pciehp_get_hp_params_from_firmware(struct pci_dev *dev, |
248 | struct hotplug_params *hpp) | 223 | struct hotplug_params *hpp) |