From owner-freebsd-current@FreeBSD.ORG Mon Feb 19 23:17:25 2007 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A9C1916F40C for ; Mon, 19 Feb 2007 23:17:25 +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 7A07513C478 for ; Mon, 19 Feb 2007 23:17:25 +0000 (UTC) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (00swqfr9mhtwdexj@localhost.funkthat.com [127.0.0.1]) by hydrogen.funkthat.com (8.13.6/8.13.3) with ESMTP id l1JMe9jc031536; Mon, 19 Feb 2007 14:40:09 -0800 (PST) (envelope-from jmg@hydrogen.funkthat.com) Received: (from jmg@localhost) by hydrogen.funkthat.com (8.13.6/8.13.3/Submit) id l1JMe7QO031535; Mon, 19 Feb 2007 14:40:07 -0800 (PST) (envelope-from jmg) Date: Mon, 19 Feb 2007 14:40:06 -0800 From: John-Mark Gurney To: Luigi Rizzo Message-ID: <20070219224006.GC73385@funkthat.com> Mail-Followup-To: Luigi Rizzo , current@freebsd.org References: <20070219020725.A56400@xorpc.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070219020725.A56400@xorpc.icir.org> 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: current@freebsd.org Subject: Re: can a valid bus_dma_tag_t be NULL ? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: John-Mark Gurney List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2007 23:17:25 -0000 Luigi Rizzo wrote this message on Mon, Feb 19, 2007 at 02:07 -0800: > The original code (if_iwi.c, but the pattern is repeated in other > drivers too) is the one below. Now, rather than using multiple > labels, is there a value for the various fields (bus_dma_tag_t, > bus_dmamap_t, fw_virtaddr, fw_physaddr) that tells me > that the resource has not been allocated, or i should keep > track of the success/failure of the various calls separately ? > > E.g. i imagine that a NULL fw_virtaddr means failure, however > bus_dmamap_load() worries me because the callback may happen later, > and also i seem to remember that one should not make assumptions > on bus_dma_tag_t == NULL ... > > comments anyone ? And, is -stable different from -current ? Unless we introduce and document that there are magic values that these can take, I would say no, there are no values that you can depend upon... Though considering that we now have sys/_bus_dma.h that has the tag and map as opaque struct pointers, we may.. Original design was to let each arch have their own defines for the structs so that an extra pointer wouldn't have to be followed, but we have dropped that idea in recent years.. > if (bus_dma_tag_create(NULL, 4, 0, BUS_SPACE_MAXADDR_32BIT, ^^^^ This is incorrect, and should be: bus_get_dma_tag(dev), though that is correct for -stable, (or have we introduced bus_get_dma_tag into -stable?) -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."