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 
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to