From owner-freebsd-current@FreeBSD.ORG Tue Sep 5 19:11:43 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 062EC16A4DA; Tue, 5 Sep 2006 19:11:43 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe03.swip.net [212.247.154.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id F211943D45; Tue, 5 Sep 2006 19:11:41 +0000 (GMT) (envelope-from hselasky@c2i.net) X-T2-Posting-ID: gvlK0tOCzrqh9CPROFOFPw== X-Cloudmark-Score: 0.000000 [] Received: from [193.216.91.134] (HELO [10.0.0.249]) by mailfe03.swip.net (CommuniGate Pro SMTP 5.0.8) with ESMTP id 279172218; Tue, 05 Sep 2006 21:11:37 +0200 From: Hans Petter Selasky To: freebsd-arch@freebsd.org Date: Tue, 5 Sep 2006 21:11:50 +0200 User-Agent: KMail/1.7 References: <14026.1157478288@critter.freebsd.dk> <44FDC278.3050902@samsco.org> In-Reply-To: <44FDC278.3050902@samsco.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200609052111.52304.hselasky@c2i.net> X-Mailman-Approved-At: Tue, 05 Sep 2006 19:21:38 +0000 Cc: John-Mark Gurney , freebsd-current@freebsd.org, Poul-Henning Kamp , freebsd-drivers@freebsd.org Subject: Re: bus_get_dma_tag now necessary for drivers using bus_dma X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Sep 2006 19:11:43 -0000 On Tuesday 05 September 2006 20:31, Scott Long wrote: > Poul-Henning Kamp wrote: > > In message <20060905173334.GH9421@funkthat.com>, John-Mark Gurney writes: > >>This means that for each call to bus_dma_tag_create, instead of passing > >>a NULL pointer, you should call bus_get_dma_tag(yourdev) and use that > >>as the parent tag. I committed some example code to various drivers, > >>such as ahc, ata, em, and ohci. > > > > If there are never any exeptions to this requirement, why not > > pass "yourdev" and have the magic hidden, rather than add 17 > > ritual characters to the API ? > > Drivers can have their own multi-level tag heirarchy. You'd have to > create a new bus_dma_tag_create() variant that expected a device_t > instead of a bus_dma_tag_t. This might be a good idea. > I think it is easier to share code with NetBSD if we use "bus_get_dma_tag(yourdev)". For example I use the following prototype on NetBSD and FreeBSD: void * usbd_mem_alloc(bus_dma_tag_t parent, u_int32_t size, u_int8_t align_power); --HPS