From nobody Sun Nov 21 16:07:46 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 48BF5189BF32; Sun, 21 Nov 2021 16:07:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HxwKb1dl1z3nHm; Sun, 21 Nov 2021 16:07:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 14BF711E6D; Sun, 21 Nov 2021 16:07:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ALG7k5Q096224; Sun, 21 Nov 2021 16:07:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ALG7kr9096223; Sun, 21 Nov 2021 16:07:46 GMT (envelope-from git) Date: Sun, 21 Nov 2021 16:07:46 GMT Message-Id: <202111211607.1ALG7kr9096223@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 77e3db078984 - main - loader: abstract boot services exiting to libefi function List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 77e3db07898461de458caece30f42adceff222a9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=77e3db07898461de458caece30f42adceff222a9 commit 77e3db07898461de458caece30f42adceff222a9 Author: Warner Losh AuthorDate: 2021-11-21 16:05:07 +0000 Commit: Warner Losh CommitDate: 2021-11-21 16:05:07 +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 --- 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 5213b328d712..ca7a2c8ce4b8 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, bool exit_bs) if (!exit_bs) break; - 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) {