From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web12.5259.1576632846668113557 for ; Tue, 17 Dec 2019 17:34:06 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: nathaniel.l.desimone@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Dec 2019 17:34:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,327,1571727600"; d="scan'208";a="247695293" Received: from orsmsx103.amr.corp.intel.com ([10.22.225.130]) by fmsmga002.fm.intel.com with ESMTP; 17 Dec 2019 17:34:05 -0800 Received: from orsmsx115.amr.corp.intel.com (10.22.240.11) by ORSMSX103.amr.corp.intel.com (10.22.225.130) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 17 Dec 2019 17:34:05 -0800 Received: from orsmsx114.amr.corp.intel.com ([169.254.8.106]) by ORSMSX115.amr.corp.intel.com ([169.254.4.94]) with mapi id 14.03.0439.000; Tue, 17 Dec 2019 17:34:05 -0800 From: "Nate DeSimone" To: "Agyeman, Prince" CC: "devel@edk2.groups.io" , "Kubacki, Michael A" , "Chiu, Chasel" Subject: Re: [edk2-platforms] [PATCH 06/11] BoardModulePkg: Add Generic BoardBootManagerLib Thread-Topic: [edk2-platforms] [PATCH 06/11] BoardModulePkg: Add Generic BoardBootManagerLib Thread-Index: AQHVsh5jiOTCQvOK/UqiyXKvKSdLxae/qFYA Date: Wed, 18 Dec 2019 01:34:04 +0000 Message-ID: <20191218013404.GG1930@nate-virtualbox> References: <97f98fc0ed58cf75513694f674f8c0124dbab647.1576282834.git.prince.agyeman@intel.com> In-Reply-To: <97f98fc0ed58cf75513694f674f8c0124dbab647.1576282834.git.prince.agyeman@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.7.159.63] MIME-Version: 1.0 Return-Path: nathaniel.l.desimone@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-ID: <20A9DD77BCF33140A398FC3242687FA5@intel.com> Content-Transfer-Encoding: quoted-printable Hi Prince, Reviewed-by: Nate DeSimone Thanks, Nate On Sat, Dec 14, 2019 at 01:32:32AM +0000, Agyeman, Prince wrote: > This library implements a generic PlatformBootManagerWaitCallback > and PlatformBootManagerUnableToBoot which will be linked Minplatform's > PlatformBootManager library instance. >=20 > Cc: Michael Kubacki > Cc: Chasel Chiu > Cc: Nate DeSimone >=20 > Signed-off-by: Prince Agyeman > --- > .../BoardBootManagerLib/BoardBootManager.c | 103 ++++++++++++++++++ > .../BoardBootManagerLib.inf | 39 +++++++ > .../BoardBootManagerLib.c | 2 +- > 3 files changed, 143 insertions(+), 1 deletion(-) > create mode 100644 Platform/Intel/BoardModulePkg/Library/BoardBootManage= rLib/BoardBootManager.c > create mode 100644 Platform/Intel/BoardModulePkg/Library/BoardBootManage= rLib/BoardBootManagerLib.inf >=20 > diff --git a/Platform/Intel/BoardModulePkg/Library/BoardBootManagerLib/Bo= ardBootManager.c b/Platform/Intel/BoardModulePkg/Library/BoardBootManagerLi= b/BoardBootManager.c > new file mode 100644 > index 0000000000..f6628d4125 > --- /dev/null > +++ b/Platform/Intel/BoardModulePkg/Library/BoardBootManagerLib/BoardBoot= Manager.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 time= out. > + > + @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, &gEfiSimpleTextI= nputExProtocolGuid, (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 applicatio= ns > + 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", mBootMenu= OptionNumber); > + Status =3D EfiBootManagerVariableToLoadOption (OptionName, &BootDevice= List); > + if (EFI_ERROR (Status)) { > + return; > + } > + for (;;) { > + EfiBootManagerBoot (&BootDeviceList); > + } > +} > diff --git a/Platform/Intel/BoardModulePkg/Library/BoardBootManagerLib/Bo= ardBootManagerLib.inf b/Platform/Intel/BoardModulePkg/Library/BoardBootMana= gerLib/BoardBootManagerLib.inf > new file mode 100644 > index 0000000000..38ff52ca81 > --- /dev/null > +++ b/Platform/Intel/BoardModulePkg/Library/BoardBootManagerLib/BoardBoot= ManagerLib.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-94A97A86BAB= B > + 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 th= e 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/BoardBootManagerLi= bNull/BoardBootManagerLib.c b/Platform/Intel/MinPlatformPkg/Bds/Library/Boa= rdBootManagerLibNull/BoardBootManagerLib.c > index 46fce8f59f..6bc518f02c 100644 > --- a/Platform/Intel/MinPlatformPkg/Bds/Library/BoardBootManagerLibNull/B= oardBootManagerLib.c > +++ b/Platform/Intel/MinPlatformPkg/Bds/Library/BoardBootManagerLibNull/B= oardBootManagerLib.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 > =