efi: app: Allocate pages in any region

Rather than immediately falling back to the pool allocator when we
cannot get enough memory below 4GB, try the page allocator first. This
provides 4K-aligned memory, which is nicer to look at when debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-08-15 13:49:15 -06:00
parent 968ee73c16
commit f7c25b1735

View File

@@ -112,6 +112,11 @@ static efi_status_t setup_memory(struct efi_priv *priv)
addr = 1ULL << 32;
ret = boot->allocate_pages(EFI_ALLOCATE_MAX_ADDRESS,
priv->image_data_type, pages, &addr);
if (ret) {
log_info("(any address) ");
ret = boot->allocate_pages(EFI_ALLOCATE_ANY_PAGES,
priv->image_data_type, pages, &addr);
}
if (ret) {
log_info("(using pool %lx) ", ret);
priv->ram_base = (ulong)efi_malloc(priv, CONFIG_EFI_RAM_SIZE,
@@ -123,6 +128,7 @@ static efi_status_t setup_memory(struct efi_priv *priv)
log_info("(using allocated RAM address %lx) ", (ulong)addr);
priv->ram_base = addr;
}
gd->ram_base = addr;
gd->ram_size = pages << 12;
return 0;