]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiPayloadPkg: Make Boot Manager Key configurable
authorSean Rhodes <sean@starlabs.systems>
Sat, 5 Mar 2022 10:14:34 +0000 (03:14 -0700)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 7 Mar 2022 20:43:58 +0000 (20:43 +0000)
Provide a build option to use [Esc] instead of [F2] for devices
such as Chromebooks that don't have F-keys.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Ray Ni <ray.ni@Intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
UefiPayloadPkg/UefiPayloadPkg.dec
UefiPayloadPkg/UefiPayloadPkg.dsc

index a8ead775ea433434c123ca94ac073b0938d6359c..0eb577313ae14d3925615cc635102040f1c181c0 100644 (file)
@@ -164,7 +164,7 @@ PlatformBootManagerBeforeConsole (
   )\r
 {\r
   EFI_INPUT_KEY                 Enter;\r
-  EFI_INPUT_KEY                 F2;\r
+  EFI_INPUT_KEY                 CustomKey;\r
   EFI_INPUT_KEY                 Down;\r
   EFI_BOOT_MANAGER_LOAD_OPTION  BootOption;\r
   EFI_STATUS                    Status;\r
@@ -186,13 +186,22 @@ PlatformBootManagerBeforeConsole (
   Enter.UnicodeChar = CHAR_CARRIAGE_RETURN;\r
   EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL);\r
 \r
-  //\r
-  // Map F2 to Boot Manager Menu\r
-  //\r
-  F2.ScanCode    = SCAN_F2;\r
-  F2.UnicodeChar = CHAR_NULL;\r
+  if (FixedPcdGetBool (PcdBootManagerEscape)) {\r
+    //\r
+    // Map Esc to Boot Manager Menu\r
+    //\r
+    CustomKey.ScanCode    = SCAN_ESC;\r
+    CustomKey.UnicodeChar = CHAR_NULL;\r
+  } else {\r
+    //\r
+    // Map Esc to Boot Manager Menu\r
+    //\r
+    CustomKey.ScanCode    = SCAN_F2;\r
+    CustomKey.UnicodeChar = CHAR_NULL;\r
+  }\r
+\r
   EfiBootManagerGetBootManagerMenu (&BootOption);\r
-  EfiBootManagerAddKeyOptionVariable (NULL, (UINT16)BootOption.OptionNumber, 0, &F2, NULL);\r
+  EfiBootManagerAddKeyOptionVariable (NULL, (UINT16)BootOption.OptionNumber, 0, &CustomKey, NULL);\r
 \r
   //\r
   // Also add Down key to Boot Manager Menu since some serial terminals don't support F2 key.\r
@@ -251,12 +260,21 @@ PlatformBootManagerAfterConsole (
   //\r
   PlatformRegisterFvBootOption (PcdGetPtr (PcdShellFile), L"UEFI Shell", LOAD_OPTION_ACTIVE);\r
 \r
-  Print (\r
-    L"\n"\r
-    L"F2 or Down      to enter Boot Manager Menu.\n"\r
-    L"ENTER           to boot directly.\n"\r
-    L"\n"\r
-    );\r
+  if (FixedPcdGetBool (PcdBootManagerEscape)) {\r
+    Print (\r
+      L"\n"\r
+      L"Esc or Down      to enter Boot Manager Menu.\n"\r
+      L"ENTER           to boot directly.\n"\r
+      L"\n"\r
+      );\r
+  } else {\r
+    Print (\r
+      L"\n"\r
+      L"F2 or Down      to enter Boot Manager Menu.\n"\r
+      L"ENTER           to boot directly.\n"\r
+      L"\n"\r
+      );\r
+  }\r
 }\r
 \r
 /**\r
index 9c4a9da94350da26864355bc0ee6dd5dd1c5a40b..80390e0d98e83173f5c77dc00258c546d838b3a5 100644 (file)
@@ -73,3 +73,4 @@
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity\r
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile\r
+  gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape\r
index e9204d1168012b60be9532b29121919d365f3916..4051172caf4848968a9cb99c08bb54c6ee3f57e8 100644 (file)
@@ -86,6 +86,9 @@ gUefiPayloadPkgTokenSpaceGuid.PcdPcdDriverFile|{ 0x57, 0x72, 0xcf, 0x80, 0xab, 0
 # Above 4G Memory\r
 gUefiPayloadPkgTokenSpaceGuid.PcdDispatchModuleAbove4GMemory|TRUE|BOOLEAN|0x00000019\r
 \r
+# Boot Manager Key\r
+gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|FALSE|BOOLEAN|0x00000020\r
+\r
 ## FFS filename to find the default variable initial data file.\r
 # @Prompt FFS Name of variable initial data file\r
  gUefiPayloadPkgTokenSpaceGuid.PcdNvsDataFile |{ 0x1a, 0xf1, 0xb1, 0xae, 0x42, 0xcc, 0xcf, 0x4e, 0xac, 0x60, 0xdb, 0xab, 0xf6, 0xca, 0x69, 0xe6 }|VOID*|0x00000025\r
index 4fe81a61d6714b5f302c7d10bc1d9c6667bc6e67..558513baf1f07eb6afbf3f2e7a6bd25aabf05051 100644 (file)
@@ -34,6 +34,7 @@
   DEFINE SECURITY_STUB_ENABLE         = TRUE\r
   DEFINE SMM_SUPPORT                  = FALSE\r
   DEFINE ABOVE_4G_MEMORY              = TRUE\r
+  DEFINE BOOT_MANAGER_ESCAPE          = FALSE\r
   #\r
   # SBL:      UEFI payload for Slim Bootloader\r
   # COREBOOT: UEFI payload for coreboot\r
 !endif\r
 \r
   gUefiPayloadPkgTokenSpaceGuid.PcdDispatchModuleAbove4GMemory|$(ABOVE_4G_MEMORY)\r
+  gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|$(BOOT_MANAGER_ESCAPE)\r
 \r
 [PcdsPatchableInModule.X64]\r
   gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|$(RTC_INDEX_REGISTER)\r