Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Aug 2001 15:52:18 -0700 (PDT)
From:      wpaul@FreeBSD.ORG (Bill Paul)
To:        gibbs@scsiguy.com (Justin T. Gibbs)
Cc:        mjacob@feral.com, hackers@FreeBSD.ORG, current@FreeBSD.ORG
Subject:   Re: Where to put new bus_dmamap_load_mbuf() code
Message-ID:  <20010822225219.0EB8637B43C@hub.freebsd.org>
In-Reply-To: <200108222217.f7MMH7Y18044@aslan.scsiguy.com> from "Justin T. Gibbs" at "Aug 22, 2001 04:17:07 pm"

next in thread | previous in thread | raw e-mail | index | archive | help

> >Maybe, but bus_dmamap_load() only lets you map one buffer at a time.
> >I want to map a bunch of little buffers, and the API doesn't let me
> >do that. And I don't want to change the API, because that would mean
> >modifying busdma_machdep.c on each platform, which is a hell that I
> >would rather avoid.
> 
> bus_dmamap_load() is only one part of the API.  bus_dmamap_load_mbuf
> or bus_dmamap_load_uio or also part of the API.  They just don't happen
> to be impmeneted yet. 8-)  Perhaps there should be an MD primitive
> that knows how to append to a mapping?  This would allow you to write
> an MI loop that does exactly what you want.

Any one of those ideas would be just fine. I eagerly await their
realization. :)
 
> >It's a separate list. The driver is reponsible for allocating the
> >head of the list, then it hands it to bus_dmamap_list_alloc() along
> >with the required dma tag. bus_dmamap_list_alloc() then calls
> >bus_dmapap_create() to populate the list. The driver doesn't have
> >to manipulate the list itself, until time comes to destroy it.
> 
> Okay, but does this mean that bus_dmamap_load_mbuf no longer takes
> a dmamap?  Drivers may want to allocate/manage the dmamaps in a
> different way.

Yes, bus_dmamap_load_mbuf() accepts a dma tag, the head of the
dmamap list, an mbuf, an segment array and a segment count. The
Driver allocates the segment array with a certain number of
members. It passes the array and segment count to bus_dmamap_load_mbuf(),
which treats the segment count as the maximum number of segments
that it can return to the caller. Once all the mappings have been
done, it updates the segment count to indicate how many segments
were actually needed. Then the driver transfers the info from
the segment array into its DMA descriptor structures and kicks
off the DMA operation.

Once the device signals the transfer is done, the driver calls
bus_dmamap_unload_mbuf() and bus_dmamap_destroy_mbuf() to unload
the maps and return them to the map list for later use. It isn't
until the driver calls bus_dmamap_list_destroy() that the dmamaps
are actually released and the list free()ed.

-Bill

--
=============================================================================
-Bill Paul            (510) 749-2329 | Senior Engineer, Master of Unix-Fu
                 wpaul@windriver.com | Wind River Systems
=============================================================================
"I like zees guys. Zey are fonny guys. Just keel one of zem." -- The 3 Amigos
=============================================================================

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010822225219.0EB8637B43C>