aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_os.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_os.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c101
1 files changed, 75 insertions, 26 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 0b12498b7672..549122dc68e6 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -178,7 +178,7 @@ void qla2x00_sp_compl(scsi_qla_host_t *ha, srb_t *);
178/* -------------------------------------------------------------------------- */ 178/* -------------------------------------------------------------------------- */
179 179
180static char * 180static char *
181qla2x00_get_pci_info_str(struct scsi_qla_host *ha, char *str) 181qla2x00_pci_info_str(struct scsi_qla_host *ha, char *str)
182{ 182{
183 static char *pci_bus_modes[] = { 183 static char *pci_bus_modes[] = {
184 "33", "66", "100", "133", 184 "33", "66", "100", "133",
@@ -201,7 +201,7 @@ qla2x00_get_pci_info_str(struct scsi_qla_host *ha, char *str)
201} 201}
202 202
203char * 203char *
204qla2x00_get_fw_version_str(struct scsi_qla_host *ha, char *str) 204qla2x00_fw_version_str(struct scsi_qla_host *ha, char *str)
205{ 205{
206 char un_str[10]; 206 char un_str[10];
207 207
@@ -493,7 +493,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
493 DEBUG3(qla2x00_print_scsi_cmd(cmd);) 493 DEBUG3(qla2x00_print_scsi_cmd(cmd);)
494 494
495 spin_unlock_irqrestore(&ha->hardware_lock, flags); 495 spin_unlock_irqrestore(&ha->hardware_lock, flags);
496 if (qla2x00_abort_command(ha, sp)) { 496 if (ha->isp_ops.abort_command(ha, sp)) {
497 DEBUG2(printk("%s(%ld): abort_command " 497 DEBUG2(printk("%s(%ld): abort_command "
498 "mbx failed.\n", __func__, ha->host_no)); 498 "mbx failed.\n", __func__, ha->host_no));
499 } else { 499 } else {
@@ -624,7 +624,7 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
624#if defined(LOGOUT_AFTER_DEVICE_RESET) 624#if defined(LOGOUT_AFTER_DEVICE_RESET)
625 if (ret == SUCCESS) { 625 if (ret == SUCCESS) {
626 if (fcport->flags & FC_FABRIC_DEVICE) { 626 if (fcport->flags & FC_FABRIC_DEVICE) {
627 qla2x00_fabric_logout(ha, fcport->loop_id); 627 ha->isp_ops.fabric_logout(ha, fcport->loop_id);
628 qla2x00_mark_device_lost(ha, fcport); 628 qla2x00_mark_device_lost(ha, fcport);
629 } 629 }
630 } 630 }
@@ -925,7 +925,7 @@ static int
925qla2x00_device_reset(scsi_qla_host_t *ha, fc_port_t *reset_fcport) 925qla2x00_device_reset(scsi_qla_host_t *ha, fc_port_t *reset_fcport)
926{ 926{
927 /* Abort Target command will clear Reservation */ 927 /* Abort Target command will clear Reservation */
928 return qla2x00_abort_target(reset_fcport); 928 return ha->isp_ops.abort_target(reset_fcport);
929} 929}
930 930
931static int 931static int
@@ -989,8 +989,6 @@ qla2x00_config_dma_addressing(scsi_qla_host_t *ha)
989{ 989{
990 /* Assume 32bit DMA address */ 990 /* Assume 32bit DMA address */
991 ha->flags.enable_64bit_addressing = 0; 991 ha->flags.enable_64bit_addressing = 0;
992 ha->calc_request_entries = qla2x00_calc_iocbs_32;
993 ha->build_scsi_iocbs = qla2x00_build_scsi_iocbs_32;
994 992
995 /* 993 /*
996 * Given the two variants pci_set_dma_mask(), allow the compiler to 994 * Given the two variants pci_set_dma_mask(), allow the compiler to
@@ -999,8 +997,8 @@ qla2x00_config_dma_addressing(scsi_qla_host_t *ha)
999 if (sizeof(dma_addr_t) > 4) { 997 if (sizeof(dma_addr_t) > 4) {
1000 if (pci_set_dma_mask(ha->pdev, DMA_64BIT_MASK) == 0) { 998 if (pci_set_dma_mask(ha->pdev, DMA_64BIT_MASK) == 0) {
1001 ha->flags.enable_64bit_addressing = 1; 999 ha->flags.enable_64bit_addressing = 1;
1002 ha->calc_request_entries = qla2x00_calc_iocbs_64; 1000 ha->isp_ops.calc_req_entries = qla2x00_calc_iocbs_64;
1003 ha->build_scsi_iocbs = qla2x00_build_scsi_iocbs_64; 1001 ha->isp_ops.build_iocbs = qla2x00_build_scsi_iocbs_64;
1004 1002
1005 if (pci_set_consistent_dma_mask(ha->pdev, 1003 if (pci_set_consistent_dma_mask(ha->pdev,
1006 DMA_64BIT_MASK)) { 1004 DMA_64BIT_MASK)) {
@@ -1087,6 +1085,35 @@ iospace_error_exit:
1087 return (-ENOMEM); 1085 return (-ENOMEM);
1088} 1086}
1089 1087
1088static void
1089qla2x00_enable_intrs(scsi_qla_host_t *ha)
1090{
1091 unsigned long flags = 0;
1092 device_reg_t __iomem *reg = ha->iobase;
1093
1094 spin_lock_irqsave(&ha->hardware_lock, flags);
1095 ha->interrupts_on = 1;
1096 /* enable risc and host interrupts */
1097 WRT_REG_WORD(&reg->ictrl, ICR_EN_INT | ICR_EN_RISC);
1098 RD_REG_WORD(&reg->ictrl);
1099 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1100
1101}
1102
1103static void
1104qla2x00_disable_intrs(scsi_qla_host_t *ha)
1105{
1106 unsigned long flags = 0;
1107 device_reg_t __iomem *reg = ha->iobase;
1108
1109 spin_lock_irqsave(&ha->hardware_lock, flags);
1110 ha->interrupts_on = 0;
1111 /* disable risc and host interrupts */
1112 WRT_REG_WORD(&reg->ictrl, 0);
1113 RD_REG_WORD(&reg->ictrl);
1114 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1115}
1116
1090/* 1117/*
1091 * PCI driver interface 1118 * PCI driver interface
1092 */ 1119 */
@@ -1140,6 +1167,28 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
1140 ha->prev_topology = 0; 1167 ha->prev_topology = 0;
1141 ha->ports = MAX_BUSES; 1168 ha->ports = MAX_BUSES;
1142 1169
1170 /* Assign ISP specific operations. */
1171 ha->isp_ops.pci_config = qla2100_pci_config;
1172 ha->isp_ops.reset_chip = qla2x00_reset_chip;
1173 ha->isp_ops.chip_diag = qla2x00_chip_diag;
1174 ha->isp_ops.config_rings = qla2x00_config_rings;
1175 ha->isp_ops.reset_adapter = qla2x00_reset_adapter;
1176 ha->isp_ops.nvram_config = qla2x00_nvram_config;
1177 ha->isp_ops.update_fw_options = qla2x00_update_fw_options;
1178 ha->isp_ops.pci_info_str = qla2x00_pci_info_str;
1179 ha->isp_ops.fw_version_str = qla2x00_fw_version_str;
1180 ha->isp_ops.intr_handler = qla2100_intr_handler;
1181 ha->isp_ops.enable_intrs = qla2x00_enable_intrs;
1182 ha->isp_ops.disable_intrs = qla2x00_disable_intrs;
1183 ha->isp_ops.abort_command = qla2x00_abort_command;
1184 ha->isp_ops.abort_target = qla2x00_abort_target;
1185 ha->isp_ops.fabric_login = qla2x00_login_fabric;
1186 ha->isp_ops.fabric_logout = qla2x00_fabric_logout;
1187 ha->isp_ops.calc_req_entries = qla2x00_calc_iocbs_32;
1188 ha->isp_ops.build_iocbs = qla2x00_build_scsi_iocbs_32;
1189 ha->isp_ops.prep_ms_iocb = qla2x00_prep_ms_iocb;
1190 ha->isp_ops.fw_dump = qla2100_fw_dump;
1191 ha->isp_ops.ascii_fw_dump = qla2100_ascii_fw_dump;
1143 if (IS_QLA2100(ha)) { 1192 if (IS_QLA2100(ha)) {
1144 host->max_id = MAX_TARGETS_2100; 1193 host->max_id = MAX_TARGETS_2100;
1145 ha->mbx_count = MAILBOX_REGISTER_COUNT_2100; 1194 ha->mbx_count = MAILBOX_REGISTER_COUNT_2100;
@@ -1147,18 +1196,25 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
1147 ha->response_q_length = RESPONSE_ENTRY_CNT_2100; 1196 ha->response_q_length = RESPONSE_ENTRY_CNT_2100;
1148 ha->last_loop_id = SNS_LAST_LOOP_ID_2100; 1197 ha->last_loop_id = SNS_LAST_LOOP_ID_2100;
1149 host->sg_tablesize = 32; 1198 host->sg_tablesize = 32;
1199 ha->gid_list_info_size = 4;
1150 } else if (IS_QLA2200(ha)) { 1200 } else if (IS_QLA2200(ha)) {
1151 host->max_id = MAX_TARGETS_2200; 1201 host->max_id = MAX_TARGETS_2200;
1152 ha->mbx_count = MAILBOX_REGISTER_COUNT; 1202 ha->mbx_count = MAILBOX_REGISTER_COUNT;
1153 ha->request_q_length = REQUEST_ENTRY_CNT_2200; 1203 ha->request_q_length = REQUEST_ENTRY_CNT_2200;
1154 ha->response_q_length = RESPONSE_ENTRY_CNT_2100; 1204 ha->response_q_length = RESPONSE_ENTRY_CNT_2100;
1155 ha->last_loop_id = SNS_LAST_LOOP_ID_2100; 1205 ha->last_loop_id = SNS_LAST_LOOP_ID_2100;
1206 ha->gid_list_info_size = 4;
1156 } else /*if (IS_QLA2300(ha))*/ { 1207 } else /*if (IS_QLA2300(ha))*/ {
1157 host->max_id = MAX_TARGETS_2200; 1208 host->max_id = MAX_TARGETS_2200;
1158 ha->mbx_count = MAILBOX_REGISTER_COUNT; 1209 ha->mbx_count = MAILBOX_REGISTER_COUNT;
1159 ha->request_q_length = REQUEST_ENTRY_CNT_2200; 1210 ha->request_q_length = REQUEST_ENTRY_CNT_2200;
1160 ha->response_q_length = RESPONSE_ENTRY_CNT_2300; 1211 ha->response_q_length = RESPONSE_ENTRY_CNT_2300;
1161 ha->last_loop_id = SNS_LAST_LOOP_ID_2300; 1212 ha->last_loop_id = SNS_LAST_LOOP_ID_2300;
1213 ha->isp_ops.pci_config = qla2300_pci_config;
1214 ha->isp_ops.intr_handler = qla2300_intr_handler;
1215 ha->isp_ops.fw_dump = qla2300_fw_dump;
1216 ha->isp_ops.ascii_fw_dump = qla2300_ascii_fw_dump;
1217 ha->gid_list_info_size = 6;
1162 } 1218 }
1163 host->can_queue = ha->request_q_length + 128; 1219 host->can_queue = ha->request_q_length + 128;
1164 1220
@@ -1229,12 +1285,8 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
1229 host->max_lun = MAX_LUNS; 1285 host->max_lun = MAX_LUNS;
1230 host->transportt = qla2xxx_transport_template; 1286 host->transportt = qla2xxx_transport_template;
1231 1287
1232 if (IS_QLA2100(ha) || IS_QLA2200(ha)) 1288 ret = request_irq(host->irq, ha->isp_ops.intr_handler,
1233 ret = request_irq(host->irq, qla2100_intr_handler, 1289 SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha);
1234 SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha);
1235 else
1236 ret = request_irq(host->irq, qla2300_intr_handler,
1237 SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha);
1238 if (ret) { 1290 if (ret) {
1239 qla_printk(KERN_WARNING, ha, 1291 qla_printk(KERN_WARNING, ha,
1240 "Failed to reserve interrupt %d already in use.\n", 1292 "Failed to reserve interrupt %d already in use.\n",
@@ -1250,8 +1302,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
1250 1302
1251 reg = ha->iobase; 1303 reg = ha->iobase;
1252 1304
1253 /* Disable ISP interrupts. */ 1305 ha->isp_ops.disable_intrs(ha);
1254 qla2x00_disable_intrs(ha);
1255 1306
1256 /* Ensure mailbox registers are free. */ 1307 /* Ensure mailbox registers are free. */
1257 spin_lock_irqsave(&ha->hardware_lock, flags); 1308 spin_lock_irqsave(&ha->hardware_lock, flags);
@@ -1270,8 +1321,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
1270 } 1321 }
1271 spin_unlock_irqrestore(&ha->hardware_lock, flags); 1322 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1272 1323
1273 /* Enable chip interrupts. */ 1324 ha->isp_ops.enable_intrs(ha);
1274 qla2x00_enable_intrs(ha);
1275 1325
1276 /* v2.19.5b6 */ 1326 /* v2.19.5b6 */
1277 /* 1327 /*
@@ -1306,9 +1356,9 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
1306 " QLogic %s - %s\n" 1356 " QLogic %s - %s\n"
1307 " %s: %s @ %s hdma%c, host#=%ld, fw=%s\n", qla2x00_version_str, 1357 " %s: %s @ %s hdma%c, host#=%ld, fw=%s\n", qla2x00_version_str,
1308 ha->model_number, ha->model_desc ? ha->model_desc: "", 1358 ha->model_number, ha->model_desc ? ha->model_desc: "",
1309 ha->brd_info->isp_name, qla2x00_get_pci_info_str(ha, pci_info), 1359 ha->brd_info->isp_name, ha->isp_ops.pci_info_str(ha, pci_info),
1310 pci_name(ha->pdev), ha->flags.enable_64bit_addressing ? '+': '-', 1360 pci_name(ha->pdev), ha->flags.enable_64bit_addressing ? '+': '-',
1311 ha->host_no, qla2x00_get_fw_version_str(ha, fw_str)); 1361 ha->host_no, ha->isp_ops.fw_version_str(ha, fw_str));
1312 1362
1313 /* Go with fc_rport registration. */ 1363 /* Go with fc_rport registration. */
1314 list_for_each_entry(fcport, &ha->fcports, list) 1364 list_for_each_entry(fcport, &ha->fcports, list)
@@ -1362,7 +1412,7 @@ qla2x00_free_device(scsi_qla_host_t *ha)
1362 1412
1363 /* turn-off interrupts on the card */ 1413 /* turn-off interrupts on the card */
1364 if (ha->interrupts_on) 1414 if (ha->interrupts_on)
1365 qla2x00_disable_intrs(ha); 1415 ha->isp_ops.disable_intrs(ha);
1366 1416
1367 /* Disable timer */ 1417 /* Disable timer */
1368 if (ha->timer_active) 1418 if (ha->timer_active)
@@ -1951,9 +2001,8 @@ qla2x00_do_dpc(void *data)
1951 if (fcport->flags & FCF_FABRIC_DEVICE) { 2001 if (fcport->flags & FCF_FABRIC_DEVICE) {
1952 if (fcport->flags & 2002 if (fcport->flags &
1953 FCF_TAPE_PRESENT) 2003 FCF_TAPE_PRESENT)
1954 qla2x00_fabric_logout( 2004 ha->isp_ops.fabric_logout(
1955 ha, 2005 ha, fcport->loop_id);
1956 fcport->loop_id);
1957 status = qla2x00_fabric_login( 2006 status = qla2x00_fabric_login(
1958 ha, fcport, &next_loopid); 2007 ha, fcport, &next_loopid);
1959 } else 2008 } else
@@ -2034,7 +2083,7 @@ qla2x00_do_dpc(void *data)
2034 } 2083 }
2035 2084
2036 if (!ha->interrupts_on) 2085 if (!ha->interrupts_on)
2037 qla2x00_enable_intrs(ha); 2086 ha->isp_ops.enable_intrs(ha);
2038 2087
2039 ha->dpc_active = 0; 2088 ha->dpc_active = 0;
2040 } /* End of while(1) */ 2089 } /* End of while(1) */