diff options
author | Toshi Kani <toshi.kani@hpe.com> | 2016-04-25 17:34:59 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2016-04-26 17:48:04 -0400 |
commit | 38a879ba9c0a6849fe26c36e325f754a89848da7 (patch) | |
tree | 22553c50e19a9d8370701c645605730b5548fbf0 | |
parent | 5ad9a7fde07a95b326da9e650b4f0a41b85e47b5 (diff) |
acpi/nfit: Add sysfs "id" for NVDIMM ID
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>
-rw-r--r-- | drivers/acpi/nfit.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c index 5dc243c65dee..5a7199db2e06 100644 --- a/drivers/acpi/nfit.c +++ b/drivers/acpi/nfit.c | |||
@@ -870,6 +870,24 @@ static ssize_t flags_show(struct device *dev, | |||
870 | } | 870 | } |
871 | static DEVICE_ATTR_RO(flags); | 871 | static DEVICE_ATTR_RO(flags); |
872 | 872 | ||
873 | static ssize_t id_show(struct device *dev, | ||
874 | struct device_attribute *attr, char *buf) | ||
875 | { | ||
876 | struct acpi_nfit_control_region *dcr = to_nfit_dcr(dev); | ||
877 | |||
878 | if (dcr->valid_fields & ACPI_NFIT_CONTROL_MFG_INFO_VALID) | ||
879 | return sprintf(buf, "%04x-%02x-%04x-%08x\n", | ||
880 | be16_to_cpu(dcr->vendor_id), | ||
881 | dcr->manufacturing_location, | ||
882 | be16_to_cpu(dcr->manufacturing_date), | ||
883 | be32_to_cpu(dcr->serial_number)); | ||
884 | else | ||
885 | return sprintf(buf, "%04x-%08x\n", | ||
886 | be16_to_cpu(dcr->vendor_id), | ||
887 | be32_to_cpu(dcr->serial_number)); | ||
888 | } | ||
889 | static DEVICE_ATTR_RO(id); | ||
890 | |||
873 | static struct attribute *acpi_nfit_dimm_attributes[] = { | 891 | static struct attribute *acpi_nfit_dimm_attributes[] = { |
874 | &dev_attr_handle.attr, | 892 | &dev_attr_handle.attr, |
875 | &dev_attr_phys_id.attr, | 893 | &dev_attr_phys_id.attr, |
@@ -879,6 +897,7 @@ static struct attribute *acpi_nfit_dimm_attributes[] = { | |||
879 | &dev_attr_serial.attr, | 897 | &dev_attr_serial.attr, |
880 | &dev_attr_rev_id.attr, | 898 | &dev_attr_rev_id.attr, |
881 | &dev_attr_flags.attr, | 899 | &dev_attr_flags.attr, |
900 | &dev_attr_id.attr, | ||
882 | NULL, | 901 | NULL, |
883 | }; | 902 | }; |
884 | 903 | ||