summaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_memory.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2016-05-11 18:25:48 +0200
committerTom Rini <trini@konsulko.com>2016-05-27 15:39:48 -0400
commit51735ae0ea2f5d67c0f7cc4d1f938f36955e1fe7 (patch)
tree63a01e042c04913656eba26ca02e8f29693d0e07 /lib/efi_loader/efi_memory.c
parent851bda81487b0e2b5b43c9c2dc2582214751953e (diff)
downloadu-boot-imx-51735ae0ea2f5d67c0f7cc4d1f938f36955e1fe7.zip
u-boot-imx-51735ae0ea2f5d67c0f7cc4d1f938f36955e1fe7.tar.gz
u-boot-imx-51735ae0ea2f5d67c0f7cc4d1f938f36955e1fe7.tar.bz2
efi_loader: Add bounce buffer support
Some hardware that is supported by U-Boot can not handle DMA above 32bits. For these systems, we need to come up with a way to expose the disk interface in a safe way. This patch implements EFI specific bounce buffers. For non-EFI cases, this apparently was no issue so far, since we can just define our environment variables conveniently. Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib/efi_loader/efi_memory.c')
-rw-r--r--lib/efi_loader/efi_memory.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 71a3d19..9e669f5 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -27,6 +27,10 @@ struct efi_mem_list {
/* This list contains all memory map items */
LIST_HEAD(efi_mem);
+#ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER
+void *efi_bounce_buffer;
+#endif
+
/*
* Sorts the memory list from highest address to lowest address
*
@@ -349,5 +353,17 @@ int efi_memory_init(void)
efi_add_memory_map(runtime_start, runtime_pages,
EFI_RUNTIME_SERVICES_CODE, false);
+#ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER
+ /* Request a 32bit 64MB bounce buffer region */
+ uint64_t efi_bounce_buffer_addr = 0xffffffff;
+
+ if (efi_allocate_pages(1, EFI_LOADER_DATA,
+ (64 * 1024 * 1024) >> EFI_PAGE_SHIFT,
+ &efi_bounce_buffer_addr) != EFI_SUCCESS)
+ return -1;
+
+ efi_bounce_buffer = (void*)(uintptr_t)efi_bounce_buffer_addr;
+#endif
+
return 0;
}