diff options
author | Doug Thompson <norsk5@yahoo.com> | 2006-06-14 19:59:48 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-21 15:00:01 -0400 |
commit | bdee9d98d281d84718eaff6bf0dd2b6ad418b36f (patch) | |
tree | b7122ecf946d3922f1462c512e2f0599fb505184 /drivers/pci | |
parent | acc7c2e0b73a46122ec370bf8a3aa9f19065d331 (diff) |
[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: Doug Thompson <norsk5@yahoo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/pci-sysfs.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 37897a8c95e0..bc405c035ce3 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -45,6 +45,28 @@ pci_config_attr(class, "0x%06x\n"); | |||
45 | pci_config_attr(irq, "%u\n"); | 45 | pci_config_attr(irq, "%u\n"); |
46 | pci_config_attr(is_enabled, "%u\n"); | 46 | pci_config_attr(is_enabled, "%u\n"); |
47 | 47 | ||
48 | static ssize_t broken_parity_status_show(struct device *dev, | ||
49 | struct device_attribute *attr, | ||
50 | char *buf) | ||
51 | { | ||
52 | struct pci_dev *pdev = to_pci_dev(dev); | ||
53 | return sprintf (buf, "%u\n", pdev->broken_parity_status); | ||
54 | } | ||
55 | |||
56 | static ssize_t broken_parity_status_store(struct device *dev, | ||
57 | struct device_attribute *attr, | ||
58 | const char *buf, size_t count) | ||
59 | { | ||
60 | struct pci_dev *pdev = to_pci_dev(dev); | ||
61 | ssize_t consumed = -EINVAL; | ||
62 | |||
63 | if ((count > 0) && (*buf == '0' || *buf == '1')) { | ||
64 | pdev->broken_parity_status = *buf == '1' ? 1 : 0; | ||
65 | consumed = count; | ||
66 | } | ||
67 | return consumed; | ||
68 | } | ||
69 | |||
48 | static ssize_t local_cpus_show(struct device *dev, | 70 | static ssize_t local_cpus_show(struct device *dev, |
49 | struct device_attribute *attr, char *buf) | 71 | struct device_attribute *attr, char *buf) |
50 | { | 72 | { |
@@ -122,6 +144,8 @@ struct device_attribute pci_dev_attrs[] = { | |||
122 | __ATTR_RO(local_cpus), | 144 | __ATTR_RO(local_cpus), |
123 | __ATTR_RO(modalias), | 145 | __ATTR_RO(modalias), |
124 | __ATTR(enable, 0600, is_enabled_show, is_enabled_store), | 146 | __ATTR(enable, 0600, is_enabled_show, is_enabled_store), |
147 | __ATTR(broken_parity_status,(S_IRUGO|S_IWUSR), | ||
148 | broken_parity_status_show,broken_parity_status_store), | ||
125 | __ATTR_NULL, | 149 | __ATTR_NULL, |
126 | }; | 150 | }; |
127 | 151 | ||