提交 85d0acbb 编写于 作者: A Andrew Vasquez 提交者: James Bottomley

[SCSI] qla2xxx: Simplify sector-mask calculation in preparation for larger flash parts.

Also removes unneeded 'findex' local variable within routine.
Signed-off-by: NAndrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
上级 6e9f21f3
...@@ -982,7 +982,7 @@ qla24xx_write_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr, ...@@ -982,7 +982,7 @@ qla24xx_write_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr,
int ret; int ret;
uint32_t liter, miter; uint32_t liter, miter;
uint32_t sec_mask, rest_addr; uint32_t sec_mask, rest_addr;
uint32_t fdata, findex; uint32_t fdata;
dma_addr_t optrom_dma; dma_addr_t optrom_dma;
void *optrom = NULL; void *optrom = NULL;
uint32_t *s, *d; uint32_t *s, *d;
...@@ -1003,17 +1003,15 @@ qla24xx_write_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr, ...@@ -1003,17 +1003,15 @@ qla24xx_write_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr,
} }
rest_addr = (ha->fdt_block_size >> 2) - 1; rest_addr = (ha->fdt_block_size >> 2) - 1;
sec_mask = (ha->optrom_size >> 2) - (ha->fdt_block_size >> 2); sec_mask = ~rest_addr;
qla24xx_unprotect_flash(ha); qla24xx_unprotect_flash(ha);
for (liter = 0; liter < dwords; liter++, faddr++, dwptr++) { for (liter = 0; liter < dwords; liter++, faddr++, dwptr++) {
fdata = (faddr & sec_mask) << 2;
findex = faddr;
fdata = (findex & sec_mask) << 2;
/* Are we at the beginning of a sector? */ /* Are we at the beginning of a sector? */
if ((findex & rest_addr) == 0) { if ((faddr & rest_addr) == 0) {
/* Do sector unprotect. */ /* Do sector unprotect. */
if (ha->fdt_unprotect_sec_cmd) if (ha->fdt_unprotect_sec_cmd)
qla24xx_write_flash_dword(ha, qla24xx_write_flash_dword(ha,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册