From patchwork Mon Feb 22 21:55:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kani, Toshi" X-Patchwork-Id: 8383221 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 490D49F1D4 for ; Mon, 22 Feb 2016 21:02:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3232E205D1 for ; Mon, 22 Feb 2016 21:02:45 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4EE8C204A0 for ; Mon, 22 Feb 2016 21:02:44 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 44AC31A1E36; Mon, 22 Feb 2016 13:02:46 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from g4t3427.houston.hp.com (g4t3427.houston.hp.com [15.201.208.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5F77F1A1E32 for ; Mon, 22 Feb 2016 13:02:45 -0800 (PST) Received: from g4t3433.houston.hp.com (g4t3433.houston.hp.com [16.210.25.219]) by g4t3427.houston.hp.com (Postfix) with ESMTP id 53ADE4C; Mon, 22 Feb 2016 21:02:42 +0000 (UTC) Received: from misato.fc.hp.com (misato.fc.hp.com [16.78.168.61]) by g4t3433.houston.hp.com (Postfix) with ESMTP id 708AC64; Mon, 22 Feb 2016 21:02:41 +0000 (UTC) From: Toshi Kani To: rjw@rjwysocki.net, dan.j.williams@intel.com Subject: [PATCH v2 2/3] ACPI/NFIT: Add NVDIMM ID "id" under sysfs Date: Mon, 22 Feb 2016 14:55:29 -0700 Message-Id: <1456178130-26468-3-git-send-email-toshi.kani@hpe.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1456178130-26468-1-git-send-email-toshi.kani@hpe.com> References: <1456178130-26468-1-git-send-email-toshi.kani@hpe.com> Cc: linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, robert.moore@intel.com, linux-acpi@vger.kernel.org, lv.zheng@intel.com, devel@acpica.org X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ACPI 6.1, section 5.2.25.9, defines an identifier for an NVDIMM. Change the NFIT driver to create read-only "id" file under NVDIMM's nfit directory of sysfs, which shows the NVDIMM ID. Signed-off-by: Toshi Kani Cc: Rafael J. Wysocki Cc: Dan Williams Cc: Robert Elliott --- drivers/acpi/nfit.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c index 4982a18..677cf89 100644 --- a/drivers/acpi/nfit.c +++ b/drivers/acpi/nfit.c @@ -781,6 +781,26 @@ 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, "%02x%02x-%02x-%02x%02x-%02x%02x%02x%02x\n", + dcr->vendor_id[0], dcr->vendor_id[1], + dcr->manufacturing_location, + dcr->manufacturing_date[0], dcr->manufacturing_date[1], + dcr->serial_number[0], dcr->serial_number[1], + dcr->serial_number[2], dcr->serial_number[3]); + else + return sprintf(buf, "%02x%02x-%02x%02x%02x%02x\n", + dcr->vendor_id[0], dcr->vendor_id[1], + dcr->serial_number[0], dcr->serial_number[1], + dcr->serial_number[2], dcr->serial_number[3]); +} +static DEVICE_ATTR_RO(id); + static struct attribute *acpi_nfit_dimm_attributes[] = { &dev_attr_handle.attr, &dev_attr_phys_id.attr, @@ -790,6 +810,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, };