1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2015 Linaro Ltd <ard.biesheuvel@linaro.org>
6 #ifndef __ASM_ARM_EFI_H
7 #define __ASM_ARM_EFI_H
9 #include <asm/cacheflush.h>
10 #include <asm/cachetype.h>
11 #include <asm/early_ioremap.h>
12 #include <asm/fixmap.h>
13 #include <asm/highmem.h>
14 #include <asm/mach/map.h>
15 #include <asm/mmu_context.h>
16 #include <asm/ptrace.h>
21 int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);
22 int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md);
24 #define arch_efi_call_virt_setup() efi_virtmap_load()
25 #define arch_efi_call_virt_teardown() efi_virtmap_unload()
27 #define arch_efi_call_virt(p, f, args...) \
34 #define ARCH_EFI_IRQ_FLAGS_MASK \
35 (PSR_J_BIT | PSR_E_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT | \
36 PSR_T_BIT | MODE_MASK)
38 static inline void efi_set_pgd(struct mm_struct *mm)
40 check_and_switch_context(mm, NULL);
43 void efi_virtmap_load(void);
44 void efi_virtmap_unload(void);
48 #endif /* CONFIG_EFI */
50 /* arch specific definitions used by the stub code */
52 struct screen_info *alloc_screen_info(void);
53 void free_screen_info(struct screen_info *si);
55 static inline void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
60 * A reasonable upper bound for the uncompressed kernel size is 32 MBytes,
61 * so we will reserve that amount of memory. We have no easy way to tell what
62 * the actuall size of code + data the uncompressed kernel will use.
63 * If this is insufficient, the decompressor will relocate itself out of the
64 * way before performing the decompression.
66 #define MAX_UNCOMP_KERNEL_SIZE SZ_32M
69 * The kernel zImage should preferably be located between 32 MB and 128 MB
70 * from the base of DRAM. The min address leaves space for a maximal size
71 * uncompressed image, and the max address is due to how the zImage decompressor
72 * picks a destination address.
74 #define ZIMAGE_OFFSET_LIMIT SZ_128M
75 #define MIN_ZIMAGE_OFFSET MAX_UNCOMP_KERNEL_SIZE
77 /* on ARM, the FDT should be located in the first 128 MB of RAM */
78 static inline unsigned long efi_get_max_fdt_addr(unsigned long dram_base)
80 return dram_base + ZIMAGE_OFFSET_LIMIT;
83 /* on ARM, the initrd should be loaded in a lowmem region */
84 static inline unsigned long efi_get_max_initrd_addr(unsigned long dram_base,
85 unsigned long image_addr)
87 return dram_base + SZ_512M;
90 #endif /* _ASM_ARM_EFI_H */