The branch stable/13 has been updated by tsoome:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=95e283e4d00ff9419fe47b9ff5a33c4a66bf5246

commit 95e283e4d00ff9419fe47b9ff5a33c4a66bf5246
Author:     Warner Losh <[email protected]>
AuthorDate: 2021-11-21 16:05:07 +0000
Commit:     Toomas Soome <[email protected]>
CommitDate: 2022-06-26 05:09:50 +0000

    loader: abstract boot services exiting to libefi function
    
    Move direct call of ExitBootServices to efi_exit_boot_services.  This
    function sets boot_services_active to false so callers don't have to do
    it everywhere (though currently only loader/bootinfo.c is affected).
    
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D32226
    
    (cherry picked from commit 77e3db07898461de458caece30f42adceff222a9)
---
 stand/efi/include/efilib.h  | 12 ++++++++++++
 stand/efi/loader/bootinfo.c |  6 ++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/stand/efi/include/efilib.h b/stand/efi/include/efilib.h
index b9b9030afd7f..903e1f0d00e5 100644
--- a/stand/efi/include/efilib.h
+++ b/stand/efi/include/efilib.h
@@ -69,9 +69,21 @@ pdinfo_t *efiblk_get_pdinfo(struct devdesc *dev);
 pdinfo_t *efiblk_get_pdinfo_by_handle(EFI_HANDLE h);
 pdinfo_t *efiblk_get_pdinfo_by_device_path(EFI_DEVICE_PATH *path);
 
+/* libefi.c */
 void *efi_get_table(EFI_GUID *tbl);
 EFI_STATUS OpenProtocolByHandle(EFI_HANDLE, EFI_GUID *, void **);
 
+static inline EFI_STATUS
+efi_exit_boot_services(UINTN key)
+{
+       EFI_STATUS status;
+
+       status = BS->ExitBootServices(IH, key);
+       if (!EFI_ERROR(status))
+               boot_services_active = false;
+       return (status);
+}
+
 int efi_getdev(void **vdev, const char *devspec, const char **path);
 char *efi_fmtdev(void *vdev);
 int efi_setcurrdev(struct env_var *ev, int flags, const void *value);
diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c
index 4bf13d1760ff..b560bf268aad 100644
--- a/stand/efi/loader/bootinfo.c
+++ b/stand/efi/loader/bootinfo.c
@@ -393,11 +393,9 @@ bi_load_efi_data(struct preloaded_file *kfp)
                        sz = (EFI_PAGE_SIZE * pages) - efisz;
                }
 
-               status = BS->ExitBootServices(IH, efi_mapkey);
-               if (!EFI_ERROR(status)) {
-                       boot_services_active = false;
+               status = efi_exit_boot_services(efi_mapkey);
+               if (!EFI_ERROR(status))
                        break;
-               }
        }
 
        if (retry == 0) {

Reply via email to