From: BigfootACA Date: 星期三, 6 Oct 2021 08:38:50 +0000 (+0800) Subject: sdm845Pkg: Library: PlatformBootManagerLib: PlatformBm.c: boot into SimpleInitGUI... X-Git-Tag: v1.0.5~20 X-Git-Url: https://git.renegade-project.org/?a=commitdiff_plain;h=363f00789e20fdadba0e90293b055fb6bba95500;p=edk2-sdm845.git sdm845Pkg: Library: PlatformBootManagerLib: PlatformBm.c: boot into SimpleInitGUI when press UP Signed-off-by: BigfootACA --- diff --git a/sdm845Pkg/Library/PlatformBootManagerLib/PlatformBm.c b/sdm845Pkg/Library/PlatformBootManagerLib/PlatformBm.c index 8cd1e6a..c709af1 100644 --- a/sdm845Pkg/Library/PlatformBootManagerLib/PlatformBm.c +++ b/sdm845Pkg/Library/PlatformBootManagerLib/PlatformBm.c @@ -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