Commit 3695310e authored by Joe Carnuccio's avatar Joe Carnuccio Committed by Martin K. Petersen

scsi: qla2xxx: Update flash read/write routine

This patch makes following changes to flash access routines:

- update return type for read_optrom
- use void instead of uint32_t * for buffer parameter in read
  and write optrom routines
- fix flash/nvram addressing
Signed-off-by: default avatarJoe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: default avatarHimanshu Madhani <hmadhani@marvell.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent a28d9e4e
...@@ -223,9 +223,9 @@ qla2x00_sysfs_write_nvram(struct file *filp, struct kobject *kobj, ...@@ -223,9 +223,9 @@ qla2x00_sysfs_write_nvram(struct file *filp, struct kobject *kobj,
} }
/* Write NVRAM. */ /* Write NVRAM. */
ha->isp_ops->write_nvram(vha, (uint8_t *)buf, ha->nvram_base, count); ha->isp_ops->write_nvram(vha, buf, ha->nvram_base, count);
ha->isp_ops->read_nvram(vha, (uint8_t *)ha->nvram, ha->nvram_base, ha->isp_ops->read_nvram(vha, ha->nvram, ha->nvram_base,
count); count);
mutex_unlock(&ha->optrom_mutex); mutex_unlock(&ha->optrom_mutex);
ql_dbg(ql_dbg_user, vha, 0x7060, ql_dbg(ql_dbg_user, vha, 0x7060,
...@@ -511,22 +511,24 @@ qla2x00_sysfs_read_vpd(struct file *filp, struct kobject *kobj, ...@@ -511,22 +511,24 @@ qla2x00_sysfs_read_vpd(struct file *filp, struct kobject *kobj,
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EINVAL; return -EINVAL;
if (IS_NOCACHE_VPD_TYPE(ha)) { if (IS_NOCACHE_VPD_TYPE(ha))
faddr = ha->flt_region_vpd << 2; goto skip;
if ((IS_QLA27XX(ha) || IS_QLA28XX(ha)) && faddr = ha->flt_region_vpd << 2;
qla27xx_find_valid_image(vha) == QLA27XX_SECONDARY_IMAGE)
faddr = ha->flt_region_vpd_sec << 2;
mutex_lock(&ha->optrom_mutex); if ((IS_QLA27XX(ha) || IS_QLA28XX(ha)) &&
if (qla2x00_chip_is_down(vha)) { qla27xx_find_valid_image(vha) == QLA27XX_SECONDARY_IMAGE)
mutex_unlock(&ha->optrom_mutex); faddr = ha->flt_region_vpd_sec << 2;
return -EAGAIN;
} mutex_lock(&ha->optrom_mutex);
ha->isp_ops->read_optrom(vha, ha->vpd, faddr, if (qla2x00_chip_is_down(vha)) {
ha->vpd_size);
mutex_unlock(&ha->optrom_mutex); mutex_unlock(&ha->optrom_mutex);
return -EAGAIN;
} }
ha->isp_ops->read_optrom(vha, ha->vpd, faddr, ha->vpd_size);
mutex_unlock(&ha->optrom_mutex);
skip:
return memory_read_from_buffer(buf, count, &off, ha->vpd, ha->vpd_size); return memory_read_from_buffer(buf, count, &off, ha->vpd, ha->vpd_size);
} }
...@@ -563,8 +565,8 @@ qla2x00_sysfs_write_vpd(struct file *filp, struct kobject *kobj, ...@@ -563,8 +565,8 @@ qla2x00_sysfs_write_vpd(struct file *filp, struct kobject *kobj,
} }
/* Write NVRAM. */ /* Write NVRAM. */
ha->isp_ops->write_nvram(vha, (uint8_t *)buf, ha->vpd_base, count); ha->isp_ops->write_nvram(vha, buf, ha->vpd_base, count);
ha->isp_ops->read_nvram(vha, (uint8_t *)ha->vpd, ha->vpd_base, count); ha->isp_ops->read_nvram(vha, ha->vpd, ha->vpd_base, count);
/* Update flash version information for 4Gb & above. */ /* Update flash version information for 4Gb & above. */
if (!IS_FWI2_CAPABLE(ha)) { if (!IS_FWI2_CAPABLE(ha)) {
...@@ -934,7 +936,7 @@ static struct bin_attribute sysfs_dcbx_tlv_attr = { ...@@ -934,7 +936,7 @@ static struct bin_attribute sysfs_dcbx_tlv_attr = {
static struct sysfs_entry { static struct sysfs_entry {
char *name; char *name;
struct bin_attribute *attr; struct bin_attribute *attr;
int is4GBp_only; int type;
} bin_file_entries[] = { } bin_file_entries[] = {
{ "fw_dump", &sysfs_fw_dump_attr, }, { "fw_dump", &sysfs_fw_dump_attr, },
{ "nvram", &sysfs_nvram_attr, }, { "nvram", &sysfs_nvram_attr, },
...@@ -957,11 +959,11 @@ qla2x00_alloc_sysfs_attr(scsi_qla_host_t *vha) ...@@ -957,11 +959,11 @@ qla2x00_alloc_sysfs_attr(scsi_qla_host_t *vha)
int ret; int ret;
for (iter = bin_file_entries; iter->name; iter++) { for (iter = bin_file_entries; iter->name; iter++) {
if (iter->is4GBp_only && !IS_FWI2_CAPABLE(vha->hw)) if (iter->type && !IS_FWI2_CAPABLE(vha->hw))
continue; continue;
if (iter->is4GBp_only == 2 && !IS_QLA25XX(vha->hw)) if (iter->type == 2 && !IS_QLA25XX(vha->hw))
continue; continue;
if (iter->is4GBp_only == 3 && !(IS_CNA_CAPABLE(vha->hw))) if (iter->type == 3 && !(IS_CNA_CAPABLE(vha->hw)))
continue; continue;
ret = sysfs_create_bin_file(&host->shost_gendev.kobj, ret = sysfs_create_bin_file(&host->shost_gendev.kobj,
...@@ -985,14 +987,14 @@ qla2x00_free_sysfs_attr(scsi_qla_host_t *vha, bool stop_beacon) ...@@ -985,14 +987,14 @@ qla2x00_free_sysfs_attr(scsi_qla_host_t *vha, bool stop_beacon)
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
for (iter = bin_file_entries; iter->name; iter++) { for (iter = bin_file_entries; iter->name; iter++) {
if (iter->is4GBp_only && !IS_FWI2_CAPABLE(ha)) if (iter->type && !IS_FWI2_CAPABLE(ha))
continue; continue;
if (iter->is4GBp_only == 2 && !IS_QLA25XX(ha)) if (iter->type == 2 && !IS_QLA25XX(ha))
continue; continue;
if (iter->is4GBp_only == 3 && !(IS_CNA_CAPABLE(vha->hw))) if (iter->type == 3 && !(IS_CNA_CAPABLE(ha)))
continue; continue;
if (iter->is4GBp_only == 0x27 && if (iter->type == 0x27 &&
(!IS_QLA27XX(vha->hw) || !IS_QLA28XX(ha))) (!IS_QLA27XX(ha) || !IS_QLA28XX(ha)))
continue; continue;
sysfs_remove_bin_file(&host->shost_gendev.kobj, sysfs_remove_bin_file(&host->shost_gendev.kobj,
...@@ -1360,19 +1362,20 @@ qla24xx_84xx_fw_version_show(struct device *dev, ...@@ -1360,19 +1362,20 @@ qla24xx_84xx_fw_version_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
int rval = QLA_SUCCESS; int rval = QLA_SUCCESS;
uint16_t status[2] = {0, 0}; uint16_t status[2] = { 0 };
scsi_qla_host_t *vha = shost_priv(class_to_shost(dev)); scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
if (!IS_QLA84XX(ha)) if (!IS_QLA84XX(ha))
return scnprintf(buf, PAGE_SIZE, "\n"); return scnprintf(buf, PAGE_SIZE, "\n");
if (ha->cs84xx->op_fw_version == 0) if (!ha->cs84xx->op_fw_version) {
rval = qla84xx_verify_chip(vha, status); rval = qla84xx_verify_chip(vha, status);
if ((rval == QLA_SUCCESS) && (status[0] == 0)) if (!rval && !status[0])
return scnprintf(buf, PAGE_SIZE, "%u\n", return scnprintf(buf, PAGE_SIZE, "%u\n",
(uint32_t)ha->cs84xx->op_fw_version); (uint32_t)ha->cs84xx->op_fw_version);
}
return scnprintf(buf, PAGE_SIZE, "\n"); return scnprintf(buf, PAGE_SIZE, "\n");
} }
......
...@@ -3161,9 +3161,9 @@ struct isp_operations { ...@@ -3161,9 +3161,9 @@ struct isp_operations {
void *(*prep_ms_fdmi_iocb) (struct scsi_qla_host *, uint32_t, void *(*prep_ms_fdmi_iocb) (struct scsi_qla_host *, uint32_t,
uint32_t); uint32_t);
uint8_t *(*read_nvram) (struct scsi_qla_host *, uint8_t *, uint8_t *(*read_nvram)(struct scsi_qla_host *, void *,
uint32_t, uint32_t); uint32_t, uint32_t);
int (*write_nvram) (struct scsi_qla_host *, uint8_t *, uint32_t, int (*write_nvram)(struct scsi_qla_host *, void *, uint32_t,
uint32_t); uint32_t);
void (*fw_dump) (struct scsi_qla_host *, int); void (*fw_dump) (struct scsi_qla_host *, int);
...@@ -3172,9 +3172,9 @@ struct isp_operations { ...@@ -3172,9 +3172,9 @@ struct isp_operations {
int (*beacon_off) (struct scsi_qla_host *); int (*beacon_off) (struct scsi_qla_host *);
void (*beacon_blink) (struct scsi_qla_host *); void (*beacon_blink) (struct scsi_qla_host *);
uint8_t * (*read_optrom) (struct scsi_qla_host *, uint8_t *, void *(*read_optrom)(struct scsi_qla_host *, void *,
uint32_t, uint32_t); uint32_t, uint32_t);
int (*write_optrom) (struct scsi_qla_host *, uint8_t *, uint32_t, int (*write_optrom)(struct scsi_qla_host *, void *, uint32_t,
uint32_t); uint32_t);
int (*get_flash_version) (struct scsi_qla_host *, void *); int (*get_flash_version) (struct scsi_qla_host *, void *);
......
...@@ -543,19 +543,20 @@ fc_port_t *qla2x00_find_fcport_by_nportid(scsi_qla_host_t *, port_id_t *, u8); ...@@ -543,19 +543,20 @@ fc_port_t *qla2x00_find_fcport_by_nportid(scsi_qla_host_t *, port_id_t *, u8);
*/ */
extern void qla2x00_release_nvram_protection(scsi_qla_host_t *); extern void qla2x00_release_nvram_protection(scsi_qla_host_t *);
extern uint32_t *qla24xx_read_flash_data(scsi_qla_host_t *, uint32_t *, extern uint32_t *qla24xx_read_flash_data(scsi_qla_host_t *, uint32_t *,
uint32_t, uint32_t); uint32_t, uint32_t);
extern uint8_t *qla2x00_read_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t, extern uint8_t *qla2x00_read_nvram_data(scsi_qla_host_t *, void *, uint32_t,
uint32_t); uint32_t);
extern uint8_t *qla24xx_read_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t, extern uint8_t *qla24xx_read_nvram_data(scsi_qla_host_t *, void *, uint32_t,
uint32_t); uint32_t);
extern int qla2x00_write_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t, extern int qla2x00_write_nvram_data(scsi_qla_host_t *, void *, uint32_t,
uint32_t); uint32_t);
extern int qla24xx_write_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t, extern int qla24xx_write_nvram_data(scsi_qla_host_t *, void *, uint32_t,
uint32_t); uint32_t);
extern uint8_t *qla25xx_read_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t, extern uint8_t *qla25xx_read_nvram_data(scsi_qla_host_t *, void *, uint32_t,
uint32_t); uint32_t);
extern int qla25xx_write_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t, extern int qla25xx_write_nvram_data(scsi_qla_host_t *, void *, uint32_t,
uint32_t); uint32_t);
extern int qla2x00_is_a_vp_did(scsi_qla_host_t *, uint32_t); extern int qla2x00_is_a_vp_did(scsi_qla_host_t *, uint32_t);
bool qla2x00_check_reg32_for_disconnect(scsi_qla_host_t *, uint32_t); bool qla2x00_check_reg32_for_disconnect(scsi_qla_host_t *, uint32_t);
bool qla2x00_check_reg16_for_disconnect(scsi_qla_host_t *, uint16_t); bool qla2x00_check_reg16_for_disconnect(scsi_qla_host_t *, uint16_t);
...@@ -575,18 +576,18 @@ extern int qla83xx_restart_nic_firmware(scsi_qla_host_t *); ...@@ -575,18 +576,18 @@ extern int qla83xx_restart_nic_firmware(scsi_qla_host_t *);
extern int qla83xx_access_control(scsi_qla_host_t *, uint16_t, uint32_t, extern int qla83xx_access_control(scsi_qla_host_t *, uint16_t, uint32_t,
uint32_t, uint16_t *); uint32_t, uint16_t *);
extern uint8_t *qla2x00_read_optrom_data(struct scsi_qla_host *, uint8_t *, extern void *qla2x00_read_optrom_data(struct scsi_qla_host *, void *,
uint32_t, uint32_t); uint32_t, uint32_t);
extern int qla2x00_write_optrom_data(struct scsi_qla_host *, uint8_t *, extern int qla2x00_write_optrom_data(struct scsi_qla_host *, void *,
uint32_t, uint32_t); uint32_t, uint32_t);
extern uint8_t *qla24xx_read_optrom_data(struct scsi_qla_host *, uint8_t *, extern void *qla24xx_read_optrom_data(struct scsi_qla_host *, void *,
uint32_t, uint32_t); uint32_t, uint32_t);
extern int qla24xx_write_optrom_data(struct scsi_qla_host *, uint8_t *, extern int qla24xx_write_optrom_data(struct scsi_qla_host *, void *,
uint32_t, uint32_t); uint32_t, uint32_t);
extern uint8_t *qla25xx_read_optrom_data(struct scsi_qla_host *, uint8_t *, extern void *qla25xx_read_optrom_data(struct scsi_qla_host *, void *,
uint32_t, uint32_t); uint32_t, uint32_t);
extern uint8_t *qla8044_read_optrom_data(struct scsi_qla_host *, extern void *qla8044_read_optrom_data(struct scsi_qla_host *,
uint8_t *, uint32_t, uint32_t); void *, uint32_t, uint32_t);
extern void qla8044_watchdog(struct scsi_qla_host *vha); extern void qla8044_watchdog(struct scsi_qla_host *vha);
extern int qla2x00_get_flash_version(scsi_qla_host_t *, void *); extern int qla2x00_get_flash_version(scsi_qla_host_t *, void *);
...@@ -766,9 +767,9 @@ extern int qla82xx_start_firmware(scsi_qla_host_t *); ...@@ -766,9 +767,9 @@ extern int qla82xx_start_firmware(scsi_qla_host_t *);
/* Firmware and flash related functions */ /* Firmware and flash related functions */
extern int qla82xx_load_risc(scsi_qla_host_t *, uint32_t *); extern int qla82xx_load_risc(scsi_qla_host_t *, uint32_t *);
extern uint8_t *qla82xx_read_optrom_data(struct scsi_qla_host *, uint8_t *, extern void *qla82xx_read_optrom_data(struct scsi_qla_host *, void *,
uint32_t, uint32_t); uint32_t, uint32_t);
extern int qla82xx_write_optrom_data(struct scsi_qla_host *, uint8_t *, extern int qla82xx_write_optrom_data(struct scsi_qla_host *, void *,
uint32_t, uint32_t); uint32_t, uint32_t);
/* Mailbox related functions */ /* Mailbox related functions */
...@@ -864,7 +865,7 @@ extern void qla8044_clear_drv_active(struct qla_hw_data *); ...@@ -864,7 +865,7 @@ extern void qla8044_clear_drv_active(struct qla_hw_data *);
void qla8044_get_minidump(struct scsi_qla_host *vha); void qla8044_get_minidump(struct scsi_qla_host *vha);
int qla8044_collect_md_data(struct scsi_qla_host *vha); int qla8044_collect_md_data(struct scsi_qla_host *vha);
extern int qla8044_md_get_template(scsi_qla_host_t *); extern int qla8044_md_get_template(scsi_qla_host_t *);
extern int qla8044_write_optrom_data(struct scsi_qla_host *, uint8_t *, extern int qla8044_write_optrom_data(struct scsi_qla_host *, void *,
uint32_t, uint32_t); uint32_t, uint32_t);
extern irqreturn_t qla8044_intr_handler(int, void *); extern irqreturn_t qla8044_intr_handler(int, void *);
extern void qla82xx_mbx_completion(scsi_qla_host_t *, uint16_t); extern void qla82xx_mbx_completion(scsi_qla_host_t *, uint16_t);
......
...@@ -4419,9 +4419,8 @@ qla2x00_nvram_config(scsi_qla_host_t *vha) ...@@ -4419,9 +4419,8 @@ qla2x00_nvram_config(scsi_qla_host_t *vha)
nv->nvram_version < 1) { nv->nvram_version < 1) {
/* Reset NVRAM data. */ /* Reset NVRAM data. */
ql_log(ql_log_warn, vha, 0x0064, ql_log(ql_log_warn, vha, 0x0064,
"Inconsistent NVRAM " "Inconsistent NVRAM detected: checksum=%#x id=%.4s version=%#x.\n",
"detected: checksum=0x%x id=%c version=0x%x.\n", chksum, nv->id, nv->nvram_version);
chksum, nv->id[0], nv->nvram_version);
ql_log(ql_log_warn, vha, 0x0065, ql_log(ql_log_warn, vha, 0x0065,
"Falling back to " "Falling back to "
"functioning (yet invalid -- WWPN) defaults.\n"); "functioning (yet invalid -- WWPN) defaults.\n");
...@@ -7007,13 +7006,12 @@ qla24xx_nvram_config(scsi_qla_host_t *vha) ...@@ -7007,13 +7006,12 @@ qla24xx_nvram_config(scsi_qla_host_t *vha)
/* Get VPD data into cache */ /* Get VPD data into cache */
ha->vpd = ha->nvram + VPD_OFFSET; ha->vpd = ha->nvram + VPD_OFFSET;
ha->isp_ops->read_nvram(vha, (uint8_t *)ha->vpd, ha->isp_ops->read_nvram(vha, ha->vpd,
ha->nvram_base - FA_NVRAM_FUNC0_ADDR, FA_NVRAM_VPD_SIZE * 4); ha->nvram_base - FA_NVRAM_FUNC0_ADDR, FA_NVRAM_VPD_SIZE * 4);
/* Get NVRAM data into cache and calculate checksum. */ /* Get NVRAM data into cache and calculate checksum. */
dptr = (uint32_t *)nv; dptr = (uint32_t *)nv;
ha->isp_ops->read_nvram(vha, (uint8_t *)dptr, ha->nvram_base, ha->isp_ops->read_nvram(vha, dptr, ha->nvram_base, ha->nvram_size);
ha->nvram_size);
for (cnt = 0, chksum = 0; cnt < ha->nvram_size >> 2; cnt++, dptr++) for (cnt = 0, chksum = 0; cnt < ha->nvram_size >> 2; cnt++, dptr++)
chksum += le32_to_cpu(*dptr); chksum += le32_to_cpu(*dptr);
...@@ -7027,9 +7025,9 @@ qla24xx_nvram_config(scsi_qla_host_t *vha) ...@@ -7027,9 +7025,9 @@ qla24xx_nvram_config(scsi_qla_host_t *vha)
le16_to_cpu(nv->nvram_version) < ICB_VERSION) { le16_to_cpu(nv->nvram_version) < ICB_VERSION) {
/* Reset NVRAM data. */ /* Reset NVRAM data. */
ql_log(ql_log_warn, vha, 0x006b, ql_log(ql_log_warn, vha, 0x006b,
"Inconsistent NVRAM detected: checksum=0x%x id=%c " "Inconsistent NVRAM checksum=%#x id=%.4s version=%#x.\n",
"version=0x%x.\n", chksum, nv->id[0], nv->nvram_version); chksum, nv->id, nv->nvram_version);
ql_dump_buffer(ql_dbg_init, vha, 0x006b, nv, 32); ql_dump_buffer(ql_dbg_init, vha, 0x006b, nv, sizeof(*nv));
ql_log(ql_log_warn, vha, 0x006c, ql_log(ql_log_warn, vha, 0x006c,
"Falling back to functioning (yet invalid -- WWPN) " "Falling back to functioning (yet invalid -- WWPN) "
"defaults.\n"); "defaults.\n");
...@@ -7418,6 +7416,7 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr, ...@@ -7418,6 +7416,7 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
fwdt->template = NULL; fwdt->template = NULL;
fwdt->length = 0; fwdt->length = 0;
dcode = (void *)req->ring;
qla24xx_read_flash_data(vha, dcode, faddr, 7); qla24xx_read_flash_data(vha, dcode, faddr, 7);
risc_size = be32_to_cpu(dcode[2]); risc_size = be32_to_cpu(dcode[2]);
ql_dbg(ql_dbg_init, vha, 0x0161, ql_dbg(ql_dbg_init, vha, 0x0161,
...@@ -8020,10 +8019,9 @@ qla81xx_nvram_config(scsi_qla_host_t *vha) ...@@ -8020,10 +8019,9 @@ qla81xx_nvram_config(scsi_qla_host_t *vha)
le16_to_cpu(nv->nvram_version) < ICB_VERSION) { le16_to_cpu(nv->nvram_version) < ICB_VERSION) {
/* Reset NVRAM data. */ /* Reset NVRAM data. */
ql_log(ql_log_info, vha, 0x0073, ql_log(ql_log_info, vha, 0x0073,
"Inconsistent NVRAM detected: checksum=0x%x id=%c " "Inconsistent NVRAM checksum=%#x id=%.4s version=%#x.\n",
"version=0x%x.\n", chksum, nv->id[0], chksum, nv->id, le16_to_cpu(nv->nvram_version));
le16_to_cpu(nv->nvram_version)); ql_dump_buffer(ql_dbg_init, vha, 0x0073, nv, sizeof(*nv));
ql_dump_buffer(ql_dbg_init, vha, 0x0073, nv, 32);
ql_log(ql_log_info, vha, 0x0074, ql_log(ql_log_info, vha, 0x0074,
"Falling back to functioning (yet invalid -- WWPN) " "Falling back to functioning (yet invalid -- WWPN) "
"defaults.\n"); "defaults.\n");
......
...@@ -2658,8 +2658,8 @@ qla82xx_erase_sector(struct qla_hw_data *ha, int addr) ...@@ -2658,8 +2658,8 @@ qla82xx_erase_sector(struct qla_hw_data *ha, int addr)
/* /*
* Address and length are byte address * Address and length are byte address
*/ */
uint8_t * void *
qla82xx_read_optrom_data(struct scsi_qla_host *vha, uint8_t *buf, qla82xx_read_optrom_data(struct scsi_qla_host *vha, void *buf,
uint32_t offset, uint32_t length) uint32_t offset, uint32_t length)
{ {
scsi_block_requests(vha->host); scsi_block_requests(vha->host);
...@@ -2767,15 +2767,14 @@ qla82xx_write_flash_data(struct scsi_qla_host *vha, uint32_t *dwptr, ...@@ -2767,15 +2767,14 @@ qla82xx_write_flash_data(struct scsi_qla_host *vha, uint32_t *dwptr,
} }
int int
qla82xx_write_optrom_data(struct scsi_qla_host *vha, uint8_t *buf, qla82xx_write_optrom_data(struct scsi_qla_host *vha, void *buf,
uint32_t offset, uint32_t length) uint32_t offset, uint32_t length)
{ {
int rval; int rval;
/* Suspend HBA. */ /* Suspend HBA. */
scsi_block_requests(vha->host); scsi_block_requests(vha->host);
rval = qla82xx_write_flash_data(vha, (uint32_t *)buf, offset, rval = qla82xx_write_flash_data(vha, buf, offset, length >> 2);
length >> 2);
scsi_unblock_requests(vha->host); scsi_unblock_requests(vha->host);
/* Convert return ISP82xx to generic */ /* Convert return ISP82xx to generic */
...@@ -3699,8 +3698,8 @@ qla82xx_chip_reset_cleanup(scsi_qla_host_t *vha) ...@@ -3699,8 +3698,8 @@ qla82xx_chip_reset_cleanup(scsi_qla_host_t *vha)
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&ha->hardware_lock, flags);
/* Wait for pending cmds (physical and virtual) to complete */ /* Wait for pending cmds (physical and virtual) to complete */
if (qla2x00_eh_wait_for_pending_commands(vha, 0, 0, if (!qla2x00_eh_wait_for_pending_commands(vha, 0, 0,
WAIT_HOST)) { WAIT_HOST) == QLA_SUCCESS) {
ql_dbg(ql_dbg_init, vha, 0x00b3, ql_dbg(ql_dbg_init, vha, 0x00b3,
"Done wait for " "Done wait for "
"pending commands.\n"); "pending commands.\n");
......
...@@ -559,12 +559,12 @@ qla8044_read_flash_data(scsi_qla_host_t *vha, uint8_t *p_data, ...@@ -559,12 +559,12 @@ qla8044_read_flash_data(scsi_qla_host_t *vha, uint8_t *p_data,
/* /*
* Address and length are byte address * Address and length are byte address
*/ */
uint8_t * void *
qla8044_read_optrom_data(struct scsi_qla_host *vha, uint8_t *buf, qla8044_read_optrom_data(struct scsi_qla_host *vha, void *buf,
uint32_t offset, uint32_t length) uint32_t offset, uint32_t length)
{ {
scsi_block_requests(vha->host); scsi_block_requests(vha->host);
if (qla8044_read_flash_data(vha, (uint8_t *)buf, offset, length / 4) if (qla8044_read_flash_data(vha, buf, offset, length / 4)
!= QLA_SUCCESS) { != QLA_SUCCESS) {
ql_log(ql_log_warn, vha, 0xb08d, ql_log(ql_log_warn, vha, 0xb08d,
"%s: Failed to read from flash\n", "%s: Failed to read from flash\n",
...@@ -3797,7 +3797,7 @@ qla8044_write_flash_dword_mode(scsi_qla_host_t *vha, uint32_t *dwptr, ...@@ -3797,7 +3797,7 @@ qla8044_write_flash_dword_mode(scsi_qla_host_t *vha, uint32_t *dwptr,
} }
int int
qla8044_write_optrom_data(struct scsi_qla_host *vha, uint8_t *buf, qla8044_write_optrom_data(struct scsi_qla_host *vha, void *buf,
uint32_t offset, uint32_t length) uint32_t offset, uint32_t length)
{ {
int rval = QLA_FUNCTION_FAILED, i, burst_iter_count; int rval = QLA_FUNCTION_FAILED, i, burst_iter_count;
......
This diff is collapsed.
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