WIP FPC-III support
[linux/fpc-iii.git] / tools / testing / nvdimm / dimm_devs.c
blob57bd27dedf1f0c0410ce8d08693955f0e0a76ec8
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright Intel Corp. 2018 */
3 #include <linux/init.h>
4 #include <linux/module.h>
5 #include <linux/moduleparam.h>
6 #include <linux/nd.h>
7 #include "pmem.h"
8 #include "pfn.h"
9 #include "nd.h"
10 #include "nd-core.h"
12 ssize_t security_show(struct device *dev,
13 struct device_attribute *attr, char *buf)
15 struct nvdimm *nvdimm = to_nvdimm(dev);
18 * For the test version we need to poll the "hardware" in order
19 * to get the updated status for unlock testing.
21 nvdimm->sec.flags = nvdimm_security_flags(nvdimm, NVDIMM_USER);
23 if (test_bit(NVDIMM_SECURITY_DISABLED, &nvdimm->sec.flags))
24 return sprintf(buf, "disabled\n");
25 if (test_bit(NVDIMM_SECURITY_UNLOCKED, &nvdimm->sec.flags))
26 return sprintf(buf, "unlocked\n");
27 if (test_bit(NVDIMM_SECURITY_LOCKED, &nvdimm->sec.flags))
28 return sprintf(buf, "locked\n");
29 return -ENOTTY;