public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-platforms][PATCH v1] KabylakeOpenBoardPkg/GalagoPro3: Deduplicate PeiSiliconPolicyNotifyLib
@ 2021-08-04 19:31 Benjamin Doron
  2021-08-13  6:38 ` [edk2-devel] " Nate DeSimone
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Benjamin Doron @ 2021-08-04 19:31 UTC (permalink / raw)
  To: devel; +Cc: Jeremy Soller

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


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

end of thread, other threads:[~2021-08-13  6:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-04 19:31 [edk2-platforms][PATCH v1] KabylakeOpenBoardPkg/GalagoPro3: Deduplicate PeiSiliconPolicyNotifyLib Benjamin Doron
2021-08-13  6:38 ` [edk2-devel] " Nate DeSimone
2021-08-13  6:40 ` Nate DeSimone
2021-08-13  6:45 ` Nate DeSimone

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