sdm845Pkg: Library: PlatformBootManagerLib: PlatformBm.c: boot into SimpleInitGUI...
authorBigfootACA <bigfoot@classfun.cn>
星期三, 6 Oct 2021 08:38:50 +0000 (16:38 +0800)
committerBigfootACA <bigfoot@classfun.cn>
星期三, 6 Oct 2021 08:38:50 +0000 (16:38 +0800)
Signed-off-by: BigfootACA <bigfoot@classfun.cn>
sdm845Pkg/Library/PlatformBootManagerLib/PlatformBm.c

index 8cd1e6abfd23d72c652b10cf79bdf2d0aa91bbe3..c709af113da389aa5cfe6fe129479e48d0f4ee82 100644 (file)
@@ -322,7 +322,7 @@ AddOutput (
 }
 
 STATIC
-VOID
+UINT16
 PlatformRegisterFvBootOption (
   CONST EFI_GUID                   *FileGuid,
   CHAR16                           *Description,
@@ -337,6 +337,7 @@ PlatformRegisterFvBootOption (
   MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;
   EFI_LOADED_IMAGE_PROTOCOL         *LoadedImage;
   EFI_DEVICE_PATH_PROTOCOL          *DevicePath;
+  UINT16                            OptionNumber;
 
   Status = gBS->HandleProtocol (
                   gImageHandle,
@@ -379,8 +380,10 @@ PlatformRegisterFvBootOption (
     Status = EfiBootManagerAddLoadOptionVariable (&NewOption, MAX_UINTN);
     ASSERT_EFI_ERROR (Status);
   }
+  OptionNumber = NewOption.OptionNumber;
   EfiBootManagerFreeLoadOption (&NewOption);
   EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);
+  return OptionNumber;
 }
 
 
@@ -510,7 +513,7 @@ PlatformRegisterOptionsAndKeys (
   ASSERT_EFI_ERROR (Status);
 
   //
-  // Map F2 and ESC to Boot Manager Menu
+  // Map UP and ESC to Boot Manager Menu or SimpleInitGUI
   //
   UP.ScanCode     = SCAN_UP;
   UP.UnicodeChar  = CHAR_NULL;
@@ -518,9 +521,21 @@ PlatformRegisterOptionsAndKeys (
   Esc.UnicodeChar = CHAR_NULL;
   Status = EfiBootManagerGetBootManagerMenu (&BootOption);
   ASSERT_EFI_ERROR (Status);
+  #ifdef ENABLE_SIMPLE_INIT
+  //
+  // Register Simple Init GUI APP
+  //
+  UINT16 OptionSimpleInit = PlatformRegisterFvBootOption (
+    &gSimpleInitFileGuid, L"Simple Init", LOAD_OPTION_ACTIVE
+  );
+  Status = EfiBootManagerAddKeyOptionVariable (
+             NULL, (UINT16) OptionSimpleInit, 0, &UP, NULL
+             );
+  #else
   Status = EfiBootManagerAddKeyOptionVariable (
              NULL, (UINT16) BootOption.OptionNumber, 0, &UP, NULL
              );
+  #endif
   ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);
   Status = EfiBootManagerAddKeyOptionVariable (
              NULL, (UINT16) BootOption.OptionNumber, 0, &Esc, NULL
@@ -707,7 +722,11 @@ PlatformBootManagerAfterConsole (
       Print (VERSION_STRING_PREFIX L"%s\n",
         PcdGetPtr (PcdFirmwareVersionString));
     }
-    Print (L"Press a any side button for for boot options");
+    #ifdef ENABLE_SIMPLE_INIT
+    Print (L"Press a any side button for SimpleInitGUI");
+    #else
+    Print (L"Press a any side button for Boot Options");
+    #endif
   } else if (FirmwareVerLength > 0) {
     Status = gBS->HandleProtocol (gST->ConsoleOutHandle,
                     &gEfiGraphicsOutputProtocolGuid, (VOID **)&GraphicsOutput);
@@ -741,15 +760,6 @@ PlatformBootManagerAfterConsole (
   //
   EfiBootManagerRefreshAllBootOption ();
 
-  #ifdef ENABLE_SIMPLE_INIT
-  //
-  // Register Simple Init GUI APP
-  //
-  PlatformRegisterFvBootOption (
-  &gSimpleInitFileGuid, L"Simple Init", LOAD_OPTION_ACTIVE
-  );
-  #endif
-
   //
   // Register UEFI Shell
   //
@@ -799,7 +809,11 @@ PlatformBootManagerWaitCallback (
   Status = BootLogoUpdateProgress (
              White.Pixel,
              Black.Pixel,
-             L"Press a any side button for for boot options",
+  #ifdef ENABLE_SIMPLE_INIT
+             L"Press a any side button for SimpleInitGUI",
+  #else
+             L"Press a any side button for Boot Options",
+  #endif
              White.Pixel,
              (Timeout - TimeoutRemain) * 100 / Timeout,
              0