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 V1 06/13] WhiskeylakeOpenBoardPkg: Add SiliconInitLib APIs to BoardInitLib
Date: Wed, 13 Nov 2019 22:06:48 -0800	[thread overview]
Message-ID: <20191114060655.5161-7-nathaniel.l.desimone@intel.com> (raw)
In-Reply-To: <20191114060655.5161-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.23.0.windows.1


  parent reply	other threads:[~2019-11-14  6:22 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-14  6:06 [edk2-platforms] [PATCH V1 00/13] SecFspWrapperPlatformSecLib Cleanup Nate DeSimone
2019-11-14  6:06 ` [edk2-platforms] [PATCH V1 01/13] KabylakeSiliconPkg: Change MODULE_TYPE of SiliconInitLib to PEIM Nate DeSimone
2019-11-14 15:15   ` Chiu, Chasel
2019-11-15  8:59   ` Chaganty, Rangasai V
2019-11-16  2:53   ` Kubacki, Michael A
2019-11-14  6:06 ` [edk2-platforms] [PATCH V1 02/13] KabylakeOpenBoardPkg: Update location of SiliconInitLib Nate DeSimone
2019-11-14 15:15   ` Chiu, Chasel
2019-11-16  2:53   ` Kubacki, Michael A
2019-11-14  6:06 ` [edk2-platforms] [PATCH V1 03/13] KabylakeSiliconPkg: Cleanup old comments Nate DeSimone
2019-11-14 15:16   ` Chiu, Chasel
2019-11-16  2:53   ` Kubacki, Michael A
2019-11-18  9:15   ` Chaganty, Rangasai V
2019-11-14  6:06 ` [edk2-platforms] [PATCH V1 04/13] CoffeeLakeSiliconPkg: Move TcoWdtHob.h Nate DeSimone
2019-11-14 15:16   ` Chiu, Chasel
2019-11-16  2:53   ` Kubacki, Michael A
2019-11-18  9:41   ` Chaganty, Rangasai V
2019-11-14  6:06 ` [edk2-platforms] [PATCH V1 05/13] CoffeelakeSiliconPkg: Add SiliconInitLib Nate DeSimone
2019-11-14 15:16   ` Chiu, Chasel
2019-11-16  2:53   ` Kubacki, Michael A
2019-11-18 19:14   ` Chaganty, Rangasai V
2019-11-14  6:06 ` Nate DeSimone [this message]
2019-11-14 15:16   ` [edk2-platforms] [PATCH V1 06/13] WhiskeylakeOpenBoardPkg: Add SiliconInitLib APIs to BoardInitLib Chiu, Chasel
2019-11-16  2:53   ` Kubacki, Michael A
2019-11-14  6:06 ` [edk2-platforms] [PATCH V1 07/13] WhiskeylakeOpenBoardPkg: Whitespace cleanup in BoardInitLib Nate DeSimone
2019-11-14 15:17   ` Chiu, Chasel
2019-11-16  2:53   ` Kubacki, Michael A
2019-11-14  6:06 ` [edk2-platforms] [PATCH V1 08/13] WhiskeylakeOpenBoardPkg: Remove SecFspWrapperPlatformSecLib override Nate DeSimone
2019-11-14 15:17   ` Chiu, Chasel
2019-11-16  2:53   ` Kubacki, Michael A
2019-11-14  6:06 ` [edk2-platforms] [PATCH V1 09/13] MinPlatformPkg: FSP Dispatch Mode Support for PlatformSecLib Nate DeSimone
2019-11-14 15:17   ` Chiu, Chasel
2019-11-16  2:54   ` Kubacki, Michael A
2019-11-14  6:06 ` [edk2-platforms] [PATCH V1 10/13] MinPlatformPkg: Coding style cleanups in MinPlatformPkg.dec Nate DeSimone
2019-11-14 15:17   ` Chiu, Chasel
2019-11-16  2:54   ` Kubacki, Michael A
2019-11-14  6:06 ` [edk2-platforms] [PATCH V1 11/13] KabylakeOpenBoardPkg: Add support for PcdFspDispatchModeUseFspPeiMain Nate DeSimone
2019-11-14 15:18   ` Chiu, Chasel
2019-11-16  2:54   ` Kubacki, Michael A
2019-11-14  6:06 ` [edk2-platforms] [PATCH V1 12/13] KabylakeOpenBoardPkg: Remove SecFspWrapperPlatformSecLib override Nate DeSimone
2019-11-14 15:18   ` Chiu, Chasel
2019-11-16  2:54   ` Kubacki, Michael A
2019-11-14  6:06 ` [edk2-platforms] [PATCH V1 13/13] MinPlatformPkg: Remove BoardInitLib dependency from PlatformSecLib Nate DeSimone
2019-11-14 15:18   ` Chiu, Chasel
2019-11-16  2:56   ` Kubacki, Michael A

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=20191114060655.5161-7-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