summaryrefslogtreecommitdiff
path: root/drivers/firmware/efi/libstub/x86-stub.c
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2020-02-10 17:02:45 +0100
committerArd Biesheuvel <ardb@kernel.org>2020-02-23 21:57:15 +0100
commit31f5e546655b502d508e160e6cab20462089e34d (patch)
treed90afb183c6f355c3a8d9d5ed278acc878901ccf /drivers/firmware/efi/libstub/x86-stub.c
parent9302c1bb8e475829330146423626c3d32e8cb012 (diff)
efi/libstub: Take soft and hard memory limits into account for initrd loading
On x86, the preferred load address of the initrd is still below 4 GB, even though in some cases, we can cope with an initrd that is loaded above that. To simplify the code, and to make it more straightforward to introduce other ways to load the initrd, pass the soft and hard memory limits at the same time, and let the code handling the initrd= command line option deal with this. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'drivers/firmware/efi/libstub/x86-stub.c')
-rw-r--r--drivers/firmware/efi/libstub/x86-stub.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
index 39d04735f1c5..52a1a2df2071 100644
--- a/drivers/firmware/efi/libstub/x86-stub.c
+++ b/drivers/firmware/efi/libstub/x86-stub.c
@@ -422,15 +422,8 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
goto fail2;
status = efi_load_initrd(image, &ramdisk_addr, &ramdisk_size,
- hdr->initrd_addr_max);
-
- if (status != EFI_SUCCESS &&
- hdr->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G) {
- efi_printk("Trying to load files to higher address\n");
- status = efi_load_initrd(image, &ramdisk_addr, &ramdisk_size,
- ULONG_MAX);
- }
-
+ hdr->initrd_addr_max,
+ above4g ? ULONG_MAX : hdr->initrd_addr_max);
if (status != EFI_SUCCESS)
goto fail2;
hdr->ramdisk_image = ramdisk_addr & 0xffffffff;