diff options
author | Suresh Thiagarajan <Suresh.Thiagarajan@pmcs.com> | 2014-08-11 02:20:35 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-09-16 12:09:48 -0400 |
commit | 9e0328453ea1a0e800b10daafffbadeac68273fd (patch) | |
tree | 873de1c598759cab522965f35670ced2af77f3e3 /drivers/scsi/pm8001 | |
parent | a07b67194307cc344953ce23c28d840609acac1f (diff) |
pm8001: Update nvmd response data to request buffer
Instead of using the virt_ptr use request buffer for copying
back the nvmd response data and use the same in request function also
Signed-off-by: Suresh Thiagarajan <suresh.thiagarajan@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/pm8001')
-rw-r--r-- | drivers/scsi/pm8001/pm8001_ctl.c | 4 | ||||
-rw-r--r-- | drivers/scsi/pm8001/pm8001_hwi.c | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c index 7abbf284da1a..be8269c8d127 100644 --- a/drivers/scsi/pm8001/pm8001_ctl.c +++ b/drivers/scsi/pm8001/pm8001_ctl.c | |||
@@ -385,7 +385,6 @@ static ssize_t pm8001_ctl_bios_version_show(struct device *cdev, | |||
385 | struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); | 385 | struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); |
386 | struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; | 386 | struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; |
387 | char *str = buf; | 387 | char *str = buf; |
388 | void *virt_addr; | ||
389 | int bios_index; | 388 | int bios_index; |
390 | DECLARE_COMPLETION_ONSTACK(completion); | 389 | DECLARE_COMPLETION_ONSTACK(completion); |
391 | struct pm8001_ioctl_payload payload; | 390 | struct pm8001_ioctl_payload payload; |
@@ -402,11 +401,10 @@ static ssize_t pm8001_ctl_bios_version_show(struct device *cdev, | |||
402 | return -ENOMEM; | 401 | return -ENOMEM; |
403 | } | 402 | } |
404 | wait_for_completion(&completion); | 403 | wait_for_completion(&completion); |
405 | virt_addr = pm8001_ha->memoryMap.region[NVMD].virt_ptr; | ||
406 | for (bios_index = BIOSOFFSET; bios_index < BIOS_OFFSET_LIMIT; | 404 | for (bios_index = BIOSOFFSET; bios_index < BIOS_OFFSET_LIMIT; |
407 | bios_index++) | 405 | bios_index++) |
408 | str += sprintf(str, "%c", | 406 | str += sprintf(str, "%c", |
409 | *((u8 *)((u8 *)virt_addr+bios_index))); | 407 | *(payload.func_specific+bios_index)); |
410 | kfree(payload.func_specific); | 408 | kfree(payload.func_specific); |
411 | return str - buf; | 409 | return str - buf; |
412 | } | 410 | } |
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index dd12c6fe57a6..933f21471951 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c | |||
@@ -3132,6 +3132,7 @@ void pm8001_mpi_set_nvmd_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
3132 | void | 3132 | void |
3133 | pm8001_mpi_get_nvmd_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) | 3133 | pm8001_mpi_get_nvmd_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) |
3134 | { | 3134 | { |
3135 | struct fw_control_ex *fw_control_context; | ||
3135 | struct get_nvm_data_resp *pPayload = | 3136 | struct get_nvm_data_resp *pPayload = |
3136 | (struct get_nvm_data_resp *)(piomb + 4); | 3137 | (struct get_nvm_data_resp *)(piomb + 4); |
3137 | u32 tag = le32_to_cpu(pPayload->tag); | 3138 | u32 tag = le32_to_cpu(pPayload->tag); |
@@ -3140,6 +3141,7 @@ pm8001_mpi_get_nvmd_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
3140 | u32 ir_tds_bn_dps_das_nvm = | 3141 | u32 ir_tds_bn_dps_das_nvm = |
3141 | le32_to_cpu(pPayload->ir_tda_bn_dps_das_nvm); | 3142 | le32_to_cpu(pPayload->ir_tda_bn_dps_das_nvm); |
3142 | void *virt_addr = pm8001_ha->memoryMap.region[NVMD].virt_ptr; | 3143 | void *virt_addr = pm8001_ha->memoryMap.region[NVMD].virt_ptr; |
3144 | fw_control_context = ccb->fw_control_context; | ||
3143 | 3145 | ||
3144 | PM8001_MSG_DBG(pm8001_ha, pm8001_printk("Get nvm data complete!\n")); | 3146 | PM8001_MSG_DBG(pm8001_ha, pm8001_printk("Get nvm data complete!\n")); |
3145 | if ((dlen_status & NVMD_STAT) != 0) { | 3147 | if ((dlen_status & NVMD_STAT) != 0) { |
@@ -3180,6 +3182,12 @@ pm8001_mpi_get_nvmd_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
3180 | pm8001_printk("Get NVMD success, IR=0, dataLen=%d\n", | 3182 | pm8001_printk("Get NVMD success, IR=0, dataLen=%d\n", |
3181 | (dlen_status & NVMD_LEN) >> 24)); | 3183 | (dlen_status & NVMD_LEN) >> 24)); |
3182 | } | 3184 | } |
3185 | /* Though fw_control_context is freed below, usrAddr still needs | ||
3186 | * to be updated as this holds the response to the request function | ||
3187 | */ | ||
3188 | memcpy(fw_control_context->usrAddr, | ||
3189 | pm8001_ha->memoryMap.region[NVMD].virt_ptr, | ||
3190 | fw_control_context->len); | ||
3183 | kfree(ccb->fw_control_context); | 3191 | kfree(ccb->fw_control_context); |
3184 | ccb->task = NULL; | 3192 | ccb->task = NULL; |
3185 | ccb->ccb_tag = 0xFFFFFFFF; | 3193 | ccb->ccb_tag = 0xFFFFFFFF; |