summaryrefslogtreecommitdiff
path: root/drivers/firmware/efi/libstub/efi-stub-helper.c
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2020-02-10 19:02:35 +0300
committerArd Biesheuvel <ardb@kernel.org>2020-02-23 23:57:15 +0300
commita7495c28c86ab3b31508c5754bc5fb717ab1169c (patch)
tree3cbd64c9e1231d595d656d95c051fbd65ec56b12 /drivers/firmware/efi/libstub/efi-stub-helper.c
parentf57db62c67c1c9d3bf94563d3228ceff456f5be7 (diff)
downloadlinux-a7495c28c86ab3b31508c5754bc5fb717ab1169c.tar.xz
efi/libstub: Simplify efi_high_alloc() and rename to efi_allocate_pages()
The implementation of efi_high_alloc() uses a complicated way of traversing the memory map to find an available region that is located as close as possible to the provided upper limit, and calls AllocatePages subsequently to create the allocation at that exact address. This is precisely what the EFI_ALLOCATE_MAX_ADDRESS allocation type argument to AllocatePages() does, and considering that EFI_ALLOC_ALIGN only exceeds EFI_PAGE_SIZE on arm64, let's use AllocatePages() directly and implement the alignment using code that the compiler can remove if it does not exceed EFI_PAGE_SIZE. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'drivers/firmware/efi/libstub/efi-stub-helper.c')
-rw-r--r--drivers/firmware/efi/libstub/efi-stub-helper.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c
index 60d13c7a2e92..7afe31357df3 100644
--- a/drivers/firmware/efi/libstub/efi-stub-helper.c
+++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
@@ -385,8 +385,7 @@ efi_status_t handle_cmdline_files(efi_loaded_image_t *image,
* so allocate enough memory for all the files. This is used
* for loading multiple files.
*/
- status = efi_high_alloc(file_size_total, 0x1000, &file_addr,
- max_addr);
+ status = efi_allocate_pages(file_size_total, &file_addr, max_addr);
if (status != EFI_SUCCESS) {
pr_efi_err("Failed to alloc highmem for files\n");
goto close_handles;
@@ -536,7 +535,7 @@ char *efi_convert_cmdline(efi_loaded_image_t *image,
options_bytes++; /* NUL termination */
- status = efi_high_alloc(options_bytes, 0, &cmdline_addr,
+ status = efi_allocate_pages(options_bytes, &cmdline_addr,
MAX_CMDLINE_ADDRESS);
if (status != EFI_SUCCESS)
return NULL;