From 51735ae0ea2f5d67c0f7cc4d1f938f36955e1fe7 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Wed, 11 May 2016 18:25:48 +0200 Subject: 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 --- lib/efi_loader/efi_memory.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/efi_loader/efi_memory.c') 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; } -- cgit v1.1