Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Oct 2014 02:24:52 -0300
From:      Martin Galvan <omgalvan.86@gmail.com>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        freebsd-drivers@freebsd.org, freebsd-embedded@freebsd.org
Subject:   Re: A few questions about SD/MMC drivers
Message-ID:  <CAN19L9E0K4rhffRwAo-oyxtajCy4R3Y1bF%2BS7RkSD-NKA_MH%2BA@mail.gmail.com>
In-Reply-To: <20141006171521.GD26076@kib.kiev.ua>
References:  <CAN19L9ENsuAR6_aXwJSRdfDz6UgE6kU%2BrCkGGsdK7tRcUes%2B0w@mail.gmail.com> <20141006171521.GD26076@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
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!



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAN19L9E0K4rhffRwAo-oyxtajCy4R3Y1bF%2BS7RkSD-NKA_MH%2BA>