aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware/efi/efi-stub-helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firmware/efi/efi-stub-helper.c')
-rw-r--r--drivers/firmware/efi/efi-stub-helper.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/firmware/efi/efi-stub-helper.c b/drivers/firmware/efi/efi-stub-helper.c
index 2f528fb541f9..a25675833598 100644
--- a/drivers/firmware/efi/efi-stub-helper.c
+++ b/drivers/firmware/efi/efi-stub-helper.c
@@ -101,6 +101,14 @@ static efi_status_t efi_high_alloc(efi_system_table_t *sys_table_arg,
101 if (status != EFI_SUCCESS) 101 if (status != EFI_SUCCESS)
102 goto fail; 102 goto fail;
103 103
104 /*
105 * Enforce minimum alignment that EFI requires when requesting
106 * a specific address. We are doing page-based allocations,
107 * so we must be aligned to a page.
108 */
109 if (align < EFI_PAGE_SIZE)
110 align = EFI_PAGE_SIZE;
111
104 nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE; 112 nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
105again: 113again:
106 for (i = 0; i < map_size / desc_size; i++) { 114 for (i = 0; i < map_size / desc_size; i++) {
@@ -179,6 +187,14 @@ static efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg,
179 if (status != EFI_SUCCESS) 187 if (status != EFI_SUCCESS)
180 goto fail; 188 goto fail;
181 189
190 /*
191 * Enforce minimum alignment that EFI requires when requesting
192 * a specific address. We are doing page-based allocations,
193 * so we must be aligned to a page.
194 */
195 if (align < EFI_PAGE_SIZE)
196 align = EFI_PAGE_SIZE;
197
182 nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE; 198 nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
183 for (i = 0; i < map_size / desc_size; i++) { 199 for (i = 0; i < map_size / desc_size; i++) {
184 efi_memory_desc_t *desc; 200 efi_memory_desc_t *desc;