[edk2-devel] [edk2-platforms][PATCH v1] KabylakeOpenBoardPkg/GalagoPro3: Deduplicate PeiSiliconPolicyNotifyLib

Benjamin Doron posted 1 patch 2 years, 8 months ago
Failed in applying to current master (apply log)
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.c   | 104 --------------------
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf |  44 ---------
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc                                                                 |   2 +-
3 files changed, 1 insertion(+), 149 deletions(-)
[edk2-devel] [edk2-platforms][PATCH v1] KabylakeOpenBoardPkg/GalagoPro3: Deduplicate PeiSiliconPolicyNotifyLib
Posted by Benjamin Doron 2 years, 8 months ago
GalagoPro3 board has a duplicate copy of PeiSiliconPolicyNotifyLib.
Remove it, and use the copy under KabylakeOpenBoardPkg/FspWrapper/ instead.

Cc: Jeremy Soller <jeremy@system76.com>
Signed-off-by: Benjamin Doron <benjamin.doron00@gmail.com>
---
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.c   | 104 --------------------
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf |  44 ---------
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc                                                                 |   2 +-
 3 files changed, 1 insertion(+), 149 deletions(-)

diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.c b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.c
deleted file mode 100644
index 70a6b7e5d2a7..000000000000
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/** @file
-  This library implements constructor function to register notify call back
-  when policy PPI installed.
-
-Copyright (c) 2019 - 2020 Intel Corporation. All rights reserved.<BR>
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-#include <PiPei.h>
-#include <Library/DebugLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PeiServicesLib.h>
-#include <Library/SiPolicyLib.h>
-#include <Library/ConfigBlockLib.h>
-
-/**
-  Callback function to update policy when policy PPI installed.
-
-  @param[in] PeiServices          General purpose services available to every PEIM.
-  @param[in] NotifyDescriptor     The notification structure this PEIM registered on install.
-  @param[in] Ppi                  The memory discovered PPI.  Not used.
-
-  @retval EFI_SUCCESS             Succeeds.
-  @retval Others                  Error code returned by sub-functions.
-**/
-EFI_STATUS
-EFIAPI
-SiPreMemPolicyPpiNotify (
-  IN  EFI_PEI_SERVICES             **PeiServices,
-  IN  EFI_PEI_NOTIFY_DESCRIPTOR    *NotifyDescriptor,
-  IN  VOID                         *Ppi
-  )
-{
-  EFI_STATUS                  Status;
-  SI_PREMEM_POLICY_PPI        *SiPreMemPolicyPpi;
-  SA_MISC_PEI_PREMEM_CONFIG   *MiscPeiPreMemConfig;
-
-  DEBUG ((DEBUG_INFO, "SiPreMemPolicyPpiNotify() Start\n"));
-
-  Status = PeiServicesLocatePpi (
-             &gSiPreMemPolicyPpiGuid,
-             0,
-             NULL,
-             (VOID **)&SiPreMemPolicyPpi
-             );
-  ASSERT_EFI_ERROR (Status);
-  if (SiPreMemPolicyPpi != NULL) {
-    //
-    // Get requisite IP Config Blocks which needs to be used here
-    //
-    Status = GetConfigBlock ((VOID *) SiPreMemPolicyPpi, &gSaMiscPeiPreMemConfigGuid, (VOID *) &MiscPeiPreMemConfig);
-    ASSERT_EFI_ERROR (Status);
-
-    //
-    // Update SpdAddressTable policy when it is installed.
-    //
-    if (MiscPeiPreMemConfig != NULL) {
-      MiscPeiPreMemConfig->SpdAddressTable[0] = PcdGet8 (PcdMrcSpdAddressTable0);
-      DEBUG ((DEBUG_INFO, "MiscPeiPreMemConfig->SpdAddressTable[0] 0x%x\n", MiscPeiPreMemConfig->SpdAddressTable[0]));
-      MiscPeiPreMemConfig->SpdAddressTable[1] = PcdGet8 (PcdMrcSpdAddressTable1);
-      DEBUG ((DEBUG_INFO, "MiscPeiPreMemConfig->SpdAddressTable[1] 0x%x\n", MiscPeiPreMemConfig->SpdAddressTable[1]));
-      MiscPeiPreMemConfig->SpdAddressTable[2] = PcdGet8 (PcdMrcSpdAddressTable2);
-      DEBUG ((DEBUG_INFO, "MiscPeiPreMemConfig->SpdAddressTable[2] 0x%x\n", MiscPeiPreMemConfig->SpdAddressTable[2]));
-      MiscPeiPreMemConfig->SpdAddressTable[3] = PcdGet8 (PcdMrcSpdAddressTable3);
-      DEBUG ((DEBUG_INFO, "MiscPeiPreMemConfig->SpdAddressTable[3] 0x%x\n", MiscPeiPreMemConfig->SpdAddressTable[3]));
-    }
-  }
-  return Status;
-}
-
-static EFI_PEI_NOTIFY_DESCRIPTOR  mSiPreMemPolicyPpiNotifyList[] = {
-  {
-    EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
-    &gSiPreMemPolicyPpiGuid,
-    SiPreMemPolicyPpiNotify
-  }
-};
-
-/**
-  The library constructuor.
-  The function register a policy install notify callback.
-
-  @param[in]  ImageHandle       The firmware allocated handle for the UEFI image.
-  @param[in]  SystemTable       A pointer to the EFI system table.
-
-  @retval     EFI_SUCCESS       The function always return EFI_SUCCESS for now.
-                                It will ASSERT on error for debug version.
-**/
-EFI_STATUS
-EFIAPI
-PeiPreMemSiliconPolicyNotifyLibConstructor (
-  IN       EFI_PEI_FILE_HANDLE  FileHandle,
-  IN CONST EFI_PEI_SERVICES     **PeiServices
-  )
-{
-  EFI_STATUS                  Status;
-  //
-  // Register call back after PPI produced
-  //
-  Status = PeiServicesNotifyPpi (mSiPreMemPolicyPpiNotifyList);
-  ASSERT_EFI_ERROR (Status);
-
-  return EFI_SUCCESS;
-}
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf
deleted file mode 100644
index 0fc857c41263..000000000000
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf
+++ /dev/null
@@ -1,44 +0,0 @@
-## @file
-# Component information file for Silicon Policy Notify Library.
-# This library implements constructor function to register notify call back
-# when policy PPI installed.
-#
-# Copyright (c) 2019 - 2020 Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
-  INF_VERSION                    = 0x00010005
-  BASE_NAME                      = PeiPreMemSiliconPolicyNotifyLib
-  FILE_GUID                      = 6D231E12-C088-47C8-8B16-61F07293EEF8
-  MODULE_TYPE                    = PEIM
-  VERSION_STRING                 = 1.0
-  LIBRARY_CLASS                  = NULL
-  CONSTRUCTOR                    = PeiPreMemSiliconPolicyNotifyLibConstructor
-
-[LibraryClasses]
-  BaseLib
-
-[Packages]
-  MdePkg/MdePkg.dec
-  KabylakeOpenBoardPkg/OpenBoardPkg.dec
-  KabylakeSiliconPkg/SiPkg.dec
-  IntelSiliconPkg/IntelSiliconPkg.dec
-
-[Sources]
-  PeiPreMemSiliconPolicyNotifyLib.c
-
-[Guids]
-  gSaMiscPeiPreMemConfigGuid
-
-[Ppis]
-  gSiPreMemPolicyPpiGuid
-
-[Pcd]
-  # SPD Address Table
-  gKabylakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable0
-  gKabylakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable1
-  gKabylakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable2
-  gKabylakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable3
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
index 302cb679b5eb..7f276d351280 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
@@ -301,7 +301,7 @@
     #
     # Hook a library constructor to update some policy fields when policy is installed.
     #
-    NULL|$(PROJECT)/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf
+    NULL|$(PLATFORM_BOARD_PACKAGE)/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf
   }
   $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPostMem.inf
 
-- 
2.31.1



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


Re: [edk2-devel] [edk2-platforms][PATCH v1] KabylakeOpenBoardPkg/GalagoPro3: Deduplicate PeiSiliconPolicyNotifyLib
Posted by Nate DeSimone 2 years, 8 months ago
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Benjamin Doron
Sent: Wednesday, August 4, 2021 12:31 PM
To: devel@edk2.groups.io
Cc: Jeremy Soller <jeremy@system76.com>
Subject: [edk2-devel] [edk2-platforms][PATCH v1] KabylakeOpenBoardPkg/GalagoPro3: Deduplicate PeiSiliconPolicyNotifyLib

GalagoPro3 board has a duplicate copy of PeiSiliconPolicyNotifyLib.
Remove it, and use the copy under KabylakeOpenBoardPkg/FspWrapper/ instead.

Cc: Jeremy Soller <jeremy@system76.com>
Signed-off-by: Benjamin Doron <benjamin.doron00@gmail.com>
---
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.c   | 104 --------------------
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf |  44 ---------
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc                                                                 |   2 +-
 3 files changed, 1 insertion(+), 149 deletions(-)

diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.c b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.c
deleted file mode 100644
index 70a6b7e5d2a7..000000000000
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/** @file-  This library implements constructor function to register notify call back-  when policy PPI installed.--Copyright (c) 2019 - 2020 Intel Corporation. All rights reserved.<BR>-SPDX-License-Identifier: BSD-2-Clause-Patent--**/-#include <PiPei.h>-#include <Library/DebugLib.h>-#include <Library/MemoryAllocationLib.h>-#include <Library/PeiServicesLib.h>-#include <Library/SiPolicyLib.h>-#include <Library/ConfigBlockLib.h>--/**-  Callback function to update policy when policy PPI installed.--  @param[in] PeiServices          General purpose services available to every PEIM.-  @param[in] NotifyDescriptor     The notification structure this PEIM registered on install.-  @param[in] Ppi                  The memory discovered PPI.  Not used.--  @retval EFI_SUCCESS             Succeeds.-  @retval Others                  Error code returned by sub-functions.-**/-EFI_STATUS-EFIAPI-SiPreMemPolicyPpiNotify (-  IN  EFI_PEI_SERVICES             **PeiServices,-  IN  EFI_PEI_NOTIFY_DESCRIPTOR    *NotifyDescriptor,-  IN  VOID                         *Ppi-  )-{-  EFI_STATUS                  Status;-  SI_PREMEM_POLICY_PPI        *SiPreMemPolicyPpi;-  SA_MISC_PEI_PREMEM_CONFIG   *MiscPeiPreMemConfig;--  DEBUG ((DEBUG_INFO, "SiPreMemPolicyPpiNotify() Start\n"));--  Status = PeiServicesLocatePpi (-             &gSiPreMemPolicyPpiGuid,-             0,-             NULL,-             (VOID **)&SiPreMemPolicyPpi-             );-  ASSERT_EFI_ERROR (Status);-  if (SiPreMemPolicyPpi != NULL) {-    //-    // Get requisite IP Config Blocks which needs to be used here-    //-    Status = GetConfigBlock ((VOID *) SiPreMemPolicyPpi, &gSaMiscPeiPreMemConfigGuid, (VOID *) &MiscPeiPreMemConfig);-    ASSERT_EFI_ERROR (Status);--    //-    // Update SpdAddressTable policy when it is installed.-    //-    if (MiscPeiPreMemConfig != NULL) {-      MiscPeiPreMemConfig->SpdAddressTable[0] = PcdGet8 (PcdMrcSpdAddressTable0);-      DEBUG ((DEBUG_INFO, "MiscPeiPreMemConfig->SpdAddressTable[0] 0x%x\n", MiscPeiPreMemConfig->SpdAddressTable[0]));-      MiscPeiPreMemConfig->SpdAddressTable[1] = PcdGet8 (PcdMrcSpdAddressTable1);-      DEBUG ((DEBUG_INFO, "MiscPeiPreMemConfig->SpdAddressTable[1] 0x%x\n", MiscPeiPreMemConfig->SpdAddressTable[1]));-      MiscPeiPreMemConfig->SpdAddressTable[2] = PcdGet8 (PcdMrcSpdAddressTable2);-      DEBUG ((DEBUG_INFO, "MiscPeiPreMemConfig->SpdAddressTable[2] 0x%x\n", MiscPeiPreMemConfig->SpdAddressTable[2]));-      MiscPeiPreMemConfig->SpdAddressTable[3] = PcdGet8 (PcdMrcSpdAddressTable3);-      DEBUG ((DEBUG_INFO, "MiscPeiPreMemConfig->SpdAddressTable[3] 0x%x\n", MiscPeiPreMemConfig->SpdAddressTable[3]));-    }-  }-  return Status;-}--static EFI_PEI_NOTIFY_DESCRIPTOR  mSiPreMemPolicyPpiNotifyList[] = {-  {-    EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,-    &gSiPreMemPolicyPpiGuid,-    SiPreMemPolicyPpiNotify-  }-};--/**-  The library constructuor.-  The function register a policy install notify callback.--  @param[in]  ImageHandle       The firmware allocated handle for the UEFI image.-  @param[in]  SystemTable       A pointer to the EFI system table.--  @retval     EFI_SUCCESS       The function always return EFI_SUCCESS for now.-                                It will ASSERT on error for debug version.-**/-EFI_STATUS-EFIAPI-PeiPreMemSiliconPolicyNotifyLibConstructor (-  IN       EFI_PEI_FILE_HANDLE  FileHandle,-  IN CONST EFI_PEI_SERVICES     **PeiServices-  )-{-  EFI_STATUS                  Status;-  //-  // Register call back after PPI produced-  //-  Status = PeiServicesNotifyPpi (mSiPreMemPolicyPpiNotifyList);-  ASSERT_EFI_ERROR (Status);--  return EFI_SUCCESS;-}diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf
deleted file mode 100644
index 0fc857c41263..000000000000
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf
+++ /dev/null
@@ -1,44 +0,0 @@
-## @file-# Component information file for Silicon Policy Notify Library.-# This library implements constructor function to register notify call back-# when policy PPI installed.-#-# Copyright (c) 2019 - 2020 Intel Corporation. All rights reserved.<BR>-#-# SPDX-License-Identifier: BSD-2-Clause-Patent-#-##--[Defines]-  INF_VERSION                    = 0x00010005-  BASE_NAME                      = PeiPreMemSiliconPolicyNotifyLib-  FILE_GUID                      = 6D231E12-C088-47C8-8B16-61F07293EEF8-  MODULE_TYPE                    = PEIM-  VERSION_STRING                 = 1.0-  LIBRARY_CLASS                  = NULL-  CONSTRUCTOR                    = PeiPreMemSiliconPolicyNotifyLibConstructor--[LibraryClasses]-  BaseLib--[Packages]-  MdePkg/MdePkg.dec-  KabylakeOpenBoardPkg/OpenBoardPkg.dec-  KabylakeSiliconPkg/SiPkg.dec-  IntelSiliconPkg/IntelSiliconPkg.dec--[Sources]-  PeiPreMemSiliconPolicyNotifyLib.c--[Guids]-  gSaMiscPeiPreMemConfigGuid--[Ppis]-  gSiPreMemPolicyPpiGuid--[Pcd]-  # SPD Address Table-  gKabylakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable0-  gKabylakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable1-  gKabylakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable2-  gKabylakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable3diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
index 302cb679b5eb..7f276d351280 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
@@ -301,7 +301,7 @@
     #     # Hook a library constructor to update some policy fields when policy is installed.     #-    NULL|$(PROJECT)/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf+    NULL|$(PLATFORM_BOARD_PACKAGE)/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf   }   $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPostMem.inf -- 
2.31.1



-=-=-=-=-=-=
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#78661): https://edk2.groups.io/g/devel/message/78661
Mute This Topic: https://groups.io/mt/84669971/1767664
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [nathaniel.l.desimone@intel.com] -=-=-=-=-=-=




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


Re: [edk2-devel] [edk2-platforms][PATCH v1] KabylakeOpenBoardPkg/GalagoPro3: Deduplicate PeiSiliconPolicyNotifyLib
Posted by Nate DeSimone 2 years, 8 months ago
Hi Benjamin,

Please remember to CC the other KabylakeOpenBoardPkg maintainers. Jeremy is just a reviewer and is not able to approve patches himself.

Thanks,
Nate

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Benjamin Doron
Sent: Wednesday, August 4, 2021 12:31 PM
To: devel@edk2.groups.io
Cc: Jeremy Soller <jeremy@system76.com>
Subject: [edk2-devel] [edk2-platforms][PATCH v1] KabylakeOpenBoardPkg/GalagoPro3: Deduplicate PeiSiliconPolicyNotifyLib

GalagoPro3 board has a duplicate copy of PeiSiliconPolicyNotifyLib.
Remove it, and use the copy under KabylakeOpenBoardPkg/FspWrapper/ instead.

Cc: Jeremy Soller <jeremy@system76.com>
Signed-off-by: Benjamin Doron <benjamin.doron00@gmail.com>
---
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.c   | 104 --------------------
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf |  44 ---------
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc                                                                 |   2 +-
 3 files changed, 1 insertion(+), 149 deletions(-)

diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.c b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.c
deleted file mode 100644
index 70a6b7e5d2a7..000000000000
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/** @file-  This library implements constructor function to register notify call back-  when policy PPI installed.--Copyright (c) 2019 - 2020 Intel Corporation. All rights reserved.<BR>-SPDX-License-Identifier: BSD-2-Clause-Patent--**/-#include <PiPei.h>-#include <Library/DebugLib.h>-#include <Library/MemoryAllocationLib.h>-#include <Library/PeiServicesLib.h>-#include <Library/SiPolicyLib.h>-#include <Library/ConfigBlockLib.h>--/**-  Callback function to update policy when policy PPI installed.--  @param[in] PeiServices          General purpose services available to every PEIM.-  @param[in] NotifyDescriptor     The notification structure this PEIM registered on install.-  @param[in] Ppi                  The memory discovered PPI.  Not used.--  @retval EFI_SUCCESS             Succeeds.-  @retval Others                  Error code returned by sub-functions.-**/-EFI_STATUS-EFIAPI-SiPreMemPolicyPpiNotify (-  IN  EFI_PEI_SERVICES             **PeiServices,-  IN  EFI_PEI_NOTIFY_DESCRIPTOR    *NotifyDescriptor,-  IN  VOID                         *Ppi-  )-{-  EFI_STATUS                  Status;-  SI_PREMEM_POLICY_PPI        *SiPreMemPolicyPpi;-  SA_MISC_PEI_PREMEM_CONFIG   *MiscPeiPreMemConfig;--  DEBUG ((DEBUG_INFO, "SiPreMemPolicyPpiNotify() Start\n"));--  Status = PeiServicesLocatePpi (-             &gSiPreMemPolicyPpiGuid,-             0,-             NULL,-             (VOID **)&SiPreMemPolicyPpi-             );-  ASSERT_EFI_ERROR (Status);-  if (SiPreMemPolicyPpi != NULL) {-    //-    // Get requisite IP Config Blocks which needs to be used here-    //-    Status = GetConfigBlock ((VOID *) SiPreMemPolicyPpi, &gSaMiscPeiPreMemConfigGuid, (VOID *) &MiscPeiPreMemConfig);-    ASSERT_EFI_ERROR (Status);--    //-    // Update SpdAddressTable policy when it is installed.-    //-    if (MiscPeiPreMemConfig != NULL) {-      MiscPeiPreMemConfig->SpdAddressTable[0] = PcdGet8 (PcdMrcSpdAddressTable0);-      DEBUG ((DEBUG_INFO, "MiscPeiPreMemConfig->SpdAddressTable[0] 0x%x\n", MiscPeiPreMemConfig->SpdAddressTable[0]));-      MiscPeiPreMemConfig->SpdAddressTable[1] = PcdGet8 (PcdMrcSpdAddressTable1);-      DEBUG ((DEBUG_INFO, "MiscPeiPreMemConfig->SpdAddressTable[1] 0x%x\n", MiscPeiPreMemConfig->SpdAddressTable[1]));-      MiscPeiPreMemConfig->SpdAddressTable[2] = PcdGet8 (PcdMrcSpdAddressTable2);-      DEBUG ((DEBUG_INFO, "MiscPeiPreMemConfig->SpdAddressTable[2] 0x%x\n", MiscPeiPreMemConfig->SpdAddressTable[2]));-      MiscPeiPreMemConfig->SpdAddressTable[3] = PcdGet8 (PcdMrcSpdAddressTable3);-      DEBUG ((DEBUG_INFO, "MiscPeiPreMemConfig->SpdAddressTable[3] 0x%x\n", MiscPeiPreMemConfig->SpdAddressTable[3]));-    }-  }-  return Status;-}--static EFI_PEI_NOTIFY_DESCRIPTOR  mSiPreMemPolicyPpiNotifyList[] = {-  {-    EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,-    &gSiPreMemPolicyPpiGuid,-    SiPreMemPolicyPpiNotify-  }-};--/**-  The library constructuor.-  The function register a policy install notify callback.--  @param[in]  ImageHandle       The firmware allocated handle for the UEFI image.-  @param[in]  SystemTable       A pointer to the EFI system table.--  @retval     EFI_SUCCESS       The function always return EFI_SUCCESS for now.-                                It will ASSERT on error for debug version.-**/-EFI_STATUS-EFIAPI-PeiPreMemSiliconPolicyNotifyLibConstructor (-  IN       EFI_PEI_FILE_HANDLE  FileHandle,-  IN CONST EFI_PEI_SERVICES     **PeiServices-  )-{-  EFI_STATUS                  Status;-  //-  // Register call back after PPI produced-  //-  Status = PeiServicesNotifyPpi (mSiPreMemPolicyPpiNotifyList);-  ASSERT_EFI_ERROR (Status);--  return EFI_SUCCESS;-}diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf
deleted file mode 100644
index 0fc857c41263..000000000000
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf
+++ /dev/null
@@ -1,44 +0,0 @@
-## @file-# Component information file for Silicon Policy Notify Library.-# This library implements constructor function to register notify call back-# when policy PPI installed.-#-# Copyright (c) 2019 - 2020 Intel Corporation. All rights reserved.<BR>-#-# SPDX-License-Identifier: BSD-2-Clause-Patent-#-##--[Defines]-  INF_VERSION                    = 0x00010005-  BASE_NAME                      = PeiPreMemSiliconPolicyNotifyLib-  FILE_GUID                      = 6D231E12-C088-47C8-8B16-61F07293EEF8-  MODULE_TYPE                    = PEIM-  VERSION_STRING                 = 1.0-  LIBRARY_CLASS                  = NULL-  CONSTRUCTOR                    = PeiPreMemSiliconPolicyNotifyLibConstructor--[LibraryClasses]-  BaseLib--[Packages]-  MdePkg/MdePkg.dec-  KabylakeOpenBoardPkg/OpenBoardPkg.dec-  KabylakeSiliconPkg/SiPkg.dec-  IntelSiliconPkg/IntelSiliconPkg.dec--[Sources]-  PeiPreMemSiliconPolicyNotifyLib.c--[Guids]-  gSaMiscPeiPreMemConfigGuid--[Ppis]-  gSiPreMemPolicyPpiGuid--[Pcd]-  # SPD Address Table-  gKabylakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable0-  gKabylakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable1-  gKabylakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable2-  gKabylakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable3diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
index 302cb679b5eb..7f276d351280 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
@@ -301,7 +301,7 @@
     #     # Hook a library constructor to update some policy fields when policy is installed.     #-    NULL|$(PROJECT)/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf+    NULL|$(PLATFORM_BOARD_PACKAGE)/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf   }   $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPostMem.inf -- 
2.31.1



-=-=-=-=-=-=
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#78661): https://edk2.groups.io/g/devel/message/78661
Mute This Topic: https://groups.io/mt/84669971/1767664
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [nathaniel.l.desimone@intel.com] -=-=-=-=-=-=




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


Re: [edk2-devel] [edk2-platforms][PATCH v1] KabylakeOpenBoardPkg/GalagoPro3: Deduplicate PeiSiliconPolicyNotifyLib
Posted by Nate DeSimone 2 years, 8 months ago
Pushed: https://github.com/tianocore/edk2-platforms/commit/9466dad

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Benjamin Doron
Sent: Wednesday, August 4, 2021 12:31 PM
To: devel@edk2.groups.io
Cc: Jeremy Soller <jeremy@system76.com>
Subject: [edk2-devel] [edk2-platforms][PATCH v1] KabylakeOpenBoardPkg/GalagoPro3: Deduplicate PeiSiliconPolicyNotifyLib

GalagoPro3 board has a duplicate copy of PeiSiliconPolicyNotifyLib.
Remove it, and use the copy under KabylakeOpenBoardPkg/FspWrapper/ instead.

Cc: Jeremy Soller <jeremy@system76.com>
Signed-off-by: Benjamin Doron <benjamin.doron00@gmail.com>
---
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.c   | 104 --------------------
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf |  44 ---------
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc                                                                 |   2 +-
 3 files changed, 1 insertion(+), 149 deletions(-)

diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.c b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.c
deleted file mode 100644
index 70a6b7e5d2a7..000000000000
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/** @file-  This library implements constructor function to register notify call back-  when policy PPI installed.--Copyright (c) 2019 - 2020 Intel Corporation. All rights reserved.<BR>-SPDX-License-Identifier: BSD-2-Clause-Patent--**/-#include <PiPei.h>-#include <Library/DebugLib.h>-#include <Library/MemoryAllocationLib.h>-#include <Library/PeiServicesLib.h>-#include <Library/SiPolicyLib.h>-#include <Library/ConfigBlockLib.h>--/**-  Callback function to update policy when policy PPI installed.--  @param[in] PeiServices          General purpose services available to every PEIM.-  @param[in] NotifyDescriptor     The notification structure this PEIM registered on install.-  @param[in] Ppi                  The memory discovered PPI.  Not used.--  @retval EFI_SUCCESS             Succeeds.-  @retval Others                  Error code returned by sub-functions.-**/-EFI_STATUS-EFIAPI-SiPreMemPolicyPpiNotify (-  IN  EFI_PEI_SERVICES             **PeiServices,-  IN  EFI_PEI_NOTIFY_DESCRIPTOR    *NotifyDescriptor,-  IN  VOID                         *Ppi-  )-{-  EFI_STATUS                  Status;-  SI_PREMEM_POLICY_PPI        *SiPreMemPolicyPpi;-  SA_MISC_PEI_PREMEM_CONFIG   *MiscPeiPreMemConfig;--  DEBUG ((DEBUG_INFO, "SiPreMemPolicyPpiNotify() Start\n"));--  Status = PeiServicesLocatePpi (-             &gSiPreMemPolicyPpiGuid,-             0,-             NULL,-             (VOID **)&SiPreMemPolicyPpi-             );-  ASSERT_EFI_ERROR (Status);-  if (SiPreMemPolicyPpi != NULL) {-    //-    // Get requisite IP Config Blocks which needs to be used here-    //-    Status = GetConfigBlock ((VOID *) SiPreMemPolicyPpi, &gSaMiscPeiPreMemConfigGuid, (VOID *) &MiscPeiPreMemConfig);-    ASSERT_EFI_ERROR (Status);--    //-    // Update SpdAddressTable policy when it is installed.-    //-    if (MiscPeiPreMemConfig != NULL) {-      MiscPeiPreMemConfig->SpdAddressTable[0] = PcdGet8 (PcdMrcSpdAddressTable0);-      DEBUG ((DEBUG_INFO, "MiscPeiPreMemConfig->SpdAddressTable[0] 0x%x\n", MiscPeiPreMemConfig->SpdAddressTable[0]));-      MiscPeiPreMemConfig->SpdAddressTable[1] = PcdGet8 (PcdMrcSpdAddressTable1);-      DEBUG ((DEBUG_INFO, "MiscPeiPreMemConfig->SpdAddressTable[1] 0x%x\n", MiscPeiPreMemConfig->SpdAddressTable[1]));-      MiscPeiPreMemConfig->SpdAddressTable[2] = PcdGet8 (PcdMrcSpdAddressTable2);-      DEBUG ((DEBUG_INFO, "MiscPeiPreMemConfig->SpdAddressTable[2] 0x%x\n", MiscPeiPreMemConfig->SpdAddressTable[2]));-      MiscPeiPreMemConfig->SpdAddressTable[3] = PcdGet8 (PcdMrcSpdAddressTable3);-      DEBUG ((DEBUG_INFO, "MiscPeiPreMemConfig->SpdAddressTable[3] 0x%x\n", MiscPeiPreMemConfig->SpdAddressTable[3]));-    }-  }-  return Status;-}--static EFI_PEI_NOTIFY_DESCRIPTOR  mSiPreMemPolicyPpiNotifyList[] = {-  {-    EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,-    &gSiPreMemPolicyPpiGuid,-    SiPreMemPolicyPpiNotify-  }-};--/**-  The library constructuor.-  The function register a policy install notify callback.--  @param[in]  ImageHandle       The firmware allocated handle for the UEFI image.-  @param[in]  SystemTable       A pointer to the EFI system table.--  @retval     EFI_SUCCESS       The function always return EFI_SUCCESS for now.-                                It will ASSERT on error for debug version.-**/-EFI_STATUS-EFIAPI-PeiPreMemSiliconPolicyNotifyLibConstructor (-  IN       EFI_PEI_FILE_HANDLE  FileHandle,-  IN CONST EFI_PEI_SERVICES     **PeiServices-  )-{-  EFI_STATUS                  Status;-  //-  // Register call back after PPI produced-  //-  Status = PeiServicesNotifyPpi (mSiPreMemPolicyPpiNotifyList);-  ASSERT_EFI_ERROR (Status);--  return EFI_SUCCESS;-}diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf
deleted file mode 100644
index 0fc857c41263..000000000000
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf
+++ /dev/null
@@ -1,44 +0,0 @@
-## @file-# Component information file for Silicon Policy Notify Library.-# This library implements constructor function to register notify call back-# when policy PPI installed.-#-# Copyright (c) 2019 - 2020 Intel Corporation. All rights reserved.<BR>-#-# SPDX-License-Identifier: BSD-2-Clause-Patent-#-##--[Defines]-  INF_VERSION                    = 0x00010005-  BASE_NAME                      = PeiPreMemSiliconPolicyNotifyLib-  FILE_GUID                      = 6D231E12-C088-47C8-8B16-61F07293EEF8-  MODULE_TYPE                    = PEIM-  VERSION_STRING                 = 1.0-  LIBRARY_CLASS                  = NULL-  CONSTRUCTOR                    = PeiPreMemSiliconPolicyNotifyLibConstructor--[LibraryClasses]-  BaseLib--[Packages]-  MdePkg/MdePkg.dec-  KabylakeOpenBoardPkg/OpenBoardPkg.dec-  KabylakeSiliconPkg/SiPkg.dec-  IntelSiliconPkg/IntelSiliconPkg.dec--[Sources]-  PeiPreMemSiliconPolicyNotifyLib.c--[Guids]-  gSaMiscPeiPreMemConfigGuid--[Ppis]-  gSiPreMemPolicyPpiGuid--[Pcd]-  # SPD Address Table-  gKabylakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable0-  gKabylakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable1-  gKabylakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable2-  gKabylakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable3diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
index 302cb679b5eb..7f276d351280 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
@@ -301,7 +301,7 @@
     #     # Hook a library constructor to update some policy fields when policy is installed.     #-    NULL|$(PROJECT)/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf+    NULL|$(PLATFORM_BOARD_PACKAGE)/FspWrapper/Library/PeiSiliconPolicyNotifyLib/PeiPreMemSiliconPolicyNotifyLib.inf   }   $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPostMem.inf -- 
2.31.1



-=-=-=-=-=-=
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#78661): https://edk2.groups.io/g/devel/message/78661
Mute This Topic: https://groups.io/mt/84669971/1767664
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [nathaniel.l.desimone@intel.com] -=-=-=-=-=-=




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