After DxeCore finish DXE phase, gEfiBdsArchProtocolGuid->BdsEntry will be invoked\r
to enter BDS phase.\r
\r
-Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>\r
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
TimeoutRemain--;\r
}\r
}\r
+ PlatformBootManagerWaitCallback (0);\r
DEBUG ((EFI_D_INFO, "[Bds]Exit the waiting!\n"));\r
}\r
\r
//\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
+ OsIndicationSupport |= EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED;\r
}\r
\r
Status = gRT->SetVariable (\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