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

scsi: qla2xxx: Cleanups for NVRAM/Flash read/write path

This patch does following:

 - Clean up NVRAM code.
 - Optimizes reading of primary/secondary flash image validation.
 - Remove 0xff mask and make correct width in FLT structure.
 - Use endian macros to assign static fields in fwdump header.
 - Correct fdwt checksum calculation.
 - Simplify ql_dump_buffer() interface usage.
 - Add endianizers to 27xx firmware image validator.
 - fixes compiler warnings for big endian architecture.
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 72a92df2
...@@ -1962,7 +1962,7 @@ qlafx00_mgmt_cmd(struct bsg_job *bsg_job) ...@@ -1962,7 +1962,7 @@ qlafx00_mgmt_cmd(struct bsg_job *bsg_job)
/* Dump the vendor information */ /* Dump the vendor information */
ql_dump_buffer(ql_dbg_user + ql_dbg_verbose , vha, 0x70cf, ql_dump_buffer(ql_dbg_user + ql_dbg_verbose , vha, 0x70cf,
(uint8_t *)piocb_rqst, sizeof(struct qla_mt_iocb_rqst_fx00)); piocb_rqst, sizeof(*piocb_rqst));
if (!vha->flags.online) { if (!vha->flags.online) {
ql_log(ql_log_warn, vha, 0x70d0, ql_log(ql_log_warn, vha, 0x70d0,
...@@ -2324,8 +2324,8 @@ qla2x00_get_priv_stats(struct bsg_job *bsg_job) ...@@ -2324,8 +2324,8 @@ qla2x00_get_priv_stats(struct bsg_job *bsg_job)
rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma, options); rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma, options);
if (rval == QLA_SUCCESS) { if (rval == QLA_SUCCESS) {
ql_dump_buffer(ql_dbg_user + ql_dbg_verbose, vha, 0x70e3, ql_dump_buffer(ql_dbg_user + ql_dbg_verbose, vha, 0x70e5,
(uint8_t *)stats, sizeof(*stats)); stats, sizeof(*stats));
sg_copy_from_buffer(bsg_job->reply_payload.sg_list, sg_copy_from_buffer(bsg_job->reply_payload.sg_list,
bsg_job->reply_payload.sg_cnt, stats, sizeof(*stats)); bsg_job->reply_payload.sg_cnt, stats, sizeof(*stats));
} }
......
...@@ -2520,7 +2520,7 @@ qla83xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked) ...@@ -2520,7 +2520,7 @@ qla83xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
/****************************************************************************/ /****************************************************************************/
static inline int static inline int
ql_mask_match(uint32_t level) ql_mask_match(uint level)
{ {
return (level & ql2xextended_error_logging) == level; return (level & ql2xextended_error_logging) == level;
} }
...@@ -2539,7 +2539,7 @@ ql_mask_match(uint32_t level) ...@@ -2539,7 +2539,7 @@ ql_mask_match(uint32_t level)
* msg: The message to be displayed. * msg: The message to be displayed.
*/ */
void void
ql_dbg(uint32_t level, scsi_qla_host_t *vha, int32_t id, const char *fmt, ...) ql_dbg(uint level, scsi_qla_host_t *vha, uint id, const char *fmt, ...)
{ {
va_list va; va_list va;
struct va_format vaf; struct va_format vaf;
...@@ -2582,8 +2582,7 @@ ql_dbg(uint32_t level, scsi_qla_host_t *vha, int32_t id, const char *fmt, ...) ...@@ -2582,8 +2582,7 @@ ql_dbg(uint32_t level, scsi_qla_host_t *vha, int32_t id, const char *fmt, ...)
* msg: The message to be displayed. * msg: The message to be displayed.
*/ */
void void
ql_dbg_pci(uint32_t level, struct pci_dev *pdev, int32_t id, ql_dbg_pci(uint level, struct pci_dev *pdev, uint id, const char *fmt, ...)
const char *fmt, ...)
{ {
va_list va; va_list va;
struct va_format vaf; struct va_format vaf;
...@@ -2619,7 +2618,7 @@ ql_dbg_pci(uint32_t level, struct pci_dev *pdev, int32_t id, ...@@ -2619,7 +2618,7 @@ ql_dbg_pci(uint32_t level, struct pci_dev *pdev, int32_t id,
* msg: The message to be displayed. * msg: The message to be displayed.
*/ */
void void
ql_log(uint32_t level, scsi_qla_host_t *vha, int32_t id, const char *fmt, ...) ql_log(uint level, scsi_qla_host_t *vha, uint id, const char *fmt, ...)
{ {
va_list va; va_list va;
struct va_format vaf; struct va_format vaf;
...@@ -2677,8 +2676,7 @@ ql_log(uint32_t level, scsi_qla_host_t *vha, int32_t id, const char *fmt, ...) ...@@ -2677,8 +2676,7 @@ ql_log(uint32_t level, scsi_qla_host_t *vha, int32_t id, const char *fmt, ...)
* msg: The message to be displayed. * msg: The message to be displayed.
*/ */
void void
ql_log_pci(uint32_t level, struct pci_dev *pdev, int32_t id, ql_log_pci(uint level, struct pci_dev *pdev, uint id, const char *fmt, ...)
const char *fmt, ...)
{ {
va_list va; va_list va;
struct va_format vaf; struct va_format vaf;
...@@ -2718,7 +2716,7 @@ ql_log_pci(uint32_t level, struct pci_dev *pdev, int32_t id, ...@@ -2718,7 +2716,7 @@ ql_log_pci(uint32_t level, struct pci_dev *pdev, int32_t id,
} }
void void
ql_dump_regs(uint32_t level, scsi_qla_host_t *vha, int32_t id) ql_dump_regs(uint level, scsi_qla_host_t *vha, uint id)
{ {
int i; int i;
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
...@@ -2740,13 +2738,12 @@ ql_dump_regs(uint32_t level, scsi_qla_host_t *vha, int32_t id) ...@@ -2740,13 +2738,12 @@ ql_dump_regs(uint32_t level, scsi_qla_host_t *vha, int32_t id)
ql_dbg(level, vha, id, "Mailbox registers:\n"); ql_dbg(level, vha, id, "Mailbox registers:\n");
for (i = 0; i < 6; i++, mbx_reg++) for (i = 0; i < 6; i++, mbx_reg++)
ql_dbg(level, vha, id, ql_dbg(level, vha, id,
"mbox[%d] 0x%04x\n", i, RD_REG_WORD(mbx_reg)); "mbox[%d] %#04x\n", i, RD_REG_WORD(mbx_reg));
} }
void void
ql_dump_buffer(uint32_t level, scsi_qla_host_t *vha, int32_t id, ql_dump_buffer(uint level, scsi_qla_host_t *vha, uint id, void *buf, uint size)
uint8_t *buf, uint size)
{ {
uint cnt; uint cnt;
......
...@@ -318,20 +318,20 @@ struct qla2xxx_fw_dump { ...@@ -318,20 +318,20 @@ struct qla2xxx_fw_dump {
* as compared to other log levels. * as compared to other log levels.
*/ */
extern int ql_errlev; extern uint ql_errlev;
void __attribute__((format (printf, 4, 5))) void __attribute__((format (printf, 4, 5)))
ql_dbg(uint32_t, scsi_qla_host_t *vha, int32_t, const char *fmt, ...); ql_dbg(uint, scsi_qla_host_t *vha, uint, const char *fmt, ...);
void __attribute__((format (printf, 4, 5))) void __attribute__((format (printf, 4, 5)))
ql_dbg_pci(uint32_t, struct pci_dev *pdev, int32_t, const char *fmt, ...); ql_dbg_pci(uint, struct pci_dev *pdev, uint, const char *fmt, ...);
void __attribute__((format (printf, 4, 5))) void __attribute__((format (printf, 4, 5)))
ql_dbg_qp(uint32_t, struct qla_qpair *, int32_t, const char *fmt, ...); ql_dbg_qp(uint32_t, struct qla_qpair *, int32_t, const char *fmt, ...);
void __attribute__((format (printf, 4, 5))) void __attribute__((format (printf, 4, 5)))
ql_log(uint32_t, scsi_qla_host_t *vha, int32_t, const char *fmt, ...); ql_log(uint, scsi_qla_host_t *vha, uint, const char *fmt, ...);
void __attribute__((format (printf, 4, 5))) void __attribute__((format (printf, 4, 5)))
ql_log_pci(uint32_t, struct pci_dev *pdev, int32_t, const char *fmt, ...); ql_log_pci(uint, struct pci_dev *pdev, uint, const char *fmt, ...);
void __attribute__((format (printf, 4, 5))) void __attribute__((format (printf, 4, 5)))
ql_log_qp(uint32_t, struct qla_qpair *, int32_t, const char *fmt, ...); ql_log_qp(uint32_t, struct qla_qpair *, int32_t, const char *fmt, ...);
......
...@@ -4467,7 +4467,7 @@ typedef struct scsi_qla_host { ...@@ -4467,7 +4467,7 @@ typedef struct scsi_qla_host {
struct qla27xx_image_status { struct qla27xx_image_status {
uint8_t image_status_mask; uint8_t image_status_mask;
uint16_t generation_number; uint16_t generation;
uint8_t reserved[3]; uint8_t reserved[3];
uint8_t ver_minor; uint8_t ver_minor;
uint8_t ver_major; uint8_t ver_major;
......
...@@ -1516,7 +1516,9 @@ struct qla_flt_header { ...@@ -1516,7 +1516,9 @@ struct qla_flt_header {
#define FLT_REG_VPD_SEC_27XX_3 0xDA #define FLT_REG_VPD_SEC_27XX_3 0xDA
struct qla_flt_region { struct qla_flt_region {
uint32_t code; uint16_t code;
uint8_t attribute;
uint8_t reserved;
uint32_t size; uint32_t size;
uint32_t start; uint32_t start;
uint32_t end; uint32_t end;
......
...@@ -118,6 +118,7 @@ int qla_post_iidma_work(struct scsi_qla_host *vha, fc_port_t *fcport); ...@@ -118,6 +118,7 @@ int qla_post_iidma_work(struct scsi_qla_host *vha, fc_port_t *fcport);
void qla_do_iidma_work(struct scsi_qla_host *vha, fc_port_t *fcport); void qla_do_iidma_work(struct scsi_qla_host *vha, fc_port_t *fcport);
int qla2x00_reserve_mgmt_server_loop_id(scsi_qla_host_t *); int qla2x00_reserve_mgmt_server_loop_id(scsi_qla_host_t *);
void qla_rscn_replay(fc_port_t *fcport); void qla_rscn_replay(fc_port_t *fcport);
extern bool qla24xx_risc_firmware_invalid(uint32_t *);
/* /*
* Global Data in qla_os.c source file. * Global Data in qla_os.c source file.
...@@ -614,14 +615,9 @@ extern ulong qla27xx_fwdt_calculate_dump_size(struct scsi_qla_host *); ...@@ -614,14 +615,9 @@ extern ulong qla27xx_fwdt_calculate_dump_size(struct scsi_qla_host *);
extern int qla27xx_fwdt_template_valid(void *); extern int qla27xx_fwdt_template_valid(void *);
extern ulong qla27xx_fwdt_template_size(void *); extern ulong qla27xx_fwdt_template_size(void *);
extern void qla2x00_dump_regs(scsi_qla_host_t *);
extern void qla2x00_dump_buffer(uint8_t *, uint32_t);
extern void qla2x00_dump_buffer_zipped(uint8_t *, uint32_t);
extern void ql_dump_regs(uint32_t, scsi_qla_host_t *, int32_t);
extern void ql_dump_buffer(uint32_t, scsi_qla_host_t *, int32_t,
uint8_t *, uint32_t);
extern void qla2xxx_dump_post_process(scsi_qla_host_t *, int); extern void qla2xxx_dump_post_process(scsi_qla_host_t *, int);
extern void ql_dump_regs(uint, scsi_qla_host_t *, uint);
extern void ql_dump_buffer(uint, scsi_qla_host_t *, uint, void *, uint);
/* /*
* Global Function Prototypes in qla_gs.c source file. * Global Function Prototypes in qla_gs.c source file.
*/ */
......
...@@ -152,8 +152,8 @@ qla2x00_chk_ms_status(scsi_qla_host_t *vha, ms_iocb_entry_t *ms_pkt, ...@@ -152,8 +152,8 @@ qla2x00_chk_ms_status(scsi_qla_host_t *vha, ms_iocb_entry_t *ms_pkt,
vha->d_id.b.area, vha->d_id.b.al_pa, vha->d_id.b.area, vha->d_id.b.al_pa,
comp_status, ct_rsp->header.response); comp_status, ct_rsp->header.response);
ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha,
0x2078, (uint8_t *)&ct_rsp->header, 0x2078, ct_rsp,
sizeof(struct ct_rsp_hdr)); offsetof(typeof(*ct_rsp), rsp));
rval = QLA_INVALID_COMMAND; rval = QLA_INVALID_COMMAND;
} else } else
rval = QLA_SUCCESS; rval = QLA_SUCCESS;
......
This diff is collapsed.
...@@ -1375,7 +1375,7 @@ qla2x00_mbx_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, ...@@ -1375,7 +1375,7 @@ qla2x00_mbx_iocb_entry(scsi_qla_host_t *vha, struct req_que *req,
le16_to_cpu(mbx->status_flags)); le16_to_cpu(mbx->status_flags));
ql_dump_buffer(ql_dbg_async + ql_dbg_buffer, vha, 0x5029, ql_dump_buffer(ql_dbg_async + ql_dbg_buffer, vha, 0x5029,
(uint8_t *)mbx, sizeof(*mbx)); mbx, sizeof(*mbx));
goto logio_done; goto logio_done;
} }
...@@ -1519,7 +1519,7 @@ qla2x00_ct_entry(scsi_qla_host_t *vha, struct req_que *req, ...@@ -1519,7 +1519,7 @@ qla2x00_ct_entry(scsi_qla_host_t *vha, struct req_que *req,
bsg_reply->reply_payload_rcv_len = 0; bsg_reply->reply_payload_rcv_len = 0;
} }
ql_dump_buffer(ql_dbg_async + ql_dbg_buffer, vha, 0x5035, ql_dump_buffer(ql_dbg_async + ql_dbg_buffer, vha, 0x5035,
(uint8_t *)pkt, sizeof(*pkt)); pkt, sizeof(*pkt));
} else { } else {
res = DID_OK << 16; res = DID_OK << 16;
bsg_reply->reply_payload_rcv_len = bsg_reply->reply_payload_rcv_len =
...@@ -1659,7 +1659,7 @@ qla24xx_els_ct_entry(scsi_qla_host_t *vha, struct req_que *req, ...@@ -1659,7 +1659,7 @@ qla24xx_els_ct_entry(scsi_qla_host_t *vha, struct req_que *req,
memcpy(bsg_job->reply + sizeof(struct fc_bsg_reply), memcpy(bsg_job->reply + sizeof(struct fc_bsg_reply),
fw_status, sizeof(fw_status)); fw_status, sizeof(fw_status));
ql_dump_buffer(ql_dbg_user + ql_dbg_buffer, vha, 0x5056, ql_dump_buffer(ql_dbg_user + ql_dbg_buffer, vha, 0x5056,
(uint8_t *)pkt, sizeof(*pkt)); pkt, sizeof(*pkt));
} }
else { else {
res = DID_OK << 16; res = DID_OK << 16;
...@@ -1703,7 +1703,7 @@ qla24xx_logio_entry(scsi_qla_host_t *vha, struct req_que *req, ...@@ -1703,7 +1703,7 @@ qla24xx_logio_entry(scsi_qla_host_t *vha, struct req_que *req,
fcport->d_id.b.area, fcport->d_id.b.al_pa, fcport->d_id.b.area, fcport->d_id.b.al_pa,
logio->entry_status); logio->entry_status);
ql_dump_buffer(ql_dbg_async + ql_dbg_buffer, vha, 0x504d, ql_dump_buffer(ql_dbg_async + ql_dbg_buffer, vha, 0x504d,
(uint8_t *)logio, sizeof(*logio)); logio, sizeof(*logio));
goto logio_done; goto logio_done;
} }
...@@ -1849,8 +1849,8 @@ qla24xx_tm_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, void *tsk) ...@@ -1849,8 +1849,8 @@ qla24xx_tm_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, void *tsk)
} }
if (iocb->u.tmf.data != QLA_SUCCESS) if (iocb->u.tmf.data != QLA_SUCCESS)
ql_dump_buffer(ql_dbg_async + ql_dbg_buffer, vha, 0x5055, ql_dump_buffer(ql_dbg_async + ql_dbg_buffer, sp->vha, 0x5055,
(uint8_t *)sts, sizeof(*sts)); sts, sizeof(*sts));
sp->done(sp, 0); sp->done(sp, 0);
} }
......
...@@ -1829,8 +1829,18 @@ qla2x00_init_firmware(scsi_qla_host_t *vha, uint16_t size) ...@@ -1829,8 +1829,18 @@ qla2x00_init_firmware(scsi_qla_host_t *vha, uint16_t size)
if (rval != QLA_SUCCESS) { if (rval != QLA_SUCCESS) {
/*EMPTY*/ /*EMPTY*/
ql_dbg(ql_dbg_mbx, vha, 0x104d, ql_dbg(ql_dbg_mbx, vha, 0x104d,
"Failed=%x mb[0]=%x, mb[1]=%x, mb[2]=%x, mb[3]=%x,.\n", "Failed=%x mb[0]=%x, mb[1]=%x, mb[2]=%x, mb[3]=%x.\n",
rval, mcp->mb[0], mcp->mb[1], mcp->mb[2], mcp->mb[3]); rval, mcp->mb[0], mcp->mb[1], mcp->mb[2], mcp->mb[3]);
if (ha->init_cb) {
ql_dbg(ql_dbg_mbx, vha, 0x104d, "init_cb:\n");
ql_dump_buffer(ql_dbg_init + ql_dbg_verbose, vha,
0x0104d, ha->init_cb, sizeof(*ha->init_cb));
}
if (ha->ex_init_cb && ha->ex_init_cb->ex_version) {
ql_dbg(ql_dbg_mbx, vha, 0x104d, "ex_init_cb:\n");
ql_dump_buffer(ql_dbg_init + ql_dbg_verbose, vha,
0x0104d, ha->ex_init_cb, sizeof(*ha->ex_init_cb));
}
} else { } else {
if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) { if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) {
if (mcp->mb[2] == 6 || mcp->mb[3] == 2) if (mcp->mb[2] == 6 || mcp->mb[3] == 2)
...@@ -4243,7 +4253,7 @@ qla84xx_verify_chip(struct scsi_qla_host *vha, uint16_t *status) ...@@ -4243,7 +4253,7 @@ qla84xx_verify_chip(struct scsi_qla_host *vha, uint16_t *status)
ql_dbg(ql_dbg_mbx + ql_dbg_buffer, vha, 0x111c, ql_dbg(ql_dbg_mbx + ql_dbg_buffer, vha, 0x111c,
"Dump of Verify Request.\n"); "Dump of Verify Request.\n");
ql_dump_buffer(ql_dbg_mbx + ql_dbg_buffer, vha, 0x111e, ql_dump_buffer(ql_dbg_mbx + ql_dbg_buffer, vha, 0x111e,
(uint8_t *)mn, sizeof(*mn)); mn, sizeof(*mn));
rval = qla2x00_issue_iocb_timeout(vha, mn, mn_dma, 0, 120); rval = qla2x00_issue_iocb_timeout(vha, mn, mn_dma, 0, 120);
if (rval != QLA_SUCCESS) { if (rval != QLA_SUCCESS) {
...@@ -4255,7 +4265,7 @@ qla84xx_verify_chip(struct scsi_qla_host *vha, uint16_t *status) ...@@ -4255,7 +4265,7 @@ qla84xx_verify_chip(struct scsi_qla_host *vha, uint16_t *status)
ql_dbg(ql_dbg_mbx + ql_dbg_buffer, vha, 0x1110, ql_dbg(ql_dbg_mbx + ql_dbg_buffer, vha, 0x1110,
"Dump of Verify Response.\n"); "Dump of Verify Response.\n");
ql_dump_buffer(ql_dbg_mbx + ql_dbg_buffer, vha, 0x1118, ql_dump_buffer(ql_dbg_mbx + ql_dbg_buffer, vha, 0x1118,
(uint8_t *)mn, sizeof(*mn)); mn, sizeof(*mn));
status[0] = le16_to_cpu(mn->p.rsp.comp_status); status[0] = le16_to_cpu(mn->p.rsp.comp_status);
status[1] = status[0] == CS_VCS_CHIP_FAILURE ? status[1] = status[0] == CS_VCS_CHIP_FAILURE ?
......
...@@ -1138,8 +1138,8 @@ qlafx00_find_all_targets(scsi_qla_host_t *vha, ...@@ -1138,8 +1138,8 @@ qlafx00_find_all_targets(scsi_qla_host_t *vha,
ql_dbg(ql_dbg_disc + ql_dbg_init, vha, 0x2088, ql_dbg(ql_dbg_disc + ql_dbg_init, vha, 0x2088,
"Listing Target bit map...\n"); "Listing Target bit map...\n");
ql_dump_buffer(ql_dbg_disc + ql_dbg_init, vha, ql_dump_buffer(ql_dbg_disc + ql_dbg_init, vha, 0x2089,
0x2089, (uint8_t *)ha->gid_list, 32); ha->gid_list, 32);
/* Allocate temporary rmtport for any new rmtports discovered. */ /* Allocate temporary rmtport for any new rmtports discovered. */
new_fcport = qla2x00_alloc_fcport(vha, GFP_KERNEL); new_fcport = qla2x00_alloc_fcport(vha, GFP_KERNEL);
...@@ -1913,8 +1913,7 @@ qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint16_t fx_type) ...@@ -1913,8 +1913,7 @@ qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint16_t fx_type)
phost_info->domainname, phost_info->domainname,
phost_info->hostdriver); phost_info->hostdriver);
ql_dump_buffer(ql_dbg_init + ql_dbg_disc, vha, 0x014d, ql_dump_buffer(ql_dbg_init + ql_dbg_disc, vha, 0x014d,
(uint8_t *)phost_info, phost_info, sizeof(*phost_info));
sizeof(struct host_system_info));
} }
} }
...@@ -1968,7 +1967,7 @@ qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint16_t fx_type) ...@@ -1968,7 +1967,7 @@ qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint16_t fx_type)
vha->d_id.b.al_pa = pinfo->port_id[2]; vha->d_id.b.al_pa = pinfo->port_id[2];
qlafx00_update_host_attr(vha, pinfo); qlafx00_update_host_attr(vha, pinfo);
ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x0141, ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x0141,
(uint8_t *)pinfo, 16); pinfo, 16);
} else if (fx_type == FXDISC_GET_TGT_NODE_INFO) { } else if (fx_type == FXDISC_GET_TGT_NODE_INFO) {
struct qlafx00_tgt_node_info *pinfo = struct qlafx00_tgt_node_info *pinfo =
(struct qlafx00_tgt_node_info *) fdisc->u.fxiocb.rsp_addr; (struct qlafx00_tgt_node_info *) fdisc->u.fxiocb.rsp_addr;
...@@ -1976,12 +1975,12 @@ qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint16_t fx_type) ...@@ -1976,12 +1975,12 @@ qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint16_t fx_type)
memcpy(fcport->port_name, pinfo->tgt_node_wwpn, WWN_SIZE); memcpy(fcport->port_name, pinfo->tgt_node_wwpn, WWN_SIZE);
fcport->port_type = FCT_TARGET; fcport->port_type = FCT_TARGET;
ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x0144, ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x0144,
(uint8_t *)pinfo, 16); pinfo, 16);
} else if (fx_type == FXDISC_GET_TGT_NODE_LIST) { } else if (fx_type == FXDISC_GET_TGT_NODE_LIST) {
struct qlafx00_tgt_node_info *pinfo = struct qlafx00_tgt_node_info *pinfo =
(struct qlafx00_tgt_node_info *) fdisc->u.fxiocb.rsp_addr; (struct qlafx00_tgt_node_info *) fdisc->u.fxiocb.rsp_addr;
ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x0146, ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x0146,
(uint8_t *)pinfo, 16); pinfo, 16);
memcpy(vha->hw->gid_list, pinfo, QLAFX00_TGT_NODE_LIST_SIZE); memcpy(vha->hw->gid_list, pinfo, QLAFX00_TGT_NODE_LIST_SIZE);
} else if (fx_type == FXDISC_ABORT_IOCTL) } else if (fx_type == FXDISC_ABORT_IOCTL)
fdisc->u.fxiocb.result = fdisc->u.fxiocb.result =
...@@ -2248,18 +2247,16 @@ qlafx00_ioctl_iosb_entry(scsi_qla_host_t *vha, struct req_que *req, ...@@ -2248,18 +2247,16 @@ qlafx00_ioctl_iosb_entry(scsi_qla_host_t *vha, struct req_que *req,
fw_sts_ptr = bsg_job->reply + sizeof(struct fc_bsg_reply); fw_sts_ptr = bsg_job->reply + sizeof(struct fc_bsg_reply);
memcpy(fw_sts_ptr, (uint8_t *)&fstatus, memcpy(fw_sts_ptr, &fstatus, sizeof(fstatus));
sizeof(struct qla_mt_iocb_rsp_fx00));
bsg_job->reply_len = sizeof(struct fc_bsg_reply) + bsg_job->reply_len = sizeof(struct fc_bsg_reply) +
sizeof(struct qla_mt_iocb_rsp_fx00) + sizeof(uint8_t); sizeof(struct qla_mt_iocb_rsp_fx00) + sizeof(uint8_t);
ql_dump_buffer(ql_dbg_user + ql_dbg_verbose, ql_dump_buffer(ql_dbg_user + ql_dbg_verbose,
sp->fcport->vha, 0x5080, sp->vha, 0x5080, pkt, sizeof(*pkt));
(uint8_t *)pkt, sizeof(struct ioctl_iocb_entry_fx00));
ql_dump_buffer(ql_dbg_user + ql_dbg_verbose, ql_dump_buffer(ql_dbg_user + ql_dbg_verbose,
sp->fcport->vha, 0x5074, sp->vha, 0x5074,
(uint8_t *)fw_sts_ptr, sizeof(struct qla_mt_iocb_rsp_fx00)); fw_sts_ptr, sizeof(fstatus));
res = bsg_reply->result = DID_OK << 16; res = bsg_reply->result = DID_OK << 16;
bsg_reply->reply_payload_rcv_len = bsg_reply->reply_payload_rcv_len =
...@@ -2597,7 +2594,7 @@ qlafx00_status_cont_entry(struct rsp_que *rsp, sts_cont_entry_t *pkt) ...@@ -2597,7 +2594,7 @@ qlafx00_status_cont_entry(struct rsp_que *rsp, sts_cont_entry_t *pkt)
/* Move sense data. */ /* Move sense data. */
ql_dump_buffer(ql_dbg_io + ql_dbg_buffer, vha, 0x304e, ql_dump_buffer(ql_dbg_io + ql_dbg_buffer, vha, 0x304e,
(uint8_t *)pkt, sizeof(sts_cont_entry_t)); pkt, sizeof(*pkt));
memcpy(sense_ptr, pkt->data, sense_sz); memcpy(sense_ptr, pkt->data, sense_sz);
ql_dump_buffer(ql_dbg_io + ql_dbg_buffer, vha, 0x304a, ql_dump_buffer(ql_dbg_io + ql_dbg_buffer, vha, 0x304a,
sense_ptr, sense_sz); sense_ptr, sense_sz);
...@@ -3056,13 +3053,13 @@ qlafx00_build_scsi_iocbs(srb_t *sp, struct cmd_type_7_fx00 *cmd_pkt, ...@@ -3056,13 +3053,13 @@ qlafx00_build_scsi_iocbs(srb_t *sp, struct cmd_type_7_fx00 *cmd_pkt,
if (avail_dsds == 0 && cont == 1) { if (avail_dsds == 0 && cont == 1) {
cont = 0; cont = 0;
memcpy_toio((void __iomem *)cont_pkt, &lcont_pkt, memcpy_toio((void __iomem *)cont_pkt, &lcont_pkt,
REQUEST_ENTRY_SIZE); sizeof(lcont_pkt));
} }
} }
if (avail_dsds != 0 && cont == 1) { if (avail_dsds != 0 && cont == 1) {
memcpy_toio((void __iomem *)cont_pkt, &lcont_pkt, memcpy_toio((void __iomem *)cont_pkt, &lcont_pkt,
REQUEST_ENTRY_SIZE); sizeof(lcont_pkt));
} }
} }
...@@ -3172,9 +3169,9 @@ qlafx00_start_scsi(srb_t *sp) ...@@ -3172,9 +3169,9 @@ qlafx00_start_scsi(srb_t *sp)
lcmd_pkt.entry_status = (uint8_t) rsp->id; lcmd_pkt.entry_status = (uint8_t) rsp->id;
ql_dump_buffer(ql_dbg_io + ql_dbg_buffer, vha, 0x302e, ql_dump_buffer(ql_dbg_io + ql_dbg_buffer, vha, 0x302e,
(uint8_t *)cmd->cmnd, cmd->cmd_len); cmd->cmnd, cmd->cmd_len);
ql_dump_buffer(ql_dbg_io + ql_dbg_buffer, vha, 0x3032, ql_dump_buffer(ql_dbg_io + ql_dbg_buffer, vha, 0x3032,
(uint8_t *)&lcmd_pkt, REQUEST_ENTRY_SIZE); &lcmd_pkt, sizeof(lcmd_pkt));
memcpy_toio((void __iomem *)cmd_pkt, &lcmd_pkt, REQUEST_ENTRY_SIZE); memcpy_toio((void __iomem *)cmd_pkt, &lcmd_pkt, REQUEST_ENTRY_SIZE);
wmb(); wmb();
...@@ -3454,10 +3451,8 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 *pfxiocb) ...@@ -3454,10 +3451,8 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 *pfxiocb)
} }
ql_dump_buffer(ql_dbg_user + ql_dbg_verbose, ql_dump_buffer(ql_dbg_user + ql_dbg_verbose,
sp->vha, 0x3047, sp->vha, 0x3047, &fx_iocb, sizeof(fx_iocb));
(uint8_t *)&fx_iocb, sizeof(struct fxdisc_entry_fx00));
memcpy_toio((void __iomem *)pfxiocb, &fx_iocb, memcpy_toio((void __iomem *)pfxiocb, &fx_iocb, sizeof(fx_iocb));
sizeof(struct fxdisc_entry_fx00));
wmb(); wmb();
} }
...@@ -42,7 +42,7 @@ static struct kmem_cache *ctx_cachep; ...@@ -42,7 +42,7 @@ static struct kmem_cache *ctx_cachep;
/* /*
* error level for logging * error level for logging
*/ */
int ql_errlev = ql_log_all; uint ql_errlev = ql_log_all;
static int ql2xenableclass2; static int ql2xenableclass2;
module_param(ql2xenableclass2, int, S_IRUGO|S_IRUSR); module_param(ql2xenableclass2, int, S_IRUGO|S_IRUSR);
......
...@@ -619,7 +619,7 @@ qla2xxx_find_flt_start(scsi_qla_host_t *vha, uint32_t *start) ...@@ -619,7 +619,7 @@ qla2xxx_find_flt_start(scsi_qla_host_t *vha, uint32_t *start)
ql_log(ql_log_fatal, vha, 0x0045, ql_log(ql_log_fatal, vha, 0x0045,
"Inconsistent FLTL detected: checksum=0x%x.\n", chksum); "Inconsistent FLTL detected: checksum=0x%x.\n", chksum);
ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x010e, ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x010e,
buf, sizeof(struct qla_flt_location)); fltl, sizeof(*fltl));
return QLA_FUNCTION_FAILED; return QLA_FUNCTION_FAILED;
} }
...@@ -721,12 +721,12 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr) ...@@ -721,12 +721,12 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr)
/* Store addresses as DWORD offsets. */ /* Store addresses as DWORD offsets. */
start = le32_to_cpu(region->start) >> 2; start = le32_to_cpu(region->start) >> 2;
ql_dbg(ql_dbg_init, vha, 0x0049, ql_dbg(ql_dbg_init, vha, 0x0049,
"FLT[%02x]: start=0x%x " "FLT[%#x]: start=%#x end=%#x size=%#x.\n",
"end=0x%x size=0x%x.\n", le32_to_cpu(region->code) & 0xff, le16_to_cpu(region->code),
start, le32_to_cpu(region->end) >> 2, start, le32_to_cpu(region->end) >> 2,
le32_to_cpu(region->size)); le32_to_cpu(region->size));
switch (le32_to_cpu(region->code) & 0xff) { switch (le16_to_cpu(region->code)) {
case FLT_REG_FCOE_FW: case FLT_REG_FCOE_FW:
if (!IS_QLA8031(ha)) if (!IS_QLA8031(ha))
break; break;
...@@ -941,7 +941,7 @@ qla2xxx_get_fdt_info(scsi_qla_host_t *vha) ...@@ -941,7 +941,7 @@ qla2xxx_get_fdt_info(scsi_qla_host_t *vha)
" checksum=0x%x id=%c version0x%x.\n", chksum, " checksum=0x%x id=%c version0x%x.\n", chksum,
fdt->sig[0], le16_to_cpu(fdt->version)); fdt->sig[0], le16_to_cpu(fdt->version));
ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x0113, ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x0113,
(uint8_t *)fdt, sizeof(*fdt)); fdt, sizeof(*fdt));
goto no_flash_data; goto no_flash_data;
} }
...@@ -2879,7 +2879,7 @@ qla2x00_get_flash_version(scsi_qla_host_t *vha, void *mbuf) ...@@ -2879,7 +2879,7 @@ qla2x00_get_flash_version(scsi_qla_host_t *vha, void *mbuf)
"Dumping fw " "Dumping fw "
"ver from flash:.\n"); "ver from flash:.\n");
ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x010b, ql_dump_buffer(ql_dbg_init + ql_dbg_buffer, vha, 0x010b,
(uint8_t *)dbyte, 8); dbyte, 8);
if ((dcode[0] == 0xffff && dcode[1] == 0xffff && if ((dcode[0] == 0xffff && dcode[1] == 0xffff &&
dcode[2] == 0xffff && dcode[3] == 0xffff) || dcode[2] == 0xffff && dcode[3] == 0xffff) ||
...@@ -3128,24 +3128,16 @@ qla24xx_get_flash_version(scsi_qla_host_t *vha, void *mbuf) ...@@ -3128,24 +3128,16 @@ qla24xx_get_flash_version(scsi_qla_host_t *vha, void *mbuf)
qla27xx_find_valid_image(vha) == QLA27XX_SECONDARY_IMAGE) qla27xx_find_valid_image(vha) == QLA27XX_SECONDARY_IMAGE)
faddr = ha->flt_region_fw_sec; faddr = ha->flt_region_fw_sec;
qla24xx_read_flash_data(vha, dcode, faddr + 4, 4); qla24xx_read_flash_data(vha, dcode, faddr, 8);
for (i = 0; i < 4; i++) if (qla24xx_risc_firmware_invalid(dcode)) {
dcode[i] = be32_to_cpu(dcode[i]);
if ((dcode[0] == 0xffffffff && dcode[1] == 0xffffffff &&
dcode[2] == 0xffffffff && dcode[3] == 0xffffffff) ||
(dcode[0] == 0 && dcode[1] == 0 && dcode[2] == 0 &&
dcode[3] == 0)) {
ql_log(ql_log_warn, vha, 0x005f, ql_log(ql_log_warn, vha, 0x005f,
"Unrecognized fw revision at %x.\n", "Unrecognized fw revision at %x.\n",
ha->flt_region_fw * 4); ha->flt_region_fw * 4);
} else { } else {
ha->fw_revision[0] = dcode[0]; for (i = 0; i < 4; i++)
ha->fw_revision[1] = dcode[1]; ha->fw_revision[i] = be32_to_cpu(dcode[4+i]);
ha->fw_revision[2] = dcode[2];
ha->fw_revision[3] = dcode[3];
ql_dbg(ql_dbg_init, vha, 0x0060, ql_dbg(ql_dbg_init, vha, 0x0060,
"Firmware revision %d.%d.%d (%x).\n", "Firmware revision (flash) %d.%d.%d (%x).\n",
ha->fw_revision[0], ha->fw_revision[1], ha->fw_revision[0], ha->fw_revision[1],
ha->fw_revision[2], ha->fw_revision[3]); ha->fw_revision[2], ha->fw_revision[3]);
} }
...@@ -3158,19 +3150,16 @@ qla24xx_get_flash_version(scsi_qla_host_t *vha, void *mbuf) ...@@ -3158,19 +3150,16 @@ qla24xx_get_flash_version(scsi_qla_host_t *vha, void *mbuf)
memset(ha->gold_fw_version, 0, sizeof(ha->gold_fw_version)); memset(ha->gold_fw_version, 0, sizeof(ha->gold_fw_version));
dcode = mbuf; dcode = mbuf;
ha->isp_ops->read_optrom(vha, (uint8_t *)dcode, qla24xx_read_flash_data(vha, dcode, ha->flt_region_gold_fw, 8);
ha->flt_region_gold_fw << 2, 32); if (qla24xx_risc_firmware_invalid(dcode)) {
if (dcode[4] == 0xFFFFFFFF && dcode[5] == 0xFFFFFFFF &&
dcode[6] == 0xFFFFFFFF && dcode[7] == 0xFFFFFFFF) {
ql_log(ql_log_warn, vha, 0x0056, ql_log(ql_log_warn, vha, 0x0056,
"Unrecognized golden fw at 0x%x.\n", "Unrecognized golden fw at 0x%x.\n",
ha->flt_region_gold_fw * 4); ha->flt_region_gold_fw * 4);
return ret; return ret;
} }
for (i = 4; i < 8; i++) for (i = 0; i < 4; i++)
ha->gold_fw_version[i-4] = be32_to_cpu(dcode[i]); ha->gold_fw_version[i] = be32_to_cpu(dcode[4+i]);
return ret; return ret;
} }
......
This diff is collapsed.
...@@ -11,12 +11,12 @@ ...@@ -11,12 +11,12 @@
#define IOBASE_ADDR offsetof(struct device_reg_24xx, iobase_addr) #define IOBASE_ADDR offsetof(struct device_reg_24xx, iobase_addr)
struct __packed qla27xx_fwdt_template { struct __packed qla27xx_fwdt_template {
uint32_t template_type; __le32 template_type;
uint32_t entry_offset; __le32 entry_offset;
uint32_t template_size; uint32_t template_size;
uint32_t reserved_1; uint32_t reserved_1;
uint32_t entry_count; __le32 entry_count;
uint32_t template_version; uint32_t template_version;
uint32_t capture_timestamp; uint32_t capture_timestamp;
uint32_t template_checksum; uint32_t template_checksum;
...@@ -65,8 +65,8 @@ struct __packed qla27xx_fwdt_template { ...@@ -65,8 +65,8 @@ struct __packed qla27xx_fwdt_template {
struct __packed qla27xx_fwdt_entry { struct __packed qla27xx_fwdt_entry {
struct __packed { struct __packed {
uint32_t type; __le32 type;
uint32_t size; __le32 size;
uint32_t reserved_1; uint32_t reserved_1;
uint8_t capture_flags; uint8_t capture_flags;
...@@ -81,36 +81,36 @@ struct __packed qla27xx_fwdt_entry { ...@@ -81,36 +81,36 @@ struct __packed qla27xx_fwdt_entry {
} t255; } t255;
struct __packed { struct __packed {
uint32_t base_addr; __le32 base_addr;
uint8_t reg_width; uint8_t reg_width;
uint16_t reg_count; __le16 reg_count;
uint8_t pci_offset; uint8_t pci_offset;
} t256; } t256;
struct __packed { struct __packed {
uint32_t base_addr; __le32 base_addr;
uint32_t write_data; __le32 write_data;
uint8_t pci_offset; uint8_t pci_offset;
uint8_t reserved[3]; uint8_t reserved[3];
} t257; } t257;
struct __packed { struct __packed {
uint32_t base_addr; __le32 base_addr;
uint8_t reg_width; uint8_t reg_width;
uint16_t reg_count; __le16 reg_count;
uint8_t pci_offset; uint8_t pci_offset;
uint8_t banksel_offset; uint8_t banksel_offset;
uint8_t reserved[3]; uint8_t reserved[3];
uint32_t bank; __le32 bank;
} t258; } t258;
struct __packed { struct __packed {
uint32_t base_addr; __le32 base_addr;
uint32_t write_data; __le32 write_data;
uint8_t reserved[2]; uint8_t reserved[2];
uint8_t pci_offset; uint8_t pci_offset;
uint8_t banksel_offset; uint8_t banksel_offset;
uint32_t bank; __le32 bank;
} t259; } t259;
struct __packed { struct __packed {
...@@ -121,14 +121,14 @@ struct __packed qla27xx_fwdt_entry { ...@@ -121,14 +121,14 @@ struct __packed qla27xx_fwdt_entry {
struct __packed { struct __packed {
uint8_t pci_offset; uint8_t pci_offset;
uint8_t reserved[3]; uint8_t reserved[3];
uint32_t write_data; __le32 write_data;
} t261; } t261;
struct __packed { struct __packed {
uint8_t ram_area; uint8_t ram_area;
uint8_t reserved[3]; uint8_t reserved[3];
uint32_t start_addr; __le32 start_addr;
uint32_t end_addr; __le32 end_addr;
} t262; } t262;
struct __packed { struct __packed {
...@@ -158,7 +158,7 @@ struct __packed qla27xx_fwdt_entry { ...@@ -158,7 +158,7 @@ struct __packed qla27xx_fwdt_entry {
struct __packed { struct __packed {
uint8_t pci_offset; uint8_t pci_offset;
uint8_t reserved[3]; uint8_t reserved[3];
uint32_t data; __le32 data;
} t267; } t267;
struct __packed { struct __packed {
...@@ -173,23 +173,23 @@ struct __packed qla27xx_fwdt_entry { ...@@ -173,23 +173,23 @@ struct __packed qla27xx_fwdt_entry {
} t269; } t269;
struct __packed { struct __packed {
uint32_t addr; __le32 addr;
uint32_t count; __le32 count;
} t270; } t270;
struct __packed { struct __packed {
uint32_t addr; __le32 addr;
uint32_t data; __le32 data;
} t271; } t271;
struct __packed { struct __packed {
uint32_t addr; __le32 addr;
uint32_t count; __le32 count;
} t272; } t272;
struct __packed { struct __packed {
uint32_t addr; __le32 addr;
uint32_t count; __le32 count;
} t273; } t273;
struct __packed { struct __packed {
...@@ -199,26 +199,26 @@ struct __packed qla27xx_fwdt_entry { ...@@ -199,26 +199,26 @@ struct __packed qla27xx_fwdt_entry {
} t274; } t274;
struct __packed { struct __packed {
uint32_t length; __le32 length;
uint8_t buffer[]; uint8_t buffer[];
} t275; } t275;
struct __packed { struct __packed {
uint32_t cond1; __le32 cond1;
uint32_t cond2; __le32 cond2;
} t276; } t276;
struct __packed { struct __packed {
uint32_t cmd_addr; __le32 cmd_addr;
uint32_t wr_cmd_data; __le32 wr_cmd_data;
uint32_t data_addr; __le32 data_addr;
} t277; } t277;
struct __packed { struct __packed {
uint32_t cmd_addr; __le32 cmd_addr;
uint32_t wr_cmd_data; __le32 wr_cmd_data;
uint32_t data_addr; __le32 data_addr;
uint32_t wr_data; __le32 wr_data;
} t278; } t278;
}; };
}; };
......
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