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>
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");