Skip to content

Commit 22090f8

Browse files
committed
efi/libstub: unify EFI call wrappers for non-x86
We have wrappers around EFI calls so that x86 can define special versions for mixed mode, while all other architectures can use the same simple definition that just issues the call directly. In preparation for the arrival of yet another architecture that doesn't need anything special here (RISC-V), let's move the default definition into a shared header. Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent cf6b836 commit 22090f8

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

arch/arm/include/asm/efi.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,6 @@ void efi_virtmap_unload(void);
5050

5151
/* arch specific definitions used by the stub code */
5252

53-
#define efi_bs_call(func, ...) efi_system_table()->boottime->func(__VA_ARGS__)
54-
#define efi_rt_call(func, ...) efi_system_table()->runtime->func(__VA_ARGS__)
55-
#define efi_is_native() (true)
56-
57-
#define efi_table_attr(inst, attr) (inst->attr)
58-
59-
#define efi_call_proto(inst, func, ...) inst->func(inst, ##__VA_ARGS__)
60-
6153
struct screen_info *alloc_screen_info(void);
6254
void free_screen_info(struct screen_info *si);
6355

arch/arm64/include/asm/efi.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,6 @@ static inline unsigned long efi_get_max_initrd_addr(unsigned long dram_base,
8686
return (image_addr & ~(SZ_1G - 1UL)) + (1UL << (VA_BITS_MIN - 1));
8787
}
8888

89-
#define efi_bs_call(func, ...) efi_system_table()->boottime->func(__VA_ARGS__)
90-
#define efi_rt_call(func, ...) efi_system_table()->runtime->func(__VA_ARGS__)
91-
#define efi_is_native() (true)
92-
93-
#define efi_table_attr(inst, attr) (inst->attr)
94-
95-
#define efi_call_proto(inst, func, ...) inst->func(inst, ##__VA_ARGS__)
96-
9789
#define alloc_screen_info(x...) &screen_info
9890

9991
static inline void free_screen_info(struct screen_info *si)

drivers/firmware/efi/libstub/efistub.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ extern bool __pure novamap(void);
3939

4040
extern __pure efi_system_table_t *efi_system_table(void);
4141

42+
#ifndef efi_bs_call
43+
#define efi_bs_call(func, ...) efi_system_table()->boottime->func(__VA_ARGS__)
44+
#endif
45+
#ifndef efi_rt_call
46+
#define efi_rt_call(func, ...) efi_system_table()->runtime->func(__VA_ARGS__)
47+
#endif
48+
#ifndef efi_is_native
49+
#define efi_is_native() (true)
50+
#endif
51+
#ifndef efi_table_attr
52+
#define efi_table_attr(inst, attr) (inst->attr)
53+
#endif
54+
#ifndef efi_call_proto
55+
#define efi_call_proto(inst, func, ...) inst->func(inst, ##__VA_ARGS__)
56+
#endif
57+
4258
#define pr_efi(msg) do { \
4359
if (!is_quiet()) efi_printk("EFI stub: "msg); \
4460
} while (0)

0 commit comments

Comments
 (0)