summaryrefslogtreecommitdiffstats
path: root/sys/boot/efi/loader/arch/amd64/elf64_freebsd.c
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2016-01-07 04:02:37 +0000
committeremaste <emaste@FreeBSD.org>2016-01-07 04:02:37 +0000
commit7e512433ae5da8eb21b09cbeee9d63820e41199d (patch)
tree66eff858d8278f33ae08ab2b9d3fedac427993c8 /sys/boot/efi/loader/arch/amd64/elf64_freebsd.c
parent5f6f7a834a9a96b2e258879e21984f0a09ae6a95 (diff)
downloadFreeBSD-src-7e512433ae5da8eb21b09cbeee9d63820e41199d.zip
FreeBSD-src-7e512433ae5da8eb21b09cbeee9d63820e41199d.tar.gz
loader.efi: combine GetMemoryMap and ExitBootServices and retry on error
MFC r292338: UEFI: combine GetMemoryMap and ExitBootServices and retry on error The EFI memory map may change before or during the first ExitBootServices call. In that case ExitBootServices returns an error, and GetMemoryMap and ExitBootServices must be retried. Glue together calls to GetMemoryMap(), ExitBootServices() and storage of (now up-to-date) MODINFOMD_EFI_MAP metadata within a single function. That new function - bi_add_efi_data_and_exit() - uses space previously allocated in bi_load_efi_data() to store the memory map (it will fail if that space is too short). It handles re-calling GetMemoryMap() once to update the map key if necessary. Finally, if ExitBootServices() is successful, it stores the memory map and its header as MODINFOMD_EFI_MAP metadata. ExitBootServices() calls are now done earlier, from within arch- independent bi_load() code. MFC r292442: loader.efi: show EFI error number, not full status value EFI return values set the high bit to indicate an error. The log messages changed here are printed only in the case of an error, so including the error bit is redundant. Also switch to decimal to match the error definitions (in sys/boot/efi/include/efierr.h). MFC r292515: loader.efi: refresh size in GetMemoryMap retry loop If ExitBootServices fails due to a changed efi_mapkey then GetMemoryMap must be called again. In this case it is also possible for the memory map to grow, so repeat the initial GetMemoryMap call to fetch the new size. Also roll bi_add_efi_data_and_exit into bi_load_efi_data as there's no need for it to be a separate function. PR: 202455 Relnotes: Yes Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/boot/efi/loader/arch/amd64/elf64_freebsd.c')
-rw-r--r--sys/boot/efi/loader/arch/amd64/elf64_freebsd.c7
1 files changed, 0 insertions, 7 deletions
diff --git a/sys/boot/efi/loader/arch/amd64/elf64_freebsd.c b/sys/boot/efi/loader/arch/amd64/elf64_freebsd.c
index 0c26072..c1dbec2 100644
--- a/sys/boot/efi/loader/arch/amd64/elf64_freebsd.c
+++ b/sys/boot/efi/loader/arch/amd64/elf64_freebsd.c
@@ -174,13 +174,6 @@ elf64_exec(struct preloaded_file *fp)
if (err != 0)
return(err);
- status = BS->ExitBootServices(IH, efi_mapkey);
- if (EFI_ERROR(status)) {
- printf("%s: ExitBootServices() returned 0x%lx\n", __func__,
- (long)status);
- return (EINVAL);
- }
-
dev_cleanup();
trampoline(trampstack, efi_copy_finish, kernend, modulep, PT4,
OpenPOWER on IntegriCloud