A few questions about SD/MMC drivers
Martin Galvan
omgalvan.86 at gmail.com
Mon Oct 13 05:24:53 UTC 2014
Hi again! I'm in the middle of implementing DMA support for the
Allwinner driver, and I was surprised to see that BSD doesn't have a
simple DMA API as Linux does. Namely, I didn't see anything like the
scatterlists used in Linux.
The host found in Allwinner SoCs uses a DMA controller which works
with a linked list of descriptors, each having info on a data buffer.
In the Linux driver they allocate a coherent DMA buffer using
dma_alloc_coherent to get both the virtual and bus addresses of the
descriptor list. When it's time to do a DMA transfer, the Linux driver
allocates a scatterlist with each entry being a buffer corresponding
to a descriptor; it then loops through the descriptor list setting the
"buffer pointer" field of each one to the bus address of the
corresponding scatterlist entry, and the "next descriptor" to the bus
address of the following descriptor. It's pretty neat, though it's
worth mentioning the scatterlist that the MMC request handler maps
already contains the virtual addresses of the requested buffers.
Do we have anything like that on BSD? If not, what would be a simple
algorithm to make this work?
Again, thanks a lot!
More information about the freebsd-embedded
mailing list