summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
diff options
context:
space:
mode:
authorAshish Singhal <ashishsingha@nvidia.com>2019-12-24 10:57:47 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-01-08 07:28:39 +0000
commit972d88726410e21b1fff1a528854202c67e97ef1 (patch)
tree87c74dc4eb693acab30a4b1f604394648c8ad7d0 /MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
parentc9d72628432126cbce58a48b440e4944baa4beab (diff)
downloadedk2-972d88726410e21b1fff1a528854202c67e97ef1.tar.gz
edk2-972d88726410e21b1fff1a528854202c67e97ef1.tar.bz2
edk2-972d88726410e21b1fff1a528854202c67e97ef1.zip
MdeModulePkg: Add EDK2 Platform Boot Manager Protocol
Add edk2 platform boot manager protocol which would have platform specific refreshes to the auto enumerated as well as NV boot options for the platform. Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
Diffstat (limited to 'MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c')
-rw-r--r--MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c41
1 files changed, 34 insertions, 7 deletions
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 760d7647b8..62c5b2dc94 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -1,6 +1,7 @@
/** @file
Library functions which relates with booting.
+Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -2258,12 +2259,15 @@ EfiBootManagerRefreshAllBootOption (
VOID
)
{
- EFI_STATUS Status;
- EFI_BOOT_MANAGER_LOAD_OPTION *NvBootOptions;
- UINTN NvBootOptionCount;
- EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;
- UINTN BootOptionCount;
- UINTN Index;
+ EFI_STATUS Status;
+ EFI_BOOT_MANAGER_LOAD_OPTION *NvBootOptions;
+ UINTN NvBootOptionCount;
+ EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;
+ UINTN BootOptionCount;
+ EFI_BOOT_MANAGER_LOAD_OPTION *UpdatedBootOptions;
+ UINTN UpdatedBootOptionCount;
+ UINTN Index;
+ EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL *PlatformBootManager;
//
// Optionally refresh the legacy boot option
@@ -2273,7 +2277,6 @@ EfiBootManagerRefreshAllBootOption (
}
BootOptions = BmEnumerateBootOptions (&BootOptionCount);
- NvBootOptions = EfiBootManagerGetLoadOptions (&NvBootOptionCount, LoadOptionTypeBoot);
//
// Mark the boot option as added by BDS by setting OptionalData to a special GUID
@@ -2284,6 +2287,30 @@ EfiBootManagerRefreshAllBootOption (
}
//
+ // Locate Platform Boot Options Protocol
+ //
+ Status = gBS->LocateProtocol (&gEdkiiPlatformBootManagerProtocolGuid,
+ NULL,
+ (VOID **)&PlatformBootManager);
+ if (!EFI_ERROR (Status)) {
+ //
+ // If found, call platform specific refresh to all auto enumerated and NV
+ // boot options.
+ //
+ Status = PlatformBootManager->RefreshAllBootOptions ((CONST EFI_BOOT_MANAGER_LOAD_OPTION *)BootOptions,
+ (CONST UINTN)BootOptionCount,
+ &UpdatedBootOptions,
+ &UpdatedBootOptionCount);
+ if (!EFI_ERROR (Status)) {
+ EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);
+ BootOptions = UpdatedBootOptions;
+ BootOptionCount = UpdatedBootOptionCount;
+ }
+ }
+
+ NvBootOptions = EfiBootManagerGetLoadOptions (&NvBootOptionCount, LoadOptionTypeBoot);
+
+ //
// Remove invalid EFI boot options from NV
//
for (Index = 0; Index < NvBootOptionCount; Index++) {