0001
0002 #ifndef _ASM_EFI_H
0003 #define _ASM_EFI_H
0004
0005 #include <asm/boot.h>
0006 #include <asm/cpufeature.h>
0007 #include <asm/fpsimd.h>
0008 #include <asm/io.h>
0009 #include <asm/memory.h>
0010 #include <asm/mmu_context.h>
0011 #include <asm/neon.h>
0012 #include <asm/ptrace.h>
0013 #include <asm/tlbflush.h>
0014
0015 #ifdef CONFIG_EFI
0016 extern void efi_init(void);
0017 #else
0018 #define efi_init()
0019 #endif
0020
0021 int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);
0022 int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md);
0023
0024 #define arch_efi_call_virt_setup() \
0025 ({ \
0026 efi_virtmap_load(); \
0027 __efi_fpsimd_begin(); \
0028 })
0029
0030 #undef arch_efi_call_virt
0031 #define arch_efi_call_virt(p, f, args...) \
0032 __efi_rt_asm_wrapper((p)->f, #f, args)
0033
0034 #define arch_efi_call_virt_teardown() \
0035 ({ \
0036 __efi_fpsimd_end(); \
0037 efi_virtmap_unload(); \
0038 })
0039
0040 efi_status_t __efi_rt_asm_wrapper(void *, const char *, ...);
0041
0042 #define ARCH_EFI_IRQ_FLAGS_MASK (PSR_D_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT)
0043
0044
0045
0046
0047
0048
0049 #define arch_efi_save_flags(state_flags) \
0050 ((void)((state_flags) = read_sysreg(daif)))
0051
0052 #define arch_efi_restore_flags(state_flags) write_sysreg(state_flags, daif)
0053
0054
0055
0056
0057
0058
0059
0060
0061 #define EFI_KIMG_ALIGN \
0062 (SEGMENT_ALIGN > THREAD_ALIGN ? SEGMENT_ALIGN : THREAD_ALIGN)
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074 static inline unsigned long efi_get_max_initrd_addr(unsigned long image_addr)
0075 {
0076 return (image_addr & ~(SZ_1G - 1UL)) + (1UL << (VA_BITS_MIN - 1));
0077 }
0078
0079 #define alloc_screen_info(x...) &screen_info
0080
0081 static inline void free_screen_info(struct screen_info *si)
0082 {
0083 }
0084
0085 #define EFI_ALLOC_ALIGN SZ_64K
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100 static inline void efi_set_pgd(struct mm_struct *mm)
0101 {
0102 __switch_mm(mm);
0103
0104 if (system_uses_ttbr0_pan()) {
0105 if (mm != current->active_mm) {
0106
0107
0108
0109
0110
0111
0112
0113 update_saved_ttbr0(current, mm);
0114 uaccess_ttbr0_enable();
0115 post_ttbr_update_workaround();
0116 } else {
0117
0118
0119
0120
0121
0122 uaccess_ttbr0_disable();
0123 update_saved_ttbr0(current, current->active_mm);
0124 }
0125 }
0126 }
0127
0128 void efi_virtmap_load(void);
0129 void efi_virtmap_unload(void);
0130
0131 static inline void efi_capsule_flush_cache_range(void *addr, int size)
0132 {
0133 dcache_clean_inval_poc((unsigned long)addr, (unsigned long)addr + size);
0134 }
0135
0136 #endif