Commit 1b81e7f3 authored by Michael Hernandez's avatar Michael Hernandez Committed by Martin K. Petersen

scsi: qla2xxx: Return appropriate failure through BSG Interface

This patch ensures flash updates API calls return possible failure
status through BSG interface to the application.

Link: https://lore.kernel.org/r/20200226224022.24518-7-hmadhani@marvell.comSigned-off-by: default avatarHimanshu Madhani <hmadhani@marvell.com>
Signed-off-by: default avatarMichael Hernandez <mhernandez@marvell.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 4ba836f6
...@@ -1517,10 +1517,15 @@ qla2x00_update_optrom(struct bsg_job *bsg_job) ...@@ -1517,10 +1517,15 @@ qla2x00_update_optrom(struct bsg_job *bsg_job)
bsg_job->request_payload.sg_cnt, ha->optrom_buffer, bsg_job->request_payload.sg_cnt, ha->optrom_buffer,
ha->optrom_region_size); ha->optrom_region_size);
ha->isp_ops->write_optrom(vha, ha->optrom_buffer, rval = ha->isp_ops->write_optrom(vha, ha->optrom_buffer,
ha->optrom_region_start, ha->optrom_region_size); ha->optrom_region_start, ha->optrom_region_size);
if (rval) {
bsg_reply->result = -EINVAL;
rval = -EINVAL;
} else {
bsg_reply->result = DID_OK; bsg_reply->result = DID_OK;
}
vfree(ha->optrom_buffer); vfree(ha->optrom_buffer);
ha->optrom_buffer = NULL; ha->optrom_buffer = NULL;
ha->optrom_state = QLA_SWAITING; ha->optrom_state = QLA_SWAITING;
......
...@@ -2683,7 +2683,7 @@ qla28xx_write_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr, ...@@ -2683,7 +2683,7 @@ qla28xx_write_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr,
uint32_t sec_mask, rest_addr, fdata; uint32_t sec_mask, rest_addr, fdata;
void *optrom = NULL; void *optrom = NULL;
dma_addr_t optrom_dma; dma_addr_t optrom_dma;
int rval; int rval, ret;
struct secure_flash_update_block *sfub; struct secure_flash_update_block *sfub;
dma_addr_t sfub_dma; dma_addr_t sfub_dma;
uint32_t offset = faddr << 2; uint32_t offset = faddr << 2;
...@@ -2939,11 +2939,12 @@ qla28xx_write_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr, ...@@ -2939,11 +2939,12 @@ qla28xx_write_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr,
write_protect: write_protect:
ql_log(ql_log_warn + ql_dbg_verbose, vha, 0x7095, ql_log(ql_log_warn + ql_dbg_verbose, vha, 0x7095,
"Protect flash...\n"); "Protect flash...\n");
rval = qla24xx_protect_flash(vha); ret = qla24xx_protect_flash(vha);
if (rval) { if (ret) {
qla81xx_fac_semaphore_access(vha, FAC_SEMAPHORE_UNLOCK); qla81xx_fac_semaphore_access(vha, FAC_SEMAPHORE_UNLOCK);
ql_log(ql_log_warn, vha, 0x7099, ql_log(ql_log_warn, vha, 0x7099,
"Failed protect flash\n"); "Failed protect flash\n");
rval = QLA_COMMAND_ERROR;
} }
if (reset_to_rom == true) { if (reset_to_rom == true) {
...@@ -2951,10 +2952,12 @@ qla28xx_write_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr, ...@@ -2951,10 +2952,12 @@ qla28xx_write_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr,
set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
qla2xxx_wake_dpc(vha); qla2xxx_wake_dpc(vha);
rval = qla2x00_wait_for_hba_online(vha); ret = qla2x00_wait_for_hba_online(vha);
if (rval != QLA_SUCCESS) if (ret != QLA_SUCCESS) {
ql_log(ql_log_warn, vha, 0xffff, ql_log(ql_log_warn, vha, 0xffff,
"Adapter did not come out of reset\n"); "Adapter did not come out of reset\n");
rval = QLA_COMMAND_ERROR;
}
} }
done: done:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment