[PATCH] pci-acpi: ignore bit0 of _OSC return code (was Re: OSC enablement issue)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tomasz Czernecki wrote:
> All,
> 
> As requested, here is a summary of the issue:
> 
> - starting with commit 4e39432f4df544d3dfe4fc90a22d87de64d15815, we have
> identified a platform which can no longer properly enable _OSC, and
> therefore native AER functions will not work.
> 
> - With Taku and Kenji's help, we have isolated an ambiguity in the ACPI spec
> that allows for multiple interpretations of the _OSC return code (some
> systems clear bit 0 whereas others do not).  Both appear legal.
> 
> - A possible solution is to change Linux's handling to ignore this bit.
>  Some more investigation is to take place and a patch should be forthcoming
> within the next week.
> 
> Tomasz
> 

Hi,

Here is a patch to fix this issue.
Tomasz, could you please test it on your environment?

Thanks,
Kenji Kaneshige


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().

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@xxxxxxxxxxxxxx>

---
 drivers/pci/pci-acpi.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

Index: 20081105/drivers/pci/pci-acpi.c
===================================================================
--- 20081105.orig/drivers/pci/pci-acpi.c
+++ 20081105/drivers/pci/pci-acpi.c
@@ -63,7 +63,7 @@ static acpi_status acpi_run_osc(acpi_han
 	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;
@@ -89,15 +89,16 @@ static acpi_status acpi_run_osc(acpi_han
 		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");

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux