bus_dma (9). What exactly means "Loading of memory allocation" ?
John Baldwin
jhb at freebsd.org
Wed Feb 4 06:26:29 PST 2009
On Monday 02 February 2009 11:23:33 am Alexej Sokolov wrote:
> Hi,
> thanx for your answer. I checked the source code of the *dma() functions.
> If I understand it correctly, "loading of memory allocation" means the
> following:
>
> 1. At first memory allocation should be done: bufp = *alloc(sizeof ....)
> 2. then in ... _bus_dmamap_load_buffer() we get physical addres of allocated
> buffer:
> if (pmap)
> curaddr = pmap_extract(pmap, vaddr);
> else
> curaddr = pmap_kextract(vaddr);
>
> ... then some "magic" with bouncing
>
> 3. then physical address will passed to dmat->segments
> segs[seg].ds_addr = curaddr;
> segs[seg].ds_len = sgsize;
>
> Ok, it all means: getting of physical address of allocated buffer. If
> physical space not accessble for device, allocating bounce buffers. Getting
> of physical addresses of allocated buffers. And then put these physical
> addresses and sizes of buffers in dmat->segments array. <- loading of
> memory allocation (-:
Yes. On architectures with an IOMMU, the load may also program entries into
the IOMMU for the specified buffer and then populate the S/G array with the
associated DMA addresses (sparc64 uses this). I think the "load" name has
more to do with this case in that you are "loading" a buffer into the DMA
virtual address space (with IOMMUs you have a separate virtual address space
for DMA that is not 1:1 with physical addresses as on i386 machines). If you
look at bus_dma as basically implementing an abstract IOMMU on all
architectures then it might make a bit more sense.
--
John Baldwin
More information about the freebsd-hackers
mailing list