From owner-freebsd-acpi@FreeBSD.ORG Thu Nov 4 07:48:56 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 BA3571065674; Thu, 4 Nov 2010 07:48:56 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe04.swip.net [212.247.154.97]) by mx1.freebsd.org (Postfix) with ESMTP id 4EBAD8FC18; Thu, 4 Nov 2010 07:48:54 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=gl0LPzB4YDQuuzpDoHYit7deEV0cOo++Sg28kyvF6vg= c=1 sm=1 a=Q9fys5e9bTEA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=rW1h7RCZl3BHQJt7948A:9 a=zWoYtayFVqiKAM4tiDK4RKWMj9cA:4 a=PUjeQqilurYA:10 a=_e-PnofileROuYtC:21 a=Rf4u6i7AX05FFheI:21 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe04.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 44192821; Thu, 04 Nov 2010 08:48:53 +0100 From: Hans Petter Selasky To: "Jung-uk Kim" Date: Thu, 4 Nov 2010 08:50:04 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.1-STABLE; KDE/4.4.5; amd64; ; ) References: <201010121209.06397.hselasky@c2i.net> <201011031351.18832.jkim@FreeBSD.org> <201011031625.38864.jkim@FreeBSD.org> In-Reply-To: <201011031625.38864.jkim@FreeBSD.org> 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="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201011040850.04401.hselasky@c2i.net> Cc: freebsd-acpi@freebsd.org, Lin Ming , Andriy Gapon , "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: Thu, 04 Nov 2010 07:48:56 -0000 On Wednesday 03 November 2010 21:25:28 Jung-uk Kim wrote: > On Wednesday 03 November 2010 01:51 pm, Jung-uk Kim wrote: > > On Wednesday 03 November 2010 12:47 pm, John Baldwin wrote: > > > On Wednesday, November 03, 2010 12:25:37 pm Jung-uk Kim wrote: > > > > On Wednesday 03 November 2010 08:28 am, John Baldwin wrote: > > > > > On Tuesday, November 02, 2010 6:32:12 pm Jung-uk Kim wrote: > > > > > > On Tuesday 02 November 2010 05:26 pm, John Baldwin wrote: > > > > > > > On Tuesday, November 02, 2010 4:50:18 pm Jung-uk Kim > > > > > > > > > > > > > > > > > > > > > > Linux doesn't set the resource source bits up at > > > > > > > > > > > all when doing _SRS, so I'd rather just do that. > > > > > > > > > > > I think what I'd prefer is that we not use the > > > > > > > > > > > prs_template, perhaps just save the type of the > > > > > > > > > > > resource and build a new resource object from > > > > > > > > > > > scratch where the resource is zero'd, the > > > > > > > > > > > appropriate bits are set and then that resource > > > > > > > > > > > is appended to the buffer being built. > > > > > > > > > > > > > > > > > > > > "Linux doesn't do it" is wrong if I am reading the > > > > > > > > > > spec. correctly, i.e., _CRS, _PRS and _SRS must > > > > > > > > > > have the same format and size. > > > > > > > > > > > > > > > > > > Umm, but we aren't setting up the raw bits for _SRS. > > > > > > > > > We are creating a list of ACPI_RESOURCE objects that > > > > > > > > > ACPICA then encodes into a buffer to send to _SRS. > > > > > > > > > > > > > > > > Yes, I understand. However, ACPICA is expecting the > > > > > > > > same size of buffer *including* the optional parts if I > > > > > > > > am reading the code right. Besides, I don't think there > > > > > > > > is any harm in doing the right thing. ;-) > > > > > > > > > > > > > > To be clear, I am suggesting to take an ACPI_RESOURCE > > > > > > > object, bzero it, then set the type and the IRQ and > > > > > > > that's it. Leave the ResourceSource bits as zero. The > > > > > > > size will still be set based on the actual type (or if > > > > > > > needed we can use the cached size from the template copy > > > > > > > we save from _PRS). The point would be to start from a > > > > > > > zero structure instead of from a copy of what we got from > > > > > > > _PRS. > > > > > > > > > > > > It may work if we don't use l_prs_template. > > > > > > > > > > Well, we still need much of the info from the _PRS resource > > > > > (the type, etc.), but I think we should not blindly use the > > > > > template directly when building the buffer for _SRS. > > > > > > > > Actually, I think we should get the information directly from > > > > _CRS as ACPI spec. is suggesting. > > > > > > I would be fine with that, but that does not work if _CRS doesn't > > > work (the acpi_pci_link_srs_from_links() case). > > > > For that case, we must use the template, of course. In fact, my > > patch is more useful for this particular case. :-) > > > > > Are we allowed to modify the buffer ACPICA gives us from _CRS and > > > then pass that back to _SRS? > > > > I believe so. If we go with that route, we don't have to worry > > about ResourceSource.StringPtr or acpi_AppendBufferResource() > > copying stale pointers. > > Please see the attached patch. It seems working fine. :-) > > Note I had to adjust resource length to prevent reading/writing beyond > buffer size. It should work okay for acpi_pci_link_srs_from_links() > case, I believe. It's a hack anyway. ;-) > Hi, The acpi_pci_link2.diff patch also works fine. No more "Bug" statements as per Lin and Moore's debug patch. The patch was tested separately from the "memset()" patch. Both patches work. --HPS