[edk2-devel] [PATCH] UefiPayloadPkg: remove the change that get platform specific logic

marsx.lin@intel.com posted 1 patch 1 year, 4 months ago
Failed in applying to current master (apply log)
.../Protocol/PlatformBootManagerOverride.h    | 84 -------------------
.../PlatformBootManager.c                     | 27 ------
.../PlatformBootManagerLib.inf                |  1 -
UefiPayloadPkg/UefiPayloadPkg.dec             |  2 -
4 files changed, 114 deletions(-)
delete mode 100644 UefiPayloadPkg/Include/Protocol/PlatformBootManagerOverride.h
[edk2-devel] [PATCH] UefiPayloadPkg: remove the change that get platform specific logic
Posted by marsx.lin@intel.com 1 year, 4 months ago
From: MarsX Lin <marsx.lin@intel.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4241

Since UefiPayloadPkg had supported multiple firmware volume,
remove the platform specific logic via protocol

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>

Signed-off-by: MarsX Lin <marsx.lin@intel.com>
---
 .../Protocol/PlatformBootManagerOverride.h    | 84 -------------------
 .../PlatformBootManager.c                     | 27 ------
 .../PlatformBootManagerLib.inf                |  1 -
 UefiPayloadPkg/UefiPayloadPkg.dec             |  2 -
 4 files changed, 114 deletions(-)
 delete mode 100644 UefiPayloadPkg/Include/Protocol/PlatformBootManagerOverride.h

diff --git a/UefiPayloadPkg/Include/Protocol/PlatformBootManagerOverride.h b/UefiPayloadPkg/Include/Protocol/PlatformBootManagerOverride.h
deleted file mode 100644
index 878ddc044b..0000000000
--- a/UefiPayloadPkg/Include/Protocol/PlatformBootManagerOverride.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/** @file
-  This file defines the Univeral Payload Platform BootManager Protocol.
-
-  Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#ifndef __PLATFORM_BOOT_MANAGER_OVERRIDE_H__
-#define __PLATFORM_BOOT_MANAGER_OVERRIDE_H__
-
-/**
-  Do the platform specific action before the console is connected.
-
-  Such as:
-    Update console variable;
-    Register new Driver#### or Boot####;
-    Signal ReadyToLock event.
-
-  This function will override the default behavior in PlatformBootManagerLib
-**/
-typedef
-VOID
-(EFIAPI *UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_BEFORE_CONSOLE)(
-  VOID
-  );
-
-/**
-  Do the platform specific action after the console is connected.
-
-  Such as:
-    Dynamically switch output mode;
-    Signal console ready platform customized event;
-    Run diagnostics like memory testing;
-    Connect certain devices;
-    Dispatch aditional option roms.
-
-  This function will override the default behavior in PlatformBootManagerLib
-**/
-typedef
-VOID
-(EFIAPI *UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_AFTER_CONSOLE)(
-  VOID
-  );
-
-/**
-  This function is called each second during the boot manager waits the timeout.
-  This function will override the default behavior in PlatformBootManagerLib
-
-  @param TimeoutRemain  The remaining timeout.
-**/
-typedef
-VOID
-(EFIAPI *UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_WAIT_CALLBACK)(
-  UINT16          TimeoutRemain
-  );
-
-/**
-  The function is called when no boot option could be launched,
-  including platform recovery options and options pointing to applications
-  built into firmware volumes.
-
-  If this function returns, BDS attempts to enter an infinite loop.
-  This function will override the default behavior in PlatformBootManagerLib
-**/
-typedef
-VOID
-(EFIAPI *UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_UNABLE_TO_BOOT)(
-  VOID
-  );
-
-///
-/// Provides an interface to override the default behavior in PlatformBootManagerLib,
-/// so platform can provide its own platform specific logic through this protocol
-///
-typedef struct {
-  UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_BEFORE_CONSOLE    BeforeConsole;
-  UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_AFTER_CONSOLE     AfterConsole;
-  UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_WAIT_CALLBACK     WaitCallback;
-  UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_UNABLE_TO_BOOT    UnableToBoot;
-} UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_PROTOCOL;
-
-extern GUID  gUniversalPayloadPlatformBootManagerOverrideProtocolGuid;
-
-#endif
diff --git a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index a92a260a6e..62637ae6aa 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
@@ -9,12 +9,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include "PlatformBootManager.h"
 #include "PlatformConsole.h"
-#include <Protocol/PlatformBootManagerOverride.h>
 #include <Guid/BootManagerMenu.h>
 #include <Library/HobLib.h>
 
-UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_PROTOCOL  *mUniversalPayloadPlatformBootManagerOverrideInstance = NULL;
-
 /**
   Signal EndOfDxe event and install SMM Ready to lock protocol.
 
@@ -167,17 +164,6 @@ PlatformBootManagerBeforeConsole (
   EFI_INPUT_KEY                 CustomKey;
   EFI_INPUT_KEY                 Down;
   EFI_BOOT_MANAGER_LOAD_OPTION  BootOption;
-  EFI_STATUS                    Status;
-
-  Status = gBS->LocateProtocol (&gUniversalPayloadPlatformBootManagerOverrideProtocolGuid, NULL, (VOID **)&mUniversalPayloadPlatformBootManagerOverrideInstance);
-  if (EFI_ERROR (Status)) {
-    mUniversalPayloadPlatformBootManagerOverrideInstance = NULL;
-  }
-
-  if (mUniversalPayloadPlatformBootManagerOverrideInstance != NULL) {
-    mUniversalPayloadPlatformBootManagerOverrideInstance->BeforeConsole ();
-    return;
-  }
 
   //
   // Register ENTER as CONTINUE key
@@ -246,11 +232,6 @@ PlatformBootManagerAfterConsole (
   EDKII_PLATFORM_LOGO_PROTOCOL   *PlatformLogo;
   EFI_STATUS                     Status;
 
-  if (mUniversalPayloadPlatformBootManagerOverrideInstance != NULL) {
-    mUniversalPayloadPlatformBootManagerOverrideInstance->AfterConsole ();
-    return;
-  }
-
   Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;
   White.Blue = White.Green = White.Red = White.Reserved = 0xFF;
 
@@ -297,10 +278,6 @@ PlatformBootManagerWaitCallback (
   UINT16  TimeoutRemain
   )
 {
-  if (mUniversalPayloadPlatformBootManagerOverrideInstance != NULL) {
-    mUniversalPayloadPlatformBootManagerOverrideInstance->WaitCallback (TimeoutRemain);
-  }
-
   return;
 }
 
@@ -317,10 +294,6 @@ PlatformBootManagerUnableToBoot (
   VOID
   )
 {
-  if (mUniversalPayloadPlatformBootManagerOverrideInstance != NULL) {
-    mUniversalPayloadPlatformBootManagerOverrideInstance->UnableToBoot ();
-  }
-
   return;
 }
 
diff --git a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 7ec93420f2..f9626175e2 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -60,7 +60,6 @@
   gEfiBootLogoProtocolGuid        ## CONSUMES
   gEfiDxeSmmReadyToLockProtocolGuid
   gEfiSmmAccess2ProtocolGuid
-  gUniversalPayloadPlatformBootManagerOverrideProtocolGuid
   gEfiSerialIoProtocolGuid
   gEfiPciRootBridgeIoProtocolGuid
 
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dec b/UefiPayloadPkg/UefiPayloadPkg.dec
index 1ccfc32548..7d61d6eeae 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dec
+++ b/UefiPayloadPkg/UefiPayloadPkg.dec
@@ -52,8 +52,6 @@
   #
   gPlatformGOPPolicyGuid                  = { 0xec2e931b, 0x3281, 0x48a5, { 0x81, 0x07, 0xdf, 0x8a, 0x8b, 0xed, 0x3c, 0x5d } }
 
-  gUniversalPayloadPlatformBootManagerOverrideProtocolGuid = { 0xdb3fc2df, 0x7376, 0x4a8d, { 0x82, 0xab, 0x91, 0x54, 0xa1, 0x36, 0xa6, 0x5a } }
-
 ################################################################################
 #
 # PCD Declarations section - list of all PCDs Declared by this Package
-- 
2.33.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97867): https://edk2.groups.io/g/devel/message/97867
Mute This Topic: https://groups.io/mt/96025985/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] UefiPayloadPkg: remove the change that get platform specific logic
Posted by Guo Dong 1 year, 4 months ago
Reviewed-by: Guo Dong <guo.dong@intel.com>

-----Original Message-----
From: Lin, MarsX <marsx.lin@intel.com> 
Sent: Tuesday, January 3, 2023 12:45 AM
To: devel@edk2.groups.io
Cc: Lin, MarsX <marsx.lin@intel.com>; Dong, Guo <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Rhodes, Sean <sean@starlabs.systems>; Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>
Subject: [PATCH] UefiPayloadPkg: remove the change that get platform specific logic

From: MarsX Lin <marsx.lin@intel.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4241

Since UefiPayloadPkg had supported multiple firmware volume, remove the platform specific logic via protocol

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>

Signed-off-by: MarsX Lin <marsx.lin@intel.com>
---
 .../Protocol/PlatformBootManagerOverride.h    | 84 -------------------
 .../PlatformBootManager.c                     | 27 ------
 .../PlatformBootManagerLib.inf                |  1 -
 UefiPayloadPkg/UefiPayloadPkg.dec             |  2 -
 4 files changed, 114 deletions(-)
 delete mode 100644 UefiPayloadPkg/Include/Protocol/PlatformBootManagerOverride.h

diff --git a/UefiPayloadPkg/Include/Protocol/PlatformBootManagerOverride.h b/UefiPayloadPkg/Include/Protocol/PlatformBootManagerOverride.h
deleted file mode 100644
index 878ddc044b..0000000000
--- a/UefiPayloadPkg/Include/Protocol/PlatformBootManagerOverride.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/** @file-  This file defines the Univeral Payload Platform BootManager Protocol.--  Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>-  SPDX-License-Identifier: BSD-2-Clause-Patent-**/--#ifndef __PLATFORM_BOOT_MANAGER_OVERRIDE_H__-#define __PLATFORM_BOOT_MANAGER_OVERRIDE_H__--/**-  Do the platform specific action before the console is connected.--  Such as:-    Update console variable;-    Register new Driver#### or Boot####;-    Signal ReadyToLock event.--  This function will override the default behavior in PlatformBootManagerLib-**/-typedef-VOID-(EFIAPI *UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_BEFORE_CONSOLE)(-  VOID-  );--/**-  Do the platform specific action after the console is connected.--  Such as:-    Dynamically switch output mode;-    Signal console ready platform customized event;-    Run diagnostics like memory testing;-    Connect certain devices;-    Dispatch aditional option roms.--  This function will override the default behavior in PlatformBootManagerLib-**/-typedef-VOID-(EFIAPI *UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_AFTER_CONSOLE)(-  VOID-  );--/**-  This function is called each second during the boot manager waits the timeout.-  This function will override the default behavior in PlatformBootManagerLib--  @param TimeoutRemain  The remaining timeout.-**/-typedef-VOID-(EFIAPI *UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_WAIT_CALLBACK)(-  UINT16          TimeoutRemain-  );--/**-  The function is called when no boot option could be launched,-  including platform recovery options and options pointing to applications-  built into firmware volumes.--  If this function returns, BDS attempts to enter an infinite loop.-  This function will override the default behavior in PlatformBootManagerLib-**/-typedef-VOID-(EFIAPI *UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_UNABLE_TO_BOOT)(-  VOID-  );--///-/// Provides an interface to override the default behavior in PlatformBootManagerLib,-/// so platform can provide its own platform specific logic through this protocol-///-typedef struct {-  UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_BEFORE_CONSOLE    BeforeConsole;-  UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_AFTER_CONSOLE     AfterConsole;-  UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_WAIT_CALLBACK     WaitCallback;-  UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_UNABLE_TO_BOOT    UnableToBoot;-} UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_PROTOCOL;--extern GUID  gUniversalPayloadPlatformBootManagerOverrideProtocolGuid;--#endifdiff --git a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index a92a260a6e..62637ae6aa 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.
+++ c
@@ -9,12 +9,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
  #include "PlatformBootManager.h" #include "PlatformConsole.h"-#include <Protocol/PlatformBootManagerOverride.h> #include <Guid/BootManagerMenu.h> #include <Library/HobLib.h> -UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_PROTOCOL  *mUniversalPayloadPlatformBootManagerOverrideInstance = NULL;- /**   Signal EndOfDxe event and install SMM Ready to lock protocol. @@ -167,17 +164,6 @@ PlatformBootManagerBeforeConsole (
   EFI_INPUT_KEY                 CustomKey;   EFI_INPUT_KEY                 Down;   EFI_BOOT_MANAGER_LOAD_OPTION  BootOption;-  EFI_STATUS                    Status;--  Status = gBS->LocateProtocol (&gUniversalPayloadPlatformBootManagerOverrideProtocolGuid, NULL, (VOID **)&mUniversalPayloadPlatformBootManagerOverrideInstance);-  if (EFI_ERROR (Status)) {-    mUniversalPayloadPlatformBootManagerOverrideInstance = NULL;-  }--  if (mUniversalPayloadPlatformBootManagerOverrideInstance != NULL) {-    mUniversalPayloadPlatformBootManagerOverrideInstance->BeforeConsole ();-    return;-  }    //   // Register ENTER as CONTINUE key@@ -246,11 +232,6 @@ PlatformBootManagerAfterConsole (
   EDKII_PLATFORM_LOGO_PROTOCOL   *PlatformLogo;   EFI_STATUS                     Status; -  if (mUniversalPayloadPlatformBootManagerOverrideInstance != NULL) {-    mUniversalPayloadPlatformBootManagerOverrideInstance->AfterConsole ();-    return;-  }-   Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;   White.Blue = White.Green = White.Red = White.Reserved = 0xFF; @@ -297,10 +278,6 @@ PlatformBootManagerWaitCallback (
   UINT16  TimeoutRemain   ) {-  if (mUniversalPayloadPlatformBootManagerOverrideInstance != NULL) {-    mUniversalPayloadPlatformBootManagerOverrideInstance->WaitCallback (TimeoutRemain);-  }-   return; } @@ -317,10 +294,6 @@ PlatformBootManagerUnableToBoot (
   VOID   ) {-  if (mUniversalPayloadPlatformBootManagerOverrideInstance != NULL) {-    mUniversalPayloadPlatformBootManagerOverrideInstance->UnableToBoot ();-  }-   return; } diff --git a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 7ec93420f2..f9626175e2 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerL
+++ ib.inf
@@ -60,7 +60,6 @@
   gEfiBootLogoProtocolGuid        ## CONSUMES   gEfiDxeSmmReadyToLockProtocolGuid   gEfiSmmAccess2ProtocolGuid-  gUniversalPayloadPlatformBootManagerOverrideProtocolGuid   gEfiSerialIoProtocolGuid   gEfiPciRootBridgeIoProtocolGuid diff --git a/UefiPayloadPkg/UefiPayloadPkg.dec b/UefiPayloadPkg/UefiPayloadPkg.dec
index 1ccfc32548..7d61d6eeae 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dec
+++ b/UefiPayloadPkg/UefiPayloadPkg.dec
@@ -52,8 +52,6 @@
   #   gPlatformGOPPolicyGuid                  = { 0xec2e931b, 0x3281, 0x48a5, { 0x81, 0x07, 0xdf, 0x8a, 0x8b, 0xed, 0x3c, 0x5d } } -  gUniversalPayloadPlatformBootManagerOverrideProtocolGuid = { 0xdb3fc2df, 0x7376, 0x4a8d, { 0x82, 0xab, 0x91, 0x54, 0xa1, 0x36, 0xa6, 0x5a } }- ################################################################################ # # PCD Declarations section - list of all PCDs Declared by this Package-- 
2.33.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97950): https://edk2.groups.io/g/devel/message/97950
Mute This Topic: https://groups.io/mt/96025985/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-