aboutsummaryrefslogtreecommitdiffstats
path: root/init/main.c
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2012-11-14 04:42:35 -0500
committerH. Peter Anvin <hpa@linux.intel.com>2013-01-30 14:51:59 -0500
commit83e68189745ad931c2afd45d8ee3303929233e7f (patch)
tree35673a4eebff4c71bda4b1023ccc7cbea36f84b2 /init/main.c
parentf44310b98ddb7f0d06550d73ed67df5865e3eda5 (diff)
efi: Make 'efi_enabled' a function to query EFI facilities
Originally 'efi_enabled' indicated whether a kernel was booted from EFI firmware. Over time its semantics have changed, and it now indicates whether or not we are booted on an EFI machine with bit-native firmware, e.g. 64-bit kernel with 64-bit firmware. The immediate motivation for this patch is the bug report at, https://bugs.launchpad.net/ubuntu-cdimage/+bug/1040557 which details how running a platform driver on an EFI machine that is designed to run under BIOS can cause the machine to become bricked. Also, the following report, https://bugzilla.kernel.org/show_bug.cgi?id=47121 details how running said driver can also cause Machine Check Exceptions. Drivers need a new means of detecting whether they're running on an EFI machine, as sadly the expression, if (!efi_enabled) hasn't been a sufficient condition for quite some time. Users actually want to query 'efi_enabled' for different reasons - what they really want access to is the list of available EFI facilities. For instance, the x86 reboot code needs to know whether it can invoke the ResetSystem() function provided by the EFI runtime services, while the ACPI OSL code wants to know whether the EFI config tables were mapped successfully. There are also checks in some of the platform driver code to simply see if they're running on an EFI machine (which would make it a bad idea to do BIOS-y things). This patch is a prereq for the samsung-laptop fix patch. Cc: David Airlie <airlied@linux.ie> Cc: Corentin Chary <corentincj@iksaif.net> Cc: Matthew Garrett <mjg59@srcf.ucam.org> Cc: Dave Jiang <dave.jiang@intel.com> Cc: Olof Johansson <olof@lixom.net> Cc: Peter Jones <pjones@redhat.com> Cc: Colin Ian King <colin.king@canonical.com> Cc: Steve Langasek <steve.langasek@canonical.com> Cc: Tony Luck <tony.luck@intel.com> Cc: Konrad Rzeszutek Wilk <konrad@kernel.org> Cc: Rafael J. Wysocki <rjw@sisk.pl> Cc: <stable@vger.kernel.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'init/main.c')
-rw-r--r--init/main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/init/main.c b/init/main.c
index 85d69dffe864..cd30179c86bd 100644
--- a/init/main.c
+++ b/init/main.c
@@ -604,7 +604,7 @@ asmlinkage void __init start_kernel(void)
604 pidmap_init(); 604 pidmap_init();
605 anon_vma_init(); 605 anon_vma_init();
606#ifdef CONFIG_X86 606#ifdef CONFIG_X86
607 if (efi_enabled) 607 if (efi_enabled(EFI_RUNTIME_SERVICES))
608 efi_enter_virtual_mode(); 608 efi_enter_virtual_mode();
609#endif 609#endif
610 thread_info_cache_init(); 610 thread_info_cache_init();
@@ -632,7 +632,7 @@ asmlinkage void __init start_kernel(void)
632 acpi_early_init(); /* before LAPIC and SMP init */ 632 acpi_early_init(); /* before LAPIC and SMP init */
633 sfi_init_late(); 633 sfi_init_late();
634 634
635 if (efi_enabled) { 635 if (efi_enabled(EFI_RUNTIME_SERVICES)) {
636 efi_late_init(); 636 efi_late_init();
637 efi_free_boot_services(); 637 efi_free_boot_services();
638 } 638 }