From 33badf8e314251e9d9c3b768c0b7a34b225aa45c Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Tue, 3 Feb 2015 11:56:33 -0500 Subject: [PATCH 1/3] EFI/early: Implement /noexit to not ExitBootServices The /noexitboot will inhibit Xen from calling ExitBootServices. This allows on Lenovo ThinkPad x230 to use GetNextVariableName in 1-1 mapping mode. Signed-off-by: Konrad Rzeszutek Wilk --- xen/arch/x86/efi/efi-boot.h | 2 +- xen/common/efi/boot.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index f50c10a..0fbc4de 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -676,7 +676,7 @@ void __init efi_multiboot2(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable setup_efi_pci(); efi_variables(); efi_set_gop_mode(gop, gop_mode); - efi_exit_boot(ImageHandle, SystemTable); + efi_exit_boot(ImageHandle, SystemTable, 0); } /* diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index d1d06d7..2389a1a 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -86,7 +86,7 @@ static void efi_tables(void); static void setup_efi_pci(void); static void efi_variables(void); static void efi_set_gop_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, UINTN gop_mode); -static void efi_exit_boot(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable); +static void efi_exit_boot(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable, int exit_boot_services); static const EFI_BOOT_SERVICES *__initdata efi_bs; static EFI_HANDLE __initdata efi_ih; @@ -882,7 +882,7 @@ static void __init efi_set_gop_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, UINTN gop efi_arch_video_init(gop, info_size, mode_info); } -static void __init efi_exit_boot(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) +static void __init efi_exit_boot(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable, int exit_boot_services) { EFI_STATUS status; UINTN map_key; @@ -906,7 +906,10 @@ static void __init efi_exit_boot(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *Syste efi_arch_pre_exit_boot(); - status = efi_bs->ExitBootServices(ImageHandle, map_key); + if ( exit_boot_services ) + status = efi_bs->ExitBootServices(ImageHandle, map_key); + else + status = 0; if ( status != EFI_INVALID_PARAMETER || retry ) break; } @@ -1023,6 +1026,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) char *option_str; bool_t use_cfg_file; bool_t query_only = 0; + bool_t exit_boot_services = 1; #ifndef CONFIG_ARM /* TODO - disabled until implemented on ARM */ efi_platform = 1; @@ -1065,6 +1069,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) base_video = 1; else if ( wstrcmp(ptr + 1, L"query") == 0 ) query_only = 1; + else if ( wstrcmp(ptr + 1, L"noexit") == 0 ) + exit_boot_services = 0; else if ( wstrncmp(ptr + 1, L"cfg=", 4) == 0 ) cfg_file_name = ptr + 5; else if ( i + 1 < argc && wstrcmp(ptr + 1, L"cfg") == 0 ) @@ -1076,6 +1082,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) PrintStr(L"-basevideo retain current video mode\r\n"); PrintStr(L"-cfg= specify configuration file\r\n"); PrintStr(L"-query GetNextVariableName up to five\r\n"); + PrintStr(L"-noexit Don't call ExitBootServices\r\n"); PrintStr(L"-help, -? display this help\r\n"); blexit(NULL); } @@ -1242,7 +1249,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) efi_set_gop_mode(gop, gop_mode); - efi_exit_boot(ImageHandle, SystemTable); + efi_exit_boot(ImageHandle, SystemTable, exit_boot_services); efi_arch_post_exit_boot(); for( ; ; ); /* not reached */ -- 2.1.0