Linux Audio

Check our new training course

Loading...
v6.13.7
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 * Copyright (C) 2015 Linaro Ltd <ard.biesheuvel@linaro.org>
 
 
 
 
 4 */
 5
 6#ifndef __ASM_ARM_EFI_H
 7#define __ASM_ARM_EFI_H
 8
 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>
17#include <asm/uaccess.h>
18
19#ifdef CONFIG_EFI
20void efi_init(void);
21void arm_efi_init(void);
22
23int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);
24int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md, bool);
25
26#define arch_efi_call_virt_setup()	efi_virtmap_load()
27#define arch_efi_call_virt_teardown()	efi_virtmap_unload()
28
29#ifdef CONFIG_CPU_TTBR0_PAN
30#undef arch_efi_call_virt
31#define arch_efi_call_virt(p, f, args...) ({				\
32	unsigned int flags = uaccess_save_and_enable();			\
33	efi_status_t res = _Generic((p)->f(args),			\
34			efi_status_t:	(p)->f(args),			\
35			default:	((p)->f(args), EFI_ABORTED));	\
36	uaccess_restore(flags);						\
37	res;								\
38})
39#endif
40
41#define ARCH_EFI_IRQ_FLAGS_MASK \
42	(PSR_J_BIT | PSR_E_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT | \
43	 PSR_T_BIT | MODE_MASK)
44
45static inline void efi_set_pgd(struct mm_struct *mm)
46{
47	check_and_switch_context(mm, NULL);
48}
49
50void efi_virtmap_load(void);
51void efi_virtmap_unload(void);
52
53#else
54#define arm_efi_init()
55#endif /* CONFIG_EFI */
56
57/* arch specific definitions used by the stub code */
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59/*
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.
65 */
66#define MAX_UNCOMP_KERNEL_SIZE	SZ_32M
67
68/*
69 * phys-to-virt patching requires that the physical to virtual offset is a
70 * multiple of 2 MiB. However, using an alignment smaller than TEXT_OFFSET
71 * here throws off the memory allocation logic, so let's use the lowest power
72 * of two greater than 2 MiB and greater than TEXT_OFFSET.
73 */
74#define EFI_PHYS_ALIGN		max(UL(SZ_2M), roundup_pow_of_two(TEXT_OFFSET))
75
76/* on ARM, the initrd should be loaded in a lowmem region */
77static inline unsigned long efi_get_max_initrd_addr(unsigned long image_addr)
78{
79	return round_down(image_addr, SZ_4M) + SZ_512M;
80}
81
82struct efi_arm_entry_state {
83	u32	cpsr_before_ebs;
84	u32	sctlr_before_ebs;
85	u32	cpsr_after_ebs;
86	u32	sctlr_after_ebs;
87};
88
89static inline void efi_capsule_flush_cache_range(void *addr, int size)
90{
91	__cpuc_flush_dcache_area(addr, size);
92}
93
94#endif /* _ASM_ARM_EFI_H */
v4.10.11
 
 1/*
 2 * Copyright (C) 2015 Linaro Ltd <ard.biesheuvel@linaro.org>
 3 *
 4 * This program is free software; you can redistribute it and/or modify
 5 * it under the terms of the GNU General Public License version 2 as
 6 * published by the Free Software Foundation.
 7 */
 8
 9#ifndef __ASM_ARM_EFI_H
10#define __ASM_ARM_EFI_H
11
12#include <asm/cacheflush.h>
13#include <asm/cachetype.h>
14#include <asm/early_ioremap.h>
15#include <asm/fixmap.h>
16#include <asm/highmem.h>
17#include <asm/mach/map.h>
18#include <asm/mmu_context.h>
19#include <asm/pgtable.h>
20#include <asm/ptrace.h>
 
21
22#ifdef CONFIG_EFI
23void efi_init(void);
 
24
25int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);
26int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md);
27
28#define arch_efi_call_virt_setup()	efi_virtmap_load()
29#define arch_efi_call_virt_teardown()	efi_virtmap_unload()
30
31#define arch_efi_call_virt(p, f, args...)				\
32({									\
33	efi_##f##_t *__f;						\
34	__f = p->f;							\
35	__f(args);							\
 
 
 
 
36})
 
37
38#define ARCH_EFI_IRQ_FLAGS_MASK \
39	(PSR_J_BIT | PSR_E_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT | \
40	 PSR_T_BIT | MODE_MASK)
41
42static inline void efi_set_pgd(struct mm_struct *mm)
43{
44	check_and_switch_context(mm, NULL);
45}
46
47void efi_virtmap_load(void);
48void efi_virtmap_unload(void);
49
50#else
51#define efi_init()
52#endif /* CONFIG_EFI */
53
54/* arch specific definitions used by the stub code */
55
56#define efi_call_early(f, ...)		sys_table_arg->boottime->f(__VA_ARGS__)
57#define __efi_call_early(f, ...)	f(__VA_ARGS__)
58#define efi_is_64bit()			(false)
59
60#define efi_call_proto(protocol, f, instance, ...)			\
61	((protocol##_t *)instance)->f(instance, ##__VA_ARGS__)
62
63struct screen_info *alloc_screen_info(efi_system_table_t *sys_table_arg);
64void free_screen_info(efi_system_table_t *sys_table, struct screen_info *si);
65
66static inline void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
67{
68}
69
70/*
71 * A reasonable upper bound for the uncompressed kernel size is 32 MBytes,
72 * so we will reserve that amount of memory. We have no easy way to tell what
73 * the actuall size of code + data the uncompressed kernel will use.
74 * If this is insufficient, the decompressor will relocate itself out of the
75 * way before performing the decompression.
76 */
77#define MAX_UNCOMP_KERNEL_SIZE	SZ_32M
78
79/*
80 * The kernel zImage should preferably be located between 32 MB and 128 MB
81 * from the base of DRAM. The min address leaves space for a maximal size
82 * uncompressed image, and the max address is due to how the zImage decompressor
83 * picks a destination address.
84 */
85#define ZIMAGE_OFFSET_LIMIT	SZ_128M
86#define MIN_ZIMAGE_OFFSET	MAX_UNCOMP_KERNEL_SIZE
87#define MAX_FDT_OFFSET		ZIMAGE_OFFSET_LIMIT
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
89#endif /* _ASM_ARM_EFI_H */