Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1386940

[PATCH v3 2/2] acpi/nfit: Add sysfs "id" for NVDIMM ID

From Toshi Kani <toshi.kani@hpe.com>
Newsgroups linux.kernel
Subject [PATCH v3 2/2] acpi/nfit: Add sysfs "id" for NVDIMM ID
Date 2016-04-25 23:50 +0200
Message-ID <rrWyf-4kQ-35@gated-at.bofh.it> (permalink)
References <rrWye-4kQ-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 drivers/acpi/nfit.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
index 5dc243c..5a7199d 100644
--- a/drivers/acpi/nfit.c
+++ b/drivers/acpi/nfit.c
@@ -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,
@@ -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,
 };
 

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/2] Support ACPI 6.1 update in NFIT Control Region Structure Toshi Kani <toshi.kani@hpe.com> - 2016-04-25 23:50 +0200
  [PATCH v3 2/2] acpi/nfit: Add sysfs "id" for NVDIMM ID Toshi Kani <toshi.kani@hpe.com> - 2016-04-25 23:50 +0200
  [PATCH v3 1/2] acpi/nfit: Update nfit driver to comply with ACPI 6.1 Toshi Kani <toshi.kani@hpe.com> - 2016-04-25 23:50 +0200
  Re: [PATCH v3 0/2] Support ACPI 6.1 update in NFIT Control Region Structure Dan Williams <dan.j.williams@intel.com> - 2016-04-27 02:00 +0200

csiph-web