This introduces the EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION2, which adds a new UpdateBootOrder() function to support customizing the boot options order according to the platform-specific policy.
Signed-off-by: Tinh Nguyen <tinhngu...@os.amperecomputing.com> --- Changes since v1: Correct the format of the email. MdeModulePkg/Include/Protocol/PlatformBootManager.h | 24 +++++++++++++++++++- MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 9 ++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Include/Protocol/PlatformBootManager.h b/MdeModulePkg/Include/Protocol/PlatformBootManager.h index e527b0ee0eaf..758bc2deb774 100644 --- a/MdeModulePkg/Include/Protocol/PlatformBootManager.h +++ b/MdeModulePkg/Include/Protocol/PlatformBootManager.h @@ -1,6 +1,7 @@ /** @file Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. + Copyright (c) 2023, Ampere Computing LLC. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -29,7 +30,8 @@ typedef struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL EDKII_PLATFORM_BOOT_MANAGER // All future revisions must be backwards compatible. // If a future version is not back wards compatible it is not the same GUID. // -#define EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION 0x00000001 +#define EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION 0x00000001 +#define EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION2 0x00000002 // // Function Prototypes @@ -72,9 +74,29 @@ EFI_STATUS OUT UINTN *UpdatedBootOptionsCount ); +/** + This function allows platform to update the DriverOrder/BootOrder variables. + And it is available from version 2 of the EDKII Platform Boot Manager protocol. + + @retval EFI_SUCCESS Platform successfully modifies + the DriverOrder/BootOrder variables as wanted. + @retval Others There are some errors that happen. Check the status code + for details. + +**/ +typedef +EFI_STATUS +(EFIAPI *PLATFORM_BOOT_MANAGER_UPDATE_BOOT_ORDER)( + IN VOID + ); + struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL { UINT64 Revision; PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS RefreshAllBootOptions; + // + // EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION2 + // + PLATFORM_BOOT_MANAGER_UPDATE_BOOT_ORDER UpdateBootOrder; }; extern EFI_GUID gEdkiiPlatformBootManagerProtocolGuid; diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c index bde22fa6590e..67d1d54b3c24 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c @@ -4,6 +4,7 @@ Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. Copyright (c) 2011 - 2021, Intel Corporation. All rights reserved.<BR> (C) Copyright 2015-2021 Hewlett Packard Enterprise Development LP<BR> +Copyright (c) 2023, Ampere Computing LLC. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -2412,6 +2413,8 @@ EfiBootManagerRefreshAllBootOption ( BootOptions = UpdatedBootOptions; BootOptionCount = UpdatedBootOptionCount; } + } else { + PlatformBootManager = NULL; } NvBootOptions = EfiBootManagerGetLoadOptions (&NvBootOptionCount, LoadOptionTypeBoot); @@ -2453,6 +2456,12 @@ EfiBootManagerRefreshAllBootOption ( EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount); EfiBootManagerFreeLoadOptions (NvBootOptions, NvBootOptionCount); + + if ((PlatformBootManager != NULL) && + (PlatformBootManager->Revision >= EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_REVISION2)) + { + PlatformBootManager->UpdateBootOrder (); + } } /** -- 2.40.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#102610): https://edk2.groups.io/g/devel/message/102610 Mute This Topic: https://groups.io/mt/98100778/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-