[SCSI] qla2xxx: Add setting of driver version string for vendor application.
authorJoe Carnuccio <joe.carnuccio@qlogic.com>
Tue, 27 Aug 2013 05:37:35 +0000 (01:37 -0400)
committerJames Bottomley <JBottomley@Parallels.com>
Tue, 3 Sep 2013 14:28:02 +0000 (07:28 -0700)
Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/qla2xxx/qla_dbg.c
drivers/scsi/qla2xxx/qla_def.h
drivers/scsi/qla2xxx/qla_gbl.h
drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_mbx.c

index 6ee4fcb0df7efdb33b073a8c2cdc9402987b66de..ecaafe4f1d12160a2bf0d5d0a4e0d67040057ac1 100644 (file)
@@ -12,7 +12,7 @@
  * |             Level            |   Last Value Used  |     Holes     |
  * ----------------------------------------------------------------------
  * | Module Init and Probe        |       0x0151       | 0x4b,0xba,0xfa |
- * | Mailbox commands             |       0x117a       | 0x111a-0x111b  |
+ * | Mailbox commands             |       0x1181       | 0x111a-0x111b  |
  * |                              |                    | 0x1155-0x1158  |
  * | Device Discovery             |       0x2095       | 0x2020-0x2022, |
  * |                              |                    | 0x2011-0x2012, |
index 58e4f19a27e29238e30b6106df9d002834f107ac..f393d24bbbacefa883d40578ffb6fd104c45c60e 100644 (file)
@@ -999,6 +999,7 @@ struct mbx_cmd_32 {
 #define        MBX_1           BIT_1
 #define        MBX_0           BIT_0
 
+#define RNID_TYPE_SET_VERSION  0x9
 #define RNID_TYPE_ASIC_TEMP    0xC
 
 /*
index 0730284ad967fd3848ae3766e43a66c46c1b64c9..5d960c5935881b627639f39807756734de6f2a98 100644 (file)
@@ -356,6 +356,12 @@ qla2x00_enable_fce_trace(scsi_qla_host_t *, dma_addr_t, uint16_t , uint16_t *,
 extern int
 qla2x00_disable_fce_trace(scsi_qla_host_t *, uint64_t *, uint64_t *);
 
+extern int
+qla82xx_set_driver_version(scsi_qla_host_t *, char *);
+
+extern int
+qla25xx_set_driver_version(scsi_qla_host_t *, char *);
+
 extern int
 qla2x00_read_sfp(scsi_qla_host_t *, dma_addr_t, uint8_t *,
        uint16_t, uint16_t, uint16_t, uint16_t);
index a92b166a73e247264887fed087d7651672988d5e..71cbdeb591c78daecfa23ffbad92fef3c8fdfa7c 100644 (file)
@@ -626,6 +626,11 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha)
        if (IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha))
                qla24xx_read_fcp_prio_cfg(vha);
 
+       if (IS_P3P_TYPE(ha))
+               qla82xx_set_driver_version(vha, QLA2XXX_VERSION);
+       else
+               qla25xx_set_driver_version(vha, QLA2XXX_VERSION);
+
        return (rval);
 }
 
index bce41f4fc5fac0e4c2667e1172ab0ab464b609a8..ce761106cfa4b6b8c6cdccb686a5b23a8dfe5458 100644 (file)
@@ -3862,6 +3862,112 @@ qla81xx_restart_mpi_firmware(scsi_qla_host_t *vha)
        return rval;
 }
 
+int
+qla82xx_set_driver_version(scsi_qla_host_t *vha, char *version)
+{
+       int rval;
+       mbx_cmd_t mc;
+       mbx_cmd_t *mcp = &mc;
+       int i;
+       int len;
+       uint16_t *str;
+       struct qla_hw_data *ha = vha->hw;
+
+       if (!IS_P3P_TYPE(ha))
+               return QLA_FUNCTION_FAILED;
+
+       ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x117b,
+           "Entered %s.\n", __func__);
+
+       str = (void *)version;
+       len = strlen(version);
+
+       mcp->mb[0] = MBC_SET_RNID_PARAMS;
+       mcp->mb[1] = RNID_TYPE_SET_VERSION << 8;
+       mcp->out_mb = MBX_1|MBX_0;
+       for (i = 4; i < 16 && len; i++, str++, len -= 2) {
+               mcp->mb[i] = cpu_to_le16p(str);
+               mcp->out_mb |= 1<<i;
+       }
+       for (; i < 16; i++) {
+               mcp->mb[i] = 0;
+               mcp->out_mb |= 1<<i;
+       }
+       mcp->in_mb = MBX_1|MBX_0;
+       mcp->tov = MBX_TOV_SECONDS;
+       mcp->flags = 0;
+       rval = qla2x00_mailbox_command(vha, mcp);
+
+       if (rval != QLA_SUCCESS) {
+               ql_dbg(ql_dbg_mbx, vha, 0x117c,
+                   "Failed=%x mb[0]=%x,%x.\n", rval, mcp->mb[0], mcp->mb[1]);
+       } else {
+               ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x117d,
+                   "Done %s.\n", __func__);
+       }
+
+       return rval;
+}
+
+int
+qla25xx_set_driver_version(scsi_qla_host_t *vha, char *version)
+{
+       int rval;
+       mbx_cmd_t mc;
+       mbx_cmd_t *mcp = &mc;
+       int len;
+       uint16_t dwlen;
+       uint8_t *str;
+       dma_addr_t str_dma;
+       struct qla_hw_data *ha = vha->hw;
+
+       if (!IS_FWI2_CAPABLE(ha) || IS_QLA24XX_TYPE(ha) || IS_QLA81XX(ha) ||
+           IS_P3P_TYPE(ha))
+               return QLA_FUNCTION_FAILED;
+
+       ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x117e,
+           "Entered %s.\n", __func__);
+
+       str = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &str_dma);
+       if (!str) {
+               ql_log(ql_log_warn, vha, 0x117f,
+                   "Failed to allocate driver version param.\n");
+               return QLA_MEMORY_ALLOC_FAILED;
+       }
+
+       memcpy(str, "\x7\x3\x11\x0", 4);
+       dwlen = str[0];
+       len = dwlen * 4 - 4;
+       memset(str + 4, 0, len);
+       if (len > strlen(version))
+               len = strlen(version);
+       memcpy(str + 4, version, len);
+
+       mcp->mb[0] = MBC_SET_RNID_PARAMS;
+       mcp->mb[1] = RNID_TYPE_SET_VERSION << 8 | dwlen;
+       mcp->mb[2] = MSW(LSD(str_dma));
+       mcp->mb[3] = LSW(LSD(str_dma));
+       mcp->mb[6] = MSW(MSD(str_dma));
+       mcp->mb[7] = LSW(MSD(str_dma));
+       mcp->out_mb = MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0;
+       mcp->in_mb = MBX_1|MBX_0;
+       mcp->tov = MBX_TOV_SECONDS;
+       mcp->flags = 0;
+       rval = qla2x00_mailbox_command(vha, mcp);
+
+       if (rval != QLA_SUCCESS) {
+               ql_dbg(ql_dbg_mbx, vha, 0x1180,
+                   "Failed=%x mb[0]=%x,%x.\n", rval, mcp->mb[0], mcp->mb[1]);
+       } else {
+               ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1181,
+                   "Done %s.\n", __func__);
+       }
+
+       dma_pool_free(ha->s_dma_pool, str, str_dma);
+
+       return rval;
+}
+
 static int
 qla2x00_read_asic_temperature(scsi_qla_host_t *vha, uint16_t *temp)
 {