Question regarding bus_dma_tag_create().
Paul Marciano
pm940 at yahoo.com
Tue May 9 18:44:17 UTC 2006
I posted this onto freebsd-questions a couple of days
ago but received no reply. Hopefully this is a more
appropriate audience.
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
More information about the freebsd-hackers
mailing list