From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 27 11:01:43 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8B85F37B401 for ; Fri, 27 Jun 2003 11:01:43 -0700 (PDT) Received: from mail.speakeasy.net (mail7.speakeasy.net [216.254.0.207]) by mx1.FreeBSD.org (Postfix) with ESMTP id EC0F643FE1 for ; Fri, 27 Jun 2003 11:01:42 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 17583 invoked from network); 27 Jun 2003 18:01:41 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender )encrypted SMTP for ; 27 Jun 2003 18:01:41 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.9/8.12.9) with ESMTP id h5RI1XGI062550; Fri, 27 Jun 2003 14:01:35 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.4 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20030627175115.GA847@crow.dom2ip.de> Date: Fri, 27 Jun 2003 14:01:45 -0400 (EDT) From: John Baldwin To: Thomas Moestl cc: freebsd-hackers@freebsd.org Subject: Re: PLEASE REVIEW: Adding a pci_if method to facilitate specialized PCI bus drivers X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jun 2003 18:01:43 -0000 On 27-Jun-2003 Thomas Moestl wrote: > On Fri, 2003/06/27 at 13:37:00 -0400, John Baldwin wrote: >> On 13-Jun-2003 Thomas Moestl wrote: >> > This requires us to get this firmware property in the OFW PCI bus >> > driver before routing the interrupt; that can't be done in the pcib >> > route_interrupt method, since we don't know whether we are routing for >> > another bridge (where we use whichever index we get passed) or for a >> > child device (in which case we would need to look at the firmware >> > property). >> >> Actually, can't you tell this by doing: >> >> if (device_get_parent(device_get_parent(dev)) == pcib) >> /* Routing direct child. */ >> else >> /* Routing descedent of a child bridge. */ > > No, pcib will always be a grandparent of dev. When routing a > descendant child bridge, dev will itself be the device_t of a bridge, > otherwise it is that of the device we are routing to. Doh, yes. :( Hmm, can you try something like this maybe: if (pci_get_class(dev) == PCIC_BRIDGE && pci_get_subclass(dev) == PCIS_BRIDGE_PCI) /* Routing across a child bridge. */ else /* Routing a direct child that is not a bridge. */ -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/