From nobody Sun Jun 26 08:25:36 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 63F4C8718A7; Sun, 26 Jun 2022 08:25:36 +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 4LW3p82LMwz4hmB; Sun, 26 Jun 2022 08:25:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656231936; 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=Q4CUh7Lu8oKZvObnkwnj0MD3/+fGfUnA4KrleChHGUk=; b=W/hBF2JENb8wKKbmNxcrV8uyBZ6NTwEZuIkZLkUSaMOosagTIsSybU+8gYFQi86Cd/DR1H AtRyBA31tqivTIznkTlLN0AU+58i6BAgOmYJiQnAhrDJ2/2Xih9osHLi8J3OItR3cXpTaP puqMEarHdZhWVZ6EQaFNKo+Sn0ak5BbaRcuXDsKnmGWZy725xCCCKaO0LhDzIvPYkOfA8Y ajZ64yz+yW93KfDjupejKvqPFA4p7/eSeS0WUpNmMiQIwq1m3/9emIxTmiRdmAmxOKgQnY d+stTsSIqO0Ac29+agouvVhi1RJYQg6BUuAF8I+QrhsSX3+QoRSMMmLu1zDMaw== 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 2C6D514335; Sun, 26 Jun 2022 08:25:36 +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 25Q8Pagh077704; Sun, 26 Jun 2022 08:25:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25Q8Pav5077703; Sun, 26 Jun 2022 08:25:36 GMT (envelope-from git) Date: Sun, 26 Jun 2022 08:25:36 GMT Message-Id: <202206260825.25Q8Pav5077703@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: c8e7050f8a6a - stable/13 - efi: switch boot_services_gone to boot_services_active 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: c8e7050f8a6a061f6331f13da0d3ef02c3463b53 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656231936; 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=Q4CUh7Lu8oKZvObnkwnj0MD3/+fGfUnA4KrleChHGUk=; b=JmaoiP81ubtpbha86Z6v3Dn9juIGlsnedbpYzD3A/uzWnLXf4t1j0LKKXmBEsW1a4kwwgo 7SfTuI+HBLucQzjtecDF0nPZGooryry2bLPUlhz6ywrCE5Tzng51aSh7OpE0OLFJoIYSAE tUv566v/2oLHRE4l0mIv/NJWhvyQh3G/eDDB8u4qjCDldNUGOVz/eASrnA87NY3eITAv21 k/W2q5JV+7mktfV3Ek8nRIV1eS5pfA4lwAE/kg585hbsHVRr8EHybvVkiaM47Kg6uPuF/6 zuTPP0pxsLTRn/t6jtaKg/YMpWaJfp61qzj9jRigIZFTwSHZU37ns1bMybTW9A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656231936; a=rsa-sha256; cv=none; b=GNgCRUOtilNFBSpR5yW7a9uVU+omY0/F5dV2HvIj4ALLIFxKQml1d0MsT6szIvWnknBlm2 jY3pJHnD9X3e7W4TPlACh64UZtpicGUrKkxDiHdH605vRwqiq+zK4G78wfMOom/oCUH4Ee cFxEldAYE2/4/mUjMvihUe5bAacYr4BUiduE1dHq5L8wk+FecXgS0ZhTC5B9Uv7tG3Jl6T eti9M6945UePX+F+fTFTnpx4KB3JATJAUWY920S/HlrHAvBJKO++bPEy6Y8qNKc0vL99gc 8tf5610zgIqwDKPYQBGxml2Y+4qk+gMMv+UjcKhu3Zh22n3Nx/3qGQsGBNq6Wg== 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=c8e7050f8a6a061f6331f13da0d3ef02c3463b53 commit c8e7050f8a6a061f6331f13da0d3ef02c3463b53 Author: Warner Losh AuthorDate: 2021-11-04 15:34:20 +0000 Commit: Toomas Soome CommitDate: 2022-06-26 04:58:55 +0000 efi: switch boot_services_gone to boot_services_active Turn the presence or absence of boot services into a positive bool (and change its type to bool). Move declaration to efi.h in the global variables section. Sponsored by: Netflix Reviewed by: tsoome, kib Differential Revision: https://reviews.freebsd.org/D31814 (cherry picked from commit 305ef653bcf349c7dea83c90add6f2d97910e545) --- stand/common/gfx_fb.c | 10 ++++++---- stand/efi/include/efi.h | 2 ++ stand/efi/libefi/efi_console.c | 23 +++++++++++------------ stand/efi/loader/bootinfo.c | 4 +--- stand/efi/loader/copy.c | 4 +--- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index 14524820bea4..b80e9c565944 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -783,14 +783,16 @@ gfxfb_blt(void *BltBuffer, GFXFB_BLT_OPERATION BltOperation, #if defined(EFI) EFI_STATUS status; EFI_GRAPHICS_OUTPUT *gop = gfx_state.tg_private; - extern int boot_services_gone; EFI_TPL tpl; /* - * We assume Blt() does work, if not, we will need to build - * exception list case by case. + * We assume Blt() does work, if not, we will need to build exception + * list case by case. We only have boot services during part of our + * exectution. Once terminate boot services, these operations cannot be + * done as they are provided by protocols that disappear when exit + * boot services. */ - if (gop != NULL && boot_services_gone == 0) { + if (gop != NULL && boot_services_active) { tpl = BS->RaiseTPL(TPL_NOTIFY); switch (BltOperation) { case GfxFbBltVideoFill: diff --git a/stand/efi/include/efi.h b/stand/efi/include/efi.h index fe8d78286529..7e44a5b819fc 100644 --- a/stand/efi/include/efi.h +++ b/stand/efi/include/efi.h @@ -60,11 +60,13 @@ Revision History #include "efitcp.h" #include "efipoint.h" #include "efiuga.h" +#include /* * Global variables */ extern EFI_LOADED_IMAGE *boot_img; +extern bool boot_services_active; /* * FreeBSD UUID diff --git a/stand/efi/libefi/efi_console.c b/stand/efi/libefi/efi_console.c index 1a264b9821f8..7166b7a3cfbe 100644 --- a/stand/efi/libefi/efi_console.c +++ b/stand/efi/libefi/efi_console.c @@ -37,14 +37,15 @@ __FBSDID("$FreeBSD$"); #include #include "bootstrap.h" -extern int boot_services_gone; extern EFI_GUID gop_guid; + +bool boot_services_active = true; /* boot services active first thing in main */ + static EFI_GUID simple_input_ex_guid = EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID; static SIMPLE_TEXT_OUTPUT_INTERFACE *conout; static SIMPLE_INPUT_INTERFACE *conin; static EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *coninex; static bool efi_started; - static int mode; /* Does ConOut have serial console? */ static uint32_t utf8_left; @@ -177,7 +178,7 @@ efi_text_cursor(void *arg, const teken_pos_t *p) teken_gfx_t *state = arg; UINTN col, row; - if (boot_services_gone) + if (!boot_services_active) return; row = p->tp_row; @@ -238,7 +239,7 @@ efi_text_putchar(void *s, const teken_pos_t *p, teken_char_t c, EFI_STATUS status; int idx; - if (boot_services_gone) + if (!boot_services_active) return; idx = p->tp_col + p->tp_row * state->tg_tp.tp_col; @@ -258,7 +259,7 @@ efi_text_fill(void *arg, const teken_rect_t *r, teken_char_t c, teken_gfx_t *state = arg; teken_pos_t p; - if (boot_services_gone) + if (!boot_services_active) return; if (state->tg_cursor_visible) @@ -313,7 +314,7 @@ efi_text_copy(void *arg, const teken_rect_t *r, const teken_pos_t *p) int nrow, ncol, x, y; /* Has to be signed - >= 0 comparison */ bool scroll = false; - if (boot_services_gone) + if (!boot_services_active) return; /* @@ -369,7 +370,7 @@ efi_text_param(void *arg, int cmd, unsigned int value) { teken_gfx_t *state = arg; - if (boot_services_gone) + if (!boot_services_active) return; switch (cmd) { @@ -749,6 +750,8 @@ get_arg(int c) static void efi_term_emu(int c) { + if (!boot_services_active) + return; #ifdef TERM_EMU static int ansi_col[] = { 0, 4, 2, 6, 1, 5, 3, 7 @@ -756,9 +759,6 @@ efi_term_emu(int c) int t, i; EFI_STATUS status; - if (boot_services_gone) - return; - switch (esc) { case 0: switch (c) { @@ -868,8 +868,7 @@ efi_term_emu(int c) break; } #else - if (!boot_services_gone) - efi_cons_rawputchar(c); + efi_cons_rawputchar(c); #endif } diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c index 92ca220e2bf9..4bf13d1760ff 100644 --- a/stand/efi/loader/bootinfo.c +++ b/stand/efi/loader/bootinfo.c @@ -64,8 +64,6 @@ int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp); extern EFI_SYSTEM_TABLE *ST; -int boot_services_gone; - static int bi_getboothowto(char *kargs) { @@ -397,7 +395,7 @@ bi_load_efi_data(struct preloaded_file *kfp) status = BS->ExitBootServices(IH, efi_mapkey); if (!EFI_ERROR(status)) { - boot_services_gone = 1; + boot_services_active = false; break; } } diff --git a/stand/efi/loader/copy.c b/stand/efi/loader/copy.c index 2552ae86d966..47e613ccc2f3 100644 --- a/stand/efi/loader/copy.c +++ b/stand/efi/loader/copy.c @@ -42,8 +42,6 @@ __FBSDID("$FreeBSD$"); #define M(x) ((x) * 1024 * 1024) #define G(x) (1UL * (x) * 1024 * 1024 * 1024) -extern int boot_services_gone; - #if defined(__i386__) || defined(__amd64__) #include #include @@ -370,7 +368,7 @@ efi_check_space(vm_offset_t end) if (end + staging_slop <= staging_end) return (true); - if (boot_services_gone) { + if (!boot_services_active) { if (end <= staging_end) return (true); panic("efi_check_space: cannot expand staging area "