From owner-freebsd-acpi@FreeBSD.ORG Tue Nov 2 20:56:02 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 6A7661065679; Tue, 2 Nov 2010 20:56:02 +0000 (UTC) (envelope-from robert.moore@intel.com) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx1.freebsd.org (Postfix) with ESMTP id 2B63A8FC08; Tue, 2 Nov 2010 20:56:01 +0000 (UTC) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 02 Nov 2010 13:56:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.58,284,1286175600"; d="scan'208";a="569734402" Received: from orsmsx603.amr.corp.intel.com ([10.22.226.49]) by orsmga002.jf.intel.com with ESMTP; 02 Nov 2010 13:56:00 -0700 Received: from orsmsx503.amr.corp.intel.com ([10.22.226.47]) by orsmsx603.amr.corp.intel.com ([10.22.226.49]) with mapi; Tue, 2 Nov 2010 13:56:00 -0700 From: "Moore, Robert" To: Jung-uk Kim , John Baldwin Date: Tue, 2 Nov 2010 13:55:58 -0700 Thread-Topic: MacBookPro 5,1 Thread-Index: Act6z5scnZGYKkUrQZiDqKP5mzYLYgAAJMxg Message-ID: <4911F71203A09E4D9981D27F9D830858BC3F4EB2@orsmsx503.amr.corp.intel.com> References: <201010121209.06397.hselasky@c2i.net> <201011021614.07631.jkim@FreeBSD.org> <201011021624.38882.jhb@freebsd.org> <201011021650.22657.jkim@FreeBSD.org> In-Reply-To: <201011021650.22657.jkim@FreeBSD.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "freebsd-acpi@freebsd.org" , "Lin, Ming M" , 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: Tue, 02 Nov 2010 20:56:02 -0000 Yes, it is important to keep all of these structures the same. The last time I personally ran into this was when we attempted to optimize = an interrupt descriptor before sending it out via _SRS. Since the size of t= he whole template was now different than the size of the _CRS, the BIOS fai= led on it. >-----Original Message----- >From: Jung-uk Kim [mailto:jkim@FreeBSD.org] >Sent: Tuesday, November 02, 2010 1:50 PM >To: John Baldwin >Cc: Andriy Gapon; Hans Petter Selasky; Lin, Ming M; Moore, Robert; freebsd= - >acpi@freebsd.org >Subject: Re: MacBookPro 5,1 > >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] =3D 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. ;-) > >Jung-uk Kim