diff options
author | Julius Werner <jwerner@chromium.org> | 2013-08-27 15:48:32 -0700 |
---|---|---|
committer | Isaac Christensen <isaac.christensen@se-eng.com> | 2014-08-13 00:04:14 +0200 |
commit | b8fad3d02986222fa162d455eca2ffe807b6a15a (patch) | |
tree | f6beaf474faa9f4a9a4a611abb52774e7d0906ed /payloads/libpayload/arch | |
parent | 4498f6a6e57aa3bc1ed9449e3ad153b1a60c4eb6 (diff) |
arm: libpayload: Add cache coherent DMA memory definition and management
This patch adds a mechanism to set aside a region of cache-coherent
(i.e. usually uncached) virtual memory, which can be used to communicate
with DMA devices without automatic cache snooping (common on ARM)
without the need of explicit flush/invalidation instructions in the
driver code.
This works by setting aside said region in the (board-specific) page
table setup, as exemplary done in this patch for the Snow and Pit
boards. It uses a new mechanism for adding board-specific Coreboot table
entries to describe this region in an entry with the LB_DMA tag.
Libpayload's memory allocator is enhanced to be able to operate on
distinct types/regions of memory. It provides dma_malloc() and
dma_memalign() functions for use in drivers, which by default just
operate on the same heap as their traditional counterparts. However, if
the Coreboot table parsing code finds a CB_DMA section, further requests
through the dma_xxx() functions will return memory from the region
described therein instead.
Change-Id: Ia9c249249e936bbc3eb76e7b4822af2230ffb186
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/167155
(cherry picked from commit d142ccdcd902a9d6ab4d495fbe6cbe85c61a5f01)
Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com>
Reviewed-on: http://review.coreboot.org/6622
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'payloads/libpayload/arch')
-rw-r--r-- | payloads/libpayload/arch/armv7/coreboot.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/payloads/libpayload/arch/armv7/coreboot.c b/payloads/libpayload/arch/armv7/coreboot.c index d1f03453a2..e16c354d6b 100644 --- a/payloads/libpayload/arch/armv7/coreboot.c +++ b/payloads/libpayload/arch/armv7/coreboot.c @@ -108,6 +108,12 @@ static void cb_parse_vdat(unsigned char *ptr, struct sysinfo_t *info) } #endif +static void cb_parse_dma(unsigned char *ptr) +{ + struct cb_range *dma = (struct cb_range *)ptr; + init_dma_memory(phys_to_virt(dma->range_start), dma->range_size); +} + static void cb_parse_tstamp(unsigned char *ptr, struct sysinfo_t *info) { struct cb_cbmem_tab *const cbmem = (struct cb_cbmem_tab *)ptr; @@ -262,6 +268,9 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info) cb_parse_vbnv(ptr, info); break; #endif + case CB_TAG_DMA: + cb_parse_dma(ptr); + break; case CB_TAG_TIMESTAMPS: cb_parse_tstamp(ptr, info); break; |