Skip to content

Commit

Permalink
acpi/nfit: Add sysfs "id" for NVDIMM ID
Browse files Browse the repository at this point in the history
ACPI 6.1, section 5.2.25.9, defines an identifier for an NVDIMM.

Change the NFIT driver to add a new sysfs file "id" under nfit
directory.

Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Robert Moore <robert.moore@intel.com>
Cc: Robert Elliott <elliott@hpe.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
  • Loading branch information
Toshi Kani authored and Dan Williams committed Apr 26, 2016
1 parent 5ad9a7f commit 38a879b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions drivers/acpi/nfit.c
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,24 @@ static ssize_t flags_show(struct device *dev,
}
static DEVICE_ATTR_RO(flags);

static ssize_t id_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct acpi_nfit_control_region *dcr = to_nfit_dcr(dev);

if (dcr->valid_fields & ACPI_NFIT_CONTROL_MFG_INFO_VALID)
return sprintf(buf, "%04x-%02x-%04x-%08x\n",
be16_to_cpu(dcr->vendor_id),
dcr->manufacturing_location,
be16_to_cpu(dcr->manufacturing_date),
be32_to_cpu(dcr->serial_number));
else
return sprintf(buf, "%04x-%08x\n",
be16_to_cpu(dcr->vendor_id),
be32_to_cpu(dcr->serial_number));
}
static DEVICE_ATTR_RO(id);

static struct attribute *acpi_nfit_dimm_attributes[] = {
&dev_attr_handle.attr,
&dev_attr_phys_id.attr,
Expand All @@ -879,6 +897,7 @@ static struct attribute *acpi_nfit_dimm_attributes[] = {
&dev_attr_serial.attr,
&dev_attr_rev_id.attr,
&dev_attr_flags.attr,
&dev_attr_id.attr,
NULL,
};

Expand Down

0 comments on commit 38a879b

Please sign in to comment.