Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Oct 2010 09:04:34 +0200
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        Lin Ming <ming.m.lin@intel.com>
Cc:        "freebsd-acpi@freebsd.org" <freebsd-acpi@freebsd.org>, "Moore, Robert" <robert.moore@intel.com>
Subject:   Re: MacBookPro 5,1
Message-ID:  <201010220904.34583.hselasky@c2i.net>
In-Reply-To: <1287724787.6530.3135.camel@minggr.sh.intel.com>
References:  <201010121209.06397.hselasky@c2i.net> <1287715164.6530.3112.camel@minggr.sh.intel.com> <1287724787.6530.3135.camel@minggr.sh.intel.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 22 October 2010 07:19:47 Lin Ming wrote:
> On Fri, 2010-10-22 at 10:39 +0800, Lin Ming wrote:
> > On Fri, 2010-10-22 at 04:57 +0800, Hans Petter Selasky wrote:
> > > Here is the relevant output. First note, the buffer length is 512 and
> > > (uint8_t)512 = 0, so I modified the code to print out the 512 bytes.
> > > 
> > > 
> > > Passed in resource buffer length=512
> > > Buffer start
> > > 0f 00 00 00 40 00 00 00 01 00 01 01 01 17 01 00 38 b0 17 03 00 ff ff ff
> > > 11 00 00 00 11 00 00 00 12 00 00 00 13 00 00 00 14 00 00 00 15 00 00
> > > 00 16 00 00 00 17 00 00 0
> > > 0 00 00 00 00 00 00 00 00 07 00 00 00 10 00 00 00 00 00 00 00 00 00 00
> > > 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > > 00 00 00 00 00 00 00 00 00
> > > 
> > >  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > >  00 00 00
> > > 
> > > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > > 00 00 00 00 00
> > > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > > 00 00 00 00 00 00 00 00 0
> > > 0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > > 00 00 00 00 00 00 00 00 00
> > > 
> > >  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > >  00 00 00
> > > 
> > > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > > 00 00 00 00 00
> > > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > > 00 00 00 00 00 00 00 00 0
> > > 0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > > 00 00 00 00 00 00 00 00 00
> > > 
> > >  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > >  00 00 00
> > > 
> > > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > > 00 00 00 00 00
> > > 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > > Buffer end
> > 
> > Unfortunately, I can't reproduce it in the simulator(acpiexec).
> 
> Hans,
> 
> This bug seems really strange.
> 
> As above resource buffer you got, it's interpreted as below
> 
> [00] Extended IRQ Resource
>                        Type : ResourceConsumer
>                  Triggering : Level
>                    Polarity : ActiveLow
>                     Sharing : Shared
>       Resource Source Index : 17
>             Resource Source : [NULL NAMESTRING]
>             Interrupt Count : 01
>                     Dword00 : 00000011
> 
> [01] EndTag Resource
> 
> [NULL NAMESTRING] actually means empty string with size 1 (1 byte for
> NULL terminator).
> 
> You wrote:
> > It appears that when a string is present in the extended interrupt
> > descriptor (6.4.3.6, ACPIspec30.pdf), then this is not handled
> > correctly, meaning that the precomputed buffer space when encoding to
> > AML, is incorrect and that data is written beyond the destination
> > buffer!
> 
> But for above resources, AcpiRsCreateAmlResources->AcpiRsGetAmlLength
> returns 13, which is the precomputed size for the AML buffer and it's
> correct.
> 
> I'm lost now.
> Would you please try this patch to double check if the fault is really
> caused by the string in the extended interrupt descriptor?

I'm pretty sure it's a bug in the parsing of ACPI_RESOURCE_TYPE_EXTENDED_IRQ. 
I will test your patch to verify that more later today.

--HPS

> 
> Tell us if it boots OK or not with this patch.
> Thanks.
> 
> diff --git a/source/components/resources/rsxface.c
> b/source/components/resources/rsxface.c index 2a019d1..17b88e2 100644
> --- a/source/components/resources/rsxface.c
> +++ b/source/components/resources/rsxface.c
> @@ -394,6 +394,7 @@ AcpiSetCurrentResources (
>  {
>      ACPI_STATUS             Status;
>      ACPI_NAMESPACE_NODE     *Node;
> +    ACPI_RESOURCE           *Res;
> 
> 
>      ACPI_FUNCTION_TRACE (AcpiSetCurrentResources);
> @@ -416,6 +417,15 @@ AcpiSetCurrentResources (
>          return_ACPI_STATUS (Status);
>      }
> 
> +    Res = (ACPI_RESOURCE *) InBuffer->Pointer;
> +    if (Res->Type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ)
> +    {
> +        /* DEBUG: clear the string to see if it's the root cause */
> +
> +        Res->Data.ExtendedIrq.ResourceSource.StringPtr = NULL;
> +        Res->Data.ExtendedIrq.ResourceSource.StringLength = 0;
> +    }
> +
>      Status = AcpiRsSetSrsMethodData (Node, InBuffer);
>      return_ACPI_STATUS (Status);
>  }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010220904.34583.hselasky>