public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Benjamin Doron" <benjamin.doron00@gmail.com>
To: devel@edk2.groups.io
Cc: Jeremy Soller <jeremy@system76.com>
Subject: [edk2-platforms][PATCH v1] KabylakeOpenBoardPkg/GalagoPro3: Deduplicate PeiSiliconPolicyNotifyLib
Date: Wed,  4 Aug 2021 15:31:22 -0400	[thread overview]
Message-ID: <20210804193122.4415-1-benjamin.doron00@gmail.com> (raw)

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


             reply	other threads:[~2021-08-04 19:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04 19:31 Benjamin Doron [this message]
2021-08-13  6:38 ` [edk2-devel] [edk2-platforms][PATCH v1] KabylakeOpenBoardPkg/GalagoPro3: Deduplicate PeiSiliconPolicyNotifyLib Nate DeSimone
2021-08-13  6:40 ` Nate DeSimone
2021-08-13  6:45 ` Nate DeSimone

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210804193122.4415-1-benjamin.doron00@gmail.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox