public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Nate DeSimone" <nathaniel.l.desimone@intel.com>
To: devel@edk2.groups.io
Cc: Chasel Chiu <chasel.chiu@intel.com>,
	Michael Kubacki <michael.a.kubacki@intel.com>
Subject: [edk2-platforms] [PATCH V2 07/14] WhiskeylakeOpenBoardPkg: Add SiliconInitLib APIs to BoardInitLib
Date: Thu, 21 Nov 2019 00:58:46 -0800	[thread overview]
Message-ID: <20191121085853.2626-8-nathaniel.l.desimone@intel.com> (raw)
In-Reply-To: <20191121085853.2626-1-nathaniel.l.desimone@intel.com>

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Michael Kubacki <michael.a.kubacki@intel.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
 .../BoardInitLib/PeiBoardInitPostMemLib.inf   |  1 +
 .../BoardInitLib/PeiBoardInitPreMemLib.inf    |  1 +
 .../PeiMultiBoardInitPostMemLib.inf           |  1 +
 .../PeiMultiBoardInitPreMemLib.inf            |  2 +-
 .../PeiWhiskeylakeURvpInitPostMemLib.c        |  6 +-
 .../PeiWhiskeylakeURvpInitPreMemLib.c         | 89 ++-----------------
 .../BoardInitLib/WhiskeylakeURvpInit.h        |  1 +
 .../WhiskeylakeURvp/OpenBoardPkg.dsc          |  5 ++
 8 files changed, 24 insertions(+), 82 deletions(-)

diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiBoardInitPostMemLib.inf b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiBoardInitPostMemLib.inf
index 9bf4d127c5..affc5c56ad 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiBoardInitPostMemLib.inf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiBoardInitPostMemLib.inf
@@ -26,6 +26,7 @@
   HdaVerbTableLib
   MemoryAllocationLib
   PcdLib
+  SiliconInitLib
 
 [Packages]
   MinPlatformPkg/MinPlatformPkg.dec
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiBoardInitPreMemLib.inf b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiBoardInitPreMemLib.inf
index 4ab80f9eb3..40e20285e0 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiBoardInitPreMemLib.inf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiBoardInitPreMemLib.inf
@@ -23,6 +23,7 @@
   BaseMemoryLib
   MemoryAllocationLib
   PcdLib
+  SiliconInitLib
 
 [Packages]
   MinPlatformPkg/MinPlatformPkg.dec
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPostMemLib.inf b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPostMemLib.inf
index c043e32638..21dc2f70c0 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPostMemLib.inf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPostMemLib.inf
@@ -30,6 +30,7 @@
   PeiPlatformHookLib
   PeiPolicyInitLib
   PchInfoLib
+  SiliconInitLib
 
 [Packages]
   MinPlatformPkg/MinPlatformPkg.dec
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPreMemLib.inf b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPreMemLib.inf
index cd0315377a..7389f1dfcd 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPreMemLib.inf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPreMemLib.inf
@@ -31,6 +31,7 @@
   PeiPlatformHookLib
   PeiPolicyInitLib
   PlatformHookLib
+  SiliconInitLib
   StallPpiLib
 
 [Packages]
@@ -57,7 +58,6 @@
 
 [Guids]
   gPchGeneralPreMemConfigGuid      ## CONSUMES
-  gTcoWdtHobGuid                                ## CONSUMES
 
 [Pcd]
   gWhiskeylakeOpenBoardPkgTokenSpaceGuid.PcdLpcSioConfigDefaultPort
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiWhiskeylakeURvpInitPostMemLib.c b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiWhiskeylakeURvpInitPostMemLib.c
index 9413620a4a..248a6657d5 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiWhiskeylakeURvpInitPostMemLib.c
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiWhiskeylakeURvpInitPostMemLib.c
@@ -430,6 +430,10 @@ WhiskeylakeURvpBoardInitBeforeSiliconInit (
   //
   Status = UpdateChipsetInitPtr();
 
+  ///
+  /// Do Late PCH init
+  ///
+  LateSiliconInit ();
+
   return EFI_SUCCESS;
 }
-
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiWhiskeylakeURvpInitPreMemLib.c b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiWhiskeylakeURvpInitPreMemLib.c
index 0124888244..055d731651 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiWhiskeylakeURvpInitPreMemLib.c
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiWhiskeylakeURvpInitPreMemLib.c
@@ -45,7 +45,6 @@
 #include <Library/PciSegmentLib.h>
 #include <PeiPlatformHookLib.h>
 #include <FirwmareConfigurations.h>
-#include <Guid/TcoWdtHob.h>
 #include <Library/OcWdtLib.h>
 
 ///
@@ -232,50 +231,8 @@ BoardMiscInitPreMem(
   return EFI_SUCCESS;
 }
 
-//@todo it should be moved to Si Pkg.
-/**
-Early Platform PCH initialization
-**/
-VOID
-EarlyPlatformPchInit(
-  VOID
-)
-{
-  UINT8        Data8;
-  UINT8        TcoRebootHappened;
-  TCO_WDT_HOB  *TcoWdtHobPtr;
-  EFI_STATUS   Status;
-
-  ///
-  /// Read the Second TO status bit
-  ///
-  Data8 = IoRead8(PcdGet16(PcdTcoBaseAddress) + R_TCO_IO_TCO2_STS);
-  if ((Data8 & B_TCO_IO_TCO2_STS_SECOND_TO) == B_TCO_IO_TCO2_STS_SECOND_TO) {
-    TcoRebootHappened = 1;
-    DEBUG((DEBUG_INFO, "PlatformInitPreMem - TCO Second TO status bit is set. This might be a TCO reboot\n"));
-  }
-  else {
-    TcoRebootHappened = 0;
-  }
-
-  ///
-  /// Create HOB
-  ///
-  Status = PeiServicesCreateHob(EFI_HOB_TYPE_GUID_EXTENSION, sizeof(TCO_WDT_HOB), (VOID **)&TcoWdtHobPtr);
-  if (!EFI_ERROR(Status)) {
-    TcoWdtHobPtr->Header.Name = gTcoWdtHobGuid;
-    TcoWdtHobPtr->TcoRebootHappened = TcoRebootHappened;
-  }
-
-  ///
-  /// Clear the Second TO status bit
-  ///
-  IoWrite8(PcdGet16(PcdTcoBaseAddress) + R_TCO_IO_TCO2_STS, B_TCO_IO_TCO2_STS_SECOND_TO);
-}
-
 /**
   Board configuration initialization in the pre-memory boot phase.
-
 **/
 VOID
 BoardConfigInitPreMem (
@@ -341,7 +298,6 @@ PlatformInitPreMemCallBack(
 )
 {
   EFI_STATUS                        Status;
-  UINT16                            ABase;
   UINT8                             FwConfig;
 
   //
@@ -378,16 +334,8 @@ PlatformInitPreMemCallBack(
   ///
   /// Configure GPIO and SIO
   ///
-  Status = BoardInitPreMem();
-  ASSERT_EFI_ERROR(Status);
-
-  ABase = PmcGetAcpiBase();
-
-  ///
-  /// Clear all pending SMI. On S3 clear power button enable so it will not generate an SMI.
-  ///
-  IoWrite16(ABase + R_ACPI_IO_PM1_EN, 0);
-  IoWrite32(ABase + R_ACPI_IO_GPE0_EN_127_96, 0);
+  Status = BoardInitPreMem ();
+  ASSERT_EFI_ERROR (Status);
 
   ///
   /// Install Pre Memory PPIs
@@ -550,12 +498,6 @@ WhiskeylakeURvpInitPreMem (
   Status = InstallStallPpi();
   ASSERT_EFI_ERROR(Status);
 
-  ///@todo it should be moved to Si Pkg.
-  ///
-  /// Do Early PCH init
-  ///
-  EarlyPlatformPchInit();
-
   //
   // Install PCH RESET PPI and EFI RESET2 PeiService
   //
@@ -588,6 +530,11 @@ WhiskeylakeURvpBoardInitBeforeMemoryInit (
   VOID
   )
 {
+  ///
+  /// Do basic PCH init
+  ///
+  SiliconInit ();
+
   WhiskeylakeURvpInitPreMem ();
 
   return EFI_SUCCESS;
@@ -600,27 +547,9 @@ WhiskeylakeURvpBoardDebugInit (
   )
 {
   ///
-  /// LPC I/O Configuration
+  /// Do Early PCH init
   ///
-  PchLpcIoDecodeRangesSet (
-    (V_LPC_CFG_IOD_LPT_378 << N_LPC_CFG_IOD_LPT) |
-    (V_LPC_CFG_IOD_COMB_3E8 << N_LPC_CFG_IOD_COMB) |
-    (V_LPC_CFG_IOD_COMA_3F8 << N_LPC_CFG_IOD_COMA)
-    );
-
-  PchLpcIoEnableDecodingSet (
-    B_LPC_CFG_IOE_ME2 |
-    B_LPC_CFG_IOE_SE |
-    B_LPC_CFG_IOE_ME1 |
-    B_LPC_CFG_IOE_KE |
-    B_LPC_CFG_IOE_HGE |
-    B_LPC_CFG_IOE_LGE |
-    B_LPC_CFG_IOE_FDE |
-    B_LPC_CFG_IOE_PPE |
-    B_LPC_CFG_IOE_CBE |
-    B_LPC_CFG_IOE_CAE
-    );
-
+  EarlySiliconInit ();
   return EFI_SUCCESS;
 }
 
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/WhiskeylakeURvpInit.h b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/WhiskeylakeURvpInit.h
index 325bcb41df..d3a709b2a9 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/WhiskeylakeURvpInit.h
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/WhiskeylakeURvpInit.h
@@ -15,6 +15,7 @@
 #include <Library/MemoryAllocationLib.h>
 #include <Library/DebugLib.h>
 #include <Library/GpioLib.h>
+#include <Library/SiliconInitLib.h>
 #include <Ppi/SiPolicy.h>
 #include <PchHsioPtssTables.h>
 
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
index cdaf47b6f7..3cd0478021 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
@@ -154,6 +154,11 @@
   TimerLib|$(PLATFORM_BOARD_PACKAGE)/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
 
 [LibraryClasses.common.PEIM]
+  #######################################
+  # Silicon Initialization Package
+  #######################################
+  SiliconInitLib|$(PLATFORM_SI_PACKAGE)/Library/PeiSiliconInitLib/PeiSiliconInitLib.inf
+
   #######################################
   # Platform Package
   #######################################
-- 
2.24.0.windows.2


  parent reply	other threads:[~2019-11-21  8:59 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-21  8:58 [edk2-platforms] [PATCH V2 00/14] SecFspWrapperPlatformSecLib Cleanup Nate DeSimone
2019-11-21  8:58 ` [edk2-platforms] [PATCH V2 01/14] KabylakeSiliconPkg: Change MODULE_TYPE of SiliconInitLib to PEIM Nate DeSimone
2019-11-22  5:15   ` Chiu, Chasel
2019-11-22  6:31   ` Kubacki, Michael A
2019-11-22  6:36   ` Chaganty, Rangasai V
2019-11-21  8:58 ` [edk2-platforms] [PATCH V2 02/14] KabylakeOpenBoardPkg: Update location of SiliconInitLib Nate DeSimone
2019-11-22  5:15   ` [edk2-devel] " Chiu, Chasel
2019-11-22  6:31   ` Kubacki, Michael A
2019-11-21  8:58 ` [edk2-platforms] [PATCH V2 03/14] KabylakeSiliconPkg: Cleanup old comments Nate DeSimone
2019-11-22  5:15   ` Chiu, Chasel
2019-11-22  6:32   ` Kubacki, Michael A
2019-11-22  6:42   ` Chaganty, Rangasai V
2019-11-21  8:58 ` [edk2-platforms] [PATCH V2 04/14] CoffeeLakeSiliconPkg: Move TcoWdtHob.h Nate DeSimone
2019-11-22  5:15   ` Chiu, Chasel
2019-11-22  6:32   ` [edk2-devel] " Kubacki, Michael A
2019-11-22  6:46   ` Chaganty, Rangasai V
2019-11-21  8:58 ` [edk2-platforms] [PATCH V2 05/14] CoffeeLakeSiliconPkg: TcoWdtHob.h Cleanup Nate DeSimone
2019-11-22  5:16   ` Chiu, Chasel
2019-11-22  6:32   ` Kubacki, Michael A
2019-11-22  6:48   ` Chaganty, Rangasai V
2019-11-21  8:58 ` [edk2-platforms] [PATCH V2 06/14] CoffeelakeSiliconPkg: Add SiliconInitLib Nate DeSimone
2019-11-22  5:16   ` Chiu, Chasel
2019-11-22  6:32   ` Kubacki, Michael A
2019-11-22  6:55   ` Chaganty, Rangasai V
2019-11-21  8:58 ` Nate DeSimone [this message]
2019-11-22  5:16   ` [edk2-platforms] [PATCH V2 07/14] WhiskeylakeOpenBoardPkg: Add SiliconInitLib APIs to BoardInitLib Chiu, Chasel
2019-11-22  6:32   ` Kubacki, Michael A
2019-11-21  8:58 ` [edk2-platforms] [PATCH V2 08/14] WhiskeylakeOpenBoardPkg: Whitespace cleanup in BoardInitLib Nate DeSimone
2019-11-22  5:16   ` Chiu, Chasel
2019-11-22  6:32   ` Kubacki, Michael A
2019-11-21  8:58 ` [edk2-platforms] [PATCH V2 09/14] WhiskeylakeOpenBoardPkg: Remove SecFspWrapperPlatformSecLib override Nate DeSimone
2019-11-22  5:17   ` Chiu, Chasel
2019-11-22  6:32   ` Kubacki, Michael A
2019-11-21  8:58 ` [edk2-platforms] [PATCH V2 10/14] MinPlatformPkg: FSP Dispatch Mode Support for PlatformSecLib Nate DeSimone
2019-11-22  5:17   ` Chiu, Chasel
2019-11-22  6:32   ` Kubacki, Michael A
2019-11-21  8:58 ` [edk2-platforms] [PATCH V2 11/14] MinPlatformPkg: Coding style cleanups in MinPlatformPkg.dec Nate DeSimone
2019-11-22  5:17   ` Chiu, Chasel
2019-11-22  6:32   ` Kubacki, Michael A
2019-11-21  8:58 ` [edk2-platforms] [PATCH V2 12/14] KabylakeOpenBoardPkg: Add support for PcdFspDispatchModeUseFspPeiMain Nate DeSimone
2019-11-22  5:18   ` Chiu, Chasel
2019-11-22  6:32   ` Kubacki, Michael A
2019-11-21  8:58 ` [edk2-platforms] [PATCH V2 13/14] KabylakeOpenBoardPkg: Remove SecFspWrapperPlatformSecLib override Nate DeSimone
2019-11-22  5:18   ` Chiu, Chasel
2019-11-22  6:32   ` Kubacki, Michael A
2019-11-21  8:58 ` [edk2-platforms] [PATCH V2 14/14] MinPlatformPkg: Remove BoardInitLib dependency from PlatformSecLib Nate DeSimone
2019-11-22  5:18   ` Chiu, Chasel
2019-11-22  6:33   ` Kubacki, Michael A
2019-11-21 17:51 ` [edk2-platforms] [PATCH V2 00/14] SecFspWrapperPlatformSecLib Cleanup Kubacki, Michael A
2019-11-22  0:51   ` 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=20191121085853.2626-8-nathaniel.l.desimone@intel.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