Skip to contentSkip to conversation

efi: don't switch to virtual mode; run in physical mode instead

PATCH New Brian J. Tarricone 1 participant 1 message Nov 19, 2010

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

PATCH 1/1 efi: don't switch to virtual mode; run in physical mode instead

Sending to lmkl at HPA's request:
https://bugzilla.kernel.org/show_bug.cgi?id=23202
Please CC me on replies.

Running in virtual mode on MacBookAir3,1 does not work, and passing 'noefi' to the kernel is required (otherwise no console output, boot appears to hang). Unfortunately, this somehow causes issues assigning IRQs to PCI devices. Running in physical mode removes the need for 'noefi' and resolves the IRQ issue.

Original patch by Takao Indoh, found here:
https://patchwork.kernel.org/patch/119823/
Updated for 2.6.37.

---
 arch/x86/include/asm/efi.h     |    3 +
 arch/x86/platform/efi/efi.c    |  142 +++++++++++++++++++++++++++++++++++++++-
 arch/x86/platform/efi/efi_32.c |    4 +
 arch/x86/platform/efi/efi_64.c |   96 ++++++++++++++++++++++++++-
 include/linux/efi.h            |    1 +
 include/linux/init.h           |    1 +
 init/main.c                    |   16 ++++-
 7 files changed, 256 insertions(+), 7 deletions(-)
arch/x86/include/asm/efi.h +3 -0
index 8e4a165..3c62f15 100644
@@ -93,6 +93,9 @@ extern int add_efi_memmap;
 extern void efi_memblock_x86_reserve_range(void);
 extern void efi_call_phys_prelog(void);
 extern void efi_call_phys_epilog(void);
+extern void efi_call_phys_prelog_in_physmode(void);
+extern void efi_call_phys_epilog_in_physmode(void);
+extern void efi_pagetable_init(void);
 
 #ifndef CONFIG_EFI
 /*
arch/x86/platform/efi/efi.c +140 -2

178 lines not on this page · raw message

arch/x86/platform/efi/efi_32.c +4 -0
index 5cab48e..90767b1 100644
@@ -110,3 +110,7 @@ void efi_call_phys_epilog(void)
 
 	local_irq_restore(efi_rt_eflags);
 }
+
+void efi_call_phys_prelog_in_physmode(void) { /* Not supported */ }
+void efi_call_phys_epilog_in_physmode(void) { /* Not supported */ }
+
arch/x86/platform/efi/efi_64.c +93 -3

120 lines not on this page · raw message

include/linux/efi.h +1 -0
index fb737bc..c4e310e 100644
@@ -290,6 +290,7 @@ extern void efi_map_pal_code (void);
 extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg);
 extern void efi_gettimeofday (struct timespec *ts);
 extern void efi_enter_virtual_mode (void);	/* switch EFI to virtual mode, if possible */
+extern void efi_setup_physical_mode(void);
 extern u64 efi_get_iobase (void);
 extern u32 efi_mem_type (unsigned long phys_addr);
 extern u64 efi_mem_attributes (unsigned long phys_addr);
include/linux/init.h +1 -0
index 577671c..2f1b28f 100644
@@ -149,6 +149,7 @@ extern int do_one_initcall(initcall_t fn);
 extern char __initdata boot_command_line[];
 extern char *saved_command_line;
 extern unsigned int reset_devices;
+extern unsigned int usevirtefi;
 
 /* used by init/main.c */
 void setup_arch(char **);
init/main.c +14 -2
index e59af24..5242edc 100644
@@ -197,6 +197,14 @@ static int __init set_reset_devices(char *str)
 
 __setup("reset_devices", set_reset_devices);
 
+unsigned int usevirtefi;
+static int __init set_virt_efi(char *str)
+{
+	usevirtefi = 1;
+	return 1;
+}
+__setup("virtefi", set_virt_efi);
+
 static const char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, };
 const char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };
 static const char *panic_later, *panic_param;
@@ -669,8 +677,12 @@ asmlinkage void __init start_kernel(void)
 	pidmap_init();
 	anon_vma_init();
 #ifdef CONFIG_X86
-	if (efi_enabled)
-		efi_enter_virtual_mode();
+	if (efi_enabled) {
+		if (usevirtefi)
+			efi_enter_virtual_mode();
+		else
+			efi_setup_physical_mode();
+	}
 #endif
 	thread_info_cache_init();
 	cred_init();
Signature · 1 line
1.7.2.2