aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShivasharan S2019-05-07 10:05:43 -0700
committerMartin K. Petersen2019-06-18 19:46:20 -0400
commita6024a9e9153d8ff2719724e20f401878e20891d (patch)
treec2c68eb33d4625d0c0c34ddd83fc079821dbbb14
parent9a5987101c15e57720759315e66d4884378f13c3 (diff)
scsi: megaraid_sas: Export RAID map id through sysfs
Add a sysfs interface to get the raid map index that is being used by driver. Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com> Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_base.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 202d5ce60a2c..ed38cec35604 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -3274,6 +3274,18 @@ megasas_dump_system_regs_show(struct device *cdev,
return megasas_dump_sys_regs(instance->reg_set, buf);
}
+static ssize_t
+megasas_raid_map_id_show(struct device *cdev, struct device_attribute *attr,
+ char *buf)
+{
+ struct Scsi_Host *shost = class_to_shost(cdev);
+ struct megasas_instance *instance =
+ (struct megasas_instance *)shost->hostdata;
+
+ return snprintf(buf, PAGE_SIZE, "%ld\n",
+ (unsigned long)instance->map_id);
+}
+
static DEVICE_ATTR(fw_crash_buffer, S_IRUGO | S_IWUSR,
megasas_fw_crash_buffer_show, megasas_fw_crash_buffer_store);
static DEVICE_ATTR(fw_crash_buffer_size, S_IRUGO,
@@ -3288,6 +3300,8 @@ static DEVICE_ATTR(fw_cmds_outstanding, S_IRUGO,
megasas_fw_cmds_outstanding_show, NULL);
static DEVICE_ATTR(dump_system_regs, S_IRUGO,
megasas_dump_system_regs_show, NULL);
+static DEVICE_ATTR(raid_map_id, S_IRUGO,
+ megasas_raid_map_id_show, NULL);
struct device_attribute *megaraid_host_attrs[] = {
&dev_attr_fw_crash_buffer_size,
@@ -3297,6 +3311,7 @@ struct device_attribute *megaraid_host_attrs[] = {
&dev_attr_ldio_outstanding,
&dev_attr_fw_cmds_outstanding,
&dev_attr_dump_system_regs,
+ &dev_attr_raid_map_id,
NULL,
};