diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-07 20:31:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-07 20:31:27 -0400 |
commit | 0481990b758628e12f4b0a9e15094e70cefc7cd1 (patch) | |
tree | 67a4b4b7acc6a688b87ef2a2d3ec0e296e6e480c /drivers/scsi/qla2xxx/qla_os.c | |
parent | db400b3c4ee89d384d9163836a55577abdae772d (diff) | |
parent | 17fa53da1239b8712c5cebbd72a74c713b6c2db9 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-for-linus-2.6
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_os.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 117 |
1 files changed, 71 insertions, 46 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 9000659bfbcf..8982978c42fd 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -79,7 +79,7 @@ module_param(ql2xloginretrycount, int, S_IRUGO|S_IRUSR); | |||
79 | MODULE_PARM_DESC(ql2xloginretrycount, | 79 | MODULE_PARM_DESC(ql2xloginretrycount, |
80 | "Specify an alternate value for the NVRAM login retry count."); | 80 | "Specify an alternate value for the NVRAM login retry count."); |
81 | 81 | ||
82 | int ql2xfwloadbin; | 82 | int ql2xfwloadbin=1; |
83 | module_param(ql2xfwloadbin, int, S_IRUGO|S_IRUSR); | 83 | module_param(ql2xfwloadbin, int, S_IRUGO|S_IRUSR); |
84 | MODULE_PARM_DESC(ql2xfwloadbin, | 84 | MODULE_PARM_DESC(ql2xfwloadbin, |
85 | "Load ISP2xxx firmware image via hotplug."); | 85 | "Load ISP2xxx firmware image via hotplug."); |
@@ -88,6 +88,12 @@ static void qla2x00_free_device(scsi_qla_host_t *); | |||
88 | 88 | ||
89 | static void qla2x00_config_dma_addressing(scsi_qla_host_t *ha); | 89 | static void qla2x00_config_dma_addressing(scsi_qla_host_t *ha); |
90 | 90 | ||
91 | int ql2xfdmienable; | ||
92 | module_param(ql2xfdmienable, int, S_IRUGO|S_IRUSR); | ||
93 | MODULE_PARM_DESC(ql2xfdmienable, | ||
94 | "Enables FDMI registratons " | ||
95 | "Default is 0 - no FDMI. 1 - perfom FDMI."); | ||
96 | |||
91 | /* | 97 | /* |
92 | * SCSI host template entry points | 98 | * SCSI host template entry points |
93 | */ | 99 | */ |
@@ -105,6 +111,9 @@ static int qla2xxx_eh_host_reset(struct scsi_cmnd *); | |||
105 | static int qla2x00_loop_reset(scsi_qla_host_t *ha); | 111 | static int qla2x00_loop_reset(scsi_qla_host_t *ha); |
106 | static int qla2x00_device_reset(scsi_qla_host_t *, fc_port_t *); | 112 | static int qla2x00_device_reset(scsi_qla_host_t *, fc_port_t *); |
107 | 113 | ||
114 | static int qla2x00_change_queue_depth(struct scsi_device *, int); | ||
115 | static int qla2x00_change_queue_type(struct scsi_device *, int); | ||
116 | |||
108 | static struct scsi_host_template qla2x00_driver_template = { | 117 | static struct scsi_host_template qla2x00_driver_template = { |
109 | .module = THIS_MODULE, | 118 | .module = THIS_MODULE, |
110 | .name = "qla2xxx", | 119 | .name = "qla2xxx", |
@@ -119,6 +128,8 @@ static struct scsi_host_template qla2x00_driver_template = { | |||
119 | 128 | ||
120 | .slave_alloc = qla2xxx_slave_alloc, | 129 | .slave_alloc = qla2xxx_slave_alloc, |
121 | .slave_destroy = qla2xxx_slave_destroy, | 130 | .slave_destroy = qla2xxx_slave_destroy, |
131 | .change_queue_depth = qla2x00_change_queue_depth, | ||
132 | .change_queue_type = qla2x00_change_queue_type, | ||
122 | .this_id = -1, | 133 | .this_id = -1, |
123 | .cmd_per_lun = 3, | 134 | .cmd_per_lun = 3, |
124 | .use_clustering = ENABLE_CLUSTERING, | 135 | .use_clustering = ENABLE_CLUSTERING, |
@@ -129,6 +140,7 @@ static struct scsi_host_template qla2x00_driver_template = { | |||
129 | * which equates to 0x800000 sectors. | 140 | * which equates to 0x800000 sectors. |
130 | */ | 141 | */ |
131 | .max_sectors = 0xFFFF, | 142 | .max_sectors = 0xFFFF, |
143 | .shost_attrs = qla2x00_host_attrs, | ||
132 | }; | 144 | }; |
133 | 145 | ||
134 | static struct scsi_host_template qla24xx_driver_template = { | 146 | static struct scsi_host_template qla24xx_driver_template = { |
@@ -145,12 +157,15 @@ static struct scsi_host_template qla24xx_driver_template = { | |||
145 | 157 | ||
146 | .slave_alloc = qla2xxx_slave_alloc, | 158 | .slave_alloc = qla2xxx_slave_alloc, |
147 | .slave_destroy = qla2xxx_slave_destroy, | 159 | .slave_destroy = qla2xxx_slave_destroy, |
160 | .change_queue_depth = qla2x00_change_queue_depth, | ||
161 | .change_queue_type = qla2x00_change_queue_type, | ||
148 | .this_id = -1, | 162 | .this_id = -1, |
149 | .cmd_per_lun = 3, | 163 | .cmd_per_lun = 3, |
150 | .use_clustering = ENABLE_CLUSTERING, | 164 | .use_clustering = ENABLE_CLUSTERING, |
151 | .sg_tablesize = SG_ALL, | 165 | .sg_tablesize = SG_ALL, |
152 | 166 | ||
153 | .max_sectors = 0xFFFF, | 167 | .max_sectors = 0xFFFF, |
168 | .shost_attrs = qla2x00_host_attrs, | ||
154 | }; | 169 | }; |
155 | 170 | ||
156 | static struct scsi_transport_template *qla2xxx_transport_template = NULL; | 171 | static struct scsi_transport_template *qla2xxx_transport_template = NULL; |
@@ -487,14 +502,13 @@ qc24_fail_command: | |||
487 | static int | 502 | static int |
488 | qla2x00_eh_wait_on_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd) | 503 | qla2x00_eh_wait_on_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd) |
489 | { | 504 | { |
490 | #define ABORT_POLLING_PERIOD HZ | 505 | #define ABORT_POLLING_PERIOD 1000 |
491 | #define ABORT_WAIT_ITER ((10 * HZ) / (ABORT_POLLING_PERIOD)) | 506 | #define ABORT_WAIT_ITER ((10 * 1000) / (ABORT_POLLING_PERIOD)) |
492 | unsigned long wait_iter = ABORT_WAIT_ITER; | 507 | unsigned long wait_iter = ABORT_WAIT_ITER; |
493 | int ret = QLA_SUCCESS; | 508 | int ret = QLA_SUCCESS; |
494 | 509 | ||
495 | while (CMD_SP(cmd)) { | 510 | while (CMD_SP(cmd)) { |
496 | set_current_state(TASK_UNINTERRUPTIBLE); | 511 | msleep(ABORT_POLLING_PERIOD); |
497 | schedule_timeout(ABORT_POLLING_PERIOD); | ||
498 | 512 | ||
499 | if (--wait_iter) | 513 | if (--wait_iter) |
500 | break; | 514 | break; |
@@ -1016,7 +1030,7 @@ qla2x00_loop_reset(scsi_qla_host_t *ha) | |||
1016 | if (fcport->port_type != FCT_TARGET) | 1030 | if (fcport->port_type != FCT_TARGET) |
1017 | continue; | 1031 | continue; |
1018 | 1032 | ||
1019 | status = qla2x00_target_reset(ha, fcport); | 1033 | status = qla2x00_device_reset(ha, fcport); |
1020 | if (status != QLA_SUCCESS) | 1034 | if (status != QLA_SUCCESS) |
1021 | break; | 1035 | break; |
1022 | } | 1036 | } |
@@ -1103,6 +1117,28 @@ qla2xxx_slave_destroy(struct scsi_device *sdev) | |||
1103 | sdev->hostdata = NULL; | 1117 | sdev->hostdata = NULL; |
1104 | } | 1118 | } |
1105 | 1119 | ||
1120 | static int | ||
1121 | qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth) | ||
1122 | { | ||
1123 | scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth); | ||
1124 | return sdev->queue_depth; | ||
1125 | } | ||
1126 | |||
1127 | static int | ||
1128 | qla2x00_change_queue_type(struct scsi_device *sdev, int tag_type) | ||
1129 | { | ||
1130 | if (sdev->tagged_supported) { | ||
1131 | scsi_set_tag_type(sdev, tag_type); | ||
1132 | if (tag_type) | ||
1133 | scsi_activate_tcq(sdev, sdev->queue_depth); | ||
1134 | else | ||
1135 | scsi_deactivate_tcq(sdev, sdev->queue_depth); | ||
1136 | } else | ||
1137 | tag_type = 0; | ||
1138 | |||
1139 | return tag_type; | ||
1140 | } | ||
1141 | |||
1106 | /** | 1142 | /** |
1107 | * qla2x00_config_dma_addressing() - Configure OS DMA addressing method. | 1143 | * qla2x00_config_dma_addressing() - Configure OS DMA addressing method. |
1108 | * @ha: HA context | 1144 | * @ha: HA context |
@@ -1113,36 +1149,23 @@ qla2xxx_slave_destroy(struct scsi_device *sdev) | |||
1113 | static void | 1149 | static void |
1114 | qla2x00_config_dma_addressing(scsi_qla_host_t *ha) | 1150 | qla2x00_config_dma_addressing(scsi_qla_host_t *ha) |
1115 | { | 1151 | { |
1116 | /* Assume 32bit DMA address */ | 1152 | /* Assume a 32bit DMA mask. */ |
1117 | ha->flags.enable_64bit_addressing = 0; | 1153 | ha->flags.enable_64bit_addressing = 0; |
1118 | 1154 | ||
1119 | /* | 1155 | if (!dma_set_mask(&ha->pdev->dev, DMA_64BIT_MASK)) { |
1120 | * Given the two variants pci_set_dma_mask(), allow the compiler to | 1156 | /* Any upper-dword bits set? */ |
1121 | * assist in setting the proper dma mask. | 1157 | if (MSD(dma_get_required_mask(&ha->pdev->dev)) && |
1122 | */ | 1158 | !pci_set_consistent_dma_mask(ha->pdev, DMA_64BIT_MASK)) { |
1123 | if (sizeof(dma_addr_t) > 4) { | 1159 | /* Ok, a 64bit DMA mask is applicable. */ |
1124 | if (pci_set_dma_mask(ha->pdev, DMA_64BIT_MASK) == 0) { | ||
1125 | ha->flags.enable_64bit_addressing = 1; | 1160 | ha->flags.enable_64bit_addressing = 1; |
1126 | ha->isp_ops.calc_req_entries = qla2x00_calc_iocbs_64; | 1161 | ha->isp_ops.calc_req_entries = qla2x00_calc_iocbs_64; |
1127 | ha->isp_ops.build_iocbs = qla2x00_build_scsi_iocbs_64; | 1162 | ha->isp_ops.build_iocbs = qla2x00_build_scsi_iocbs_64; |
1128 | 1163 | return; | |
1129 | if (pci_set_consistent_dma_mask(ha->pdev, | ||
1130 | DMA_64BIT_MASK)) { | ||
1131 | qla_printk(KERN_DEBUG, ha, | ||
1132 | "Failed to set 64 bit PCI consistent mask; " | ||
1133 | "using 32 bit.\n"); | ||
1134 | pci_set_consistent_dma_mask(ha->pdev, | ||
1135 | DMA_32BIT_MASK); | ||
1136 | } | ||
1137 | } else { | ||
1138 | qla_printk(KERN_DEBUG, ha, | ||
1139 | "Failed to set 64 bit PCI DMA mask, falling back " | ||
1140 | "to 32 bit MASK.\n"); | ||
1141 | pci_set_dma_mask(ha->pdev, DMA_32BIT_MASK); | ||
1142 | } | 1164 | } |
1143 | } else { | ||
1144 | pci_set_dma_mask(ha->pdev, DMA_32BIT_MASK); | ||
1145 | } | 1165 | } |
1166 | |||
1167 | dma_set_mask(&ha->pdev->dev, DMA_32BIT_MASK); | ||
1168 | pci_set_consistent_dma_mask(ha->pdev, DMA_32BIT_MASK); | ||
1146 | } | 1169 | } |
1147 | 1170 | ||
1148 | static int | 1171 | static int |
@@ -1316,6 +1339,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1316 | ha->prev_topology = 0; | 1339 | ha->prev_topology = 0; |
1317 | ha->ports = MAX_BUSES; | 1340 | ha->ports = MAX_BUSES; |
1318 | ha->init_cb_size = sizeof(init_cb_t); | 1341 | ha->init_cb_size = sizeof(init_cb_t); |
1342 | ha->mgmt_svr_loop_id = MANAGEMENT_SERVER; | ||
1319 | 1343 | ||
1320 | /* Assign ISP specific operations. */ | 1344 | /* Assign ISP specific operations. */ |
1321 | ha->isp_ops.pci_config = qla2100_pci_config; | 1345 | ha->isp_ops.pci_config = qla2100_pci_config; |
@@ -1338,6 +1362,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1338 | ha->isp_ops.calc_req_entries = qla2x00_calc_iocbs_32; | 1362 | ha->isp_ops.calc_req_entries = qla2x00_calc_iocbs_32; |
1339 | ha->isp_ops.build_iocbs = qla2x00_build_scsi_iocbs_32; | 1363 | ha->isp_ops.build_iocbs = qla2x00_build_scsi_iocbs_32; |
1340 | ha->isp_ops.prep_ms_iocb = qla2x00_prep_ms_iocb; | 1364 | ha->isp_ops.prep_ms_iocb = qla2x00_prep_ms_iocb; |
1365 | ha->isp_ops.prep_ms_fdmi_iocb = qla2x00_prep_ms_fdmi_iocb; | ||
1341 | ha->isp_ops.read_nvram = qla2x00_read_nvram_data; | 1366 | ha->isp_ops.read_nvram = qla2x00_read_nvram_data; |
1342 | ha->isp_ops.write_nvram = qla2x00_write_nvram_data; | 1367 | ha->isp_ops.write_nvram = qla2x00_write_nvram_data; |
1343 | ha->isp_ops.fw_dump = qla2100_fw_dump; | 1368 | ha->isp_ops.fw_dump = qla2100_fw_dump; |
@@ -1375,6 +1400,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1375 | ha->response_q_length = RESPONSE_ENTRY_CNT_2300; | 1400 | ha->response_q_length = RESPONSE_ENTRY_CNT_2300; |
1376 | ha->last_loop_id = SNS_LAST_LOOP_ID_2300; | 1401 | ha->last_loop_id = SNS_LAST_LOOP_ID_2300; |
1377 | ha->init_cb_size = sizeof(struct init_cb_24xx); | 1402 | ha->init_cb_size = sizeof(struct init_cb_24xx); |
1403 | ha->mgmt_svr_loop_id = 10; | ||
1378 | ha->isp_ops.pci_config = qla24xx_pci_config; | 1404 | ha->isp_ops.pci_config = qla24xx_pci_config; |
1379 | ha->isp_ops.reset_chip = qla24xx_reset_chip; | 1405 | ha->isp_ops.reset_chip = qla24xx_reset_chip; |
1380 | ha->isp_ops.chip_diag = qla24xx_chip_diag; | 1406 | ha->isp_ops.chip_diag = qla24xx_chip_diag; |
@@ -1395,6 +1421,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1395 | ha->isp_ops.fabric_login = qla24xx_login_fabric; | 1421 | ha->isp_ops.fabric_login = qla24xx_login_fabric; |
1396 | ha->isp_ops.fabric_logout = qla24xx_fabric_logout; | 1422 | ha->isp_ops.fabric_logout = qla24xx_fabric_logout; |
1397 | ha->isp_ops.prep_ms_iocb = qla24xx_prep_ms_iocb; | 1423 | ha->isp_ops.prep_ms_iocb = qla24xx_prep_ms_iocb; |
1424 | ha->isp_ops.prep_ms_fdmi_iocb = qla24xx_prep_ms_fdmi_iocb; | ||
1398 | ha->isp_ops.read_nvram = qla24xx_read_nvram_data; | 1425 | ha->isp_ops.read_nvram = qla24xx_read_nvram_data; |
1399 | ha->isp_ops.write_nvram = qla24xx_write_nvram_data; | 1426 | ha->isp_ops.write_nvram = qla24xx_write_nvram_data; |
1400 | ha->isp_ops.fw_dump = qla24xx_fw_dump; | 1427 | ha->isp_ops.fw_dump = qla24xx_fw_dump; |
@@ -1558,8 +1585,6 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) | |||
1558 | return 0; | 1585 | return 0; |
1559 | 1586 | ||
1560 | probe_failed: | 1587 | probe_failed: |
1561 | fc_remove_host(ha->host); | ||
1562 | |||
1563 | qla2x00_free_device(ha); | 1588 | qla2x00_free_device(ha); |
1564 | 1589 | ||
1565 | scsi_host_put(host); | 1590 | scsi_host_put(host); |
@@ -1601,10 +1626,6 @@ qla2x00_free_device(scsi_qla_host_t *ha) | |||
1601 | if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) | 1626 | if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) |
1602 | qla2x00_cancel_io_descriptors(ha); | 1627 | qla2x00_cancel_io_descriptors(ha); |
1603 | 1628 | ||
1604 | /* turn-off interrupts on the card */ | ||
1605 | if (ha->interrupts_on) | ||
1606 | ha->isp_ops.disable_intrs(ha); | ||
1607 | |||
1608 | /* Disable timer */ | 1629 | /* Disable timer */ |
1609 | if (ha->timer_active) | 1630 | if (ha->timer_active) |
1610 | qla2x00_stop_timer(ha); | 1631 | qla2x00_stop_timer(ha); |
@@ -1624,8 +1645,14 @@ qla2x00_free_device(scsi_qla_host_t *ha) | |||
1624 | } | 1645 | } |
1625 | } | 1646 | } |
1626 | 1647 | ||
1627 | qla2x00_mem_free(ha); | 1648 | /* Stop currently executing firmware. */ |
1649 | qla2x00_stop_firmware(ha); | ||
1650 | |||
1651 | /* turn-off interrupts on the card */ | ||
1652 | if (ha->interrupts_on) | ||
1653 | ha->isp_ops.disable_intrs(ha); | ||
1628 | 1654 | ||
1655 | qla2x00_mem_free(ha); | ||
1629 | 1656 | ||
1630 | ha->flags.online = 0; | 1657 | ha->flags.online = 0; |
1631 | 1658 | ||
@@ -1934,7 +1961,7 @@ qla2x00_mem_free(scsi_qla_host_t *ha) | |||
1934 | { | 1961 | { |
1935 | struct list_head *fcpl, *fcptemp; | 1962 | struct list_head *fcpl, *fcptemp; |
1936 | fc_port_t *fcport; | 1963 | fc_port_t *fcport; |
1937 | unsigned long wtime;/* max wait time if mbx cmd is busy. */ | 1964 | unsigned int wtime;/* max wait time if mbx cmd is busy. */ |
1938 | 1965 | ||
1939 | if (ha == NULL) { | 1966 | if (ha == NULL) { |
1940 | /* error */ | 1967 | /* error */ |
@@ -1943,11 +1970,9 @@ qla2x00_mem_free(scsi_qla_host_t *ha) | |||
1943 | } | 1970 | } |
1944 | 1971 | ||
1945 | /* Make sure all other threads are stopped. */ | 1972 | /* Make sure all other threads are stopped. */ |
1946 | wtime = 60 * HZ; | 1973 | wtime = 60 * 1000; |
1947 | while (ha->dpc_wait && wtime) { | 1974 | while (ha->dpc_wait && wtime) |
1948 | set_current_state(TASK_INTERRUPTIBLE); | 1975 | wtime = msleep_interruptible(wtime); |
1949 | wtime = schedule_timeout(wtime); | ||
1950 | } | ||
1951 | 1976 | ||
1952 | /* free ioctl memory */ | 1977 | /* free ioctl memory */ |
1953 | qla2x00_free_ioctl_mem(ha); | 1978 | qla2x00_free_ioctl_mem(ha); |
@@ -2478,15 +2503,15 @@ qla2x00_timer(scsi_qla_host_t *ha) | |||
2478 | int | 2503 | int |
2479 | qla2x00_down_timeout(struct semaphore *sema, unsigned long timeout) | 2504 | qla2x00_down_timeout(struct semaphore *sema, unsigned long timeout) |
2480 | { | 2505 | { |
2481 | const unsigned int step = HZ/10; | 2506 | const unsigned int step = 100; /* msecs */ |
2507 | unsigned int iterations = jiffies_to_msecs(timeout)/100; | ||
2482 | 2508 | ||
2483 | do { | 2509 | do { |
2484 | if (!down_trylock(sema)) | 2510 | if (!down_trylock(sema)) |
2485 | return 0; | 2511 | return 0; |
2486 | set_current_state(TASK_INTERRUPTIBLE); | 2512 | if (msleep_interruptible(step)) |
2487 | if (schedule_timeout(step)) | ||
2488 | break; | 2513 | break; |
2489 | } while ((timeout -= step) > 0); | 2514 | } while (--iterations >= 0); |
2490 | 2515 | ||
2491 | return -ETIMEDOUT; | 2516 | return -ETIMEDOUT; |
2492 | } | 2517 | } |