summaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_boottime.c
diff options
context:
space:
mode:
authorStefan Brüns <stefan.bruens@rwth-aachen.de>2016-10-09 22:17:26 +0200
committerAlexander Graf <agraf@suse.de>2016-10-18 09:08:07 +0200
commit42417bc84d1d56f739d43d562773d4821cf1bf47 (patch)
tree52b540b625324c1f11b59d8f6a1803c1a0902fd1 /lib/efi_loader/efi_boottime.c
parentead1274b7f9578e346b3cdcb3d9e2002ef8f0e75 (diff)
efi_loader: Track size of pool allocations to allow freeing
We need a functional free_pool implementation, as otherwise each allocate_pool causes growth of the memory descriptor table. Different to free_pages, free_pool does not provide the size for the to be freed allocation, thus we have to track the size ourselves. As the only EFI requirement for pool allocation is an alignment of 8 bytes, we can keep allocating a range using the page allocator, reserve the first 8 bytes for our bookkeeping and hand out the remainder to the caller. This saves us from having to use any independent data structures for tracking. To simplify the conversion between pool allocations and the corresponding page allocation, we create an auxiliary struct efi_pool_allocation. Given the allocation size free_pool size can handoff freeing the page range, which was indirectly allocated by a call to allocate_pool, to free_pages. 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>
Diffstat (limited to 'lib/efi_loader/efi_boottime.c')
-rw-r--r--lib/efi_loader/efi_boottime.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 05b93e87bf..6c8d93b261 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -141,12 +141,12 @@ static efi_status_t EFIAPI efi_allocate_pool_ext(int pool_type,
return EFI_EXIT(r);
}
-static efi_status_t EFIAPI efi_free_pool(void *buffer)
+static efi_status_t EFIAPI efi_free_pool_ext(void *buffer)
{
efi_status_t r;
EFI_ENTRY("%p", buffer);
- r = efi_free_pages((ulong)buffer, 0);
+ r = efi_free_pool(buffer);
return EFI_EXIT(r);
}
@@ -736,7 +736,7 @@ static const struct efi_boot_services efi_boot_services = {
.free_pages = efi_free_pages_ext,
.get_memory_map = efi_get_memory_map_ext,
.allocate_pool = efi_allocate_pool_ext,
- .free_pool = efi_free_pool,
+ .free_pool = efi_free_pool_ext,
.create_event = efi_create_event,
.set_timer = efi_set_timer,
.wait_for_event = efi_wait_for_event,