Commit ae8e9060 authored by Roy Franz's avatar Roy Franz Committed by Matt Fleming

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: default avatarRoy Franz <roy.franz@linaro.org>
Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
parent 1c089c65
...@@ -527,25 +527,12 @@ static efi_status_t exit_boot(struct boot_params *boot_params, ...@@ -527,25 +527,12 @@ static efi_status_t exit_boot(struct boot_params *boot_params,
u8 nr_entries; u8 nr_entries;
int i; int i;
size = sizeof(*mem_map) * 32;
again:
size += sizeof(*mem_map) * 2;
_size = size;
status = efi_low_alloc(sys_table, size, 1, (unsigned long *)&mem_map);
if (status != EFI_SUCCESS)
return status;
get_map: get_map:
status = efi_call_phys5(sys_table->boottime->get_memory_map, &size, status = efi_get_memory_map(sys_table, &mem_map, &size, &desc_size,
mem_map, &key, &desc_size, &desc_version); &desc_version, &key);
if (status == EFI_BUFFER_TOO_SMALL) {
efi_free(sys_table, _size, (unsigned long)mem_map);
goto again;
}
if (status != EFI_SUCCESS) if (status != EFI_SUCCESS)
goto free_mem_map; return status;
memcpy(&efi->efi_loader_signature, EFI_LOADER_SIGNATURE, sizeof(__u32)); memcpy(&efi->efi_loader_signature, EFI_LOADER_SIGNATURE, sizeof(__u32));
efi->efi_systab = (unsigned long)sys_table; efi->efi_systab = (unsigned long)sys_table;
...@@ -574,6 +561,7 @@ static efi_status_t exit_boot(struct boot_params *boot_params, ...@@ -574,6 +561,7 @@ static efi_status_t exit_boot(struct boot_params *boot_params,
goto free_mem_map; goto free_mem_map;
called_exit = true; called_exit = true;
efi_call_phys1(sys_table->boottime->free_pool, mem_map);
goto get_map; goto get_map;
} }
...@@ -642,7 +630,7 @@ static efi_status_t exit_boot(struct boot_params *boot_params, ...@@ -642,7 +630,7 @@ static efi_status_t exit_boot(struct boot_params *boot_params,
return EFI_SUCCESS; return EFI_SUCCESS;
free_mem_map: free_mem_map:
efi_free(sys_table, _size, (unsigned long)mem_map); efi_call_phys1(sys_table->boottime->free_pool, mem_map);
return status; return status;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment