diff options
author | Matthew Garrett <matthew.garrett@nebula.com> | 2013-04-15 16:09:46 -0400 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2013-04-15 16:31:09 -0400 |
commit | cc5a080c5d40c36089bb08a8a16fa3fc7047fe0f (patch) | |
tree | bd3160fc5b3ce71036d5e218ecd5e3dbf1632d02 /arch/x86/platform | |
parent | 0635eb8a54cf0fea64b174bb68bc36b9c3d622db (diff) |
efi: Pass boot services variable info to runtime code
EFI variables can be flagged as being accessible only within boot services.
This makes it awkward for us to figure out how much space they use at
runtime. In theory we could figure this out by simply comparing the results
from QueryVariableInfo() to the space used by all of our variables, but
that fails if the platform doesn't garbage collect on every boot. Thankfully,
calling QueryVariableInfo() while still inside boot services gives a more
reliable answer. This patch passes that information from the EFI boot stub
up to the efi platform code.
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'arch/x86/platform')
-rw-r--r-- | arch/x86/platform/efi/efi.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 3f96a487aa2a..977d1ce7e173 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c | |||
@@ -69,6 +69,10 @@ struct efi_memory_map memmap; | |||
69 | static struct efi efi_phys __initdata; | 69 | static struct efi efi_phys __initdata; |
70 | static efi_system_table_t efi_systab __initdata; | 70 | static efi_system_table_t efi_systab __initdata; |
71 | 71 | ||
72 | static u64 efi_var_store_size; | ||
73 | static u64 efi_var_remaining_size; | ||
74 | static u64 efi_var_max_var_size; | ||
75 | |||
72 | unsigned long x86_efi_facility; | 76 | unsigned long x86_efi_facility; |
73 | 77 | ||
74 | /* | 78 | /* |
@@ -682,6 +686,9 @@ void __init efi_init(void) | |||
682 | char vendor[100] = "unknown"; | 686 | char vendor[100] = "unknown"; |
683 | int i = 0; | 687 | int i = 0; |
684 | void *tmp; | 688 | void *tmp; |
689 | struct setup_data *data; | ||
690 | struct efi_var_bootdata *efi_var_data; | ||
691 | u64 pa_data; | ||
685 | 692 | ||
686 | #ifdef CONFIG_X86_32 | 693 | #ifdef CONFIG_X86_32 |
687 | if (boot_params.efi_info.efi_systab_hi || | 694 | if (boot_params.efi_info.efi_systab_hi || |
@@ -699,6 +706,20 @@ void __init efi_init(void) | |||
699 | if (efi_systab_init(efi_phys.systab)) | 706 | if (efi_systab_init(efi_phys.systab)) |
700 | return; | 707 | return; |
701 | 708 | ||
709 | pa_data = boot_params.hdr.setup_data; | ||
710 | while (pa_data) { | ||
711 | data = early_ioremap(pa_data, sizeof(*efi_var_data)); | ||
712 | if (data->type == SETUP_EFI_VARS) { | ||
713 | efi_var_data = (struct efi_var_bootdata *)data; | ||
714 | |||
715 | efi_var_store_size = efi_var_data->store_size; | ||
716 | efi_var_remaining_size = efi_var_data->remaining_size; | ||
717 | efi_var_max_var_size = efi_var_data->max_var_size; | ||
718 | } | ||
719 | pa_data = data->next; | ||
720 | early_iounmap(data, sizeof(*efi_var_data)); | ||
721 | } | ||
722 | |||
702 | set_bit(EFI_SYSTEM_TABLES, &x86_efi_facility); | 723 | set_bit(EFI_SYSTEM_TABLES, &x86_efi_facility); |
703 | 724 | ||
704 | /* | 725 | /* |