public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Chaganty, Rangasai V" <rangasai.v.chaganty@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>,
	"Kubacki, Michael A" <michael.a.kubacki@intel.com>
Subject: Re: [edk2-platforms] [PATCH V1 05/13] CoffeelakeSiliconPkg: Add SiliconInitLib
Date: Mon, 18 Nov 2019 19:14:11 +0000	[thread overview]
Message-ID: <BCAAFC0A0683754C9A88D2C4E3F3A9C7F2F9D801@fmsmsx104.amr.corp.intel.com> (raw)
In-Reply-To: <20191114060655.5161-6-nathaniel.l.desimone@intel.com>

Reviewed-by: Sai Chaganty <rangasai.v.chaganty@intel.com>

Minor feedback - The comments surrounding the new APIs (Early PCH Init) is not matching with the API function name (EarlySiliconInit). It's good to keep them consistent.


-----Original Message-----
From: Desimone, Nathaniel L 
Sent: Wednesday, November 13, 2019 10:07 PM
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 V1 05/13] 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.inf
 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..47da5f608b
--- /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+#+# 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..122c02a3e5
--- /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 PCH 
+Init+**/+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..23e4a3d4a0
--- /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 PCH 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.23.0.windows.1


  parent reply	other threads:[~2019-11-18 19:14 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 [this message]
2019-11-14  6:06 ` [edk2-platforms] [PATCH V1 06/13] WhiskeylakeOpenBoardPkg: Add SiliconInitLib APIs to BoardInitLib Nate DeSimone
2019-11-14 15:16   ` 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=BCAAFC0A0683754C9A88D2C4E3F3A9C7F2F9D801@fmsmsx104.amr.corp.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