Commit bdee9d98 authored by Doug Thompson's avatar Doug Thompson Committed by Greg Kroah-Hartman

[PATCH] PCI: Bus Parity Status sysfs interface

From: Doug Thompson <norsk5@yahoo.com>

This patch adds the 'broken_parity_status' sysfs attribute file to a PCI device.
Reading this attribute a userland program can determine if PCI device provides false
positives (value of 1) in its generation of PCI Parity status, or not (value of 0).
As PCI devices are found to be 'bad' in this regard, userland programs can also set
the appropriate value (root access only) of a faulty device. This per device
information will be used in the EDAC PCI Parity scanner code in a future patch once
this interface becomes available.
Signed-off-by: default avatarDoug Thompson <norsk5@yahoo.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent acc7c2e0
...@@ -45,6 +45,28 @@ pci_config_attr(class, "0x%06x\n"); ...@@ -45,6 +45,28 @@ pci_config_attr(class, "0x%06x\n");
pci_config_attr(irq, "%u\n"); pci_config_attr(irq, "%u\n");
pci_config_attr(is_enabled, "%u\n"); pci_config_attr(is_enabled, "%u\n");
static ssize_t broken_parity_status_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct pci_dev *pdev = to_pci_dev(dev);
return sprintf (buf, "%u\n", pdev->broken_parity_status);
}
static ssize_t broken_parity_status_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct pci_dev *pdev = to_pci_dev(dev);
ssize_t consumed = -EINVAL;
if ((count > 0) && (*buf == '0' || *buf == '1')) {
pdev->broken_parity_status = *buf == '1' ? 1 : 0;
consumed = count;
}
return consumed;
}
static ssize_t local_cpus_show(struct device *dev, static ssize_t local_cpus_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
...@@ -122,6 +144,8 @@ struct device_attribute pci_dev_attrs[] = { ...@@ -122,6 +144,8 @@ struct device_attribute pci_dev_attrs[] = {
__ATTR_RO(local_cpus), __ATTR_RO(local_cpus),
__ATTR_RO(modalias), __ATTR_RO(modalias),
__ATTR(enable, 0600, is_enabled_show, is_enabled_store), __ATTR(enable, 0600, is_enabled_show, is_enabled_store),
__ATTR(broken_parity_status,(S_IRUGO|S_IWUSR),
broken_parity_status_show,broken_parity_status_store),
__ATTR_NULL, __ATTR_NULL,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment