1#ifndef _ASM_EFI_H
2#define _ASM_EFI_H
3
4#include <asm/boot.h>
5#include <asm/cpufeature.h>
6#include <asm/io.h>
7#include <asm/mmu_context.h>
8#include <asm/neon.h>
9#include <asm/ptrace.h>
10#include <asm/tlbflush.h>
11
12#ifdef CONFIG_EFI
13extern void efi_init(void);
14#else
15#define efi_init()
16#endif
17
18int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);
19int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md);
20
21#define arch_efi_call_virt_setup() \
22({ \
23 kernel_neon_begin(); \
24 efi_virtmap_load(); \
25})
26
27#define arch_efi_call_virt(p, f, args...) \
28({ \
29 efi_##f##_t *__f; \
30 __f = p->f; \
31 __f(args); \
32})
33
34#define arch_efi_call_virt_teardown() \
35({ \
36 efi_virtmap_unload(); \
37 kernel_neon_end(); \
38})
39
40#define ARCH_EFI_IRQ_FLAGS_MASK (PSR_D_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT)
41
42
43
44
45
46
47
48
49#define EFI_FDT_ALIGN SZ_2M
50
51
52static inline unsigned long efi_get_max_fdt_addr(unsigned long dram_base)
53{
54 return ULONG_MAX;
55}
56
57
58
59
60
61
62
63
64
65
66
67static inline unsigned long efi_get_max_initrd_addr(unsigned long dram_base,
68 unsigned long image_addr)
69{
70 return (image_addr & ~(SZ_1G - 1UL)) + (1UL << (VA_BITS - 1));
71}
72
73#define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__)
74#define __efi_call_early(f, ...) f(__VA_ARGS__)
75#define efi_call_runtime(f, ...) sys_table_arg->runtime->f(__VA_ARGS__)
76#define efi_is_64bit() (true)
77
78#define efi_call_proto(protocol, f, instance, ...) \
79 ((protocol##_t *)instance)->f(instance, ##__VA_ARGS__)
80
81#define alloc_screen_info(x...) &screen_info
82#define free_screen_info(x...)
83
84static inline void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
85{
86}
87
88#define EFI_ALLOC_ALIGN SZ_64K
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103static inline void efi_set_pgd(struct mm_struct *mm)
104{
105 __switch_mm(mm);
106
107 if (system_uses_ttbr0_pan()) {
108 if (mm != current->active_mm) {
109
110
111
112
113
114
115 update_saved_ttbr0(current, mm);
116 cpu_switch_mm(mm->pgd, mm);
117 } else {
118
119
120
121
122
123
124 cpu_set_reserved_ttbr0();
125 if (current->active_mm != &init_mm)
126 update_saved_ttbr0(current, current->active_mm);
127 }
128 }
129}
130
131void efi_virtmap_load(void);
132void efi_virtmap_unload(void);
133
134#endif
135