aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/boot/compressed/eboot.c19
-rw-r--r--drivers/firmware/efi/efi-stub-helper.c14
2 files changed, 17 insertions, 16 deletions
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index 65b6a34f56d6..2a4430a0fb03 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -457,7 +457,8 @@ struct boot_params *make_boot_params(void *handle, efi_system_table_t *_table)
457 return NULL; 457 return NULL;
458 } 458 }
459 459
460 status = low_alloc(sys_table, 0x4000, 1, (unsigned long *)&boot_params); 460 status = efi_low_alloc(sys_table, 0x4000, 1,
461 (unsigned long *)&boot_params);
461 if (status != EFI_SUCCESS) { 462 if (status != EFI_SUCCESS) {
462 efi_printk(sys_table, "Failed to alloc lowmem for boot params\n"); 463 efi_printk(sys_table, "Failed to alloc lowmem for boot params\n");
463 return NULL; 464 return NULL;
@@ -503,7 +504,7 @@ struct boot_params *make_boot_params(void *handle, efi_system_table_t *_table)
503 504
504 options_size++; /* NUL termination */ 505 options_size++; /* NUL termination */
505 506
506 status = low_alloc(sys_table, options_size, 1, 507 status = efi_low_alloc(sys_table, options_size, 1,
507 &cmdline); 508 &cmdline);
508 if (status != EFI_SUCCESS) { 509 if (status != EFI_SUCCESS) {
509 efi_printk(sys_table, "Failed to alloc mem for cmdline\n"); 510 efi_printk(sys_table, "Failed to alloc mem for cmdline\n");
@@ -537,9 +538,9 @@ struct boot_params *make_boot_params(void *handle, efi_system_table_t *_table)
537 return boot_params; 538 return boot_params;
538fail2: 539fail2:
539 if (options_size) 540 if (options_size)
540 low_free(sys_table, options_size, hdr->cmd_line_ptr); 541 efi_free(sys_table, options_size, hdr->cmd_line_ptr);
541fail: 542fail:
542 low_free(sys_table, 0x4000, (unsigned long)boot_params); 543 efi_free(sys_table, 0x4000, (unsigned long)boot_params);
543 return NULL; 544 return NULL;
544} 545}
545 546
@@ -562,7 +563,7 @@ static efi_status_t exit_boot(struct boot_params *boot_params,
562again: 563again:
563 size += sizeof(*mem_map) * 2; 564 size += sizeof(*mem_map) * 2;
564 _size = size; 565 _size = size;
565 status = low_alloc(sys_table, size, 1, (unsigned long *)&mem_map); 566 status = efi_low_alloc(sys_table, size, 1, (unsigned long *)&mem_map);
566 if (status != EFI_SUCCESS) 567 if (status != EFI_SUCCESS)
567 return status; 568 return status;
568 569
@@ -570,7 +571,7 @@ get_map:
570 status = efi_call_phys5(sys_table->boottime->get_memory_map, &size, 571 status = efi_call_phys5(sys_table->boottime->get_memory_map, &size,
571 mem_map, &key, &desc_size, &desc_version); 572 mem_map, &key, &desc_size, &desc_version);
572 if (status == EFI_BUFFER_TOO_SMALL) { 573 if (status == EFI_BUFFER_TOO_SMALL) {
573 low_free(sys_table, _size, (unsigned long)mem_map); 574 efi_free(sys_table, _size, (unsigned long)mem_map);
574 goto again; 575 goto again;
575 } 576 }
576 577
@@ -672,7 +673,7 @@ get_map:
672 return EFI_SUCCESS; 673 return EFI_SUCCESS;
673 674
674free_mem_map: 675free_mem_map:
675 low_free(sys_table, _size, (unsigned long)mem_map); 676 efi_free(sys_table, _size, (unsigned long)mem_map);
676 return status; 677 return status;
677} 678}
678 679
@@ -695,7 +696,7 @@ static efi_status_t relocate_kernel(struct setup_header *hdr)
695 EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA, 696 EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA,
696 nr_pages, &start); 697 nr_pages, &start);
697 if (status != EFI_SUCCESS) { 698 if (status != EFI_SUCCESS) {
698 status = low_alloc(sys_table, hdr->init_size, 699 status = efi_low_alloc(sys_table, hdr->init_size,
699 hdr->kernel_alignment, &start); 700 hdr->kernel_alignment, &start);
700 if (status != EFI_SUCCESS) 701 if (status != EFI_SUCCESS)
701 efi_printk(sys_table, "Failed to alloc mem for kernel\n"); 702 efi_printk(sys_table, "Failed to alloc mem for kernel\n");
@@ -743,7 +744,7 @@ struct boot_params *efi_main(void *handle, efi_system_table_t *_table,
743 } 744 }
744 745
745 gdt->size = 0x800; 746 gdt->size = 0x800;
746 status = low_alloc(sys_table, gdt->size, 8, 747 status = efi_low_alloc(sys_table, gdt->size, 8,
747 (unsigned long *)&gdt->address); 748 (unsigned long *)&gdt->address);
748 if (status != EFI_SUCCESS) { 749 if (status != EFI_SUCCESS) {
749 efi_printk(sys_table, "Failed to alloc mem for gdt\n"); 750 efi_printk(sys_table, "Failed to alloc mem for gdt\n");
diff --git a/drivers/firmware/efi/efi-stub-helper.c b/drivers/firmware/efi/efi-stub-helper.c
index 05c539e9a3c8..2f528fb541f9 100644
--- a/drivers/firmware/efi/efi-stub-helper.c
+++ b/drivers/firmware/efi/efi-stub-helper.c
@@ -86,7 +86,7 @@ fail:
86/* 86/*
87 * Allocate at the highest possible address that is not above 'max'. 87 * Allocate at the highest possible address that is not above 'max'.
88 */ 88 */
89static efi_status_t high_alloc(efi_system_table_t *sys_table_arg, 89static efi_status_t efi_high_alloc(efi_system_table_t *sys_table_arg,
90 unsigned long size, unsigned long align, 90 unsigned long size, unsigned long align,
91 unsigned long *addr, unsigned long max) 91 unsigned long *addr, unsigned long max)
92{ 92{
@@ -165,8 +165,8 @@ fail:
165/* 165/*
166 * Allocate at the lowest possible address. 166 * Allocate at the lowest possible address.
167 */ 167 */
168static efi_status_t low_alloc(efi_system_table_t *sys_table_arg, 168static efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg,
169 unsigned long size, unsigned long align, 169 unsigned long size, unsigned long align,
170 unsigned long *addr) 170 unsigned long *addr)
171{ 171{
172 unsigned long map_size, desc_size; 172 unsigned long map_size, desc_size;
@@ -226,7 +226,7 @@ fail:
226 return status; 226 return status;
227} 227}
228 228
229static void low_free(efi_system_table_t *sys_table_arg, unsigned long size, 229static void efi_free(efi_system_table_t *sys_table_arg, unsigned long size,
230 unsigned long addr) 230 unsigned long addr)
231{ 231{
232 unsigned long nr_pages; 232 unsigned long nr_pages;
@@ -407,8 +407,8 @@ grow:
407 * addresses in memory, so allocate enough memory for 407 * addresses in memory, so allocate enough memory for
408 * all the initrd's. 408 * all the initrd's.
409 */ 409 */
410 status = high_alloc(sys_table_arg, initrd_total, 0x1000, 410 status = efi_high_alloc(sys_table_arg, initrd_total, 0x1000,
411 &initrd_addr, hdr->initrd_addr_max); 411 &initrd_addr, hdr->initrd_addr_max);
412 if (status != EFI_SUCCESS) { 412 if (status != EFI_SUCCESS) {
413 efi_printk(sys_table_arg, "Failed to alloc highmem for initrds\n"); 413 efi_printk(sys_table_arg, "Failed to alloc highmem for initrds\n");
414 goto close_handles; 414 goto close_handles;
@@ -456,7 +456,7 @@ grow:
456 return status; 456 return status;
457 457
458free_initrd_total: 458free_initrd_total:
459 low_free(sys_table_arg, initrd_total, initrd_addr); 459 efi_free(sys_table_arg, initrd_total, initrd_addr);
460 460
461close_handles: 461close_handles:
462 for (k = j; k < i; k++) 462 for (k = j; k < i; k++)