Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 195702
b: refs/heads/master
c: 86fbee8
h: refs/heads/master
v: v3
  • Loading branch information
Lalit Chandivade authored and James Bottomley committed May 16, 2010
1 parent ee40134 commit 733255a
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1516ef44835417f55645cdd9ccf203551ca6e8c0
refs/heads/master: 86fbee86e94c7e80c9bb01db0cf68b7977462109
6 changes: 6 additions & 0 deletions trunk/drivers/scsi/qla2xxx/qla_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,12 @@ qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj,
return count;
}

if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) {
qla_printk(KERN_WARNING, ha,
"HBA not online, failing NVRAM update.\n");
return -EAGAIN;
}

DEBUG2(qla_printk(KERN_INFO, ha,
"Reading flash region -- 0x%x/0x%x.\n",
ha->optrom_region_start, ha->optrom_region_size));
Expand Down
46 changes: 45 additions & 1 deletion trunk/drivers/scsi/qla2xxx/qla_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,50 @@ qla2x00_wait_for_hba_online(scsi_qla_host_t *vha)
return (return_status);
}

/*
* qla2x00_wait_for_reset_ready
* Wait till the HBA is online after going through
* <= MAX_RETRIES_OF_ISP_ABORT or
* finally HBA is disabled ie marked offline or flash
* operations are in progress.
*
* Input:
* ha - pointer to host adapter structure
*
* Note:
* Does context switching-Release SPIN_LOCK
* (if any) before calling this routine.
*
* Return:
* Success (Adapter is online/no flash ops) : 0
* Failed (Adapter is offline/disabled/flash ops in progress) : 1
*/
int
qla2x00_wait_for_reset_ready(scsi_qla_host_t *vha)
{
int return_status;
unsigned long wait_online;
struct qla_hw_data *ha = vha->hw;
scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);

wait_online = jiffies + (MAX_LOOP_TIMEOUT * HZ);
while (((test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) ||
test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) ||
test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) ||
ha->optrom_state != QLA_SWAITING ||
ha->dpc_active) && time_before(jiffies, wait_online))
msleep(1000);

if (base_vha->flags.online && ha->optrom_state == QLA_SWAITING)
return_status = QLA_SUCCESS;
else
return_status = QLA_FUNCTION_FAILED;

DEBUG2(printk("%s return_status=%d\n", __func__, return_status));

return return_status;
}

int
qla2x00_wait_for_chip_reset(scsi_qla_host_t *vha)
{
Expand Down Expand Up @@ -1081,7 +1125,7 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
qla_printk(KERN_INFO, ha,
"scsi(%ld:%d:%d): ADAPTER RESET ISSUED.\n", vha->host_no, id, lun);

if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS)
if (qla2x00_wait_for_reset_ready(vha) != QLA_SUCCESS)
goto eh_host_reset_lock;

/*
Expand Down

0 comments on commit 733255a

Please sign in to comment.