Add support for allocating DMA memory

This patch extends the RAM session interface with the ability to
allocate DMA buffers. The client specifies the type of RAM dataspace to
allocate via the new 'cached' argument of the 'Ram_session::alloc()'
function. By default, 'cached' is true, which correponds to the common
case and the original behavior. When setting 'cached' to 'false', core
takes the precautions needed to register the memory as uncached in the
page table of each process that has the dataspace attached.

Currently, the support for allocating DMA buffers is implemented for
Fiasco.OC only. On x86 platforms, it is generally not needed. But on
platforms with more relaxed cache coherence (such as ARM), user-level
device drivers should always use uncacheable memory for DMA transactions.
This commit is contained in:
Norman Feske
2012-06-18 15:20:31 +02:00
parent 896d12d0b8
commit 288fd4e56e
28 changed files with 187 additions and 124 deletions

View File

@ -252,12 +252,12 @@ namespace Genode {
Expanding_ram_session_client(Ram_session_capability cap)
: Ram_session_client(cap), _cap(cap) { }
Ram_dataspace_capability alloc(size_t size) {
Ram_dataspace_capability alloc(size_t size, bool cached) {
bool try_again;
do {
try_again = false;
try {
return Ram_session_client::alloc(size);
return Ram_session_client::alloc(size, cached);
} catch (Ram_session::Out_of_metadata) {