mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhao Yakui <yakui.zhao@intel.com>
To: NoWhereMan <uncommonnonsense@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
	Len Brown <lenb@kernel.org>
Subject: Re: [PATCH 2.6.25-rc7 001/001] ACPI: workaround for buggy BIOS to ignore error LINK CRS method
Date: Tue, 15 Apr 2008 21:49:45 +0800	[thread overview]
Message-ID: <1208267385.12372.11.camel@yakui_zhao.sh.intel.com> (raw)
In-Reply-To: <f7430a760804100523t6483dc0cn144429ee7024a7f2@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 844 bytes --]

On Thu, 2008-04-10 at 14:23 +0200, NoWhereMan wrote:
> On Thu, Apr 10, 2008 at 12:40 PM, Zhao Yakui <yakui.zhao@intel.com> wrote:
> > On Wed, 2008-04-09 at 16:12 -0700, Andrew Morton wrote:
> 
> >  > That patch is about four months old.  Hopefully there was a reason why we
> >  > dodn't proceed with it?
> >  It seems that the system can work after applying the patch.
> >  But the patch depends on the returned result(-ENODEV).
> >  > if (ACPI_FAILURE(status)) {
> >  >               ACPI_EXCEPTION((AE_INFO, status, "Evaluating _CRS"));
> >  >                result = -ENODEV;
> >   >               goto end;
> >   >       }
> >  Now I am writing another workaround patch about this problem.
> 
Will you please try the workaround patch and see whether the problem can
be fixed?
Thanks.
> I'll try to help, testing the new patch on my system

[-- Attachment #2: crs_debug.patch --]
[-- Type: text/x-patch, Size: 2869 bytes --]

An integer is returned by _CRS/_PRS object of LINK device
for some broken bios( the HID of LINK device is "PNP0C0F").
In such case irq_number will be constructed as the Extended
IRQ descriptor.
The content of the buffer should be the following:
0x89,0x06,0x00,0x0D,0x01,0x0,0x00,0x00,0x00,0x79,0x00.
And the length of the buffer is 11.

---
 drivers/acpi/resources/rsutils.c |   47 +++++++++++++++++++++++++++++++++++++--
 1 file changed, 45 insertions(+), 2 deletions(-)

Index: linux-2.6/drivers/acpi/resources/rsutils.c
===================================================================
--- linux-2.6.orig/drivers/acpi/resources/rsutils.c
+++ linux-2.6/drivers/acpi/resources/rsutils.c
@@ -611,7 +611,11 @@ acpi_rs_get_method_data(acpi_handle hand
 			char *path, struct acpi_buffer *ret_buffer)
 {
 	union acpi_operand_object *obj_desc;
+	struct acpi_namespace_node *device_node = NULL;
 	acpi_status status;
+	u8 *ptr = NULL;
+	u32 irq_number = 0;
+	struct acpica_device_id hid;
 
 	ACPI_FUNCTION_TRACE(rs_get_method_data);
 
@@ -622,9 +626,48 @@ acpi_rs_get_method_data(acpi_handle hand
 	status =
 	    acpi_ut_evaluate_object(handle, path, ACPI_BTYPE_BUFFER, &obj_desc);
 	if (ACPI_FAILURE(status)) {
-		return_ACPI_STATUS(status);
+		/*
+		 * An integer is returned by _CRS/_PRS object of LINK device
+		 * for some broken bios( the HID of LINK device is "PNP0C0F").
+		 * In such case irq_number will be constructed as the Extended
+		 * IRQ descriptor.
+		 * The content of the buffer should be the following:
+		 * 0x89,0x06,0x00,0x0D,0x01,0x0,0x00,0x00,0x00,0x79,0x00.
+		 * And the length of the buffer is 11.
+		 */
+		device_node = acpi_ns_map_handle_to_node(handle);
+		status = acpi_ut_execute_HID(device_node, &hid);
+		/* Now only LINK device is supported */
+		if (ACPI_FAILURE(status) || ACPI_STRNCMP(hid.value,
+					"PNP0C0F", sizeof(hid.value))) {
+			ACPI_WARNING((AE_INFO , "Only LINK device supports "
+				" the workaround patch"));
+			return_ACPI_STATUS(AE_SUPPORT);
+		}
+
+		status = acpi_ut_evaluate_object(handle, path,
+				ACPI_BTYPE_INTEGER, &obj_desc);
+		if (ACPI_FAILURE(status))
+			return_ACPI_STATUS(status);
+
+		if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
+			#define IRQ_OFFSET	5
+		 	char fixed_irq_buffer[] = { 0x89, 0x06, 0x0, 0x0D,
+				0x01, 0x0, 0x0, 0x0, 0x0, 0x79, 0x0 };
+			irq_number = obj_desc->integer.value;
+			acpi_ut_remove_reference(obj_desc);
+			obj_desc = acpi_ut_create_buffer_object(
+					sizeof(fixed_irq_buffer));
+			if (!obj_desc)
+				return_ACPI_STATUS(AE_NO_MEMORY);
+
+			ptr = obj_desc->buffer.pointer;
+			ACPI_MEMCPY(ptr, fixed_irq_buffer,
+					sizeof(fixed_irq_buffer));
+			ptr += IRQ_OFFSET;
+			ACPI_MOVE_32_TO_32(ptr, &irq_number);
+		}
 	}
-
 	/*
 	 * Make the call to create a resource linked list from the
 	 * byte stream buffer that comes back from the method

  reply	other threads:[~2008-04-15  5:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-09 15:42 NoWhereMan
2008-04-09 23:12 ` Andrew Morton
2008-04-10 10:40   ` Zhao Yakui
2008-04-10 12:23     ` NoWhereMan
2008-04-15 13:49       ` Zhao Yakui [this message]
     [not found]         ` <f7430a760804150121ndfaf065j332ebf1cee3c572@mail.gmail.com>
     [not found]           ` <f7430a760804151538v410f7c64m21d90cb9da8e9baa@mail.gmail.com>
     [not found]             ` <f7430a760804161154o77dd7fc5g622d3bbe4fa1183b@mail.gmail.com>
2008-04-21 13:13               ` NoWhereMan
2008-04-22 13:37                 ` Zhao Yakui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1208267385.12372.11.camel@yakui_zhao.sh.intel.com \
    --to=yakui.zhao@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=uncommonnonsense@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®