diff options
author | Lee, Chun-Yi <joeyli.kernel@gmail.com> | 2014-07-09 06:39:29 -0400 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2014-07-18 16:24:01 -0400 |
commit | 28d54022e6ff9c16bf4dacb5f64a97443a38caa9 (patch) | |
tree | 5ff5e9d5cce511c27864baadf442dfacd920b5ee /drivers/firmware/efi/efi.c | |
parent | 82f990a82244f8dfeb7e776186dc4811eb651ed7 (diff) |
efi: Autoload efivars
The original patch is from Ben Hutchings's contribution to debian
kernel. Got Ben's permission to remove the code of efi-pstore.c and
send to linux-efi:
https://github.com/BlankOn/linux-debian/blob/master/debian/patches/features/all/efi-autoload-efivars.patch
efivars is generally useful to have on EFI systems, and in some cases
it may be impossible to load it after a kernel upgrade in order to
complete a boot loader update. At the same time we don't want to waste
memory on non-EFI systems by making them built-in.
Instead, give them module aliases as if they are platform drivers, and
register a corresponding platform device whenever EFI runtime services
are available. This should trigger udev to load them.
Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'drivers/firmware/efi/efi.c')
-rw-r--r-- | drivers/firmware/efi/efi.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index ac88ec05eb70..36ffa1747e84 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/of.h> | 23 | #include <linux/of.h> |
24 | #include <linux/of_fdt.h> | 24 | #include <linux/of_fdt.h> |
25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/platform_device.h> | ||
26 | 27 | ||
27 | struct efi __read_mostly efi = { | 28 | struct efi __read_mostly efi = { |
28 | .mps = EFI_INVALID_TABLE_ADDR, | 29 | .mps = EFI_INVALID_TABLE_ADDR, |
@@ -324,6 +325,20 @@ int __init efi_config_init(efi_config_table_type_t *arch_tables) | |||
324 | return 0; | 325 | return 0; |
325 | } | 326 | } |
326 | 327 | ||
328 | #ifdef CONFIG_EFI_VARS_MODULE | ||
329 | static int __init efi_load_efivars(void) | ||
330 | { | ||
331 | struct platform_device *pdev; | ||
332 | |||
333 | if (!efi_enabled(EFI_RUNTIME_SERVICES)) | ||
334 | return 0; | ||
335 | |||
336 | pdev = platform_device_register_simple("efivars", 0, NULL, 0); | ||
337 | return IS_ERR(pdev) ? PTR_ERR(pdev) : 0; | ||
338 | } | ||
339 | device_initcall(efi_load_efivars); | ||
340 | #endif | ||
341 | |||
327 | #ifdef CONFIG_EFI_PARAMS_FROM_FDT | 342 | #ifdef CONFIG_EFI_PARAMS_FROM_FDT |
328 | 343 | ||
329 | #define UEFI_PARAM(name, prop, field) \ | 344 | #define UEFI_PARAM(name, prop, field) \ |