[U-Boot] [PATCH 1/3] efi_loader: fix GetMemoryMap()

Heinrich Schuchardt xypron.glpk at gmx.de
Sun Nov 4 18:48:59 UTC 2018


The sandbox uses two different address rooms - one used internally by the
sandbox and one usable for EFI.

Very unfortunately this has spilled into the EFI coding.

In efi_get_memory_map() we have to map the returned physical start
addresses to EFI usable addresses.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 lib/efi_loader/efi_memory.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 5bd4f4d7fc4..bbf174c7ef7 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -531,9 +531,14 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size,
 	memory_map = &memory_map[map_entries - 1];
 	list_for_each(lhandle, &efi_mem) {
 		struct efi_mem_list *lmem;
+		unsigned long len;
+		efi_physical_addr_t addr;
 
 		lmem = list_entry(lhandle, struct efi_mem_list, link);
 		*memory_map = lmem->desc;
+		len = memory_map->num_pages << EFI_PAGE_SHIFT;
+		addr = (uintptr_t)map_sysmem(memory_map->physical_start, len);
+		memory_map->physical_start = addr;
 		memory_map--;
 	}
 
-- 
2.19.1



More information about the U-Boot mailing list