//\r
Status = EfiBootManagerGetBootManagerMenu (&BootManagerMenu);\r
if (Status != EFI_NOT_FOUND) {\r
- OsIndicationSupport = EFI_OS_INDICATIONS_BOOT_TO_FW_UI | EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY;\r
+ OsIndicationSupport = EFI_OS_INDICATIONS_BOOT_TO_FW_UI;\r
EfiBootManagerFreeLoadOption (&BootManagerMenu);\r
} else {\r
- OsIndicationSupport = EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY;\r
+ OsIndicationSupport = 0;\r
+ }\r
+\r
+ if (PcdGetBool (PcdPlatformRecoverySupport)) {\r
+ OsIndicationSupport |= EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY;\r
}\r
\r
if (PcdGetBool(PcdCapsuleOnDiskSupport)) {\r
BOOLEAN BootSuccess;\r
EFI_DEVICE_PATH_PROTOCOL *FilePath;\r
EFI_STATUS BootManagerMenuStatus;\r
+ EFI_BOOT_MANAGER_LOAD_OPTION PlatformDefaultBootOption;\r
\r
HotkeyTriggered = NULL;\r
Status = EFI_SUCCESS;\r
//\r
InitializeLanguage (TRUE);\r
\r
- //\r
- // System firmware must include a PlatformRecovery#### variable specifying\r
- // a short-form File Path Media Device Path containing the platform default\r
- // file path for removable media\r
- //\r
FilePath = FileDevicePath (NULL, EFI_REMOVABLE_MEDIA_FILE_NAME);\r
+ if (FilePath == NULL) {\r
+ DEBUG ((DEBUG_ERROR, "Fail to allocate memory for defualt boot file path. Unable to boot.\n"));\r
+ CpuDeadLoop ();\r
+ }\r
Status = EfiBootManagerInitializeLoadOption (\r
- &LoadOption,\r
+ &PlatformDefaultBootOption,\r
LoadOptionNumberUnassigned,\r
LoadOptionTypePlatformRecovery,\r
LOAD_OPTION_ACTIVE,\r
0\r
);\r
ASSERT_EFI_ERROR (Status);\r
- LoadOptions = EfiBootManagerGetLoadOptions (&LoadOptionCount, LoadOptionTypePlatformRecovery);\r
- if (EfiBootManagerFindLoadOption (&LoadOption, LoadOptions, LoadOptionCount) == -1) {\r
- for (Index = 0; Index < LoadOptionCount; Index++) {\r
- //\r
- // The PlatformRecovery#### options are sorted by OptionNumber.\r
- // Find the the smallest unused number as the new OptionNumber.\r
- //\r
- if (LoadOptions[Index].OptionNumber != Index) {\r
- break;\r
+\r
+ //\r
+ // System firmware must include a PlatformRecovery#### variable specifying\r
+ // a short-form File Path Media Device Path containing the platform default\r
+ // file path for removable media if the platform supports Platform Recovery.\r
+ //\r
+ if (PcdGetBool (PcdPlatformRecoverySupport)) {\r
+ LoadOptions = EfiBootManagerGetLoadOptions (&LoadOptionCount, LoadOptionTypePlatformRecovery);\r
+ if (EfiBootManagerFindLoadOption (&PlatformDefaultBootOption, LoadOptions, LoadOptionCount) == -1) {\r
+ for (Index = 0; Index < LoadOptionCount; Index++) {\r
+ //\r
+ // The PlatformRecovery#### options are sorted by OptionNumber.\r
+ // Find the the smallest unused number as the new OptionNumber.\r
+ //\r
+ if (LoadOptions[Index].OptionNumber != Index) {\r
+ break;\r
+ }\r
}\r
+ PlatformDefaultBootOption.OptionNumber = Index;\r
+ Status = EfiBootManagerLoadOptionToVariable (&PlatformDefaultBootOption);\r
+ ASSERT_EFI_ERROR (Status);\r
}\r
- LoadOption.OptionNumber = Index;\r
- Status = EfiBootManagerLoadOptionToVariable (&LoadOption);\r
- ASSERT_EFI_ERROR (Status);\r
+ EfiBootManagerFreeLoadOptions (LoadOptions, LoadOptionCount);\r
}\r
- EfiBootManagerFreeLoadOption (&LoadOption);\r
FreePool (FilePath);\r
- EfiBootManagerFreeLoadOptions (LoadOptions, LoadOptionCount);\r
\r
//\r
// Report Status Code to indicate connecting drivers will happen\r
}\r
\r
if (!BootSuccess) {\r
- LoadOptions = EfiBootManagerGetLoadOptions (&LoadOptionCount, LoadOptionTypePlatformRecovery);\r
- ProcessLoadOptions (LoadOptions, LoadOptionCount);\r
- EfiBootManagerFreeLoadOptions (LoadOptions, LoadOptionCount);\r
+ if (PlatformRecovery) {\r
+ LoadOptions = EfiBootManagerGetLoadOptions (&LoadOptionCount, LoadOptionTypePlatformRecovery);\r
+ ProcessLoadOptions (LoadOptions, LoadOptionCount);\r
+ EfiBootManagerFreeLoadOptions (LoadOptions, LoadOptionCount);\r
+ } else {\r
+ //\r
+ // When platform recovery is not enabled, still boot to platform default file path.\r
+ //\r
+ EfiBootManagerProcessLoadOption (&PlatformDefaultBootOption);\r
+ }\r
}\r
+ EfiBootManagerFreeLoadOption (&PlatformDefaultBootOption);\r
\r
DEBUG ((EFI_D_ERROR, "[Bds] Unable to boot!\n"));\r
PlatformBootManagerUnableToBoot ();\r