aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Franz <roy.franz@linaro.org>2013-09-22 18:45:37 -0400
committerMatt Fleming <matt.fleming@intel.com>2013-09-25 07:34:41 -0400
commitae8e9060a3ecfd22bd5059e39f81547613ae376c (patch)
tree02917afa6c64b5d1af31743265036e8a7280be9a
parent1c089c65f54b70261fdcb4c238986a979c11fad7 (diff)
efi: use efi_get_memory_map() to get final map for x86
Replace the open-coded memory map getting with the efi_get_memory_map() that is now general enough to use. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r--arch/x86/boot/compressed/eboot.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index 5e708c0d466f..bf2c35d5ec1f 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -527,25 +527,12 @@ static efi_status_t exit_boot(struct boot_params *boot_params,
527 u8 nr_entries; 527 u8 nr_entries;
528 int i; 528 int i;
529 529
530 size = sizeof(*mem_map) * 32;
531
532again:
533 size += sizeof(*mem_map) * 2;
534 _size = size;
535 status = efi_low_alloc(sys_table, size, 1, (unsigned long *)&mem_map);
536 if (status != EFI_SUCCESS)
537 return status;
538
539get_map: 530get_map:
540 status = efi_call_phys5(sys_table->boottime->get_memory_map, &size, 531 status = efi_get_memory_map(sys_table, &mem_map, &size, &desc_size,
541 mem_map, &key, &desc_size, &desc_version); 532 &desc_version, &key);
542 if (status == EFI_BUFFER_TOO_SMALL) {
543 efi_free(sys_table, _size, (unsigned long)mem_map);
544 goto again;
545 }
546 533
547 if (status != EFI_SUCCESS) 534 if (status != EFI_SUCCESS)
548 goto free_mem_map; 535 return status;
549 536
550 memcpy(&efi->efi_loader_signature, EFI_LOADER_SIGNATURE, sizeof(__u32)); 537 memcpy(&efi->efi_loader_signature, EFI_LOADER_SIGNATURE, sizeof(__u32));
551 efi->efi_systab = (unsigned long)sys_table; 538 efi->efi_systab = (unsigned long)sys_table;
@@ -574,6 +561,7 @@ get_map:
574 goto free_mem_map; 561 goto free_mem_map;
575 562
576 called_exit = true; 563 called_exit = true;
564 efi_call_phys1(sys_table->boottime->free_pool, mem_map);
577 goto get_map; 565 goto get_map;
578 } 566 }
579 567
@@ -642,7 +630,7 @@ get_map:
642 return EFI_SUCCESS; 630 return EFI_SUCCESS;
643 631
644free_mem_map: 632free_mem_map:
645 efi_free(sys_table, _size, (unsigned long)mem_map); 633 efi_call_phys1(sys_table->boottime->free_pool, mem_map);
646 return status; 634 return status;
647} 635}
648 636