diff options
author | Dan Williams <dan.j.williams@intel.com> | 2017-05-04 11:47:22 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2017-05-04 15:41:39 -0700 |
commit | 9d62ed96511823fa9c2ac7a819d7b4be22a9a6de (patch) | |
tree | 960201b66f5fb6733dda4ab6b274fe6fafcf0e29 /drivers/acpi | |
parent | 8f078b38dd382710884ce7abd31a1935c440e6f8 (diff) | |
download | linux-stable-9d62ed96511823fa9c2ac7a819d7b4be22a9a6de.tar.gz linux-stable-9d62ed96511823fa9c2ac7a819d7b4be22a9a6de.tar.bz2 linux-stable-9d62ed96511823fa9c2ac7a819d7b4be22a9a6de.zip |
libnvdimm: handle locked label storage areas
Per the latest version of the "NVDIMM DSM Interface Example" [1], the
label data retrieval routine can report a "locked" status. In this case
all regions associated with that DIMM are disabled until the label area
is unlocked. Provide generic libnvdimm enabling for NVDIMMs with label
data area locking capabilities.
[1]: http://pmem.io/documents/
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/nfit/core.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index a26c2297c1ed..891bd49ada0b 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -184,14 +184,29 @@ static int xlat_bus_status(void *buf, unsigned int cmd, u32 status) return 0; } +static int xlat_nvdimm_status(void *buf, unsigned int cmd, u32 status) +{ + switch (cmd) { + case ND_CMD_GET_CONFIG_SIZE: + if (status >> 16 & ND_CONFIG_LOCKED) + return -EACCES; + break; + default: + break; + } + + /* all other non-zero status results in an error */ + if (status) + return -EIO; + return 0; +} + static int xlat_status(struct nvdimm *nvdimm, void *buf, unsigned int cmd, u32 status) { if (!nvdimm) return xlat_bus_status(buf, cmd, status); - if (status) - return -EIO; - return 0; + return xlat_nvdimm_status(buf, cmd, status); } int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, |