public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Kubacki, Michael A" <michael.a.kubacki@intel.com>
To: "Desimone, Nathaniel L" <nathaniel.l.desimone@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Chiu, Chasel" <chasel.chiu@intel.com>,
	"Chaganty, Rangasai V" <rangasai.v.chaganty@intel.com>
Subject: Re: [edk2-platforms] [PATCH V2 06/14] CoffeelakeSiliconPkg: Add SiliconInitLib
Date: Fri, 22 Nov 2019 06:32:20 +0000	[thread overview]
Message-ID: <BY5PR11MB448482976B833568BA9B4263B5490@BY5PR11MB4484.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20191121085853.2626-7-nathaniel.l.desimone@intel.com>

Reviewed-by: Michael Kubacki <michael.a.kubacki@intel.com>

> -----Original Message-----
> From: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
> Sent: Thursday, November 21, 2019 12:59 AM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel <chasel.chiu@intel.com>; Kubacki, Michael A
> <michael.a.kubacki@intel.com>; Chaganty, Rangasai V
> <rangasai.v.chaganty@intel.com>
> Subject: [edk2-platforms] [PATCH V2 06/14] CoffeelakeSiliconPkg: Add
> SiliconInitLib
> 
> SiliconInitLib contains Silicon Init APIs that can be reused by BoardInitLib. It is
> expected that several implementations of BoardInitLib exist for a given SOC,
> these APIs allow the various BoardInitLib implementations to reuse common
> silicon initialization code. This matches the implementation already found in
> KabylakeSiliconPkg. This change also adds halting the TCO watch dog timer to
> PEI, which was previously done in SEC.
> 
> Cc: Chasel Chiu <chasel.chiu@intel.com>
> Cc: Michael Kubacki <michael.a.kubacki@intel.com>
> Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
> Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
> ---
>  .../Include/Library/SiliconInitLib.h          |  28 +++++
>  .../PeiSiliconInitLib/PeiSiliconInitLib.inf   |  46 ++++++++
>  .../Library/PeiSiliconInitLib/SiliconInit.c   |  19 +++
>  .../PeiSiliconInitLib/SiliconInitPreMem.c     | 109 ++++++++++++++++++
>  4 files changed, 202 insertions(+)
>  create mode 100644
> Silicon/Intel/CoffeelakeSiliconPkg/Include/Library/SiliconInitLib.h
>  create mode 100644
> Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconInitLib/PeiSiliconInitLib.in
> f
>  create mode 100644
> Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconInitLib/SiliconInit.c
>  create mode 100644
> Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconInitLib/SiliconInitPreMem
> .c
> 
> diff --git a/Silicon/Intel/CoffeelakeSiliconPkg/Include/Library/SiliconInitLib.h
> b/Silicon/Intel/CoffeelakeSiliconPkg/Include/Library/SiliconInitLib.h
> new file mode 100644
> index 0000000000..a3411126a7
> --- /dev/null
> +++ b/Silicon/Intel/CoffeelakeSiliconPkg/Include/Library/SiliconInitLib.
> +++ h
> @@ -0,0 +1,28 @@
> +/** @file++Copyright (c) 2019, Intel Corporation. All rights
> +reserved.<BR>+SPDX-License-Identifier:
> +BSD-2-Clause-Patent++**/++#ifndef _SILICON_INIT_LIB_H_+#define
> +_SILICON_INIT_LIB_H_++#include <PiPei.h>++VOID+EarlySiliconInit (+
> +VOID+  );++VOID+SiliconInit (+  VOID+  );++VOID+LateSiliconInit (+
> +VOID+  );++#endif
> \ No newline at end of file
> diff --git
> a/Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconInitLib/PeiSiliconInitLib.
> inf
> b/Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconInitLib/PeiSiliconInitLib.
> inf
> new file mode 100644
> index 0000000000..1534a24dd2
> --- /dev/null
> +++ b/Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconInitLib/PeiSi
> +++ liconInitLib.inf
> @@ -0,0 +1,46 @@
> +### @file+#+# Copyright (c) 2019, Intel Corporation. All rights
> reserved.<BR>+#+# SPDX-License-Identifier: BSD-2-Clause-
> Patent+#+###++[Defines]+  INF_VERSION                    = 0x00010017+
> BASE_NAME                      = SiliconInitLib+  FILE_GUID                      = 82F2ACF0-
> 2EBE-48C8-AC58-9D0F8BC1E16E+  VERSION_STRING                 = 1.0+
> MODULE_TYPE                    = PEIM+  LIBRARY_CLASS                  =
> SiliconInitLib|SEC PEIM+#+# The following information is for reference only
> and not required by the build tools.+#+# VALID_ARCHITECTURES = IA32 X64
> IPF EBC+#++[LibraryClasses]+  BaseLib+  BaseMemoryLib+  DebugLib+
> HobLib+  IoLib+  PcdLib+  PeiServicesLib+  PchCycleDecodingLib+
> PmcLib++[Packages]+  MdePkg/MdePkg.dec+
> CoffeelakeSiliconPkg/SiPkg.dec++[Sources]+  SiliconInit.c+
> SiliconInitPreMem.c++[Guids]+  gTcoWdtHobGuid                              ##
> CONSUMES++[Pcd]+  gSiPkgTokenSpaceGuid.PcdAcpiBaseAddress     ##
> CONSUMES+  gSiPkgTokenSpaceGuid.PcdTcoBaseAddress      ##
> CONSUMESdiff --git
> a/Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconInitLib/SiliconInit.c
> b/Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconInitLib/SiliconInit.c
> new file mode 100644
> index 0000000000..1c15e0e54e
> --- /dev/null
> +++ b/Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconInitLib/Silic
> +++ onInit.c
> @@ -0,0 +1,19 @@
> +/** @file+  Silicon Init APIs for MinPlatform BoardInitLib
> +implementations.++Copyright (c) 2019, Intel Corporation. All rights
> +reserved.<BR>+SPDX-License-Identifier:
> +BSD-2-Clause-Patent++**/++#include <PiPei.h>++/**+  Late Silicon
> +Initialization+**/+VOID+LateSiliconInit (+  VOID+  )+{+}diff --git
> +a/Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconInitLib/SiliconI
> +nitPreMem.c
> +b/Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconInitLib/SiliconI
> +nitPreMem.c
> new file mode 100644
> index 0000000000..ab98b6ccc5
> --- /dev/null
> +++ b/Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconInitLib/Silic
> +++ onInitPreMem.c
> @@ -0,0 +1,109 @@
> +/** @file+  Silicon Init APIs for MinPlatform BoardInitLib
> implementations.++Copyright (c) 2019, Intel Corporation. All rights
> reserved.<BR>+SPDX-License-Identifier: BSD-2-Clause-
> Patent++**/++#include <PiPei.h>+#include <Guid/TcoWdtHob.h>+#include
> <Library/IoLib.h>+#include <Library/DebugLib.h>+#include
> <Library/HobLib.h>+#include <Library/PcdLib.h>+#include
> <Library/PeiServicesLib.h>+#include
> <Library/PchCycleDecodingLib.h>+#include <Library/PmcLib.h>+#include
> <Register/PchRegsLpc.h>+#include <Register/PchRegsPmc.h>++/**+  Early
> Silicon initialization+**/+VOID+EarlySiliconInit (+  VOID+  )+{+  UINT16
> Data16;+  UINT8        Data8;+  UINT8        TcoRebootHappened;+
> TCO_WDT_HOB  *TcoWdtHobPtr;+  EFI_STATUS   Status;++  ///+  /// LPC I/O
> Configuration+  ///+  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+    );++  ///+  /// Halt the TCO timer+  ///+  Data16 =
> IoRead16 (PcdGet16 (PcdTcoBaseAddress) + R_TCO_IO_TCO1_CNT);+
> Data16 |= B_TCO_IO_TCO1_CNT_TMR_HLT;+  IoWrite16 (PcdGet16
> (PcdTcoBaseAddress) + R_TCO_IO_TCO1_CNT, Data16);++  ///+  /// 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);+}++/**+
> Initialize the GPIO IO selection, GPIO USE selection, and GPIO signal inversion
> registers++**/+VOID+SiliconInit (+  VOID+  )+{+  UINT16       ABase;++  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);+}--
> 2.24.0.windows.2


  parent reply	other threads:[~2019-11-22  6:32 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 [this message]
2019-11-22  6:55   ` Chaganty, Rangasai V
2019-11-21  8:58 ` [edk2-platforms] [PATCH V2 07/14] WhiskeylakeOpenBoardPkg: Add SiliconInitLib APIs to 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 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=BY5PR11MB448482976B833568BA9B4263B5490@BY5PR11MB4484.namprd11.prod.outlook.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