From nobody Tue Nov 26 14:39:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+52230+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+52230+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1576287161; cv=none; d=zohomail.com; s=zohoarc; b=RykcQWfDCRbymlW8NilAnCUzrKqb5A/WZwMMdtuSXu+D2GtGTr4WsGPEWY19sGfLRLMdYgMpTe9v9wCMD9MP8eCndrUXpNWdFrZiX5QgVdQ4HDNCE6SVhEOHnR7sVAzB9iUbSITG3MR6y2AcxkMx5TFbeRVgO4CNSdDsr2y7P7c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576287161; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=I+feIN4nSMiUOHeU6sz6hhmMNRbLYdqKzxVC871RNQU=; b=FW9BmrJ+MukDzQ7bBtkZ6+COBIkYi+pRvI+do6Nphgsiii0UlGZBPptMUXdAOVpJhdIws4HM/zTWZMdj+18C0ytzefaL77vSNO+Z5nir5A6rCRKz1JwLNWjcow3I5nwALLFHlsISib7JX1Puxg9KpKI28O4r0MRyUHavCD/LVM0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+52230+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1576287161864477.659554373825; Fri, 13 Dec 2019 17:32:41 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id QsWHYY1788612xCC27Cq2Piu; Fri, 13 Dec 2019 17:32:41 -0800 X-Received: from mga01.intel.com (mga01.intel.com []) by mx.groups.io with SMTP id smtpd.web10.2430.1576287158438932734 for ; Fri, 13 Dec 2019 17:32:39 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Dec 2019 17:32:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,311,1571727600"; d="scan'208";a="297091523" X-Received: from paagyema-desk2.amr.corp.intel.com ([10.24.15.84]) by orsmga001.jf.intel.com with ESMTP; 13 Dec 2019 17:32:38 -0800 From: "Agyeman, Prince" To: devel@edk2.groups.io Cc: Michael Kubacki , Chasel Chiu , Nate DeSimone Subject: [edk2-devel] [edk2-platforms] [PATCH 06/11] BoardModulePkg: Add Generic BoardBootManagerLib Date: Fri, 13 Dec 2019 17:32:32 -0800 Message-Id: <97f98fc0ed58cf75513694f674f8c0124dbab647.1576282834.git.prince.agyeman@intel.com> In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,prince.agyeman@intel.com X-Gm-Message-State: 2kPz0i4FChdRGyZ0fQNshxQzx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1576287161; bh=YAt3SDEaT2XTtrIBk6go3H5lOVSG78X4oTLDvYfgwMg=; h=Cc:Date:From:Reply-To:Subject:To; b=oVTCFxHOHWDW8fct+2Dl8bBlZQnyjSATubB/8Q+r4s4HrgTdZuHwiLk+DZbgsXvL+8a 6wPq2hvnc+htevrCBmXhlAyD5kLxYgRPTj0veublCSo5CPqWMj0t2a4qRC3UvNpBG4Ky7 7Bg8qLc14r+WgcdR5hTLGnj1DaEblvKdu70= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" This library implements a generic PlatformBootManagerWaitCallback and PlatformBootManagerUnableToBoot which will be linked Minplatform's PlatformBootManager library instance. Cc: Michael Kubacki Cc: Chasel Chiu Cc: Nate DeSimone Signed-off-by: Prince Agyeman Reviewed-by: Michael Kubacki Reviewed-by: Nate DeSimone --- .../BoardBootManagerLib/BoardBootManager.c | 103 ++++++++++++++++++ .../BoardBootManagerLib.inf | 39 +++++++ .../BoardBootManagerLib.c | 2 +- 3 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 Platform/Intel/BoardModulePkg/Library/BoardBootManagerL= ib/BoardBootManager.c create mode 100644 Platform/Intel/BoardModulePkg/Library/BoardBootManagerL= ib/BoardBootManagerLib.inf diff --git a/Platform/Intel/BoardModulePkg/Library/BoardBootManagerLib/Boar= dBootManager.c b/Platform/Intel/BoardModulePkg/Library/BoardBootManagerLib/= BoardBootManager.c new file mode 100644 index 0000000000..f6628d4125 --- /dev/null +++ b/Platform/Intel/BoardModulePkg/Library/BoardBootManagerLib/BoardBootMa= nager.c @@ -0,0 +1,103 @@ +/** @file + This file include board specific boot manager callbacks + + Copyright (c) 2019, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + + +#include +#include +#include +#include +#include +#include +#include +#include + + +BOOLEAN mHotKeypressed =3D FALSE; +EFI_EVENT HotKeyEvent =3D NULL; +UINTN mBootMenuOptionNumber; + +/** + This function is called each second during the boot manager waits timeou= t. + + @param TimeoutRemain The remaining timeout. +**/ +VOID +EFIAPI +BoardBootManagerWaitCallback ( + UINT16 TimeoutRemain + ) +{ + EFI_STATUS Status; + EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TxtInEx; + EFI_KEY_DATA KeyData; + BOOLEAN PausePressed; + + // + // Pause on PAUSE key + // + Status =3D gBS->HandleProtocol (gST->ConsoleInHandle, &gEfiSimpleTextInp= utExProtocolGuid, (VOID **) &TxtInEx); + ASSERT_EFI_ERROR (Status); + + PausePressed =3D FALSE; + + while (TRUE) { + Status =3D TxtInEx->ReadKeyStrokeEx (TxtInEx, &KeyData); + if (EFI_ERROR (Status)) { + break; + } + + if (KeyData.Key.ScanCode =3D=3D SCAN_PAUSE) { + PausePressed =3D TRUE; + break; + } + } + + // + // Loop until non-PAUSE key pressed + // + while (PausePressed) { + Status =3D TxtInEx->ReadKeyStrokeEx (TxtInEx, &KeyData); + if (!EFI_ERROR (Status)) { + DEBUG (( + DEBUG_INFO, "[PauseCallback] %x/%x %x/%x\n", + KeyData.Key.ScanCode, KeyData.Key.UnicodeChar, + KeyData.KeyState.KeyShiftState, KeyData.KeyState.KeyToggleState + )); + PausePressed =3D (BOOLEAN) (KeyData.Key.ScanCode =3D=3D SCAN_PAUSE); + } + } +} + +/** + The function is called when no boot option could be launched, + including platform recovery options and options pointing to applications + built into firmware volumes. + + If this function returns, BDS attempts to enter an infinite loop. +**/ +VOID +EFIAPI +BoardBootManagerUnableToBoot ( + VOID + ) +{ + EFI_STATUS Status; + EFI_BOOT_MANAGER_LOAD_OPTION BootDeviceList; + CHAR16 OptionName[sizeof ("Boot####")]; + + if (mBootMenuOptionNumber =3D=3D LoadOptionNumberUnassigned) { + return; + } + UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", mBootMenuOp= tionNumber); + Status =3D EfiBootManagerVariableToLoadOption (OptionName, &BootDeviceLi= st); + if (EFI_ERROR (Status)) { + return; + } + for (;;) { + EfiBootManagerBoot (&BootDeviceList); + } +} diff --git a/Platform/Intel/BoardModulePkg/Library/BoardBootManagerLib/Boar= dBootManagerLib.inf b/Platform/Intel/BoardModulePkg/Library/BoardBootManage= rLib/BoardBootManagerLib.inf new file mode 100644 index 0000000000..38ff52ca81 --- /dev/null +++ b/Platform/Intel/BoardModulePkg/Library/BoardBootManagerLib/BoardBootMa= nagerLib.inf @@ -0,0 +1,39 @@ +## @file +# The module definition file for BoardBootManagerLib. +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D BoardBootManagerLib + FILE_GUID =3D E7512AE0-6CB1-47ED-B6FF-94A97A86BABB + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D BoardBootManagerLib|DXE_DRIVER + + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D IA32 X64 EBC +# + +[Sources] + BoardBootManager.c + +[LibraryClasses] + BaseLib + UefiBootServicesTableLib + DebugLib + UefiLib + HobLib + UefiBootManagerLib + TimerLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MinPlatformPkg/MinPlatformPkg.dec diff --git a/Platform/Intel/MinPlatformPkg/Bds/Library/BoardBootManagerLibN= ull/BoardBootManagerLib.c b/Platform/Intel/MinPlatformPkg/Bds/Library/Board= BootManagerLibNull/BoardBootManagerLib.c index 46fce8f59f..6bc518f02c 100644 --- a/Platform/Intel/MinPlatformPkg/Bds/Library/BoardBootManagerLibNull/Boa= rdBootManagerLib.c +++ b/Platform/Intel/MinPlatformPkg/Bds/Library/BoardBootManagerLibNull/Boa= rdBootManagerLib.c @@ -1,7 +1,7 @@ /** @file This file include board specific boot manager callbacks =20 - Copyright (c) 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 --=20 2.19.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#52230): https://edk2.groups.io/g/devel/message/52230 Mute This Topic: https://groups.io/mt/68590736/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-