1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 08:42:12 +02:00

efi_loader: Move efi_allocate_pool implementation to efi_memory.c

We currently handle efi_allocate_pool() in our boot time service
file. In the following patch, pool allocation will receive additional
internal semantics that we should preserve inside efi_memory.c instead.

As foundation for those changes, split the function into an externally
facing efi_allocate_pool_ext() for use by payloads and an internal helper
efi_allocate_pool() in efi_memory.c that handles the actual allocation.

While at it, change the magic 0xfff / 12 constants to the more obvious
EFI_PAGE_MASK/SHIFT defines.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
Stefan Brüns
2016-10-09 22:17:18 +02:00
committed by Alexander Graf
parent 991d62fa73
commit ead1274b7f
3 changed files with 22 additions and 6 deletions

View File

@@ -327,6 +327,20 @@ efi_status_t efi_free_pages(uint64_t memory, unsigned long pages)
return EFI_SUCCESS;
}
efi_status_t efi_allocate_pool(int pool_type, unsigned long size,
void **buffer)
{
efi_status_t r;
efi_physical_addr_t t;
u64 num_pages = (size + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT;
r = efi_allocate_pages(0, pool_type, num_pages, &t);
if (r == EFI_SUCCESS)
*buffer = (void *)(uintptr_t)t;
return r;
}
efi_status_t efi_get_memory_map(unsigned long *memory_map_size,
struct efi_mem_desc *memory_map,
unsigned long *map_key,