forked from QubesOS/qubes-vmm-xen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0200-EFI-early-Add-noexit-to-inhibit-calling-ExitBootServ.patch
104 lines (89 loc) · 4.49 KB
/
0200-EFI-early-Add-noexit-to-inhibit-calling-ExitBootServ.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
From bf8e7496d95c2a71a3bdac4340e1a9c03b86b0af Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <konrad@xxxxxxxxxx>
Date: Fri, 24 Apr 2015 16:47:18 -0400
Subject: [PATCH] EFI/early: Add /noexit to inhibit calling ExitBootServices
The '/noexitboot' parameter will inhibit Xen in calling ExitBootServices.
That helps with some platforms with GetNextVariableName which
cannot deal running in 1-1 mode and having BootSevices being disabled.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Ported to Xen 4.7.0
Signed-off-by: Marcus of Wetware Labs <[email protected]>
---
xen/arch/x86/efi/efi-boot.h | 2 +-
xen/common/efi/boot.c | 16 +++++++++++-----
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index f282358435f1..39cc8baef4bc 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -909,7 +909,7 @@ void asmlinkage __init efi_multiboot2(EFI_HANDLE ImageHandle,
efi_relocate_esrt(SystemTable);
- efi_exit_boot(ImageHandle, SystemTable);
+ efi_exit_boot(ImageHandle, SystemTable, true);
}
/*
diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index efbec00af9da..8004cf4d1303 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -146,7 +146,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, bool exit_boot_services);
static const EFI_BOOT_SERVICES *__initdata efi_bs;
static UINT32 __initdata efi_bs_revision;
@@ -1180,7 +1180,7 @@ static void __init efi_set_gop_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, UINTN gop
#define INVALID_VIRTUAL_ADDRESS (0xBAAADUL << \
(EFI_PAGE_SHIFT + BITS_PER_LONG - 32))
-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, bool exit_boot_services)
{
EFI_STATUS status;
UINTN info_size = 0, map_key;
@@ -1211,8 +1211,11 @@ static void __init efi_exit_boot(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *Syste
efi_arch_pre_exit_boot();
- status = SystemTable->BootServices->ExitBootServices(ImageHandle,
+ if (exit_boot_services)
+ status = SystemTable->BootServices->ExitBootServices(ImageHandle,
map_key);
+ else
+ status = 0;
efi_bs = NULL;
if ( status != EFI_INVALID_PARAMETER || retry )
break;
@@ -1268,7 +1271,7 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle,
EFI_SHIM_LOCK_PROTOCOL *shim_lock;
EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = NULL;
union string section = { NULL }, name;
- bool base_video = false;
+ bool base_video = false, exit_boot_services = true;
const char *option_str;
bool use_cfg_file;
int dt_modules_found;
@@ -1318,6 +1321,8 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle,
base_video = true;
else if ( wstrcmp(ptr + 1, L"mapbs") == 0 )
map_bs = true;
+ else if ( wstrcmp(ptr + 1, L"noexitboot") == 0 )
+ exit_boot_services = false;
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 )
@@ -1328,6 +1333,7 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle,
PrintStr(L"Xen EFI Loader options:\r\n");
PrintStr(L"-basevideo retain current video mode\r\n");
PrintStr(L"-mapbs map EfiBootServices{Code,Data}\r\n");
+ PrintStr(L"-noexitboot Do not call ExitBootServices\r\n");
PrintStr(L"-cfg=<file> specify configuration file\r\n");
PrintStr(L"-help, -? display this help\r\n");
blexit(NULL);
@@ -1541,7 +1547,7 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle,
efi_relocate_esrt(SystemTable);
- efi_exit_boot(ImageHandle, SystemTable);
+ efi_exit_boot(ImageHandle, SystemTable, exit_boot_services);
efi_arch_post_exit_boot(); /* Doesn't return. */
}
--
2.44.0