From owner-freebsd-acpi@FreeBSD.ORG Fri Jun 4 06:45:23 2004 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E290C16A4CE for ; Fri, 4 Jun 2004 06:45:22 -0700 (PDT) Received: from mail5.speakeasy.net (mail5.speakeasy.net [216.254.0.205]) by mx1.FreeBSD.org (Postfix) with ESMTP id C39F743D2D for ; Fri, 4 Jun 2004 06:45:22 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 30445 invoked from network); 4 Jun 2004 13:45:13 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 4 Jun 2004 13:45:12 -0000 Received: from 10.50.41.233 (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.11/8.12.11) with ESMTP id i54Dj9QN081001; Fri, 4 Jun 2004 09:45:09 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: freebsd-acpi@FreeBSD.org Date: Fri, 4 Jun 2004 09:45:56 -0400 User-Agent: KMail/1.6 References: <20040601141424.I29932@root.org> <200406030917.36901.jhb@FreeBSD.org> <20040603104616.I43856@root.org> In-Reply-To: <20040603104616.I43856@root.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200406040945.56645.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx Subject: Re: Patch: Defer bus_config_intr() until bus_alloc_resource().. X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2004 13:45:23 -0000 On Thursday 03 June 2004 01:54 pm, Nate Lawson wrote: > On Thu, 3 Jun 2004, John Baldwin wrote: > > On Wednesday 02 June 2004 07:27 pm, Nate Lawson wrote: > > > On Wed, 2 Jun 2004, John Baldwin wrote: > > > > Ok, summary of PITAs after an hour or so of looking into it: > > > > > > I appreciate your efforts. Just to recap, we're trying to work around > > > an API design problem with bus_config_intr(). > > > > Well, it depends. See, using the existing API, I can make it work now > > with a small change. Here's some more food for thought. Specifically we > > are dealing with properties of an IRQ resource, correct? Now, the flags > > in struct resource now are provided by the driver as part of the request > > (align to this many bytes, I want it to be prefetchable, etc.). The > > properties of the actual hardware interrupt line are _not_ provided by > > the driver, but by the firmware. Now, what's another attribute about an > > IRQ resource that is provided by the firmware/BIOS. PCI interrupt > > routing! Yes, and where do we go ask the firmware for that information? > > bus_alloc_resource! So, we have a working model now. > > Except we already have the special bus_setup_intr() and bus_config_intr() > methods in addition to bus_alloc_resource() and bus_activate_resource(). > This indicates that a more general method is needed (bus_config_resource?) > between alloc/activate to set any special options, properties, etc. It > could just have a (void *) argument that is interpreted by the bus method > in any way it wants. This could also allow someone to reconfigure > resources by deactivating them, configuring them, then reactivating them. Yes, whatever model we go with, setup_intr/teardown_intr() need to die. I think that the nexus drivers should setup interrupt handlers when an IRQ resource is activated (done automatically during a RF_ACTIVE bus_alloc_resource()). It seems we have a few different types of meta-data associated with a resource: 1) Data that the device driver provides (for example, alignment of memory, whether or not memory is prefetchable, interrupt routine and argument) 2) Data that the firmware provides (PCI interrupt routing, interrupt properties (trigger/polarity). The bus driver provides this. Right now our current model is to use flags to bus_alloc_resource() for 1) with a hack for interrupt handler variables and to do 2) during bus_alloc_resource()'s implementation. If a bus wants to cache data for 2) earlier than bus_alloc_resource(), it can either provide its own method of doing this (this is what my patch does for ACPI by using _CRS as the cache) or we can try to push the data down into the resource list. We need a better solution for 1) though. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org