Date: Sat, 6 May 2006 21:03:48 -0700 (PDT) From: Paul Marciano <pm940@yahoo.com> To: freebsd-questions@freebsd.org Subject: Question regarding bus_dma_tag_create() . Message-ID: <20060507040348.73577.qmail@web54007.mail.yahoo.com>
next in thread | raw e-mail | index | archive | help
Hi.
The man page for bus_dma_map_create() says this about
the "nsegments" parameter:
Number of discontinuities (scatter/gather seg-
ments) allowed in a DMA mapped region. If there
is no restriction, BUS_SPACE_UNRESTRICTED may be
specified.
BUS_SPACE_UNRESTRICTED is #defined as (~0).
Then, in busdma_map_create() and busdma_mem_alloc():
if (dmat->segments == NULL) {
dmat->segments = (bus_dma_segment_t *)malloc(
sizeof(bus_dma_segment_t) * dmat->nsegments,
M_DEVBUF,
M_NOWAIT);
...
}
I don't understand how this works when
BUS_SPACE_UNRESTRICTED is specified. The malloc will
be fed a -8 (or -12 with PAE) on i386.
I'm reviewing a driver at work that specifies
nsegments = 0, which I think is invalid, but in
reading the man page I came across this ~0 option,
which I've also seen in other FreeBSD drivers and I
just don't get it.
I hope someone can clue me in.
Thanks,
Paul.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060507040348.73577.qmail>
