summaryrefslogtreecommitdiff
path: root/sys/arch/amd64/stand
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2017-02-08 04:00:05 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2017-02-08 04:00:05 +0000
commit6a179c80f8264c2d3e075f87946e8f030c8f1790 (patch)
tree1abbc880dc508e5f58ab20163352b02f7b9b25de /sys/arch/amd64/stand
parent95497cd05539fff5826d7a46b9e70b33a02c7dac (diff)
Retry BS->ExitBootServices() if it fails.
Reported by Ryan, pulse.purge at gmail.com
Diffstat (limited to 'sys/arch/amd64/stand')
-rw-r--r--sys/arch/amd64/stand/efiboot/efiboot.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/arch/amd64/stand/efiboot/efiboot.c b/sys/arch/amd64/stand/efiboot/efiboot.c
index 29ea212e758..1903862d271 100644
--- a/sys/arch/amd64/stand/efiboot/efiboot.c
+++ b/sys/arch/amd64/stand/efiboot/efiboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: efiboot.c,v 1.14 2016/08/30 20:31:09 yasuoka Exp $ */
+/* $OpenBSD: efiboot.c,v 1.15 2017/02/08 04:00:04 yasuoka Exp $ */
/*
* Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net>
@@ -137,12 +137,18 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
void
efi_cleanup(void)
{
+ int retry;
EFI_STATUS status;
- efi_memprobe_internal(); /* sync the current map */
- status = EFI_CALL(BS->ExitBootServices, IH, mmap_key);
- if (status != EFI_SUCCESS)
- panic("ExitBootServices");
+ /* retry once in case of failure */
+ for (retry = 1; retry >= 0; retry--) {
+ efi_memprobe_internal(); /* sync the current map */
+ status = EFI_CALL(BS->ExitBootServices, IH, mmap_key);
+ if (status == EFI_SUCCESS)
+ break;
+ if (retry == 0)
+ panic("ExitBootServices failed (%d)", status);
+ }
}
/***********************************************************************