PCI aer: add pci_cleanup_aer_correct_aer_status
authorStephen Hemminger <shemminger@linux-foundation.org>
Wed, 6 Jun 2007 03:50:34 +0000 (11:50 +0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 11 Jul 2007 23:02:08 +0000 (16:02 -0700)
Function to clear bogus correctable errors. Analog to pci_aer_uncorrect_are_status.
The Marvell chips seem to start out with a bogus value that needs to be
cleared.

Yanmin ported it to 2.6.22-rc4 by fixing a fuzz patch applying info.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Acked-by: Zhang Yanmin <yanmin.zhang@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/pci/pcie/aer/aerdrv_core.c
include/linux/aer.h

index fef159a68081767482504b7892fe48ec330a79af..92a8469b21bacecc2f161621553029ea99222d1e 100644 (file)
@@ -117,6 +117,21 @@ int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
        return 0;
 }
 
+int pci_cleanup_aer_correct_error_status(struct pci_dev *dev)
+{
+       int pos;
+       u32 status;
+
+       pos = pci_find_aer_capability(dev);
+       if (!pos)
+               return -EIO;
+
+       pci_read_config_dword(dev, pos + PCI_ERR_COR_STATUS, &status);
+       pci_write_config_dword(dev, pos + PCI_ERR_COR_STATUS, status);
+
+       return 0;
+}
+
 static int find_device_iter(struct device *device, void *data)
 {
        struct pci_dev *dev;
@@ -741,4 +756,5 @@ EXPORT_SYMBOL_GPL(pci_find_aer_capability);
 EXPORT_SYMBOL_GPL(pci_enable_pcie_error_reporting);
 EXPORT_SYMBOL_GPL(pci_disable_pcie_error_reporting);
 EXPORT_SYMBOL_GPL(pci_cleanup_aer_uncorrect_error_status);
+EXPORT_SYMBOL_GPL(pci_cleanup_aer_correct_error_status);
 
index 64aacaed8d6c0c0e780c713aa3f1286d31b9a690..509656286e5326e3f10617bea575ad56f5128602 100644 (file)
@@ -13,11 +13,13 @@ extern int pci_enable_pcie_error_reporting(struct pci_dev *dev);
 extern int pci_find_aer_capability(struct pci_dev *dev);
 extern int pci_disable_pcie_error_reporting(struct pci_dev *dev);
 extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev);
+extern int pci_cleanup_aer_correct_error_status(struct pci_dev *dev);
 #else
 #define pci_enable_pcie_error_reporting(dev)           (-EINVAL)
 #define pci_find_aer_capability(dev)                   (0)
 #define pci_disable_pcie_error_reporting(dev)          (-EINVAL)
 #define pci_cleanup_aer_uncorrect_error_status(dev)    (-EINVAL)
+#define pci_cleanup_aer_correct_error_status(dev)      (-EINVAL)
 #endif
 
 #endif //_AER_H_