]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
qla2xxx: Add FW DUMP SIZE sysfs attribute.
authorHarish Zunjarrao <harish.zunjarrao@qlogic.com>
Wed, 30 May 2012 06:44:58 +0000 (23:44 -0700)
committerMaxim Uvarov <maxim.uvarov@oracle.com>
Mon, 23 Jul 2012 08:02:45 +0000 (01:02 -0700)
JIRA Key: V2632FC-211

drivers/scsi/qla2xxx/qla_attr.c

index 23420c290e339aaa96dc4089977f41c84cbe88b3..4603e74009eeee829697354c176daedf7c8f33e5 100644 (file)
@@ -1274,6 +1274,24 @@ qla2x00_diag_megabytes_show(struct device *dev,
        return snprintf(buf, PAGE_SIZE, "%llu\n", vha->bidi_stats.transfer_bytes >> 20);
 }
 
+static ssize_t
+qla2x00_fw_dump_size_show(struct device *dev, struct device_attribute *attr,
+    char *buf)
+{
+       scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
+       struct qla_hw_data *ha = vha->hw;
+       uint32_t size;
+
+       if (!ha->fw_dumped)
+               size = 0;
+       else if (IS_QLA82XX(ha))
+               size = ha->md_template_size + ha->md_dump_size;
+       else
+               size = ha->fw_dump_len;
+
+       return snprintf(buf, PAGE_SIZE, "%d\n", size);
+}
+
 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(serial_num, S_IRUGO, qla2x00_serial_num_show, NULL);
@@ -1314,6 +1332,7 @@ static DEVICE_ATTR(fw_state, S_IRUGO, qla2x00_fw_state_show, NULL);
 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_megabytes, S_IRUGO, qla2x00_diag_megabytes_show, NULL);
+static DEVICE_ATTR(fw_dump_size, S_IRUGO, qla2x00_fw_dump_size_show, NULL);
 
 struct device_attribute *qla2x00_host_attrs[] = {
        &dev_attr_driver_version,
@@ -1345,6 +1364,7 @@ struct device_attribute *qla2x00_host_attrs[] = {
        &dev_attr_thermal_temp,
        &dev_attr_diag_requests,
        &dev_attr_diag_megabytes,
+       &dev_attr_fw_dump_size,
        NULL,
 };