From owner-svn-src-all@FreeBSD.ORG Sun Apr 14 21:18:46 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E04B2E83; Sun, 14 Apr 2013 21:18:46 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 7BDDF27E; Sun, 14 Apr 2013 21:18:46 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.6/8.14.6/ALCHEMY.FRANKEN.DE) with ESMTP id r3ELIjmX069077; Sun, 14 Apr 2013 23:18:45 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.6/8.14.6/Submit) id r3ELIimp069076; Sun, 14 Apr 2013 23:18:44 +0200 (CEST) (envelope-from marius) Date: Sun, 14 Apr 2013 23:18:44 +0200 From: Marius Strobl To: Konstantin Belousov Subject: Re: svn commit: r249476 - in head/sys/dev: ata pci Message-ID: <20130414211844.GB62578@alchemy.franken.de> References: <201304141402.r3EE2YIi001357@svn.freebsd.org> <20130414150507.GA62578@alchemy.franken.de> <20130414205222.GG2930@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130414205222.GG2930@kib.kiev.ua> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 21:18:47 -0000 On Sun, Apr 14, 2013 at 11:52:22PM +0300, Konstantin Belousov wrote: > On Sun, Apr 14, 2013 at 05:05:07PM +0200, Marius Strobl wrote: > > On Sun, Apr 14, 2013 at 02:02:34PM +0000, Konstantin Belousov wrote: > > > Author: kib > > > Date: Sun Apr 14 14:02:34 2013 > > > New Revision: 249476 > > > URL: http://svnweb.freebsd.org/changeset/base/249476 > > > > > > Log: > > > Usnure that PCI bus BIS_GET_DMA_TAG() method sees the actual PCI > > > device which makes the request for dma tag, instead of some descendant > > > of the PCI device, by creating a pass-through trampoline for vga_pci > > > and ata_pci buses. > > > > If you need to know the last PCI device requesting the DMA tag, > > wouldn't it make more sense to let the consumer of this walk up the > > tree as necessary instead of hacking N drivers? I.e.: > > foo_get_dma_tag(device_t bus, device_t child) > > { > > device_t device, parent; > > devclass_t pci_devclass; > > > > pci_devclass = devclass_find("pci"); > > for (device = child; child != bus; device = parent) { > > parent = device_get_parent(device); > > if (device_get_devclass(parent) != pci_devclass) > > continue; > > break; > > } > > /* use device */ > > } > The similar approach was my first thought, and I discussed it with John. > After the discussion, I agreed that this is a hack. > > My understanding is that this default behaviour is only correct for > the simple cases like the one fixed in the commit. Forcing this on > other buses would only make the bugs hidden and cause more efforts > in trying to identify it. Oh, I see that now. Thanks for the clarification. Marius