RefreshAllBootOptions() API internally can keep an ordering rule so that 
platform-level-higher-priority boot options are before
those platform-level-lower-priority options.

So, that means, you could only change RefreshAllOptions() implementation to 
control the order without adding a new API.

Thanks,
ray

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Tinh
> Nguyen via groups.io
> Sent: Tuesday, April 11, 2023 1:35 AM
> To: devel@edk2.groups.io; tinhngu...@os.amperecomputing.com
> Cc: patc...@amperecomputing.com; n...@os.amperecomputing.com;
> chu...@os.amperecomputing.com;
> minhngu...@os.amperecomputing.com; Wang, Jian J
> <jian.j.w...@intel.com>; Gao, Liming <gaolim...@byosoft.com.cn>; Gao,
> Zhichao <zhichao....@intel.com>; Ni, Ray <ray...@intel.com>;
> rebe...@bsdio.com
> Subject: Re: [edk2-devel] [edk2][PATCH v2 1/1] MdeModulePkg: Add EDKII
> Platform Boot Manager Protocol v2
> 
> Gentle ping, I’m looking for some feedback on this patch. Could someone
> please help me to review it?
> 
> On 4/6/2023 3:19 PM, Tinh Nguyen via groups.io wrote:
> > 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 (#103126): https://edk2.groups.io/g/devel/message/103126
Mute This Topic: https://groups.io/mt/98100778/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: 
https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to