Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (C) 2015 Linaro Ltd <ard.biesheuvel@linaro.org>
0004  */
0005 
0006 #ifndef __ASM_ARM_EFI_H
0007 #define __ASM_ARM_EFI_H
0008 
0009 #include <asm/cacheflush.h>
0010 #include <asm/cachetype.h>
0011 #include <asm/early_ioremap.h>
0012 #include <asm/fixmap.h>
0013 #include <asm/highmem.h>
0014 #include <asm/mach/map.h>
0015 #include <asm/mmu_context.h>
0016 #include <asm/ptrace.h>
0017 
0018 #ifdef CONFIG_EFI
0019 void efi_init(void);
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()  efi_virtmap_load()
0025 #define arch_efi_call_virt_teardown()   efi_virtmap_unload()
0026 
0027 #define ARCH_EFI_IRQ_FLAGS_MASK \
0028     (PSR_J_BIT | PSR_E_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT | \
0029      PSR_T_BIT | MODE_MASK)
0030 
0031 static inline void efi_set_pgd(struct mm_struct *mm)
0032 {
0033     check_and_switch_context(mm, NULL);
0034 }
0035 
0036 void efi_virtmap_load(void);
0037 void efi_virtmap_unload(void);
0038 
0039 #else
0040 #define efi_init()
0041 #endif /* CONFIG_EFI */
0042 
0043 /* arch specific definitions used by the stub code */
0044 
0045 struct screen_info *alloc_screen_info(void);
0046 void free_screen_info(struct screen_info *si);
0047 
0048 /*
0049  * A reasonable upper bound for the uncompressed kernel size is 32 MBytes,
0050  * so we will reserve that amount of memory. We have no easy way to tell what
0051  * the actuall size of code + data the uncompressed kernel will use.
0052  * If this is insufficient, the decompressor will relocate itself out of the
0053  * way before performing the decompression.
0054  */
0055 #define MAX_UNCOMP_KERNEL_SIZE  SZ_32M
0056 
0057 /*
0058  * phys-to-virt patching requires that the physical to virtual offset is a
0059  * multiple of 2 MiB. However, using an alignment smaller than TEXT_OFFSET
0060  * here throws off the memory allocation logic, so let's use the lowest power
0061  * of two greater than 2 MiB and greater than TEXT_OFFSET.
0062  */
0063 #define EFI_PHYS_ALIGN      max(UL(SZ_2M), roundup_pow_of_two(TEXT_OFFSET))
0064 
0065 /* on ARM, the initrd should be loaded in a lowmem region */
0066 static inline unsigned long efi_get_max_initrd_addr(unsigned long image_addr)
0067 {
0068     return round_down(image_addr, SZ_4M) + SZ_512M;
0069 }
0070 
0071 struct efi_arm_entry_state {
0072     u32 cpsr_before_ebs;
0073     u32 sctlr_before_ebs;
0074     u32 cpsr_after_ebs;
0075     u32 sctlr_after_ebs;
0076 };
0077 
0078 static inline void efi_capsule_flush_cache_range(void *addr, int size)
0079 {
0080     __cpuc_flush_dcache_area(addr, size);
0081 }
0082 
0083 #endif /* _ASM_ARM_EFI_H */