mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-12 04:15:21 +02:00
x86/efistub: Revert to heap allocated boot_params for PE entrypoint
commitae835a96d7
upstream. This is a partial revert of commit8117961d98
("x86/efi: Disregard setup header of loaded image") which triggers boot issues on older Dell laptops. As it turns out, switching back to a heap allocation for the struct boot_params constructed by the EFI stub works around this, even though it is unclear why. Cc: Christian Heusel <christian@heusel.eu> Reported-by: <mavrix#kernel@simplelogin.com> Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c12db5aa54
commit
d849da88f7
|
@ -469,11 +469,12 @@ void __noreturn efi_stub_entry(efi_handle_t handle,
|
||||||
efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
|
efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
|
||||||
efi_system_table_t *sys_table_arg)
|
efi_system_table_t *sys_table_arg)
|
||||||
{
|
{
|
||||||
static struct boot_params boot_params __page_aligned_bss;
|
|
||||||
struct setup_header *hdr = &boot_params.hdr;
|
|
||||||
efi_guid_t proto = LOADED_IMAGE_PROTOCOL_GUID;
|
efi_guid_t proto = LOADED_IMAGE_PROTOCOL_GUID;
|
||||||
|
struct boot_params *boot_params;
|
||||||
|
struct setup_header *hdr;
|
||||||
int options_size = 0;
|
int options_size = 0;
|
||||||
efi_status_t status;
|
efi_status_t status;
|
||||||
|
unsigned long alloc;
|
||||||
char *cmdline_ptr;
|
char *cmdline_ptr;
|
||||||
|
|
||||||
if (efi_is_native())
|
if (efi_is_native())
|
||||||
|
@ -491,6 +492,13 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
|
||||||
efi_exit(handle, status);
|
efi_exit(handle, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
status = efi_allocate_pages(PARAM_SIZE, &alloc, ULONG_MAX);
|
||||||
|
if (status != EFI_SUCCESS)
|
||||||
|
efi_exit(handle, status);
|
||||||
|
|
||||||
|
boot_params = memset((void *)alloc, 0x0, PARAM_SIZE);
|
||||||
|
hdr = &boot_params->hdr;
|
||||||
|
|
||||||
/* Assign the setup_header fields that the kernel actually cares about */
|
/* Assign the setup_header fields that the kernel actually cares about */
|
||||||
hdr->root_flags = 1;
|
hdr->root_flags = 1;
|
||||||
hdr->vid_mode = 0xffff;
|
hdr->vid_mode = 0xffff;
|
||||||
|
@ -500,13 +508,15 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
|
||||||
|
|
||||||
/* Convert unicode cmdline to ascii */
|
/* Convert unicode cmdline to ascii */
|
||||||
cmdline_ptr = efi_convert_cmdline(image, &options_size);
|
cmdline_ptr = efi_convert_cmdline(image, &options_size);
|
||||||
if (!cmdline_ptr)
|
if (!cmdline_ptr) {
|
||||||
|
efi_free(PARAM_SIZE, alloc);
|
||||||
efi_exit(handle, EFI_OUT_OF_RESOURCES);
|
efi_exit(handle, EFI_OUT_OF_RESOURCES);
|
||||||
|
}
|
||||||
|
|
||||||
efi_set_u64_split((unsigned long)cmdline_ptr, &hdr->cmd_line_ptr,
|
efi_set_u64_split((unsigned long)cmdline_ptr, &hdr->cmd_line_ptr,
|
||||||
&boot_params.ext_cmd_line_ptr);
|
&boot_params->ext_cmd_line_ptr);
|
||||||
|
|
||||||
efi_stub_entry(handle, sys_table_arg, &boot_params);
|
efi_stub_entry(handle, sys_table_arg, boot_params);
|
||||||
/* not reached */
|
/* not reached */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user