Skip to contentSkip to conversation

x86/efi for v3.9-rc1

GIT PULL H. Peter Anvin 1 participant 1 message Feb 27, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Linus,

This patchset came in to us late, but it seems fairly innocuous and is mostly fixes anyway.

The following changes since commit 04c2eee5b9dfcb13f3cd07a5537fb8c785f2751a:

Merge branch 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip (2013-01-31 17:10:36 +1100)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-efi-for-linus

for you to fetch changes up to 6b59e366e074d3962e04f01efb8acc10a33c0e1e:

x86, efi: remove duplicate code in setup_arch() by using, efi_is_native() (2013-02-14 10:36:18 +0000)

----------------------------------------------------------------
EFI changes for v3.9-rc1,

* 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.

----------------------------------------------------------------
Lee, Chun-Yi (1):
x86, efi: Allow slash in file path of initrd

Matt Fleming (3):
efivarfs: Use sizeof() instead of magic number
efivarfs: Validate filenames much more aggressively
efivarfs: guid part of filenames are case-insensitive

Satoru Takeuchi (1):
x86, efi: remove duplicate code in setup_arch() by using, efi_is_native()

 arch/x86/boot/compressed/eboot.c |  26 +++++--
 arch/x86/include/asm/efi.h       |   9 ++-
 arch/x86/kernel/setup.c          |   3 +-
 arch/x86/platform/efi/efi.c      |   5 --
 drivers/firmware/efivars.c       | 146 ++++++++++++++++++++++++++++++++++++---
 5 files changed, 166 insertions(+), 23 deletions(-)
arch/x86/boot/compressed/eboot.c +19 -7
index f8fa411..c205035 100644
@@ -19,23 +19,28 @@
 
 static efi_system_table_t *sys_table;
 
+static void efi_char16_printk(efi_char16_t *str)
+{
+	struct efi_simple_text_output_protocol *out;
+
+	out = (struct efi_simple_text_output_protocol *)sys_table->con_out;
+	efi_call_phys2(out->output_string, out, str);
+}
+
 static void efi_printk(char *str)
 {
 	char *s8;
 
 	for (s8 = str; *s8; s8++) {
-		struct efi_simple_text_output_protocol *out;
 		efi_char16_t ch[2] = { 0 };
 
 		ch[0] = *s8;
-		out = (struct efi_simple_text_output_protocol *)sys_table->con_out;
-
 		if (*s8 == '\n') {
 			efi_char16_t nl[2] = { '\r', 0 };
-			efi_call_phys2(out->output_string, out, nl);
+			efi_char16_printk(nl);
 		}
 
-		efi_call_phys2(out->output_string, out, ch);
+		efi_char16_printk(ch);
 	}
 }
 
@@ -709,7 +714,12 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image,
 			if ((u8 *)p >= (u8 *)filename_16 + sizeof(filename_16))
 				break;
 
-			*p++ = *str++;
+			if (*str == '/') {
+				*p++ = '\\';
+				*str++;
+			} else {
+				*p++ = *str++;
+			}
 		}
 
 		*p = '\0';
@@ -737,7 +747,9 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image,
 		status = efi_call_phys5(fh->open, fh, &h, filename_16,
 					EFI_FILE_MODE_READ, (u64)0);
 		if (status != EFI_SUCCESS) {
-			efi_printk("Failed to open initrd file\n");
+			efi_printk("Failed to open initrd file: ");
+			efi_char16_printk(filename_16);
+			efi_printk("\n");
 			goto close_handles;
 		}
 
arch/x86/include/asm/efi.h +8 -1
index 28677c5..60c89f3 100644
@@ -102,7 +102,14 @@ extern void efi_call_phys_epilog(void);
 extern void efi_unmap_memmap(void);
 extern void efi_memory_uc(u64 addr, unsigned long size);
 
-#ifndef CONFIG_EFI
+#ifdef CONFIG_EFI
+
+static inline bool efi_is_native(void)
+{
+	return IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT);
+}
+
+#else
 /*
  * IF EFI is not configured, have the EFI calls return -ENOSYS.
  */
arch/x86/kernel/setup.c +1 -2
index 8b24289..1abb796 100644
@@ -1135,8 +1135,7 @@ void __init setup_arch(char **cmdline_p)
 	 * mismatched firmware/kernel archtectures since there is no
 	 * support for runtime services.
 	 */
-	if (efi_enabled(EFI_BOOT) &&
-	    IS_ENABLED(CONFIG_X86_64) != efi_enabled(EFI_64BIT)) {
+	if (efi_enabled(EFI_BOOT) && !efi_is_native()) {
 		pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n");
 		efi_unmap_memmap();
 	}
arch/x86/platform/efi/efi.c +0 -5
index 77cf009..e075e47 100644
@@ -69,11 +69,6 @@ struct efi_memory_map memmap;
 static struct efi efi_phys __initdata;
 static efi_system_table_t efi_systab __initdata;
 
-static inline bool efi_is_native(void)
-{
-	return IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT);
-}
-
 unsigned long x86_efi_facility;
 
 /*
drivers/firmware/efivars.c +138 -8

195 lines not on this page · raw message