mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
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 <[email protected]>
Cc: Corentin Chary <[email protected]>
Cc: Matthew Garrett <[email protected]>
Cc: Dave Jiang <[email protected]>
Cc: Olof Johansson <[email protected]>
Cc: Peter Jones <[email protected]>
Cc: Colin Ian King <[email protected]>
Cc: Steve Langasek <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Rafael J. Wysocki <[email protected]>
Cc: <[email protected]>
Signed-off-by: Matt Fleming <[email protected]>
Signed-off-by: H. Peter Anvin <[email protected]>
This commit is contained in:
parent
f44310b98d
commit
83e6818974
13 changed files with 79 additions and 54 deletions
|
|
@ -471,7 +471,7 @@ void __init dmi_scan_machine(void)
|
|||
char __iomem *p, *q;
|
||||
int rc;
|
||||
|
||||
if (efi_enabled) {
|
||||
if (efi_enabled(EFI_CONFIG_TABLES)) {
|
||||
if (efi.smbios == EFI_INVALID_TABLE_ADDR)
|
||||
goto error;
|
||||
|
||||
|
|
|
|||
|
|
@ -1782,7 +1782,7 @@ efivars_init(void)
|
|||
printk(KERN_INFO "EFI Variables Facility v%s %s\n", EFIVARS_VERSION,
|
||||
EFIVARS_DATE);
|
||||
|
||||
if (!efi_enabled)
|
||||
if (!efi_enabled(EFI_RUNTIME_SERVICES))
|
||||
return 0;
|
||||
|
||||
/* For now we'll register the efi directory at /sys/firmware/efi */
|
||||
|
|
@ -1822,7 +1822,7 @@ err_put:
|
|||
static void __exit
|
||||
efivars_exit(void)
|
||||
{
|
||||
if (efi_enabled) {
|
||||
if (efi_enabled(EFI_RUNTIME_SERVICES)) {
|
||||
unregister_efivars(&__efivars);
|
||||
kobject_put(efi_kobj);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ unsigned long __init find_ibft_region(unsigned long *sizep)
|
|||
/* iBFT 1.03 section 1.4.3.1 mandates that UEFI machines will
|
||||
* only use ACPI for this */
|
||||
|
||||
if (!efi_enabled)
|
||||
if (!efi_enabled(EFI_BOOT))
|
||||
find_ibft_in_mem();
|
||||
|
||||
if (ibft_addr) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue