/** @file\r
Library functions which relates with booting.\r
\r
+Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.\r
Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.<BR>\r
(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
VOID\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_BOOT_MANAGER_LOAD_OPTION *NvBootOptions;\r
- UINTN NvBootOptionCount;\r
- EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;\r
- UINTN BootOptionCount;\r
- UINTN Index;\r
+ EFI_STATUS Status;\r
+ EFI_BOOT_MANAGER_LOAD_OPTION *NvBootOptions;\r
+ UINTN NvBootOptionCount;\r
+ EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;\r
+ UINTN BootOptionCount;\r
+ EFI_BOOT_MANAGER_LOAD_OPTION *UpdatedBootOptions;\r
+ UINTN UpdatedBootOptionCount;\r
+ UINTN Index;\r
+ EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL *PlatformBootManager;\r
\r
//\r
// Optionally refresh the legacy boot option\r
}\r
\r
BootOptions = BmEnumerateBootOptions (&BootOptionCount);\r
- NvBootOptions = EfiBootManagerGetLoadOptions (&NvBootOptionCount, LoadOptionTypeBoot);\r
\r
//\r
// Mark the boot option as added by BDS by setting OptionalData to a special GUID\r
BootOptions[Index].OptionalDataSize = sizeof (EFI_GUID);\r
}\r
\r
+ //\r
+ // Locate Platform Boot Options Protocol\r
+ //\r
+ Status = gBS->LocateProtocol (&gEdkiiPlatformBootManagerProtocolGuid,\r
+ NULL,\r
+ (VOID **)&PlatformBootManager);\r
+ if (!EFI_ERROR (Status)) {\r
+ //\r
+ // If found, call platform specific refresh to all auto enumerated and NV\r
+ // boot options.\r
+ //\r
+ Status = PlatformBootManager->RefreshAllBootOptions ((CONST EFI_BOOT_MANAGER_LOAD_OPTION *)BootOptions,\r
+ (CONST UINTN)BootOptionCount,\r
+ &UpdatedBootOptions,\r
+ &UpdatedBootOptionCount);\r
+ if (!EFI_ERROR (Status)) {\r
+ EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);\r
+ BootOptions = UpdatedBootOptions;\r
+ BootOptionCount = UpdatedBootOptionCount;\r
+ }\r
+ }\r
+\r
+ NvBootOptions = EfiBootManagerGetLoadOptions (&NvBootOptionCount, LoadOptionTypeBoot);\r
+\r
//\r
// Remove invalid EFI boot options from NV\r
//\r