[edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform Boot Manager Protocol

Ashish Singhal posted 1 patch 4 years, 4 months ago
Failed in applying to current master (apply log)
.../Include/Protocol/PlatformBootManager.h         | 82 ++++++++++++++++++++++
MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c   | 41 +++++++++--
.../Library/UefiBootManagerLib/InternalBm.h        |  2 +
.../UefiBootManagerLib/UefiBootManagerLib.inf      |  2 +
MdeModulePkg/MdeModulePkg.dec                      |  4 ++
5 files changed, 124 insertions(+), 7 deletions(-)
create mode 100644 MdeModulePkg/Include/Protocol/PlatformBootManager.h
[edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform Boot Manager Protocol
Posted by Ashish Singhal 4 years, 4 months ago
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>
---
 .../Include/Protocol/PlatformBootManager.h         | 82 ++++++++++++++++++++++
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c   | 41 +++++++++--
 .../Library/UefiBootManagerLib/InternalBm.h        |  2 +
 .../UefiBootManagerLib/UefiBootManagerLib.inf      |  2 +
 MdeModulePkg/MdeModulePkg.dec                      |  4 ++
 5 files changed, 124 insertions(+), 7 deletions(-)
 create mode 100644 MdeModulePkg/Include/Protocol/PlatformBootManager.h

diff --git a/MdeModulePkg/Include/Protocol/PlatformBootManager.h b/MdeModulePkg/Include/Protocol/PlatformBootManager.h
new file mode 100644
index 0000000..26b9ce4
--- /dev/null
+++ b/MdeModulePkg/Include/Protocol/PlatformBootManager.h
@@ -0,0 +1,82 @@
+/** @file
+
+  Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __PLATFORM_BOOT_MANAGER_PROTOCOL_H__
+#define __PLATFORM_BOOT_MANAGER_PROTOCOL_H__
+
+#include <Library/UefiBootManagerLib.h>
+
+//
+// Platform Boot Manager Protocol GUID value
+//
+#define EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_GUID \
+    { \
+      0xaa17add4, 0x756c, 0x460d, { 0x94, 0xb8, 0x43, 0x88, 0xd7, 0xfb, 0x3e, 0x59 } \
+    }
+
+//
+// Protocol interface structure
+//
+typedef struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL;
+
+//
+// Revision The revision to which the protocol interface adheres.
+//          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
+
+//
+// Function Prototypes
+//
+
+/*
+  This function allows platform to refresh all boot options specific to the platform. Within
+  this function, platform can make modifications to the auto enumerated platform boot options
+  as well as NV boot options.
+
+  @param[in const] BootOptions             An array of auto enumerated platform boot options.
+                                           This array will be freed by caller upon successful
+                                           exit of this function and output array would be used.
+
+  @param[in const] BootOptionsCount        The number of elements in BootOptions.
+
+  @param[out]      UpdatedBootOptions      An array of boot options that have been customized
+                                           for the platform on top of input boot options. This
+                                           array would be allocated by REFRESH_ALL_BOOT_OPTIONS
+                                           and would be freed by caller after consuming it.
+
+  @param[out]      UpdatedBootOptionsCount The number of elements in UpdatedBootOptions.
+
+
+  @retval EFI_SUCCESS                      Platform refresh to input BootOptions and
+                                           BootCount have been done.
+
+  @retval EFI_OUT_OF_RESOURCES             Memory allocation failed.
+
+  @retval EFI_INVALID_PARAMETER            Input is not correct.
+
+  @retval EFI_UNSUPPORTED                  Platform specific overrides are not supported.
+*/
+typedef
+EFI_STATUS
+(EFIAPI *PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS) (
+  IN  CONST EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions,
+  IN  CONST UINTN                        BootOptionsCount,
+  OUT       EFI_BOOT_MANAGER_LOAD_OPTION **UpdatedBootOptions,
+  OUT       UINTN                        *UpdatedBootOptionsCount
+  );
+
+struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL {
+  UINT64                                         Revision;
+  PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS RefreshAllBootOptions;
+};
+
+extern EFI_GUID gEdkiiPlatformBootManagerProtocolGuid;
+
+#endif /* __PLATFORM_BOOT_MANAGER_PROTOCOL_H__ */
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 760d764..62c5b2dc 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++) {
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
index 027eb25..ac866ac 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
+++ b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
@@ -1,6 +1,7 @@
 /** @file
   BDS library definition, include the file and data structure
 
+Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
 Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
 (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -41,6 +42,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Protocol/VariableLock.h>
 #include <Protocol/RamDisk.h>
 #include <Protocol/DeferredImageLoad.h>
+#include <Protocol/PlatformBootManager.h>
 
 #include <Guid/MemoryTypeInformation.h>
 #include <Guid/FileInfo.h>
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
index ed6b467..cf59086 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+++ b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
@@ -5,6 +5,7 @@
 #  manipulation, hotkey registration, UEFI boot, connect/disconnect, console
 #  manipulation, driver health checking and etc.
 #
+#  Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
 #  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
 #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -107,6 +108,7 @@
   gEfiFormBrowser2ProtocolGuid                  ## SOMETIMES_CONSUMES
   gEfiRamDiskProtocolGuid                       ## SOMETIMES_CONSUMES
   gEfiDeferredImageLoadProtocolGuid             ## SOMETIMES_CONSUMES
+  gEdkiiPlatformBootManagerProtocolGuid         ## SOMETIMES_CONSUMES
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange      ## SOMETIMES_CONSUMES
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 41b9e70..cc238e9 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -3,6 +3,7 @@
 # It also provides the definitions(including PPIs/PROTOCOLs/GUIDs and library classes)
 # and libraries instances, which are used for those modules.
 #
+# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
 # Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
 # Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
 # (C) Copyright 2016 - 2019 Hewlett Packard Enterprise Development LP<BR>
@@ -609,6 +610,9 @@
   ## Include/Protocol/PeCoffImageEmulator.h
   gEdkiiPeCoffImageEmulatorProtocolGuid = { 0x96f46153, 0x97a7, 0x4793, { 0xac, 0xc1, 0xfa, 0x19, 0xbf, 0x78, 0xea, 0x97 } }
 
+  ## Include/Protocol/PlatformBootManager.h
+  gEdkiiPlatformBootManagerProtocolGuid = { 0xaa17add4, 0x756c, 0x460d, { 0x94, 0xb8, 0x43, 0x88, 0xd7, 0xfb, 0x3e, 0x59 } }
+
 #
 # [Error.gEfiMdeModulePkgTokenSpaceGuid]
 #   0x80000001 | Invalid value provided.
-- 
2.7.4


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#52524): https://edk2.groups.io/g/devel/message/52524
Mute This Topic: https://groups.io/mt/69243735/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform Boot Manager Protocol
Posted by Wang, Sunny (HPS SW) 4 years, 4 months ago
Looks good enough to me. Thanks for addressing my comments, Ashish.
Reviewed-by: Sunny Wang <sunnywang@hpe.com>

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Ashish Singhal
Sent: Tuesday, December 24, 2019 10:58 AM
To: devel@edk2.groups.io; ray.ni@intel.com; jian.j.wang@intel.com; hao.a.wu@intel.com; zhichao.gao@intel.com; michael.d.kinney@intel.com; afish@apple.com
Cc: Ashish Singhal <ashishsingha@nvidia.com>
Subject: [edk2-devel] [PATCH v7] 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>
---
 .../Include/Protocol/PlatformBootManager.h         | 82 ++++++++++++++++++++++
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c   | 41 +++++++++--
 .../Library/UefiBootManagerLib/InternalBm.h        |  2 +
 .../UefiBootManagerLib/UefiBootManagerLib.inf      |  2 +
 MdeModulePkg/MdeModulePkg.dec                      |  4 ++
 5 files changed, 124 insertions(+), 7 deletions(-)  create mode 100644 MdeModulePkg/Include/Protocol/PlatformBootManager.h

diff --git a/MdeModulePkg/Include/Protocol/PlatformBootManager.h b/MdeModulePkg/Include/Protocol/PlatformBootManager.h
new file mode 100644
index 0000000..26b9ce4
--- /dev/null
+++ b/MdeModulePkg/Include/Protocol/PlatformBootManager.h
@@ -0,0 +1,82 @@
+/** @file
+
+  Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __PLATFORM_BOOT_MANAGER_PROTOCOL_H__
+#define __PLATFORM_BOOT_MANAGER_PROTOCOL_H__
+
+#include <Library/UefiBootManagerLib.h>
+
+//
+// Platform Boot Manager Protocol GUID value // #define 
+EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_GUID \
+    { \
+      0xaa17add4, 0x756c, 0x460d, { 0x94, 0xb8, 0x43, 0x88, 0xd7, 0xfb, 0x3e, 0x59 } \
+    }
+
+//
+// Protocol interface structure
+//
+typedef struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL 
+EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL;
+
+//
+// Revision The revision to which the protocol interface adheres.
+//          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
+
+//
+// Function Prototypes
+//
+
+/*
+  This function allows platform to refresh all boot options specific to 
+the platform. Within
+  this function, platform can make modifications to the auto enumerated 
+platform boot options
+  as well as NV boot options.
+
+  @param[in const] BootOptions             An array of auto enumerated platform boot options.
+                                           This array will be freed by caller upon successful
+                                           exit of this function and output array would be used.
+
+  @param[in const] BootOptionsCount        The number of elements in BootOptions.
+
+  @param[out]      UpdatedBootOptions      An array of boot options that have been customized
+                                           for the platform on top of input boot options. This
+                                           array would be allocated by REFRESH_ALL_BOOT_OPTIONS
+                                           and would be freed by caller after consuming it.
+
+  @param[out]      UpdatedBootOptionsCount The number of elements in UpdatedBootOptions.
+
+
+  @retval EFI_SUCCESS                      Platform refresh to input BootOptions and
+                                           BootCount have been done.
+
+  @retval EFI_OUT_OF_RESOURCES             Memory allocation failed.
+
+  @retval EFI_INVALID_PARAMETER            Input is not correct.
+
+  @retval EFI_UNSUPPORTED                  Platform specific overrides are not supported.
+*/
+typedef
+EFI_STATUS
+(EFIAPI *PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS) (
+  IN  CONST EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions,
+  IN  CONST UINTN                        BootOptionsCount,
+  OUT       EFI_BOOT_MANAGER_LOAD_OPTION **UpdatedBootOptions,
+  OUT       UINTN                        *UpdatedBootOptionsCount
+  );
+
+struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL {
+  UINT64                                         Revision;
+  PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS RefreshAllBootOptions; 
+};
+
+extern EFI_GUID gEdkiiPlatformBootManagerProtocolGuid;
+
+#endif /* __PLATFORM_BOOT_MANAGER_PROTOCOL_H__ */
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 760d764..62c5b2dc 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++) { diff --git a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
index 027eb25..ac866ac 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
+++ b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
@@ -1,6 +1,7 @@
 /** @file
   BDS library definition, include the file and data structure
 
+Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
 Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
 (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent @@ -41,6 +42,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent  #include <Protocol/VariableLock.h>  #include <Protocol/RamDisk.h>  #include <Protocol/DeferredImageLoad.h>
+#include <Protocol/PlatformBootManager.h>
 
 #include <Guid/MemoryTypeInformation.h>  #include <Guid/FileInfo.h> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
index ed6b467..cf59086 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+++ b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
@@ -5,6 +5,7 @@
 #  manipulation, hotkey registration, UEFI boot, connect/disconnect, console  #  manipulation, driver health checking and etc.
 #
+#  Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
 #  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>  #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>  #  SPDX-License-Identifier: BSD-2-Clause-Patent @@ -107,6 +108,7 @@
   gEfiFormBrowser2ProtocolGuid                  ## SOMETIMES_CONSUMES
   gEfiRamDiskProtocolGuid                       ## SOMETIMES_CONSUMES
   gEfiDeferredImageLoadProtocolGuid             ## SOMETIMES_CONSUMES
+  gEdkiiPlatformBootManagerProtocolGuid         ## SOMETIMES_CONSUMES
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange      ## SOMETIMES_CONSUMES
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 41b9e70..cc238e9 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -3,6 +3,7 @@
 # It also provides the definitions(including PPIs/PROTOCOLs/GUIDs and library classes)  # and libraries instances, which are used for those modules.
 #
+# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
 # Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>  # Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>  # (C) Copyright 2016 - 2019 Hewlett Packard Enterprise Development LP<BR> @@ -609,6 +610,9 @@
   ## Include/Protocol/PeCoffImageEmulator.h
   gEdkiiPeCoffImageEmulatorProtocolGuid = { 0x96f46153, 0x97a7, 0x4793, { 0xac, 0xc1, 0xfa, 0x19, 0xbf, 0x78, 0xea, 0x97 } }
 
+  ## Include/Protocol/PlatformBootManager.h
+  gEdkiiPlatformBootManagerProtocolGuid = { 0xaa17add4, 0x756c, 0x460d, 
+ { 0x94, 0xb8, 0x43, 0x88, 0xd7, 0xfb, 0x3e, 0x59 } }
+
 #
 # [Error.gEfiMdeModulePkgTokenSpaceGuid]
 #   0x80000001 | Invalid value provided.
--
2.7.4





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#52532): https://edk2.groups.io/g/devel/message/52532
Mute This Topic: https://groups.io/mt/69243735/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform Boot Manager Protocol
Posted by Ni, Ray 4 years, 4 months ago
Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Wang, Sunny (HPS SW) <sunnywang@hpe.com>
> Sent: Tuesday, December 24, 2019 12:44 PM
> To: devel@edk2.groups.io; ashishsingha@nvidia.com; Ni, Ray
> <ray.ni@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>; Kinney,
> Michael D <michael.d.kinney@intel.com>; afish@apple.com
> Cc: Wang, Sunny (HPS SW) <sunnywang@hpe.com>; Spottswood, Jason
> <jason.spottswood@hpe.com>
> Subject: RE: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform
> Boot Manager Protocol
> 
> Looks good enough to me. Thanks for addressing my comments, Ashish.
> Reviewed-by: Sunny Wang <sunnywang@hpe.com>
> 
> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Ashish Singhal
> Sent: Tuesday, December 24, 2019 10:58 AM
> To: devel@edk2.groups.io; ray.ni@intel.com; jian.j.wang@intel.com;
> hao.a.wu@intel.com; zhichao.gao@intel.com; michael.d.kinney@intel.com;
> afish@apple.com
> Cc: Ashish Singhal <ashishsingha@nvidia.com>
> Subject: [edk2-devel] [PATCH v7] 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>
> ---
>  .../Include/Protocol/PlatformBootManager.h         | 82
> ++++++++++++++++++++++
>  MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c   | 41 +++++++++--
>  .../Library/UefiBootManagerLib/InternalBm.h        |  2 +
>  .../UefiBootManagerLib/UefiBootManagerLib.inf      |  2 +
>  MdeModulePkg/MdeModulePkg.dec                      |  4 ++
>  5 files changed, 124 insertions(+), 7 deletions(-)  create mode 100644
> MdeModulePkg/Include/Protocol/PlatformBootManager.h
> 
> diff --git a/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> b/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> new file mode 100644
> index 0000000..26b9ce4
> --- /dev/null
> +++ b/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> @@ -0,0 +1,82 @@
> +/** @file
> +
> +  Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef __PLATFORM_BOOT_MANAGER_PROTOCOL_H__
> +#define __PLATFORM_BOOT_MANAGER_PROTOCOL_H__
> +
> +#include <Library/UefiBootManagerLib.h>
> +
> +//
> +// Platform Boot Manager Protocol GUID value // #define
> +EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_GUID \
> +    { \
> +      0xaa17add4, 0x756c, 0x460d, { 0x94, 0xb8, 0x43, 0x88, 0xd7, 0xfb, 0x3e,
> 0x59 } \
> +    }
> +
> +//
> +// Protocol interface structure
> +//
> +typedef struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL
> +EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL;
> +
> +//
> +// Revision The revision to which the protocol interface adheres.
> +//          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
> +
> +//
> +// Function Prototypes
> +//
> +
> +/*
> +  This function allows platform to refresh all boot options specific to
> +the platform. Within
> +  this function, platform can make modifications to the auto enumerated
> +platform boot options
> +  as well as NV boot options.
> +
> +  @param[in const] BootOptions             An array of auto enumerated
> platform boot options.
> +                                           This array will be freed by caller upon successful
> +                                           exit of this function and output array would be used.
> +
> +  @param[in const] BootOptionsCount        The number of elements in
> BootOptions.
> +
> +  @param[out]      UpdatedBootOptions      An array of boot options that
> have been customized
> +                                           for the platform on top of input boot options. This
> +                                           array would be allocated by
> REFRESH_ALL_BOOT_OPTIONS
> +                                           and would be freed by caller after consuming it.
> +
> +  @param[out]      UpdatedBootOptionsCount The number of elements in
> UpdatedBootOptions.
> +
> +
> +  @retval EFI_SUCCESS                      Platform refresh to input BootOptions and
> +                                           BootCount have been done.
> +
> +  @retval EFI_OUT_OF_RESOURCES             Memory allocation failed.
> +
> +  @retval EFI_INVALID_PARAMETER            Input is not correct.
> +
> +  @retval EFI_UNSUPPORTED                  Platform specific overrides are not
> supported.
> +*/
> +typedef
> +EFI_STATUS
> +(EFIAPI *PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS) (
> +  IN  CONST EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions,
> +  IN  CONST UINTN                        BootOptionsCount,
> +  OUT       EFI_BOOT_MANAGER_LOAD_OPTION **UpdatedBootOptions,
> +  OUT       UINTN                        *UpdatedBootOptionsCount
> +  );
> +
> +struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL {
> +  UINT64                                         Revision;
> +  PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS
> RefreshAllBootOptions;
> +};
> +
> +extern EFI_GUID gEdkiiPlatformBootManagerProtocolGuid;
> +
> +#endif /* __PLATFORM_BOOT_MANAGER_PROTOCOL_H__ */
> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> index 760d764..62c5b2dc 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++) { diff --git
> a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> index 027eb25..ac866ac 100644
> --- a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> +++ b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> @@ -1,6 +1,7 @@
>  /** @file
>    BDS library definition, include the file and data structure
> 
> +Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
>  Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
>  (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
>  SPDX-License-Identifier: BSD-2-Clause-Patent @@ -41,6 +42,7 @@ SPDX-
> License-Identifier: BSD-2-Clause-Patent  #include <Protocol/VariableLock.h>
> #include <Protocol/RamDisk.h>  #include <Protocol/DeferredImageLoad.h>
> +#include <Protocol/PlatformBootManager.h>
> 
>  #include <Guid/MemoryTypeInformation.h>  #include <Guid/FileInfo.h>
> diff --git
> a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> index ed6b467..cf59086 100644
> --- a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> +++
> b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> @@ -5,6 +5,7 @@
>  #  manipulation, hotkey registration, UEFI boot, connect/disconnect, console
> #  manipulation, driver health checking and etc.
>  #
> +#  Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
>  #  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>  #  (C)
> Copyright 2016 Hewlett Packard Enterprise Development LP<BR>  #  SPDX-
> License-Identifier: BSD-2-Clause-Patent @@ -107,6 +108,7 @@
>    gEfiFormBrowser2ProtocolGuid                  ## SOMETIMES_CONSUMES
>    gEfiRamDiskProtocolGuid                       ## SOMETIMES_CONSUMES
>    gEfiDeferredImageLoadProtocolGuid             ## SOMETIMES_CONSUMES
> +  gEdkiiPlatformBootManagerProtocolGuid         ## SOMETIMES_CONSUMES
> 
>  [Pcd]
> 
> gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationC
> hange      ## SOMETIMES_CONSUMES
> diff --git a/MdeModulePkg/MdeModulePkg.dec
> b/MdeModulePkg/MdeModulePkg.dec index 41b9e70..cc238e9 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -3,6 +3,7 @@
>  # It also provides the definitions(including PPIs/PROTOCOLs/GUIDs and
> library classes)  # and libraries instances, which are used for those modules.
>  #
> +# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
>  # Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>  #
> Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>  # (C) Copyright 2016 -
> 2019 Hewlett Packard Enterprise Development LP<BR> @@ -609,6 +610,9
> @@
>    ## Include/Protocol/PeCoffImageEmulator.h
>    gEdkiiPeCoffImageEmulatorProtocolGuid = { 0x96f46153, 0x97a7, 0x4793,
> { 0xac, 0xc1, 0xfa, 0x19, 0xbf, 0x78, 0xea, 0x97 } }
> 
> +  ## Include/Protocol/PlatformBootManager.h
> +  gEdkiiPlatformBootManagerProtocolGuid = { 0xaa17add4, 0x756c, 0x460d,
> + { 0x94, 0xb8, 0x43, 0x88, 0xd7, 0xfb, 0x3e, 0x59 } }
> +
>  #
>  # [Error.gEfiMdeModulePkgTokenSpaceGuid]
>  #   0x80000001 | Invalid value provided.
> --
> 2.7.4
> 
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#52536): https://edk2.groups.io/g/devel/message/52536
Mute This Topic: https://groups.io/mt/69243735/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform Boot Manager Protocol
Posted by Ashish Singhal 4 years, 4 months ago
Hi Ray,

Following up on this. Are we waiting on more suggestions or clarifications?

Thanks
Ashish

Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Ni, Ray <ray.ni@intel.com>
Sent: Monday, December 23, 2019 10:41:50 PM
To: Wang, Sunny (HPS SW) <sunnywang@hpe.com>; devel@edk2.groups.io <devel@edk2.groups.io>; Ashish Singhal <ashishsingha@nvidia.com>; Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; afish@apple.com <afish@apple.com>
Cc: Spottswood, Jason <jason.spottswood@hpe.com>
Subject: RE: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform Boot Manager Protocol

External email: Use caution opening links or attachments


Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Wang, Sunny (HPS SW) <sunnywang@hpe.com>
> Sent: Tuesday, December 24, 2019 12:44 PM
> To: devel@edk2.groups.io; ashishsingha@nvidia.com; Ni, Ray
> <ray.ni@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>; Kinney,
> Michael D <michael.d.kinney@intel.com>; afish@apple.com
> Cc: Wang, Sunny (HPS SW) <sunnywang@hpe.com>; Spottswood, Jason
> <jason.spottswood@hpe.com>
> Subject: RE: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform
> Boot Manager Protocol
>
> Looks good enough to me. Thanks for addressing my comments, Ashish.
> Reviewed-by: Sunny Wang <sunnywang@hpe.com>
>
> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Ashish Singhal
> Sent: Tuesday, December 24, 2019 10:58 AM
> To: devel@edk2.groups.io; ray.ni@intel.com; jian.j.wang@intel.com;
> hao.a.wu@intel.com; zhichao.gao@intel.com; michael.d.kinney@intel.com;
> afish@apple.com
> Cc: Ashish Singhal <ashishsingha@nvidia.com>
> Subject: [edk2-devel] [PATCH v7] 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>
> ---
>  .../Include/Protocol/PlatformBootManager.h         | 82
> ++++++++++++++++++++++
>  MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c   | 41 +++++++++--
>  .../Library/UefiBootManagerLib/InternalBm.h        |  2 +
>  .../UefiBootManagerLib/UefiBootManagerLib.inf      |  2 +
>  MdeModulePkg/MdeModulePkg.dec                      |  4 ++
>  5 files changed, 124 insertions(+), 7 deletions(-)  create mode 100644
> MdeModulePkg/Include/Protocol/PlatformBootManager.h
>
> diff --git a/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> b/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> new file mode 100644
> index 0000000..26b9ce4
> --- /dev/null
> +++ b/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> @@ -0,0 +1,82 @@
> +/** @file
> +
> +  Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef __PLATFORM_BOOT_MANAGER_PROTOCOL_H__
> +#define __PLATFORM_BOOT_MANAGER_PROTOCOL_H__
> +
> +#include <Library/UefiBootManagerLib.h>
> +
> +//
> +// Platform Boot Manager Protocol GUID value // #define
> +EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_GUID \
> +    { \
> +      0xaa17add4, 0x756c, 0x460d, { 0x94, 0xb8, 0x43, 0x88, 0xd7, 0xfb, 0x3e,
> 0x59 } \
> +    }
> +
> +//
> +// Protocol interface structure
> +//
> +typedef struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL
> +EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL;
> +
> +//
> +// Revision The revision to which the protocol interface adheres.
> +//          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
> +
> +//
> +// Function Prototypes
> +//
> +
> +/*
> +  This function allows platform to refresh all boot options specific to
> +the platform. Within
> +  this function, platform can make modifications to the auto enumerated
> +platform boot options
> +  as well as NV boot options.
> +
> +  @param[in const] BootOptions             An array of auto enumerated
> platform boot options.
> +                                           This array will be freed by caller upon successful
> +                                           exit of this function and output array would be used.
> +
> +  @param[in const] BootOptionsCount        The number of elements in
> BootOptions.
> +
> +  @param[out]      UpdatedBootOptions      An array of boot options that
> have been customized
> +                                           for the platform on top of input boot options. This
> +                                           array would be allocated by
> REFRESH_ALL_BOOT_OPTIONS
> +                                           and would be freed by caller after consuming it.
> +
> +  @param[out]      UpdatedBootOptionsCount The number of elements in
> UpdatedBootOptions.
> +
> +
> +  @retval EFI_SUCCESS                      Platform refresh to input BootOptions and
> +                                           BootCount have been done.
> +
> +  @retval EFI_OUT_OF_RESOURCES             Memory allocation failed.
> +
> +  @retval EFI_INVALID_PARAMETER            Input is not correct.
> +
> +  @retval EFI_UNSUPPORTED                  Platform specific overrides are not
> supported.
> +*/
> +typedef
> +EFI_STATUS
> +(EFIAPI *PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS) (
> +  IN  CONST EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions,
> +  IN  CONST UINTN                        BootOptionsCount,
> +  OUT       EFI_BOOT_MANAGER_LOAD_OPTION **UpdatedBootOptions,
> +  OUT       UINTN                        *UpdatedBootOptionsCount
> +  );
> +
> +struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL {
> +  UINT64                                         Revision;
> +  PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS
> RefreshAllBootOptions;
> +};
> +
> +extern EFI_GUID gEdkiiPlatformBootManagerProtocolGuid;
> +
> +#endif /* __PLATFORM_BOOT_MANAGER_PROTOCOL_H__ */
> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> index 760d764..62c5b2dc 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++) { diff --git
> a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> index 027eb25..ac866ac 100644
> --- a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> +++ b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> @@ -1,6 +1,7 @@
>  /** @file
>    BDS library definition, include the file and data structure
>
> +Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
>  Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
>  (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
>  SPDX-License-Identifier: BSD-2-Clause-Patent @@ -41,6 +42,7 @@ SPDX-
> License-Identifier: BSD-2-Clause-Patent  #include <Protocol/VariableLock.h>
> #include <Protocol/RamDisk.h>  #include <Protocol/DeferredImageLoad.h>
> +#include <Protocol/PlatformBootManager.h>
>
>  #include <Guid/MemoryTypeInformation.h>  #include <Guid/FileInfo.h>
> diff --git
> a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> index ed6b467..cf59086 100644
> --- a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> +++
> b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> @@ -5,6 +5,7 @@
>  #  manipulation, hotkey registration, UEFI boot, connect/disconnect, console
> #  manipulation, driver health checking and etc.
>  #
> +#  Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
>  #  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>  #  (C)
> Copyright 2016 Hewlett Packard Enterprise Development LP<BR>  #  SPDX-
> License-Identifier: BSD-2-Clause-Patent @@ -107,6 +108,7 @@
>    gEfiFormBrowser2ProtocolGuid                  ## SOMETIMES_CONSUMES
>    gEfiRamDiskProtocolGuid                       ## SOMETIMES_CONSUMES
>    gEfiDeferredImageLoadProtocolGuid             ## SOMETIMES_CONSUMES
> +  gEdkiiPlatformBootManagerProtocolGuid         ## SOMETIMES_CONSUMES
>
>  [Pcd]
>
> gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationC
> hange      ## SOMETIMES_CONSUMES
> diff --git a/MdeModulePkg/MdeModulePkg.dec
> b/MdeModulePkg/MdeModulePkg.dec index 41b9e70..cc238e9 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -3,6 +3,7 @@
>  # It also provides the definitions(including PPIs/PROTOCOLs/GUIDs and
> library classes)  # and libraries instances, which are used for those modules.
>  #
> +# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
>  # Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>  #
> Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>  # (C) Copyright 2016 -
> 2019 Hewlett Packard Enterprise Development LP<BR> @@ -609,6 +610,9
> @@
>    ## Include/Protocol/PeCoffImageEmulator.h
>    gEdkiiPeCoffImageEmulatorProtocolGuid = { 0x96f46153, 0x97a7, 0x4793,
> { 0xac, 0xc1, 0xfa, 0x19, 0xbf, 0x78, 0xea, 0x97 } }
>
> +  ## Include/Protocol/PlatformBootManager.h
> +  gEdkiiPlatformBootManagerProtocolGuid = { 0xaa17add4, 0x756c, 0x460d,
> + { 0x94, 0xb8, 0x43, 0x88, 0xd7, 0xfb, 0x3e, 0x59 } }
> +
>  #
>  # [Error.gEfiMdeModulePkgTokenSpaceGuid]
>  #   0x80000001 | Invalid value provided.
> --
> 2.7.4
>
>
> 
>


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#52574): https://edk2.groups.io/g/devel/message/52574
Mute This Topic: https://groups.io/mt/69243735/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform Boot Manager Protocol
Posted by Ni, Ray 4 years, 3 months ago
Ashish, no follow up is required from your side.
MdeModulePkg maintainers will help to push the patches.

From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Ashish Singhal
Sent: Thursday, December 26, 2019 11:42 AM
To: Ni, Ray <ray.ni@intel.com>; Wang, Sunny (HPS SW) <sunnywang@hpe.com>; devel@edk2.groups.io; Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; afish@apple.com
Cc: Spottswood, Jason <jason.spottswood@hpe.com>
Subject: Re: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform Boot Manager Protocol

Hi Ray,

Following up on this. Are we waiting on more suggestions or clarifications?

Thanks
Ashish

Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
Sent: Monday, December 23, 2019 10:41:50 PM
To: Wang, Sunny (HPS SW) <sunnywang@hpe.com<mailto:sunnywang@hpe.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>>; Ashish Singhal <ashishsingha@nvidia.com<mailto:ashishsingha@nvidia.com>>; Wang, Jian J <jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>>; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Gao, Zhichao <zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; afish@apple.com<mailto:afish@apple.com> <afish@apple.com<mailto:afish@apple.com>>
Cc: Spottswood, Jason <jason.spottswood@hpe.com<mailto:jason.spottswood@hpe.com>>
Subject: RE: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform Boot Manager Protocol

External email: Use caution opening links or attachments


Reviewed-by: Ray Ni <ray.ni@intel.com<mailto:ray.ni@intel.com>>

> -----Original Message-----
> From: Wang, Sunny (HPS SW) <sunnywang@hpe.com<mailto:sunnywang@hpe.com>>
> Sent: Tuesday, December 24, 2019 12:44 PM
> To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; ashishsingha@nvidia.com<mailto:ashishsingha@nvidia.com>; Ni, Ray
> <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Wang, Jian J <jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>>; Wu, Hao A
> <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Gao, Zhichao <zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>>; Kinney,
> Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; afish@apple.com<mailto:afish@apple.com>
> Cc: Wang, Sunny (HPS SW) <sunnywang@hpe.com<mailto:sunnywang@hpe.com>>; Spottswood, Jason
> <jason.spottswood@hpe.com<mailto:jason.spottswood@hpe.com>>
> Subject: RE: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform
> Boot Manager Protocol
>
> Looks good enough to me. Thanks for addressing my comments, Ashish.
> Reviewed-by: Sunny Wang <sunnywang@hpe.com<mailto:sunnywang@hpe.com>>
>
> -----Original Message-----
> From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> [mailto:devel@edk2.groups.io] On Behalf Of
> Ashish Singhal
> Sent: Tuesday, December 24, 2019 10:58 AM
> To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; ray.ni@intel.com<mailto:ray.ni@intel.com>; jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>;
> hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>; zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>; michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>;
> afish@apple.com<mailto:afish@apple.com>
> Cc: Ashish Singhal <ashishsingha@nvidia.com<mailto:ashishsingha@nvidia.com>>
> Subject: [edk2-devel] [PATCH v7] 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<mailto:ashishsingha@nvidia.com>>
> ---
>  .../Include/Protocol/PlatformBootManager.h         | 82
> ++++++++++++++++++++++
>  MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c   | 41 +++++++++--
>  .../Library/UefiBootManagerLib/InternalBm.h        |  2 +
>  .../UefiBootManagerLib/UefiBootManagerLib.inf      |  2 +
>  MdeModulePkg/MdeModulePkg.dec                      |  4 ++
>  5 files changed, 124 insertions(+), 7 deletions(-)  create mode 100644
> MdeModulePkg/Include/Protocol/PlatformBootManager.h
>
> diff --git a/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> b/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> new file mode 100644
> index 0000000..26b9ce4
> --- /dev/null
> +++ b/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> @@ -0,0 +1,82 @@
> +/** @file
> +
> +  Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef __PLATFORM_BOOT_MANAGER_PROTOCOL_H__
> +#define __PLATFORM_BOOT_MANAGER_PROTOCOL_H__
> +
> +#include <Library/UefiBootManagerLib.h>
> +
> +//
> +// Platform Boot Manager Protocol GUID value // #define
> +EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_GUID \
> +    { \
> +      0xaa17add4, 0x756c, 0x460d, { 0x94, 0xb8, 0x43, 0x88, 0xd7, 0xfb, 0x3e,
> 0x59 } \
> +    }
> +
> +//
> +// Protocol interface structure
> +//
> +typedef struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL
> +EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL;
> +
> +//
> +// Revision The revision to which the protocol interface adheres.
> +//          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
> +
> +//
> +// Function Prototypes
> +//
> +
> +/*
> +  This function allows platform to refresh all boot options specific to
> +the platform. Within
> +  this function, platform can make modifications to the auto enumerated
> +platform boot options
> +  as well as NV boot options.
> +
> +  @param[in const] BootOptions             An array of auto enumerated
> platform boot options.
> +                                           This array will be freed by caller upon successful
> +                                           exit of this function and output array would be used.
> +
> +  @param[in const] BootOptionsCount        The number of elements in
> BootOptions.
> +
> +  @param[out]      UpdatedBootOptions      An array of boot options that
> have been customized
> +                                           for the platform on top of input boot options. This
> +                                           array would be allocated by
> REFRESH_ALL_BOOT_OPTIONS
> +                                           and would be freed by caller after consuming it.
> +
> +  @param[out]      UpdatedBootOptionsCount The number of elements in
> UpdatedBootOptions.
> +
> +
> +  @retval EFI_SUCCESS                      Platform refresh to input BootOptions and
> +                                           BootCount have been done.
> +
> +  @retval EFI_OUT_OF_RESOURCES             Memory allocation failed.
> +
> +  @retval EFI_INVALID_PARAMETER            Input is not correct.
> +
> +  @retval EFI_UNSUPPORTED                  Platform specific overrides are not
> supported.
> +*/
> +typedef
> +EFI_STATUS
> +(EFIAPI *PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS) (
> +  IN  CONST EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions,
> +  IN  CONST UINTN                        BootOptionsCount,
> +  OUT       EFI_BOOT_MANAGER_LOAD_OPTION **UpdatedBootOptions,
> +  OUT       UINTN                        *UpdatedBootOptionsCount
> +  );
> +
> +struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL {
> +  UINT64                                         Revision;
> +  PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS
> RefreshAllBootOptions;
> +};
> +
> +extern EFI_GUID gEdkiiPlatformBootManagerProtocolGuid;
> +
> +#endif /* __PLATFORM_BOOT_MANAGER_PROTOCOL_H__ */
> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> index 760d764..62c5b2dc 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++) { diff --git
> a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> index 027eb25..ac866ac 100644
> --- a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> +++ b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> @@ -1,6 +1,7 @@
>  /** @file
>    BDS library definition, include the file and data structure
>
> +Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
>  Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
>  (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
>  SPDX-License-Identifier: BSD-2-Clause-Patent @@ -41,6 +42,7 @@ SPDX-
> License-Identifier: BSD-2-Clause-Patent  #include <Protocol/VariableLock.h>
> #include <Protocol/RamDisk.h>  #include <Protocol/DeferredImageLoad.h>
> +#include <Protocol/PlatformBootManager.h>
>
>  #include <Guid/MemoryTypeInformation.h>  #include <Guid/FileInfo.h>
> diff --git
> a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> index ed6b467..cf59086 100644
> --- a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> +++
> b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> @@ -5,6 +5,7 @@
>  #  manipulation, hotkey registration, UEFI boot, connect/disconnect, console
> #  manipulation, driver health checking and etc.
>  #
> +#  Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
>  #  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>  #  (C)
> Copyright 2016 Hewlett Packard Enterprise Development LP<BR>  #  SPDX-
> License-Identifier: BSD-2-Clause-Patent @@ -107,6 +108,7 @@
>    gEfiFormBrowser2ProtocolGuid                  ## SOMETIMES_CONSUMES
>    gEfiRamDiskProtocolGuid                       ## SOMETIMES_CONSUMES
>    gEfiDeferredImageLoadProtocolGuid             ## SOMETIMES_CONSUMES
> +  gEdkiiPlatformBootManagerProtocolGuid         ## SOMETIMES_CONSUMES
>
>  [Pcd]
>
> gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationC
> hange      ## SOMETIMES_CONSUMES
> diff --git a/MdeModulePkg/MdeModulePkg.dec
> b/MdeModulePkg/MdeModulePkg.dec index 41b9e70..cc238e9 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -3,6 +3,7 @@
>  # It also provides the definitions(including PPIs/PROTOCOLs/GUIDs and
> library classes)  # and libraries instances, which are used for those modules.
>  #
> +# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
>  # Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>  #
> Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>  # (C) Copyright 2016 -
> 2019 Hewlett Packard Enterprise Development LP<BR> @@ -609,6 +610,9
> @@
>    ## Include/Protocol/PeCoffImageEmulator.h
>    gEdkiiPeCoffImageEmulatorProtocolGuid = { 0x96f46153, 0x97a7, 0x4793,
> { 0xac, 0xc1, 0xfa, 0x19, 0xbf, 0x78, 0xea, 0x97 } }
>
> +  ## Include/Protocol/PlatformBootManager.h
> +  gEdkiiPlatformBootManagerProtocolGuid = { 0xaa17add4, 0x756c, 0x460d,
> + { 0x94, 0xb8, 0x43, 0x88, 0xd7, 0xfb, 0x3e, 0x59 } }
> +
>  #
>  # [Error.gEfiMdeModulePkgTokenSpaceGuid]
>  #   0x80000001 | Invalid value provided.
> --
> 2.7.4
>
>
>
>
________________________________
This email message is for the sole use of the intended recipient(s) and may contain confidential information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
________________________________


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#52639): https://edk2.groups.io/g/devel/message/52639
Mute This Topic: https://groups.io/mt/69243735/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform Boot Manager Protocol
Posted by Ashish Singhal 4 years, 3 months ago
Hello Hao/Jian,

As per Maintainers.txt, I think you guys are the overall maintainers of MdeModulePkg. Bringing this patch to your attention so that it could be submitted. Ray who is the reviewer of BDS changes has already reviewed this patch.

Thanks
Ashish

From: Ni, Ray <ray.ni@intel.com>
Sent: Wednesday, January 1, 2020 7:05 PM
To: devel@edk2.groups.io; Ashish Singhal <ashishsingha@nvidia.com>; Wang, Sunny (HPS SW) <sunnywang@hpe.com>; Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; afish@apple.com
Cc: Spottswood, Jason <jason.spottswood@hpe.com>
Subject: RE: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform Boot Manager Protocol

External email: Use caution opening links or attachments

Ashish, no follow up is required from your side.
MdeModulePkg maintainers will help to push the patches.

From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Ashish Singhal
Sent: Thursday, December 26, 2019 11:42 AM
To: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Wang, Sunny (HPS SW) <sunnywang@hpe.com<mailto:sunnywang@hpe.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Wang, Jian J <jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>>; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Gao, Zhichao <zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; afish@apple.com<mailto:afish@apple.com>
Cc: Spottswood, Jason <jason.spottswood@hpe.com<mailto:jason.spottswood@hpe.com>>
Subject: Re: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform Boot Manager Protocol

Hi Ray,

Following up on this. Are we waiting on more suggestions or clarifications?

Thanks
Ashish

Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
Sent: Monday, December 23, 2019 10:41:50 PM
To: Wang, Sunny (HPS SW) <sunnywang@hpe.com<mailto:sunnywang@hpe.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>>; Ashish Singhal <ashishsingha@nvidia.com<mailto:ashishsingha@nvidia.com>>; Wang, Jian J <jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>>; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Gao, Zhichao <zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; afish@apple.com<mailto:afish@apple.com> <afish@apple.com<mailto:afish@apple.com>>
Cc: Spottswood, Jason <jason.spottswood@hpe.com<mailto:jason.spottswood@hpe.com>>
Subject: RE: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform Boot Manager Protocol

External email: Use caution opening links or attachments


Reviewed-by: Ray Ni <ray.ni@intel.com<mailto:ray.ni@intel.com>>

> -----Original Message-----
> From: Wang, Sunny (HPS SW) <sunnywang@hpe.com<mailto:sunnywang@hpe.com>>
> Sent: Tuesday, December 24, 2019 12:44 PM
> To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; ashishsingha@nvidia.com<mailto:ashishsingha@nvidia.com>; Ni, Ray
> <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Wang, Jian J <jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>>; Wu, Hao A
> <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Gao, Zhichao <zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>>; Kinney,
> Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; afish@apple.com<mailto:afish@apple.com>
> Cc: Wang, Sunny (HPS SW) <sunnywang@hpe.com<mailto:sunnywang@hpe.com>>; Spottswood, Jason
> <jason.spottswood@hpe.com<mailto:jason.spottswood@hpe.com>>
> Subject: RE: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform
> Boot Manager Protocol
>
> Looks good enough to me. Thanks for addressing my comments, Ashish.
> Reviewed-by: Sunny Wang <sunnywang@hpe.com<mailto:sunnywang@hpe.com>>
>
> -----Original Message-----
> From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> [mailto:devel@edk2.groups.io] On Behalf Of
> Ashish Singhal
> Sent: Tuesday, December 24, 2019 10:58 AM
> To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; ray.ni@intel.com<mailto:ray.ni@intel.com>; jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>;
> hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>; zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>; michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>;
> afish@apple.com<mailto:afish@apple.com>
> Cc: Ashish Singhal <ashishsingha@nvidia.com<mailto:ashishsingha@nvidia.com>>
> Subject: [edk2-devel] [PATCH v7] 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<mailto:ashishsingha@nvidia.com>>
> ---
>  .../Include/Protocol/PlatformBootManager.h         | 82
> ++++++++++++++++++++++
>  MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c   | 41 +++++++++--
>  .../Library/UefiBootManagerLib/InternalBm.h        |  2 +
>  .../UefiBootManagerLib/UefiBootManagerLib.inf      |  2 +
>  MdeModulePkg/MdeModulePkg.dec                      |  4 ++
>  5 files changed, 124 insertions(+), 7 deletions(-)  create mode 100644
> MdeModulePkg/Include/Protocol/PlatformBootManager.h
>
> diff --git a/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> b/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> new file mode 100644
> index 0000000..26b9ce4
> --- /dev/null
> +++ b/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> @@ -0,0 +1,82 @@
> +/** @file
> +
> +  Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef __PLATFORM_BOOT_MANAGER_PROTOCOL_H__
> +#define __PLATFORM_BOOT_MANAGER_PROTOCOL_H__
> +
> +#include <Library/UefiBootManagerLib.h>
> +
> +//
> +// Platform Boot Manager Protocol GUID value // #define
> +EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_GUID \
> +    { \
> +      0xaa17add4, 0x756c, 0x460d, { 0x94, 0xb8, 0x43, 0x88, 0xd7, 0xfb, 0x3e,
> 0x59 } \
> +    }
> +
> +//
> +// Protocol interface structure
> +//
> +typedef struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL
> +EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL;
> +
> +//
> +// Revision The revision to which the protocol interface adheres.
> +//          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
> +
> +//
> +// Function Prototypes
> +//
> +
> +/*
> +  This function allows platform to refresh all boot options specific to
> +the platform. Within
> +  this function, platform can make modifications to the auto enumerated
> +platform boot options
> +  as well as NV boot options.
> +
> +  @param[in const] BootOptions             An array of auto enumerated
> platform boot options.
> +                                           This array will be freed by caller upon successful
> +                                           exit of this function and output array would be used.
> +
> +  @param[in const] BootOptionsCount        The number of elements in
> BootOptions.
> +
> +  @param[out]      UpdatedBootOptions      An array of boot options that
> have been customized
> +                                           for the platform on top of input boot options. This
> +                                           array would be allocated by
> REFRESH_ALL_BOOT_OPTIONS
> +                                           and would be freed by caller after consuming it.
> +
> +  @param[out]      UpdatedBootOptionsCount The number of elements in
> UpdatedBootOptions.
> +
> +
> +  @retval EFI_SUCCESS                      Platform refresh to input BootOptions and
> +                                           BootCount have been done.
> +
> +  @retval EFI_OUT_OF_RESOURCES             Memory allocation failed.
> +
> +  @retval EFI_INVALID_PARAMETER            Input is not correct.
> +
> +  @retval EFI_UNSUPPORTED                  Platform specific overrides are not
> supported.
> +*/
> +typedef
> +EFI_STATUS
> +(EFIAPI *PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS) (
> +  IN  CONST EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions,
> +  IN  CONST UINTN                        BootOptionsCount,
> +  OUT       EFI_BOOT_MANAGER_LOAD_OPTION **UpdatedBootOptions,
> +  OUT       UINTN                        *UpdatedBootOptionsCount
> +  );
> +
> +struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL {
> +  UINT64                                         Revision;
> +  PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS
> RefreshAllBootOptions;
> +};
> +
> +extern EFI_GUID gEdkiiPlatformBootManagerProtocolGuid;
> +
> +#endif /* __PLATFORM_BOOT_MANAGER_PROTOCOL_H__ */
> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> index 760d764..62c5b2dc 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++) { diff --git
> a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> index 027eb25..ac866ac 100644
> --- a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> +++ b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> @@ -1,6 +1,7 @@
>  /** @file
>    BDS library definition, include the file and data structure
>
> +Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
>  Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
>  (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
>  SPDX-License-Identifier: BSD-2-Clause-Patent @@ -41,6 +42,7 @@ SPDX-
> License-Identifier: BSD-2-Clause-Patent  #include <Protocol/VariableLock.h>
> #include <Protocol/RamDisk.h>  #include <Protocol/DeferredImageLoad.h>
> +#include <Protocol/PlatformBootManager.h>
>
>  #include <Guid/MemoryTypeInformation.h>  #include <Guid/FileInfo.h>
> diff --git
> a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> index ed6b467..cf59086 100644
> --- a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> +++
> b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> @@ -5,6 +5,7 @@
>  #  manipulation, hotkey registration, UEFI boot, connect/disconnect, console
> #  manipulation, driver health checking and etc.
>  #
> +#  Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
>  #  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>  #  (C)
> Copyright 2016 Hewlett Packard Enterprise Development LP<BR>  #  SPDX-
> License-Identifier: BSD-2-Clause-Patent @@ -107,6 +108,7 @@
>    gEfiFormBrowser2ProtocolGuid                  ## SOMETIMES_CONSUMES
>    gEfiRamDiskProtocolGuid                       ## SOMETIMES_CONSUMES
>    gEfiDeferredImageLoadProtocolGuid             ## SOMETIMES_CONSUMES
> +  gEdkiiPlatformBootManagerProtocolGuid         ## SOMETIMES_CONSUMES
>
>  [Pcd]
>
> gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationC
> hange      ## SOMETIMES_CONSUMES
> diff --git a/MdeModulePkg/MdeModulePkg.dec
> b/MdeModulePkg/MdeModulePkg.dec index 41b9e70..cc238e9 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -3,6 +3,7 @@
>  # It also provides the definitions(including PPIs/PROTOCOLs/GUIDs and
> library classes)  # and libraries instances, which are used for those modules.
>  #
> +# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
>  # Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>  #
> Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>  # (C) Copyright 2016 -
> 2019 Hewlett Packard Enterprise Development LP<BR> @@ -609,6 +610,9
> @@
>    ## Include/Protocol/PeCoffImageEmulator.h
>    gEdkiiPeCoffImageEmulatorProtocolGuid = { 0x96f46153, 0x97a7, 0x4793,
> { 0xac, 0xc1, 0xfa, 0x19, 0xbf, 0x78, 0xea, 0x97 } }
>
> +  ## Include/Protocol/PlatformBootManager.h
> +  gEdkiiPlatformBootManagerProtocolGuid = { 0xaa17add4, 0x756c, 0x460d,
> + { 0x94, 0xb8, 0x43, 0x88, 0xd7, 0xfb, 0x3e, 0x59 } }
> +
>  #
>  # [Error.gEfiMdeModulePkgTokenSpaceGuid]
>  #   0x80000001 | Invalid value provided.
> --
> 2.7.4
>
>
>
>
________________________________
This email message is for the sole use of the intended recipient(s) and may contain confidential information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
________________________________


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#53001): https://edk2.groups.io/g/devel/message/53001
Mute This Topic: https://groups.io/mt/69243735/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform Boot Manager Protocol
Posted by Wang, Jian J 4 years, 3 months ago
Pushed @ 972d88726410e21b1fff1a528854202c67e97ef1

Regards,
Jian

From: Ashish Singhal <ashishsingha@nvidia.com>
Sent: Wednesday, January 08, 2020 1:18 PM
To: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; devel@edk2.groups.io
Cc: Spottswood, Jason <jason.spottswood@hpe.com>; Wang, Sunny (HPS SW) <sunnywang@hpe.com>; Ni, Ray <ray.ni@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Andrew Fish <afish@apple.com>
Subject: RE: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform Boot Manager Protocol

Hello Hao/Jian,

As per Maintainers.txt, I think you guys are the overall maintainers of MdeModulePkg. Bringing this patch to your attention so that it could be submitted. Ray who is the reviewer of BDS changes has already reviewed this patch.

Thanks
Ashish

From: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
Sent: Wednesday, January 1, 2020 7:05 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Ashish Singhal <ashishsingha@nvidia.com<mailto:ashishsingha@nvidia.com>>; Wang, Sunny (HPS SW) <sunnywang@hpe.com<mailto:sunnywang@hpe.com>>; Wang, Jian J <jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>>; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Gao, Zhichao <zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; afish@apple.com<mailto:afish@apple.com>
Cc: Spottswood, Jason <jason.spottswood@hpe.com<mailto:jason.spottswood@hpe.com>>
Subject: RE: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform Boot Manager Protocol

External email: Use caution opening links or attachments


Ashish, no follow up is required from your side.
MdeModulePkg maintainers will help to push the patches.

From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Ashish Singhal
Sent: Thursday, December 26, 2019 11:42 AM
To: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Wang, Sunny (HPS SW) <sunnywang@hpe.com<mailto:sunnywang@hpe.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Wang, Jian J <jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>>; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Gao, Zhichao <zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; afish@apple.com<mailto:afish@apple.com>
Cc: Spottswood, Jason <jason.spottswood@hpe.com<mailto:jason.spottswood@hpe.com>>
Subject: Re: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform Boot Manager Protocol

Hi Ray,

Following up on this. Are we waiting on more suggestions or clarifications?

Thanks
Ashish

Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>
Sent: Monday, December 23, 2019 10:41:50 PM
To: Wang, Sunny (HPS SW) <sunnywang@hpe.com<mailto:sunnywang@hpe.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>>; Ashish Singhal <ashishsingha@nvidia.com<mailto:ashishsingha@nvidia.com>>; Wang, Jian J <jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>>; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Gao, Zhichao <zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; afish@apple.com<mailto:afish@apple.com> <afish@apple.com<mailto:afish@apple.com>>
Cc: Spottswood, Jason <jason.spottswood@hpe.com<mailto:jason.spottswood@hpe.com>>
Subject: RE: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform Boot Manager Protocol

External email: Use caution opening links or attachments


Reviewed-by: Ray Ni <ray.ni@intel.com<mailto:ray.ni@intel.com>>

> -----Original Message-----
> From: Wang, Sunny (HPS SW) <sunnywang@hpe.com<mailto:sunnywang@hpe.com>>
> Sent: Tuesday, December 24, 2019 12:44 PM
> To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; ashishsingha@nvidia.com<mailto:ashishsingha@nvidia.com>; Ni, Ray
> <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Wang, Jian J <jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>>; Wu, Hao A
> <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; Gao, Zhichao <zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>>; Kinney,
> Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; afish@apple.com<mailto:afish@apple.com>
> Cc: Wang, Sunny (HPS SW) <sunnywang@hpe.com<mailto:sunnywang@hpe.com>>; Spottswood, Jason
> <jason.spottswood@hpe.com<mailto:jason.spottswood@hpe.com>>
> Subject: RE: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform
> Boot Manager Protocol
>
> Looks good enough to me. Thanks for addressing my comments, Ashish.
> Reviewed-by: Sunny Wang <sunnywang@hpe.com<mailto:sunnywang@hpe.com>>
>
> -----Original Message-----
> From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> [mailto:devel@edk2.groups.io] On Behalf Of
> Ashish Singhal
> Sent: Tuesday, December 24, 2019 10:58 AM
> To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; ray.ni@intel.com<mailto:ray.ni@intel.com>; jian.j.wang@intel.com<mailto:jian.j.wang@intel.com>;
> hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>; zhichao.gao@intel.com<mailto:zhichao.gao@intel.com>; michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>;
> afish@apple.com<mailto:afish@apple.com>
> Cc: Ashish Singhal <ashishsingha@nvidia.com<mailto:ashishsingha@nvidia.com>>
> Subject: [edk2-devel] [PATCH v7] 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<mailto:ashishsingha@nvidia.com>>
> ---
>  .../Include/Protocol/PlatformBootManager.h         | 82
> ++++++++++++++++++++++
>  MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c   | 41 +++++++++--
>  .../Library/UefiBootManagerLib/InternalBm.h        |  2 +
>  .../UefiBootManagerLib/UefiBootManagerLib.inf      |  2 +
>  MdeModulePkg/MdeModulePkg.dec                      |  4 ++
>  5 files changed, 124 insertions(+), 7 deletions(-)  create mode 100644
> MdeModulePkg/Include/Protocol/PlatformBootManager.h
>
> diff --git a/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> b/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> new file mode 100644
> index 0000000..26b9ce4
> --- /dev/null
> +++ b/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> @@ -0,0 +1,82 @@
> +/** @file
> +
> +  Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef __PLATFORM_BOOT_MANAGER_PROTOCOL_H__
> +#define __PLATFORM_BOOT_MANAGER_PROTOCOL_H__
> +
> +#include <Library/UefiBootManagerLib.h>
> +
> +//
> +// Platform Boot Manager Protocol GUID value // #define
> +EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_GUID \
> +    { \
> +      0xaa17add4, 0x756c, 0x460d, { 0x94, 0xb8, 0x43, 0x88, 0xd7, 0xfb, 0x3e,
> 0x59 } \
> +    }
> +
> +//
> +// Protocol interface structure
> +//
> +typedef struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL
> +EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL;
> +
> +//
> +// Revision The revision to which the protocol interface adheres.
> +//          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
> +
> +//
> +// Function Prototypes
> +//
> +
> +/*
> +  This function allows platform to refresh all boot options specific to
> +the platform. Within
> +  this function, platform can make modifications to the auto enumerated
> +platform boot options
> +  as well as NV boot options.
> +
> +  @param[in const] BootOptions             An array of auto enumerated
> platform boot options.
> +                                           This array will be freed by caller upon successful
> +                                           exit of this function and output array would be used.
> +
> +  @param[in const] BootOptionsCount        The number of elements in
> BootOptions.
> +
> +  @param[out]      UpdatedBootOptions      An array of boot options that
> have been customized
> +                                           for the platform on top of input boot options. This
> +                                           array would be allocated by
> REFRESH_ALL_BOOT_OPTIONS
> +                                           and would be freed by caller after consuming it.
> +
> +  @param[out]      UpdatedBootOptionsCount The number of elements in
> UpdatedBootOptions.
> +
> +
> +  @retval EFI_SUCCESS                      Platform refresh to input BootOptions and
> +                                           BootCount have been done.
> +
> +  @retval EFI_OUT_OF_RESOURCES             Memory allocation failed.
> +
> +  @retval EFI_INVALID_PARAMETER            Input is not correct.
> +
> +  @retval EFI_UNSUPPORTED                  Platform specific overrides are not
> supported.
> +*/
> +typedef
> +EFI_STATUS
> +(EFIAPI *PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS) (
> +  IN  CONST EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions,
> +  IN  CONST UINTN                        BootOptionsCount,
> +  OUT       EFI_BOOT_MANAGER_LOAD_OPTION **UpdatedBootOptions,
> +  OUT       UINTN                        *UpdatedBootOptionsCount
> +  );
> +
> +struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL {
> +  UINT64                                         Revision;
> +  PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS
> RefreshAllBootOptions;
> +};
> +
> +extern EFI_GUID gEdkiiPlatformBootManagerProtocolGuid;
> +
> +#endif /* __PLATFORM_BOOT_MANAGER_PROTOCOL_H__ */
> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> index 760d764..62c5b2dc 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++) { diff --git
> a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> index 027eb25..ac866ac 100644
> --- a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> +++ b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> @@ -1,6 +1,7 @@
>  /** @file
>    BDS library definition, include the file and data structure
>
> +Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
>  Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
>  (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
>  SPDX-License-Identifier: BSD-2-Clause-Patent @@ -41,6 +42,7 @@ SPDX-
> License-Identifier: BSD-2-Clause-Patent  #include <Protocol/VariableLock.h>
> #include <Protocol/RamDisk.h>  #include <Protocol/DeferredImageLoad.h>
> +#include <Protocol/PlatformBootManager.h>
>
>  #include <Guid/MemoryTypeInformation.h>  #include <Guid/FileInfo.h>
> diff --git
> a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> index ed6b467..cf59086 100644
> --- a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> +++
> b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> @@ -5,6 +5,7 @@
>  #  manipulation, hotkey registration, UEFI boot, connect/disconnect, console
> #  manipulation, driver health checking and etc.
>  #
> +#  Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
>  #  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>  #  (C)
> Copyright 2016 Hewlett Packard Enterprise Development LP<BR>  #  SPDX-
> License-Identifier: BSD-2-Clause-Patent @@ -107,6 +108,7 @@
>    gEfiFormBrowser2ProtocolGuid                  ## SOMETIMES_CONSUMES
>    gEfiRamDiskProtocolGuid                       ## SOMETIMES_CONSUMES
>    gEfiDeferredImageLoadProtocolGuid             ## SOMETIMES_CONSUMES
> +  gEdkiiPlatformBootManagerProtocolGuid         ## SOMETIMES_CONSUMES
>
>  [Pcd]
>
> gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationC
> hange      ## SOMETIMES_CONSUMES
> diff --git a/MdeModulePkg/MdeModulePkg.dec
> b/MdeModulePkg/MdeModulePkg.dec index 41b9e70..cc238e9 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -3,6 +3,7 @@
>  # It also provides the definitions(including PPIs/PROTOCOLs/GUIDs and
> library classes)  # and libraries instances, which are used for those modules.
>  #
> +# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
>  # Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>  #
> Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>  # (C) Copyright 2016 -
> 2019 Hewlett Packard Enterprise Development LP<BR> @@ -609,6 +610,9
> @@
>    ## Include/Protocol/PeCoffImageEmulator.h
>    gEdkiiPeCoffImageEmulatorProtocolGuid = { 0x96f46153, 0x97a7, 0x4793,
> { 0xac, 0xc1, 0xfa, 0x19, 0xbf, 0x78, 0xea, 0x97 } }
>
> +  ## Include/Protocol/PlatformBootManager.h
> +  gEdkiiPlatformBootManagerProtocolGuid = { 0xaa17add4, 0x756c, 0x460d,
> + { 0x94, 0xb8, 0x43, 0x88, 0xd7, 0xfb, 0x3e, 0x59 } }
> +
>  #
>  # [Error.gEfiMdeModulePkgTokenSpaceGuid]
>  #   0x80000001 | Invalid value provided.
> --
> 2.7.4
>
>
>
>
________________________________
This email message is for the sole use of the intended recipient(s) and may contain confidential information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
________________________________


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#53006): https://edk2.groups.io/g/devel/message/53006
Mute This Topic: https://groups.io/mt/69243735/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH v7] MdeModulePkg: Add EDK2 Platform Boot Manager Protocol
Posted by Ni, Ray 4 years, 4 months ago
Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Ashish Singhal <ashishsingha@nvidia.com>
> Sent: Tuesday, December 24, 2019 10:58 AM
> To: devel@edk2.groups.io; Ni, Ray <ray.ni@intel.com>; Wang, Jian J
> <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Gao, Zhichao
> <zhichao.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>;
> afish@apple.com
> Cc: Ashish Singhal <ashishsingha@nvidia.com>
> Subject: [PATCH v7] 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>
> ---
>  .../Include/Protocol/PlatformBootManager.h         | 82
> ++++++++++++++++++++++
>  MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c   | 41 +++++++++--
>  .../Library/UefiBootManagerLib/InternalBm.h        |  2 +
>  .../UefiBootManagerLib/UefiBootManagerLib.inf      |  2 +
>  MdeModulePkg/MdeModulePkg.dec                      |  4 ++
>  5 files changed, 124 insertions(+), 7 deletions(-)
>  create mode 100644
> MdeModulePkg/Include/Protocol/PlatformBootManager.h
> 
> diff --git a/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> b/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> new file mode 100644
> index 0000000..26b9ce4
> --- /dev/null
> +++ b/MdeModulePkg/Include/Protocol/PlatformBootManager.h
> @@ -0,0 +1,82 @@
> +/** @file
> +
> +  Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef __PLATFORM_BOOT_MANAGER_PROTOCOL_H__
> +#define __PLATFORM_BOOT_MANAGER_PROTOCOL_H__
> +
> +#include <Library/UefiBootManagerLib.h>
> +
> +//
> +// Platform Boot Manager Protocol GUID value
> +//
> +#define EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL_GUID \
> +    { \
> +      0xaa17add4, 0x756c, 0x460d, { 0x94, 0xb8, 0x43, 0x88, 0xd7, 0xfb, 0x3e,
> 0x59 } \
> +    }
> +
> +//
> +// Protocol interface structure
> +//
> +typedef struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL
> EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL;
> +
> +//
> +// Revision The revision to which the protocol interface adheres.
> +//          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
> +
> +//
> +// Function Prototypes
> +//
> +
> +/*
> +  This function allows platform to refresh all boot options specific to the
> platform. Within
> +  this function, platform can make modifications to the auto enumerated
> platform boot options
> +  as well as NV boot options.
> +
> +  @param[in const] BootOptions             An array of auto enumerated
> platform boot options.
> +                                           This array will be freed by caller upon successful
> +                                           exit of this function and output array would be used.
> +
> +  @param[in const] BootOptionsCount        The number of elements in
> BootOptions.
> +
> +  @param[out]      UpdatedBootOptions      An array of boot options that
> have been customized
> +                                           for the platform on top of input boot options. This
> +                                           array would be allocated by
> REFRESH_ALL_BOOT_OPTIONS
> +                                           and would be freed by caller after consuming it.
> +
> +  @param[out]      UpdatedBootOptionsCount The number of elements in
> UpdatedBootOptions.
> +
> +
> +  @retval EFI_SUCCESS                      Platform refresh to input BootOptions and
> +                                           BootCount have been done.
> +
> +  @retval EFI_OUT_OF_RESOURCES             Memory allocation failed.
> +
> +  @retval EFI_INVALID_PARAMETER            Input is not correct.
> +
> +  @retval EFI_UNSUPPORTED                  Platform specific overrides are not
> supported.
> +*/
> +typedef
> +EFI_STATUS
> +(EFIAPI *PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS) (
> +  IN  CONST EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions,
> +  IN  CONST UINTN                        BootOptionsCount,
> +  OUT       EFI_BOOT_MANAGER_LOAD_OPTION **UpdatedBootOptions,
> +  OUT       UINTN                        *UpdatedBootOptionsCount
> +  );
> +
> +struct _EDKII_PLATFORM_BOOT_MANAGER_PROTOCOL {
> +  UINT64                                         Revision;
> +  PLATFORM_BOOT_MANAGER_REFRESH_ALL_BOOT_OPTIONS
> RefreshAllBootOptions;
> +};
> +
> +extern EFI_GUID gEdkiiPlatformBootManagerProtocolGuid;
> +
> +#endif /* __PLATFORM_BOOT_MANAGER_PROTOCOL_H__ */
> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> index 760d764..62c5b2dc 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++) {
> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> index 027eb25..ac866ac 100644
> --- a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> +++ b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
> @@ -1,6 +1,7 @@
>  /** @file
>    BDS library definition, include the file and data structure
> 
> +Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
>  Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
>  (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> @@ -41,6 +42,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #include <Protocol/VariableLock.h>
>  #include <Protocol/RamDisk.h>
>  #include <Protocol/DeferredImageLoad.h>
> +#include <Protocol/PlatformBootManager.h>
> 
>  #include <Guid/MemoryTypeInformation.h>
>  #include <Guid/FileInfo.h>
> diff --git
> a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> index ed6b467..cf59086 100644
> --- a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> +++
> b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> @@ -5,6 +5,7 @@
>  #  manipulation, hotkey registration, UEFI boot, connect/disconnect, console
>  #  manipulation, driver health checking and etc.
>  #
> +#  Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
>  #  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
>  #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
> @@ -107,6 +108,7 @@
>    gEfiFormBrowser2ProtocolGuid                  ## SOMETIMES_CONSUMES
>    gEfiRamDiskProtocolGuid                       ## SOMETIMES_CONSUMES
>    gEfiDeferredImageLoadProtocolGuid             ## SOMETIMES_CONSUMES
> +  gEdkiiPlatformBootManagerProtocolGuid         ## SOMETIMES_CONSUMES
> 
>  [Pcd]
> 
> gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationC
> hange      ## SOMETIMES_CONSUMES
> diff --git a/MdeModulePkg/MdeModulePkg.dec
> b/MdeModulePkg/MdeModulePkg.dec
> index 41b9e70..cc238e9 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -3,6 +3,7 @@
>  # It also provides the definitions(including PPIs/PROTOCOLs/GUIDs and
> library classes)
>  # and libraries instances, which are used for those modules.
>  #
> +# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
>  # Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
>  # Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
>  # (C) Copyright 2016 - 2019 Hewlett Packard Enterprise Development LP<BR>
> @@ -609,6 +610,9 @@
>    ## Include/Protocol/PeCoffImageEmulator.h
>    gEdkiiPeCoffImageEmulatorProtocolGuid = { 0x96f46153, 0x97a7, 0x4793,
> { 0xac, 0xc1, 0xfa, 0x19, 0xbf, 0x78, 0xea, 0x97 } }
> 
> +  ## Include/Protocol/PlatformBootManager.h
> +  gEdkiiPlatformBootManagerProtocolGuid = { 0xaa17add4, 0x756c, 0x460d,
> { 0x94, 0xb8, 0x43, 0x88, 0xd7, 0xfb, 0x3e, 0x59 } }
> +
>  #
>  # [Error.gEfiMdeModulePkgTokenSpaceGuid]
>  #   0x80000001 | Invalid value provided.
> --
> 2.7.4


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#52535): https://edk2.groups.io/g/devel/message/52535
Mute This Topic: https://groups.io/mt/69243735/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-