aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/shpchp_ctrl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug/shpchp_ctrl.c')
-rw-r--r--drivers/pci/hotplug/shpchp_ctrl.c158
1 files changed, 89 insertions, 69 deletions
diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
index dfb53932dfb..b8ab2796e66 100644
--- a/drivers/pci/hotplug/shpchp_ctrl.c
+++ b/drivers/pci/hotplug/shpchp_ctrl.c
@@ -62,7 +62,7 @@ u8 shpchp_handle_attention_button(u8 hp_slot, struct controller *ctrl)
62 u32 event_type; 62 u32 event_type;
63 63
64 /* Attention Button Change */ 64 /* Attention Button Change */
65 dbg("shpchp: Attention button interrupt received.\n"); 65 ctrl_dbg(ctrl, "Attention button interrupt received\n");
66 66
67 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 67 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
68 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); 68 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save));
@@ -70,7 +70,7 @@ u8 shpchp_handle_attention_button(u8 hp_slot, struct controller *ctrl)
70 /* 70 /*
71 * Button pressed - See if need to TAKE ACTION!!! 71 * Button pressed - See if need to TAKE ACTION!!!
72 */ 72 */
73 info("Button pressed on Slot(%s)\n", p_slot->name); 73 ctrl_info(ctrl, "Button pressed on Slot(%s)\n", slot_name(p_slot));
74 event_type = INT_BUTTON_PRESS; 74 event_type = INT_BUTTON_PRESS;
75 75
76 queue_interrupt_event(p_slot, event_type); 76 queue_interrupt_event(p_slot, event_type);
@@ -86,29 +86,29 @@ u8 shpchp_handle_switch_change(u8 hp_slot, struct controller *ctrl)
86 u32 event_type; 86 u32 event_type;
87 87
88 /* Switch Change */ 88 /* Switch Change */
89 dbg("shpchp: Switch interrupt received.\n"); 89 ctrl_dbg(ctrl, "Switch interrupt received\n");
90 90
91 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 91 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
92 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); 92 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save));
93 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 93 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
94 dbg("%s: Card present %x Power status %x\n", __func__, 94 ctrl_dbg(ctrl, "Card present %x Power status %x\n",
95 p_slot->presence_save, p_slot->pwr_save); 95 p_slot->presence_save, p_slot->pwr_save);
96 96
97 if (getstatus) { 97 if (getstatus) {
98 /* 98 /*
99 * Switch opened 99 * Switch opened
100 */ 100 */
101 info("Latch open on Slot(%s)\n", p_slot->name); 101 ctrl_info(ctrl, "Latch open on Slot(%s)\n", slot_name(p_slot));
102 event_type = INT_SWITCH_OPEN; 102 event_type = INT_SWITCH_OPEN;
103 if (p_slot->pwr_save && p_slot->presence_save) { 103 if (p_slot->pwr_save && p_slot->presence_save) {
104 event_type = INT_POWER_FAULT; 104 event_type = INT_POWER_FAULT;
105 err("Surprise Removal of card\n"); 105 ctrl_err(ctrl, "Surprise Removal of card\n");
106 } 106 }
107 } else { 107 } else {
108 /* 108 /*
109 * Switch closed 109 * Switch closed
110 */ 110 */
111 info("Latch close on Slot(%s)\n", p_slot->name); 111 ctrl_info(ctrl, "Latch close on Slot(%s)\n", slot_name(p_slot));
112 event_type = INT_SWITCH_CLOSE; 112 event_type = INT_SWITCH_CLOSE;
113 } 113 }
114 114
@@ -123,7 +123,7 @@ u8 shpchp_handle_presence_change(u8 hp_slot, struct controller *ctrl)
123 u32 event_type; 123 u32 event_type;
124 124
125 /* Presence Change */ 125 /* Presence Change */
126 dbg("shpchp: Presence/Notify input change.\n"); 126 ctrl_dbg(ctrl, "Presence/Notify input change\n");
127 127
128 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 128 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
129 129
@@ -135,13 +135,15 @@ u8 shpchp_handle_presence_change(u8 hp_slot, struct controller *ctrl)
135 /* 135 /*
136 * Card Present 136 * Card Present
137 */ 137 */
138 info("Card present on Slot(%s)\n", p_slot->name); 138 ctrl_info(ctrl, "Card present on Slot(%s)\n",
139 slot_name(p_slot));
139 event_type = INT_PRESENCE_ON; 140 event_type = INT_PRESENCE_ON;
140 } else { 141 } else {
141 /* 142 /*
142 * Not Present 143 * Not Present
143 */ 144 */
144 info("Card not present on Slot(%s)\n", p_slot->name); 145 ctrl_info(ctrl, "Card not present on Slot(%s)\n",
146 slot_name(p_slot));
145 event_type = INT_PRESENCE_OFF; 147 event_type = INT_PRESENCE_OFF;
146 } 148 }
147 149
@@ -156,7 +158,7 @@ u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl)
156 u32 event_type; 158 u32 event_type;
157 159
158 /* Power fault */ 160 /* Power fault */
159 dbg("shpchp: Power fault interrupt received.\n"); 161 ctrl_dbg(ctrl, "Power fault interrupt received\n");
160 162
161 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 163 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
162 164
@@ -164,18 +166,19 @@ u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl)
164 /* 166 /*
165 * Power fault Cleared 167 * Power fault Cleared
166 */ 168 */
167 info("Power fault cleared on Slot(%s)\n", p_slot->name); 169 ctrl_info(ctrl, "Power fault cleared on Slot(%s)\n",
170 slot_name(p_slot));
168 p_slot->status = 0x00; 171 p_slot->status = 0x00;
169 event_type = INT_POWER_FAULT_CLEAR; 172 event_type = INT_POWER_FAULT_CLEAR;
170 } else { 173 } else {
171 /* 174 /*
172 * Power fault 175 * Power fault
173 */ 176 */
174 info("Power fault on Slot(%s)\n", p_slot->name); 177 ctrl_info(ctrl, "Power fault on Slot(%s)\n", slot_name(p_slot));
175 event_type = INT_POWER_FAULT; 178 event_type = INT_POWER_FAULT;
176 /* set power fault status for this board */ 179 /* set power fault status for this board */
177 p_slot->status = 0xFF; 180 p_slot->status = 0xFF;
178 info("power fault bit %x set\n", hp_slot); 181 ctrl_info(ctrl, "Power fault bit %x set\n", hp_slot);
179 } 182 }
180 183
181 queue_interrupt_event(p_slot, event_type); 184 queue_interrupt_event(p_slot, event_type);
@@ -191,10 +194,10 @@ static int change_bus_speed(struct controller *ctrl, struct slot *p_slot,
191{ 194{
192 int rc = 0; 195 int rc = 0;
193 196
194 dbg("%s: change to speed %d\n", __func__, speed); 197 ctrl_dbg(ctrl, "Change speed to %d\n", speed);
195 if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed))) { 198 if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed))) {
196 err("%s: Issue of set bus speed mode command failed\n", 199 ctrl_err(ctrl, "%s: Issue of set bus speed mode command "
197 __func__); 200 "failed\n", __func__);
198 return WRONG_BUS_FREQUENCY; 201 return WRONG_BUS_FREQUENCY;
199 } 202 }
200 return rc; 203 return rc;
@@ -212,8 +215,8 @@ static int fix_bus_speed(struct controller *ctrl, struct slot *pslot,
212 */ 215 */
213 if (flag) { 216 if (flag) {
214 if (asp < bsp) { 217 if (asp < bsp) {
215 err("%s: speed of bus %x and adapter %x mismatch\n", 218 ctrl_err(ctrl, "Speed of bus %x and adapter %x "
216 __func__, bsp, asp); 219 "mismatch\n", bsp, asp);
217 rc = WRONG_BUS_FREQUENCY; 220 rc = WRONG_BUS_FREQUENCY;
218 } 221 }
219 return rc; 222 return rc;
@@ -243,17 +246,18 @@ static int board_added(struct slot *p_slot)
243 int rc = 0; 246 int rc = 0;
244 enum pci_bus_speed asp, bsp, msp; 247 enum pci_bus_speed asp, bsp, msp;
245 struct controller *ctrl = p_slot->ctrl; 248 struct controller *ctrl = p_slot->ctrl;
249 struct pci_bus *parent = ctrl->pci_dev->subordinate;
246 250
247 hp_slot = p_slot->device - ctrl->slot_device_offset; 251 hp_slot = p_slot->device - ctrl->slot_device_offset;
248 252
249 dbg("%s: p_slot->device, slot_offset, hp_slot = %d, %d ,%d\n", 253 ctrl_dbg(ctrl,
250 __func__, p_slot->device, 254 "%s: p_slot->device, slot_offset, hp_slot = %d, %d ,%d\n",
251 ctrl->slot_device_offset, hp_slot); 255 __func__, p_slot->device, ctrl->slot_device_offset, hp_slot);
252 256
253 /* Power on slot without connecting to bus */ 257 /* Power on slot without connecting to bus */
254 rc = p_slot->hpc_ops->power_on_slot(p_slot); 258 rc = p_slot->hpc_ops->power_on_slot(p_slot);
255 if (rc) { 259 if (rc) {
256 err("%s: Failed to power on slot\n", __func__); 260 ctrl_err(ctrl, "Failed to power on slot\n");
257 return -1; 261 return -1;
258 } 262 }
259 263
@@ -262,33 +266,34 @@ static int board_added(struct slot *p_slot)
262 return WRONG_BUS_FREQUENCY; 266 return WRONG_BUS_FREQUENCY;
263 267
264 if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, PCI_SPEED_33MHz))) { 268 if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, PCI_SPEED_33MHz))) {
265 err("%s: Issue of set bus speed mode command failed\n", __func__); 269 ctrl_err(ctrl, "%s: Issue of set bus speed mode command"
270 " failed\n", __func__);
266 return WRONG_BUS_FREQUENCY; 271 return WRONG_BUS_FREQUENCY;
267 } 272 }
268 273
269 /* turn on board, blink green LED, turn off Amber LED */ 274 /* turn on board, blink green LED, turn off Amber LED */
270 if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) { 275 if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) {
271 err("%s: Issue of Slot Enable command failed\n", __func__); 276 ctrl_err(ctrl, "Issue of Slot Enable command failed\n");
272 return rc; 277 return rc;
273 } 278 }
274 } 279 }
275 280
276 rc = p_slot->hpc_ops->get_adapter_speed(p_slot, &asp); 281 rc = p_slot->hpc_ops->get_adapter_speed(p_slot, &asp);
277 if (rc) { 282 if (rc) {
278 err("%s: Can't get adapter speed or bus mode mismatch\n", 283 ctrl_err(ctrl, "Can't get adapter speed or "
279 __func__); 284 "bus mode mismatch\n");
280 return WRONG_BUS_FREQUENCY; 285 return WRONG_BUS_FREQUENCY;
281 } 286 }
282 287
283 rc = p_slot->hpc_ops->get_cur_bus_speed(p_slot, &bsp); 288 rc = p_slot->hpc_ops->get_cur_bus_speed(p_slot, &bsp);
284 if (rc) { 289 if (rc) {
285 err("%s: Can't get bus operation speed\n", __func__); 290 ctrl_err(ctrl, "Can't get bus operation speed\n");
286 return WRONG_BUS_FREQUENCY; 291 return WRONG_BUS_FREQUENCY;
287 } 292 }
288 293
289 rc = p_slot->hpc_ops->get_max_bus_speed(p_slot, &msp); 294 rc = p_slot->hpc_ops->get_max_bus_speed(p_slot, &msp);
290 if (rc) { 295 if (rc) {
291 err("%s: Can't get max bus operation speed\n", __func__); 296 ctrl_err(ctrl, "Can't get max bus operation speed\n");
292 msp = bsp; 297 msp = bsp;
293 } 298 }
294 299
@@ -296,9 +301,9 @@ static int board_added(struct slot *p_slot)
296 if (!list_empty(&ctrl->pci_dev->subordinate->devices)) 301 if (!list_empty(&ctrl->pci_dev->subordinate->devices))
297 slots_not_empty = 1; 302 slots_not_empty = 1;
298 303
299 dbg("%s: slots_not_empty %d, adapter_speed %d, bus_speed %d, " 304 ctrl_dbg(ctrl, "%s: slots_not_empty %d, adapter_speed %d, bus_speed %d,"
300 "max_bus_speed %d\n", __func__, slots_not_empty, asp, 305 " max_bus_speed %d\n", __func__, slots_not_empty, asp,
301 bsp, msp); 306 bsp, msp);
302 307
303 rc = fix_bus_speed(ctrl, p_slot, slots_not_empty, asp, bsp, msp); 308 rc = fix_bus_speed(ctrl, p_slot, slots_not_empty, asp, bsp, msp);
304 if (rc) 309 if (rc)
@@ -306,26 +311,26 @@ static int board_added(struct slot *p_slot)
306 311
307 /* turn on board, blink green LED, turn off Amber LED */ 312 /* turn on board, blink green LED, turn off Amber LED */
308 if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) { 313 if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) {
309 err("%s: Issue of Slot Enable command failed\n", __func__); 314 ctrl_err(ctrl, "Issue of Slot Enable command failed\n");
310 return rc; 315 return rc;
311 } 316 }
312 317
313 /* Wait for ~1 second */ 318 /* Wait for ~1 second */
314 msleep(1000); 319 msleep(1000);
315 320
316 dbg("%s: slot status = %x\n", __func__, p_slot->status); 321 ctrl_dbg(ctrl, "%s: slot status = %x\n", __func__, p_slot->status);
317 /* Check for a power fault */ 322 /* Check for a power fault */
318 if (p_slot->status == 0xFF) { 323 if (p_slot->status == 0xFF) {
319 /* power fault occurred, but it was benign */ 324 /* power fault occurred, but it was benign */
320 dbg("%s: power fault\n", __func__); 325 ctrl_dbg(ctrl, "%s: Power fault\n", __func__);
321 rc = POWER_FAILURE; 326 rc = POWER_FAILURE;
322 p_slot->status = 0; 327 p_slot->status = 0;
323 goto err_exit; 328 goto err_exit;
324 } 329 }
325 330
326 if (shpchp_configure_device(p_slot)) { 331 if (shpchp_configure_device(p_slot)) {
327 err("Cannot add device at 0x%x:0x%x\n", p_slot->bus, 332 ctrl_err(ctrl, "Cannot add device at %04x:%02x:%02x\n",
328 p_slot->device); 333 pci_domain_nr(parent), p_slot->bus, p_slot->device);
329 goto err_exit; 334 goto err_exit;
330 } 335 }
331 336
@@ -341,7 +346,8 @@ err_exit:
341 /* turn off slot, turn on Amber LED, turn off Green LED */ 346 /* turn off slot, turn on Amber LED, turn off Green LED */
342 rc = p_slot->hpc_ops->slot_disable(p_slot); 347 rc = p_slot->hpc_ops->slot_disable(p_slot);
343 if (rc) { 348 if (rc) {
344 err("%s: Issue of Slot Disable command failed\n", __func__); 349 ctrl_err(ctrl, "%s: Issue of Slot Disable command failed\n",
350 __func__);
345 return rc; 351 return rc;
346 } 352 }
347 353
@@ -365,7 +371,7 @@ static int remove_board(struct slot *p_slot)
365 hp_slot = p_slot->device - ctrl->slot_device_offset; 371 hp_slot = p_slot->device - ctrl->slot_device_offset;
366 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 372 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
367 373
368 dbg("In %s, hp_slot = %d\n", __func__, hp_slot); 374 ctrl_dbg(ctrl, "%s: hp_slot = %d\n", __func__, hp_slot);
369 375
370 /* Change status to shutdown */ 376 /* Change status to shutdown */
371 if (p_slot->is_a_board) 377 if (p_slot->is_a_board)
@@ -374,13 +380,14 @@ static int remove_board(struct slot *p_slot)
374 /* turn off slot, turn on Amber LED, turn off Green LED */ 380 /* turn off slot, turn on Amber LED, turn off Green LED */
375 rc = p_slot->hpc_ops->slot_disable(p_slot); 381 rc = p_slot->hpc_ops->slot_disable(p_slot);
376 if (rc) { 382 if (rc) {
377 err("%s: Issue of Slot Disable command failed\n", __func__); 383 ctrl_err(ctrl, "%s: Issue of Slot Disable command failed\n",
384 __func__);
378 return rc; 385 return rc;
379 } 386 }
380 387
381 rc = p_slot->hpc_ops->set_attention_status(p_slot, 0); 388 rc = p_slot->hpc_ops->set_attention_status(p_slot, 0);
382 if (rc) { 389 if (rc) {
383 err("%s: Issue of Set Attention command failed\n", __func__); 390 ctrl_err(ctrl, "Issue of Set Attention command failed\n");
384 return rc; 391 return rc;
385 } 392 }
386 393
@@ -439,7 +446,8 @@ void shpchp_queue_pushbutton_work(struct work_struct *work)
439 446
440 info = kmalloc(sizeof(*info), GFP_KERNEL); 447 info = kmalloc(sizeof(*info), GFP_KERNEL);
441 if (!info) { 448 if (!info) {
442 err("%s: Cannot allocate memory\n", __func__); 449 ctrl_err(p_slot->ctrl, "%s: Cannot allocate memory\n",
450 __func__);
443 return; 451 return;
444 } 452 }
445 info->p_slot = p_slot; 453 info->p_slot = p_slot;
@@ -486,18 +494,19 @@ static int update_slot_info (struct slot *slot)
486static void handle_button_press_event(struct slot *p_slot) 494static void handle_button_press_event(struct slot *p_slot)
487{ 495{
488 u8 getstatus; 496 u8 getstatus;
497 struct controller *ctrl = p_slot->ctrl;
489 498
490 switch (p_slot->state) { 499 switch (p_slot->state) {
491 case STATIC_STATE: 500 case STATIC_STATE:
492 p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 501 p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
493 if (getstatus) { 502 if (getstatus) {
494 p_slot->state = BLINKINGOFF_STATE; 503 p_slot->state = BLINKINGOFF_STATE;
495 info("PCI slot #%s - powering off due to button " 504 ctrl_info(ctrl, "PCI slot #%s - powering off due to "
496 "press.\n", p_slot->name); 505 "button press.\n", slot_name(p_slot));
497 } else { 506 } else {
498 p_slot->state = BLINKINGON_STATE; 507 p_slot->state = BLINKINGON_STATE;
499 info("PCI slot #%s - powering on due to button " 508 ctrl_info(ctrl, "PCI slot #%s - powering on due to "
500 "press.\n", p_slot->name); 509 "button press.\n", slot_name(p_slot));
501 } 510 }
502 /* blink green LED and turn off amber */ 511 /* blink green LED and turn off amber */
503 p_slot->hpc_ops->green_led_blink(p_slot); 512 p_slot->hpc_ops->green_led_blink(p_slot);
@@ -512,16 +521,16 @@ static void handle_button_press_event(struct slot *p_slot)
512 * press the attention again before the 5 sec. limit 521 * press the attention again before the 5 sec. limit
513 * expires to cancel hot-add or hot-remove 522 * expires to cancel hot-add or hot-remove
514 */ 523 */
515 info("Button cancel on Slot(%s)\n", p_slot->name); 524 ctrl_info(ctrl, "Button cancel on Slot(%s)\n",
516 dbg("%s: button cancel\n", __func__); 525 slot_name(p_slot));
517 cancel_delayed_work(&p_slot->work); 526 cancel_delayed_work(&p_slot->work);
518 if (p_slot->state == BLINKINGOFF_STATE) 527 if (p_slot->state == BLINKINGOFF_STATE)
519 p_slot->hpc_ops->green_led_on(p_slot); 528 p_slot->hpc_ops->green_led_on(p_slot);
520 else 529 else
521 p_slot->hpc_ops->green_led_off(p_slot); 530 p_slot->hpc_ops->green_led_off(p_slot);
522 p_slot->hpc_ops->set_attention_status(p_slot, 0); 531 p_slot->hpc_ops->set_attention_status(p_slot, 0);
523 info("PCI slot #%s - action canceled due to button press\n", 532 ctrl_info(ctrl, "PCI slot #%s - action canceled due to "
524 p_slot->name); 533 "button press\n", slot_name(p_slot));
525 p_slot->state = STATIC_STATE; 534 p_slot->state = STATIC_STATE;
526 break; 535 break;
527 case POWEROFF_STATE: 536 case POWEROFF_STATE:
@@ -531,11 +540,12 @@ static void handle_button_press_event(struct slot *p_slot)
531 * this means that the previous attention button action 540 * this means that the previous attention button action
532 * to hot-add or hot-remove is undergoing 541 * to hot-add or hot-remove is undergoing
533 */ 542 */
534 info("Button ignore on Slot(%s)\n", p_slot->name); 543 ctrl_info(ctrl, "Button ignore on Slot(%s)\n",
544 slot_name(p_slot));
535 update_slot_info(p_slot); 545 update_slot_info(p_slot);
536 break; 546 break;
537 default: 547 default:
538 warn("Not a valid state\n"); 548 ctrl_warn(ctrl, "Not a valid state\n");
539 break; 549 break;
540 } 550 }
541} 551}
@@ -551,7 +561,7 @@ static void interrupt_event_handler(struct work_struct *work)
551 handle_button_press_event(p_slot); 561 handle_button_press_event(p_slot);
552 break; 562 break;
553 case INT_POWER_FAULT: 563 case INT_POWER_FAULT:
554 dbg("%s: power fault\n", __func__); 564 ctrl_dbg(p_slot->ctrl, "%s: Power fault\n", __func__);
555 p_slot->hpc_ops->set_attention_status(p_slot, 1); 565 p_slot->hpc_ops->set_attention_status(p_slot, 1);
556 p_slot->hpc_ops->green_led_off(p_slot); 566 p_slot->hpc_ops->green_led_off(p_slot);
557 break; 567 break;
@@ -569,22 +579,24 @@ static int shpchp_enable_slot (struct slot *p_slot)
569{ 579{
570 u8 getstatus = 0; 580 u8 getstatus = 0;
571 int rc, retval = -ENODEV; 581 int rc, retval = -ENODEV;
582 struct controller *ctrl = p_slot->ctrl;
572 583
573 /* Check to see if (latch closed, card present, power off) */ 584 /* Check to see if (latch closed, card present, power off) */
574 mutex_lock(&p_slot->ctrl->crit_sect); 585 mutex_lock(&p_slot->ctrl->crit_sect);
575 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 586 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
576 if (rc || !getstatus) { 587 if (rc || !getstatus) {
577 info("No adapter on slot(%s)\n", p_slot->name); 588 ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot));
578 goto out; 589 goto out;
579 } 590 }
580 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 591 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
581 if (rc || getstatus) { 592 if (rc || getstatus) {
582 info("Latch open on slot(%s)\n", p_slot->name); 593 ctrl_info(ctrl, "Latch open on slot(%s)\n", slot_name(p_slot));
583 goto out; 594 goto out;
584 } 595 }
585 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 596 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
586 if (rc || getstatus) { 597 if (rc || getstatus) {
587 info("Already enabled on slot(%s)\n", p_slot->name); 598 ctrl_info(ctrl, "Already enabled on slot(%s)\n",
599 slot_name(p_slot));
588 goto out; 600 goto out;
589 } 601 }
590 602
@@ -593,7 +605,7 @@ static int shpchp_enable_slot (struct slot *p_slot)
593 /* We have to save the presence info for these slots */ 605 /* We have to save the presence info for these slots */
594 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); 606 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save));
595 p_slot->hpc_ops->get_power_status(p_slot, &(p_slot->pwr_save)); 607 p_slot->hpc_ops->get_power_status(p_slot, &(p_slot->pwr_save));
596 dbg("%s: p_slot->pwr_save %x\n", __func__, p_slot->pwr_save); 608 ctrl_dbg(ctrl, "%s: p_slot->pwr_save %x\n", __func__, p_slot->pwr_save);
597 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 609 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
598 610
599 if(((p_slot->ctrl->pci_dev->vendor == PCI_VENDOR_ID_AMD) || 611 if(((p_slot->ctrl->pci_dev->vendor == PCI_VENDOR_ID_AMD) ||
@@ -624,6 +636,7 @@ static int shpchp_disable_slot (struct slot *p_slot)
624{ 636{
625 u8 getstatus = 0; 637 u8 getstatus = 0;
626 int rc, retval = -ENODEV; 638 int rc, retval = -ENODEV;
639 struct controller *ctrl = p_slot->ctrl;
627 640
628 if (!p_slot->ctrl) 641 if (!p_slot->ctrl)
629 return -ENODEV; 642 return -ENODEV;
@@ -633,17 +646,18 @@ static int shpchp_disable_slot (struct slot *p_slot)
633 646
634 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 647 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
635 if (rc || !getstatus) { 648 if (rc || !getstatus) {
636 info("No adapter on slot(%s)\n", p_slot->name); 649 ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot));
637 goto out; 650 goto out;
638 } 651 }
639 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 652 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
640 if (rc || getstatus) { 653 if (rc || getstatus) {
641 info("Latch open on slot(%s)\n", p_slot->name); 654 ctrl_info(ctrl, "Latch open on slot(%s)\n", slot_name(p_slot));
642 goto out; 655 goto out;
643 } 656 }
644 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 657 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
645 if (rc || !getstatus) { 658 if (rc || !getstatus) {
646 info("Already disabled slot(%s)\n", p_slot->name); 659 ctrl_info(ctrl, "Already disabled on slot(%s)\n",
660 slot_name(p_slot));
647 goto out; 661 goto out;
648 } 662 }
649 663
@@ -657,6 +671,7 @@ static int shpchp_disable_slot (struct slot *p_slot)
657int shpchp_sysfs_enable_slot(struct slot *p_slot) 671int shpchp_sysfs_enable_slot(struct slot *p_slot)
658{ 672{
659 int retval = -ENODEV; 673 int retval = -ENODEV;
674 struct controller *ctrl = p_slot->ctrl;
660 675
661 mutex_lock(&p_slot->lock); 676 mutex_lock(&p_slot->lock);
662 switch (p_slot->state) { 677 switch (p_slot->state) {
@@ -670,15 +685,17 @@ int shpchp_sysfs_enable_slot(struct slot *p_slot)
670 p_slot->state = STATIC_STATE; 685 p_slot->state = STATIC_STATE;
671 break; 686 break;
672 case POWERON_STATE: 687 case POWERON_STATE:
673 info("Slot %s is already in powering on state\n", 688 ctrl_info(ctrl, "Slot %s is already in powering on state\n",
674 p_slot->name); 689 slot_name(p_slot));
675 break; 690 break;
676 case BLINKINGOFF_STATE: 691 case BLINKINGOFF_STATE:
677 case POWEROFF_STATE: 692 case POWEROFF_STATE:
678 info("Already enabled on slot %s\n", p_slot->name); 693 ctrl_info(ctrl, "Already enabled on slot %s\n",
694 slot_name(p_slot));
679 break; 695 break;
680 default: 696 default:
681 err("Not a valid state on slot %s\n", p_slot->name); 697 ctrl_err(ctrl, "Not a valid state on slot %s\n",
698 slot_name(p_slot));
682 break; 699 break;
683 } 700 }
684 mutex_unlock(&p_slot->lock); 701 mutex_unlock(&p_slot->lock);
@@ -689,6 +706,7 @@ int shpchp_sysfs_enable_slot(struct slot *p_slot)
689int shpchp_sysfs_disable_slot(struct slot *p_slot) 706int shpchp_sysfs_disable_slot(struct slot *p_slot)
690{ 707{
691 int retval = -ENODEV; 708 int retval = -ENODEV;
709 struct controller *ctrl = p_slot->ctrl;
692 710
693 mutex_lock(&p_slot->lock); 711 mutex_lock(&p_slot->lock);
694 switch (p_slot->state) { 712 switch (p_slot->state) {
@@ -702,15 +720,17 @@ int shpchp_sysfs_disable_slot(struct slot *p_slot)
702 p_slot->state = STATIC_STATE; 720 p_slot->state = STATIC_STATE;
703 break; 721 break;
704 case POWEROFF_STATE: 722 case POWEROFF_STATE:
705 info("Slot %s is already in powering off state\n", 723 ctrl_info(ctrl, "Slot %s is already in powering off state\n",
706 p_slot->name); 724 slot_name(p_slot));
707 break; 725 break;
708 case BLINKINGON_STATE: 726 case BLINKINGON_STATE:
709 case POWERON_STATE: 727 case POWERON_STATE:
710 info("Already disabled on slot %s\n", p_slot->name); 728 ctrl_info(ctrl, "Already disabled on slot %s\n",
729 slot_name(p_slot));
711 break; 730 break;
712 default: 731 default:
713 err("Not a valid state on slot %s\n", p_slot->name); 732 ctrl_err(ctrl, "Not a valid state on slot %s\n",
733 slot_name(p_slot));
714 break; 734 break;
715 } 735 }
716 mutex_unlock(&p_slot->lock); 736 mutex_unlock(&p_slot->lock);