aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm64/Kconfig6
-rw-r--r--arch/arm64/Makefile1
-rw-r--r--arch/arm64/include/asm/efi.h33
-rw-r--r--arch/arm64/kernel/Makefile3
-rw-r--r--arch/arm64/kernel/efi-stub.c48
-rw-r--r--arch/arm64/kernel/efi.c42
-rw-r--r--arch/ia64/include/asm/io.h1
-rw-r--r--arch/ia64/kernel/process.c2
-rw-r--r--arch/x86/Kconfig1
-rw-r--r--arch/x86/boot/compressed/Makefile3
-rw-r--r--arch/x86/boot/compressed/eboot.c48
-rw-r--r--arch/x86/boot/compressed/eboot.h16
-rw-r--r--arch/x86/boot/header.S2
-rw-r--r--arch/x86/include/asm/efi.h33
-rw-r--r--arch/x86/kernel/reboot.c24
-rw-r--r--arch/x86/kernel/setup.c4
-rw-r--r--arch/x86/platform/efi/Makefile2
-rw-r--r--arch/x86/platform/efi/efi.c483
-rw-r--r--arch/x86/platform/efi/quirks.c290
-rw-r--r--arch/x86/xen/Makefile1
-rw-r--r--arch/x86/xen/efi.c43
-rw-r--r--arch/x86/xen/enlighten.c2
-rw-r--r--arch/x86/xen/xen-ops.h8
-rw-r--r--drivers/firmware/efi/Kconfig6
-rw-r--r--drivers/firmware/efi/Makefile4
-rw-r--r--drivers/firmware/efi/efi.c40
-rw-r--r--drivers/firmware/efi/efivars.c1
-rw-r--r--drivers/firmware/efi/libstub/Makefile26
-rw-r--r--drivers/firmware/efi/libstub/arm-stub.c (renamed from drivers/firmware/efi/arm-stub.c)32
-rw-r--r--drivers/firmware/efi/libstub/efi-stub-helper.c (renamed from drivers/firmware/efi/efi-stub-helper.c)74
-rw-r--r--drivers/firmware/efi/libstub/efistub.h42
-rw-r--r--drivers/firmware/efi/libstub/fdt.c (renamed from drivers/firmware/efi/fdt.c)20
-rw-r--r--drivers/firmware/efi/reboot.c56
-rw-r--r--drivers/firmware/efi/runtime-wrappers.c161
-rw-r--r--drivers/xen/Kconfig4
-rw-r--r--drivers/xen/Makefile3
-rw-r--r--drivers/xen/efi.c368
-rw-r--r--include/linux/efi.h63
-rw-r--r--include/xen/interface/platform.h123
-rw-r--r--include/xen/xen-ops.h11
40 files changed, 1508 insertions, 622 deletions
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index f3b584be76d7..b0f9c9db9590 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -347,12 +347,18 @@ config CMDLINE_FORCE
347 This is useful if you cannot or don't want to change the 347 This is useful if you cannot or don't want to change the
348 command-line options your boot loader passes to the kernel. 348 command-line options your boot loader passes to the kernel.
349 349
350config EFI_STUB
351 bool
352
350config EFI 353config EFI
351 bool "UEFI runtime support" 354 bool "UEFI runtime support"
352 depends on OF && !CPU_BIG_ENDIAN 355 depends on OF && !CPU_BIG_ENDIAN
353 select LIBFDT 356 select LIBFDT
354 select UCS2_STRING 357 select UCS2_STRING
355 select EFI_PARAMS_FROM_FDT 358 select EFI_PARAMS_FROM_FDT
359 select EFI_RUNTIME_WRAPPERS
360 select EFI_STUB
361 select EFI_ARMSTUB
356 default y 362 default y
357 help 363 help
358 This option provides support for runtime services provided 364 This option provides support for runtime services provided
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index e8d025c1459e..57833546bf00 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -52,6 +52,7 @@ core-$(CONFIG_XEN) += arch/arm64/xen/
52core-$(CONFIG_CRYPTO) += arch/arm64/crypto/ 52core-$(CONFIG_CRYPTO) += arch/arm64/crypto/
53libs-y := arch/arm64/lib/ $(libs-y) 53libs-y := arch/arm64/lib/ $(libs-y)
54libs-y += $(LIBGCC) 54libs-y += $(LIBGCC)
55libs-$(CONFIG_EFI_STUB) += drivers/firmware/efi/libstub/
55 56
56# Default target when executing plain make 57# Default target when executing plain make
57KBUILD_IMAGE := Image.gz 58KBUILD_IMAGE := Image.gz
diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h
index 5a46c4e7f539..a34fd3b12e2b 100644
--- a/arch/arm64/include/asm/efi.h
+++ b/arch/arm64/include/asm/efi.h
@@ -2,6 +2,7 @@
2#define _ASM_EFI_H 2#define _ASM_EFI_H
3 3
4#include <asm/io.h> 4#include <asm/io.h>
5#include <asm/neon.h>
5 6
6#ifdef CONFIG_EFI 7#ifdef CONFIG_EFI
7extern void efi_init(void); 8extern void efi_init(void);
@@ -11,4 +12,36 @@ extern void efi_idmap_init(void);
11#define efi_idmap_init() 12#define efi_idmap_init()
12#endif 13#endif
13 14
15#define efi_call_virt(f, ...) \
16({ \
17 efi_##f##_t *__f = efi.systab->runtime->f; \
18 efi_status_t __s; \
19 \
20 kernel_neon_begin(); \
21 __s = __f(__VA_ARGS__); \
22 kernel_neon_end(); \
23 __s; \
24})
25
26#define __efi_call_virt(f, ...) \
27({ \
28 efi_##f##_t *__f = efi.systab->runtime->f; \
29 \
30 kernel_neon_begin(); \
31 __f(__VA_ARGS__); \
32 kernel_neon_end(); \
33})
34
35/* arch specific definitions used by the stub code */
36
37/*
38 * AArch64 requires the DTB to be 8-byte aligned in the first 512MiB from
39 * start of kernel and may not cross a 2MiB boundary. We set alignment to
40 * 2MiB so we know it won't cross a 2MiB boundary.
41 */
42#define EFI_FDT_ALIGN SZ_2M /* used by allocate_new_fdt_and_exit_boot() */
43#define MAX_FDT_OFFSET SZ_512M
44
45#define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__)
46
14#endif /* _ASM_EFI_H */ 47#endif /* _ASM_EFI_H */
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index 27c72ef4fd7a..df7ef8768fc2 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -4,8 +4,7 @@
4 4
5CPPFLAGS_vmlinux.lds := -DTEXT_OFFSET=$(TEXT_OFFSET) 5CPPFLAGS_vmlinux.lds := -DTEXT_OFFSET=$(TEXT_OFFSET)
6AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) 6AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
7CFLAGS_efi-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) \ 7CFLAGS_efi-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
8 -I$(src)/../../../scripts/dtc/libfdt
9 8
10CFLAGS_REMOVE_ftrace.o = -pg 9CFLAGS_REMOVE_ftrace.o = -pg
11CFLAGS_REMOVE_insn.o = -pg 10CFLAGS_REMOVE_insn.o = -pg
diff --git a/arch/arm64/kernel/efi-stub.c b/arch/arm64/kernel/efi-stub.c
index e786e6cdc400..1317fef8dde9 100644
--- a/arch/arm64/kernel/efi-stub.c
+++ b/arch/arm64/kernel/efi-stub.c
@@ -10,46 +10,16 @@
10 * 10 *
11 */ 11 */
12#include <linux/efi.h> 12#include <linux/efi.h>
13#include <linux/libfdt.h> 13#include <asm/efi.h>
14#include <asm/sections.h> 14#include <asm/sections.h>
15 15
16/* 16efi_status_t handle_kernel_image(efi_system_table_t *sys_table,
17 * AArch64 requires the DTB to be 8-byte aligned in the first 512MiB from 17 unsigned long *image_addr,
18 * start of kernel and may not cross a 2MiB boundary. We set alignment to 18 unsigned long *image_size,
19 * 2MiB so we know it won't cross a 2MiB boundary. 19 unsigned long *reserve_addr,
20 */ 20 unsigned long *reserve_size,
21#define EFI_FDT_ALIGN SZ_2M /* used by allocate_new_fdt_and_exit_boot() */ 21 unsigned long dram_base,
22#define MAX_FDT_OFFSET SZ_512M 22 efi_loaded_image_t *image)
23
24#define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__)
25
26static void efi_char16_printk(efi_system_table_t *sys_table_arg,
27 efi_char16_t *str);
28
29static efi_status_t efi_open_volume(efi_system_table_t *sys_table,
30 void *__image, void **__fh);
31static efi_status_t efi_file_close(void *handle);
32
33static efi_status_t
34efi_file_read(void *handle, unsigned long *size, void *addr);
35
36static efi_status_t
37efi_file_size(efi_system_table_t *sys_table, void *__fh,
38 efi_char16_t *filename_16, void **handle, u64 *file_sz);
39
40/* Include shared EFI stub code */
41#include "../../../drivers/firmware/efi/efi-stub-helper.c"
42#include "../../../drivers/firmware/efi/fdt.c"
43#include "../../../drivers/firmware/efi/arm-stub.c"
44
45
46static efi_status_t handle_kernel_image(efi_system_table_t *sys_table,
47 unsigned long *image_addr,
48 unsigned long *image_size,
49 unsigned long *res