From owner-freebsd-acpi@FreeBSD.ORG Wed Nov 3 12:39: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 338AF106564A; Wed, 3 Nov 2010 12:39:24 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id E0C268FC16; Wed, 3 Nov 2010 12:39:23 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 74B9B46B2D; Wed, 3 Nov 2010 08:39:23 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 796AE8A01D; Wed, 3 Nov 2010 08:39:22 -0400 (EDT) From: John Baldwin To: "Jung-uk Kim" Date: Wed, 3 Nov 2010 08:28:02 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201010121209.06397.hselasky@c2i.net> <201011021726.37423.jhb@freebsd.org> <201011021832.22710.jkim@FreeBSD.org> In-Reply-To: <201011021832.22710.jkim@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201011030828.03108.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Wed, 03 Nov 2010 08:39:22 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: "Moore, Robert" , freebsd-acpi@freebsd.org, Lin Ming , Andriy Gapon 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: Wed, 03 Nov 2010 12:39:24 -0000 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 wrote: > > > On Tuesday 02 November 2010 04:24 pm, John Baldwin wrote: > > > > On Tuesday, November 02, 2010 4:14:05 pm Jung-uk Kim wrote: > > > > > On Tuesday 02 November 2010 03:41 pm, John Baldwin wrote: > > > > > > On Tuesday, November 02, 2010 3:29:01 pm Jung-uk Kim wrote: > > > > > > > On Tuesday 02 November 2010 11:29 am, Andriy Gapon wrote: > > > > > > > > on 29/10/2010 08:51 Andriy Gapon said the following: > > > > > > > > > I guess that a general problem here is that it is > > > > > > > > > incorrect to merely use memcpy/bcopy to create a copy > > > > > > > > > of a resource if the resource has > > > > > > > > > ACPI_RESOURCE_SOURCE field in it. > > > > > > > > > > > > > > > > Hans, > > > > > > > > > > > > > > > > could you please test the following patch? > > > > > > > > > > > > > > > > diff --git a/sys/dev/acpica/acpi_pci_link.c > > > > > > > > b/sys/dev/acpica/acpi_pci_link.c index dcf101d..e842635 > > > > > > > > 100644 --- a/sys/dev/acpica/acpi_pci_link.c > > > > > > > > +++ b/sys/dev/acpica/acpi_pci_link.c > > > > > > > > @@ -767,6 +767,8 @@ acpi_pci_link_srs_from_crs > > > > > > > > link->l_irq; > > > > > > > > else > > > > > > > > resptr->Data.ExtendedIrq.Interrupts[0] = 0; > > > > > > > > + memset(&resptr->Data.ExtendedIrq.ResourceSource, 0, > > > > > > > > + sizeof(ACPI_RESOURCE_SOURCE)); > > > > > > > > link++; > > > > > > > > i++; > > > > > > > > break; > > > > > > > > > > > > > > Hmm... Very interesting. Can you please try this, too? > > > > > > > > > > > > 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. -- John Baldwin