From f8123381bae8d581d81f24b55719db3d9a6a262c Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Fri, 24 Oct 2008 21:50:31 +0200 Subject: ACPI: Oops in ACPI with git latest ACPI Warning (nseval-0168): Insufficient arguments - method [_OSC] needs 5, found 4 [20080926] ACPI Warning (nspredef-0252): \_SB_.PCI0._OSC: Parameter count mismatch - ASL declared 5, expected 4 [20080926] ACPI Error (nspredef-0163): \_SB_.PCI0._OSC: Missing expected return value [20080926] BUG: unable to handle kernel NULL pointer dereference at 00000000 IP: [] acpi_run_osc+0xa1/0x170 Signed-off-by: Rafael J. Wysocki Tested-by: James Bottomley Signed-off-by: Len Brown --- drivers/pci/pci-acpi.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/pci/pci-acpi.c') diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index dfe7c8e1b18..b3a63edb690 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -83,6 +83,9 @@ static acpi_status acpi_run_osc(acpi_handle handle, if (ACPI_FAILURE(status)) return status; + if (!output.length) + return AE_NULL_OBJECT; + out_obj = output.pointer; if (out_obj->type != ACPI_TYPE_BUFFER) { printk(KERN_DEBUG "Evaluate _OSC returns wrong type\n"); -- cgit v1.2.3 From 2485b8674bf5762822e14e1554938e36511c0ae4 Mon Sep 17 00:00:00 2001 From: Kenji Kaneshige Date: Mon, 10 Nov 2008 13:54:43 +0900 Subject: PCI: ignore bit0 of _OSC return code Currently acpi_run_osc() checks all the bits in _OSC result code (the first DWORD in the capabilities buffer) to see error condition. But the bit 0, which doesn't indicate any error, must be ignored. The bit 0 is used as the query flag at _OSC invocation time. Some platforms clear it during _OSC evaluation, but the others don't. On latter platforms, current acpi_run_osc() mis-detects error when _OSC is evaluated with query flag set because it doesn't ignore the bit 0. Because of this, the __acpi_query_osc() always fails on such platforms. And this is the cause of the problem that pci_osc_control_set() doesn't work since the commit 4e39432f4df544d3dfe4fc90a22d87de64d15815 which changed pci_osc_control_set() to use __acpi_query_osc(). Tested-by:"Tomasz Czernecki Signed-off-by: Kenji Kaneshige Signed-off-by: Jesse Barnes --- drivers/pci/pci-acpi.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'drivers/pci/pci-acpi.c') diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index b3a63edb690..ae5ec76dca7 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -63,7 +63,7 @@ static acpi_status acpi_run_osc(acpi_handle handle, union acpi_object in_params[4]; struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL}; union acpi_object *out_obj; - u32 osc_dw0, flags = osc_args->capbuf[OSC_QUERY_TYPE]; + u32 errors, flags = osc_args->capbuf[OSC_QUERY_TYPE]; /* Setting up input parameters */ input.count = 4; @@ -92,15 +92,16 @@ static acpi_status acpi_run_osc(acpi_handle handle, status = AE_TYPE; goto out_kfree; } - osc_dw0 = *((u32 *)out_obj->buffer.pointer); - if (osc_dw0) { - if (osc_dw0 & OSC_REQUEST_ERROR) + /* Need to ignore the bit0 in result code */ + errors = *((u32 *)out_obj->buffer.pointer) & ~(1 << 0); + if (errors) { + if (errors & OSC_REQUEST_ERROR) printk(KERN_DEBUG "_OSC request fails\n"); - if (osc_dw0 & OSC_INVALID_UUID_ERROR) + if (errors & OSC_INVALID_UUID_ERROR) printk(KERN_DEBUG "_OSC invalid UUID\n"); - if (osc_dw0 & OSC_INVALID_REVISION_ERROR) + if (errors & OSC_INVALID_REVISION_ERROR) printk(KERN_DEBUG "_OSC invalid revision\n"); - if (osc_dw0 & OSC_CAPABILITIES_MASK_ERROR) { + if (errors & OSC_CAPABILITIES_MASK_ERROR) { if (flags & OSC_QUERY_ENABLE) goto out_success; printk(KERN_DEBUG "_OSC FW not grant req. control\n"); -- cgit v1.2.3