aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/efi.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/include/asm/efi.h')
-rw-r--r--arch/x86/include/asm/efi.h29
1 files changed, 17 insertions, 12 deletions
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index d0bb76d81402..389d700b961e 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -117,7 +117,6 @@ extern int __init efi_memblock_x86_reserve_range(void);
117extern pgd_t * __init efi_call_phys_prolog(void); 117extern pgd_t * __init efi_call_phys_prolog(void);
118extern void __init efi_call_phys_epilog(pgd_t *save_pgd); 118extern void __init efi_call_phys_epilog(pgd_t *save_pgd);
119extern void __init efi_print_memmap(void); 119extern void __init efi_print_memmap(void);
120extern void __init efi_unmap_memmap(void);
121extern void __init efi_memory_uc(u64 addr, unsigned long size); 120extern void __init efi_memory_uc(u64 addr, unsigned long size);
122extern void __init efi_map_region(efi_memory_desc_t *md); 121extern void __init efi_map_region(efi_memory_desc_t *md);
123extern void __init efi_map_region_fixed(efi_memory_desc_t *md); 122extern void __init efi_map_region_fixed(efi_memory_desc_t *md);
@@ -192,14 +191,7 @@ static inline efi_status_t efi_thunk_set_virtual_address_map(
192struct efi_config { 191struct efi_config {
193 u64 image_handle; 192 u64 image_handle;
194 u64 table; 193 u64 table;
195 u64 allocate_pool; 194 u64 boot_services;
196 u64 allocate_pages;
197 u64 get_memory_map;
198 u64 free_pool;
199 u64 free_pages;
200 u64 locate_handle;
201 u64 handle_protocol;
202 u64 exit_boot_services;
203 u64 text_output; 195 u64 text_output;
204 efi_status_t (*call)(unsigned long, ...); 196 efi_status_t (*call)(unsigned long, ...);
205 bool is64; 197 bool is64;
@@ -207,14 +199,27 @@ struct efi_config {
207 199
208__pure const struct efi_config *__efi_early(void); 200__pure const struct efi_config *__efi_early(void);
209 201
202static inline bool efi_is_64bit(void)
203{
204 if (!IS_ENABLED(CONFIG_X86_64))
205 return false;
206
207 if (!IS_ENABLED(CONFIG_EFI_MIXED))
208 return true;
209
210 return __efi_early()->is64;
211}
212
210#define efi_call_early(f, ...) \ 213#define efi_call_early(f, ...) \
211 __efi_early()->call(__efi_early()->f, __VA_ARGS__); 214 __efi_early()->call(efi_is_64bit() ? \
215 ((efi_boot_services_64_t *)(unsigned long) \
216 __efi_early()->boot_services)->f : \
217 ((efi_boot_services_32_t *)(unsigned long) \
218 __efi_early()->boot_services)->f, __VA_ARGS__)
212 219
213#define __efi_call_early(f, ...) \ 220#define __efi_call_early(f, ...) \
214 __efi_early()->call((unsigned long)f, __VA_ARGS__); 221 __efi_early()->call((unsigned long)f, __VA_ARGS__);
215 222
216#define efi_is_64bit() __efi_early()->is64
217
218extern bool efi_reboot_required(void); 223extern bool efi_reboot_required(void);
219 224
220#else 225#else