diff options
-rw-r--r-- | arch/arm/include/asm/efi.h | 60 | ||||
-rw-r--r-- | arch/arm/include/asm/mmu_context.h | 2 | ||||
-rw-r--r-- | arch/arm/kernel/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/kernel/efi.c | 38 | ||||
-rw-r--r-- | arch/arm/kernel/setup.c | 3 | ||||
-rw-r--r-- | drivers/firmware/efi/Makefile | 1 |
6 files changed, 104 insertions, 1 deletions
diff --git a/arch/arm/include/asm/efi.h b/arch/arm/include/asm/efi.h new file mode 100644 index 000000000000..c91e330616ad --- /dev/null +++ b/arch/arm/include/asm/efi.h | |||
@@ -0,0 +1,60 @@ | |||
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 | |||
21 | #ifdef CONFIG_EFI | ||
22 | void efi_init(void); | ||
23 | |||
24 | int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md); | ||
25 | |||
26 | #define efi_call_virt(f, ...) \ | ||
27 | ({ \ | ||
28 | efi_##f##_t *__f; \ | ||
29 | efi_status_t __s; \ | ||
30 | \ | ||
31 | efi_virtmap_load(); \ | ||
32 | __f = efi.systab->runtime->f; \ | ||
33 | __s = __f(__VA_ARGS__); \ | ||
34 | efi_virtmap_unload(); \ | ||
35 | __s; \ | ||
36 | }) | ||
37 | |||
38 | #define __efi_call_virt(f, ...) \ | ||
39 | ({ \ | ||
40 | efi_##f##_t *__f; \ | ||
41 | \ | ||
42 | efi_virtmap_load(); \ | ||
43 | __f = efi.systab->runtime->f; \ | ||
44 | __f(__VA_ARGS__); \ | ||
45 | efi_virtmap_unload(); \ | ||
46 | }) | ||
47 | |||
48 | static inline void efi_set_pgd(struct mm_struct *mm) | ||
49 | { | ||
50 | check_and_switch_context(mm, NULL); | ||
51 | } | ||
52 | |||
53 | void efi_virtmap_load(void); | ||
54 | void efi_virtmap_unload(void); | ||
55 | |||
56 | #else | ||
57 | #define efi_init() | ||
58 | #endif /* CONFIG_EFI */ | ||
59 | |||
60 | #endif /* _ASM_ARM_EFI_H */ | ||
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h index 9b32f76bb0dd..432ce8176498 100644 --- a/arch/arm/include/asm/mmu_context.h +++ b/arch/arm/include/asm/mmu_context.h | |||
@@ -26,7 +26,7 @@ void __check_vmalloc_seq(struct mm_struct *mm); | |||
26 | #ifdef CONFIG_CPU_HAS_ASID | 26 | #ifdef CONFIG_CPU_HAS_ASID |
27 | 27 | ||
28 | void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk); | 28 | void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk); |
29 | #define init_new_context(tsk,mm) ({ atomic64_set(&mm->context.id, 0); 0; }) | 29 | #define init_new_context(tsk,mm) ({ atomic64_set(&(mm)->context.id, 0); 0; }) |
30 | 30 | ||
31 | #ifdef CONFIG_ARM_ERRATA_798181 | 31 | #ifdef CONFIG_ARM_ERRATA_798181 |
32 | void a15_erratum_get_cpumask(int this_cpu, struct mm_struct *mm, | 32 | void a15_erratum_get_cpumask(int this_cpu, struct mm_struct *mm, |
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index af9e59bf3831..c90f4a70d646 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile | |||
@@ -77,6 +77,7 @@ CFLAGS_pj4-cp0.o := -marm | |||
77 | AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt | 77 | AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt |
78 | obj-$(CONFIG_ARM_CPU_TOPOLOGY) += topology.o | 78 | obj-$(CONFIG_ARM_CPU_TOPOLOGY) += topology.o |
79 | obj-$(CONFIG_VDSO) += vdso.o | 79 | obj-$(CONFIG_VDSO) += vdso.o |
80 | obj-$(CONFIG_EFI) += efi.o | ||
80 | 81 | ||
81 | ifneq ($(CONFIG_ARCH_EBSA110),y) | 82 | ifneq ($(CONFIG_ARCH_EBSA110),y) |
82 | obj-y += io.o | 83 | obj-y += io.o |
diff --git a/arch/arm/kernel/efi.c b/arch/arm/kernel/efi.c new file mode 100644 index 000000000000..ff8a9d8acfac --- /dev/null +++ b/arch/arm/kernel/efi.c | |||
@@ -0,0 +1,38 @@ | |||
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 | #include <linux/efi.h> | ||
10 | #include <asm/efi.h> | ||
11 | #include <asm/mach/map.h> | ||
12 | #include <asm/mmu_context.h> | ||
13 | |||
14 | int __init efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md) | ||
15 | { | ||
16 | struct map_desc desc = { | ||
17 | .virtual = md->virt_addr, | ||
18 | .pfn = __phys_to_pfn(md->phys_addr), | ||
19 | .length = md->num_pages * EFI_PAGE_SIZE, | ||
20 | }; | ||
21 | |||
22 | /* | ||
23 | * Order is important here: memory regions may have all of the | ||
24 | * bits below set (and usually do), so we check them in order of | ||
25 | * preference. | ||
26 | */ | ||
27 | if (md->attribute & EFI_MEMORY_WB) | ||
28 | desc.type = MT_MEMORY_RWX; | ||
29 | else if (md->attribute & EFI_MEMORY_WT) | ||
30 | desc.type = MT_MEMORY_RWX_NONCACHED; | ||
31 | else if (md->attribute & EFI_MEMORY_WC) | ||
32 | desc.type = MT_DEVICE_WC; | ||
33 | else | ||
34 | desc.type = MT_DEVICE; | ||
35 | |||
36 | create_mapping_late(mm, &desc, true); | ||
37 | return 0; | ||
38 | } | ||
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 5df2bca57c42..b341b1c3b2fa 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | #include <linux/efi.h> | ||
10 | #include <linux/export.h> | 11 | #include <linux/export.h> |
11 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
12 | #include <linux/stddef.h> | 13 | #include <linux/stddef.h> |
@@ -37,6 +38,7 @@ | |||
37 | #include <asm/cp15.h> | 38 | #include <asm/cp15.h> |
38 | #include <asm/cpu.h> | 39 | #include <asm/cpu.h> |
39 | #include <asm/cputype.h> | 40 | #include <asm/cputype.h> |
41 | #include <asm/efi.h> | ||
40 | #include <asm/elf.h> | 42 | #include <asm/elf.h> |
41 | #include <asm/early_ioremap.h> | 43 | #include <asm/early_ioremap.h> |
42 | #include <asm/fixmap.h> | 44 | #include <asm/fixmap.h> |
@@ -966,6 +968,7 @@ void __init setup_arch(char **cmdline_p) | |||
966 | early_paging_init(mdesc); | 968 | early_paging_init(mdesc); |
967 | #endif | 969 | #endif |
968 | setup_dma_zone(mdesc); | 970 | setup_dma_zone(mdesc); |
971 | efi_init(); | ||
969 | sanity_check_meminfo(); | 972 | sanity_check_meminfo(); |
970 | arm_memblock_init(mdesc); | 973 | arm_memblock_init(mdesc); |
971 | 974 | ||
diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile index f292917b00e7..62e654f255f4 100644 --- a/drivers/firmware/efi/Makefile +++ b/drivers/firmware/efi/Makefile | |||
@@ -20,4 +20,5 @@ obj-$(CONFIG_EFI_STUB) += libstub/ | |||
20 | obj-$(CONFIG_EFI_FAKE_MEMMAP) += fake_mem.o | 20 | obj-$(CONFIG_EFI_FAKE_MEMMAP) += fake_mem.o |
21 | 21 | ||
22 | arm-obj-$(CONFIG_EFI) := arm-init.o arm-runtime.o | 22 | arm-obj-$(CONFIG_EFI) := arm-init.o arm-runtime.o |
23 | obj-$(CONFIG_ARM) += $(arm-obj-y) | ||
23 | obj-$(CONFIG_ARM64) += $(arm-obj-y) | 24 | obj-$(CONFIG_ARM64) += $(arm-obj-y) |