diff options
author | Russell King <rmk@arm.linux.org.uk> | 2013-06-23 09:51:20 +0100 |
---|---|---|
committer | Russell King <rmk@arm.linux.org.uk> | 2013-06-23 09:54:19 +0100 |
commit | 791f2728d4030ec8f453463fba95647ce19767b9 (patch) | |
tree | 999c773edd2aed5f3d7d467a6ec9e75e3bd4d7a1 /vmeta_lib.c | |
parent | d2ba876f81bd13679a842f94a5111109ffee78d6 (diff) |
Convert to use bmm_malloc_aligned_phys() API
BMM internally allocates memory by physical address, and then maps it
to a virtual address.
Rather than using an API which returns the virtual address which then
has to be re-translated back to a physical address, use an API which
gets us all the information we need in one go.
This gets rid of the bmm_get_paddr() step when allocating memory.
Diffstat (limited to 'vmeta_lib.c')
-rw-r--r-- | vmeta_lib.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/vmeta_lib.c b/vmeta_lib.c index 01ae124..0fbe76e 100644 --- a/vmeta_lib.c +++ b/vmeta_lib.c @@ -167,6 +167,7 @@ void vdec_os_api_dma_free(void *ptr) static void *vmeta_bmm_malloc_aligned(UNSG32 size, UNSG32 align, UNSG32 *phys, int attr) { + unsigned long paddr; void *ptr; if (size == 0) @@ -175,16 +176,17 @@ static void *vmeta_bmm_malloc_aligned(UNSG32 size, UNSG32 align, UNSG32 *phys, i dbg_printf(VDEC_DEBUG_MEM, "%s: size 0x%x attr %u align %u\n", __FUNCTION__, size, attr, align); - ptr = bmm_malloc_aligned(size, attr, align); + ptr = bmm_malloc_aligned_phys(size, attr, align, &paddr); if (!ptr) { dbg_printf(VDEC_DEBUG_MEM, "%s: not enough memory\n", __FUNCTION__); return NULL; } - *phys = (UNSG32)bmm_get_paddr(ptr); + *phys = paddr; - dbg_printf(VDEC_DEBUG_MEM, "%s: ptr: 0x%x\n", __FUNCTION__, ptr); + dbg_printf(VDEC_DEBUG_MEM, "%s: virt=%p phys=0x%08lx\n", + __FUNCTION__, ptr, paddr); return ptr; } |