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

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
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1962,7 +1962,7 @@ qlafx00_mgmt_cmd(struct bsg_job *bsg_job)

	/* Dump the vendor information */
	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) {
		ql_log(ql_log_warn, vha, 0x70d0,
@@ -2324,8 +2324,8 @@ qla2x00_get_priv_stats(struct bsg_job *bsg_job)
	rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma, options);

	if (rval == QLA_SUCCESS) {
		ql_dump_buffer(ql_dbg_user + ql_dbg_verbose, vha, 0x70e3,
		    (uint8_t *)stats, sizeof(*stats));
		ql_dump_buffer(ql_dbg_user + ql_dbg_verbose, vha, 0x70e5,
			stats, sizeof(*stats));
		sg_copy_from_buffer(bsg_job->reply_payload.sg_list,
			bsg_job->reply_payload.sg_cnt, stats, sizeof(*stats));
	}
+8 −11
Original line number Diff line number Diff line
@@ -2520,7 +2520,7 @@ qla83xx_fw_dump_failed:
/****************************************************************************/

static inline int
ql_mask_match(uint32_t level)
ql_mask_match(uint level)
{
	return (level & ql2xextended_error_logging) == level;
}
@@ -2539,7 +2539,7 @@ ql_mask_match(uint32_t level)
 * msg:   The message to be displayed.
 */
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;
	struct va_format vaf;
@@ -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.
 */
void
ql_dbg_pci(uint32_t level, struct pci_dev *pdev, int32_t id,
	   const char *fmt, ...)
ql_dbg_pci(uint level, struct pci_dev *pdev, uint id, const char *fmt, ...)
{
	va_list va;
	struct va_format vaf;
@@ -2619,7 +2618,7 @@ ql_dbg_pci(uint32_t level, struct pci_dev *pdev, int32_t id,
 * msg:   The message to be displayed.
 */
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;
	struct va_format vaf;
@@ -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.
 */
void
ql_log_pci(uint32_t level, struct pci_dev *pdev, int32_t id,
	   const char *fmt, ...)
ql_log_pci(uint level, struct pci_dev *pdev, uint id, const char *fmt, ...)
{
	va_list va;
	struct va_format vaf;
@@ -2718,7 +2716,7 @@ ql_log_pci(uint32_t level, struct pci_dev *pdev, int32_t id,
}

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;
	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)
	ql_dbg(level, vha, id, "Mailbox registers:\n");
	for (i = 0; i < 6; i++, mbx_reg++)
		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
ql_dump_buffer(uint32_t level, scsi_qla_host_t *vha, int32_t id,
	uint8_t *buf, uint size)
ql_dump_buffer(uint level, scsi_qla_host_t *vha, uint id, void *buf, uint size)
{
	uint cnt;

+5 −5
Original line number Diff line number Diff line
@@ -318,20 +318,20 @@ struct qla2xxx_fw_dump {
				   * as compared to other log levels.
				   */

extern int ql_errlev;
extern uint ql_errlev;

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)))
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)))
ql_dbg_qp(uint32_t, struct qla_qpair *, int32_t, const char *fmt, ...);


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)))
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)))
ql_log_qp(uint32_t, struct qla_qpair *, int32_t, const char *fmt, ...);
+1 −1
Original line number Diff line number Diff line
@@ -4467,7 +4467,7 @@ typedef struct scsi_qla_host {

struct qla27xx_image_status {
	uint8_t image_status_mask;
	uint16_t generation_number;
	uint16_t generation;
	uint8_t reserved[3];
	uint8_t ver_minor;
	uint8_t ver_major;
+3 −1
Original line number Diff line number Diff line
@@ -1516,7 +1516,9 @@ struct qla_flt_header {
#define FLT_REG_VPD_SEC_27XX_3	0xDA

struct qla_flt_region {
	uint32_t code;
	uint16_t code;
	uint8_t attribute;
	uint8_t reserved;
	uint32_t size;
	uint32_t start;
	uint32_t end;
Loading