linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Toshi Kani <toshi.kani@hpe.com>
To: rjw@rjwysocki.net, dan.j.williams@intel.com
Cc: robert.moore@intel.com, elliott@hpe.com,
	linux-nvdimm@lists.01.org, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org, Toshi Kani <toshi.kani@hpe.com>
Subject: [PATCH v3 2/2] acpi/nfit: Add sysfs "id" for NVDIMM ID
Date: Mon, 25 Apr 2016 15:34:59 -0600	[thread overview]
Message-ID: <1461620099-11933-3-git-send-email-toshi.kani@hpe.com> (raw)
In-Reply-To: <1461620099-11933-1-git-send-email-toshi.kani@hpe.com>

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,
 };
 

  parent reply	other threads:[~2016-04-25 21:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-25 21:34 [PATCH v3 0/2] Support ACPI 6.1 update in NFIT Control Region Structure Toshi Kani
2016-04-25 21:34 ` [PATCH v3 1/2] acpi/nfit: Update nfit driver to comply with ACPI 6.1 Toshi Kani
     [not found]   ` <1461620099-11933-2-git-send-email-toshi.kani-ZPxbGqLxI0U@public.gmane.org>
2018-06-18 19:01     ` Dan Williams
     [not found]       ` <CAA9_cmenbY9GStibRjO0BfTq0kzzzqThiLeOygJsT9L03BFsBQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-06-18 19:39         ` Kani, Toshi
2018-06-18 19:46           ` Dan Williams
     [not found]             ` <CAPcyv4jbctFgCob58sjQZ8msGOT7GBe=+Z_2P6YvNrrK-ztMag-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-06-18 21:37               ` Elliott, Robert (Persistent Memory)
     [not found]                 ` <AT5PR8401MB1169FA8B55B36BAE8DF0F6EBAB710-TASIVIpwxD5P8eCFU2xCp5pmD3emsgjRq6DjORPBYUW4xSMpw2roznzNABE0Ld/Y@public.gmane.org>
2018-06-18 21:46                   ` Dan Williams
     [not found]                     ` <CAPcyv4goV+VR15qpio-wqDpDS3nXsfYEbTSk1Ws6DPp6ECKcRQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-06-19 14:31                       ` Elliott, Robert (Persistent Memory)
     [not found]                         ` <AT5PR8401MB1169ECE7D26644D39DB735D5AB700-TASIVIpwxD5P8eCFU2xCp5pmD3emsgjRq6DjORPBYUW4xSMpw2roznzNABE0Ld/Y@public.gmane.org>
2018-06-19 15:28                           ` Dan Williams
     [not found]                             ` <CAPcyv4joz7OemcKvJMJVhqKEVgSMpfLbm2DRP9B=S3vRPUAGkQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-06-19 19:53                               ` Elliott, Robert (Persistent Memory)
     [not found]                                 ` <AT5PR8401MB1169CBD96EE6C152A24D9FD3AB700-TASIVIpwxD5P8eCFU2xCp5pmD3emsgjRq6DjORPBYUW4xSMpw2roznzNABE0Ld/Y@public.gmane.org>
2018-06-19 23:46                                   ` Dan Williams
2016-04-25 21:34 ` Toshi Kani [this message]
2016-04-26 23:54 ` [PATCH v3 0/2] Support ACPI 6.1 update in NFIT Control Region Structure Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1461620099-11933-3-git-send-email-toshi.kani@hpe.com \
    --to=toshi.kani@hpe.com \
    --cc=dan.j.williams@intel.com \
    --cc=elliott@hpe.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=rjw@rjwysocki.net \
    --cc=robert.moore@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).