forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/arch/arm/include/asm/efi.h
....@@ -1,9 +1,6 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * 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.
74 */
85
96 #ifndef __ASM_ARM_EFI_H
....@@ -16,7 +13,6 @@
1613 #include <asm/highmem.h>
1714 #include <asm/mach/map.h>
1815 #include <asm/mmu_context.h>
19
-#include <asm/pgtable.h>
2016 #include <asm/ptrace.h>
2117
2218 #ifdef CONFIG_EFI
....@@ -53,19 +49,8 @@
5349
5450 /* arch specific definitions used by the stub code */
5551
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_call_runtime(f, ...) sys_table_arg->runtime->f(__VA_ARGS__)
59
-#define efi_is_64bit() (false)
60
-
61
-#define efi_table_attr(table, attr, instance) \
62
- ((table##_t *)instance)->attr
63
-
64
-#define efi_call_proto(protocol, f, instance, ...) \
65
- ((protocol##_t *)instance)->f(instance, ##__VA_ARGS__)
66
-
67
-struct screen_info *alloc_screen_info(efi_system_table_t *sys_table_arg);
68
-void free_screen_info(efi_system_table_t *sys_table, struct screen_info *si);
52
+struct screen_info *alloc_screen_info(void);
53
+void free_screen_info(struct screen_info *si);
6954
7055 static inline void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
7156 {
....@@ -81,25 +66,31 @@
8166 #define MAX_UNCOMP_KERNEL_SIZE SZ_32M
8267
8368 /*
84
- * The kernel zImage should preferably be located between 32 MB and 128 MB
85
- * from the base of DRAM. The min address leaves space for a maximal size
86
- * uncompressed image, and the max address is due to how the zImage decompressor
87
- * picks a destination address.
69
+ * phys-to-virt patching requires that the physical to virtual offset fits
70
+ * into the immediate field of an add/sub instruction, which comes down to the
71
+ * 24 least significant bits being zero, and so the offset should be a multiple
72
+ * of 16 MB. Since PAGE_OFFSET itself is a multiple of 16 MB, the physical
73
+ * base should be aligned to 16 MB as well.
8874 */
89
-#define ZIMAGE_OFFSET_LIMIT SZ_128M
90
-#define MIN_ZIMAGE_OFFSET MAX_UNCOMP_KERNEL_SIZE
75
+#define EFI_PHYS_ALIGN SZ_16M
9176
92
-/* on ARM, the FDT should be located in the first 128 MB of RAM */
93
-static inline unsigned long efi_get_max_fdt_addr(unsigned long dram_base)
77
+/* on ARM, the FDT should be located in a lowmem region */
78
+static inline unsigned long efi_get_max_fdt_addr(unsigned long image_addr)
9479 {
95
- return dram_base + ZIMAGE_OFFSET_LIMIT;
80
+ return round_down(image_addr, EFI_PHYS_ALIGN) + SZ_512M;
9681 }
9782
9883 /* on ARM, the initrd should be loaded in a lowmem region */
99
-static inline unsigned long efi_get_max_initrd_addr(unsigned long dram_base,
100
- unsigned long image_addr)
84
+static inline unsigned long efi_get_max_initrd_addr(unsigned long image_addr)
10185 {
102
- return dram_base + SZ_512M;
86
+ return round_down(image_addr, EFI_PHYS_ALIGN) + SZ_512M;
10387 }
10488
89
+struct efi_arm_entry_state {
90
+ u32 cpsr_before_ebs;
91
+ u32 sctlr_before_ebs;
92
+ u32 cpsr_after_ebs;
93
+ u32 sctlr_after_ebs;
94
+};
95
+
10596 #endif /* _ASM_ARM_EFI_H */