On 09/18/2017 12:59 AM, Simon Glass wrote: > With sandbox the U-Boot code is not mapped into the sandbox memory range > so does not need to be excluded when allocating EFI memory. Update the EFI > memory init code to take account of that. > > Signed-off-by: Simon Glass <s...@chromium.org> > --- > > lib/efi_loader/efi_memory.c | 28 ++++++++++++++++------------ > 1 file changed, 16 insertions(+), 12 deletions(-) > > diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c > index ad3d277be6..c1a080e2e9 100644 > --- a/lib/efi_loader/efi_memory.c > +++ b/lib/efi_loader/efi_memory.c > @@ -459,18 +459,22 @@ int efi_memory_init(void) > > efi_add_known_memory(); > > - /* Add U-Boot */ > - uboot_start = (gd->start_addr_sp - uboot_stack_size) & ~EFI_PAGE_MASK; > - uboot_pages = (gd->ram_top - uboot_start) >> EFI_PAGE_SHIFT; > - efi_add_memory_map(uboot_start, uboot_pages, EFI_LOADER_DATA, false); > - > - /* Add Runtime Services */ > - runtime_start = (ulong)&__efi_runtime_start & ~EFI_PAGE_MASK; > - runtime_end = (ulong)&__efi_runtime_stop; > - runtime_end = (runtime_end + EFI_PAGE_MASK) & ~EFI_PAGE_MASK; > - runtime_pages = (runtime_end - runtime_start) >> EFI_PAGE_SHIFT; > - efi_add_memory_map(runtime_start, runtime_pages, > - EFI_RUNTIME_SERVICES_CODE, false); > + if (!IS_ENABLED(CONFIG_SANDBOX)) {
We need the memory maps for: GetMemoryMap ExitBootServices In efi_init_memory_init you define 8 MB memory starting at 0x0000000000000000 as available: ram_start 0 start 0 pages 8000 I suggest you override efi_init_memory_init using malloc to assign at least 128 MB contiguous memory with alignment EFI_PAGE_SIZE. Regards Heinrich > + /* Add U-Boot */ > + uboot_start = (gd->start_addr_sp - uboot_stack_size) & > + ~EFI_PAGE_MASK; > + uboot_pages = (gd->ram_top - uboot_start) >> EFI_PAGE_SHIFT; > + efi_add_memory_map(uboot_start, uboot_pages, EFI_LOADER_DATA, > + false); > + > + /* Add Runtime Services */ > + runtime_start = (ulong)&__efi_runtime_start & ~EFI_PAGE_MASK; > + runtime_end = (ulong)&__efi_runtime_stop; > + runtime_end = (runtime_end + EFI_PAGE_MASK) & ~EFI_PAGE_MASK; > + runtime_pages = (runtime_end - runtime_start) >> EFI_PAGE_SHIFT; > + 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 */ > _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot