[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 16/23] efi: split out efi_variables()
From: |
Daniel Kiper |
Subject: |
[PATCH v2 16/23] efi: split out efi_variables() |
Date: |
Mon, 20 Jul 2015 16:29:11 +0200 |
..which collects variable store parameters. We want to re-use this
code to support multiboot2 protocol on EFI platforms.
Signed-off-by: Daniel Kiper <address@hidden>
---
v2 - suggestions/fixes:
- improve commit message
(suggested by Jan Beulich).
---
xen/common/efi/boot.c | 41 ++++++++++++++++++++++++-----------------
1 file changed, 24 insertions(+), 17 deletions(-)
diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index fd62125..177697a 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -837,6 +837,29 @@ static void __init setup_efi_pci(void)
efi_bs->FreePool(handles);
}
+static void __init efi_variables(void)
+{
+ EFI_STATUS status;
+
+ status = (efi_rs->Hdr.Revision >> 16) >= 2 ?
+ efi_rs->QueryVariableInfo(EFI_VARIABLE_NON_VOLATILE |
+ EFI_VARIABLE_BOOTSERVICE_ACCESS |
+ EFI_VARIABLE_RUNTIME_ACCESS,
+ &efi_boot_max_var_store_size,
+ &efi_boot_remain_var_store_size,
+ &efi_boot_max_var_size) :
+ EFI_INCOMPATIBLE_VERSION;
+ if ( EFI_ERROR(status) )
+ {
+ efi_boot_max_var_store_size = 0;
+ efi_boot_remain_var_store_size = 0;
+ efi_boot_max_var_size = status;
+ PrintStr(L"Warning: Could not query variable store: ");
+ DisplayUint(status, 0);
+ PrintStr(newline);
+ }
+}
+
static int __init __maybe_unused set_color(u32 mask, int bpp, u8 *pos, u8 *sz)
{
if ( bpp < 0 )
@@ -1078,23 +1101,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE
*SystemTable)
setup_efi_pci();
/* Get snapshot of variable store parameters. */
- status = (efi_rs->Hdr.Revision >> 16) >= 2 ?
- efi_rs->QueryVariableInfo(EFI_VARIABLE_NON_VOLATILE |
- EFI_VARIABLE_BOOTSERVICE_ACCESS |
- EFI_VARIABLE_RUNTIME_ACCESS,
- &efi_boot_max_var_store_size,
- &efi_boot_remain_var_store_size,
- &efi_boot_max_var_size) :
- EFI_INCOMPATIBLE_VERSION;
- if ( EFI_ERROR(status) )
- {
- efi_boot_max_var_store_size = 0;
- efi_boot_remain_var_store_size = 0;
- efi_boot_max_var_size = status;
- PrintStr(L"Warning: Could not query variable store: ");
- DisplayUint(status, 0);
- PrintStr(newline);
- }
+ efi_variables();
efi_arch_memory_setup();
--
1.7.10.4
- [PATCH v2 04/23] x86/boot: call reloc() using cdecl calling convention, (continued)
- [PATCH v2 04/23] x86/boot: call reloc() using cdecl calling convention, Daniel Kiper, 2015/07/20
- [PATCH v2 03/23] x86: zero BSS using stosl instead of stosb, Daniel Kiper, 2015/07/20
- [PATCH v2 07/23] x86/boot/reloc: Rename some variables and rearrange code a bit, Daniel Kiper, 2015/07/20
- [PATCH v2 06/23] x86/boot: use %ecx instead of %eax, Daniel Kiper, 2015/07/20
- [PATCH v2 05/23] x86/boot/reloc: create generic alloc and copy functions, Daniel Kiper, 2015/07/20
- [PATCH v2 08/23] x86: add multiboot2 protocol support, Daniel Kiper, 2015/07/20
- [PATCH v2 11/23] efi: split out efi_init(), Daniel Kiper, 2015/07/20
- [PATCH v2 12/23] efi: split out efi_console_set_mode(), Daniel Kiper, 2015/07/20
- [PATCH v2 02/23] x86/boot: copy only text section from *.lnk file to *.bin file, Daniel Kiper, 2015/07/20
- [PATCH v2 13/23] efi: split out efi_get_gop(), Daniel Kiper, 2015/07/20
- [PATCH v2 16/23] efi: split out efi_variables(),
Daniel Kiper <=
- [PATCH v2 19/23] x86/efi: create new early memory allocator, Daniel Kiper, 2015/07/20
- [PATCH v2 18/23] efi: split out efi_exit_boot(), Daniel Kiper, 2015/07/20
- [PATCH v2 21/23] x86/boot: implement early command line parser in C, Daniel Kiper, 2015/07/20
- [PATCH v2 20/23] x86: add multiboot2 protocol support for EFI platforms, Daniel Kiper, 2015/07/20
- [PATCH v2 09/23] efi: create efi_enabled(), Daniel Kiper, 2015/07/20
- [PATCH v2 14/23] efi: split out efi_find_gop_mode(), Daniel Kiper, 2015/07/20
- [PATCH v2 10/23] efi: build xen.gz with EFI code, Daniel Kiper, 2015/07/20
- [PATCH v2 22/23] x86: make Xen early boot code relocatable, Daniel Kiper, 2015/07/20
- [PATCH v2 17/23] efi: split out efi_set_gop_mode(), Daniel Kiper, 2015/07/20
- [PATCH v2 15/23] efi: split out efi_tables(), Daniel Kiper, 2015/07/20