diff mbox series

efi: Add mixed-mode thunk recipe for GetMemoryAttributes

Message ID 20230210142114.1861621-1-ardb@kernel.org
State Accepted
Commit 45d5165426ae3ceb35e2c35ad675e7dacd2aa59e
Headers show
Series efi: Add mixed-mode thunk recipe for GetMemoryAttributes | expand

Commit Message

Ard Biesheuvel Feb. 10, 2023, 2:21 p.m. UTC
EFI mixed mode on x86 requires a recipe for each protocol method or
firmware service that takes u64 arguments by value, or returns pointer
or 'native int' (UINTN) values by reference (e.g,, through a void ** or
unsigned long * parameter), due to the fact that these types cannot be
translated 1:1 between the i386 and MS x64 calling conventions.

So add the missing recipe for GetMemoryAttributes, which is not actually
being used yet on x86, but the code exists and can be built for x86 so
let's make sure it works as it should.

Cc: Evgeniy Baskov <baskov@ispras.ru>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 arch/x86/include/asm/efi.h | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 9f8ded3de0381973..419280d263d2e3f2 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -338,6 +338,9 @@  static inline u32 efi64_convert_status(efi_status_t status)
 	((prot), efi64_zero_upper(file))
 
 /* Memory Attribute Protocol */
+#define __efi64_argmap_get_memory_attributes(protocol, phys, size, flags) \
+	((protocol), __efi64_split(phys), __efi64_split(size), (flags))
+
 #define __efi64_argmap_set_memory_attributes(protocol, phys, size, flags) \
 	((protocol), __efi64_split(phys), __efi64_split(size), __efi64_split(flags))