diff options
Diffstat (limited to 'arch/x86/include/asm/efi.h')
-rw-r--r-- | arch/x86/include/asm/efi.h | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index 53748c45e488..78d1e7467eae 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <asm/fpu/api.h> | 4 | #include <asm/fpu/api.h> |
5 | #include <asm/pgtable.h> | 5 | #include <asm/pgtable.h> |
6 | #include <asm/processor-flags.h> | ||
6 | #include <asm/tlb.h> | 7 | #include <asm/tlb.h> |
7 | 8 | ||
8 | /* | 9 | /* |
@@ -28,33 +29,22 @@ | |||
28 | 29 | ||
29 | #define MAX_CMDLINE_ADDRESS UINT_MAX | 30 | #define MAX_CMDLINE_ADDRESS UINT_MAX |
30 | 31 | ||
31 | #ifdef CONFIG_X86_32 | 32 | #define ARCH_EFI_IRQ_FLAGS_MASK X86_EFLAGS_IF |
32 | 33 | ||
34 | #ifdef CONFIG_X86_32 | ||
33 | 35 | ||
34 | extern unsigned long asmlinkage efi_call_phys(void *, ...); | 36 | extern unsigned long asmlinkage efi_call_phys(void *, ...); |
35 | 37 | ||
38 | #define arch_efi_call_virt_setup() kernel_fpu_begin() | ||
39 | #define arch_efi_call_virt_teardown() kernel_fpu_end() | ||
40 | |||
36 | /* | 41 | /* |
37 | * Wrap all the virtual calls in a way that forces the parameters on the stack. | 42 | * Wrap all the virtual calls in a way that forces the parameters on the stack. |
38 | */ | 43 | */ |
39 | 44 | #define arch_efi_call_virt(f, args...) \ | |
40 | /* Use this macro if your virtual returns a non-void value */ | ||
41 | #define efi_call_virt(f, args...) \ | ||
42 | ({ \ | 45 | ({ \ |
43 | efi_status_t __s; \ | ||
44 | kernel_fpu_begin(); \ | ||
45 | __s = ((efi_##f##_t __attribute__((regparm(0)))*) \ | ||
46 | efi.systab->runtime->f)(args); \ | ||
47 | kernel_fpu_end(); \ | ||
48 | __s; \ | ||
49 | }) | ||
50 | |||
51 | /* Use this macro if your virtual call does not return any value */ | ||
52 | #define __efi_call_virt(f, args...) \ | ||
53 | ({ \ | ||
54 | kernel_fpu_begin(); \ | ||
55 | ((efi_##f##_t __attribute__((regparm(0)))*) \ | 46 | ((efi_##f##_t __attribute__((regparm(0)))*) \ |
56 | efi.systab->runtime->f)(args); \ | 47 | efi.systab->runtime->f)(args); \ |
57 | kernel_fpu_end(); \ | ||
58 | }) | 48 | }) |
59 | 49 | ||
60 | #define efi_ioremap(addr, size, type, attr) ioremap_cache(addr, size) | 50 | #define efi_ioremap(addr, size, type, attr) ioremap_cache(addr, size) |
@@ -78,10 +68,8 @@ struct efi_scratch { | |||
78 | u64 phys_stack; | 68 | u64 phys_stack; |
79 | } __packed; | 69 | } __packed; |
80 | 70 | ||
81 | #define efi_call_virt(f, ...) \ | 71 | #define arch_efi_call_virt_setup() \ |
82 | ({ \ | 72 | ({ \ |
83 | efi_status_t __s; \ | ||
84 | \ | ||
85 | efi_sync_low_kernel_mappings(); \ | 73 | efi_sync_low_kernel_mappings(); \ |
86 | preempt_disable(); \ | 74 | preempt_disable(); \ |
87 | __kernel_fpu_begin(); \ | 75 | __kernel_fpu_begin(); \ |
@@ -91,9 +79,13 @@ struct efi_scratch { | |||
91 | write_cr3((unsigned long)efi_scratch.efi_pgt); \ | 79 | write_cr3((unsigned long)efi_scratch.efi_pgt); \ |
92 | __flush_tlb_all(); \ | 80 | __flush_tlb_all(); \ |
93 | } \ | 81 | } \ |
94 | \ | 82 | }) |
95 | __s = efi_call((void *)efi.systab->runtime->f, __VA_ARGS__); \ | 83 | |
96 | \ | 84 | #define arch_efi_call_virt(f, args...) \ |
85 | efi_call((void *)efi.systab->runtime->f, args) \ | ||
86 | |||
87 | #define arch_efi_call_virt_teardown() \ | ||
88 | ({ \ | ||
97 | if (efi_scratch.use_pgd) { \ | 89 | if (efi_scratch.use_pgd) { \ |
98 | write_cr3(efi_scratch.prev_cr3); \ | 90 | write_cr3(efi_scratch.prev_cr3); \ |
99 | __flush_tlb_all(); \ | 91 | __flush_tlb_all(); \ |
@@ -101,15 +93,8 @@ struct efi_scratch { | |||
101 | \ | 93 | \ |
102 | __kernel_fpu_end(); \ | 94 | __kernel_fpu_end(); \ |
103 | preempt_enable(); \ | 95 | preempt_enable(); \ |
104 | __s; \ | ||
105 | }) | 96 | }) |
106 | 97 | ||
107 | /* | ||
108 | * All X86_64 virt calls return non-void values. Thus, use non-void call for | ||
109 | * virt calls that would be void on X86_32. | ||
110 | */ | ||
111 | #define __efi_call_virt(f, args...) efi_call_virt(f, args) | ||
112 | |||
113 | extern void __iomem *__init efi_ioremap(unsigned long addr, unsigned long size, | 98 | extern void __iomem *__init efi_ioremap(unsigned long addr, unsigned long size, |
114 | u32 type, u64 attribute); | 99 | u32 type, u64 attribute); |
115 | 100 | ||
@@ -180,6 +165,8 @@ static inline bool efi_runtime_supported(void) | |||
180 | extern struct console early_efi_console; | 165 | extern struct console early_efi_console; |
181 | extern void parse_efi_setup(u64 phys_addr, u32 data_len); | 166 | extern void parse_efi_setup(u64 phys_addr, u32 data_len); |
182 | 167 | ||
168 | extern void efifb_setup_from_dmi(struct screen_info *si, const char *opt); | ||
169 | |||
183 | #ifdef CONFIG_EFI_MIXED | 170 | #ifdef CONFIG_EFI_MIXED |
184 | extern void efi_thunk_runtime_setup(void); | 171 | extern void efi_thunk_runtime_setup(void); |
185 | extern efi_status_t efi_thunk_set_virtual_address_map( | 172 | extern efi_status_t efi_thunk_set_virtual_address_map( |
@@ -225,6 +212,11 @@ __pure const struct efi_config *__efi_early(void); | |||
225 | #define efi_call_early(f, ...) \ | 212 | #define efi_call_early(f, ...) \ |
226 | __efi_early()->call(__efi_early()->f, __VA_ARGS__); | 213 | __efi_early()->call(__efi_early()->f, __VA_ARGS__); |
227 | 214 | ||
215 | #define __efi_call_early(f, ...) \ | ||
216 | __efi_early()->call((unsigned long)f, __VA_ARGS__); | ||
217 | |||
218 | #define efi_is_64bit() __efi_early()->is64 | ||
219 | |||
228 | extern bool efi_reboot_required(void); | 220 | extern bool efi_reboot_required(void); |
229 | 221 | ||
230 | #else | 222 | #else |