diff options
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_os.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 66 |
1 files changed, 38 insertions, 28 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 208607be78c7..cbe0cad83b68 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -95,6 +95,8 @@ MODULE_PARM_DESC(ql2xqfullrampup, | |||
95 | */ | 95 | */ |
96 | static int qla2xxx_slave_configure(struct scsi_device * device); | 96 | static int qla2xxx_slave_configure(struct scsi_device * device); |
97 | static int qla2xxx_slave_alloc(struct scsi_device *); | 97 | static int qla2xxx_slave_alloc(struct scsi_device *); |
98 | static int qla2xxx_scan_finished(struct Scsi_Host *, unsigned long time); | ||
99 | static void qla2xxx_scan_start(struct Scsi_Host *); | ||
98 | static void qla2xxx_slave_destroy(struct scsi_device *); | 100 | static void qla2xxx_slave_destroy(struct scsi_device *); |
99 | static int qla2x00_queuecommand(struct scsi_cmnd *cmd, | 101 | static int qla2x00_queuecommand(struct scsi_cmnd *cmd, |
100 | void (*fn)(struct scsi_cmnd *)); | 102 | void (*fn)(struct scsi_cmnd *)); |
@@ -124,6 +126,8 @@ static struct scsi_host_template qla2x00_driver_template = { | |||
124 | 126 | ||
125 | .slave_alloc = qla2xxx_slave_alloc, | 127 | .slave_alloc = qla2xxx_slave_alloc, |
126 | .slave_destroy = qla2xxx_slave_destroy, | 128 | .slave_destroy = qla2xxx_slave_destroy, |
129 | .scan_finished = qla2xxx_scan_finished, | ||
130 | .scan_start = qla2xxx_scan_start, | ||
127 | .change_queue_depth = qla2x00_change_queue_depth, | 131 | .change_queue_depth = qla2x00_change_queue_depth, |
128 | .change_queue_type = qla2x00_change_queue_type, | 132 | .change_queue_type = qla2x00_change_queue_type, |
129 | .this_id = -1, | 133 | .this_id = -1, |
@@ -287,7 +291,7 @@ qla24xx_pci_info_str(struct scsi_qla_host *ha, char *str) | |||
287 | return str; | 291 | return str; |
288 | } | 292 | } |
289 | 293 | ||
290 | char * | 294 | static char * |
291 | qla2x00_fw_version_str(struct scsi_qla_host *ha, char *str) | 295 | qla2x00_fw_version_str(struct scsi_qla_host *ha, char *str) |
292 | { | 296 | { |
293 | char un_str[10]; | 297 | char un_str[10]; |
@@ -325,7 +329,7 @@ qla2x00_fw_version_str(struct scsi_qla_host *ha, char *str) | |||
325 | return (str); | 329 | return (str); |
326 | } | 330 | } |
327 | 331 | ||
328 | char * | 332 | static char * |
329 | qla24xx_fw_version_str(struct scsi_qla_host *ha, char *str) | 333 | qla24xx_fw_version_str(struct scsi_qla_host *ha, char *str) |
330 | { | 334 | { |
331 | sprintf(str, "%d.%02d.%02d ", ha->fw_major_version, | 335 | sprintf(str, "%d.%02d.%02d ", ha->fw_major_version, |
@@ -634,7 +638,7 @@ qla2x00_block_error_handler(struct scsi_cmnd *cmnd) | |||
634 | * Note: | 638 | * Note: |
635 | * Only return FAILED if command not returned by firmware. | 639 | * Only return FAILED if command not returned by firmware. |
636 | **************************************************************************/ | 640 | **************************************************************************/ |
637 | int | 641 | static int |
638 | qla2xxx_eh_abort(struct scsi_cmnd *cmd) | 642 | qla2xxx_eh_abort(struct scsi_cmnd *cmd) |
639 | { | 643 | { |
640 | scsi_qla_host_t *ha = to_qla_host(cmd->device->host); | 644 | scsi_qla_host_t *ha = to_qla_host(cmd->device->host); |
@@ -771,7 +775,7 @@ qla2x00_eh_wait_for_pending_target_commands(scsi_qla_host_t *ha, unsigned int t) | |||
771 | * SUCCESS/FAILURE (defined as macro in scsi.h). | 775 | * SUCCESS/FAILURE (defined as macro in scsi.h). |
772 | * | 776 | * |
773 | **************************************************************************/ | 777 | **************************************************************************/ |
774 | int | 778 | static int |
775 | qla2xxx_eh_device_reset(struct scsi_cmnd *cmd) | 779 | qla2xxx_eh_device_reset(struct scsi_cmnd *cmd) |
776 | { | 780 | { |
777 | scsi_qla_host_t *ha = to_qla_host(cmd->device->host); | 781 | scsi_qla_host_t *ha = to_qla_host(cmd->device->host); |
@@ -902,7 +906,7 @@ qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *ha) | |||
902 | * SUCCESS/FAILURE (defined as macro in scsi.h). | 906 | * SUCCESS/FAILURE (defined as macro in scsi.h). |
903 | * | 907 | * |
904 | **************************************************************************/ | 908 | **************************************************************************/ |
905 | int | 909 | static int |
906 | qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) | 910 | qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) |
907 | { | 911 | { |
908 | scsi_qla_host_t *ha = to_qla_host(cmd->device->host); | 912 | scsi_qla_host_t *ha = to_qla_host(cmd->device->host); |
@@ -963,7 +967,7 @@ eh_bus_reset_done: | |||
963 | * | 967 | * |
964 | * Note: | 968 | * Note: |
965 | **************************************************************************/ | 969 | **************************************************************************/ |
966 | int | 970 | static int |
967 | qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) | 971 | qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) |
968 | { | 972 | { |
969 | scsi_qla_host_t *ha = to_qla_host(cmd->device->host); | 973 | scsi_qla_host_t *ha = to_qla_host(cmd->device->host); |
@@ -1366,6 +1370,29 @@ qla24xx_disable_intrs(scsi_qla_host_t *ha) | |||
1366 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 1370 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
1367 | } | 1371 | } |
1368 | 1372 | ||
1373 | static void | ||
1374 | qla2xxx_scan_start(struct Scsi_Host *shost) | ||
1375 | { | ||
1376 | scsi_qla_host_t *ha = (scsi_qla_host_t *)shost->hostdata; | ||
1377 | |||
1378 | set_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags); | ||
1379 | set_bit(LOCAL_LOOP_UPDATE, &ha->dpc_flags); | ||
1380 | set_bit(RSCN_UPDATE, &ha->dpc_flags); | ||
1381 | } | ||
1382 | |||
1383 | static int | ||
1384 | qla2xxx_scan_finished(struct Scsi_Host *shost, unsigned long time) | ||
1385 | { | ||
1386 | scsi_qla_host_t *ha = (scsi_qla_host_t *)shost->hostdata; | ||
1387 | |||
1388 | if (!ha->host) | ||
1389 | return 1; | ||
1390 | if (time > ha->loop_reset_delay * HZ) | ||
1391 | return 1; | ||
1392 | |||
1393 | return atomic_read(&ha->loop_state) == LOOP_READY; | ||
1394 | } | ||
1395 | |||
1369 | /* | 1396 | /* |
1370 | * PCI driver interface | 1397 | * PCI driver interface |
1371 | */ | 1398 | */ |
@@ -1377,10 +1404,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1377 | struct Scsi_Host *host; | 1404 | struct Scsi_Host *host; |
1378 | scsi_qla_host_t *ha; | 1405 | scsi_qla_host_t *ha; |
1379 | unsigned long flags = 0; | 1406 | unsigned long flags = 0; |
1380 | unsigned long wait_switch = 0; | ||
1381 | char pci_info[20]; | 1407 | char pci_info[20]; |
1382 | char fw_str[30]; | 1408 | char fw_str[30]; |
1383 | fc_port_t *fcport; | ||
1384 | struct scsi_host_template *sht; | 1409 | struct scsi_host_template *sht; |
1385 | 1410 | ||
1386 | if (pci_enable_device(pdev)) | 1411 | if (pci_enable_device(pdev)) |
@@ -1631,30 +1656,19 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1631 | 1656 | ||
1632 | ha->isp_ops.enable_intrs(ha); | 1657 | ha->isp_ops.enable_intrs(ha); |
1633 | 1658 | ||
1634 | /* v2.19.5b6 */ | ||
1635 | /* | ||
1636 | * Wait around max loop_reset_delay secs for the devices to come | ||
1637 | * on-line. We don't want Linux scanning before we are ready. | ||
1638 | * | ||
1639 | */ | ||
1640 | for (wait_switch = jiffies + (ha->loop_reset_delay * HZ); | ||
1641 | time_before(jiffies,wait_switch) && | ||
1642 | !(ha->device_flags & (DFLG_NO_CABLE | DFLG_FABRIC_DEVICES)) | ||
1643 | && (ha->device_flags & SWITCH_FOUND) ;) { | ||
1644 | |||
1645 | qla2x00_check_fabric_devices(ha); | ||
1646 | |||
1647 | msleep(10); | ||
1648 | } | ||
1649 | |||
1650 | pci_set_drvdata(pdev, ha); | 1659 | pci_set_drvdata(pdev, ha); |
1660 | |||
1651 | ha->flags.init_done = 1; | 1661 | ha->flags.init_done = 1; |
1662 | ha->flags.online = 1; | ||
1663 | |||
1652 | num_hosts++; | 1664 | num_hosts++; |
1653 | 1665 | ||
1654 | ret = scsi_add_host(host, &pdev->dev); | 1666 | ret = scsi_add_host(host, &pdev->dev); |
1655 | if (ret) | 1667 | if (ret) |
1656 | goto probe_failed; | 1668 | goto probe_failed; |
1657 | 1669 | ||
1670 | scsi_scan_host(host); | ||
1671 | |||
1658 | qla2x00_alloc_sysfs_attr(ha); | 1672 | qla2x00_alloc_sysfs_attr(ha); |
1659 | 1673 | ||
1660 | qla2x00_init_host_attr(ha); | 1674 | qla2x00_init_host_attr(ha); |
@@ -1669,10 +1683,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1669 | ha->flags.enable_64bit_addressing ? '+': '-', ha->host_no, | 1683 | ha->flags.enable_64bit_addressing ? '+': '-', ha->host_no, |
1670 | ha->isp_ops.fw_version_str(ha, fw_str)); | 1684 | ha->isp_ops.fw_version_str(ha, fw_str)); |
1671 | 1685 | ||
1672 | /* Go with fc_rport registration. */ | ||
1673 | list_for_each_entry(fcport, &ha->fcports, list) | ||
1674 | qla2x00_reg_remote_port(ha, fcport); | ||
1675 | |||
1676 | return 0; | 1686 | return 0; |
1677 | 1687 | ||
1678 | probe_failed: | 1688 | probe_failed: |