From owner-freebsd-arch@FreeBSD.ORG Tue Sep 5 22:04:00 2006 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6121C16A4E7; Tue, 5 Sep 2006 22:04:00 +0000 (UTC) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (gate.funkthat.com [69.17.45.168]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7084943D53; Tue, 5 Sep 2006 22:03:54 +0000 (GMT) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (6nkq3cr4f6xiziw1@localhost.funkthat.com [127.0.0.1]) by hydrogen.funkthat.com (8.13.6/8.13.3) with ESMTP id k85M3jR5050256; Tue, 5 Sep 2006 15:03:45 -0700 (PDT) (envelope-from jmg@hydrogen.funkthat.com) Received: (from jmg@localhost) by hydrogen.funkthat.com (8.13.6/8.13.3/Submit) id k85M3ido050254; Tue, 5 Sep 2006 15:03:44 -0700 (PDT) (envelope-from jmg) Date: Tue, 5 Sep 2006 15:03:44 -0700 From: John-Mark Gurney To: Hans Petter Selasky Message-ID: <20060905220344.GL9421@funkthat.com> Mail-Followup-To: Hans Petter Selasky , freebsd-arch@freebsd.org, freebsd-current@freebsd.org, Poul-Henning Kamp , freebsd-drivers@freebsd.org References: <14026.1157478288@critter.freebsd.dk> <44FDC278.3050902@samsco.org> <200609052111.52304.hselasky@c2i.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200609052111.52304.hselasky@c2i.net> User-Agent: Mutt/1.4.2.1i X-Operating-System: FreeBSD 5.4-RELEASE-p6 i386 X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html Cc: Poul-Henning Kamp , freebsd-current@freebsd.org, freebsd-drivers@freebsd.org, freebsd-arch@freebsd.org Subject: Re: bus_get_dma_tag now necessary for drivers using bus_dma X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: John-Mark Gurney List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Sep 2006 22:04:00 -0000 Hans Petter Selasky wrote this message on Tue, Sep 05, 2006 at 21:11 +0200: > 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); It won't prevent you from first creating a bus_dma_tag_t w/ no restrictions but the dev, and passing that to this function.. Once you have inherited the tag from the device, all children tag's will have the correct tag... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."