lmb: Remove lmb_alloc_base_flags()

lmb_alloc_base() is just calling lmb_alloc_base_flags() with LMB_NONE.
There's not much we gain from this abstraction, so let's remove the
former add the flags argument to lmb_alloc_base() and make the code
a bit easier to follow.

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Tested-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
(cherry picked from commit 3075708017)
This commit is contained in:
Ilias Apalodimas
2024-12-18 09:02:36 +02:00
committed by Simon Glass
parent e005799d8f
commit c20372170e
6 changed files with 26 additions and 35 deletions

View File

@@ -455,14 +455,14 @@ static efi_status_t efi_allocate_pages_(enum efi_allocate_type type,
switch (type) {
case EFI_ALLOCATE_ANY_PAGES:
/* Any page */
addr = (u64)lmb_alloc_base_flags(len, EFI_PAGE_SIZE,
addr = (u64)lmb_alloc_base(len, EFI_PAGE_SIZE,
LMB_ALLOC_ANYWHERE, flags);
if (!addr)
return EFI_OUT_OF_RESOURCES;
break;
case EFI_ALLOCATE_MAX_ADDRESS:
/* Max address */
addr = (u64)lmb_alloc_base_flags(len, EFI_PAGE_SIZE, *memory,
addr = (u64)lmb_alloc_base(len, EFI_PAGE_SIZE, *memory,
flags);
if (!addr)
return EFI_OUT_OF_RESOURCES;

View File

@@ -729,24 +729,11 @@ static phys_addr_t _lmb_alloc_base(phys_size_t size, ulong align,
phys_addr_t lmb_alloc(phys_size_t size, ulong align)
{
return lmb_alloc_base(size, align, LMB_ALLOC_ANYWHERE);
return lmb_alloc_base(size, align, LMB_ALLOC_ANYWHERE, LMB_NONE);
}
phys_addr_t lmb_alloc_base(phys_size_t size, ulong align, phys_addr_t max_addr)
{
phys_addr_t alloc;
alloc = _lmb_alloc_base(size, align, max_addr, LMB_NONE);
if (alloc == 0)
printf("ERROR: Failed to allocate 0x%lx bytes below 0x%lx.\n",
(ulong)size, (ulong)max_addr);
return alloc;
}
phys_addr_t lmb_alloc_base_flags(phys_size_t size, ulong align,
phys_addr_t max_addr, uint flags)
phys_addr_t lmb_alloc_base(phys_size_t size, ulong align, phys_addr_t max_addr,
uint flags)
{
phys_addr_t alloc;