public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2][PATCH 1/1] MdeModulePkg: Add EDKII Platform Boot Manager Protocol v2
@ 2023-04-05  6:11 Tinh Nguyen
  2023-04-05 23:05 ` [edk2-devel] " Rebecca Cran
  0 siblings, 1 reply; 3+ messages in thread
From: Tinh Nguyen @ 2023-04-05  6:11 UTC (permalink / raw)
  To: devel
  Cc: patches, nhi, chuong, minhnguyen, jian.j.wang, gaoliming,
	zhichao.gao, ray.ni, Tinh Nguyen

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 <tinhnguyen@os.amperecomputing.com>
---
 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.39.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [edk2][PATCH 1/1] MdeModulePkg: Add EDKII Platform Boot Manager Protocol v2
  2023-04-05  6:11 [edk2][PATCH 1/1] MdeModulePkg: Add EDKII Platform Boot Manager Protocol v2 Tinh Nguyen
@ 2023-04-05 23:05 ` Rebecca Cran
  2023-04-06  7:47   ` Tinh Nguyen
  0 siblings, 1 reply; 3+ messages in thread
From: Rebecca Cran @ 2023-04-05 23:05 UTC (permalink / raw)
  To: devel, tinhnguyen
  Cc: patches, nhi, chuong, minhnguyen, jian.j.wang, gaoliming,
	zhichao.gao, ray.ni

Tinh,


You appear to be sending emails in quoted-printable format, while we 
prefer them in 8bit encoding: quoted-printable causes issues such as 
equals signs being replaced with "=3D" in the plain text for example.

Could you make sure you've run "python3 BaseTools/Scripts/SetupGit.py" 
for the repo please?

It makes several additions to .git/config, including:


[format]
         coverLetter = True
         numbered = True
         signoff = False
[sendemail]
         chainreplyto = False
         thread = True
         transferEncoding = 8bit
         to = devel@edk2.groups.io


-- 
Rebecca Cran


On 4/5/23 12:11 AM, 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 <tinhnguyen@os.amperecomputing.com>
> ---
>   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.39.2
>
>
> 
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [edk2][PATCH 1/1] MdeModulePkg: Add EDKII Platform Boot Manager Protocol v2
  2023-04-05 23:05 ` [edk2-devel] " Rebecca Cran
@ 2023-04-06  7:47   ` Tinh Nguyen
  0 siblings, 0 replies; 3+ messages in thread
From: Tinh Nguyen @ 2023-04-06  7:47 UTC (permalink / raw)
  To: Rebecca Cran, devel, tinhnguyen
  Cc: patches, nhi, chuong, minhnguyen, jian.j.wang, gaoliming,
	zhichao.gao, ray.ni

Hi Rebecca,

Thanks for your information, I will update it in v2

Thanks,

Tinh

On 4/6/2023 6:05 AM, Rebecca Cran wrote:
> Tinh,
>
>
> You appear to be sending emails in quoted-printable format, while we 
> prefer them in 8bit encoding: quoted-printable causes issues such as 
> equals signs being replaced with "=3D" in the plain text for example.
>
> Could you make sure you've run "python3 BaseTools/Scripts/SetupGit.py" 
> for the repo please?
>
> It makes several additions to .git/config, including:
>
>
> [format]
>         coverLetter = True
>         numbered = True
>         signoff = False
> [sendemail]
>         chainreplyto = False
>         thread = True
>         transferEncoding = 8bit
>         to = devel@edk2.groups.io
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-04-06  7:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-05  6:11 [edk2][PATCH 1/1] MdeModulePkg: Add EDKII Platform Boot Manager Protocol v2 Tinh Nguyen
2023-04-05 23:05 ` [edk2-devel] " Rebecca Cran
2023-04-06  7:47   ` Tinh Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox