|
@@ -878,6 +878,58 @@ static ssize_t revision_show(struct device *dev,
|
|
|
}
|
|
}
|
|
|
static DEVICE_ATTR_RO(revision);
|
|
static DEVICE_ATTR_RO(revision);
|
|
|
|
|
|
|
|
|
|
+static ssize_t hw_error_scrub_show(struct device *dev,
|
|
|
|
|
+ struct device_attribute *attr, char *buf)
|
|
|
|
|
+{
|
|
|
|
|
+ struct nvdimm_bus *nvdimm_bus = to_nvdimm_bus(dev);
|
|
|
|
|
+ struct nvdimm_bus_descriptor *nd_desc = to_nd_desc(nvdimm_bus);
|
|
|
|
|
+ struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc);
|
|
|
|
|
+
|
|
|
|
|
+ return sprintf(buf, "%d\n", acpi_desc->scrub_mode);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/*
|
|
|
|
|
+ * The 'hw_error_scrub' attribute can have the following values written to it:
|
|
|
|
|
+ * '0': Switch to the default mode where an exception will only insert
|
|
|
|
|
+ * the address of the memory error into the poison and badblocks lists.
|
|
|
|
|
+ * '1': Enable a full scrub to happen if an exception for a memory error is
|
|
|
|
|
+ * received.
|
|
|
|
|
+ */
|
|
|
|
|
+static ssize_t hw_error_scrub_store(struct device *dev,
|
|
|
|
|
+ struct device_attribute *attr, const char *buf, size_t size)
|
|
|
|
|
+{
|
|
|
|
|
+ struct nvdimm_bus_descriptor *nd_desc;
|
|
|
|
|
+ ssize_t rc;
|
|
|
|
|
+ long val;
|
|
|
|
|
+
|
|
|
|
|
+ rc = kstrtol(buf, 0, &val);
|
|
|
|
|
+ if (rc)
|
|
|
|
|
+ return rc;
|
|
|
|
|
+
|
|
|
|
|
+ device_lock(dev);
|
|
|
|
|
+ nd_desc = dev_get_drvdata(dev);
|
|
|
|
|
+ if (nd_desc) {
|
|
|
|
|
+ struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc);
|
|
|
|
|
+
|
|
|
|
|
+ switch (val) {
|
|
|
|
|
+ case HW_ERROR_SCRUB_ON:
|
|
|
|
|
+ acpi_desc->scrub_mode = HW_ERROR_SCRUB_ON;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case HW_ERROR_SCRUB_OFF:
|
|
|
|
|
+ acpi_desc->scrub_mode = HW_ERROR_SCRUB_OFF;
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ rc = -EINVAL;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ device_unlock(dev);
|
|
|
|
|
+ if (rc)
|
|
|
|
|
+ return rc;
|
|
|
|
|
+ return size;
|
|
|
|
|
+}
|
|
|
|
|
+static DEVICE_ATTR_RW(hw_error_scrub);
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* This shows the number of full Address Range Scrubs that have been
|
|
* This shows the number of full Address Range Scrubs that have been
|
|
|
* completed since driver load time. Userspace can wait on this using
|
|
* completed since driver load time. Userspace can wait on this using
|
|
@@ -950,6 +1002,7 @@ static umode_t nfit_visible(struct kobject *kobj, struct attribute *a, int n)
|
|
|
static struct attribute *acpi_nfit_attributes[] = {
|
|
static struct attribute *acpi_nfit_attributes[] = {
|
|
|
&dev_attr_revision.attr,
|
|
&dev_attr_revision.attr,
|
|
|
&dev_attr_scrub.attr,
|
|
&dev_attr_scrub.attr,
|
|
|
|
|
+ &dev_attr_hw_error_scrub.attr,
|
|
|
NULL,
|
|
NULL,
|
|
|
};
|
|
};
|
|
|
|
|
|