contiguous memory allocation problem

Ian Dowse iedowse at iedowse.com
Sun Jul 2 21:30:33 UTC 2006


In message <200607022106.22935.hselasky at c2i.net>, Hans Petter Selasky writes:
>Ok. So the solution to my problem is to use scatter and gather. I will see 
>about updating my USB system to do it like that.
>
>But there is one thing I do not understand yet. When you load a page that 
>physically resides above 4GB, because a computer has more than 4GB of memory, 
>how does "bus_dmamap_load()" move that page down below 4GB, so that the 
>32-bit USB host controllers can reach it?

What should happen is that bus_dma allocates a bounce buffer and
performs copies as required from within the bus_dmamap_sync() calls.
This is something I haven't been able to verify yet with the USB
code though, so there could easily be bugs there.

BTW, as far as I know bus_dma is also missing support for multi-segment
allocations, so for example if you ask it to allocate 16k in at
most 4 segments below the 4GB mark, it will actually attempt a
physically contiguous allocation. If this was fixed it could be
used by usbd_alloc_buffer() to give directly usable buffers without
contiguous allocations.

Ian


More information about the freebsd-hackers mailing list