diff options
Diffstat (limited to 'drivers/pci/hotplug/pciehp_hpc.c')
-rw-r--r-- | drivers/pci/hotplug/pciehp_hpc.c | 60 |
1 files changed, 17 insertions, 43 deletions
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 3867d9c47ebd..8c34e84fc0c7 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
@@ -266,7 +266,7 @@ static void pcie_wait_link_active(struct controller *ctrl) | |||
266 | ctrl_dbg(ctrl, "Data Link Layer Link Active not set in 1000 msec\n"); | 266 | ctrl_dbg(ctrl, "Data Link Layer Link Active not set in 1000 msec\n"); |
267 | } | 267 | } |
268 | 268 | ||
269 | static int hpc_check_lnk_status(struct controller *ctrl) | 269 | int pciehp_check_link_status(struct controller *ctrl) |
270 | { | 270 | { |
271 | u16 lnk_status; | 271 | u16 lnk_status; |
272 | int retval = 0; | 272 | int retval = 0; |
@@ -305,7 +305,7 @@ static int hpc_check_lnk_status(struct controller *ctrl) | |||
305 | return retval; | 305 | return retval; |
306 | } | 306 | } |
307 | 307 | ||
308 | static int hpc_get_attention_status(struct slot *slot, u8 *status) | 308 | int pciehp_get_attention_status(struct slot *slot, u8 *status) |
309 | { | 309 | { |
310 | struct controller *ctrl = slot->ctrl; | 310 | struct controller *ctrl = slot->ctrl; |
311 | u16 slot_ctrl; | 311 | u16 slot_ctrl; |
@@ -344,7 +344,7 @@ static int hpc_get_attention_status(struct slot *slot, u8 *status) | |||
344 | return 0; | 344 | return 0; |
345 | } | 345 | } |
346 | 346 | ||
347 | static int hpc_get_power_status(struct slot *slot, u8 *status) | 347 | int pciehp_get_power_status(struct slot *slot, u8 *status) |
348 | { | 348 | { |
349 | struct controller *ctrl = slot->ctrl; | 349 | struct controller *ctrl = slot->ctrl; |
350 | u16 slot_ctrl; | 350 | u16 slot_ctrl; |
@@ -376,7 +376,7 @@ static int hpc_get_power_status(struct slot *slot, u8 *status) | |||
376 | return retval; | 376 | return retval; |
377 | } | 377 | } |
378 | 378 | ||
379 | static int hpc_get_latch_status(struct slot *slot, u8 *status) | 379 | int pciehp_get_latch_status(struct slot *slot, u8 *status) |
380 | { | 380 | { |
381 | struct controller *ctrl = slot->ctrl; | 381 | struct controller *ctrl = slot->ctrl; |
382 | u16 slot_status; | 382 | u16 slot_status; |
@@ -392,7 +392,7 @@ static int hpc_get_latch_status(struct slot *slot, u8 *status) | |||
392 | return 0; | 392 | return 0; |
393 | } | 393 | } |
394 | 394 | ||
395 | static int hpc_get_adapter_status(struct slot *slot, u8 *status) | 395 | int pciehp_get_adapter_status(struct slot *slot, u8 *status) |
396 | { | 396 | { |
397 | struct controller *ctrl = slot->ctrl; | 397 | struct controller *ctrl = slot->ctrl; |
398 | u16 slot_status; | 398 | u16 slot_status; |
@@ -408,7 +408,7 @@ static int hpc_get_adapter_status(struct slot *slot, u8 *status) | |||
408 | return 0; | 408 | return 0; |
409 | } | 409 | } |
410 | 410 | ||
411 | static int hpc_query_power_fault(struct slot *slot) | 411 | int pciehp_query_power_fault(struct slot *slot) |
412 | { | 412 | { |
413 | struct controller *ctrl = slot->ctrl; | 413 | struct controller *ctrl = slot->ctrl; |
414 | u16 slot_status; | 414 | u16 slot_status; |
@@ -422,7 +422,7 @@ static int hpc_query_power_fault(struct slot *slot) | |||
422 | return !!(slot_status & PCI_EXP_SLTSTA_PFD); | 422 | return !!(slot_status & PCI_EXP_SLTSTA_PFD); |
423 | } | 423 | } |
424 | 424 | ||
425 | static int hpc_set_attention_status(struct slot *slot, u8 value) | 425 | int pciehp_set_attention_status(struct slot *slot, u8 value) |
426 | { | 426 | { |
427 | struct controller *ctrl = slot->ctrl; | 427 | struct controller *ctrl = slot->ctrl; |
428 | u16 slot_cmd; | 428 | u16 slot_cmd; |
@@ -450,7 +450,7 @@ static int hpc_set_attention_status(struct slot *slot, u8 value) | |||
450 | return rc; | 450 | return rc; |
451 | } | 451 | } |
452 | 452 | ||
453 | static void hpc_set_green_led_on(struct slot *slot) | 453 | void pciehp_green_led_on(struct slot *slot) |
454 | { | 454 | { |
455 | struct controller *ctrl = slot->ctrl; | 455 | struct controller *ctrl = slot->ctrl; |
456 | u16 slot_cmd; | 456 | u16 slot_cmd; |
@@ -463,7 +463,7 @@ static void hpc_set_green_led_on(struct slot *slot) | |||
463 | __func__, ctrl->cap_base + PCI_EXP_SLTCTL, slot_cmd); | 463 | __func__, ctrl->cap_base + PCI_EXP_SLTCTL, slot_cmd); |
464 | } | 464 | } |
465 | 465 | ||
466 | static void hpc_set_green_led_off(struct slot *slot) | 466 | void pciehp_green_led_off(struct slot *slot) |
467 | { | 467 | { |
468 | struct controller *ctrl = slot->ctrl; | 468 | struct controller *ctrl = slot->ctrl; |
469 | u16 slot_cmd; | 469 | u16 slot_cmd; |
@@ -476,7 +476,7 @@ static void hpc_set_green_led_off(struct slot *slot) | |||
476 | __func__, ctrl->cap_base + PCI_EXP_SLTCTL, slot_cmd); | 476 | __func__, ctrl->cap_base + PCI_EXP_SLTCTL, slot_cmd); |
477 | } | 477 | } |
478 | 478 | ||
479 | static void hpc_set_green_led_blink(struct slot *slot) | 479 | void pciehp_green_led_blink(struct slot *slot) |
480 | { | 480 | { |
481 | struct controller *ctrl = slot->ctrl; | 481 | struct controller *ctrl = slot->ctrl; |
482 | u16 slot_cmd; | 482 | u16 slot_cmd; |
@@ -489,7 +489,7 @@ static void hpc_set_green_led_blink(struct slot *slot) | |||
489 | __func__, ctrl->cap_base + PCI_EXP_SLTCTL, slot_cmd); | 489 | __func__, ctrl->cap_base + PCI_EXP_SLTCTL, slot_cmd); |
490 | } | 490 | } |
491 | 491 | ||
492 | static int hpc_power_on_slot(struct slot * slot) | 492 | int pciehp_power_on_slot(struct slot * slot) |
493 | { | 493 | { |
494 | struct controller *ctrl = slot->ctrl; | 494 | struct controller *ctrl = slot->ctrl; |
495 | u16 slot_cmd; | 495 | u16 slot_cmd; |
@@ -568,7 +568,7 @@ static inline void pcie_unmask_bad_dllp(struct controller *ctrl) | |||
568 | pci_write_config_dword(dev, pos + PCI_ERR_COR_MASK, reg); | 568 | pci_write_config_dword(dev, pos + PCI_ERR_COR_MASK, reg); |
569 | } | 569 | } |
570 | 570 | ||
571 | static int hpc_power_off_slot(struct slot * slot) | 571 | int pciehp_power_off_slot(struct slot * slot) |
572 | { | 572 | { |
573 | struct controller *ctrl = slot->ctrl; | 573 | struct controller *ctrl = slot->ctrl; |
574 | u16 slot_cmd; | 574 | u16 slot_cmd; |
@@ -672,7 +672,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
672 | return IRQ_HANDLED; | 672 | return IRQ_HANDLED; |
673 | } | 673 | } |
674 | 674 | ||
675 | static int hpc_get_max_lnk_speed(struct slot *slot, enum pci_bus_speed *value) | 675 | int pciehp_get_max_link_speed(struct slot *slot, enum pci_bus_speed *value) |
676 | { | 676 | { |
677 | struct controller *ctrl = slot->ctrl; | 677 | struct controller *ctrl = slot->ctrl; |
678 | enum pcie_link_speed lnk_speed; | 678 | enum pcie_link_speed lnk_speed; |
@@ -703,7 +703,7 @@ static int hpc_get_max_lnk_speed(struct slot *slot, enum pci_bus_speed *value) | |||
703 | return retval; | 703 | return retval; |
704 | } | 704 | } |
705 | 705 | ||
706 | static int hpc_get_max_lnk_width(struct slot *slot, | 706 | int pciehp_get_max_lnk_width(struct slot *slot, |
707 | enum pcie_link_width *value) | 707 | enum pcie_link_width *value) |
708 | { | 708 | { |
709 | struct controller *ctrl = slot->ctrl; | 709 | struct controller *ctrl = slot->ctrl; |
@@ -753,7 +753,7 @@ static int hpc_get_max_lnk_width(struct slot *slot, | |||
753 | return retval; | 753 | return retval; |
754 | } | 754 | } |
755 | 755 | ||
756 | static int hpc_get_cur_lnk_speed(struct slot *slot, enum pci_bus_speed *value) | 756 | int pciehp_get_cur_link_speed(struct slot *slot, enum pci_bus_speed *value) |
757 | { | 757 | { |
758 | struct controller *ctrl = slot->ctrl; | 758 | struct controller *ctrl = slot->ctrl; |
759 | enum pcie_link_speed lnk_speed = PCI_SPEED_UNKNOWN; | 759 | enum pcie_link_speed lnk_speed = PCI_SPEED_UNKNOWN; |
@@ -785,7 +785,7 @@ static int hpc_get_cur_lnk_speed(struct slot *slot, enum pci_bus_speed *value) | |||
785 | return retval; | 785 | return retval; |
786 | } | 786 | } |
787 | 787 | ||
788 | static int hpc_get_cur_lnk_width(struct slot *slot, | 788 | int pciehp_get_cur_lnk_width(struct slot *slot, |
789 | enum pcie_link_width *value) | 789 | enum pcie_link_width *value) |
790 | { | 790 | { |
791 | struct controller *ctrl = slot->ctrl; | 791 | struct controller *ctrl = slot->ctrl; |
@@ -836,30 +836,6 @@ static int hpc_get_cur_lnk_width(struct slot *slot, | |||
836 | return retval; | 836 | return retval; |
837 | } | 837 | } |
838 | 838 | ||
839 | static void pcie_release_ctrl(struct controller *ctrl); | ||
840 | static struct hpc_ops pciehp_hpc_ops = { | ||
841 | .power_on_slot = hpc_power_on_slot, | ||
842 | .power_off_slot = hpc_power_off_slot, | ||
843 | .set_attention_status = hpc_set_attention_status, | ||
844 | .get_power_status = hpc_get_power_status, | ||
845 | .get_attention_status = hpc_get_attention_status, | ||
846 | .get_latch_status = hpc_get_latch_status, | ||
847 | .get_adapter_status = hpc_get_adapter_status, | ||
848 | |||
849 | .get_max_bus_speed = hpc_get_max_lnk_speed, | ||
850 | .get_cur_bus_speed = hpc_get_cur_lnk_speed, | ||
851 | .get_max_lnk_width = hpc_get_max_lnk_width, | ||
852 | .get_cur_lnk_width = hpc_get_cur_lnk_width, | ||
853 | |||
854 | .query_power_fault = hpc_query_power_fault, | ||
855 | .green_led_on = hpc_set_green_led_on, | ||
856 | .green_led_off = hpc_set_green_led_off, | ||
857 | .green_led_blink = hpc_set_green_led_blink, | ||
858 | |||
859 | .release_ctlr = pcie_release_ctrl, | ||
860 | .check_lnk_status = hpc_check_lnk_status, | ||
861 | }; | ||
862 | |||
863 | int pcie_enable_notification(struct controller *ctrl) | 839 | int pcie_enable_notification(struct controller *ctrl) |
864 | { | 840 | { |
865 | u16 cmd, mask; | 841 | u16 cmd, mask; |
@@ -925,7 +901,6 @@ static int pcie_init_slot(struct controller *ctrl) | |||
925 | return -ENOMEM; | 901 | return -ENOMEM; |
926 | 902 | ||
927 | slot->ctrl = ctrl; | 903 | slot->ctrl = ctrl; |
928 | slot->hpc_ops = ctrl->hpc_ops; | ||
929 | slot->number = PSN(ctrl); | 904 | slot->number = PSN(ctrl); |
930 | mutex_init(&slot->lock); | 905 | mutex_init(&slot->lock); |
931 | INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work); | 906 | INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work); |
@@ -1015,7 +990,6 @@ struct controller *pcie_init(struct pcie_device *dev) | |||
1015 | } | 990 | } |
1016 | 991 | ||
1017 | ctrl->slot_cap = slot_cap; | 992 | ctrl->slot_cap = slot_cap; |
1018 | ctrl->hpc_ops = &pciehp_hpc_ops; | ||
1019 | mutex_init(&ctrl->ctrl_lock); | 993 | mutex_init(&ctrl->ctrl_lock); |
1020 | init_waitqueue_head(&ctrl->queue); | 994 | init_waitqueue_head(&ctrl->queue); |
1021 | dbg_ctrl(ctrl); | 995 | dbg_ctrl(ctrl); |
@@ -1071,7 +1045,7 @@ abort: | |||
1071 | return NULL; | 1045 | return NULL; |
1072 | } | 1046 | } |
1073 | 1047 | ||
1074 | void pcie_release_ctrl(struct controller *ctrl) | 1048 | void pciehp_release_ctrl(struct controller *ctrl) |
1075 | { | 1049 | { |
1076 | pcie_shutdown_notification(ctrl); | 1050 | pcie_shutdown_notification(ctrl); |
1077 | pcie_cleanup_slot(ctrl); | 1051 | pcie_cleanup_slot(ctrl); |