Commit 8d29bfb7 authored by Zhang, Yanmin's avatar Zhang, Yanmin Committed by Greg Kroah-Hartman

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=2Signed-off-by: default avatarZhang Yanmin <yanmin.zhang@intel.com>
Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f4778364
...@@ -55,8 +55,6 @@ acpi_query_osc ( ...@@ -55,8 +55,6 @@ acpi_query_osc (
status = acpi_evaluate_object(handle, "_OSC", &input, &output); status = acpi_evaluate_object(handle, "_OSC", &input, &output);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
printk(KERN_DEBUG
"Evaluate _OSC Set fails. Status = 0x%04x\n", status);
*ret_status = status; *ret_status = status;
return status; return status;
} }
...@@ -124,11 +122,9 @@ acpi_run_osc ( ...@@ -124,11 +122,9 @@ acpi_run_osc (
in_params[3].buffer.pointer = (u8 *)context; in_params[3].buffer.pointer = (u8 *)context;
status = acpi_evaluate_object(handle, "_OSC", &input, &output); status = acpi_evaluate_object(handle, "_OSC", &input, &output);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status))
printk(KERN_DEBUG
"Evaluate _OSC Set fails. Status = 0x%04x\n", status);
return status; return status;
}
out_obj = output.pointer; out_obj = output.pointer;
if (out_obj->type != ACPI_TYPE_BUFFER) { if (out_obj->type != ACPI_TYPE_BUFFER) {
printk(KERN_DEBUG printk(KERN_DEBUG
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
config PCIEAER config PCIEAER
boolean "Root Port Advanced Error Reporting support" boolean "Root Port Advanced Error Reporting support"
depends on PCIEPORTBUS && ACPI depends on PCIEPORTBUS
default y default y
help help
This enables PCI Express Root Port Advanced Error Reporting This enables PCI Express Root Port Advanced Error Reporting
......
...@@ -4,5 +4,6 @@ ...@@ -4,5 +4,6 @@
obj-$(CONFIG_PCIEAER) += aerdriver.o obj-$(CONFIG_PCIEAER) += aerdriver.o
aerdriver-objs := aerdrv_errprint.o aerdrv_core.o aerdrv.o aerdrv_acpi.o aerdriver-objs := aerdrv_errprint.o aerdrv_core.o aerdrv.o
aerdriver-$(CONFIG_ACPI) += aerdrv_acpi.o
...@@ -19,10 +19,6 @@ ...@@ -19,10 +19,6 @@
#define AER_ERROR_MASK 0x001fffff #define AER_ERROR_MASK 0x001fffff
#define AER_ERROR(d) (d & AER_ERROR_MASK) #define AER_ERROR(d) (d & AER_ERROR_MASK)
#define OSC_METHOD_RUN_SUCCESS 0
#define OSC_METHOD_NOT_SUPPORTED 1
#define OSC_METHOD_RUN_FAILURE 2
/* Root Error Status Register Bits */ /* Root Error Status Register Bits */
#define ROOT_ERR_STATUS_MASKS 0x0f #define ROOT_ERR_STATUS_MASKS 0x0f
...@@ -121,6 +117,14 @@ extern void aer_delete_rootport(struct aer_rpc *rpc); ...@@ -121,6 +117,14 @@ extern void aer_delete_rootport(struct aer_rpc *rpc);
extern int aer_init(struct pcie_device *dev); extern int aer_init(struct pcie_device *dev);
extern void aer_isr(struct work_struct *work); extern void aer_isr(struct work_struct *work);
extern void aer_print_error(struct pci_dev *dev, struct aer_err_info *info); extern void aer_print_error(struct pci_dev *dev, struct aer_err_info *info);
extern int aer_osc_setup(struct pci_dev *dev);
#ifdef CONFIG_ACPI
extern int aer_osc_setup(struct pcie_device *pciedev);
#else
static inline int aer_osc_setup(struct pcie_device *pciedev)
{
return 0;
}
#endif
#endif //_AERDRV_H_ #endif //_AERDRV_H_
...@@ -20,19 +20,18 @@ ...@@ -20,19 +20,18 @@
/** /**
* aer_osc_setup - run ACPI _OSC method * aer_osc_setup - run ACPI _OSC method
* @pciedev: pcie_device which AER is being enabled on
* *
* Return: * @return: Zero on success. Nonzero otherwise.
* Zero if success. Nonzero for otherwise.
* *
* Invoked when PCIE bus loads AER service driver. To avoid conflict with * Invoked when PCIE bus loads AER service driver. To avoid conflict with
* BIOS AER support requires BIOS to yield AER control to OS native driver. * BIOS AER support requires BIOS to yield AER control to OS native driver.
**/ **/
int aer_osc_setup(struct pci_dev *dev) int aer_osc_setup(struct pcie_device *pciedev)
{ {
int retval = OSC_METHOD_RUN_SUCCESS; acpi_status status = AE_NOT_FOUND;
acpi_status status; struct pci_dev *pdev = pciedev->port;
acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); acpi_handle handle = DEVICE_ACPI_HANDLE(&pdev->dev);
struct pci_dev *pdev = dev;
struct pci_bus *parent; struct pci_bus *parent;
while (!handle) { while (!handle) {
...@@ -50,19 +49,20 @@ int aer_osc_setup(struct pci_dev *dev) ...@@ -50,19 +49,20 @@ int aer_osc_setup(struct pci_dev *dev)
pdev = parent->self; pdev = parent->self;
} }
if (!handle) if (handle) {
return OSC_METHOD_NOT_SUPPORTED; pci_osc_support_set(OSC_EXT_PCI_CONFIG_SUPPORT);
status = pci_osc_control_set(handle,
OSC_PCI_EXPRESS_AER_CONTROL |
OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
}
pci_osc_support_set(OSC_EXT_PCI_CONFIG_SUPPORT);
status = pci_osc_control_set(handle, OSC_PCI_EXPRESS_AER_CONTROL |
OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
if (status == AE_SUPPORT) printk(KERN_DEBUG "AER service couldn't init device %s - %s\n",
retval = OSC_METHOD_NOT_SUPPORTED; pciedev->device.bus_id,
else (status == AE_SUPPORT || status == AE_NOT_FOUND) ?
retval = OSC_METHOD_RUN_FAILURE; "no _OSC support" : "Run ACPI _OSC fails");
return -1;
} }
return retval; return 0;
} }
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/suspend.h> #include <linux/suspend.h>
#include <linux/acpi.h>
#include <linux/pci-acpi.h>
#include <linux/delay.h> #include <linux/delay.h>
#include "aerdrv.h" #include "aerdrv.h"
...@@ -733,20 +731,8 @@ void aer_delete_rootport(struct aer_rpc *rpc) ...@@ -733,20 +731,8 @@ void aer_delete_rootport(struct aer_rpc *rpc)
**/ **/
int aer_init(struct pcie_device *dev) int aer_init(struct pcie_device *dev)
{ {
int status; if (aer_osc_setup(dev) && !forceload)
return -ENXIO;
/* Run _OSC Method */
status = aer_osc_setup(dev->port);
if(status != OSC_METHOD_RUN_SUCCESS) {
printk(KERN_DEBUG "%s: AER service init fails - %s\n",
__FUNCTION__,
(status == OSC_METHOD_NOT_SUPPORTED) ?
"No ACPI _OSC support" : "Run ACPI _OSC fails");
if (!forceload)
return status;
}
return AER_SUCCESS; return AER_SUCCESS;
} }
......
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