Date: Tue, 9 May 2006 11:44:10 -0700 (PDT) From: Paul Marciano <pm940@yahoo.com> To: freebsd-hackers@freebsd.org Subject: Question regarding bus_dma_tag_create(). Message-ID: <20060509184410.1515.qmail@web54008.mail.yahoo.com>
index | next in thread | raw e-mail
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
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060509184410.1515.qmail>
