aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pci/hotplug/pciehp.h101
-rw-r--r--drivers/pci/hotplug/pciehp_core.c2
-rw-r--r--drivers/pci/hotplug/pciehp_ctrl.c6
3 files changed, 42 insertions, 67 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;
44extern int pciehp_debug; 44extern int pciehp_debug;
45extern int pciehp_force; 45extern 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
54struct slot { 60struct 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/* 148extern int pciehp_event_start_thread(void);
149 * error Messages 149extern void pciehp_event_stop_thread(void);
150 */ 150extern int pciehp_enable_slot(struct slot *slot);
151#define msg_initialization_err "Initialization failure, error=%d\n" 151extern 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 */
158extern int pciehp_event_start_thread (void);
159extern void pciehp_event_stop_thread (void);
160extern int pciehp_enable_slot (struct slot *slot);
161extern int pciehp_disable_slot (struct slot *slot);
162
163extern u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl); 152extern u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl);
164extern u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl); 153extern u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl);
165extern u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl); 154extern u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl);
166extern u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl); 155extern u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl);
167/* extern void long_delay (int delay); */ 156extern int pciehp_configure_device(struct slot *p_slot);
168 157extern int pciehp_unconfigure_device(struct slot *p_slot);
169/* pci functions */ 158int pcie_init(struct controller *ctrl, struct pcie_device *dev);
170extern int pciehp_configure_device (struct slot *p_slot);
171extern int pciehp_unconfigure_device (struct slot *p_slot);
172
173
174 159
175/* Global variables */ 160/* Global variables */
176extern struct controller *pciehp_ctrl_list; 161extern struct controller *pciehp_ctrl_list;
177 162
178/* Inline functions */
179
180static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device) 163static 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
193static inline int wait_for_ctrl_irq(struct controller *ctrl) 176static 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
213int pcie_init(struct controller *ctrl, struct pcie_device *dev);
214
215struct hpc_ops { 194struct 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)
247static inline int pciehp_get_hp_params_from_firmware(struct pci_dev *dev, 222static inline int pciehp_get_hp_params_from_firmware(struct pci_dev *dev,
248 struct hotplug_params *hpp) 223 struct hotplug_params *hpp)
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index b617613381d6..e2d45662bdbf 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -357,7 +357,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
357 /* Setup the slot information structures */ 357 /* Setup the slot information structures */
358 rc = init_slots(ctrl); 358 rc = init_slots(ctrl);
359 if (rc) { 359 if (rc) {
360 err(msg_initialization_err, 6); 360 err("%s: slot initialization failed\n", PCIE_MODULE_NAME);
361 goto err_out_release_ctlr; 361 goto err_out_release_ctlr;
362 } 362 }
363 363
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
index 5bca9212f5e1..072befa345a7 100644
--- a/drivers/pci/hotplug/pciehp_ctrl.c
+++ b/drivers/pci/hotplug/pciehp_ctrl.c
@@ -655,7 +655,7 @@ static void interrupt_event_handler(struct controller *ctrl)
655 warn("Not a valid state\n"); 655 warn("Not a valid state\n");
656 return; 656 return;
657 } 657 }
658 info(msg_button_cancel, slot_name(p_slot)); 658 info("PCI slot #%s - action canceled due to button press.\n", slot_name(p_slot));
659 p_slot->state = STATIC_STATE; 659 p_slot->state = STATIC_STATE;
660 } 660 }
661 /* ***********Button Pressed (No action on 1st press...) */ 661 /* ***********Button Pressed (No action on 1st press...) */
@@ -668,12 +668,12 @@ static void interrupt_event_handler(struct controller *ctrl)
668 /* slot is on */ 668 /* slot is on */
669 dbg("slot is on\n"); 669 dbg("slot is on\n");
670 p_slot->state = BLINKINGOFF_STATE; 670 p_slot->state = BLINKINGOFF_STATE;
671 info(msg_button_off, slot_name(p_slot)); 671 info("PCI slot #%s - powering off due to button press.\n", slot_name(p_slot));
672 } else { 672 } else {
673 /* slot is off */ 673 /* slot is off */
674 dbg("slot is off\n"); 674 dbg("slot is off\n");
675 p_slot->state = BLINKINGON_STATE; 675 p_slot->state = BLINKINGON_STATE;
676 info(msg_button_on, slot_name(p_slot)); 676 info("PCI slot #%s - powering on due to button press.\n", slot_name(p_slot));
677 } 677 }
678 678
679 /* Wait for exclusive access to hardware */ 679 /* Wait for exclusive access to hardware */