hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/arch/arm64/include/asm/efi.h
....@@ -25,6 +25,7 @@
2525 ({ \
2626 efi_virtmap_load(); \
2727 __efi_fpsimd_begin(); \
28
+ raw_spin_lock(&efi_rt_lock); \
2829 })
2930
3031 #define arch_efi_call_virt(p, f, args...) \
....@@ -36,22 +37,28 @@
3637
3738 #define arch_efi_call_virt_teardown() \
3839 ({ \
40
+ raw_spin_unlock(&efi_rt_lock); \
3941 __efi_fpsimd_end(); \
4042 efi_virtmap_unload(); \
4143 })
4244
45
+extern raw_spinlock_t efi_rt_lock;
4346 efi_status_t __efi_rt_asm_wrapper(void *, const char *, ...);
4447
4548 #define ARCH_EFI_IRQ_FLAGS_MASK (PSR_D_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT)
4649
47
-/* arch specific definitions used by the stub code */
48
-
4950 /*
50
- * AArch64 requires the DTB to be 8-byte aligned in the first 512MiB from
51
- * start of kernel and may not cross a 2MiB boundary. We set alignment to
52
- * 2MiB so we know it won't cross a 2MiB boundary.
51
+ * Even when Linux uses IRQ priorities for IRQ disabling, EFI does not.
52
+ * And EFI shouldn't really play around with priority masking as it is not aware
53
+ * which priorities the OS has assigned to its interrupts.
5354 */
54
-#define EFI_FDT_ALIGN SZ_2M /* used by allocate_new_fdt_and_exit_boot() */
55
+#define arch_efi_save_flags(state_flags) \
56
+ ((void)((state_flags) = read_sysreg(daif)))
57
+
58
+#define arch_efi_restore_flags(state_flags) write_sysreg(state_flags, daif)
59
+
60
+
61
+/* arch specific definitions used by the stub code */
5562
5663 /*
5764 * In some configurations (e.g. VMAP_STACK && 64K pages), stacks built into the
....@@ -61,47 +68,31 @@
6168 (SEGMENT_ALIGN > THREAD_ALIGN ? SEGMENT_ALIGN : THREAD_ALIGN)
6269
6370 /* on arm64, the FDT may be located anywhere in system RAM */
64
-static inline unsigned long efi_get_max_fdt_addr(unsigned long dram_base)
71
+static inline unsigned long efi_get_max_fdt_addr(unsigned long image_addr)
6572 {
6673 return ULONG_MAX;
6774 }
6875
6976 /*
7077 * On arm64, we have to ensure that the initrd ends up in the linear region,
71
- * which is a 1 GB aligned region of size '1UL << (VA_BITS - 1)' that is
78
+ * which is a 1 GB aligned region of size '1UL << (VA_BITS_MIN - 1)' that is
7279 * guaranteed to cover the kernel Image.
7380 *
7481 * Since the EFI stub is part of the kernel Image, we can relax the
75
- * usual requirements in Documentation/arm64/booting.txt, which still
82
+ * usual requirements in Documentation/arm64/booting.rst, which still
7683 * apply to other bootloaders, and are required for some kernel
7784 * configurations.
7885 */
79
-static inline unsigned long efi_get_max_initrd_addr(unsigned long dram_base,
80
- unsigned long image_addr)
86
+static inline unsigned long efi_get_max_initrd_addr(unsigned long image_addr)
8187 {
82
- return (image_addr & ~(SZ_1G - 1UL)) + (1UL << (VA_BITS - 1));
88
+ return (image_addr & ~(SZ_1G - 1UL)) + (1UL << (VA_BITS_MIN - 1));
8389 }
84
-
85
-#define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__)
86
-#define __efi_call_early(f, ...) f(__VA_ARGS__)
87
-#define efi_call_runtime(f, ...) sys_table_arg->runtime->f(__VA_ARGS__)
88
-#define efi_is_64bit() (true)
89
-
90
-#define efi_table_attr(table, attr, instance) \
91
- ((table##_t *)instance)->attr
92
-
93
-#define efi_call_proto(protocol, f, instance, ...) \
94
- ((protocol##_t *)instance)->f(instance, ##__VA_ARGS__)
9590
9691 #define alloc_screen_info(x...) &screen_info
9792
98
-static inline void free_screen_info(efi_system_table_t *sys_table_arg,
99
- struct screen_info *si)
93
+static inline void free_screen_info(struct screen_info *si)
10094 {
10195 }
102
-
103
-/* redeclare as 'hidden' so the compiler will generate relative references */
104
-extern struct screen_info screen_info __attribute__((__visibility__("hidden")));
10596
10697 static inline void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
10798 {