DragonFly BSD
DragonFly kernel List (threaded) for 2006-08
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: mapping user space buffer


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 8 Aug 2006 13:27:55 -0700 (PDT)

:
:I have a driver that supports DMA of user space buffers and had a
:couple of questions. The ultimate question (I think) is how to
:lock/map/unmap/unlock user space virtual addresses. A quick perusal of
:some drivers turned up two approaches: vmapbuf() and the
:bus_dmamap_load*() routines. The source for each makes them look
:similar, but are they equivalent? Is one preferable? In both cases, it
:appears that the driver must first call vslock() on the user virtual
:address (and then vsunlock after the transfer completes). Are there
:other necessary steps? Is there a good driver that I can use to answer
:some of these questions? As usual, TIA.
:
:---chuck

    You will probably have to use both.  vmapbuf() assumes the data to be
    in user memory and basically maps it into kernel memory and prevents
    it from being ripped out from under the device.  BUSDMA expects
    the data to be in kernel memory and handles any bounce-buffer 
    requirements (if the device's DMA cannot reach the physical memory
    locations in question).

					-Matt
					Matthew Dillon 
					<dillon@xxxxxxxxxxxxx>



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]