aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/shpchp_hpc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug/shpchp_hpc.c')
-rw-r--r--drivers/pci/hotplug/shpchp_hpc.c47
1 files changed, 7 insertions, 40 deletions
diff --git a/drivers/pci/hotplug/shpchp_hpc.c b/drivers/pci/hotplug/shpchp_hpc.c
index d46a47603386..40905a6c8094 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