aboutsummaryrefslogtreecommitdiff
path: root/drivers/firmware
diff options
context:
space:
mode:
authorGravatar Arvind Sankar <nivedita@alum.mit.edu> 2020-01-03 12:39:49 +0100
committerGravatar Ingo Molnar <mingo@kernel.org> 2020-01-10 18:55:04 +0100
commitea7d87f98fa9675076fb5ad208d889b217e83889 (patch)
tree77ee2f45103441c18fa5a7e1a60ccbda44936548 /drivers/firmware
parentefi/x86: Check number of arguments to variadic functions (diff)
downloadlinux-ea7d87f98fa9675076fb5ad208d889b217e83889.tar.gz
linux-ea7d87f98fa9675076fb5ad208d889b217e83889.tar.bz2
linux-ea7d87f98fa9675076fb5ad208d889b217e83889.zip
efi/x86: Allow translating 64-bit arguments for mixed mode calls
Introduce the ability to define macros to perform argument translation for the calls that need it, and define them for the boot services that we currently use. When calling 32-bit firmware methods in mixed mode, all output parameters that are 32-bit according to the firmware, but 64-bit in the kernel (ie OUT UINTN * or OUT VOID **) must be initialized in the kernel, or the upper 32 bits may contain garbage. Define macros that zero out the upper 32 bits of the output before invoking the firmware method. When a 32-bit EFI call takes 64-bit arguments, the mixed-mode call must push the two 32-bit halves as separate arguments onto the stack. This can be achieved by splitting the argument into its two halves when calling the assembler thunk. Define a macro to do this for the free_pages boot service. Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu> Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Matthew Garrett <mjg59@google.com> Cc: linux-efi@vger.kernel.org Link: https://lkml.kernel.org/r/20200103113953.9571-17-ardb@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/efi/libstub/efi-stub-helper.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c
index f1b9c36934e9..fcc45ee94e02 100644
--- a/drivers/firmware/efi/libstub/efi-stub-helper.c
+++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
@@ -344,9 +344,6 @@ fail:
}
void efi_free(unsigned long size, unsigned long addr)
- __weak __alias(efi_free_native);
-
-void efi_free_native(unsigned long size, unsigned long addr)
{
unsigned long nr_pages;
@@ -354,7 +351,7 @@ void efi_free_native(unsigned long size, unsigned long addr)
return;
nr_pages = round_up(size, EFI_ALLOC_ALIGN) / EFI_PAGE_SIZE;
- efi_system_table()->boottime->free_pages(addr, nr_pages);
+ efi_bs_call(free_pages, addr, nr_pages);
}
static efi_status_t efi_file_size(void *__fh, efi_char16_t *filename_16,