]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
UefiPayloadPkg: Make Boot Manager Key configurable
[mirror_edk2.git] / UefiPayloadPkg / Library / PlatformBootManagerLib / PlatformBootManager.c
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