bus_dma (9). What exactly means "Loading of memory allocation" ?

Alexej Sokolov bsd.quest at googlemail.com
Mon Feb 2 08:23:36 PST 2009


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 (-:

right ?

Thanx,
Alexej



2009/2/2 Garrett Cooper <yanefbsd at gmail.com>

> On Mon, Feb 2, 2009 at 12:45 AM, Garrett Cooper <yanefbsd at gmail.com>
> wrote:
> > On Sun, Feb 1, 2009 at 5:56 PM, Sergey Babkin <babkin at verizon.net>
> wrote:
> >>
> >>   If I remember correctly, loading means that the pages become mapped
> >>   and visible to the devices. Some buses can access only a limited
> >>   address space , like ISA has only a 24-bit address. When a map gets
> >>   loaded, for any pages outside of this range the temporary in-ramge
> >>   pages are allocated and the d ata gets moved through them. On some
> >>   machines, like I think DEC Alpha, the  physicall addresses seen by
> >>   the devices are not the same as seen by the CPU , these need to be
> >>   translated. And so on.
> >>   I think my real old articl e had some of these explanations but now
> >>   the Daemonnews site seems to be re al slow:
> >>   http://ezine.daemonnews.org/200008/isa.html
> >>   -SB
> >>   (sorry a bout top quoting, it's the only kind the web interface of my
> >>   provider suppo rts)
> >>   Feb 1, 2009 03:38:27 PM, [1]bsd.quest at googlemail.com  wrote:
> >>
> >>      Hi,
> >>     at first the cut of text from man (9) bus_dma:
> >>     bus_dmamap_t
> >>      A machine-dependent opaque type describing an individual
> >>     mapp ing.
> >>     One map is used for each memory allocation that will b e loaded.
> >>     Maps can be reused once they have been unloaded.. .
> >>     Question: What exactly means "Loading of memory allocation" in thi
>   s context
> >>     ?
> >>     Could anyone explain it or give me some little example wi th DMA
> >>     functions
> >>     for understanding it.
> >
> > Unfortunately it's bad English, so that might be where some of the
> > confusion is stemming from. I'll send a doc's PR request after this to
> > fix it.
> > -Garrett
>
> Ugh. Nevermind. The question was written improperly -- the manpage wasn't
> ><.
> -Garrett
>


More information about the freebsd-hackers mailing list