aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla4xxx/ql4_os.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla4xxx/ql4_os.c')
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c124
1 files changed, 24 insertions, 100 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 5b8db6109536..969c9e431028 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -708,10 +708,10 @@ static int qla4xxx_cmd_wait(struct scsi_qla_host *ha)
708} 708}
709 709
710/** 710/**
711 * qla4010_soft_reset - performs soft reset. 711 * qla4xxx_soft_reset - performs soft reset.
712 * @ha: Pointer to host adapter structure. 712 * @ha: Pointer to host adapter structure.
713 **/ 713 **/
714static int qla4010_soft_reset(struct scsi_qla_host *ha) 714int qla4xxx_soft_reset(struct scsi_qla_host *ha)
715{ 715{
716 uint32_t max_wait_time; 716 uint32_t max_wait_time;
717 unsigned long flags = 0; 717 unsigned long flags = 0;
@@ -817,29 +817,6 @@ static int qla4010_soft_reset(struct scsi_qla_host *ha)
817} 817}
818 818
819/** 819/**
820 * qla4xxx_topcat_reset - performs hard reset of TopCat Chip.
821 * @ha: Pointer to host adapter structure.
822 **/
823static int qla4xxx_topcat_reset(struct scsi_qla_host *ha)
824{
825 unsigned long flags;
826
827 ql4xxx_lock_nvram(ha);
828 spin_lock_irqsave(&ha->hardware_lock, flags);
829 writel(set_rmask(GPOR_TOPCAT_RESET), isp_gp_out(ha));
830 readl(isp_gp_out(ha));
831 mdelay(1);
832
833 writel(clr_rmask(GPOR_TOPCAT_RESET), isp_gp_out(ha));
834 readl(isp_gp_out(ha));
835 spin_unlock_irqrestore(&ha->hardware_lock, flags);
836 mdelay(2523);
837
838 ql4xxx_unlock_nvram(ha);
839 return QLA_SUCCESS;
840}
841
842/**
843 * qla4xxx_flush_active_srbs - returns all outstanding i/o requests to O.S. 820 * qla4xxx_flush_active_srbs - returns all outstanding i/o requests to O.S.
844 * @ha: Pointer to host adapter structure. 821 * @ha: Pointer to host adapter structure.
845 * 822 *
@@ -867,26 +844,6 @@ static void qla4xxx_flush_active_srbs(struct scsi_qla_host *ha)
867} 844}
868 845
869/** 846/**
870 * qla4xxx_hard_reset - performs HBA Hard Reset
871 * @ha: Pointer to host adapter structure.
872 **/
873static int qla4xxx_hard_reset(struct scsi_qla_host *ha)
874{
875 /* The QLA4010 really doesn't have an equivalent to a hard reset */
876 qla4xxx_flush_active_srbs(ha);
877 if (test_bit(AF_TOPCAT_CHIP_PRESENT, &ha->flags)) {
878 int status = QLA_ERROR;
879
880 if ((qla4010_soft_reset(ha) == QLA_SUCCESS) &&
881 (qla4xxx_topcat_reset(ha) == QLA_SUCCESS) &&
882 (qla4010_soft_reset(ha) == QLA_SUCCESS))
883 status = QLA_SUCCESS;
884 return status;
885 } else
886 return qla4010_soft_reset(ha);
887}
888
889/**
890 * qla4xxx_recover_adapter - recovers adapter after a fatal error 847 * qla4xxx_recover_adapter - recovers adapter after a fatal error
891 * @ha: Pointer to host adapter structure. 848 * @ha: Pointer to host adapter structure.
892 * @renew_ddb_list: Indicates what to do with the adapter's ddb list 849 * @renew_ddb_list: Indicates what to do with the adapter's ddb list
@@ -919,18 +876,11 @@ static int qla4xxx_recover_adapter(struct scsi_qla_host *ha,
919 if (status == QLA_SUCCESS) { 876 if (status == QLA_SUCCESS) {
920 DEBUG2(printk("scsi%ld: %s - Performing soft reset..\n", 877 DEBUG2(printk("scsi%ld: %s - Performing soft reset..\n",
921 ha->host_no, __func__)); 878 ha->host_no, __func__));
922 status = qla4xxx_soft_reset(ha); 879 qla4xxx_flush_active_srbs(ha);
923 } 880 if (ql4xxx_lock_drvr_wait(ha) == QLA_SUCCESS)
924 /* FIXMEkaren: Do we want to keep interrupts enabled and process 881 status = qla4xxx_soft_reset(ha);
925 AENs after soft reset */ 882 else
926 883 status = QLA_ERROR;
927 /* If firmware (SOFT) reset failed, or if all outstanding
928 * commands have not returned, then do a HARD reset.
929 */
930 if (status == QLA_ERROR) {
931 DEBUG2(printk("scsi%ld: %s - Performing hard reset..\n",
932 ha->host_no, __func__));
933 status = qla4xxx_hard_reset(ha);
934 } 884 }
935 885
936 /* Flush any pending ddb changed AENs */ 886 /* Flush any pending ddb changed AENs */
@@ -1011,18 +961,15 @@ static int qla4xxx_recover_adapter(struct scsi_qla_host *ha,
1011 * the mid-level tries to sleep when it reaches the driver threshold 961 * the mid-level tries to sleep when it reaches the driver threshold
1012 * "host->can_queue". This can cause a panic if we were in our interrupt code. 962 * "host->can_queue". This can cause a panic if we were in our interrupt code.
1013 **/ 963 **/
1014static void qla4xxx_do_dpc(void *data) 964static void qla4xxx_do_dpc(struct work_struct *work)
1015{ 965{
1016 struct scsi_qla_host *ha = (struct scsi_qla_host *) data; 966 struct scsi_qla_host *ha =
967 container_of(work, struct scsi_qla_host, dpc_work);
1017 struct ddb_entry *ddb_entry, *dtemp; 968 struct ddb_entry *ddb_entry, *dtemp;
1018 969
1019 DEBUG2(printk("scsi%ld: %s: DPC handler waking up.\n", 970 DEBUG2(printk("scsi%ld: %s: DPC handler waking up."
1020 ha->host_no, __func__)); 971 "flags = 0x%08lx, dpc_flags = 0x%08lx\n",
1021 972 ha->host_no, __func__, ha->flags, ha->dpc_flags));
1022 DEBUG2(printk("scsi%ld: %s: ha->flags = 0x%08lx\n",
1023 ha->host_no, __func__, ha->flags));
1024 DEBUG2(printk("scsi%ld: %s: ha->dpc_flags = 0x%08lx\n",
1025 ha->host_no, __func__, ha->dpc_flags));
1026 973
1027 /* Initialization not yet finished. Don't do anything yet. */ 974 /* Initialization not yet finished. Don't do anything yet. */
1028 if (!test_bit(AF_INIT_DONE, &ha->flags)) 975 if (!test_bit(AF_INIT_DONE, &ha->flags))
@@ -1032,16 +979,8 @@ static void qla4xxx_do_dpc(void *data)
1032 test_bit(DPC_RESET_HA, &ha->dpc_flags) || 979 test_bit(DPC_RESET_HA, &ha->dpc_flags) ||
1033 test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags) || 980 test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags) ||
1034 test_bit(DPC_RESET_HA_DESTROY_DDB_LIST, &ha->dpc_flags)) { 981 test_bit(DPC_RESET_HA_DESTROY_DDB_LIST, &ha->dpc_flags)) {
1035 if (test_bit(DPC_RESET_HA_DESTROY_DDB_LIST, &ha->dpc_flags)) 982 if (test_bit(DPC_RESET_HA_DESTROY_DDB_LIST, &ha->dpc_flags) ||
1036 /* 983 test_bit(DPC_RESET_HA, &ha->dpc_flags))
1037 * dg 09/23 Never initialize ddb list
1038 * once we up and running
1039 * qla4xxx_recover_adapter(ha,
1040 * REBUILD_DDB_LIST);
1041 */
1042 qla4xxx_recover_adapter(ha, PRESERVE_DDB_LIST);
1043
1044 if (test_bit(DPC_RESET_HA, &ha->dpc_flags))
1045 qla4xxx_recover_adapter(ha, PRESERVE_DDB_LIST); 984 qla4xxx_recover_adapter(ha, PRESERVE_DDB_LIST);
1046 985
1047 if (test_and_clear_bit(DPC_RESET_HA_INTR, &ha->dpc_flags)) { 986 if (test_and_clear_bit(DPC_RESET_HA_INTR, &ha->dpc_flags)) {
@@ -1122,7 +1061,8 @@ static void qla4xxx_free_adapter(struct scsi_qla_host *ha)
1122 destroy_workqueue(ha->dpc_thread); 1061 destroy_workqueue(ha->dpc_thread);
1123 1062
1124 /* Issue Soft Reset to put firmware in unknown state */ 1063 /* Issue Soft Reset to put firmware in unknown state */
1125 qla4xxx_soft_reset(ha); 1064 if (ql4xxx_lock_drvr_wait(ha) == QLA_SUCCESS)
1065 qla4xxx_soft_reset(ha);
1126 1066
1127 /* Remove timer thread, if present */ 1067 /* Remove timer thread, if present */
1128 if (ha->timer_active) 1068 if (ha->timer_active)
@@ -1261,7 +1201,6 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev,
1261 init_waitqueue_head(&ha->mailbox_wait_queue); 1201 init_waitqueue_head(&ha->mailbox_wait_queue);
1262 1202
1263 spin_lock_init(&ha->hardware_lock); 1203 spin_lock_init(&ha->hardware_lock);
1264 spin_lock_init(&ha->list_lock);
1265 1204
1266 /* Allocate dma buffers */ 1205 /* Allocate dma buffers */
1267 if (qla4xxx_mem_alloc(ha)) { 1206 if (qla4xxx_mem_alloc(ha)) {
@@ -1315,7 +1254,7 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev,
1315 ret = -ENODEV; 1254 ret = -ENODEV;
1316 goto probe_failed; 1255 goto probe_failed;
1317 } 1256 }
1318 INIT_WORK(&ha->dpc_work, qla4xxx_do_dpc, ha); 1257 INIT_WORK(&ha->dpc_work, qla4xxx_do_dpc);
1319 1258
1320 ret = request_irq(pdev->irq, qla4xxx_intr_handler, 1259 ret = request_irq(pdev->irq, qla4xxx_intr_handler,
1321 SA_INTERRUPT|SA_SHIRQ, "qla4xxx", ha); 1260 SA_INTERRUPT|SA_SHIRQ, "qla4xxx", ha);
@@ -1468,27 +1407,6 @@ struct srb * qla4xxx_del_from_active_array(struct scsi_qla_host *ha, uint32_t in
1468} 1407}
1469 1408
1470/** 1409/**
1471 * qla4xxx_soft_reset - performs a SOFT RESET of hba.
1472 * @ha: Pointer to host adapter structure.
1473 **/
1474int qla4xxx_soft_reset(struct scsi_qla_host *ha)
1475{
1476
1477 DEBUG2(printk(KERN_WARNING "scsi%ld: %s: chip reset!\n", ha->host_no,
1478 __func__));
1479 if (test_bit(AF_TOPCAT_CHIP_PRESENT, &ha->flags)) {
1480 int status = QLA_ERROR;
1481
1482 if ((qla4010_soft_reset(ha) == QLA_SUCCESS) &&
1483 (qla4xxx_topcat_reset(ha) == QLA_SUCCESS) &&
1484 (qla4010_soft_reset(ha) == QLA_SUCCESS) )
1485 status = QLA_SUCCESS;
1486 return status;
1487 } else
1488 return qla4010_soft_reset(ha);
1489}
1490
1491/**
1492 * qla4xxx_eh_wait_on_command - waits for command to be returned by firmware 1410 * qla4xxx_eh_wait_on_command - waits for command to be returned by firmware
1493 * @ha: actual ha whose done queue will contain the comd returned by firmware. 1411 * @ha: actual ha whose done queue will contain the comd returned by firmware.
1494 * @cmd: Scsi Command to wait on. 1412 * @cmd: Scsi Command to wait on.
@@ -1686,6 +1604,12 @@ static struct pci_device_id qla4xxx_pci_tbl[] = {
1686 .subvendor = PCI_ANY_ID, 1604 .subvendor = PCI_ANY_ID,
1687 .subdevice = PCI_ANY_ID, 1605 .subdevice = PCI_ANY_ID,
1688 }, 1606 },
1607 {
1608 .vendor = PCI_VENDOR_ID_QLOGIC,
1609 .device = PCI_DEVICE_ID_QLOGIC_ISP4032,
1610 .subvendor = PCI_ANY_ID,
1611 .subdevice = PCI_ANY_ID,
1612 },
1689 {0, 0}, 1613 {0, 0},
1690}; 1614};
1691MODULE_DEVICE_TABLE(pci, qla4xxx_pci_tbl); 1615MODULE_DEVICE_TABLE(pci, qla4xxx_pci_tbl);