Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Feb 2007 14:40:06 -0800
From:      John-Mark Gurney <gurney_j@resnet.uoregon.edu>
To:        Luigi Rizzo <rizzo@icir.org>
Cc:        current@freebsd.org
Subject:   Re: can a valid bus_dma_tag_t be NULL ?
Message-ID:  <20070219224006.GC73385@funkthat.com>
In-Reply-To: <20070219020725.A56400@xorpc.icir.org>
References:  <20070219020725.A56400@xorpc.icir.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070219224006.GC73385>