mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
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 <[email protected]>
This commit is contained in:
parent
8f078b38dd
commit
9d62ed9651
5 changed files with 39 additions and 10 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue