From nobody Sun Nov 24 11:50:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+87302+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87302+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1646475282; cv=none; d=zohomail.com; s=zohoarc; b=IhMGAIUlilmnktRVSMI5cN6TuwGaWyD2JV93Gof3ib0NDfUOJuu0HKnvEag01DI8CwfLexCKs3hBA5Mn4lcOlmj3fFqw8f2G7z1o1fjaMCucFVMmFcvdr7ejTEB6ZKmU43rc44BsH4NVg4BlVczA1Jai8mp99Pdd06FyMy9Q+Rs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646475282; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=u0XdIU/XOa6m96difsF07ZA2LoLGq4RaQpdPzqLKVM4=; b=B0CGhzLxvgwTk2WxKQ9SMKmf+NRqpwKOEOpQsEz+eUytGSGMw4gZX8BI7OLU44r8daPOpaqAxy6Fwgc68EynIa+3inCMVxAGza0a3PrLGLun6YfDrUzIJhe7WctUEKMZWg7d9t77nWsrjTkd0baQVDpK1Fe/Rg+wy+zW5ypr6ec= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87302+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1646475282643661.684093937166; Sat, 5 Mar 2022 02:14:42 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id vkJbYY1788612xocFHmarF8V; Sat, 05 Mar 2022 02:14:42 -0800 X-Received: from smarthost01b.ixn.mail.zen.net.uk (smarthost01b.ixn.mail.zen.net.uk [212.23.1.21]) by mx.groups.io with SMTP id smtpd.web11.4109.1646475280659933587 for ; Sat, 05 Mar 2022 02:14:41 -0800 X-Received: from [51.148.147.4] (helo=sean-StarBook.lan) by smarthost01b.ixn.mail.zen.net.uk with esmtp (Exim 4.90_1) (envelope-from ) id 1nQRQq-0003x1-7a; Sat, 05 Mar 2022 10:14:36 +0000 From: "Sean Rhodes" To: devel@edk2.groups.io Cc: Sean Rhodes , Guo Dong , Ray Ni , Maurice Ma , Benjamin You Subject: [edk2-devel] [PATCH] UefiPayloadPkg: Make Boot Manager Key configurable Date: Sat, 5 Mar 2022 10:14:34 +0000 Message-Id: <761adf234fa5ca4fd3e6b3abc608927df1372251.1646475274.git.sean@starlabs.systems> MIME-Version: 1.0 X-Originating-smarthost01b-IP: [51.148.147.4] Feedback-ID: 51.148.147.4 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,sean@starlabs.systems X-Gm-Message-State: 7hSddYksTq5k23uTgTv8C1Cyx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1646475282; bh=YOayFBwBqGIN2j4wVeCkfNcM9yBja7HJLhiDAanYdMM=; h=Cc:Date:From:Reply-To:Subject:To; b=PugKMbfVYN+WccmHSIIGN3kdsTZXLiYw8ySnP8K4MEeuz0MAL/mdeU7T/QNc7DgwcCu eedE9U/mNcjBn40bV7uDHEHamRHWtleEdd4f3m/anli+MsuQROW5FiJeiUZuiJTZCKMbY rjsrNwu4t2OuIHlVqN4xdfWh2MzSMZkFajk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1646475284120100001 Content-Type: text/plain; charset="utf-8" Provide a build option to use [Esc] instead of [F2] for devices such as Chromebooks that don't have F-keys. Cc: Guo Dong Cc: Ray Ni Cc: Maurice Ma Cc: Benjamin You Signed-off-by: Sean Rhodes Reviewed-by: Guo Dong --- .../PlatformBootManager.c | 44 +++++++++++++------ .../PlatformBootManagerLib.inf | 1 + UefiPayloadPkg/UefiPayloadPkg.dec | 3 ++ UefiPayloadPkg/UefiPayloadPkg.dsc | 2 + 4 files changed, 37 insertions(+), 13 deletions(-) diff --git a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootMana= ger.c b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c index a8ead775ea..0eb577313a 100644 --- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c +++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c @@ -164,7 +164,7 @@ PlatformBootManagerBeforeConsole ( ) { EFI_INPUT_KEY Enter; - EFI_INPUT_KEY F2; + EFI_INPUT_KEY CustomKey; EFI_INPUT_KEY Down; EFI_BOOT_MANAGER_LOAD_OPTION BootOption; EFI_STATUS Status; @@ -186,13 +186,22 @@ PlatformBootManagerBeforeConsole ( Enter.UnicodeChar =3D CHAR_CARRIAGE_RETURN; EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL); =20 - // - // Map F2 to Boot Manager Menu - // - F2.ScanCode =3D SCAN_F2; - F2.UnicodeChar =3D CHAR_NULL; + if (FixedPcdGetBool (PcdBootManagerEscape)) { + // + // Map Esc to Boot Manager Menu + // + CustomKey.ScanCode =3D SCAN_ESC; + CustomKey.UnicodeChar =3D CHAR_NULL; + } else { + // + // Map Esc to Boot Manager Menu + // + CustomKey.ScanCode =3D SCAN_F2; + CustomKey.UnicodeChar =3D CHAR_NULL; + } + EfiBootManagerGetBootManagerMenu (&BootOption); - EfiBootManagerAddKeyOptionVariable (NULL, (UINT16)BootOption.OptionNumbe= r, 0, &F2, NULL); + EfiBootManagerAddKeyOptionVariable (NULL, (UINT16)BootOption.OptionNumbe= r, 0, &CustomKey, NULL); =20 // // Also add Down key to Boot Manager Menu since some serial terminals do= n't support F2 key. @@ -251,12 +260,21 @@ PlatformBootManagerAfterConsole ( // PlatformRegisterFvBootOption (PcdGetPtr (PcdShellFile), L"UEFI Shell", L= OAD_OPTION_ACTIVE); =20 - Print ( - L"\n" - L"F2 or Down to enter Boot Manager Menu.\n" - L"ENTER to boot directly.\n" - L"\n" - ); + if (FixedPcdGetBool (PcdBootManagerEscape)) { + Print ( + L"\n" + L"Esc or Down to enter Boot Manager Menu.\n" + L"ENTER to boot directly.\n" + L"\n" + ); + } else { + Print ( + L"\n" + L"F2 or Down to enter Boot Manager Menu.\n" + L"ENTER to boot directly.\n" + L"\n" + ); + } } =20 /** diff --git a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootMana= gerLib.inf b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootMana= gerLib.inf index 9c4a9da943..80390e0d98 100644 --- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.= inf +++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.= inf @@ -73,3 +73,4 @@ gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile + gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape diff --git a/UefiPayloadPkg/UefiPayloadPkg.dec b/UefiPayloadPkg/UefiPayload= Pkg.dec index e9204d1168..4051172caf 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dec +++ b/UefiPayloadPkg/UefiPayloadPkg.dec @@ -86,6 +86,9 @@ gUefiPayloadPkgTokenSpaceGuid.PcdPcdDriverFile|{ 0x57, 0x= 72, 0xcf, 0x80, 0xab, 0 # Above 4G Memory gUefiPayloadPkgTokenSpaceGuid.PcdDispatchModuleAbove4GMemory|TRUE|BOOLEAN|= 0x00000019 =20 +# Boot Manager Key +gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|FALSE|BOOLEAN|0x00000020 + ## FFS filename to find the default variable initial data file. # @Prompt FFS Name of variable initial data file gUefiPayloadPkgTokenSpaceGuid.PcdNvsDataFile |{ 0x1a, 0xf1, 0xb1, 0xae, 0= x42, 0xcc, 0xcf, 0x4e, 0xac, 0x60, 0xdb, 0xab, 0xf6, 0xca, 0x69, 0xe6 }|VOI= D*|0x00000025 diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayload= Pkg.dsc index 4fe81a61d6..558513baf1 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -34,6 +34,7 @@ DEFINE SECURITY_STUB_ENABLE =3D TRUE DEFINE SMM_SUPPORT =3D FALSE DEFINE ABOVE_4G_MEMORY =3D TRUE + DEFINE BOOT_MANAGER_ESCAPE =3D FALSE # # SBL: UEFI payload for Slim Bootloader # COREBOOT: UEFI payload for coreboot @@ -401,6 +402,7 @@ !endif =20 gUefiPayloadPkgTokenSpaceGuid.PcdDispatchModuleAbove4GMemory|$(ABOVE_4G_= MEMORY) + gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|$(BOOT_MANAGER_ESCAPE) =20 [PcdsPatchableInModule.X64] gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|$(RTC_INDEX_REGISTER) --=20 2.32.0 -=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 (#87302): https://edk2.groups.io/g/devel/message/87302 Mute This Topic: https://groups.io/mt/89276535/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-