mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shaohua Li <shaohua.li@intel.com>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>, Len Brown <lenb@kernel.org>,
	"Barnes, Jesse" <jesse.barnes@intel.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Subject: Re: [git pull request] ACPI and driver patches for 2.6.33.merge
Date: Wed, 23 Dec 2009 17:04:11 +0800	[thread overview]
Message-ID: <20091223090411.GA8526@sli10-desk.sh.intel.com> (raw)
In-Reply-To: <4B31870F.7090106@kernel.org>

On Wed, Dec 23, 2009 at 10:57:19AM +0800, Yinghai Lu wrote:
> Shaohua Li wrote:
> > On Wed, Dec 23, 2009 at 10:09:04AM +0800, Yinghai Lu wrote:
> >> On Tue, Dec 22, 2009 at 5:38 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> >>> Shaohua Li wrote:
> >>>> On Tue, Dec 22, 2009 at 06:08:57PM +0800, Yinghai Lu wrote:
> >>>>> Ingo Molnar wrote:
> >>>>>> * Shaohua Li <shaohua.li@intel.com> wrote:
> >>>>>>
> >>>>>>> On Fri, Dec 18, 2009 at 09:28:50AM +0800, Yinghai Lu wrote:
> >>>>>>>> On Wed, Dec 16, 2009 at 12:06 PM, Len Brown <lenb@kernel.org> wrote:
> >>>>>>>>> Hi Linus,
> >>>>>>>>>
> >>>>>>>>> please pull from:
> >>>>>>>>>
> >>>>>>>>> git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git release
> >>>>>>>>>
> >>>>>>>> ;..
> >>>>>>>>> Shaohua Li (3):
> >>>>>>>>> ? ? ?ACPI: Add a generic API for _OSC -v2
> >>>>>>>>> ? ? ?ACPI: cleanup pci_root _OSC code.
> >>>>>>>>> ? ? ?ACPI: Add platform-wide _OSC support.
> >>>>>>>> it seems these three patches broke the _OSC on my intel new systems.
> >>>>>>>>
> >>>>>>>> revert them fix the problem with AER and pciehp and etc
> >>>>>>> can you give more details? I just cleaned up the _OSC code for AER and
> >>>>>>> pciehp, no function changes.
> >>>>>> Famous last words ;-)
> >>>>>>
> >>>>>> Yinghai, i suspect Shaohua needs the kind of info you'd need if you tried to
> >>>>>> fix it: acpidump, before/after debug boot log, a description of what goes bad,
> >>>>>> etc.
> >>>>> the so called clean up, change the ret length checking.
> >>>>>
> >>>>> -       if (!output.length)
> >>>>> -               return AE_NULL_OBJECT;
> >>>>> -
> >>>>>
> >>>>> +       /* return buffer should have the same length as cap buffer */
> >>>>> +       if (context->ret.length != context->cap.length)
> >>>>> +               return AE_NULL_OBJECT;
> >>>> Wield BIOS. ACPI spec does mention the return buffer have the same length.
> >>>> Does changing the check back make the issue go away?
> >>> change to
> >>> if (context->ret.length < context->cap.length)
> >>>
> >>> make AER work, but pciehp still fail.
> > Can you try below patch please? Looks the returned acpi buffer is a two-tiled buffer.
> > Strange is it doesn't fail at my hand.
> > 
> > diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
> > index 65f7e33..0c1ad31 100644
> > --- a/drivers/acpi/bus.c
> > +++ b/drivers/acpi/bus.c
> > @@ -397,6 +397,7 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
> >  	union acpi_object *out_obj;
> >  	u8 uuid[16];
> >  	u32 errors;
> > +	struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
> >  
> >  	if (!context)
> >  		return AE_ERROR;
> > @@ -419,16 +420,16 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
> >  	in_params[3].buffer.length 	= context->cap.length;
> >  	in_params[3].buffer.pointer 	= context->cap.pointer;
> >  
> > -	status = acpi_evaluate_object(handle, "_OSC", &input, &context->ret);
> > +	status = acpi_evaluate_object(handle, "_OSC", &input, &output);
> >  	if (ACPI_FAILURE(status))
> >  		return status;
> >  
> > -	/* return buffer should have the same length as cap buffer */
> > -	if (context->ret.length != context->cap.length)
> > +	if (!output.length)
> >  		return AE_NULL_OBJECT;
> >  
> > -	out_obj = context->ret.pointer;
> > -	if (out_obj->type != ACPI_TYPE_BUFFER) {
> > +	out_obj = output.pointer;
> > +	if (out_obj->type != ACPI_TYPE_BUFFER
> > +		|| out_obj->buffer.length != context->cap.length) {
> >  		acpi_print_osc_error(handle, context,
> >  			"_OSC evaluation returned wrong type");
> >  		status = AE_TYPE;
> > @@ -457,11 +458,20 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
> >  		goto out_kfree;
> >  	}
> >  out_success:
> > -	return AE_OK;
> > +	context->ret.length = out_obj->buffer.length;
> > +	context->ret.pointer = kmalloc(context->ret.length, GFP_KERNEL);
> > +	if (!context->ret.pointer) {
> > +		status =  AE_NO_MEMORY;
> > +		goto out_kfree;
> > +	}
> > +	memcpy(context->ret.pointer, out_obj->buffer.pointer,
> > +		context->ret.length);
> > +	status =  AE_OK;
> >  
> >  out_kfree:
> > -	kfree(context->ret.pointer);
> > -	context->ret.pointer = NULL;
> > +	kfree(output.pointer);
> > +	if (status != AE_OK)
> > +		context->ret.pointer = NULL;
> >  	return status;
> >  }
> >  EXPORT_SYMBOL(acpi_run_osc);
> 
> aer and pciehp work again with this patch.
Len, this is the patch with describtion, please check and apply.

Executing _OSC returns a buffer, which has an acpi object in it.
Don't directly returns the buffer, instead, we return the acpi object's
buffer. This fixes a regression since caller of acpi_run_osc expects
an acpi object's buffer returned.

Tested-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 65f7e33..0c1ad31 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -397,6 +397,7 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
 	union acpi_object *out_obj;
 	u8 uuid[16];
 	u32 errors;
+	struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
 
 	if (!context)
 		return AE_ERROR;
@@ -419,16 +420,16 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
 	in_params[3].buffer.length 	= context->cap.length;
 	in_params[3].buffer.pointer 	= context->cap.pointer;
 
-	status = acpi_evaluate_object(handle, "_OSC", &input, &context->ret);
+	status = acpi_evaluate_object(handle, "_OSC", &input, &output);
 	if (ACPI_FAILURE(status))
 		return status;
 
-	/* return buffer should have the same length as cap buffer */
-	if (context->ret.length != context->cap.length)
+	if (!output.length)
 		return AE_NULL_OBJECT;
 
-	out_obj = context->ret.pointer;
-	if (out_obj->type != ACPI_TYPE_BUFFER) {
+	out_obj = output.pointer;
+	if (out_obj->type != ACPI_TYPE_BUFFER
+		|| out_obj->buffer.length != context->cap.length) {
 		acpi_print_osc_error(handle, context,
 			"_OSC evaluation returned wrong type");
 		status = AE_TYPE;
@@ -457,11 +458,20 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
 		goto out_kfree;
 	}
 out_success:
-	return AE_OK;
+	context->ret.length = out_obj->buffer.length;
+	context->ret.pointer = kmalloc(context->ret.length, GFP_KERNEL);
+	if (!context->ret.pointer) {
+		status =  AE_NO_MEMORY;
+		goto out_kfree;
+	}
+	memcpy(context->ret.pointer, out_obj->buffer.pointer,
+		context->ret.length);
+	status =  AE_OK;
 
 out_kfree:
-	kfree(context->ret.pointer);
-	context->ret.pointer = NULL;
+	kfree(output.pointer);
+	if (status != AE_OK)
+		context->ret.pointer = NULL;
 	return status;
 }
 EXPORT_SYMBOL(acpi_run_osc);

  reply	other threads:[~2009-12-23  9:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-16 20:06 Len Brown
2009-12-18  1:28 ` Yinghai Lu
2009-12-18  2:21   ` Shaohua Li
2009-12-18  5:14     ` Ingo Molnar
2009-12-22 10:08       ` Yinghai Lu
2009-12-22 10:31         ` Yinghai Lu
2009-12-23  0:56         ` Shaohua Li
2009-12-23  1:38           ` Yinghai Lu
2009-12-23  2:09             ` Yinghai Lu
2009-12-23  2:45               ` Shaohua Li
2009-12-23  2:57                 ` Yinghai Lu
2009-12-23  9:04                   ` Shaohua Li [this message]
2009-12-22  2:10   ` Len Brown
2009-12-22  2:57     ` Yinghai Lu
2009-12-22  7:54       ` Len Brown
2009-12-22  7:59         ` Yinghai Lu
2009-12-22 19:45           ` Len Brown
2009-12-22 20:41             ` Yinghai Lu
2009-12-22 20:44               ` Yinghai Lu
2009-12-23 22:46                 ` Len Brown

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=20091223090411.GA8526@sli10-desk.sh.intel.com \
    --to=shaohua.li@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=jesse.barnes@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.org \
    --cc=yinghai@kernel.org \
    /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®