summaryrefslogtreecommitdiffstats
path: root/drivers/nvdimm
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2017-09-25 10:24:26 -0700
committerDan Williams <dan.j.williams@intel.com>2017-10-07 10:04:06 -0700
commitefbf6f50ada168b68f5e3de474bc8dee4a02d046 (patch)
tree411d9aafc359561708f056c67951d22f9ac8bbaf /drivers/nvdimm
parent4b27db7e26cdb9deb4a211e963e2993fde0110cb (diff)
downloadlinux-efbf6f50ada168b68f5e3de474bc8dee4a02d046.tar.bz2
libnvdimm: introduce 'flags' attribute for DIMM 'lock' and 'alias' status
Given that we now how have two mechanisms for a DIMM to indicate that it is locked: * NVDIMM_FAMILY_INTEL 'get_config_size' _DSM command * ACPI 6.2 Label Storage Read / Write commands ...export the generic libnvdimm DIMM status in a new 'flags' attribute. This attribute can also reflect the 'alias' state which indicates whether the nvdimm core is enforcing labels for aliased-region-capacity that the given dimm is an interleave-set member. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm')
-rw-r--r--drivers/nvdimm/dimm_devs.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c
index 5f1385b96b13..097794d9f786 100644
--- a/drivers/nvdimm/dimm_devs.c
+++ b/drivers/nvdimm/dimm_devs.c
@@ -331,6 +331,17 @@ static ssize_t commands_show(struct device *dev,
}
static DEVICE_ATTR_RO(commands);
+static ssize_t flags_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct nvdimm *nvdimm = to_nvdimm(dev);
+
+ return sprintf(buf, "%s%s\n",
+ test_bit(NDD_ALIASING, &nvdimm->flags) ? "alias " : "",
+ test_bit(NDD_LOCKED, &nvdimm->flags) ? "lock " : "");
+}
+static DEVICE_ATTR_RO(flags);
+
static ssize_t state_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
@@ -372,6 +383,7 @@ static DEVICE_ATTR_RO(available_slots);
static struct attribute *nvdimm_attributes[] = {
&dev_attr_state.attr,
+ &dev_attr_flags.attr,
&dev_attr_commands.attr,
&dev_attr_available_slots.attr,
NULL,