提交 a1b23c5a 编写于 作者: C Chad Dupuis 提交者: James Bottomley

[SCSI] qla2xxx: Read capture firmware dump on mailbox timeout for ISP8044 and ISP82XX.

Allow for the capture of a firmware dump but have a sysfs node
(allow_cna_fw_dump) to allow the feature to be enabled/disabled dynamically.

The default is off.
Signed-off-by: NChad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: NSaurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
上级 fbe9c54b
...@@ -1503,6 +1503,37 @@ qla2x00_fw_dump_size_show(struct device *dev, struct device_attribute *attr, ...@@ -1503,6 +1503,37 @@ qla2x00_fw_dump_size_show(struct device *dev, struct device_attribute *attr,
return scnprintf(buf, PAGE_SIZE, "%d\n", size); return scnprintf(buf, PAGE_SIZE, "%d\n", size);
} }
static ssize_t
qla2x00_allow_cna_fw_dump_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
if (!IS_P3P_TYPE(vha->hw))
return scnprintf(buf, PAGE_SIZE, "\n");
else
return scnprintf(buf, PAGE_SIZE, "%s\n",
vha->hw->allow_cna_fw_dump ? "true" : "false");
}
static ssize_t
qla2x00_allow_cna_fw_dump_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
int val = 0;
if (!IS_P3P_TYPE(vha->hw))
return -EINVAL;
if (sscanf(buf, "%d", &val) != 1)
return -EINVAL;
vha->hw->allow_cna_fw_dump = val != 0;
return strlen(buf);
}
static DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, NULL); static DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, NULL);
static DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); static DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL);
static DEVICE_ATTR(serial_num, S_IRUGO, qla2x00_serial_num_show, NULL); static DEVICE_ATTR(serial_num, S_IRUGO, qla2x00_serial_num_show, NULL);
...@@ -1544,6 +1575,9 @@ static DEVICE_ATTR(thermal_temp, S_IRUGO, qla2x00_thermal_temp_show, NULL); ...@@ -1544,6 +1575,9 @@ static DEVICE_ATTR(thermal_temp, S_IRUGO, qla2x00_thermal_temp_show, NULL);
static DEVICE_ATTR(diag_requests, S_IRUGO, qla2x00_diag_requests_show, NULL); static DEVICE_ATTR(diag_requests, S_IRUGO, qla2x00_diag_requests_show, NULL);
static DEVICE_ATTR(diag_megabytes, S_IRUGO, qla2x00_diag_megabytes_show, NULL); static DEVICE_ATTR(diag_megabytes, S_IRUGO, qla2x00_diag_megabytes_show, NULL);
static DEVICE_ATTR(fw_dump_size, S_IRUGO, qla2x00_fw_dump_size_show, NULL); static DEVICE_ATTR(fw_dump_size, S_IRUGO, qla2x00_fw_dump_size_show, NULL);
static DEVICE_ATTR(allow_cna_fw_dump, S_IRUGO | S_IWUSR,
qla2x00_allow_cna_fw_dump_show,
qla2x00_allow_cna_fw_dump_store);
struct device_attribute *qla2x00_host_attrs[] = { struct device_attribute *qla2x00_host_attrs[] = {
&dev_attr_driver_version, &dev_attr_driver_version,
...@@ -1576,6 +1610,7 @@ struct device_attribute *qla2x00_host_attrs[] = { ...@@ -1576,6 +1610,7 @@ struct device_attribute *qla2x00_host_attrs[] = {
&dev_attr_diag_requests, &dev_attr_diag_requests,
&dev_attr_diag_megabytes, &dev_attr_diag_megabytes,
&dev_attr_fw_dump_size, &dev_attr_fw_dump_size,
&dev_attr_allow_cna_fw_dump,
NULL, NULL,
}; };
......
...@@ -3301,6 +3301,7 @@ struct qla_hw_data { ...@@ -3301,6 +3301,7 @@ struct qla_hw_data {
struct mr_data_fx00 mr; struct mr_data_fx00 mr;
struct qlt_hw_data tgt; struct qlt_hw_data tgt;
int allow_cna_fw_dump;
}; };
/* /*
......
...@@ -511,6 +511,8 @@ extern void qla2300_fw_dump(scsi_qla_host_t *, int); ...@@ -511,6 +511,8 @@ extern void qla2300_fw_dump(scsi_qla_host_t *, int);
extern void qla24xx_fw_dump(scsi_qla_host_t *, int); extern void qla24xx_fw_dump(scsi_qla_host_t *, int);
extern void qla25xx_fw_dump(scsi_qla_host_t *, int); extern void qla25xx_fw_dump(scsi_qla_host_t *, int);
extern void qla81xx_fw_dump(scsi_qla_host_t *, int); extern void qla81xx_fw_dump(scsi_qla_host_t *, int);
extern void qla82xx_fw_dump(scsi_qla_host_t *, int);
extern void qla8044_fw_dump(scsi_qla_host_t *, int);
extern void qla27xx_fwdump(scsi_qla_host_t *, int); extern void qla27xx_fwdump(scsi_qla_host_t *, int);
extern ulong qla27xx_fwdt_calculate_dump_size(struct scsi_qla_host *); extern ulong qla27xx_fwdt_calculate_dump_size(struct scsi_qla_host *);
......
...@@ -4502,3 +4502,20 @@ qla82xx_beacon_off(struct scsi_qla_host *vha) ...@@ -4502,3 +4502,20 @@ qla82xx_beacon_off(struct scsi_qla_host *vha)
qla82xx_idc_unlock(ha); qla82xx_idc_unlock(ha);
return rval; return rval;
} }
void
qla82xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
{
struct qla_hw_data *ha = vha->hw;
if (!ha->allow_cna_fw_dump)
return;
scsi_block_requests(vha->host);
ha->flags.isp82xx_no_md_cap = 1;
qla82xx_idc_lock(ha);
qla82xx_set_reset_owner(vha);
qla82xx_idc_unlock(ha);
qla2x00_wait_for_chip_reset(vha);
scsi_unblock_requests(vha->host);
}
...@@ -3713,3 +3713,19 @@ qla8044_abort_isp(scsi_qla_host_t *vha) ...@@ -3713,3 +3713,19 @@ qla8044_abort_isp(scsi_qla_host_t *vha)
return rval; return rval;
} }
void
qla8044_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
{
struct qla_hw_data *ha = vha->hw;
if (!ha->allow_cna_fw_dump)
return;
scsi_block_requests(vha->host);
ha->flags.isp82xx_no_md_cap = 1;
qla8044_idc_lock(ha);
qla82xx_set_reset_owner(vha);
qla8044_idc_unlock(ha);
qla2x00_wait_for_chip_reset(vha);
scsi_unblock_requests(vha->host);
}
...@@ -1975,7 +1975,7 @@ static struct isp_operations qla82xx_isp_ops = { ...@@ -1975,7 +1975,7 @@ static struct isp_operations qla82xx_isp_ops = {
.prep_ms_fdmi_iocb = qla24xx_prep_ms_fdmi_iocb, .prep_ms_fdmi_iocb = qla24xx_prep_ms_fdmi_iocb,
.read_nvram = qla24xx_read_nvram_data, .read_nvram = qla24xx_read_nvram_data,
.write_nvram = qla24xx_write_nvram_data, .write_nvram = qla24xx_write_nvram_data,
.fw_dump = qla24xx_fw_dump, .fw_dump = qla82xx_fw_dump,
.beacon_on = qla82xx_beacon_on, .beacon_on = qla82xx_beacon_on,
.beacon_off = qla82xx_beacon_off, .beacon_off = qla82xx_beacon_off,
.beacon_blink = NULL, .beacon_blink = NULL,
...@@ -2013,7 +2013,7 @@ static struct isp_operations qla8044_isp_ops = { ...@@ -2013,7 +2013,7 @@ static struct isp_operations qla8044_isp_ops = {
.prep_ms_fdmi_iocb = qla24xx_prep_ms_fdmi_iocb, .prep_ms_fdmi_iocb = qla24xx_prep_ms_fdmi_iocb,
.read_nvram = NULL, .read_nvram = NULL,
.write_nvram = NULL, .write_nvram = NULL,
.fw_dump = qla24xx_fw_dump, .fw_dump = qla8044_fw_dump,
.beacon_on = qla82xx_beacon_on, .beacon_on = qla82xx_beacon_on,
.beacon_off = qla82xx_beacon_off, .beacon_off = qla82xx_beacon_off,
.beacon_blink = NULL, .beacon_blink = NULL,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册