aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhang, Yanmin <yanmin_zhang@linux.intel.com>2007-06-05 23:44:16 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-11 19:02:08 -0400
commit8d29bfb79e632fe318f4c01c9c2e8faacb89b800 (patch)
tree696caa373f8340153bd18655ed4f61b035823f16
parentf477836457730a2b925f625023ec4e5bf11015be (diff)
PCI: fix AER driver error information
Below patch fixes aer driver error information and enables aer driver although CONFIG_ACPI=n. As a matter of fact, the new patch is created from below 2 patches plus a minor patch apply fuzz fixing. Because the second patch fixed a compilation error introduced by the first patch, I merge them to facilitate bisect. 1) http://marc.info/?l=linux-kernel&m=117783233918191&w=2; 2) http://marc.info/?l=linux-mm-commits&m=118046936720790&w=2 Signed-off-by: Zhang Yanmin <yanmin.zhang@intel.com> Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/pci/pci-acpi.c8
-rw-r--r--drivers/pci/pcie/aer/Kconfig2
-rw-r--r--drivers/pci/pcie/aer/Makefile3
-rw-r--r--drivers/pci/pcie/aer/aerdrv.h14
-rw-r--r--drivers/pci/pcie/aer/aerdrv_acpi.c36
-rw-r--r--drivers/pci/pcie/aer/aerdrv_core.c18
6 files changed, 34 insertions, 47 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index b5ac810404c0..c8062494009f 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -55,8 +55,6 @@ acpi_query_osc (
55 55
56 status = acpi_evaluate_object(handle, "_OSC", &input, &output); 56 status = acpi_evaluate_object(handle, "_OSC", &input, &output);
57 if (ACPI_FAILURE (status)) { 57 if (ACPI_FAILURE (status)) {
58 printk(KERN_DEBUG
59 "Evaluate _OSC Set fails. Status = 0x%04x\n", status);
60 *ret_status = status; 58 *ret_status = status;
61 return status; 59 return status;
62 } 60 }
@@ -124,11 +122,9 @@ acpi_run_osc (
124 in_params[3].buffer.pointer = (u8 *)context; 122 in_params[3].buffer.pointer = (u8 *)context;
125 123
126 status = acpi_evaluate_object(handle, "_OSC", &input, &output); 124 status = acpi_evaluate_object(handle, "_OSC", &input, &output);
127 if (ACPI_FAILURE (status)) { 125 if (ACPI_FAILURE (status))
128 printk(KERN_DEBUG
129 "Evaluate _OSC Set fails. Status = 0x%04x\n", status);
130 return status; 126 return status;
131 } 127
132 out_obj = output.pointer; 128 out_obj = output.pointer;
133 if (out_obj->type != ACPI_TYPE_BUFFER) { 129 if (out_obj->type != ACPI_TYPE_BUFFER) {
134 printk(KERN_DEBUG 130 printk(KERN_DEBUG
diff --git a/drivers/pci/pcie/aer/Kconfig b/drivers/pci/pcie/aer/Kconfig
index 3f37a60a6438..c3bde588aa13 100644
--- a/drivers/pci/pcie/aer/Kconfig
+++ b/drivers/pci/pcie/aer/Kconfig
@@ -4,7 +4,7 @@
4 4
5config PCIEAER 5config PCIEAER
6 boolean "Root Port Advanced Error Reporting support" 6 boolean "Root Port Advanced Error Reporting support"
7 depends on PCIEPORTBUS && ACPI 7 depends on PCIEPORTBUS
8 default y 8 default y
9 help 9 help
10 This enables PCI Express Root Port Advanced Error Reporting 10 This enables PCI Express Root Port Advanced Error Reporting
diff --git a/drivers/pci/pcie/aer/Makefile b/drivers/pci/pcie/aer/Makefile
index 15a4f40d520b..8da3bd8455a8 100644
--- a/drivers/pci/pcie/aer/Makefile
+++ b/drivers/pci/pcie/aer/Makefile
@@ -4,5 +4,6 @@
4 4
5obj-$(CONFIG_PCIEAER) += aerdriver.o 5obj-$(CONFIG_PCIEAER) += aerdriver.o
6 6
7aerdriver-objs := aerdrv_errprint.o aerdrv_core.o aerdrv.o aerdrv_acpi.o 7aerdriver-objs := aerdrv_errprint.o aerdrv_core.o aerdrv.o
8aerdriver-$(CONFIG_ACPI) += aerdrv_acpi.o
8 9
diff --git a/drivers/pci/pcie/aer/aerdrv.h b/drivers/pci/pcie/aer/aerdrv.h
index 5cca394d5999..c7ad68b6c6d6 100644
--- a/drivers/pci/pcie/aer/aerdrv.h
+++ b/drivers/pci/pcie/aer/aerdrv.h
@@ -19,10 +19,6 @@
19#define AER_ERROR_MASK 0x001fffff 19#define AER_ERROR_MASK 0x001fffff
20#define AER_ERROR(d) (d & AER_ERROR_MASK) 20#define AER_ERROR(d) (d & AER_ERROR_MASK)
21 21
22#define OSC_METHOD_RUN_SUCCESS 0
23#define OSC_METHOD_NOT_SUPPORTED 1
24#define OSC_METHOD_RUN_FAILURE 2
25
26/* Root Error Status Register Bits */ 22/* Root Error Status Register Bits */
27#define ROOT_ERR_STATUS_MASKS 0x0f 23#define ROOT_ERR_STATUS_MASKS 0x0f
28 24
@@ -121,6 +117,14 @@ extern void aer_delete_rootport(struct aer_rpc *rpc);
121extern int aer_init(struct pcie_device *dev); 117extern int aer_init(struct pcie_device *dev);
122extern void aer_isr(struct work_struct *work); 118extern void aer_isr(struct work_struct *work);
123extern void aer_print_error(struct pci_dev *dev, struct aer_err_info *info); 119extern void aer_print_error(struct pci_dev *dev, struct aer_err_info *info);
124extern int aer_osc_setup(struct pci_dev *dev); 120
121#ifdef CONFIG_ACPI
122extern int aer_osc_setup(struct pcie_device *pciedev);
123#else
124static inline int aer_osc_setup(struct pcie_device *pciedev)
125{
126 return 0;
127}
128#endif
125 129
126#endif //_AERDRV_H_ 130#endif //_AERDRV_H_
diff --git a/drivers/pci/pcie/aer/aerdrv_acpi.c b/drivers/pci/pcie/aer/aerdrv_acpi.c
index fa68e89ebec9..1a1eb45a779e 100644
--- a/drivers/pci/pcie/aer/aerdrv_acpi.c
+++ b/drivers/pci/pcie/aer/aerdrv_acpi.c
@@ -20,19 +20,18 @@
20 20
21/** 21/**
22 * aer_osc_setup - run ACPI _OSC method 22 * aer_osc_setup - run ACPI _OSC method
23 * @pciedev: pcie_device which AER is being enabled on
23 * 24 *
24 * Return: 25 * @return: Zero on success. Nonzero otherwise.
25 * Zero if success. Nonzero for otherwise.
26 * 26 *
27 * Invoked when PCIE bus loads AER service driver. To avoid conflict with 27 * Invoked when PCIE bus loads AER service driver. To avoid conflict with
28 * BIOS AER support requires BIOS to yield AER control to OS native driver. 28 * BIOS AER support requires BIOS to yield AER control to OS native driver.
29 **/ 29 **/
30int aer_osc_setup(struct pci_dev *dev) 30int aer_osc_setup(struct pcie_device *pciedev)
31{ 31{
32 int retval = OSC_METHOD_RUN_SUCCESS; 32 acpi_status status = AE_NOT_FOUND;
33 acpi_status status; 33 struct pci_dev *pdev = pciedev->port;
34 acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); 34 acpi_handle handle = DEVICE_ACPI_HANDLE(&pdev->dev);
35 struct pci_dev *pdev = dev;
36 struct pci_bus *parent; 35 struct pci_bus *parent;
37 36
38 while (!handle) { 37 while (!handle) {
@@ -50,19 +49,20 @@ int aer_osc_setup(struct pci_dev *dev)
50 pdev = parent->self; 49 pdev = parent->self;
51 } 50 }
52 51
53 if (!handle) 52 if (handle) {
54 return OSC_METHOD_NOT_SUPPORTED; 53 pci_osc_support_set(OSC_EXT_PCI_CONFIG_SUPPORT);
54 status = pci_osc_control_set(handle,
55 OSC_PCI_EXPRESS_AER_CONTROL |
56 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
57 }
55 58
56 pci_osc_support_set(OSC_EXT_PCI_CONFIG_SUPPORT);
57 status = pci_osc_control_set(handle, OSC_PCI_EXPRESS_AER_CONTROL |
58 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
59 if (ACPI_FAILURE(status)) { 59 if (ACPI_FAILURE(status)) {
60 if (status == AE_SUPPORT) 60 printk(KERN_DEBUG "AER service couldn't init device %s - %s\n",
61 retval = OSC_METHOD_NOT_SUPPORTED; 61 pciedev->device.bus_id,
62 else 62 (status == AE_SUPPORT || status == AE_NOT_FOUND) ?
63 retval = OSC_METHOD_RUN_FAILURE; 63 "no _OSC support" : "Run ACPI _OSC fails");
64 return -1;
64 } 65 }
65 66
66 return retval; 67 return 0;
67} 68}
68
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c
index 08e13033ced8..fef159a68081 100644
--- a/drivers/pci/pcie/aer/aerdrv_core.c
+++ b/drivers/pci/pcie/aer/aerdrv_core.c
@@ -22,8 +22,6 @@
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <linux/pm.h> 23#include <linux/pm.h>
24#include <linux/suspend.h> 24#include <linux/suspend.h>
25#include <linux/acpi.h>
26#include <linux/pci-acpi.h>
27#include <linux/delay.h> 25#include <linux/delay.h>
28#include "aerdrv.h" 26#include "aerdrv.h"
29 27
@@ -733,20 +731,8 @@ void aer_delete_rootport(struct aer_rpc *rpc)
733 **/ 731 **/
734int aer_init(struct pcie_device *dev) 732int aer_init(struct pcie_device *dev)
735{ 733{
736 int status; 734 if (aer_osc_setup(dev) && !forceload)
737 735 return -ENXIO;
738 /* Run _OSC Method */
739 status = aer_osc_setup(dev->port);
740
741 if(status != OSC_METHOD_RUN_SUCCESS) {
742 printk(KERN_DEBUG "%s: AER service init fails - %s\n",
743 __FUNCTION__,
744 (status == OSC_METHOD_NOT_SUPPORTED) ?
745 "No ACPI _OSC support" : "Run ACPI _OSC fails");
746
747 if (!forceload)
748 return status;
749 }
750 736
751 return AER_SUCCESS; 737 return AER_SUCCESS;
752} 738}