From nobody Mon Feb 9 15:27:23 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+50629+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+50629+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1573712557; cv=none; d=zoho.com; s=zohoarc; b=cLGA9wsNlt7uR2muxJGq0qae9viiM3UCzCDmswx3dMcD57TUNuXgeu3Zo99jmc8HXjEy3pzhoM+gFkGsxBIq/DiAVxCVMa65JlUUD5/UJmWEDTsmMxy1NGlphPU9TZ/E2DytJVQOrfDkKfDAdkjlquGDXmE4e9I0OD0cbgVD2zw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573712557; 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=lYYICK3Uxo/X1BY15rO1BGZ5TW0oLaGkCocX+BxbJmo=; b=ewTqG09KjNqZpYo3W0/GjdiJ5H8BWMukCfBbpn/2OPQ9MlxN29B0Zm3NeTOLtG+PaI35vzTgTkVgEro2Akxx1Bc0//SATlp5NYvw5JKkNGwlf3ENwnaiTjvjCDaliMPdJieMlMAaqQrbqunvTFwksHEu8OIcf++HZlbJXXwu1sU= 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+50629+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 1573712557043155.90652827037945; Wed, 13 Nov 2019 22:22:37 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id DwWIYY1788612xjWDC6YQ8lr; Wed, 13 Nov 2019 22:22:36 -0800 X-Received: from mga09.intel.com (mga09.intel.com []) by mx.groups.io with SMTP id smtpd.web11.411.1573712555062592504 for ; Wed, 13 Nov 2019 22:22:35 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Nov 2019 22:22:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,302,1569308400"; d="scan'208";a="216641611" X-Received: from nldesimo-desk1.amr.corp.intel.com ([10.7.159.63]) by orsmga002.jf.intel.com with ESMTP; 13 Nov 2019 22:22:34 -0800 From: "Nate DeSimone" To: devel@edk2.groups.io Cc: Chasel Chiu , Michael Kubacki , Sai Chaganty Subject: [edk2-devel] [edk2-platforms] [PATCH V1 05/13] CoffeelakeSiliconPkg: Add SiliconInitLib Date: Wed, 13 Nov 2019 22:06:47 -0800 Message-Id: <20191114060655.5161-6-nathaniel.l.desimone@intel.com> In-Reply-To: <20191114060655.5161-1-nathaniel.l.desimone@intel.com> References: <20191114060655.5161-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: deNI7nQxlu3MISyHvxMSWipex1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1573712556; bh=eGb2uRYHgyc5A/mInqFAsoxBevFZqx13wAo98J7/JOM=; h=Cc:Date:From:Reply-To:Subject:To; b=fj8B4FcTo4ndO1d4l0x2MI6KoLtDfkb8ffCAU6/sVjdr5h/WlyiHLJnLQ3QG96OSMuC 01GOESawkGj81y0nNIEdKj77B6O9zTbAPEznd1x5Cc8Vs+HvJDNiSgfd4QuB7xoxbByns VsobbFmBkEhKHFXXRMiGWjOkOLzBbXTKaBE= 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..47da5f608b --- /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 +# +# 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..122c02a3e5 --- /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 PCH Init +**/ +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..23e4a3d4a0 --- /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 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 =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.23.0.windows.1 -=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 (#50629): https://edk2.groups.io/g/devel/message/50629 Mute This Topic: https://groups.io/mt/57059542/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-