diff options
Diffstat (limited to 'arch/arm64/include/asm/efi.h')
-rw-r--r-- | arch/arm64/include/asm/efi.h | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h index a34fd3b12e2b..7baf2cc04e1e 100644 --- a/arch/arm64/include/asm/efi.h +++ b/arch/arm64/include/asm/efi.h | |||
@@ -6,29 +6,35 @@ | |||
6 | 6 | ||
7 | #ifdef CONFIG_EFI | 7 | #ifdef CONFIG_EFI |
8 | extern void efi_init(void); | 8 | extern void efi_init(void); |
9 | extern void efi_idmap_init(void); | 9 | extern void efi_virtmap_init(void); |
10 | #else | 10 | #else |
11 | #define efi_init() | 11 | #define efi_init() |
12 | #define efi_idmap_init() | 12 | #define efi_virtmap_init() |
13 | #endif | 13 | #endif |
14 | 14 | ||
15 | #define efi_call_virt(f, ...) \ | 15 | #define efi_call_virt(f, ...) \ |
16 | ({ \ | 16 | ({ \ |
17 | efi_##f##_t *__f = efi.systab->runtime->f; \ | 17 | efi_##f##_t *__f; \ |
18 | efi_status_t __s; \ | 18 | efi_status_t __s; \ |
19 | \ | 19 | \ |
20 | kernel_neon_begin(); \ | 20 | kernel_neon_begin(); \ |
21 | efi_virtmap_load(); \ | ||
22 | __f = efi.systab->runtime->f; \ | ||
21 | __s = __f(__VA_ARGS__); \ | 23 | __s = __f(__VA_ARGS__); \ |
24 | efi_virtmap_unload(); \ | ||
22 | kernel_neon_end(); \ | 25 | kernel_neon_end(); \ |
23 | __s; \ | 26 | __s; \ |
24 | }) | 27 | }) |
25 | 28 | ||
26 | #define __efi_call_virt(f, ...) \ | 29 | #define __efi_call_virt(f, ...) \ |
27 | ({ \ | 30 | ({ \ |
28 | efi_##f##_t *__f = efi.systab->runtime->f; \ | 31 | efi_##f##_t *__f; \ |
29 | \ | 32 | \ |
30 | kernel_neon_begin(); \ | 33 | kernel_neon_begin(); \ |
34 | efi_virtmap_load(); \ | ||
35 | __f = efi.systab->runtime->f; \ | ||
31 | __f(__VA_ARGS__); \ | 36 | __f(__VA_ARGS__); \ |
37 | efi_virtmap_unload(); \ | ||
32 | kernel_neon_end(); \ | 38 | kernel_neon_end(); \ |
33 | }) | 39 | }) |
34 | 40 | ||
@@ -44,4 +50,28 @@ extern void efi_idmap_init(void); | |||
44 | 50 | ||
45 | #define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__) | 51 | #define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__) |
46 | 52 | ||
53 | #define EFI_ALLOC_ALIGN SZ_64K | ||
54 | |||
55 | /* | ||
56 | * On ARM systems, virtually remapped UEFI runtime services are set up in three | ||
57 | * distinct stages: | ||
58 | * - The stub retrieves the final version of the memory map from UEFI, populates | ||
59 | * the virt_addr fields and calls the SetVirtualAddressMap() [SVAM] runtime | ||
60 | * service to communicate the new mapping to the firmware (Note that the new | ||
61 | * mapping is not live at this time) | ||
62 | * - During early boot, the page tables are allocated and populated based on the | ||
63 | * virt_addr fields in the memory map, but only if all descriptors with the | ||
64 | * EFI_MEMORY_RUNTIME attribute have a non-zero value for virt_addr. If this | ||
65 | * succeeds, the EFI_VIRTMAP flag is set to indicate that the virtual mappings | ||
66 | * have been installed successfully. | ||
67 | * - During an early initcall(), the UEFI Runtime Services are enabled and the | ||
68 | * EFI_RUNTIME_SERVICES bit set if some conditions are met, i.e., we need a | ||
69 | * non-early mapping of the UEFI system table, and we need to have the virtmap | ||
70 | * installed. | ||
71 | */ | ||
72 | #define EFI_VIRTMAP EFI_ARCH_1 | ||
73 | |||
74 | void efi_virtmap_load(void); | ||
75 | void efi_virtmap_unload(void); | ||
76 | |||
47 | #endif /* _ASM_EFI_H */ | 77 | #endif /* _ASM_EFI_H */ |