aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug')
-rw-r--r--drivers/pci/hotplug/shpchp.h6
-rw-r--r--drivers/pci/hotplug/shpchp_core.c8
-rw-r--r--drivers/pci/hotplug/shpchp_ctrl.c11
-rw-r--r--drivers/pci/hotplug/shpchp_hpc.c47
4 files changed, 7 insertions, 65 deletions
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h
index ade8ec145e1..dae1543a4e2 100644
--- a/drivers/pci/hotplug/shpchp.h
+++ b/drivers/pci/hotplug/shpchp.h
@@ -293,12 +293,9 @@ static inline struct slot *shpchp_find_slot (struct controller *ctrl, u8 device)
293 293
294 p_slot = ctrl->slot; 294 p_slot = ctrl->slot;
295 295
296 dbg("p_slot = %p\n", p_slot);
297
298 while (p_slot && (p_slot->device != device)) { 296 while (p_slot && (p_slot->device != device)) {
299 tmp_slot = p_slot; 297 tmp_slot = p_slot;
300 p_slot = p_slot->next; 298 p_slot = p_slot->next;
301 dbg("In while loop, p_slot = %p\n", p_slot);
302 } 299 }
303 if (p_slot == NULL) { 300 if (p_slot == NULL) {
304 err("ERROR: shpchp_find_slot device=0x%x\n", device); 301 err("ERROR: shpchp_find_slot device=0x%x\n", device);
@@ -313,8 +310,6 @@ static inline int wait_for_ctrl_irq (struct controller *ctrl)
313 DECLARE_WAITQUEUE(wait, current); 310 DECLARE_WAITQUEUE(wait, current);
314 int retval = 0; 311 int retval = 0;
315 312
316 dbg("%s : start\n",__FUNCTION__);
317
318 add_wait_queue(&ctrl->queue, &wait); 313 add_wait_queue(&ctrl->queue, &wait);
319 314
320 if (!shpchp_poll_mode) { 315 if (!shpchp_poll_mode) {
@@ -328,7 +323,6 @@ static inline int wait_for_ctrl_irq (struct controller *ctrl)
328 if (signal_pending(current)) 323 if (signal_pending(current))
329 retval = -EINTR; 324 retval = -EINTR;
330 325
331 dbg("%s : end\n", __FUNCTION__);
332 return retval; 326 return retval;
333} 327}
334 328
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c
index 28ed2dc9388..6a2b4a0193a 100644
--- a/drivers/pci/hotplug/shpchp_core.c
+++ b/drivers/pci/hotplug/shpchp_core.c
@@ -105,8 +105,6 @@ static int init_slots(struct controller *ctrl)
105 u32 slot_number, sun; 105 u32 slot_number, sun;
106 int result = -ENOMEM; 106 int result = -ENOMEM;
107 107
108 dbg("%s\n",__FUNCTION__);
109
110 number_of_slots = ctrl->num_slots; 108 number_of_slots = ctrl->num_slots;
111 slot_device = ctrl->slot_device_offset; 109 slot_device = ctrl->slot_device_offset;
112 slot_number = ctrl->first_slot; 110 slot_number = ctrl->first_slot;
@@ -373,15 +371,12 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
373 } 371 }
374 memset(ctrl, 0, sizeof(struct controller)); 372 memset(ctrl, 0, sizeof(struct controller));
375 373
376 dbg("DRV_thread pid = %d\n", current->pid);
377
378 rc = shpc_init(ctrl, pdev); 374 rc = shpc_init(ctrl, pdev);
379 if (rc) { 375 if (rc) {
380 dbg("%s: controller initialization failed\n", SHPC_MODULE_NAME); 376 dbg("%s: controller initialization failed\n", SHPC_MODULE_NAME);
381 goto err_out_free_ctrl; 377 goto err_out_free_ctrl;
382 } 378 }
383 379
384 dbg("%s: controller initialization success\n", __FUNCTION__);
385 ctrl->pci_dev = pdev; /* pci_dev of the P2P bridge */ 380 ctrl->pci_dev = pdev; /* pci_dev of the P2P bridge */
386 381
387 pci_set_drvdata(pdev, ctrl); 382 pci_set_drvdata(pdev, ctrl);
@@ -488,8 +483,6 @@ static void __exit unload_shpchpd(void)
488 cleanup_slots(ctrl); 483 cleanup_slots(ctrl);
489 484
490 kfree (ctrl->pci_bus); 485 kfree (ctrl->pci_bus);
491
492 dbg("%s: calling release_ctlr\n", __FUNCTION__);
493 ctrl->hpc_ops->release_ctlr(ctrl); 486 ctrl->hpc_ops->release_ctlr(ctrl);
494 487
495 tctrl = ctrl; 488 tctrl = ctrl;
@@ -558,7 +551,6 @@ static void __exit shpcd_cleanup(void)
558 dbg("unload_shpchpd()\n"); 551 dbg("unload_shpchpd()\n");
559 unload_shpchpd(); 552 unload_shpchpd();
560 553
561 dbg("pci_unregister_driver\n");
562 pci_unregister_driver(&shpc_driver); 554 pci_unregister_driver(&shpc_driver);
563 555
564 info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n"); 556 info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n");
diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
index 8541180781e..58619359ad0 100644
--- a/drivers/pci/hotplug/shpchp_ctrl.c
+++ b/drivers/pci/hotplug/shpchp_ctrl.c
@@ -505,9 +505,7 @@ static int board_added(struct slot *p_slot)
505 up(&ctrl->crit_sect); 505 up(&ctrl->crit_sect);
506 506
507 /* Wait for ~1 second */ 507 /* Wait for ~1 second */
508 dbg("%s: before long_delay\n", __FUNCTION__);
509 wait_for_ctrl_irq (ctrl); 508 wait_for_ctrl_irq (ctrl);
510 dbg("%s: after long_delay\n", __FUNCTION__);
511 509
512 dbg("%s: slot status = %x\n", __FUNCTION__, p_slot->status); 510 dbg("%s: slot status = %x\n", __FUNCTION__, p_slot->status);
513 /* Check for a power fault */ 511 /* Check for a power fault */
@@ -666,13 +664,11 @@ static void shpchp_pushbutton_thread (unsigned long slot)
666 p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 664 p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
667 if (getstatus) { 665 if (getstatus) {
668 p_slot->state = POWEROFF_STATE; 666 p_slot->state = POWEROFF_STATE;
669 dbg("In power_down_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device);
670 667
671 shpchp_disable_slot(p_slot); 668 shpchp_disable_slot(p_slot);
672 p_slot->state = STATIC_STATE; 669 p_slot->state = STATIC_STATE;
673 } else { 670 } else {
674 p_slot->state = POWERON_STATE; 671 p_slot->state = POWERON_STATE;
675 dbg("In add_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device);
676 672
677 if (shpchp_enable_slot(p_slot)) { 673 if (shpchp_enable_slot(p_slot)) {
678 /* Wait for exclusive access to hardware */ 674 /* Wait for exclusive access to hardware */
@@ -734,7 +730,6 @@ int shpchp_event_start_thread (void)
734 err ("Can't start up our event thread\n"); 730 err ("Can't start up our event thread\n");
735 return -1; 731 return -1;
736 } 732 }
737 dbg("Our event thread pid = %d\n", pid);
738 return 0; 733 return 0;
739} 734}
740 735
@@ -742,9 +737,7 @@ int shpchp_event_start_thread (void)
742void shpchp_event_stop_thread (void) 737void shpchp_event_stop_thread (void)
743{ 738{
744 event_finished = 1; 739 event_finished = 1;
745 dbg("event_thread finish command given\n");
746 up(&event_semaphore); 740 up(&event_semaphore);
747 dbg("wait for event_thread to exit\n");
748 down(&event_exit); 741 down(&event_exit);
749} 742}
750 743
@@ -776,7 +769,6 @@ static void interrupt_event_handler(struct controller *ctrl)
776 u8 getstatus; 769 u8 getstatus;
777 struct slot *p_slot; 770 struct slot *p_slot;
778 771
779 dbg("%s:\n", __FUNCTION__);
780 while (change) { 772 while (change) {
781 change = 0; 773 change = 0;
782 774
@@ -788,9 +780,6 @@ static void interrupt_event_handler(struct controller *ctrl)
788 780
789 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 781 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
790 782
791 dbg("%s: hp_slot %d, p_slot %p\n",
792 __FUNCTION__, hp_slot, p_slot);
793
794 if (ctrl->event_queue[loop].event_type == INT_BUTTON_CANCEL) { 783 if (ctrl->event_queue[loop].event_type == INT_BUTTON_CANCEL) {
795 dbg("%s: button cancel\n", __FUNCTION__); 784 dbg("%s: button cancel\n", __FUNCTION__);
796 del_timer(&p_slot->task_event); 785 del_timer(&p_slot->task_event);
diff --git a/drivers/pci/hotplug/shpchp_hpc.c b/drivers/pci/hotplug/shpchp_hpc.c
index d46a4760338..40905a6c809 100644
--- a/drivers/pci/hotplug/shpchp_hpc.c
+++ b/drivers/pci/hotplug/shpchp_hpc.c
@@ -313,7 +313,6 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd)
313 * command. 313 * command.
314 */ 314 */
315 writew(temp_word, php_ctlr->creg + CMD); 315 writew(temp_word, php_ctlr->creg + CMD);
316 dbg("%s: temp_word written %x\n", __FUNCTION__, temp_word);
317 316
318 DBG_LEAVE_ROUTINE 317 DBG_LEAVE_ROUTINE
319 return retval; 318 return retval;
@@ -789,10 +788,8 @@ static void hpc_release_ctlr(struct controller *ctrl)
789 } 788 }
790 } 789 }
791 if (php_ctlr->pci_dev) { 790 if (php_ctlr->pci_dev) {
792 dbg("%s: before calling iounmap & release_mem_region\n", __FUNCTION__);
793 iounmap(php_ctlr->creg); 791 iounmap(php_ctlr->creg);
794 release_mem_region(pci_resource_start(php_ctlr->pci_dev, 0), pci_resource_len(php_ctlr->pci_dev, 0)); 792 release_mem_region(pci_resource_start(php_ctlr->pci_dev, 0), pci_resource_len(php_ctlr->pci_dev, 0));
795 dbg("%s: before calling iounmap & release_mem_region\n", __FUNCTION__);
796 php_ctlr->pci_dev = NULL; 793 php_ctlr->pci_dev = NULL;
797 } 794 }
798 795
@@ -1043,18 +1040,13 @@ static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs)
1043 1040
1044 if (!intr_loc) 1041 if (!intr_loc)
1045 return IRQ_NONE; 1042 return IRQ_NONE;
1046 dbg("%s: shpc_isr proceeds\n", __FUNCTION__);
1047 dbg("%s: intr_loc = %x\n",__FUNCTION__, intr_loc); 1043 dbg("%s: intr_loc = %x\n",__FUNCTION__, intr_loc);
1048 1044
1049 if(!shpchp_poll_mode) { 1045 if(!shpchp_poll_mode) {
1050 /* Mask Global Interrupt Mask - see implementation note on p. 139 */ 1046 /* Mask Global Interrupt Mask - see implementation note on p. 139 */
1051 /* of SHPC spec rev 1.0*/ 1047 /* of SHPC spec rev 1.0*/
1052 temp_dword = readl(php_ctlr->creg + SERR_INTR_ENABLE); 1048 temp_dword = readl(php_ctlr->creg + SERR_INTR_ENABLE);
1053 dbg("%s: Before masking global interrupt, temp_dword = %x\n",
1054 __FUNCTION__, temp_dword);
1055 temp_dword |= 0x00000001; 1049 temp_dword |= 0x00000001;
1056 dbg("%s: After masking global interrupt, temp_dword = %x\n",
1057 __FUNCTION__, temp_dword);
1058 writel(temp_dword, php_ctlr->creg + SERR_INTR_ENABLE); 1050 writel(temp_dword, php_ctlr->creg + SERR_INTR_ENABLE);
1059 1051
1060 intr_loc2 = readl(php_ctlr->creg + INTR_LOC); 1052 intr_loc2 = readl(php_ctlr->creg + INTR_LOC);
@@ -1068,11 +1060,7 @@ static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs)
1068 * Detect bit in Controller SERR-INT register 1060 * Detect bit in Controller SERR-INT register
1069 */ 1061 */
1070 temp_dword = readl(php_ctlr->creg + SERR_INTR_ENABLE); 1062 temp_dword = readl(php_ctlr->creg + SERR_INTR_ENABLE);
1071 dbg("%s: Before clearing CCIP, temp_dword = %x\n",
1072 __FUNCTION__, temp_dword);
1073 temp_dword &= 0xfffeffff; 1063 temp_dword &= 0xfffeffff;
1074 dbg("%s: After clearing CCIP, temp_dword = %x\n",
1075 __FUNCTION__, temp_dword);
1076 writel(temp_dword, php_ctlr->creg + SERR_INTR_ENABLE); 1064 writel(temp_dword, php_ctlr->creg + SERR_INTR_ENABLE);
1077 wake_up_interruptible(&ctrl->queue); 1065 wake_up_interruptible(&ctrl->queue);
1078 } 1066 }
@@ -1080,11 +1068,7 @@ static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs)
1080 if ((intr_loc = (intr_loc >> 1)) == 0) { 1068 if ((intr_loc = (intr_loc >> 1)) == 0) {
1081 /* Unmask Global Interrupt Mask */ 1069 /* Unmask Global Interrupt Mask */
1082 temp_dword = readl(php_ctlr->creg + SERR_INTR_ENABLE); 1070 temp_dword = readl(php_ctlr->creg + SERR_INTR_ENABLE);
1083 dbg("%s: 1-Before unmasking global interrupt, temp_dword = %x\n",
1084 __FUNCTION__, temp_dword);
1085 temp_dword &= 0xfffffffe; 1071 temp_dword &= 0xfffffffe;
1086 dbg("%s: 1-After unmasking global interrupt, temp_dword = %x\n",
1087 __FUNCTION__, temp_dword);
1088 writel(temp_dword, php_ctlr->creg + SERR_INTR_ENABLE); 1072 writel(temp_dword, php_ctlr->creg + SERR_INTR_ENABLE);
1089 1073
1090 return IRQ_NONE; 1074 return IRQ_NONE;
@@ -1094,11 +1078,9 @@ static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs)
1094 /* To find out which slot has interrupt pending */ 1078 /* To find out which slot has interrupt pending */
1095 if ((intr_loc >> hp_slot) & 0x01) { 1079 if ((intr_loc >> hp_slot) & 0x01) {
1096 temp_dword = readl(php_ctlr->creg + SLOT1 + (4*hp_slot)); 1080 temp_dword = readl(php_ctlr->creg + SLOT1 + (4*hp_slot));
1097 dbg("%s: Slot %x with intr, temp_dword = %x\n", 1081 dbg("%s: Slot %x with intr, slot register = %x\n",
1098 __FUNCTION__, hp_slot, temp_dword); 1082 __FUNCTION__, hp_slot, temp_dword);
1099 temp_byte = (temp_dword >> 16) & 0xFF; 1083 temp_byte = (temp_dword >> 16) & 0xFF;
1100 dbg("%s: Slot with intr, temp_byte = %x\n",
1101 __FUNCTION__, temp_byte);
1102 if ((php_ctlr->switch_change_callback) && (temp_byte & 0x08)) 1084 if ((php_ctlr->switch_change_callback) && (temp_byte & 0x08))
1103 schedule_flag += php_ctlr->switch_change_callback( 1085 schedule_flag += php_ctlr->switch_change_callback(
1104 hp_slot, php_ctlr->callback_instance_id); 1086 hp_slot, php_ctlr->callback_instance_id);
@@ -1114,8 +1096,6 @@ static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs)
1114 1096
1115 /* Clear all slot events */ 1097 /* Clear all slot events */
1116 temp_dword = 0xe01f3fff; 1098 temp_dword = 0xe01f3fff;
1117 dbg("%s: Clearing slot events, temp_dword = %x\n",
1118 __FUNCTION__, temp_dword);
1119 writel(temp_dword, php_ctlr->creg + SLOT1 + (4*hp_slot)); 1099 writel(temp_dword, php_ctlr->creg + SLOT1 + (4*hp_slot));
1120 1100
1121 intr_loc2 = readl(php_ctlr->creg + INTR_LOC); 1101 intr_loc2 = readl(php_ctlr->creg + INTR_LOC);
@@ -1125,11 +1105,7 @@ static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs)
1125 if (!shpchp_poll_mode) { 1105 if (!shpchp_poll_mode) {
1126 /* Unmask Global Interrupt Mask */ 1106 /* Unmask Global Interrupt Mask */
1127 temp_dword = readl(php_ctlr->creg + SERR_INTR_ENABLE); 1107 temp_dword = readl(php_ctlr->creg + SERR_INTR_ENABLE);
1128 dbg("%s: 2-Before unmasking global interrupt, temp_dword = %x\n",
1129 __FUNCTION__, temp_dword);
1130 temp_dword &= 0xfffffffe; 1108 temp_dword &= 0xfffffffe;
1131 dbg("%s: 2-After unmasking global interrupt, temp_dword = %x\n",
1132 __FUNCTION__, temp_dword);
1133 writel(temp_dword, php_ctlr->creg + SERR_INTR_ENABLE); 1109 writel(temp_dword, php_ctlr->creg + SERR_INTR_ENABLE);
1134 } 1110 }
1135 1111
@@ -1402,7 +1378,8 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
1402 err("%s : pci_read_config_dword failed\n", __FUNCTION__); 1378 err("%s : pci_read_config_dword failed\n", __FUNCTION__);
1403 goto abort_free_ctlr; 1379 goto abort_free_ctlr;
1404 } 1380 }
1405 dbg("%s: offset %d: tempdword %x\n", __FUNCTION__,i, tempdword); 1381 dbg("%s: offset %d: value %x\n", __FUNCTION__,i,
1382 tempdword);
1406 } 1383 }
1407 } 1384 }
1408 1385
@@ -1411,13 +1388,6 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
1411 first = 0; 1388 first = 0;
1412 } 1389 }
1413 1390
1414 dbg("pdev = %p: b:d:f:irq=0x%x:%x:%x:%x\n", pdev, pdev->bus->number, PCI_SLOT(pdev->devfn),
1415 PCI_FUNC(pdev->devfn), pdev->irq);
1416 for ( rc = 0; rc < DEVICE_COUNT_RESOURCE; rc++)
1417 if (pci_resource_len(pdev, rc) > 0)
1418 dbg("pci resource[%d] start=0x%lx(len=0x%lx), shpc_base_offset %x\n", rc,
1419 pci_resource_start(pdev, rc), pci_resource_len(pdev, rc), shpc_base_offset);
1420
1421 info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", pdev->vendor, pdev->device, pdev->subsystem_vendor, 1391 info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", pdev->vendor, pdev->device, pdev->subsystem_vendor,
1422 pdev->subsystem_device); 1392 pdev->subsystem_device);
1423 1393
@@ -1437,7 +1407,6 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
1437 goto abort_free_ctlr; 1407 goto abort_free_ctlr;
1438 } 1408 }
1439 dbg("%s: php_ctlr->creg %p\n", __FUNCTION__, php_ctlr->creg); 1409 dbg("%s: php_ctlr->creg %p\n", __FUNCTION__, php_ctlr->creg);
1440 dbg("%s: physical addr %p\n", __FUNCTION__, (void*)pci_resource_start(pdev, 0));
1441 1410
1442 init_MUTEX(&ctrl->crit_sect); 1411 init_MUTEX(&ctrl->crit_sect);
1443 /* Setup wait queue */ 1412 /* Setup wait queue */
@@ -1445,8 +1414,6 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
1445 1414
1446 /* Find the IRQ */ 1415 /* Find the IRQ */
1447 php_ctlr->irq = pdev->irq; 1416 php_ctlr->irq = pdev->irq;
1448 dbg("HPC interrupt = %d\n", php_ctlr->irq);
1449
1450 php_ctlr->attention_button_callback = shpchp_handle_attention_button, 1417 php_ctlr->attention_button_callback = shpchp_handle_attention_button,
1451 php_ctlr->switch_change_callback = shpchp_handle_switch_change; 1418 php_ctlr->switch_change_callback = shpchp_handle_switch_change;
1452 php_ctlr->presence_change_callback = shpchp_handle_presence_change; 1419 php_ctlr->presence_change_callback = shpchp_handle_presence_change;
@@ -1488,7 +1455,6 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
1488 if (rc) { 1455 if (rc) {
1489 info("Can't get msi for the hotplug controller\n"); 1456 info("Can't get msi for the hotplug controller\n");
1490 info("Use INTx for the hotplug controller\n"); 1457 info("Use INTx for the hotplug controller\n");
1491 dbg("%s: rc = %x\n", __FUNCTION__, rc);
1492 } else 1458 } else
1493 php_ctlr->irq = pdev->irq; 1459 php_ctlr->irq = pdev->irq;
1494 1460
@@ -1499,8 +1465,10 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
1499 goto abort_free_ctlr; 1465 goto abort_free_ctlr;
1500 } 1466 }
1501 } 1467 }
1468 dbg("%s: HPC at b:d:f:irq=0x%x:%x:%x:%x\n", __FUNCTION__,
1469 pdev->bus->number, PCI_SLOT(pdev->devfn),
1470 PCI_FUNC(pdev->devfn), pdev->irq);
1502 get_hp_hw_control_from_firmware(pdev); 1471 get_hp_hw_control_from_firmware(pdev);
1503 dbg("%s: Before adding HPC to HPC list\n", __FUNCTION__);
1504 1472
1505 /* Add this HPC instance into the HPC list */ 1473 /* Add this HPC instance into the HPC list */
1506 spin_lock(&list_lock); 1474 spin_lock(&list_lock);
@@ -1539,7 +1507,6 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
1539 dbg("%s: SERR_INTR_ENABLE = %x\n", __FUNCTION__, tempdword); 1507 dbg("%s: SERR_INTR_ENABLE = %x\n", __FUNCTION__, tempdword);
1540 } 1508 }
1541 1509
1542 dbg("%s: Leaving shpc_init\n", __FUNCTION__);
1543 DBG_LEAVE_ROUTINE 1510 DBG_LEAVE_ROUTINE
1544 return 0; 1511 return 0;
1545 1512