diff options
-rw-r--r-- | drivers/scsi/qla2xxx/qla_attr.c | 6 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 46 |
2 files changed, 51 insertions, 1 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 62a22cfae20e..3b708606b932 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -281,6 +281,12 @@ qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj, | |||
281 | return count; | 281 | return count; |
282 | } | 282 | } |
283 | 283 | ||
284 | if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) { | ||
285 | qla_printk(KERN_WARNING, ha, | ||
286 | "HBA not online, failing NVRAM update.\n"); | ||
287 | return -EAGAIN; | ||
288 | } | ||
289 | |||
284 | DEBUG2(qla_printk(KERN_INFO, ha, | 290 | DEBUG2(qla_printk(KERN_INFO, ha, |
285 | "Reading flash region -- 0x%x/0x%x.\n", | 291 | "Reading flash region -- 0x%x/0x%x.\n", |
286 | ha->optrom_region_start, ha->optrom_region_size)); | 292 | ha->optrom_region_start, ha->optrom_region_size)); |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 5104aefdc7e6..0de92d376677 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -676,6 +676,50 @@ qla2x00_wait_for_hba_online(scsi_qla_host_t *vha) | |||
676 | return (return_status); | 676 | return (return_status); |
677 | } | 677 | } |
678 | 678 | ||
679 | /* | ||
680 | * qla2x00_wait_for_reset_ready | ||
681 | * Wait till the HBA is online after going through | ||
682 | * <= MAX_RETRIES_OF_ISP_ABORT or | ||
683 | * finally HBA is disabled ie marked offline or flash | ||
684 | * operations are in progress. | ||
685 | * | ||
686 | * Input: | ||
687 | * ha - pointer to host adapter structure | ||
688 | * | ||
689 | * Note: | ||
690 | * Does context switching-Release SPIN_LOCK | ||
691 | * (if any) before calling this routine. | ||
692 | * | ||
693 | * Return: | ||
694 | * Success (Adapter is online/no flash ops) : 0 | ||
695 | * Failed (Adapter is offline/disabled/flash ops in progress) : 1 | ||
696 | */ | ||
697 | int | ||
698 | qla2x00_wait_for_reset_ready(scsi_qla_host_t *vha) | ||
699 | { | ||
700 | int return_status; | ||
701 | unsigned long wait_online; | ||
702 | struct qla_hw_data *ha = vha->hw; | ||
703 | scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); | ||
704 | |||
705 | wait_online = jiffies + (MAX_LOOP_TIMEOUT * HZ); | ||
706 | while (((test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) || | ||
707 | test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || | ||
708 | test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || | ||
709 | ha->optrom_state != QLA_SWAITING || | ||
710 | ha->dpc_active) && time_before(jiffies, wait_online)) | ||
711 | msleep(1000); | ||
712 | |||
713 | if (base_vha->flags.online && ha->optrom_state == QLA_SWAITING) | ||
714 | return_status = QLA_SUCCESS; | ||
715 | else | ||
716 | return_status = QLA_FUNCTION_FAILED; | ||
717 | |||
718 | DEBUG2(printk("%s return_status=%d\n", __func__, return_status)); | ||
719 | |||
720 | return return_status; | ||
721 | } | ||
722 | |||
679 | int | 723 | int |
680 | qla2x00_wait_for_chip_reset(scsi_qla_host_t *vha) | 724 | qla2x00_wait_for_chip_reset(scsi_qla_host_t *vha) |
681 | { | 725 | { |
@@ -1081,7 +1125,7 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) | |||
1081 | qla_printk(KERN_INFO, ha, | 1125 | qla_printk(KERN_INFO, ha, |
1082 | "scsi(%ld:%d:%d): ADAPTER RESET ISSUED.\n", vha->host_no, id, lun); | 1126 | "scsi(%ld:%d:%d): ADAPTER RESET ISSUED.\n", vha->host_no, id, lun); |
1083 | 1127 | ||
1084 | if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) | 1128 | if (qla2x00_wait_for_reset_ready(vha) != QLA_SUCCESS) |
1085 | goto eh_host_reset_lock; | 1129 | goto eh_host_reset_lock; |
1086 | 1130 | ||
1087 | /* | 1131 | /* |