diff options
author | Ingo Molnar <mingo@kernel.org> | 2020-05-25 15:10:37 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2020-05-25 15:10:37 +0200 |
commit | a5d8e55b2c7d3d18d7837af0ef8d1477eeeb919c (patch) | |
tree | fe07d3af2f6f13d005da832fe3d18d5d257fb9bd /drivers/firmware/efi/libstub/x86-stub.c | |
parent | efi/libstub: Re-enable command line initrd loading for x86 (diff) | |
parent | Linux 5.7-rc7 (diff) | |
download | linux-a5d8e55b2c7d3d18d7837af0ef8d1477eeeb919c.tar.xz linux-a5d8e55b2c7d3d18d7837af0ef8d1477eeeb919c.zip |
Merge tag 'v5.7-rc7' into efi/core, to refresh the branch and pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/firmware/efi/libstub/x86-stub.c')
-rw-r--r-- | drivers/firmware/efi/libstub/x86-stub.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c index 597793fe8d22..fbf4c976ba18 100644 --- a/drivers/firmware/efi/libstub/x86-stub.c +++ b/drivers/firmware/efi/libstub/x86-stub.c @@ -593,24 +593,18 @@ static efi_status_t allocate_e820(struct boot_params *params, struct setup_data **e820ext, u32 *e820ext_size) { - unsigned long map_size, desc_size, buff_size; - struct efi_boot_memmap boot_map; - efi_memory_desc_t *map; + unsigned long map_size, desc_size, map_key; efi_status_t status; - __u32 nr_desc; + __u32 nr_desc, desc_version; - boot_map.map = ↦ - boot_map.map_size = &map_size; - boot_map.desc_size = &desc_size; - boot_map.desc_ver = NULL; - boot_map.key_ptr = NULL; - boot_map.buff_size = &buff_size; + /* Only need the size of the mem map and size of each mem descriptor */ + map_size = 0; + status = efi_bs_call(get_memory_map, &map_size, NULL, &map_key, + &desc_size, &desc_version); + if (status != EFI_BUFFER_TOO_SMALL) + return (status != EFI_SUCCESS) ? status : EFI_UNSUPPORTED; - status = efi_get_memory_map(&boot_map); - if (status != EFI_SUCCESS) - return status; - - nr_desc = buff_size / desc_size; + nr_desc = map_size / desc_size + EFI_MMAP_NR_SLACK_SLOTS; if (nr_desc > ARRAY_SIZE(params->e820_table)) { u32 nr_e820ext = nr_desc - ARRAY_SIZE(params->e820_table); |