From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smarthost01c.ixn.mail.zen.net.uk (smarthost01c.ixn.mail.zen.net.uk [212.23.1.22]) by mx.groups.io with SMTP id smtpd.web12.1969.1644528228700827160 for ; Thu, 10 Feb 2022 13:23:49 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=permerror, err=parse error for token &{10 18 sdn.klaviyomail.com}: permanent DNS error (domain: starlabs.systems, ip: 212.23.1.22, mailfrom: sean@starlabs.systems) Received: from [217.155.46.38] (helo=sean-StarBook.lan) by smarthost01c.ixn.mail.zen.net.uk with esmtp (Exim 4.90_1) (envelope-from ) id 1nIGuo-0000bg-NB; Thu, 10 Feb 2022 21:23:46 +0000 From: "Sean Rhodes" To: devel@edk2.groups.io Cc: guo.dong@intel.com, Sean Rhodes Subject: [PATCH 05/18] UefiPayloadPkg: Make Boot Manager Key configurable Date: Thu, 10 Feb 2022 21:23:45 +0000 Message-Id: <33cf996698068a1ed50aac245de047b103137687.1644527848.git.sean@starlabs.systems> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 X-Originating-smarthost01c-IP: [217.155.46.38] Feedback-ID: 217.155.46.38 Content-Transfer-Encoding: quoted-printable Provide a build option to use [Esc] instead of [F2] for devices such as Chromebooks that don't have F-keys. Signed-off-by: Sean Rhodes --- .../PlatformBootManager.c | 44 +++++++++++++------ .../PlatformBootManagerLib.inf | 2 + UefiPayloadPkg/UefiPayloadPkg.dec | 3 ++ UefiPayloadPkg/UefiPayloadPkg.dsc | 4 ++ 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootMana= ger.c b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c index 3bded489ef..6174ca7896 100644 --- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c +++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c @@ -164,7 +164,7 @@ PlatformBootManagerBeforeConsole ( )=0D {=0D EFI_INPUT_KEY Enter;=0D - EFI_INPUT_KEY F2;=0D + EFI_INPUT_KEY CustomKey;=0D EFI_INPUT_KEY Down;=0D EFI_BOOT_MANAGER_LOAD_OPTION BootOption;=0D EFI_STATUS Status;=0D @@ -186,13 +186,22 @@ PlatformBootManagerBeforeConsole ( Enter.UnicodeChar =3D CHAR_CARRIAGE_RETURN;=0D EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL);=0D =0D - //=0D - // Map F2 to Boot Manager Menu=0D - //=0D - F2.ScanCode =3D SCAN_F2;=0D - F2.UnicodeChar =3D CHAR_NULL;=0D + if (FixedPcdGetBool (PcdBootManagerEscape)) {=0D + //=0D + // Map Esc to Boot Manager Menu=0D + //=0D + CustomKey.ScanCode =3D SCAN_ESC;=0D + CustomKey.UnicodeChar =3D CHAR_NULL;=0D + } else {=0D + //=0D + // Map Esc to Boot Manager Menu=0D + //=0D + CustomKey.ScanCode =3D SCAN_F2;=0D + CustomKey.UnicodeChar =3D CHAR_NULL;=0D + }=0D +=0D EfiBootManagerGetBootManagerMenu (&BootOption);=0D - EfiBootManagerAddKeyOptionVariable (NULL, (UINT16)BootOption.OptionNumbe= r, 0, &F2, NULL);=0D + EfiBootManagerAddKeyOptionVariable (NULL, (UINT16)BootOption.OptionNumbe= r, 0, &CustomKey, NULL);=0D =0D //=0D // Also add Down key to Boot Manager Menu since some serial terminals do= n't support F2 key.=0D @@ -256,12 +265,21 @@ PlatformBootManagerAfterConsole ( //=0D PlatformRegisterFvBootOption (PcdGetPtr (PcdShellFile), L"UEFI Shell", L= OAD_OPTION_ACTIVE);=0D =0D - Print (=0D - L"\n"=0D - L"F2 or Down to enter Boot Manager Menu.\n"=0D - L"ENTER to boot directly.\n"=0D - L"\n"=0D - );=0D + if (FixedPcdGetBool (PcdBootManagerEscape)) {=0D + Print (=0D + L"\n"=0D + L"Esc or Down to enter Boot Manager Menu.\n"=0D + L"ENTER to boot directly.\n"=0D + L"\n"=0D + );=0D + } else {=0D + Print (=0D + L"\n"=0D + L"F2 or Down to enter Boot Manager Menu.\n"=0D + L"ENTER to boot directly.\n"=0D + L"\n"=0D + );=0D + }=0D }=0D =0D /**=0D diff --git a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootMana= gerLib.inf b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootMana= gerLib.inf index 306bd33b7a..c0bfed26cf 100644 --- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.= inf +++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.= inf @@ -75,3 +75,5 @@ gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits=0D gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile=0D gUefiPayloadPkgTokenSpaceGuid.PcdBootSplashImage=0D + gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape=0D +=0D diff --git a/UefiPayloadPkg/UefiPayloadPkg.dec b/UefiPayloadPkg/UefiPayload= Pkg.dec index 4f5756d575..b01b553cdd 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dec +++ b/UefiPayloadPkg/UefiPayloadPkg.dec @@ -83,6 +83,9 @@ gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSi= ze|0x04000000|UINT32|0x =0D gUefiPayloadPkgTokenSpaceGuid.PcdPcdDriverFile|{ 0x57, 0x72, 0xcf, 0x80, 0= xab, 0x87, 0xf9, 0x47, 0xa3, 0xfe, 0xD5, 0x0B, 0x76, 0xd8, 0x95, 0x41 }|VOI= D*|0x00000018=0D =0D +# Boot Manager Key=0D +gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|FALSE|BOOLEAN|0x0000002= 0=0D +=0D # BootSplash Image=0D gUefiPayloadPkgTokenSpaceGuid.PcdBootSplashImage|TRUE|BOOLEAN|0x00000021=0D =0D diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayload= Pkg.dsc index 82adf98a45..eaad7eee84 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -33,8 +33,10 @@ DEFINE UNIVERSAL_PAYLOAD =3D FALSE=0D DEFINE SECURITY_STUB_ENABLE =3D TRUE=0D DEFINE SMM_SUPPORT =3D FALSE=0D + DEFINE BOOT_MANAGER_ESCAPE =3D FALSE=0D DEFINE BOOTSPLASH_IMAGE =3D FALSE=0D DEFINE FOLLOW_BGRT_SPEC =3D FALSE=0D + DEFINE BOOT_MANAGER_ESCAPE =3D FALSE=0D #=0D # SBL: UEFI payload for Slim Bootloader=0D # COREBOOT: UEFI payload for coreboot=0D @@ -405,6 +407,8 @@ =0D gUefiPayloadPkgTokenSpaceGuid.PcdBootSplashImage|$(BOOTSPLASH_IMAGE)=0D =0D + gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|$(BOOT_MANAGER_ESCAPE= )=0D +=0D [PcdsPatchableInModule.X64]=0D gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|$(RTC_INDEX_REGISTER)= =0D gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister|$(RTC_TARGET_REGISTER= )=0D --=20 2.32.0