From nobody Sun Jun 26 08:34:02 2022 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 7C8508727D7; Sun, 26 Jun 2022 08:34:02 +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 4LW3zt33xzz4jPR; Sun, 26 Jun 2022 08:34:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656232442; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JWI+dmwmhMxsdHXHXIX1qkXOgTnUPQvNsSp9wUI4/nM=; b=nMewDHd1dZFadJc9XB1KKGkRvP/6PhnNsqLKO5kpecoMVYhEAIH+L86yND5gmgVnpJzc3R KvgszqFfOCcAwYH2APGnkTpOWV+yDw+2Mv2P5py3F91KtONrEIujc522HZgluX/b9IdzD1 GqgJ9qyH1ujdAHhlLwnHbsh63IRj29JqyM7ExyKYC6E1WTN29+Zlbx4iZiJTuPyUGbEdoU +bs1qgzJs5WNggfpEOB83Lj+N5q+uAIy+06DWo2ixZqEONJmfvtm+KV5RKNAccmEUF9oHu rnxG5HgQWxdsiGYUyJxPTppYUzUnxNd3v+MSZNXL7dlSvmgZ9Zv5j9/FM7hcDA== 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 4917513FDE; Sun, 26 Jun 2022 08:34:02 +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 25Q8Y2O4090516; Sun, 26 Jun 2022 08:34:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25Q8Y2Uu090515; Sun, 26 Jun 2022 08:34:02 GMT (envelope-from git) Date: Sun, 26 Jun 2022 08:34:02 GMT Message-Id: <202206260834.25Q8Y2Uu090515@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Toomas Soome Subject: git: 95e283e4d00f - stable/13 - 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: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 95e283e4d00ff9419fe47b9ff5a33c4a66bf5246 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656232442; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JWI+dmwmhMxsdHXHXIX1qkXOgTnUPQvNsSp9wUI4/nM=; b=xd6U8idSjD62WzZ6lBl9r05o3WzXr/uEwA5O2GAttIIymVYMfBJ0ynYQap3fekK6kXkMSi GUjqHSst+Rhc6WPRKTEidyMb4TYV0zqpdYrQm6RH5BplU4xuS6/fOdrO492B7p4wkyzUZ1 hsmddYTs8ppoXcFO+Z3cJnM+rB+Z+klp+fMpPfrjB3weGoc/iEe2+qZXBU3HofU3Xow/FF jsZMogKUewuuVY/TiAOgBVT+lDgqAGXR42u60u9apxDWtWGsJagtBdipZp+52523Z7RYYa qZtoosy8ul47kzNlEx/RRk7zA/+KwrtiZ92gFrWLHxZ5mZJ8YNFKNgvVuyJUIg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656232442; a=rsa-sha256; cv=none; b=PuFymL1hmS9Uj9bLUe5d2OJe+3cAQZxliWqLC4iDAk6LmRsi0yuE6Zzb8ij2IKM0RBx0XH x0Ka/K1nuUH+SffAb0xKjs5l9SiRKT1ksIKJ6+nUVTXauKwr842m7A7nWf8iCf9aL4E6mQ gQFx06XZdph9s14E1EphjcM16MCt7CpI7IjaNBVge95St6oY+l8DetdDwNiVXTo0G/E7U9 xQHxNxVgiT+oPzsFsbf0t4AGBBTDZ7gi3UwyN83Lfx+3BPgwpMbs3bx/nPubgSLC1fExgW WNOhyJWjRLAlI2trfUAtz1d2T8FWgLQmELrK12P+ppZ9EXjzvbfzT+VTdgs+Og== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=95e283e4d00ff9419fe47b9ff5a33c4a66bf5246 commit 95e283e4d00ff9419fe47b9ff5a33c4a66bf5246 Author: Warner Losh AuthorDate: 2021-11-21 16:05:07 +0000 Commit: Toomas Soome 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) {