diff options
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_os.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index e90f7c16b956..75a966c94860 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -506,7 +506,7 @@ qla24xx_fw_version_str(struct scsi_qla_host *vha, char *str) | |||
506 | 506 | ||
507 | static inline srb_t * | 507 | static inline srb_t * |
508 | qla2x00_get_new_sp(scsi_qla_host_t *vha, fc_port_t *fcport, | 508 | qla2x00_get_new_sp(scsi_qla_host_t *vha, fc_port_t *fcport, |
509 | struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | 509 | struct scsi_cmnd *cmd) |
510 | { | 510 | { |
511 | srb_t *sp; | 511 | srb_t *sp; |
512 | struct qla_hw_data *ha = vha->hw; | 512 | struct qla_hw_data *ha = vha->hw; |
@@ -520,14 +520,13 @@ qla2x00_get_new_sp(scsi_qla_host_t *vha, fc_port_t *fcport, | |||
520 | sp->cmd = cmd; | 520 | sp->cmd = cmd; |
521 | sp->flags = 0; | 521 | sp->flags = 0; |
522 | CMD_SP(cmd) = (void *)sp; | 522 | CMD_SP(cmd) = (void *)sp; |
523 | cmd->scsi_done = done; | ||
524 | sp->ctx = NULL; | 523 | sp->ctx = NULL; |
525 | 524 | ||
526 | return sp; | 525 | return sp; |
527 | } | 526 | } |
528 | 527 | ||
529 | static int | 528 | static int |
530 | qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | 529 | qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) |
531 | { | 530 | { |
532 | scsi_qla_host_t *vha = shost_priv(cmd->device->host); | 531 | scsi_qla_host_t *vha = shost_priv(cmd->device->host); |
533 | fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; | 532 | fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; |
@@ -537,7 +536,6 @@ qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *) | |||
537 | srb_t *sp; | 536 | srb_t *sp; |
538 | int rval; | 537 | int rval; |
539 | 538 | ||
540 | spin_unlock_irq(vha->host->host_lock); | ||
541 | if (ha->flags.eeh_busy) { | 539 | if (ha->flags.eeh_busy) { |
542 | if (ha->flags.pci_channel_io_perm_failure) | 540 | if (ha->flags.pci_channel_io_perm_failure) |
543 | cmd->result = DID_NO_CONNECT << 16; | 541 | cmd->result = DID_NO_CONNECT << 16; |
@@ -569,40 +567,32 @@ qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *) | |||
569 | goto qc24_target_busy; | 567 | goto qc24_target_busy; |
570 | } | 568 | } |
571 | 569 | ||
572 | sp = qla2x00_get_new_sp(base_vha, fcport, cmd, done); | 570 | sp = qla2x00_get_new_sp(base_vha, fcport, cmd); |
573 | if (!sp) | 571 | if (!sp) |
574 | goto qc24_host_busy_lock; | 572 | goto qc24_host_busy; |
575 | 573 | ||
576 | rval = ha->isp_ops->start_scsi(sp); | 574 | rval = ha->isp_ops->start_scsi(sp); |
577 | if (rval != QLA_SUCCESS) | 575 | if (rval != QLA_SUCCESS) |
578 | goto qc24_host_busy_free_sp; | 576 | goto qc24_host_busy_free_sp; |
579 | 577 | ||
580 | spin_lock_irq(vha->host->host_lock); | ||
581 | |||
582 | return 0; | 578 | return 0; |
583 | 579 | ||
584 | qc24_host_busy_free_sp: | 580 | qc24_host_busy_free_sp: |
585 | qla2x00_sp_free_dma(sp); | 581 | qla2x00_sp_free_dma(sp); |
586 | mempool_free(sp, ha->srb_mempool); | 582 | mempool_free(sp, ha->srb_mempool); |
587 | 583 | ||
588 | qc24_host_busy_lock: | 584 | qc24_host_busy: |
589 | spin_lock_irq(vha->host->host_lock); | ||
590 | return SCSI_MLQUEUE_HOST_BUSY; | 585 | return SCSI_MLQUEUE_HOST_BUSY; |
591 | 586 | ||
592 | qc24_target_busy: | 587 | qc24_target_busy: |
593 | spin_lock_irq(vha->host->host_lock); | ||
594 | return SCSI_MLQUEUE_TARGET_BUSY; | 588 | return SCSI_MLQUEUE_TARGET_BUSY; |
595 | 589 | ||
596 | qc24_fail_command: | 590 | qc24_fail_command: |
597 | spin_lock_irq(vha->host->host_lock); | 591 | cmd->scsi_done(cmd); |
598 | done(cmd); | ||
599 | 592 | ||
600 | return 0; | 593 | return 0; |
601 | } | 594 | } |
602 | 595 | ||
603 | static DEF_SCSI_QCMD(qla2xxx_queuecommand) | ||
604 | |||
605 | |||
606 | /* | 596 | /* |
607 | * qla2x00_eh_wait_on_command | 597 | * qla2x00_eh_wait_on_command |
608 | * Waits for the command to be returned by the Firmware for some | 598 | * Waits for the command to be returned by the Firmware for some |
@@ -821,17 +811,20 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) | |||
821 | { | 811 | { |
822 | scsi_qla_host_t *vha = shost_priv(cmd->device->host); | 812 | scsi_qla_host_t *vha = shost_priv(cmd->device->host); |
823 | srb_t *sp; | 813 | srb_t *sp; |
824 | int ret = SUCCESS; | 814 | int ret; |
825 | unsigned int id, lun; | 815 | unsigned int id, lun; |
826 | unsigned long flags; | 816 | unsigned long flags; |
827 | int wait = 0; | 817 | int wait = 0; |
828 | struct qla_hw_data *ha = vha->hw; | 818 | struct qla_hw_data *ha = vha->hw; |
829 | 819 | ||
830 | fc_block_scsi_eh(cmd); | ||
831 | |||
832 | if (!CMD_SP(cmd)) | 820 | if (!CMD_SP(cmd)) |
833 | return SUCCESS; | 821 | return SUCCESS; |
834 | 822 | ||
823 | ret = fc_block_scsi_eh(cmd); | ||
824 | if (ret != 0) | ||
825 | return ret; | ||
826 | ret = SUCCESS; | ||
827 | |||
835 | id = cmd->device->id; | 828 | id = cmd->device->id; |
836 | lun = cmd->device->lun; | 829 | lun = cmd->device->lun; |
837 | 830 | ||
@@ -940,11 +933,13 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type, | |||
940 | fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; | 933 | fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; |
941 | int err; | 934 | int err; |
942 | 935 | ||
943 | fc_block_scsi_eh(cmd); | ||
944 | |||
945 | if (!fcport) | 936 | if (!fcport) |
946 | return FAILED; | 937 | return FAILED; |
947 | 938 | ||
939 | err = fc_block_scsi_eh(cmd); | ||
940 | if (err != 0) | ||
941 | return err; | ||
942 | |||
948 | qla_printk(KERN_INFO, vha->hw, "scsi(%ld:%d:%d): %s RESET ISSUED.\n", | 943 | qla_printk(KERN_INFO, vha->hw, "scsi(%ld:%d:%d): %s RESET ISSUED.\n", |
949 | vha->host_no, cmd->device->id, cmd->device->lun, name); | 944 | vha->host_no, cmd->device->id, cmd->device->lun, name); |
950 | 945 | ||
@@ -1018,14 +1013,17 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) | |||
1018 | int ret = FAILED; | 1013 | int ret = FAILED; |
1019 | unsigned int id, lun; | 1014 | unsigned int id, lun; |
1020 | 1015 | ||
1021 | fc_block_scsi_eh(cmd); | ||
1022 | |||
1023 | id = cmd->device->id; | 1016 | id = cmd->device->id; |
1024 | lun = cmd->device->lun; | 1017 | lun = cmd->device->lun; |
1025 | 1018 | ||
1026 | if (!fcport) | 1019 | if (!fcport) |
1027 | return ret; | 1020 | return ret; |
1028 | 1021 | ||
1022 | ret = fc_block_scsi_eh(cmd); | ||
1023 | if (ret != 0) | ||
1024 | return ret; | ||
1025 | ret = FAILED; | ||
1026 | |||
1029 | qla_printk(KERN_INFO, vha->hw, | 1027 | qla_printk(KERN_INFO, vha->hw, |
1030 | "scsi(%ld:%d:%d): BUS RESET ISSUED.\n", vha->host_no, id, lun); | 1028 | "scsi(%ld:%d:%d): BUS RESET ISSUED.\n", vha->host_no, id, lun); |
1031 | 1029 | ||
@@ -1078,14 +1076,17 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) | |||
1078 | unsigned int id, lun; | 1076 | unsigned int id, lun; |
1079 | scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); | 1077 | scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); |
1080 | 1078 | ||
1081 | fc_block_scsi_eh(cmd); | ||
1082 | |||
1083 | id = cmd->device->id; | 1079 | id = cmd->device->id; |
1084 | lun = cmd->device->lun; | 1080 | lun = cmd->device->lun; |
1085 | 1081 | ||
1086 | if (!fcport) | 1082 | if (!fcport) |
1087 | return ret; | 1083 | return ret; |
1088 | 1084 | ||
1085 | ret = fc_block_scsi_eh(cmd); | ||
1086 | if (ret != 0) | ||
1087 | return ret; | ||
1088 | ret = FAILED; | ||
1089 | |||
1089 | qla_printk(KERN_INFO, ha, | 1090 | qla_printk(KERN_INFO, ha, |
1090 | "scsi(%ld:%d:%d): ADAPTER RESET ISSUED.\n", vha->host_no, id, lun); | 1091 | "scsi(%ld:%d:%d): ADAPTER RESET ISSUED.\n", vha->host_no, id, lun); |
1091 | 1092 | ||
@@ -3805,7 +3806,7 @@ qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state) | |||
3805 | ha->flags.eeh_busy = 1; | 3806 | ha->flags.eeh_busy = 1; |
3806 | /* For ISP82XX complete any pending mailbox cmd */ | 3807 | /* For ISP82XX complete any pending mailbox cmd */ |
3807 | if (IS_QLA82XX(ha)) { | 3808 | if (IS_QLA82XX(ha)) { |
3808 | ha->flags.fw_hung = 1; | 3809 | ha->flags.isp82xx_fw_hung = 1; |
3809 | if (ha->flags.mbox_busy) { | 3810 | if (ha->flags.mbox_busy) { |
3810 | ha->flags.mbox_int = 1; | 3811 | ha->flags.mbox_int = 1; |
3811 | DEBUG2(qla_printk(KERN_ERR, ha, | 3812 | DEBUG2(qla_printk(KERN_ERR, ha, |
@@ -3945,7 +3946,7 @@ uint32_t qla82xx_error_recovery(scsi_qla_host_t *base_vha) | |||
3945 | qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, | 3946 | qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, |
3946 | QLA82XX_DEV_READY); | 3947 | QLA82XX_DEV_READY); |
3947 | qla82xx_idc_unlock(ha); | 3948 | qla82xx_idc_unlock(ha); |
3948 | ha->flags.fw_hung = 0; | 3949 | ha->flags.isp82xx_fw_hung = 0; |
3949 | rval = qla82xx_restart_isp(base_vha); | 3950 | rval = qla82xx_restart_isp(base_vha); |
3950 | qla82xx_idc_lock(ha); | 3951 | qla82xx_idc_lock(ha); |
3951 | /* Clear driver state register */ | 3952 | /* Clear driver state register */ |
@@ -3958,7 +3959,7 @@ uint32_t qla82xx_error_recovery(scsi_qla_host_t *base_vha) | |||
3958 | "This devfn is not reset owner = 0x%x\n", ha->pdev->devfn)); | 3959 | "This devfn is not reset owner = 0x%x\n", ha->pdev->devfn)); |
3959 | if ((qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE) == | 3960 | if ((qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE) == |
3960 | QLA82XX_DEV_READY)) { | 3961 | QLA82XX_DEV_READY)) { |
3961 | ha->flags.fw_hung = 0; | 3962 | ha->flags.isp82xx_fw_hung = 0; |
3962 | rval = qla82xx_restart_isp(base_vha); | 3963 | rval = qla82xx_restart_isp(base_vha); |
3963 | qla82xx_idc_lock(ha); | 3964 | qla82xx_idc_lock(ha); |
3964 | qla82xx_set_drv_active(base_vha); | 3965 | qla82xx_set_drv_active(base_vha); |