diff options
author | Giridhar Malavali <giridhar.malavali@qlogic.com> | 2011-08-16 14:31:44 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-08-29 03:12:26 -0400 |
commit | 08de2844c626511cfd1db9c36e5e7d126707f780 (patch) | |
tree | 0acfe3150cc5d0eb28c4c242c040c45cec5758af /drivers/scsi/qla2xxx/qla_mbx.c | |
parent | 86a9668a8d29ea711613e1cb37efa68e7c4db564 (diff) |
[SCSI] qla2xxx: Add support for ISP82xx to capture dump (minidump) on failure.
Minidump allows us to catpure a snapshot of the firmware/hardware states at the
time of failure for further analysis.
[jejb: added missing #include <linux/vmalloc.h>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> ]
Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_mbx.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_mbx.c | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index f7604ea1af83..a41137452c41 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c | |||
@@ -4186,3 +4186,92 @@ qla82xx_mbx_intr_disable(scsi_qla_host_t *vha) | |||
4186 | 4186 | ||
4187 | return rval; | 4187 | return rval; |
4188 | } | 4188 | } |
4189 | |||
4190 | int | ||
4191 | qla82xx_md_get_template_size(scsi_qla_host_t *vha) | ||
4192 | { | ||
4193 | struct qla_hw_data *ha = vha->hw; | ||
4194 | mbx_cmd_t mc; | ||
4195 | mbx_cmd_t *mcp = &mc; | ||
4196 | int rval = QLA_FUNCTION_FAILED; | ||
4197 | |||
4198 | ql_dbg(ql_dbg_mbx, vha, 0x111f, "Entered %s.\n", __func__); | ||
4199 | |||
4200 | memset(mcp->mb, 0 , sizeof(mcp->mb)); | ||
4201 | mcp->mb[0] = LSW(MBC_DIAGNOSTIC_MINIDUMP_TEMPLATE); | ||
4202 | mcp->mb[1] = MSW(MBC_DIAGNOSTIC_MINIDUMP_TEMPLATE); | ||
4203 | mcp->mb[2] = LSW(RQST_TMPLT_SIZE); | ||
4204 | mcp->mb[3] = MSW(RQST_TMPLT_SIZE); | ||
4205 | |||
4206 | mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; | ||
4207 | mcp->in_mb = MBX_14|MBX_13|MBX_12|MBX_11|MBX_10|MBX_9|MBX_8| | ||
4208 | MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; | ||
4209 | |||
4210 | mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD; | ||
4211 | mcp->tov = MBX_TOV_SECONDS; | ||
4212 | rval = qla2x00_mailbox_command(vha, mcp); | ||
4213 | |||
4214 | /* Always copy back return mailbox values. */ | ||
4215 | if (rval != QLA_SUCCESS) { | ||
4216 | ql_dbg(ql_dbg_mbx, vha, 0x1120, | ||
4217 | "mailbox command FAILED=0x%x, subcode=%x.\n", | ||
4218 | (mcp->mb[1] << 16) | mcp->mb[0], | ||
4219 | (mcp->mb[3] << 16) | mcp->mb[2]); | ||
4220 | } else { | ||
4221 | ql_dbg(ql_dbg_mbx, vha, 0x1121, "Done %s.\n", __func__); | ||
4222 | ha->md_template_size = ((mcp->mb[3] << 16) | mcp->mb[2]); | ||
4223 | if (!ha->md_template_size) { | ||
4224 | ql_dbg(ql_dbg_mbx, vha, 0x1122, | ||
4225 | "Null template size obtained.\n"); | ||
4226 | rval = QLA_FUNCTION_FAILED; | ||
4227 | } | ||
4228 | } | ||
4229 | return rval; | ||
4230 | } | ||
4231 | |||
4232 | int | ||
4233 | qla82xx_md_get_template(scsi_qla_host_t *vha) | ||
4234 | { | ||
4235 | struct qla_hw_data *ha = vha->hw; | ||
4236 | mbx_cmd_t mc; | ||
4237 | mbx_cmd_t *mcp = &mc; | ||
4238 | int rval = QLA_FUNCTION_FAILED; | ||
4239 | |||
4240 | ql_dbg(ql_dbg_mbx, vha, 0x1123, "Entered %s.\n", __func__); | ||
4241 | |||
4242 | ha->md_tmplt_hdr = dma_alloc_coherent(&ha->pdev->dev, | ||
4243 | ha->md_template_size, &ha->md_tmplt_hdr_dma, GFP_KERNEL); | ||
4244 | if (!ha->md_tmplt_hdr) { | ||
4245 | ql_log(ql_log_warn, vha, 0x1124, | ||
4246 | "Unable to allocate memory for Minidump template.\n"); | ||
4247 | return rval; | ||
4248 | } | ||
4249 | |||
4250 | memset(mcp->mb, 0 , sizeof(mcp->mb)); | ||
4251 | mcp->mb[0] = LSW(MBC_DIAGNOSTIC_MINIDUMP_TEMPLATE); | ||
4252 | mcp->mb[1] = MSW(MBC_DIAGNOSTIC_MINIDUMP_TEMPLATE); | ||
4253 | mcp->mb[2] = LSW(RQST_TMPLT); | ||
4254 | mcp->mb[3] = MSW(RQST_TMPLT); | ||
4255 | mcp->mb[4] = LSW(LSD(ha->md_tmplt_hdr_dma)); | ||
4256 | mcp->mb[5] = MSW(LSD(ha->md_tmplt_hdr_dma)); | ||
4257 | mcp->mb[6] = LSW(MSD(ha->md_tmplt_hdr_dma)); | ||
4258 | mcp->mb[7] = MSW(MSD(ha->md_tmplt_hdr_dma)); | ||
4259 | mcp->mb[8] = LSW(ha->md_template_size); | ||
4260 | mcp->mb[9] = MSW(ha->md_template_size); | ||
4261 | |||
4262 | mcp->flags = MBX_DMA_OUT|MBX_DMA_IN|IOCTL_CMD; | ||
4263 | mcp->tov = MBX_TOV_SECONDS; | ||
4264 | mcp->out_mb = MBX_11|MBX_10|MBX_9|MBX_8| | ||
4265 | MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; | ||
4266 | mcp->in_mb = MBX_3|MBX_2|MBX_1|MBX_0; | ||
4267 | rval = qla2x00_mailbox_command(vha, mcp); | ||
4268 | |||
4269 | if (rval != QLA_SUCCESS) { | ||
4270 | ql_dbg(ql_dbg_mbx, vha, 0x1125, | ||
4271 | "mailbox command FAILED=0x%x, subcode=%x.\n", | ||
4272 | ((mcp->mb[1] << 16) | mcp->mb[0]), | ||
4273 | ((mcp->mb[3] << 16) | mcp->mb[2])); | ||
4274 | } else | ||
4275 | ql_dbg(ql_dbg_mbx, vha, 0x1126, "Done %s.\n", __func__); | ||
4276 | return rval; | ||
4277 | } | ||