From nobody Mon Feb 9 08:58:12 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+51018+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51018+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1574326767; cv=none; d=zoho.com; s=zohoarc; b=motzc59TUUZjpTWYnlUjiYOhnDSxcPcEYNH8/ry4j3nLqXCVhd4HABgnDK0qaqCsamMXjqEnQdN1Oomj2QX5DeeB5uo0uYQZNsVFccdUVq/ma972XI4WQnSbMj8btMqH/X+z5+tOiOQyhprILygR0htJHNmlARd1tYl3hU2kc9A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574326767; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=3ZnXIX8/RHU9MLD7ZrfTXrClXhzvzyA3tkzBdNa2tk0=; b=Ja5z2l8TAKWzzmklOPvBQdQgWn3wW8UmQCvDH24n2dyNAETgr7k8gnH6gosex1dSQD3w2JMfhzpWysVxXIcRIkHEl15eadHiggH6ywiK3KWk91nXRetR569PbZx4re3k3A9WH9AZDHOs4CyGPvNkCcSAQadBP+4DoUcbZqusdl8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51018+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1574326767382449.7572961560887; Thu, 21 Nov 2019 00:59:27 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Thu, 21 Nov 2019 00:59:26 -0800 X-Received: from mga18.intel.com (mga18.intel.com []) by mx.groups.io with SMTP id smtpd.web10.21389.1574326764546050137 for ; Thu, 21 Nov 2019 00:59:25 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Nov 2019 00:59:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,224,1571727600"; d="scan'208";a="210033053" X-Received: from nldesimo-desk1.amr.corp.intel.com ([10.7.159.63]) by orsmga006.jf.intel.com with ESMTP; 21 Nov 2019 00:59:20 -0800 From: "Nate DeSimone" To: devel@edk2.groups.io Cc: Chasel Chiu , Michael Kubacki , Sai Chaganty Subject: [edk2-devel] [edk2-platforms] [PATCH V2 06/14] CoffeelakeSiliconPkg: Add SiliconInitLib Date: Thu, 21 Nov 2019 00:58:45 -0800 Message-Id: <20191121085853.2626-7-nathaniel.l.desimone@intel.com> In-Reply-To: <20191121085853.2626-1-nathaniel.l.desimone@intel.com> References: <20191121085853.2626-1-nathaniel.l.desimone@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nathaniel.l.desimone@intel.com X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1574326766; bh=YIRp3rzI3/sEh21VQCAwO9JBruLLpQ2oKiyHEyFbvjU=; h=Cc:Date:From:Reply-To:Subject:To; b=LUxAq7UX8W3+yi0exDEAlzhFN2zJ1TP+lqUXe27Id5FqgRhnshfAZd4MS3bquPi+zVq rx0HBjbv91JavcNaz3TksJSZnfkoDSaktAQ+3Y6en7TDTiI8Yiy2wYxkAxP11iCPQfcpY BtP087XPNF//MK2eOV5x6gNx+1Pz58cd2bU= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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 Cc: Michael Kubacki Cc: Sai Chaganty Signed-off-by: Nate DeSimone Reviewed-by: Chasel Chiu Reviewed-by: Michael Kubacki Reviewed-by: Sai Chaganty --- .../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/Sili= conInitLib.h create mode 100644 Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconIn= itLib/PeiSiliconInitLib.inf create mode 100644 Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconIn= itLib/SiliconInit.c create mode 100644 Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconIn= itLib/SiliconInitPreMem.c diff --git a/Silicon/Intel/CoffeelakeSiliconPkg/Include/Library/SiliconInit= Lib.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.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _SILICON_INIT_LIB_H_ +#define _SILICON_INIT_LIB_H_ + +#include + +VOID +EarlySiliconInit ( + VOID + ); + +VOID +SiliconInit ( + VOID + ); + +VOID +LateSiliconInit ( + VOID + ); + +#endif \ No newline at end of file diff --git a/Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconInitLib/P= eiSiliconInitLib.inf b/Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSilico= nInitLib/PeiSiliconInitLib.inf new file mode 100644 index 0000000000..1534a24dd2 --- /dev/null +++ b/Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconInitLib/PeiSilic= onInitLib.inf @@ -0,0 +1,46 @@ +### @file +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +### + +[Defines] + INF_VERSION =3D 0x00010017 + BASE_NAME =3D SiliconInitLib + FILE_GUID =3D 82F2ACF0-2EBE-48C8-AC58-9D0F8BC1E16E + VERSION_STRING =3D 1.0 + MODULE_TYPE =3D PEIM + LIBRARY_CLASS =3D SiliconInitLib|SEC PEIM +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D 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 ## CONSUMES diff --git a/Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconInitLib/S= iliconInit.c b/Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconInitLib= /SiliconInit.c new file mode 100644 index 0000000000..1c15e0e54e --- /dev/null +++ b/Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconInitLib/SiliconI= nit.c @@ -0,0 +1,19 @@ +/** @file + Silicon Init APIs for MinPlatform BoardInitLib implementations. + +Copyright (c) 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +/** + Late Silicon Initialization +**/ +VOID +LateSiliconInit ( + VOID + ) +{ +} diff --git a/Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconInitLib/S= iliconInitPreMem.c b/Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconI= nitLib/SiliconInitPreMem.c new file mode 100644 index 0000000000..ab98b6ccc5 --- /dev/null +++ b/Silicon/Intel/CoffeelakeSiliconPkg/Library/PeiSiliconInitLib/SiliconI= nitPreMem.c @@ -0,0 +1,109 @@ +/** @file + Silicon Init APIs for MinPlatform BoardInitLib implementations. + +Copyright (c) 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** + 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 =3D IoRead16 (PcdGet16 (PcdTcoBaseAddress) + R_TCO_IO_TCO1_CNT); + Data16 |=3D B_TCO_IO_TCO1_CNT_TMR_HLT; + IoWrite16 (PcdGet16 (PcdTcoBaseAddress) + R_TCO_IO_TCO1_CNT, Data16); + + /// + /// Read the Second TO status bit + /// + Data8 =3D IoRead8 (PcdGet16 (PcdTcoBaseAddress) + R_TCO_IO_TCO2_STS); + if ((Data8 & B_TCO_IO_TCO2_STS_SECOND_TO) =3D=3D B_TCO_IO_TCO2_STS_SECON= D_TO) { + TcoRebootHappened =3D 1; + DEBUG ((DEBUG_INFO, "PlatformInitPreMem - TCO Second TO status bit is = set. This might be a TCO reboot\n")); + } + else { + TcoRebootHappened =3D 0; + } + + /// + /// Create HOB + /// + Status =3D PeiServicesCreateHob (EFI_HOB_TYPE_GUID_EXTENSION, sizeof(TCO= _WDT_HOB), (VOID **)&TcoWdtHobPtr); + if (!EFI_ERROR (Status)) { + TcoWdtHobPtr->Header.Name =3D gTcoWdtHobGuid; + TcoWdtHobPtr->TcoRebootHappened =3D TcoRebootHappened; + } + + /// + /// Clear the Second TO status bit + /// + IoWrite8 (PcdGet16 (PcdTcoBaseAddress) + R_TCO_IO_TCO2_STS, B_TCO_IO_TCO= 2_STS_SECOND_TO); +} + +/** + Initialize the GPIO IO selection, GPIO USE selection, and GPIO signal in= version registers + +**/ +VOID +SiliconInit ( + VOID + ) +{ + UINT16 ABase; + + ABase =3D PmcGetAcpiBase (); + + /// + /// Clear all pending SMI. On S3 clear power button enable so it will no= t generate an SMI. + /// + IoWrite16 (ABase + R_ACPI_IO_PM1_EN, 0); + IoWrite32 (ABase + R_ACPI_IO_GPE0_EN_127_96, 0); +} --=20 2.24.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#51018): https://edk2.groups.io/g/devel/message/51018 Mute This Topic: https://groups.io/mt/61073538/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-