Reviewed-by: Chasel Chiu <chasel.c...@intel.com>


> -----Original Message-----
> From: Desimone, Nathaniel L <nathaniel.l.desim...@intel.com>
> Sent: Thursday, November 21, 2019 4:59 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel <chasel.c...@intel.com>; Kubacki, Michael A
> <michael.a.kuba...@intel.com>
> Subject: [edk2-platforms] [PATCH V2 07/14] WhiskeylakeOpenBoardPkg: Add
> SiliconInitLib APIs to BoardInitLib
> 
> Cc: Chasel Chiu <chasel.c...@intel.com>
> Cc: Michael Kubacki <michael.a.kuba...@intel.com>
> Signed-off-by: Nate DeSimone <nathaniel.l.desim...@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/Boar
> dInitLib/PeiBoardInitPostMemLib.inf
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/PeiBoardInitPostMemLib.inf
> index 9bf4d127c5..affc5c56ad 100644
> ---
> a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/PeiBoardInitPostMemLib.inf
> +++
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/PeiBoardInitPostMemLib.inf
> @@ -26,6 +26,7 @@
>    HdaVerbTableLib
> 
>    MemoryAllocationLib
> 
>    PcdLib
> 
> +  SiliconInitLib
> 
> 
> 
>  [Packages]
> 
>    MinPlatformPkg/MinPlatformPkg.dec
> 
> diff --git
> a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/PeiBoardInitPreMemLib.inf
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/PeiBoardInitPreMemLib.inf
> index 4ab80f9eb3..40e20285e0 100644
> ---
> a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/PeiBoardInitPreMemLib.inf
> +++
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/PeiBoardInitPreMemLib.inf
> @@ -23,6 +23,7 @@
>    BaseMemoryLib
> 
>    MemoryAllocationLib
> 
>    PcdLib
> 
> +  SiliconInitLib
> 
> 
> 
>  [Packages]
> 
>    MinPlatformPkg/MinPlatformPkg.dec
> 
> diff --git
> a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/PeiMultiBoardInitPostMemLib.inf
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/PeiMultiBoardInitPostMemLib.inf
> index c043e32638..21dc2f70c0 100644
> ---
> a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/PeiMultiBoardInitPostMemLib.inf
> +++
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/PeiMultiBoardInitPostMemLib.inf
> @@ -30,6 +30,7 @@
>    PeiPlatformHookLib
> 
>    PeiPolicyInitLib
> 
>    PchInfoLib
> 
> +  SiliconInitLib
> 
> 
> 
>  [Packages]
> 
>    MinPlatformPkg/MinPlatformPkg.dec
> 
> diff --git
> a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/PeiMultiBoardInitPreMemLib.inf
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/PeiMultiBoardInitPreMemLib.inf
> index cd0315377a..7389f1dfcd 100644
> ---
> a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/PeiMultiBoardInitPreMemLib.inf
> +++
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/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/Boar
> dInitLib/PeiWhiskeylakeURvpInitPostMemLib.c
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/PeiWhiskeylakeURvpInitPostMemLib.c
> index 9413620a4a..248a6657d5 100644
> ---
> a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/PeiWhiskeylakeURvpInitPostMemLib.c
> +++
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/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/Boar
> dInitLib/PeiWhiskeylakeURvpInitPreMemLib.c
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/PeiWhiskeylakeURvpInitPreMemLib.c
> index 0124888244..055d731651 100644
> ---
> a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/PeiWhiskeylakeURvpInitPreMemLib.c
> +++
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/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/Boar
> dInitLib/WhiskeylakeURvpInit.h
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/WhiskeylakeURvpInit.h
> index 325bcb41df..d3a709b2a9 100644
> ---
> a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/WhiskeylakeURvpInit.h
> +++
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boar
> dInitLib/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/OpenBoardP
> kg.dsc
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardP
> kg.dsc
> index cdaf47b6f7..3cd0478021 100644
> ---
> a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardP
> kg.dsc
> +++
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardP
> kg.dsc
> @@ -154,6 +154,11 @@
> 
> TimerLib|$(PLATFORM_BOARD_PACKAGE)/Library/AcpiTimerLib/BaseAcpiTim
> erLib.inf
> 
> 
> 
>  [LibraryClasses.common.PEIM]
> 
> +  #######################################
> 
> +  # Silicon Initialization Package
> 
> +  #######################################
> 
> +
> SiliconInitLib|$(PLATFORM_SI_PACKAGE)/Library/PeiSiliconInitLib/PeiSiliconIn
> itLib.inf
> 
> +
> 
>    #######################################
> 
>    # Platform Package
> 
>    #######################################
> 
> --
> 2.24.0.windows.2


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#51137): https://edk2.groups.io/g/devel/message/51137
Mute This Topic: https://groups.io/mt/61073543/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to