From owner-freebsd-acpi@FreeBSD.ORG Fri Oct 22 07:03:24 2010 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5312D106566C for ; Fri, 22 Oct 2010 07:03:24 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe06.swip.net [212.247.154.161]) by mx1.freebsd.org (Postfix) with ESMTP id BBD548FC13 for ; Fri, 22 Oct 2010 07:03:23 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=5UXFHLfkiY5XrCDma5uYm2T9fyMGz6t0cyN4hLfZsqg= c=1 sm=1 a=IkcTkHD0fZMA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=MMVxDBbnyh3PXRL5lLkA:9 a=Z9DCFsx7N2C1AseLnr-FDGbXPXcA:4 a=QEXdDO2ut3YA:10 a=x1IBvQ22bnPtTBTG:21 a=m5XuVVhlUhnRvmgg:21 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe06.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 38021251; Fri, 22 Oct 2010 09:03:21 +0200 From: Hans Petter Selasky To: Lin Ming Date: Fri, 22 Oct 2010 09:04:34 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.1-STABLE; KDE/4.4.5; amd64; ; ) References: <201010121209.06397.hselasky@c2i.net> <1287715164.6530.3112.camel@minggr.sh.intel.com> <1287724787.6530.3135.camel@minggr.sh.intel.com> In-Reply-To: <1287724787.6530.3135.camel@minggr.sh.intel.com> X-Face: +~\`s("[*|O,="7?X@L.elg*F"OA\I/3%^p8g?ab%RN'(; _IjlA: hGE..Ew, XAQ*o#\/M~SC=S1-f9{EzRfT'|Hhll5Q]ha5Bt-s|oTlKMusi:1e[wJl}kd}GR Z0adGx-x_0zGbZj'e(Y[(UNle~)8CQWXW@:DX+9)_YlB[tIccCPN$7/L' MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201010220904.34583.hselasky@c2i.net> Cc: "freebsd-acpi@freebsd.org" , "Moore, Robert" Subject: Re: MacBookPro 5,1 X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Oct 2010 07:03:24 -0000 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); > }