diff options
Diffstat (limited to 'drivers/pci/hotplug/pciehp_ctrl.c')
-rw-r--r-- | drivers/pci/hotplug/pciehp_ctrl.c | 90 |
1 files changed, 30 insertions, 60 deletions
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index 38f018679175..50628487597d 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |||
@@ -158,11 +158,8 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot) | |||
158 | { | 158 | { |
159 | /* turn off slot, turn on Amber LED, turn off Green LED if supported*/ | 159 | /* turn off slot, turn on Amber LED, turn off Green LED if supported*/ |
160 | if (POWER_CTRL(ctrl)) { | 160 | if (POWER_CTRL(ctrl)) { |
161 | if (pciehp_power_off_slot(pslot)) { | 161 | pciehp_power_off_slot(pslot); |
162 | ctrl_err(ctrl, | 162 | |
163 | "Issue of Slot Power Off command failed\n"); | ||
164 | return; | ||
165 | } | ||
166 | /* | 163 | /* |
167 | * After turning power off, we must wait for at least 1 second | 164 | * After turning power off, we must wait for at least 1 second |
168 | * before taking any action that relies on power having been | 165 | * before taking any action that relies on power having been |
@@ -171,16 +168,8 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot) | |||
171 | msleep(1000); | 168 | msleep(1000); |
172 | } | 169 | } |
173 | 170 | ||
174 | if (PWR_LED(ctrl)) | 171 | pciehp_green_led_off(pslot); |
175 | pciehp_green_led_off(pslot); | 172 | pciehp_set_attention_status(pslot, 1); |
176 | |||
177 | if (ATTN_LED(ctrl)) { | ||
178 | if (pciehp_set_attention_status(pslot, 1)) { | ||
179 | ctrl_err(ctrl, | ||
180 | "Issue of Set Attention Led command failed\n"); | ||
181 | return; | ||
182 | } | ||
183 | } | ||
184 | } | 173 | } |
185 | 174 | ||
186 | /** | 175 | /** |
@@ -203,8 +192,7 @@ static int board_added(struct slot *p_slot) | |||
203 | return retval; | 192 | return retval; |
204 | } | 193 | } |
205 | 194 | ||
206 | if (PWR_LED(ctrl)) | 195 | pciehp_green_led_blink(p_slot); |
207 | pciehp_green_led_blink(p_slot); | ||
208 | 196 | ||
209 | /* Check link training status */ | 197 | /* Check link training status */ |
210 | retval = pciehp_check_link_status(ctrl); | 198 | retval = pciehp_check_link_status(ctrl); |
@@ -227,9 +215,7 @@ static int board_added(struct slot *p_slot) | |||
227 | goto err_exit; | 215 | goto err_exit; |
228 | } | 216 | } |
229 | 217 | ||
230 | if (PWR_LED(ctrl)) | 218 | pciehp_green_led_on(p_slot); |
231 | pciehp_green_led_on(p_slot); | ||
232 | |||
233 | return 0; | 219 | return 0; |
234 | 220 | ||
235 | err_exit: | 221 | err_exit: |
@@ -243,7 +229,7 @@ err_exit: | |||
243 | */ | 229 | */ |
244 | static int remove_board(struct slot *p_slot) | 230 | static int remove_board(struct slot *p_slot) |
245 | { | 231 | { |
246 | int retval = 0; | 232 | int retval; |
247 | struct controller *ctrl = p_slot->ctrl; | 233 | struct controller *ctrl = p_slot->ctrl; |
248 | 234 | ||
249 | retval = pciehp_unconfigure_device(p_slot); | 235 | retval = pciehp_unconfigure_device(p_slot); |
@@ -251,13 +237,8 @@ static int remove_board(struct slot *p_slot) | |||
251 | return retval; | 237 | return retval; |
252 | 238 | ||
253 | if (POWER_CTRL(ctrl)) { | 239 | if (POWER_CTRL(ctrl)) { |
254 | /* power off slot */ | 240 | pciehp_power_off_slot(p_slot); |
255 | retval = pciehp_power_off_slot(p_slot); | 241 | |
256 | if (retval) { | ||
257 | ctrl_err(ctrl, | ||
258 | "Issue of Slot Disable command failed\n"); | ||
259 | return retval; | ||
260 | } | ||
261 | /* | 242 | /* |
262 | * After turning power off, we must wait for at least 1 second | 243 | * After turning power off, we must wait for at least 1 second |
263 | * before taking any action that relies on power having been | 244 | * before taking any action that relies on power having been |
@@ -267,9 +248,7 @@ static int remove_board(struct slot *p_slot) | |||
267 | } | 248 | } |
268 | 249 | ||
269 | /* turn off Green LED */ | 250 | /* turn off Green LED */ |
270 | if (PWR_LED(ctrl)) | 251 | pciehp_green_led_off(p_slot); |
271 | pciehp_green_led_off(p_slot); | ||
272 | |||
273 | return 0; | 252 | return 0; |
274 | } | 253 | } |
275 | 254 | ||
@@ -305,7 +284,7 @@ static void pciehp_power_thread(struct work_struct *work) | |||
305 | break; | 284 | break; |
306 | case POWERON_STATE: | 285 | case POWERON_STATE: |
307 | mutex_unlock(&p_slot->lock); | 286 | mutex_unlock(&p_slot->lock); |
308 | if (pciehp_enable_slot(p_slot) && PWR_LED(p_slot->ctrl)) | 287 | if (pciehp_enable_slot(p_slot)) |
309 | pciehp_green_led_off(p_slot); | 288 | pciehp_green_led_off(p_slot); |
310 | mutex_lock(&p_slot->lock); | 289 | mutex_lock(&p_slot->lock); |
311 | p_slot->state = STATIC_STATE; | 290 | p_slot->state = STATIC_STATE; |
@@ -372,11 +351,8 @@ static void handle_button_press_event(struct slot *p_slot) | |||
372 | "press.\n", slot_name(p_slot)); | 351 | "press.\n", slot_name(p_slot)); |
373 | } | 352 | } |
374 | /* blink green LED and turn off amber */ | 353 | /* blink green LED and turn off amber */ |
375 | if (PWR_LED(ctrl)) | 354 | pciehp_green_led_blink(p_slot); |
376 | pciehp_green_led_blink(p_slot); | 355 | pciehp_set_attention_status(p_slot, 0); |
377 | if (ATTN_LED(ctrl)) | ||
378 | pciehp_set_attention_status(p_slot, 0); | ||
379 | |||
380 | queue_delayed_work(p_slot->wq, &p_slot->work, 5*HZ); | 356 | queue_delayed_work(p_slot->wq, &p_slot->work, 5*HZ); |
381 | break; | 357 | break; |
382 | case BLINKINGOFF_STATE: | 358 | case BLINKINGOFF_STATE: |
@@ -389,14 +365,11 @@ static void handle_button_press_event(struct slot *p_slot) | |||
389 | ctrl_info(ctrl, "Button cancel on Slot(%s)\n", slot_name(p_slot)); | 365 | ctrl_info(ctrl, "Button cancel on Slot(%s)\n", slot_name(p_slot)); |
390 | cancel_delayed_work(&p_slot->work); | 366 | cancel_delayed_work(&p_slot->work); |
391 | if (p_slot->state == BLINKINGOFF_STATE) { | 367 | if (p_slot->state == BLINKINGOFF_STATE) { |
392 | if (PWR_LED(ctrl)) | 368 | pciehp_green_led_on(p_slot); |
393 | pciehp_green_led_on(p_slot); | ||
394 | } else { | 369 | } else { |
395 | if (PWR_LED(ctrl)) | 370 | pciehp_green_led_off(p_slot); |
396 | pciehp_green_led_off(p_slot); | ||
397 | } | 371 | } |
398 | if (ATTN_LED(ctrl)) | 372 | pciehp_set_attention_status(p_slot, 0); |
399 | pciehp_set_attention_status(p_slot, 0); | ||
400 | ctrl_info(ctrl, "PCI slot #%s - action canceled " | 373 | ctrl_info(ctrl, "PCI slot #%s - action canceled " |
401 | "due to button press\n", slot_name(p_slot)); | 374 | "due to button press\n", slot_name(p_slot)); |
402 | p_slot->state = STATIC_STATE; | 375 | p_slot->state = STATIC_STATE; |
@@ -456,10 +429,8 @@ static void interrupt_event_handler(struct work_struct *work) | |||
456 | case INT_POWER_FAULT: | 429 | case INT_POWER_FAULT: |
457 | if (!POWER_CTRL(ctrl)) | 430 | if (!POWER_CTRL(ctrl)) |
458 | break; | 431 | break; |
459 | if (ATTN_LED(ctrl)) | 432 | pciehp_set_attention_status(p_slot, 1); |
460 | pciehp_set_attention_status(p_slot, 1); | 433 | pciehp_green_led_off(p_slot); |
461 | if (PWR_LED(ctrl)) | ||
462 | pciehp_green_led_off(p_slot); | ||
463 | break; | 434 | break; |
464 | case INT_PRESENCE_ON: | 435 | case INT_PRESENCE_ON: |
465 | case INT_PRESENCE_OFF: | 436 | case INT_PRESENCE_OFF: |
@@ -482,14 +453,14 @@ int pciehp_enable_slot(struct slot *p_slot) | |||
482 | int rc; | 453 | int rc; |
483 | struct controller *ctrl = p_slot->ctrl; | 454 | struct controller *ctrl = p_slot->ctrl; |
484 | 455 | ||
485 | rc = pciehp_get_adapter_status(p_slot, &getstatus); | 456 | pciehp_get_adapter_status(p_slot, &getstatus); |
486 | if (rc || !getstatus) { | 457 | if (!getstatus) { |
487 | ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot)); | 458 | ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot)); |
488 | return -ENODEV; | 459 | return -ENODEV; |
489 | } | 460 | } |
490 | if (MRL_SENS(p_slot->ctrl)) { | 461 | if (MRL_SENS(p_slot->ctrl)) { |
491 | rc = pciehp_get_latch_status(p_slot, &getstatus); | 462 | pciehp_get_latch_status(p_slot, &getstatus); |
492 | if (rc || getstatus) { | 463 | if (getstatus) { |
493 | ctrl_info(ctrl, "Latch open on slot(%s)\n", | 464 | ctrl_info(ctrl, "Latch open on slot(%s)\n", |
494 | slot_name(p_slot)); | 465 | slot_name(p_slot)); |
495 | return -ENODEV; | 466 | return -ENODEV; |
@@ -497,8 +468,8 @@ int pciehp_enable_slot(struct slot *p_slot) | |||
497 | } | 468 | } |
498 | 469 | ||
499 | if (POWER_CTRL(p_slot->ctrl)) { | 470 | if (POWER_CTRL(p_slot->ctrl)) { |
500 | rc = pciehp_get_power_status(p_slot, &getstatus); | 471 | pciehp_get_power_status(p_slot, &getstatus); |
501 | if (rc || getstatus) { | 472 | if (getstatus) { |
502 | ctrl_info(ctrl, "Already enabled on slot(%s)\n", | 473 | ctrl_info(ctrl, "Already enabled on slot(%s)\n", |
503 | slot_name(p_slot)); | 474 | slot_name(p_slot)); |
504 | return -EINVAL; | 475 | return -EINVAL; |
@@ -518,15 +489,14 @@ int pciehp_enable_slot(struct slot *p_slot) | |||
518 | int pciehp_disable_slot(struct slot *p_slot) | 489 | int pciehp_disable_slot(struct slot *p_slot) |
519 | { | 490 | { |
520 | u8 getstatus = 0; | 491 | u8 getstatus = 0; |
521 | int ret = 0; | ||
522 | struct controller *ctrl = p_slot->ctrl; | 492 | struct controller *ctrl = p_slot->ctrl; |
523 | 493 | ||
524 | if (!p_slot->ctrl) | 494 | if (!p_slot->ctrl) |
525 | return 1; | 495 | return 1; |
526 | 496 | ||
527 | if (!HP_SUPR_RM(p_slot->ctrl)) { | 497 | if (!HP_SUPR_RM(p_slot->ctrl)) { |
528 | ret = pciehp_get_adapter_status(p_slot, &getstatus); | 498 | pciehp_get_adapter_status(p_slot, &getstatus); |
529 | if (ret || !getstatus) { | 499 | if (!getstatus) { |
530 | ctrl_info(ctrl, "No adapter on slot(%s)\n", | 500 | ctrl_info(ctrl, "No adapter on slot(%s)\n", |
531 | slot_name(p_slot)); | 501 | slot_name(p_slot)); |
532 | return -ENODEV; | 502 | return -ENODEV; |
@@ -534,8 +504,8 @@ int pciehp_disable_slot(struct slot *p_slot) | |||
534 | } | 504 | } |
535 | 505 | ||
536 | if (MRL_SENS(p_slot->ctrl)) { | 506 | if (MRL_SENS(p_slot->ctrl)) { |
537 | ret = pciehp_get_latch_status(p_slot, &getstatus); | 507 | pciehp_get_latch_status(p_slot, &getstatus); |
538 | if (ret || getstatus) { | 508 | if (getstatus) { |
539 | ctrl_info(ctrl, "Latch open on slot(%s)\n", | 509 | ctrl_info(ctrl, "Latch open on slot(%s)\n", |
540 | slot_name(p_slot)); | 510 | slot_name(p_slot)); |
541 | return -ENODEV; | 511 | return -ENODEV; |
@@ -543,8 +513,8 @@ int pciehp_disable_slot(struct slot *p_slot) | |||
543 | } | 513 | } |
544 | 514 | ||
545 | if (POWER_CTRL(p_slot->ctrl)) { | 515 | if (POWER_CTRL(p_slot->ctrl)) { |
546 | ret = pciehp_get_power_status(p_slot, &getstatus); | 516 | pciehp_get_power_status(p_slot, &getstatus); |
547 | if (ret || !getstatus) { | 517 | if (!getstatus) { |
548 | ctrl_info(ctrl, "Already disabled on slot(%s)\n", | 518 | ctrl_info(ctrl, "Already disabled on slot(%s)\n", |
549 | slot_name(p_slot)); | 519 | slot_name(p_slot)); |
550 | return -EINVAL; | 520 | return -EINVAL; |