diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-27 19:17:42 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-27 19:17:42 -0500 |
commit | e3c4877de8b9d93bd47b6ee88eb594b1c1e10da5 (patch) | |
tree | 17ade3a3a13b1e7768abe3561b6808dc4980a5f6 /arch/x86 | |
parent | 18a44a7ff1075ce5157ac07cde573aca6b5e9973 (diff) | |
parent | 6b59e366e074d3962e04f01efb8acc10a33c0e1e (diff) |
Merge branch 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86/EFI changes from Peter Anvin:
- Improve the initrd handling in the EFI boot stub by allowing forward
slashes in the pathname - from Chun-Yi Lee.
- Cleanup code duplication in the EFI mixed kernel/firmware code - from
Satoru Takeuchi.
- efivarfs bug fixes for more strict filename validation, with lots of
input from Al Viro.
* 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86, efi: remove duplicate code in setup_arch() by using, efi_is_native()
efivarfs: guid part of filenames are case-insensitive
efivarfs: Validate filenames much more aggressively
efivarfs: Use sizeof() instead of magic number
x86, efi: Allow slash in file path of initrd
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/boot/compressed/eboot.c | 26 | ||||
-rw-r--r-- | arch/x86/include/asm/efi.h | 9 | ||||
-rw-r--r-- | arch/x86/kernel/setup.c | 3 | ||||
-rw-r--r-- | arch/x86/platform/efi/efi.c | 5 |
4 files changed, 28 insertions, 15 deletions
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index f8fa41190c35..c205035a6b96 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c | |||
@@ -19,23 +19,28 @@ | |||
19 | 19 | ||
20 | static efi_system_table_t *sys_table; | 20 | static efi_system_table_t *sys_table; |
21 | 21 | ||
22 | static void efi_char16_printk(efi_char16_t *str) | ||
23 | { | ||
24 | struct efi_simple_text_output_protocol *out; | ||
25 | |||
26 | out = (struct efi_simple_text_output_protocol *)sys_table->con_out; | ||
27 | efi_call_phys2(out->output_string, out, str); | ||
28 | } | ||
29 | |||
22 | static void efi_printk(char *str) | 30 | static void efi_printk(char *str) |
23 | { | 31 | { |
24 | char *s8; | 32 | char *s8; |
25 | 33 | ||
26 | for (s8 = str; *s8; s8++) { | 34 | for (s8 = str; *s8; s8++) { |
27 | struct efi_simple_text_output_protocol *out; | ||
28 | efi_char16_t ch[2] = { 0 }; | 35 | efi_char16_t ch[2] = { 0 }; |
29 | 36 | ||
30 | ch[0] = *s8; | 37 | ch[0] = *s8; |
31 | out = (struct efi_simple_text_output_protocol *)sys_table->con_out; | ||
32 | |||
33 | if (*s8 == '\n') { | 38 | if (*s8 == '\n') { |
34 | efi_char16_t nl[2] = { '\r', 0 }; | 39 | efi_char16_t nl[2] = { '\r', 0 }; |
35 | efi_call_phys2(out->output_string, out, nl); | 40 | efi_char16_printk(nl); |
36 | } | 41 | } |
37 | 42 | ||
38 | efi_call_phys2(out->output_string, out, ch); | 43 | efi_char16_printk(ch); |
39 | } | 44 | } |
40 | } | 45 | } |
41 | 46 | ||
@@ -709,7 +714,12 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image, | |||
709 | if ((u8 *)p >= (u8 *)filename_16 + sizeof(filename_16)) | 714 | if ((u8 *)p >= (u8 *)filename_16 + sizeof(filename_16)) |
710 | break; | 715 | break; |
711 | 716 | ||
712 | *p++ = *str++; | 717 | if (*str == '/') { |
718 | *p++ = '\\'; | ||
719 | *str++; | ||
720 | } else { | ||
721 | *p++ = *str++; | ||
722 | } | ||
713 | } | 723 | } |
714 | 724 | ||
715 | *p = '\0'; | 725 | *p = '\0'; |
@@ -737,7 +747,9 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image, | |||
737 | status = efi_call_phys5(fh->open, fh, &h, filename_16, | 747 | status = efi_call_phys5(fh->open, fh, &h, filename_16, |
738 | EFI_FILE_MODE_READ, (u64)0); | 748 | EFI_FILE_MODE_READ, (u64)0); |
739 | if (status != EFI_SUCCESS) { | 749 | if (status != EFI_SUCCESS) { |
740 | efi_printk("Failed to open initrd file\n"); | 750 | efi_printk("Failed to open initrd file: "); |
751 | efi_char16_printk(filename_16); | ||
752 | efi_printk("\n"); | ||
741 | goto close_handles; | 753 | goto close_handles; |
742 | } | 754 | } |
743 | 755 | ||
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index 28677c55113f..60c89f30c727 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h | |||
@@ -102,7 +102,14 @@ extern void efi_call_phys_epilog(void); | |||
102 | extern void efi_unmap_memmap(void); | 102 | extern void efi_unmap_memmap(void); |
103 | extern void efi_memory_uc(u64 addr, unsigned long size); | 103 | extern void efi_memory_uc(u64 addr, unsigned long size); |
104 | 104 | ||
105 | #ifndef CONFIG_EFI | 105 | #ifdef CONFIG_EFI |
106 | |||
107 | static inline bool efi_is_native(void) | ||
108 | { | ||
109 | return IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT); | ||
110 | } | ||
111 | |||
112 | #else | ||
106 | /* | 113 | /* |
107 | * IF EFI is not configured, have the EFI calls return -ENOSYS. | 114 | * IF EFI is not configured, have the EFI calls return -ENOSYS. |
108 | */ | 115 | */ |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 9c857f05cef0..e89acdf6b77b 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -1196,8 +1196,7 @@ void __init setup_arch(char **cmdline_p) | |||
1196 | * mismatched firmware/kernel archtectures since there is no | 1196 | * mismatched firmware/kernel archtectures since there is no |
1197 | * support for runtime services. | 1197 | * support for runtime services. |
1198 | */ | 1198 | */ |
1199 | if (efi_enabled(EFI_BOOT) && | 1199 | if (efi_enabled(EFI_BOOT) && !efi_is_native()) { |
1200 | IS_ENABLED(CONFIG_X86_64) != efi_enabled(EFI_64BIT)) { | ||
1201 | pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n"); | 1200 | pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n"); |
1202 | efi_unmap_memmap(); | 1201 | efi_unmap_memmap(); |
1203 | } | 1202 | } |
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 5ae99f9160d9..5f2ecaf3f9d8 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c | |||
@@ -69,11 +69,6 @@ struct efi_memory_map memmap; | |||
69 | static struct efi efi_phys __initdata; | 69 | static struct efi efi_phys __initdata; |
70 | static efi_system_table_t efi_systab __initdata; | 70 | static efi_system_table_t efi_systab __initdata; |
71 | 71 | ||
72 | static inline bool efi_is_native(void) | ||
73 | { | ||
74 | return IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT); | ||
75 | } | ||
76 | |||
77 | unsigned long x86_efi_facility; | 72 | unsigned long x86_efi_facility; |
78 | 73 | ||
79 | /* | 74 | /* |