From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 69B78D801B3 for ; Mon, 8 Apr 2024 22:53:08 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=oZIXcoZ//Y+mOJjl/B29i7OOtOAs8Ah/IXD40NMqHtc=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20240206; t=1712616787; v=1; b=bBTe3JInsaQbbKPhfV/pNIh12lI/st18FD/TRGt2f9gFGDopYBaEJHwHXbSO4m6jXizElK70 a1SRJ7vH4gqyi7eTEZslV3YQJ22dom2c1/YxJv6rjI9LQximkYA4cphaYyBz73+SuIsqBkuK9sa rFgkmqY6DYxwlZbxcgVxWN0gZxvPWfhQVfcUEgjoKlWWmASIfX1yPRQqmQiL9fdRIn0kXcsFfVr Wj/CQaqRGLMeZ93N5GJcGR24VzpTWOlv/Uz/dIvx8TnAeDk971radjZ0wMd3mhjGHWyIqdLd1/c urghQTkrufDIXCggmQ8i1ySBPR+QevSTM6sRd67sAbrBQ== X-Received: by 127.0.0.2 with SMTP id aX0bYY7687511xpjmbEN5jHC; Mon, 08 Apr 2024 15:53:07 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) by mx.groups.io with SMTP id smtpd.web10.122599.1712616785997580866 for ; Mon, 08 Apr 2024 15:53:06 -0700 X-CSE-ConnectionGUID: B/TM38nLSi6nO8+VOF+tVg== X-CSE-MsgGUID: zQ4dcrzLSGOo4yjyp8GVJQ== X-IronPort-AV: E=McAfee;i="6600,9927,11038"; a="19347803" X-IronPort-AV: E=Sophos;i="6.07,187,1708416000"; d="scan'208";a="19347803" X-Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 15:53:05 -0700 X-CSE-ConnectionGUID: u7tWjBVNROKcKbo+W8zwnA== X-CSE-MsgGUID: Rjd5zWE8QbuK3Go+lBGJNg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,187,1708416000"; d="scan'208";a="19983883" X-Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmviesa010.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 08 Apr 2024 15:53:05 -0700 X-Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 8 Apr 2024 15:53:04 -0700 X-Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 8 Apr 2024 15:53:04 -0700 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.40) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 8 Apr 2024 15:53:04 -0700 X-Received: from MW4PR11MB5821.namprd11.prod.outlook.com (2603:10b6:303:184::5) by IA1PR11MB6099.namprd11.prod.outlook.com (2603:10b6:208:3d5::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.25; Mon, 8 Apr 2024 22:53:00 +0000 X-Received: from MW4PR11MB5821.namprd11.prod.outlook.com ([fe80::2769:a1e8:3236:e5a1]) by MW4PR11MB5821.namprd11.prod.outlook.com ([fe80::2769:a1e8:3236:e5a1%4]) with mapi id 15.20.7452.019; Mon, 8 Apr 2024 22:53:00 +0000 From: "Nate DeSimone" To: "Hsueh, DoraX" , "devel@edk2.groups.io" CC: "Chaganty, Rangasai V" , "Chuang, Rosen" , "Kasbekar, Saloni" , "Tang, Haoyu" Subject: Re: [edk2-devel] [PATCH] AlderlakeOpenBoardPkg: Change MinPlatform MinDsdt and Update SpiFlashCommonLib Thread-Topic: [PATCH] AlderlakeOpenBoardPkg: Change MinPlatform MinDsdt and Update SpiFlashCommonLib Thread-Index: AQHaf0ExuQ5dvYo6A0+IQ9CBWMMFurFfD/jQ Date: Mon, 8 Apr 2024 22:53:00 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW4PR11MB5821:EE_|IA1PR11MB6099:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: tYufowuxjdKVW5aOw1A7OilEYPQv/lqT+kv8y9CmxejhEhYyxndR/N+ZIunKmO8sbZR3HC9KMSkeFCiQpd9SfrblxkTonjOyHP0bgCuUtFlWZZKoBqeK97Q3XpMz+iklSKn8FQcjAr28aYz6BJSh4/SBTFfGYivfzvnyKQDNQgZ/dqzrGvMcDxVjwReddFE/nXQf+JDtSNW/YhTN7/LQ0ALF1L8UDrmzT3uiIQKiER00/UM0v67G0p3JtCA9WmSgXia0WpFcgYllGtPa5wujEGx3Ejmgf9HZhX3zaWugps3rS/Oe14UE5ulwryqVCb8PZnsWpLAsnKZNmeQmCT0mNNWnatAn6vGuuXGrq8xuHkJcCE7UghSfPS5XjYcz2C7vefNQnHayT43AdFovO+5idELcJdeAQUQ1u5blVMqSDGaAFuJF86jJHpu2WwIrsXiOKHCswHTu7dFFdNYf7FN0AS5yZ0itv2EjLIlVbCo5pfFDKZPRz/t9EuAPulWfX7INyKRR3jZYLlOzgXgsdqv/BTNd9OnJl55yt4dSGCDS+2jZDmLsCV31m5LhzuZF+1gu6R5XPGDoIgV+qy584MYV5AfcMt//Ar1EH26Gfdu4Pj8= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?N+gwEqAa/cnmB8887dQqcl4J/+jabv1fyKthGRNj0/sugfGi1LVAec/ga8eP?= =?us-ascii?Q?I+dVHxfbBOgKQZBWKy+E0kkhemOHb1SdDuyGFsUEJrMGH1UT5QQui+R2lkT6?= =?us-ascii?Q?WVBzx2Fo6x+KIHh+1UvHsOKC4Dd3pPvtvAyrxCuTUAolOZ1O9eNwR4CPXpp2?= =?us-ascii?Q?JGdNxtpSmyjAm71FOaf+gGiRjpiTMjq3KFWmE+bX9916Bcg5+P2ntOHKaQQT?= =?us-ascii?Q?T/WuV6Pth99hb+e9Vi2h/mFFO/PTKxEUQ7c2rChgIADcOdKGQ+MQJdGZ5W4v?= =?us-ascii?Q?AHJH05ylczynZQ7dbRmH8yqyd8N5X3QTbwdBzytFaeYzNzhFs88y/A40azzz?= =?us-ascii?Q?C1i9F7hgRIkYF5Tl0dOTmP/1RlAm9S8xBto0IKkMTgfAtHqDe2gV0oP7kAwH?= =?us-ascii?Q?BxUM6fTSxNgND/5ps0DC4rnnajSNSH4IRSgg+uiUkswCfQBAL2HzAq4Hm75g?= =?us-ascii?Q?ap6DVJDUaVn4xt7ZGV2xD+kI7bzQ+sZhoje6W+dDw9RPB/E3pQI/hYlLi8Yv?= =?us-ascii?Q?LEej4cL98ZTG4QBtCIdR7MErbdb1Wo8el4HowArKtr0CftL4W5IGwv/4YP5r?= =?us-ascii?Q?u1PZgVotiDbP1MMFcC6hyIEnjFNJ50tTsRqm1lMjlaA0qjXvngvfcfLB0Nm4?= =?us-ascii?Q?8awQhoEvja/lFBrWi1WsO7bnXicKv4NvJPyNQf7QGSrRRETzALM/0df/AGH9?= =?us-ascii?Q?uQ6sx1dRwuydbo6oYhMDv7FybmOOdBaYlR/grb8gkmk6iys4bhnT8J+SSkqh?= =?us-ascii?Q?EQa9fpwK5dRpR9QrVVSQXR6pioF7aZEfD3Vi5ui2spoisJojFWi5QEc0PBoj?= =?us-ascii?Q?w+gHbYqj03s8fNil1xQeGxV06hpvu+XfxOQiF47yBIAIM2zHFnih6H1NP7LL?= =?us-ascii?Q?oU/yFEU4x7v1mx+GSBXyuxPOcrtsBvRiAwlMmNuwAfaU2+z5fOTmBy3lF2yh?= =?us-ascii?Q?XoaZRDBUOeTK9sjmDd8Pu1ESZwJF/+Q5a0d0tt5gk1S3jYPUCH9IfKDVEHlX?= =?us-ascii?Q?2wLtbsnHXLP3RsVyvm73jT752UqavMXnKg6oeBnOTCJOEXc/m0weM0677AZC?= =?us-ascii?Q?rXB8XL+5c9sRU54R8LJGPEWkWj5/KtkLpyzQbDOgJDZdqO8d0UhXroByZqpF?= =?us-ascii?Q?eKYSA6TsueFB4QmSKv5kzDJ+EqMrNIE4q6HxJ3PUcH29aW6BbXrMcCgQd9uM?= =?us-ascii?Q?rxssuD/mCYH4p4ZLMn46bgrvvPGg0YhSHfAtIMPT7E4gWpg3aLaWwVgSnjHK?= =?us-ascii?Q?Ncel64tpvXR34qat6M9HJuoHpUg2F+IQjuMZdzFCHntmURyvsNL+merN9wUY?= =?us-ascii?Q?qRogO49npzB6yeXn1DQes7Nv8PzqqQmtJzH5DReNfrtcC68zKV1X1CHXUV94?= =?us-ascii?Q?AP21ggZ3Zf2G4ASyXpGyPGOti0gbHeIprCh4onDSE8VzNsjCd4LgD/wR2lDZ?= =?us-ascii?Q?JkHpTPEsX28Jgm58od7QGMu9wY/qP+57L+c/I+3g+lS6hoPAbOzXYxG5FbY8?= =?us-ascii?Q?9I0vCl7kwlmZJBPlqEOztwzEwONBjNG4orhwmqCW0YtRV6g5XsK4oynSg338?= =?us-ascii?Q?g/pn3ErD91XH+zJTvNE8rGTiAzhqDP7E0OyqsGDFSFAV+FGgbjEYVugHQY5a?= =?us-ascii?Q?0w=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB5821.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 00dd5f0a-ecc2-4ce0-33b9-08dc581ea441 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Apr 2024 22:53:00.7269 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: raDtOKHljf3pEFPu2/nfWIXlg7L2lynBOAhvXUkBSQwPo49JMYh0YRNX+zZPiiy+5zIzCGAI8RLNJg2rRG8WZIuDxZiR5oq/3ukHdNSueRo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR11MB6099 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Mon, 08 Apr 2024 15:53:06 -0700 Resent-From: nathaniel.l.desimone@intel.com Reply-To: devel@edk2.groups.io,nathaniel.l.desimone@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: yJqHf1piZVoI91miCZ3AINtix7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=bBTe3JIn; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none) Reviewed-by: Nate DeSimone > -----Original Message----- > From: Hsueh, DoraX > Sent: Monday, March 25, 2024 10:48 PM > To: devel@edk2.groups.io > Cc: Hsueh, DoraX ; Chaganty, Rangasai V > ; Chuang, Rosen ; > Kasbekar, Saloni ; Tang, Haoyu > ; Desimone, Nathaniel L > > Subject: [PATCH] AlderlakeOpenBoardPkg: Change MinPlatform MinDsdt and > Update SpiFlashCommonLib >=20 > From: DoraX Hsueh >=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D4662 >=20 > 1. Change MinPlatform MinDsdt to fix hang logo issue. > 2. Update SecFspWrapperPlatformSecLib for FSP use. > 3. Update SpiFlashCommonLib to fix boot assert issue. > 4. Create SmmLocked callback to fix assert >=20 > Cc: Sai Chaganty > Cc: Rosen Chuang > Cc: Saloni Kasbekar > Cc: Haoyu Tang > Cc: Nate DeSimone > Signed-off-by: DoraX Hsueh > --- > .../Acpi/MinDsdt/MinDsdt.asl | 68 --- > .../Acpi/MinDsdt/MinDsdt.c | 232 ----------- > .../Acpi/MinDsdt/MinDsdt.inf | 48 --- > .../AlderlakePRvp/OpenBoardPkg.dsc | 6 +- > .../AlderlakePRvp/OpenBoardPkg.fdf | 2 +- > .../AlderlakePRvp/OpenBoardPkgPcd.dsc | 8 + > .../FspWrapperPlatformSecLib.c | 186 +++++++++ > .../SecFspWrapperPlatformSecLib/FsptCoreUpd.h | 394 ++++++++++++++++++ > .../SecFspWrapperPlatformSecLib/Ia32/Fsp.h | 42 ++ > .../Ia32/PeiCoreEntry.nasm | 130 ++++++ > .../Ia32/SecEntry.nasm | 361 ++++++++++++++++ > .../Ia32/Stack.nasm | 72 ++++ > .../PlatformInit.c | 47 +++ > .../SecFspWrapperPlatformSecLib.inf | 106 +++++ > .../SecGetPerformance.c | 89 ++++ > .../SecPlatformInformation.c | 78 ++++ > .../SecRamInitData.c | 57 +++ > .../SecTempRamDone.c | 93 +++++ > .../Include/Library/SpiFlashCommon.h | 99 ----- > .../SmmSpiFlashCommonLib.inf | 49 --- > .../SmmSpiFlashCommonLib/SpiFlashCommon.c | 215 ---------- > .../SpiFlashCommonSmmLib.c | 60 --- > .../OpenBoardPlatformInitPostMem.c | 96 +---- > .../OpenBoardPlatformInitPostMem.inf | 20 - > .../DxeSaPolicyInit.c | 71 ++++ > .../DxeSiliconPolicyUpdateLib.inf | 2 + > .../PeiCpuPolicyUpdatePreMem.c | 3 - > .../PeiPolicyUpdateLib/PeiPolicyUpdateLib.inf | 3 +- > 28 files changed, 1742 insertions(+), 895 deletions(-) > delete mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/Acpi/MinDsdt/Min= Dsdt.asl > delete mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/Acpi/MinDsdt/Min= Dsdt.c > delete mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/Acpi/MinDsdt/Min= Dsdt.inf > create mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Libra= ry/SecFspWrapperPlatformSecLib/FspWrapperPlatformSecLib.c > create mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Libra= ry/SecFspWrapperPlatformSecLib/FsptCoreUpd.h > create mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Libra= ry/SecFspWrapperPlatformSecLib/Ia32/Fsp.h > create mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Libra= ry/SecFspWrapperPlatformSecLib/Ia32/PeiCoreEntry.nasm > create mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Libra= ry/SecFspWrapperPlatformSecLib/Ia32/SecEntry.nasm > create mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Libra= ry/SecFspWrapperPlatformSecLib/Ia32/Stack.nasm > create mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Libra= ry/SecFspWrapperPlatformSecLib/PlatformInit.c > create mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Libra= ry/SecFspWrapperPlatformSecLib/SecFspWrapperPlatformSecLib.inf > create mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Libra= ry/SecFspWrapperPlatformSecLib/SecGetPerformance.c > create mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Libra= ry/SecFspWrapperPlatformSecLib/SecPlatformInformation.c > create mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Libra= ry/SecFspWrapperPlatformSecLib/SecRamInitData.c > create mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Libra= ry/SecFspWrapperPlatformSecLib/SecTempRamDone.c > delete mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/Include/Library/= SpiFlashCommon.h > delete mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/Library/SmmSpiFl= ashCommonLib/SmmSpiFlashCommonLib.inf > delete mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/Library/SmmSpiFl= ashCommonLib/SpiFlashCommon.c > delete mode 100644 Platform/Intel/AlderlakeOpenBoardPkg/Library/SmmSpiFl= ashCommonLib/SpiFlashCommonSmmLib.c >=20 > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/Acpi/MinDsdt/MinDsdt.as= l b/Platform/Intel/AlderlakeOpenBoardPkg/Acpi/MinDsdt/MinDsdt.asl > deleted file mode 100644 > index be110145..00000000 > --- a/Platform/Intel/AlderlakeOpenBoardPkg/Acpi/MinDsdt/MinDsdt.asl > +++ /dev/null > @@ -1,68 +0,0 @@ > -/** @file > - ACPI minimum DSDT table > - > - Copyright (c) 2022, Intel Corporation. All rights reserved.
> - SPDX-License-Identifier: BSD-2-Clause-Patent > - > -**/ > - > -DefinitionBlock ( > - "DSDT.aml", > - "DSDT", > - 0x01, // DSDT revision. > - // A Revision field value greater than or equal to 2 signifies t= hat integers > - // declared within the Definition Block are to be evaluated as 6= 4-bit values > - "INTEL ", // OEM ID (6 byte string) > - "MIN ",// OEM table ID (8 byte string) > - 0x00 // OEM version of DSDT table (4 byte Integer) > -) > - > -// BEGIN OF ASL SCOPE > -{ > - Scope(\_SB) { > - //--------------------------------------------------------------------= ------- > - // Begin PCI tree object scope > - //--------------------------------------------------------------------= ------- > - Device(PCI0) { // PCI Bridge "Host Bridge" > - Name(_HID, EISAID("PNP0A08")) // Indicates PCI Express/PCI-X Mode2= host hierarchy > - Name(_CID, EISAID("PNP0A03")) // To support legacy OS that doesn't= understand the new HID > - Name(_SEG, 0) > - Method(^BN00, 0){ return(0x0000) } // Returns default Bus number = for Peer PCI busses. Name can be overriden with control method placed direc= tly under Device scope > - Method(_BBN, 0){ return(BN00()) } // Bus number, optional for the = Root PCI Bus > - Name(_UID, 0x0000) // Unique Bus ID, optional > - Name(BUF0,ResourceTemplate() > - { > - // > - // PCI Configuration Registers ( 0x0CF8 - 0x0CFF ) > - // > - Io(Decode16,0x0CF8,0x0CF8,1,0x08) > - // > - // PCI MMIO space > - // > - DWordMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,NonCach= eable, > - ReadWrite,0x00,0x00,0x00,0x00,0x00,,,PM01) > - }) > - Method(_CRS,0,Serialized) > - { > - // > - // Create pointers to Memory Sizing values. > - // > - CreateDwordField(BUF0, ^PM01._MIN,M1MN) > - CreateDwordField(BUF0, ^PM01._MAX,M1MX) > - CreateDwordField(BUF0, ^PM01._LEN,M1LN) > - > - // > - // Set Memory Size Values. TLUD represents bits 31:20 of phyical > - // TOM, so shift these bits into the correct position and fix up > - // the Memory Region available to PCI. > - // > - Subtract (FixedPcdGet32(PcdPciReservedMemLimit),FixedPcdGet32(Pc= dPciReservedMemBase),M1LN) > - Store (FixedPcdGet32(PcdPciReservedMemBase), M1MN) > - Subtract (FixedPcdGet32(PcdPciReservedMemLimit), 1, M1MX) > - > - Return(BUF0) > - } > - } > - } > -}// End of ASL File > - > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/Acpi/MinDsdt/MinDsdt.c = b/Platform/Intel/AlderlakeOpenBoardPkg/Acpi/MinDsdt/MinDsdt.c > deleted file mode 100644 > index 08709a43..00000000 > --- a/Platform/Intel/AlderlakeOpenBoardPkg/Acpi/MinDsdt/MinDsdt.c > +++ /dev/null > @@ -1,232 +0,0 @@ > -/** @file > - Min DSDT Driver > - > - Copyright (c) 2022, Intel Corporation. All rights reserved.
> - SPDX-License-Identifier: BSD-2-Clause-Patent > - > -**/ > - > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > - > -#include > -#include > - > -// > -// Function implementations > -// > - > -/** > - Locate the first instance of a protocol. If the protocol requested is= an > - FV protocol, then it will return the first FV that contains the ACPI t= able > - storage file. > - > - @param[in] Protocol The protocol to find. > - @param[in] FfsGuid The FFS that contains the ACPI table. > - @param[out] Instance Return pointer to the first instance of= the protocol. > - > - @retval EFI_SUCCESS The function completed successfully. > - @retval EFI_NOT_FOUND The protocol could not be located. > - @retval EFI_OUT_OF_RESOURCES There are not enough resources to find t= he protocol. > -**/ > -EFI_STATUS > -LocateSupportProtocol ( > - IN EFI_GUID *Protocol, > - IN EFI_GUID *FfsGuid, > - OUT VOID **Instance > - ) > -{ > - EFI_STATUS Status; > - EFI_HANDLE *HandleBuffer; > - UINTN NumberOfHandles; > - EFI_FV_FILETYPE FileType; > - UINT32 FvStatus; > - EFI_FV_FILE_ATTRIBUTES Attributes; > - UINTN Size; > - UINTN Index; > - > - // > - // Locate protocol. > - // > - Status =3D gBS->LocateHandleBuffer ( > - ByProtocol, > - Protocol, > - NULL, > - &NumberOfHandles, > - &HandleBuffer > - ); > - if (EFI_ERROR (Status)) { > - // > - // Defined errors at this time are not found and out of resources. > - // > - return Status; > - } > - > - // > - // Looking for FV with ACPI storage file > - // > - for (Index =3D 0; Index < NumberOfHandles; Index++) { > - > - // > - // Get the protocol on this handle > - // This should not fail because of LocateHandleBuffer > - // > - Status =3D gBS->HandleProtocol ( > - HandleBuffer[Index], > - Protocol, > - Instance > - ); > - ASSERT_EFI_ERROR (Status); > - > - // > - // See if it has the ACPI storage file > - // > - Size =3D 0; > - FvStatus =3D 0; > - Status =3D ((EFI_FIRMWARE_VOLUME2_PROTOCOL *) (*Instance))->ReadFile= ( > - *Instance, > - FfsGuid, > - NULL, > - &Size, > - &FileType, > - &Attribute= s, > - &FvStatus > - ); > - > - // > - // If we found it, then we are done > - // > - if (Status =3D=3D EFI_SUCCESS) { > - break; > - } > - } > - > - // > - // Our exit status is determined by the success of the previous operat= ions > - // If the protocol was found, Instance already points to it. > - // > - // > - // Free any allocated buffers > - // > - FreePool (HandleBuffer); > - > - return Status; > -} > - > -/** > - Publish ACPI table from FV. > - > - @param[in] FfsGuid The FFS that contains the ACPI table. > - > - @retval EFI_SUCCESS The function completed successfully. > -**/ > -EFI_STATUS > -PublishAcpiTablesFromFv ( > - IN EFI_GUID *FfsGuid > - ) > -{ > - EFI_STATUS Status; > - EFI_FIRMWARE_VOLUME2_PROTOCOL *FwVol; > - EFI_ACPI_COMMON_HEADER *CurrentTable; > - UINT32 FvStatus; > - UINTN Size; > - UINTN TableHandle; > - INTN Instance; > - EFI_ACPI_TABLE_PROTOCOL *AcpiTable; > - > - Instance =3D 0; > - TableHandle =3D 0; > - CurrentTable =3D NULL; > - FwVol =3D NULL; > - > - Status =3D gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOI= D **)&AcpiTable); > - ASSERT_EFI_ERROR (Status); > - > - // > - // Locate the firmware volume protocol > - // > - Status =3D LocateSupportProtocol ( > - &gEfiFirmwareVolume2ProtocolGuid, > - FfsGuid, > - (VOID **) &FwVol > - ); > - ASSERT_EFI_ERROR (Status); > - > - // > - // Read tables from the storage file. > - // > - > - while (Status =3D=3D EFI_SUCCESS) { > - Status =3D FwVol->ReadSection ( > - FwVol, > - FfsGuid, > - EFI_SECTION_RAW, > - Instance, > - (VOID **) &CurrentTable, > - &Size, > - &FvStatus > - ); > - > - if (!EFI_ERROR (Status)) { > - > - // > - // Add the table > - // > - TableHandle =3D 0; > - Status =3D AcpiTable->InstallAcpiTable ( > - AcpiTable, > - CurrentTable, > - CurrentTable->Length, > - &TableHandle > - ); > - ASSERT_EFI_ERROR (Status); > - > - // > - // Increment the instance > - // > - Instance++; > - CurrentTable =3D NULL; > - } > - } > - > - // > - // Finished > - // > - return EFI_SUCCESS; > -} > - > -/** > - ACPI Platform driver installation function. > - > - @param[in] ImageHandle Handle for this drivers loaded image protoc= ol. > - @param[in] SystemTable EFI system table. > - > - @retval EFI_SUCCESS The driver installed without error. > - @retval EFI_ABORTED The driver encountered an error and could n= ot complete installation of > - the ACPI tables. > - > -**/ > -EFI_STATUS > -EFIAPI > -InstallMinDsdt ( > - IN EFI_HANDLE ImageHandle, > - IN EFI_SYSTEM_TABLE *SystemTable > - ) > -{ > - EFI_STATUS Status; > - > - Status =3D PublishAcpiTablesFromFv (&gEfiCallerIdGuid); > - ASSERT_EFI_ERROR (Status); > - > - return EFI_SUCCESS; > -} > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/Acpi/MinDsdt/MinDsdt.in= f b/Platform/Intel/AlderlakeOpenBoardPkg/Acpi/MinDsdt/MinDsdt.inf > deleted file mode 100644 > index f2571407..00000000 > --- a/Platform/Intel/AlderlakeOpenBoardPkg/Acpi/MinDsdt/MinDsdt.inf > +++ /dev/null > @@ -1,48 +0,0 @@ > -### @file > -# Component information file for Minimal DSDT module > -# > -# Copyright (c) 2022, Intel Corporation. All rights reserved.
> -# SPDX-License-Identifier: BSD-2-Clause-Patent > -# > -# > -# @par Glossary: > -### > - > -[Defines] > - INF_VERSION =3D 0x00010005 > - BASE_NAME =3D MinDsdt > - FILE_GUID =3D 8EB04370-482C-4505-AA27-7EB226A5729= F > - MODULE_TYPE =3D DXE_DRIVER > - VERSION_STRING =3D 1.0 > - ENTRY_POINT =3D InstallMinDsdt > - > -[Sources.common] > - MinDsdt.c > - MinDsdt.asl > - > -[Packages] > - MdePkg/MdePkg.dec > - MinPlatformPkg/MinPlatformPkg.dec > - > -[LibraryClasses] > - UefiDriverEntryPoint > - BaseLib > - DebugLib > - PcdLib > - UefiBootServicesTableLib > - UefiRuntimeServicesTableLib > - BaseMemoryLib > - MemoryAllocationLib > - > -[Protocols] > - gEfiAcpiTableProtocolGuid ## CONSUMES > - gEfiFirmwareVolume2ProtocolGuid ## CONSUMES > - > -[Pcd] > - gMinPlatformPkgTokenSpaceGuid.PcdPciReservedMemBase > - gMinPlatformPkgTokenSpaceGuid.PcdPciReservedMemLimit > - > -[Depex] > - gEfiAcpiTableProtocolGuid AND > - gEfiFirmwareVolume2ProtocolGuid > - > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/OpenBoard= Pkg.dsc b/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/OpenBoardPkg.d= sc > index 4cdc9c01..59350f06 100644 > --- a/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/OpenBoardPkg.dsc > +++ b/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/OpenBoardPkg.dsc > @@ -101,7 +101,7 @@ > =20 > PostCodeMapLib|PostCodeDebugFeaturePkg/Library/PostCodeMapLib/PostCode= MapLib.inf > =20 > - PlatformSecLib|$(PLATFORM_PACKAGE)/FspWrapper/Library/SecFspWrapperPla= tformSecLib/SecFspWrapperPlatformSecLib.inf > + PlatformSecLib|$(PLATFORM_BOARD_PACKAGE)/FspWrapper/Library/SecFspWrap= perPlatformSecLib/SecFspWrapperPlatformSecLib.inf > FspWrapperPlatformLib|$(PLATFORM_PACKAGE)/FspWrapper/Library/PeiFspWra= pperPlatformLib/PeiFspWrapperPlatformLib.inf > FspWrapperHobProcessLib|$(PLATFORM_PACKAGE)/FspWrapper/Library/PeiFspW= rapperHobProcessLib/PeiFspWrapperHobProcessLib.inf > =20 > @@ -234,7 +234,7 @@ > [LibraryClasses.X64.DXE_SMM_DRIVER] > =20 > !if $(TARGET) =3D=3D DEBUG > - SpiFlashCommonLib|$(PLATFORM_BOARD_PACKAGE)/Library/SmmSpiFlashCommonL= ib/SmmSpiFlashCommonLib.inf > + SpiFlashCommonLib|IntelSiliconPkg/Library/SmmSpiFlashCommonLib/SmmSpiF= lashCommonLib.inf > TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/S= mmTestPointCheckLib.inf > TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLibNu= ll/TestPointCheckLibNull.inf > !endif > @@ -453,7 +453,7 @@ $(PLATFORM_SI_BIN_PACKAGE)/Microcode/MicrocodeUpdates= .inf > # > !if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly =3D=3D FALSE > $(PLATFORM_PACKAGE)/Acpi/AcpiTables/AcpiPlatform.inf > - $(PLATFORM_BOARD_PACKAGE)/Acpi/MinDsdt/MinDsdt.inf > + $(PLATFORM_PACKAGE)/Acpi/MinDsdt/MinDsdt.inf > $(PLATFORM_PACKAGE)/Acpi/AcpiSmm/AcpiSmm.inf { > > NULL|$(PROJECT)/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.i= nf > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/OpenBoard= Pkg.fdf b/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/OpenBoardPkg.f= df > index f1ce271b..27366fc4 100644 > --- a/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/OpenBoardPkg.fdf > +++ b/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/OpenBoardPkg.fdf > @@ -485,7 +485,7 @@ APRIORI DXE { > !if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly =3D=3D FALSE > INF UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf > INF $(PLATFORM_PACKAGE)/Acpi/AcpiTables/AcpiPlatform.inf > -INF RuleOverride =3D DRIVER_ACPITABLE $(PLATFORM_BOARD_PACKAGE)/Acpi/Mi= nDsdt/MinDsdt.inf > +INF RuleOverride =3D DRIVER_ACPITABLE $(PLATFORM_PACKAGE)/Acpi/MinDsdt/= MinDsdt.inf > INF $(PLATFORM_PACKAGE)/Acpi/AcpiSmm/AcpiSmm.inf > =20 > !include $(PLATFORM_PACKAGE)/Include/Fdf/CoreOsBootInclude.fdf > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/OpenBoard= PkgPcd.dsc b/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/OpenBoardPk= gPcd.dsc > index 3eb9a575..edcd33e6 100644 > --- a/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/OpenBoardPkgPcd.= dsc > +++ b/Platform/Intel/AlderlakeOpenBoardPkg/AlderlakePRvp/OpenBoardPkgPcd.= dsc > @@ -174,6 +174,13 @@ > gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07 > !endif > =20 > + # > + # INIT is now triggered before BIOS by ucode/hardware. In the OVMF > + # environment, QEMU lacks a simulation for the INIT process. > + # To address this, PcdFirstTimeWakeUpAPsBySipi set to FALSE to > + # broadcast INIT-SIPI-SIPI for the first time. > + # > + gUefiCpuPkgTokenSpaceGuid.PcdFirstTimeWakeUpAPsBySipi|FALSE > =20 > !if $(TARGET) =3D=3D DEBUG > !if gSiPkgTokenSpaceGuid.PcdSerialIoUartEnable =3D=3D TRUE > @@ -287,6 +294,7 @@ > =20 > =20 > [PcdsDynamicDefault] > + gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSupport|FALSE > gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|0x0 > gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|0x0 > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId|0x20202020204C= 4349 > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecF= spWrapperPlatformSecLib/FspWrapperPlatformSecLib.c b/Platform/Intel/Alderla= keOpenBoardPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/FspWrapperPla= tformSecLib.c > new file mode 100644 > index 00000000..d6796be5 > --- /dev/null > +++ b/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/FspWrapperPlatformSecLib.c > @@ -0,0 +1,186 @@ > +/** @file > + Provide FSP wrapper platform sec related function. > + > +Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.
> +SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > + > +/** > + This interface conveys state information out of the Security (SEC) pha= se into PEI. > + > + @param[in] PeiServices Pointer to the PEI Services T= able. > + @param[in,out] StructureSize Pointer to the variable descr= ibing size of the input buffer. > + @param[out] PlatformInformationRecord Pointer to the EFI_SEC_PLATFO= RM_INFORMATION_RECORD. > + > + @retval EFI_SUCCESS The data was successfully returned. > + @retval EFI_BUFFER_TOO_SMALL The buffer was too small. > + > +**/ > +EFI_STATUS > +EFIAPI > +SecPlatformInformation ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN OUT UINT64 *StructureSize, > + OUT EFI_SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationReco= rd > + ); > + > +/** > + This interface conveys performance information out of the Security (SE= C) phase into PEI. > + > + This service is published by the SEC phase. The SEC phase handoff has = an optional > + EFI_PEI_PPI_DESCRIPTOR list as its final argument when control is pass= ed from SEC into the > + PEI Foundation. As such, if the platform supports collecting performan= ce data in SEC, > + this information is encapsulated into the data structure abstracted by= this service. > + This information is collected for the boot-strap processor (BSP) on IA= -32. > + > + @param[in] PeiServices The pointer to the PEI Services Table. > + @param[in] This The pointer to this instance of the PEI_SEC_P= ERFORMANCE_PPI. > + @param[out] Performance The pointer to performance data collected in = SEC phase. > + > + @retval EFI_SUCCESS The data was successfully returned. > + > +**/ > +EFI_STATUS > +EFIAPI > +SecGetPerformance ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN PEI_SEC_PERFORMANCE_PPI *This, > + OUT FIRMWARE_SEC_PERFORMANCE *Performance > + ); > + > +PEI_SEC_PERFORMANCE_PPI mSecPerformancePpi =3D { > + SecGetPerformance > +}; > + > +EFI_PEI_CORE_FV_LOCATION_PPI mPeiCoreFvLocationPpi =3D { > + (VOID *) (UINTN) FixedPcdGet32 (PcdFspmBaseAddress) > +}; > + > +EFI_PEI_PPI_DESCRIPTOR mPeiCoreFvLocationPpiList[] =3D { > + { > + EFI_PEI_PPI_DESCRIPTOR_PPI, > + &gEfiPeiCoreFvLocationPpiGuid, > + &mPeiCoreFvLocationPpi > + } > +}; > + > +EFI_PEI_PPI_DESCRIPTOR mPeiSecPlatformPpi[] =3D { > + { > + EFI_PEI_PPI_DESCRIPTOR_PPI, > + &gTopOfTemporaryRamPpiGuid, > + NULL // To be patched later. > + }, > + { > + EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST, > + &gPeiSecPerformancePpiGuid, > + &mSecPerformancePpi > + }, > +}; > + > +#define LEGACY_8259_MASK_REGISTER_MASTER 0x21 > +#define LEGACY_8259_MASK_REGISTER_SLAVE 0xA1 > +#define LEGACY_8259_EDGE_LEVEL_TRIGGERED_REGISTER_MASTER 0x4D0 > +#define LEGACY_8259_EDGE_LEVEL_TRIGGERED_REGISTER_SLAVE 0x4D1 > + > +/** > + Write to mask and edge/level triggered registers of master and slave 8= 259 PICs. > + > + @param[in] Mask low byte for master PIC mask register, > + high byte for slave PIC mask register. > + @param[in] EdgeLevel low byte for master PIC edge/level triggered re= gister, > + high byte for slave PIC edge/level triggered re= gister. > + > +**/ > +VOID > +Interrupt8259WriteMask ( > + IN UINT16 Mask, > + IN UINT16 EdgeLevel > + ) > +{ > + IoWrite8 (LEGACY_8259_MASK_REGISTER_MASTER, (UINT8) Mask); > + IoWrite8 (LEGACY_8259_MASK_REGISTER_SLAVE, (UINT8) (Mask >> 8)); > + IoWrite8 (LEGACY_8259_EDGE_LEVEL_TRIGGERED_REGISTER_MASTER, (UINT8) Ed= geLevel); > + IoWrite8 (LEGACY_8259_EDGE_LEVEL_TRIGGERED_REGISTER_SLAVE, (UINT8) (Ed= geLevel >> 8)); > +} > + > +/** > + A developer supplied function to perform platform specific operations. > + > + It's a developer supplied function to perform any operations appropria= te to a > + given platform. It's invoked just before passing control to PEI core b= y SEC > + core. Platform developer may modify the SecCoreData passed to PEI Core= . > + It returns a platform specific PPI list that platform wishes to pass t= o PEI core. > + The Generic SEC core module will merge this list to join the final lis= t passed to > + PEI core. > + > + @param[in,out] SecCoreData The same parameter as passing to = PEI core. It > + could be overridden by this funct= ion. > + > + @return The platform specific PPI list to be passed to PEI core or > + NULL if there is no need of such platform specific PPI list. > + > +**/ > +EFI_PEI_PPI_DESCRIPTOR * > +EFIAPI > +SecPlatformMain ( > + IN OUT EFI_SEC_PEI_HAND_OFF *SecCoreData > + ) > +{ > + EFI_PEI_PPI_DESCRIPTOR *PpiList; > + UINT8 TopOfTemporaryRamPpiIndex; > + UINT8 *CopyDestinationPointer; > + > + DEBUG ((DEBUG_INFO, "FSP Wrapper BootFirmwareVolumeBase - 0x%x\n", Sec= CoreData->BootFirmwareVolumeBase)); > + DEBUG ((DEBUG_INFO, "FSP Wrapper BootFirmwareVolumeSize - 0x%x\n", Sec= CoreData->BootFirmwareVolumeSize)); > + DEBUG ((DEBUG_INFO, "FSP Wrapper TemporaryRamBase - 0x%x\n", Sec= CoreData->TemporaryRamBase)); > + DEBUG ((DEBUG_INFO, "FSP Wrapper TemporaryRamSize - 0x%x\n", Sec= CoreData->TemporaryRamSize)); > + DEBUG ((DEBUG_INFO, "FSP Wrapper PeiTemporaryRamBase - 0x%x\n", Sec= CoreData->PeiTemporaryRamBase)); > + DEBUG ((DEBUG_INFO, "FSP Wrapper PeiTemporaryRamSize - 0x%x\n", Sec= CoreData->PeiTemporaryRamSize)); > + DEBUG ((DEBUG_INFO, "FSP Wrapper StackBase - 0x%x\n", Sec= CoreData->StackBase)); > + DEBUG ((DEBUG_INFO, "FSP Wrapper StackSize - 0x%x\n", Sec= CoreData->StackSize)); > + > + InitializeApicTimer (0, (UINT32) -1, TRUE, 5); > + > + // > + // Set all 8259 interrupts to edge triggered and disabled > + // > + Interrupt8259WriteMask (0xFFFF, 0x0000); > + > + // > + // Use middle of Heap as temp buffer, it will be copied by caller. > + // Do not use Stack, because it will cause wrong calculation on stack = by PeiCore > + // > + PpiList =3D (VOID *)((UINTN) SecCoreData->PeiTemporaryRamBase + (UINTN= ) SecCoreData->PeiTemporaryRamSize/2); > + CopyDestinationPointer =3D (UINT8 *) PpiList; > + TopOfTemporaryRamPpiIndex =3D 0; > + if ((PcdGet8 (PcdFspModeSelection) =3D=3D 0) && PcdGetBool (PcdFspDisp= atchModeUseFspPeiMain)) { > + // > + // In Dispatch mode, wrapper should provide PeiCoreFvLocationPpi. > + // > + CopyMem (CopyDestinationPointer, mPeiCoreFvLocationPpiList, sizeof (= mPeiCoreFvLocationPpiList)); > + TopOfTemporaryRamPpiIndex =3D 1; > + CopyDestinationPointer +=3D sizeof (mPeiCoreFvLocationPpiList); > + } > + CopyMem (CopyDestinationPointer, mPeiSecPlatformPpi, sizeof (mPeiSecPl= atformPpi)); > + // > + // Patch TopOfTemporaryRamPpi > + // > + PpiList[TopOfTemporaryRamPpiIndex].Ppi =3D (VOID *)((UINTN) SecCoreDat= a->TemporaryRamBase + SecCoreData->TemporaryRamSize); > + > + return PpiList; > +} > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecF= spWrapperPlatformSecLib/FsptCoreUpd.h b/Platform/Intel/AlderlakeOpenBoardPk= g/FspWrapper/Library/SecFspWrapperPlatformSecLib/FsptCoreUpd.h > new file mode 100644 > index 00000000..f92ed50e > --- /dev/null > +++ b/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/FsptCoreUpd.h > @@ -0,0 +1,394 @@ > +/** @file > + > +Copyright (c) 2023, Intel Corporation. All rights reserved.
> +SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef __FSPT_CORE_UPD_H__ > +#define __FSPT_CORE_UPD_H__ > + > +#include > + > +#pragma pack(1) > + > +/** Fsp T Core UPD > +**/ > +typedef struct { > + > +/** Offset 0x0020 > +**/ > + UINT32 MicrocodeRegionBase; > + > +/** Offset 0x0024 > +**/ > + UINT32 MicrocodeRegionSize; > + > +/** Offset 0x0028 > +**/ > + UINT32 CodeRegionBase; > + > +/** Offset 0x002C > +**/ > + UINT32 CodeRegionSize; > + > +/** Offset 0x0030 > +**/ > + UINT8 Reserved[16]; > +} FSPT_CORE_UPD; > + > +/** Fsp T Configuration > +**/ > +typedef struct { > + > +/** Offset 0x0060 - PcdSerialIoUartDebugEnable > + Enable SerialIo Uart debug library with/without initializing SerialIo = Uart device in FSP. > + 0:Disable, 1:Enable and Initialize, 2:Enable without Initializing > +**/ > + UINT8 PcdSerialIoUartDebugEnable; > + > +/** Offset 0x0061 - PcdSerialIoUartNumber > + Select SerialIo Uart Controller for debug. > + 0:SerialIoUart0, 1:SerialIoUart1, 2:SerialIoUart2 > +**/ > + UINT8 PcdSerialIoUartNumber; > + > +/** Offset 0x0062 - PcdSerialIoUartMode - FSPT > + Select SerialIo Uart Controller mode > + 0:SerialIoUartDisabled, 1:SerialIoUartPci, 2:SerialIoUartHidden, 3:Ser= ialIoUartCom, > + 4:SerialIoUartSkipInit > +**/ > + UINT8 PcdSerialIoUartMode; > + > +/** Offset 0x0063 - PcdSerialIoUartPowerGating - FSPT > + Select SerialIo Uart Controller Powergating mode > + 0:Disabled, 1:Enabled, 2:Auto > +**/ > + UINT8 PcdSerialIoUartPowerGating; > + > +/** Offset 0x0064 - PcdSerialIoUartBaudRate - FSPT > + Set default BaudRate Supported from 0 - default to 6000000 > +**/ > + UINT32 PcdSerialIoUartBaudRate; > + > +/** Offset 0x0068 - Pci Express Base Address > + Base address to be programmed for Pci Express > +**/ > + UINT64 PcdPciExpressBaseAddress; > + > +/** Offset 0x0070 - Pci Express Region Length > + Region Length to be programmed for Pci Express > +**/ > + UINT32 PcdPciExpressRegionLength; > + > +/** Offset 0x0074 - PcdSerialIoUartParity - FSPT > + Set default Parity. > + 0: DefaultParity, 1: NoParity, 2: EvenParity, 3: OddParity > +**/ > + UINT8 PcdSerialIoUartParity; > + > +/** Offset 0x0075 - PcdSerialIoUartDataBits - FSPT > + Set default word length. 0: Default, 5,6,7,8 > +**/ > + UINT8 PcdSerialIoUartDataBits; > + > +/** Offset 0x0076 - PcdSerialIoUartStopBits - FSPT > + Set default stop bits. > + 0: DefaultStopBits, 1: OneStopBit, 2: OneFiveStopBits, 3: TwoStopBits > +**/ > + UINT8 PcdSerialIoUartStopBits; > + > +/** Offset 0x0077 - PcdSerialIoUartAutoFlow - FSPT > + Enables UART hardware flow control, CTS and RTS lines. > + 0: Disable, 1:Enable > +**/ > + UINT8 PcdSerialIoUartAutoFlow; > + > +/** Offset 0x0078 - PcdSerialIoUartRxPinMux - FSPT > + Select RX pin muxing for SerialIo UART used for debug > +**/ > + UINT32 PcdSerialIoUartRxPinMux; > + > +/** Offset 0x007C - PcdSerialIoUartTxPinMux - FSPT > + Select TX pin muxing for SerialIo UART used for debug > +**/ > + UINT32 PcdSerialIoUartTxPinMux; > + > +/** Offset 0x0080 - PcdSerialIoUartRtsPinMux - FSPT > + Select SerialIo Uart used for debug Rts pin muxing. Refer to GPIO_*_MU= XING_SERIALIO_UARTx_RTS* > + for possible values. > +**/ > + UINT32 PcdSerialIoUartRtsPinMux; > + > +/** Offset 0x0084 - PcdSerialIoUartCtsPinMux - FSPT > + Select SerialIo Uart used for debug Cts pin muxing. Refer to GPIO_*_MU= XING_SERIALIO_UARTx_CTS* > + for possible values. > +**/ > + UINT32 PcdSerialIoUartCtsPinMux; > + > +/** Offset 0x0088 - PcdSerialIoUartDebugMmioBase - FSPT > + Select SerialIo Uart default MMIO resource in SEC/PEI phase when PcdSe= rialIoUartMode > + =3D SerialIoUartPci. > +**/ > + UINT32 PcdSerialIoUartDebugMmioBase; > + > +/** Offset 0x008C - PcdSerialIoUartDebugPciCfgBase - FSPT > + Specify PciCfgBase address. Allows for SerialIO UART functionality out= side Bus 0 > +**/ > + UINT32 PcdSerialIoUartDebugPciCfgBase; > + > +/** Offset 0x0090 - PcdLpcUartDebugEnable > + Enable to initialize LPC Uart device in FSP. > + 0:Disable, 1:Enable > +**/ > + UINT8 PcdLpcUartDebugEnable; > + > +/** Offset 0x0091 - Debug Interfaces > + Debug Interfaces. BIT0-RAM, BIT1-UART, BIT3-USB3, BIT4-Serial IO, BIT5= -TraceHub, > + BIT2 - Not used. > +**/ > + UINT8 PcdDebugInterfaceFlags; > + > +/** Offset 0x0092 - PcdSerialDebugLevel > + Serial Debug Message Level. 0:Disable, 1:Error Only, 2:Error & Warning= s, 3:Load, > + Error, Warnings & Info, 4:Load, Error, Warnings, Info & Event, 5:Load,= Error, Warnings, > + Info & Verbose. > + 0:Disable, 1:Error Only, 2:Error and Warnings, 3:Load Error Warnings a= nd Info, 4:Load > + Error Warnings and Info, 5:Load Error Warnings Info and Verbose > +**/ > + UINT8 PcdSerialDebugLevel; > + > +/** Offset 0x0093 - ISA Serial Base selection > + Select ISA Serial Base address. Default is 0x3F8. > + 0:0x3F8, 1:0x2F8 > +**/ > + UINT8 PcdIsaSerialUartBase; > + > +/** Offset 0x0094 - PcdSerialIo2ndUartEnable > + Enable Additional SerialIo Uart device in FSP. > + 0:Disable, 1:Enable and Initialize, 2:Enable without Initializing > +**/ > + UINT8 PcdSerialIo2ndUartEnable; > + > +/** Offset 0x0095 - PcdSerialIo2ndUartNumber > + Select SerialIo Uart Controller Number > + 0:SerialIoUart0, 1:SerialIoUart1, 2:SerialIoUart2 > +**/ > + UINT8 PcdSerialIo2ndUartNumber; > + > +/** Offset 0x0096 - PcdSerialIo2ndUartMode - FSPT > + Select SerialIo Uart Controller mode > + 0:SerialIoUartDisabled, 1:SerialIoUartPci, 2:SerialIoUartHidden, 3:Ser= ialIoUartCom, > + 4:SerialIoUartSkipInit > +**/ > + UINT8 PcdSerialIo2ndUartMode; > + > +/** Offset 0x0097 > +**/ > + UINT8 Rsvd020[1]; > + > +/** Offset 0x0098 - PcdSerialIo2ndUartBaudRate - FSPT > + Set default BaudRate Supported from 0 - default to 6000000 > +**/ > + UINT32 PcdSerialIo2ndUartBaudRate; > + > +/** Offset 0x009C - PcdSerialIo2ndUartParity - FSPT > + Set default Parity. > + 0: DefaultParity, 1: NoParity, 2: EvenParity, 3: OddParity > +**/ > + UINT8 PcdSerialIo2ndUartParity; > + > +/** Offset 0x009D - PcdSerialIo2ndUartDataBits - FSPT > + Set default word length. 0: Default, 5,6,7,8 > +**/ > + UINT8 PcdSerialIo2ndUartDataBits; > + > +/** Offset 0x009E - PcdSerialIo2ndUartStopBits - FSPT > + Set default stop bits. > + 0: DefaultStopBits, 1: OneStopBit, 2: OneFiveStopBits, 3: TwoStopBits > +**/ > + UINT8 PcdSerialIo2ndUartStopBits; > + > +/** Offset 0x009F - PcdSerialIo2ndUartAutoFlow - FSPT > + Enables UART hardware flow control, CTS and RTS lines. > + 0: Disable, 1:Enable > +**/ > + UINT8 PcdSerialIo2ndUartAutoFlow; > + > +/** Offset 0x00A0 - PcdSerialIo2ndUartRxPinMux - FSPT > + Select RX pin muxing for SerialIo UART > +**/ > + UINT32 PcdSerialIo2ndUartRxPinMux; > + > +/** Offset 0x00A4 - PcdSerialIo2ndUartTxPinMux - FSPT > + Select TX pin muxing for SerialIo UART > +**/ > + UINT32 PcdSerialIo2ndUartTxPinMux; > + > +/** Offset 0x00A8 - PcdSerialIo2ndUartRtsPinMux - FSPT > + Select SerialIo Uart Rts pin muxing. Refer to GPIO_*_MUXING_SERIALIO_U= ARTx_RTS* > + for possible values. > +**/ > + UINT32 PcdSerialIo2ndUartRtsPinMux; > + > +/** Offset 0x00AC - PcdSerialIo2ndUartCtsPinMux - FSPT > + Select SerialIo Uart Cts pin muxing. Refer to GPIO_*_MUXING_SERIALIO_U= ARTx_CTS* > + for possible values. > +**/ > + UINT32 PcdSerialIo2ndUartCtsPinMux; > + > +/** Offset 0x00B0 - PcdSerialIo2ndUartMmioBase - FSPT > + Select SerialIo Uart default MMIO resource in SEC/PEI phase when PcdSe= rialIo2ndUartMode > + =3D SerialIoUartPci. > +**/ > + UINT32 PcdSerialIo2ndUartMmioBase; > + > +/** Offset 0x00B4 - PcdSerialIo2ndUartPciCfgBase - FSPT > + Specify PciCfgBase address. Allows for SerialIO UART functionality out= side Bus 0 > +**/ > + UINT32 PcdSerialIo2ndUartPciCfgBase; > + > +/** Offset 0x00B8 > +**/ > + UINT32 TopMemoryCacheSize; > + > +/** Offset 0x00BC - FspDebugHandler > + Optional pointer to the boot loader's implementation of FSP_DEB= UG_HANDLER. > +**/ > + UINT32 FspDebugHandler; > + > +/** Offset 0x00C0 - Serial Io SPI Chip Select Polarity > + Sets polarity for each chip Select. Available options: 0:SerialIoSpiCs= ActiveLow, > + 1:SerialIoSpiCsActiveHigh > +**/ > + UINT8 PcdSerialIoSpiCsPolarity[2]; > + > +/** Offset 0x00C2 - Serial Io SPI Chip Select Enable > + 0:Disabled, 1:Enabled. Enables GPIO for CS0 or CS1 if it is Enabled > +**/ > + UINT8 PcdSerialIoSpiCsEnable[2]; > + > +/** Offset 0x00C4 - Serial Io SPI Device Mode > + When mode is set to Pci, controller is initalized in early stage. Avai= lable modes: > + 0:SerialIoSpiDisabled, 1:SerialIoSpiPci. > +**/ > + UINT8 PcdSerialIoSpiMode; > + > +/** Offset 0x00C5 - Serial Io SPI Default Chip Select Output > + Sets Default CS as Output. Available options: 0:CS0, 1:CS1 > +**/ > + UINT8 PcdSerialIoSpiDefaultCsOutput; > + > +/** Offset 0x00C6 - Serial Io SPI Default Chip Select Mode HW/SW > + Sets Default CS Mode Hardware or Software. Available options: 0:HW, 1:= SW > +**/ > + UINT8 PcdSerialIoSpiCsMode; > + > +/** Offset 0x00C7 - Serial Io SPI Default Chip Select State Low/High > + Sets Default CS State Low or High. Available options: 0:Low, 1:High > +**/ > + UINT8 PcdSerialIoSpiCsState; > + > +/** Offset 0x00C8 - Serial Io SPI Device Number > + Select which Serial Io SPI controller is initalized in early stage. > +**/ > + UINT8 PcdSerialIoSpiNumber; > + > +/** Offset 0x00C9 > +**/ > + UINT8 Rsvd030[3]; > + > +/** Offset 0x00CC - Serial Io SPI Device MMIO Base > + Assigns MMIO for Serial Io SPI controller usage in early stage. > +**/ > + UINT32 PcdSerialIoSpiMmioBase; > + > +/** Offset 0x00D0 - Serial IO SPI CS Pin Muxing > + Select SerialIo SPI CS pin muxing. Refer to GPIO_*_MUXING_SERIALIO_SPI= x_CS* for > + possible values. > +**/ > + UINT32 PcdSerialIoSpiCsPinMux[2]; > + > +/** Offset 0x00D8 - Serial IO SPI CLK Pin Muxing > + Select SerialIo SPI CLK pin muxing. Refer to GPIO_*_MUXING_SERIALIO_SP= Ix_CLK* for > + possible values. > +**/ > + UINT32 PcdSerialIoSpiClkPinMux; > + > +/** Offset 0x00DC - Serial IO SPI MISO Pin Muxing > + Select SerialIo SPI MISO pin muxing. Refer to GPIO_*_MUXING_SERIALIO_S= PIx_MISO* > + for possible values. > +**/ > + UINT32 PcdSerialIoSpiMisoPinMux; > + > +/** Offset 0x00E0 - Serial IO SPI MOSI Pin Muxing > + Select SerialIo SPI MOSI pin muxing. Refer to GPIO_*_MUXING_SERIALIO_S= PIx_MOSI* > + for possible values. > +**/ > + UINT32 PcdSerialIoSpiMosiPinMux; > + > +/** Offset 0x00E4 - Serial Io I2C Device MMIO Base > + Assigns MMIO for Serial Io I2C controller usage in early stage. > +**/ > + UINT32 PcdSerialIoI2cMmioBase; > + > +/** Offset 0x00E8 - Serial Io I2C Sda Gpio Pin > + Select SerialIo I2C Rts pin. Refer to GPIO_*_MUXING_SERIALIO_I2C*_SDA*= for possible values. > +**/ > + UINT32 PcdSerialIoI2cSdaPin; > + > +/** Offset 0x00EC - Serial Io I2C Scl Gpio Pin > + Select SerialIo I2C Cts pin. Refer to GPIO_*_MUXING_SERIALIO_I2C*_SCL*= for possible values. > +**/ > + UINT32 PcdSerialIoI2cSclPin; > + > +/** Offset 0x00F0 - Serial Io I2C Gpio Pad termination > + 0x0: Hardware default, 0x1: None, 0x13: 1kOhm weak pull-up, 0x15: 5kOh= m weak pull-up, > + 0x19: 20kOhm weak pull-up - Enable/disable SerialIo I2C0,I2C1,... pads= termination > + respectively. One byte for each controller, byte0 for I2C0, byte1 for = I2C1, and so on. > +**/ > + UINT8 PcdSerialIoI2cPadsTerm; > + > +/** Offset 0x00F1 - Serial Io I2c Controller Number > + Select SerialIo I2C Controller number to be intilizaed during early bo= ot. Default is 0xFF > + 0:SerialIoI2c0, 1:SerialIoI2c1, 2:SerialIoI2c2, 0xFF:Disable > +**/ > + UINT8 PcdSerialIoI2cNumber; > + > +/** Offset 0x00F2 > +**/ > + UINT8 ReservedFsptUpd1[6]; > +} FSP_T_CONFIG; > + > +/** Fsp T UPD Configuration > +**/ > +typedef struct { > + > +/** Offset 0x0000 > +**/ > + FSP_UPD_HEADER FspUpdHeader; > + > +/** Offset 0x0020 > +**/ > + FSPT_ARCH_UPD FsptArchUpd; > + > +/** Offset 0x0040 > +**/ > + FSPT_CORE_UPD FsptCoreUpd; > + > +/** Offset 0x0060 > +**/ > + FSP_T_CONFIG FsptConfig; > + > +/** Offset 0x00F8 > +**/ > + UINT8 Rsvd3[6]; > + > +/** Offset 0x00FE > +**/ > + UINT16 UpdTerminator; > +} FSPT_UPD; > + > +#pragma pack() > + > +#endif > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecF= spWrapperPlatformSecLib/Ia32/Fsp.h b/Platform/Intel/AlderlakeOpenBoardPkg/F= spWrapper/Library/SecFspWrapperPlatformSecLib/Ia32/Fsp.h > new file mode 100644 > index 00000000..b8b5af6a > --- /dev/null > +++ b/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/Ia32/Fsp.h > @@ -0,0 +1,42 @@ > +/** @file > + Fsp related definitions > + > +Copyright (c) 2023, Intel Corporation. All rights reserved.
> +SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef __FSP_H__ > +#define __FSP_H__ > + > +// > +// Fv Header > +// > +#define FVH_SIGINATURE_OFFSET 0x28 > +#define FVH_SIGINATURE_VALID_VALUE 0x4856465F // valid signature:_FV= H > +#define FVH_HEADER_LENGTH_OFFSET 0x30 > +#define FVH_EXTHEADER_OFFSET_OFFSET 0x34 > +#define FVH_EXTHEADER_SIZE_OFFSET 0x10 > + > +// > +// Ffs Header > +// > +#define FSP_HEADER_GUID_DWORD1 0x912740BE > +#define FSP_HEADER_GUID_DWORD2 0x47342284 > +#define FSP_HEADER_GUID_DWORD3 0xB08471B9 > +#define FSP_HEADER_GUID_DWORD4 0x0C3F3527 > +#define FFS_HEADER_SIZE_VALUE 0x18 > + > +// > +// Section Header > +// > +#define SECTION_HEADER_TYPE_OFFSET 0x03 > +#define RAW_SECTION_HEADER_SIZE_VALUE 0x04 > + > +// > +// Fsp Header > +// > +#define FSP_HEADER_IMAGEBASE_OFFSET 0x1C > +#define FSP_HEADER_TEMPRAMINIT_OFFSET 0x30 > + > +#endif > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecF= spWrapperPlatformSecLib/Ia32/PeiCoreEntry.nasm b/Platform/Intel/AlderlakeOp= enBoardPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/Ia32/PeiCoreEntry= .nasm > new file mode 100644 > index 00000000..1b6f0e2d > --- /dev/null > +++ b/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/Ia32/PeiCoreEntry.nasm > @@ -0,0 +1,130 @@ > +;-----------------------------------------------------------------------= ------- > +; > +; Copyright (c) 2023, Intel Corporation. All rights reserved.
> +; SPDX-License-Identifier: BSD-2-Clause-Patent > +; > +; Module Name: > +; > +; PeiCoreEntry.nasm > +; > +; Abstract: > +; > +; Find and call SecStartup > +; > +;-----------------------------------------------------------------------= ------- > + > +SECTION .text > + > +extern ASM_PFX(SecStartup) > +extern ASM_PFX(PlatformInit) > + > +global ASM_PFX(CallPeiCoreEntryPoint) > +ASM_PFX(CallPeiCoreEntryPoint): > + ; > + ; Obtain the hob list pointer > + ; > + mov eax, [esp+4] > + ; > + ; Obtain the stack information > + ; ECX: start of range > + ; EDX: end of range > + ; > + mov ecx, [esp+8] > + mov edx, [esp+0xC] > + > + ; > + ; Platform init > + ; > + pushad > + push edx > + push ecx > + push eax > + call ASM_PFX(PlatformInit) > + pop eax > + pop eax > + pop eax > + popad > + > + ; > + ; Set stack top pointer > + ; > + mov esp, edx > + > + ; > + ; Push the hob list pointer > + ; > + push eax > + > + ; > + ; Save the value > + ; ECX: start of range > + ; EDX: end of range > + ; > + mov ebp, esp > + push ecx > + push edx > + > + ; > + ; Push processor count to stack first, then BIST status (AP then BSP) > + ; > + mov eax, 1 > + cpuid > + shr ebx, 16 > + and ebx, 0xFF > + cmp bl, 1 > + jae PushProcessorCount > + > + ; > + ; Some processors report 0 logical processors. Effectively 0 =3D 1. > + ; So we fix up the processor count > + ; > + inc ebx > + > +PushProcessorCount: > + push ebx > + > + ; > + ; We need to implement a long-term solution for BIST capture. For now= , we just copy BSP BIST > + ; for all processor threads > + ; > + xor ecx, ecx > + mov cl, bl > +PushBist: > + movd eax, mm0 > + push eax > + loop PushBist > + > + ; Save Time-Stamp Counter > + movd eax, mm5 > + push eax > + > + movd eax, mm6 > + push eax > + > + ; > + ; Pass entry point of the PEI core > + ; > + mov edi, 0xFFFFFFE0 > + push DWORD [edi] > + > + ; > + ; Pass BFV into the PEI Core > + ; > + mov edi, 0xFFFFFFFC > + push DWORD [edi] > + > + ; > + ; Pass stack size into the PEI Core > + ; > + mov ecx, [ebp - 4] > + mov edx, [ebp - 8] > + push ecx ; RamBase > + > + sub edx, ecx > + push edx ; RamSize > + > + ; > + ; Pass Control into the PEI Core > + ; > + call ASM_PFX(SecStartup) > + > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecF= spWrapperPlatformSecLib/Ia32/SecEntry.nasm b/Platform/Intel/AlderlakeOpenBo= ardPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/Ia32/SecEntry.nasm > new file mode 100644 > index 00000000..c4533da1 > --- /dev/null > +++ b/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/Ia32/SecEntry.nasm > @@ -0,0 +1,361 @@ > +;-----------------------------------------------------------------------= ------- > +; > +; Copyright (c) 2023, Intel Corporation. All rights reserved.
> +; SPDX-License-Identifier: BSD-2-Clause-Patent > +; Module Name: > +; > +; SecEntry.nasm > +; > +; Abstract: > +; > +; This is the code that goes from real-mode to protected mode. > +; It consumes the reset vector, calls TempRamInit API from FSP binary. > +; > +;-----------------------------------------------------------------------= ------- > + > +#include "Fsp.h" > + > +SECTION .text > + > +extern ASM_PFX(CallPeiCoreEntryPoint) > +extern ASM_PFX(FsptUpdDataPtr) > +extern ASM_PFX(BoardBeforeTempRamInit) > +; Pcds > +extern ASM_PFX(PcdGet32 (PcdFspTemporaryRamSize)) > +extern ASM_PFX(PcdGet32 (PcdFsptBaseAddress)) > + > +;-----------------------------------------------------------------------= ----- > +; > +; Procedure: _ModuleEntryPoint > +; > +; Input: None > +; > +; Output: None > +; > +; Destroys: Assume all registers > +; > +; Description: > +; > +; Transition to non-paged flat-model protected mode from a > +; hard-coded GDT that provides exactly two descriptors. > +; This is a bare bones transition to protected mode only > +; used for a while in PEI and possibly DXE. > +; > +; After enabling protected mode, a far jump is executed to > +; transfer to PEI using the newly loaded GDT. > +; > +; Return: None > +; > +; MMX Usage: > +; MM0 =3D BIST State > +; MM5 =3D Save time-stamp counter value high32bit > +; MM6 =3D Save time-stamp counter value low32bit. > +; > +;-----------------------------------------------------------------------= ----- > + > +BITS 16 > +align 4 > +global ASM_PFX(_ModuleEntryPoint) > +ASM_PFX(_ModuleEntryPoint): > + fninit ; clear any pending Floating poi= nt exceptions > + ; > + ; Store the BIST value in mm0 > + ; > + movd mm0, eax > + cli > + > + ; > + ; Check INIT# is asserted by port 0xCF9 > + ; > + mov dx, 0CF9h > + in al, dx > + cmp al, 04h > + jnz NotWarmStart > + > + > + ; > + ; @note Issue warm reset, since if CPU only reset is issued not all MS= Rs are restored to their defaults > + ; > + mov dx, 0CF9h > + mov al, 06h > + out dx, al > + > +NotWarmStart: > + ; > + ; Save time-stamp counter value > + ; rdtsc load 64bit time-stamp counter to EDX:EAX > + ; > + rdtsc > + movd mm5, edx > + movd mm6, eax > + > + ; > + ; Load the GDT table in GdtDesc > + ; > + mov esi, GdtDesc > + DB 66h > + lgdt [cs:si] > + > + ; > + ; Transition to 16 bit protected mode > + ; > + mov eax, cr0 ; Get control register 0 > + or eax, 00000003h ; Set PE bit (bit #0) & MP bit (bit= #1) > + mov cr0, eax ; Activate protected mode > + > + mov eax, cr4 ; Get control register 4 > + or eax, 00000600h ; Set OSFXSR bit (bit #9) & OSXMMEX= CPT bit (bit #10) > + mov cr4, eax > + > + ; > + ; Now we're in 16 bit protected mode > + ; Set up the selectors for 32 bit protected mode entry > + ; > + mov ax, SYS_DATA_SEL > + mov ds, ax > + mov es, ax > + mov fs, ax > + mov gs, ax > + mov ss, ax > + > + ; > + ; Transition to Flat 32 bit protected mode > + ; The jump to a far pointer causes the transition to 32 bit mode > + ; > + mov esi, ProtectedModeEntryLinearAddress > + jmp dword far [cs:si] > + > +;-----------------------------------------------------------------------= ----- > +; > +; Procedure: ProtectedModeEntryPoint > +; > +; Input: None > +; > +; Output: None > +; > +; Destroys: Assume all registers > +; > +; Description: > +; > +; This function handles: > +; Call two basic APIs from FSP binary > +; Initializes stack with some early data (BIST, PEI entry, etc) > +; > +; Return: None > +; > +;-----------------------------------------------------------------------= ----- > + > +BITS 32 > +align 4 > +ProtectedModeEntryPoint: > + ; > + ; Early board hooks > + ; > + mov esp, BoardBeforeTempRamInitRet > + jmp ASM_PFX(BoardBeforeTempRamInit) > + > +BoardBeforeTempRamInitRet: > + > + ; Find the fsp info header > + mov edi, [ASM_PFX(PcdGet32 (PcdFsptBaseAddress))] > + > + mov eax, dword [edi + FVH_SIGINATURE_OFFSET] > + cmp eax, FVH_SIGINATURE_VALID_VALUE > + jnz FspHeaderNotFound > + > + xor eax, eax > + mov ax, word [edi + FVH_EXTHEADER_OFFSET_OFFSET] > + cmp ax, 0 > + jnz FspFvExtHeaderExist > + > + xor eax, eax > + mov ax, word [edi + FVH_HEADER_LENGTH_OFFSET] ; Bypass Fv Header > + add edi, eax > + jmp FspCheckFfsHeader > + > +FspFvExtHeaderExist: > + add edi, eax > + mov eax, dword [edi + FVH_EXTHEADER_SIZE_OFFSET] ; Bypass Ext Fv Hea= der > + add edi, eax > + > + ; Round up to 8 byte alignment > + mov eax, edi > + and al, 07h > + jz FspCheckFfsHeader > + > + and edi, 0FFFFFFF8h > + add edi, 08h > + > +FspCheckFfsHeader: > + ; Check the ffs guid > + mov eax, dword [edi] > + cmp eax, FSP_HEADER_GUID_DWORD1 > + jnz FspHeaderNotFound > + > + mov eax, dword [edi + 4] > + cmp eax, FSP_HEADER_GUID_DWORD2 > + jnz FspHeaderNotFound > + > + mov eax, dword [edi + 8] > + cmp eax, FSP_HEADER_GUID_DWORD3 > + jnz FspHeaderNotFound > + > + mov eax, dword [edi + 0Ch] > + cmp eax, FSP_HEADER_GUID_DWORD4 > + jnz FspHeaderNotFound > + > + add edi, FFS_HEADER_SIZE_VALUE ; Bypass the ffs header > + > + ; Check the section type as raw section > + mov al, byte [edi + SECTION_HEADER_TYPE_OFFSET] > + cmp al, 019h > + jnz FspHeaderNotFound > + > + add edi, RAW_SECTION_HEADER_SIZE_VALUE ; Bypass the section header > + jmp FspHeaderFound > + > +FspHeaderNotFound: > + jmp $ > + > +FspHeaderFound: > + ; Get the fsp TempRamInit Api address > + mov eax, dword [edi + FSP_HEADER_IMAGEBASE_OFFSET] > + add eax, dword [edi + FSP_HEADER_TEMPRAMINIT_OFFSET] > + > + ; Setup the hardcode stack > + mov esp, TempRamInitStack > + > + ; Call the fsp TempRamInit Api > + jmp eax > + > +TempRamInitDone: > + cmp eax, 8000000Eh ;Check if EFI_NOT_FOUND returned. Error code f= or Microcode Update not found. > + je CallSecFspInit ;If microcode not found, don't hang, but conti= nue. > + > + cmp eax, 0 ;Check if EFI_SUCCESS retuned. > + jnz FspApiFailed > + > + ; ECX: start of range > + ; EDX: end of range > +CallSecFspInit: > + sub edx, [ASM_PFX(PcdGet32 (PcdFspTemporaryRamSize))] ; TemporaryR= am for FSP > + xor eax, eax > + mov esp, edx > + > + ; Align the stack at DWORD > + add esp, 3 > + and esp, 0FFFFFFFCh > + > + push edx > + push ecx > + push eax ; zero - no hob list yet > + call ASM_PFX(CallPeiCoreEntryPoint) > + > +FspApiFailed: > + jmp $ > + > +align 10h > +TempRamInitStack: > + DD TempRamInitDone > + DD ASM_PFX(FsptUpdDataPtr); TempRamInitParams > + > +; > +; ROM-based Global-Descriptor Table for the Tiano PEI Phase > +; > +align 16 > +global ASM_PFX(BootGdtTable) > + > +; > +; GDT[0]: 0x00: Null entry, never used. > +; > +NULL_SEL EQU $ - GDT_BASE ; Selector [0] > +GDT_BASE: > +ASM_PFX(BootGdtTable): > + DD 0 > + DD 0 > +; > +; Linear data segment descriptor > +; > +LINEAR_SEL EQU $ - GDT_BASE ; Selector [0x8] > + DW 0FFFFh ; limit 0xFFFFF > + DW 0 ; base 0 > + DB 0 > + DB 092h ; present, ring 0, data, expand-= up, writable > + DB 0CFh ; page-granular, 32-bit > + DB 0 > +; > +; Linear code segment descriptor > +; > +LINEAR_CODE_SEL EQU $ - GDT_BASE ; Selector [0x10] > + DW 0FFFFh ; limit 0xFFFFF > + DW 0 ; base 0 > + DB 0 > + DB 09Bh ; present, ring 0, data, expand-= up, not-writable > + DB 0CFh ; page-granular, 32-bit > + DB 0 > +; > +; System data segment descriptor > +; > +SYS_DATA_SEL EQU $ - GDT_BASE ; Selector [0x18] > + DW 0FFFFh ; limit 0xFFFFF > + DW 0 ; base 0 > + DB 0 > + DB 093h ; present, ring 0, data, expand-= up, not-writable > + DB 0CFh ; page-granular, 32-bit > + DB 0 > + > +; > +; System code segment descriptor > +; > +SYS_CODE_SEL EQU $ - GDT_BASE ; Selector [0x20] > + DW 0FFFFh ; limit 0xFFFFF > + DW 0 ; base 0 > + DB 0 > + DB 09Ah ; present, ring 0, data, expand-= up, writable > + DB 0CFh ; page-granular, 32-bit > + DB 0 > +; > +; Spare segment descriptor > +; > +SYS16_CODE_SEL EQU $ - GDT_BASE ; Selector [0x28] > + DW 0FFFFh ; limit 0xFFFFF > + DW 0 ; base 0 > + DB 0Eh ; Changed from F000 to E000. > + DB 09Bh ; present, ring 0, code, expand-= up, writable > + DB 00h ; byte-granular, 16-bit > + DB 0 > +; > +; Spare segment descriptor > +; > +SYS16_DATA_SEL EQU $ - GDT_BASE ; Selector [0x30] > + DW 0FFFFh ; limit 0xFFFF > + DW 0 ; base 0 > + DB 0 > + DB 093h ; present, ring 0, data, expand-= up, not-writable > + DB 00h ; byte-granular, 16-bit > + DB 0 > + > +; > +; Spare segment descriptor > +; > +SPARE5_SEL EQU $ - GDT_BASE ; Selector [0x38] > + DW 0 ; limit 0 > + DW 0 ; base 0 > + DB 0 > + DB 0 ; present, ring 0, data, expand-= up, writable > + DB 0 ; page-granular, 32-bit > + DB 0 > +GDT_SIZE EQU $ - GDT_BASE ; Size, in bytes > + > +; > +; GDT Descriptor > +; > +GdtDesc: ; GDT descriptor > + DW GDT_SIZE - 1 ; GDT limit > + DD GDT_BASE ; GDT base address > + > + > +ProtectedModeEntryLinearAddress: > +ProtectedModeEntryLinear: > + DD ProtectedModeEntryPoint ; Offset of our 32 bit code > + DW LINEAR_CODE_SEL > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecF= spWrapperPlatformSecLib/Ia32/Stack.nasm b/Platform/Intel/AlderlakeOpenBoard= Pkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/Ia32/Stack.nasm > new file mode 100644 > index 00000000..d893b692 > --- /dev/null > +++ b/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/Ia32/Stack.nasm > @@ -0,0 +1,72 @@ > +;-----------------------------------------------------------------------= ------- > +; > +; Copyright (c) 2023, Intel Corporation. All rights reserved.
> +; SPDX-License-Identifier: BSD-2-Clause-Patent > +; Abstract: > +; > +; Switch the stack from temporary memory to permanent memory. > +; > +;-----------------------------------------------------------------------= ------- > + > + SECTION .text > + > +;-----------------------------------------------------------------------= ------- > +; VOID > +; EFIAPI > +; SecSwitchStack ( > +; UINT32 TemporaryMemoryBase, > +; UINT32 PermanentMemoryBase > +; ); > +;-----------------------------------------------------------------------= ------- > +global ASM_PFX(SecSwitchStack) > +ASM_PFX(SecSwitchStack): > + ; > + ; Save three register: eax, ebx, ecx > + ; > + push eax > + push ebx > + push ecx > + push edx > + > + ; > + ; !!CAUTION!! this function address's is pushed into stack after > + ; migration of whole temporary memory, so need save it to permanent > + ; memory at first! > + ; > + > + mov ebx, [esp + 20] ; Save the first parameter > + mov ecx, [esp + 24] ; Save the second parameter > + > + ; > + ; Save this function's return address into permanent memory at first= . > + ; Then, Fixup the esp point to permanent memory > + ; > + mov eax, esp > + sub eax, ebx > + add eax, ecx > + mov edx, dword [esp] ; copy pushed register's value to per= manent memory > + mov dword [eax], edx > + mov edx, dword [esp + 4] > + mov dword [eax + 4], edx > + mov edx, dword [esp + 8] > + mov dword [eax + 8], edx > + mov edx, dword [esp + 12] > + mov dword [eax + 12], edx > + mov edx, dword [esp + 16] ; Update this function's return addre= ss into permanent memory > + mov dword [eax + 16], edx > + mov esp, eax ; From now, esp is pointed to per= manent memory > + > + ; > + ; Fixup the ebp point to permanent memory > + ; > + mov eax, ebp > + sub eax, ebx > + add eax, ecx > + mov ebp, eax ; From now, ebp is pointed to permanen= t memory > + > + pop edx > + pop ecx > + pop ebx > + pop eax > + ret > + > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecF= spWrapperPlatformSecLib/PlatformInit.c b/Platform/Intel/AlderlakeOpenBoardP= kg/FspWrapper/Library/SecFspWrapperPlatformSecLib/PlatformInit.c > new file mode 100644 > index 00000000..f7ec4f9e > --- /dev/null > +++ b/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/PlatformInit.c > @@ -0,0 +1,47 @@ > +/** @file > + Provide platform init function. > + > +Copyright (c) 2023, Intel Corporation. All rights reserved.
> +SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > + > +#include > +#include > +#include > +#include > +#include > + > +/** > + Platform initialization. > + > + @param[in] FspHobList HobList produced by FSP. > + @param[in] StartOfRange Start of temporary RAM. > + @param[in] EndOfRange End of temporary RAM. > +**/ > +VOID > +EFIAPI > +PlatformInit ( > + IN VOID *FspHobList, > + IN VOID *StartOfRange, > + IN VOID *EndOfRange > + ) > +{ > + // > + // Platform initialization > + // Enable Serial port here > + // > + if (PcdGetBool(PcdSecSerialPortDebugEnable)) { > + SerialPortInitialize (); > + } > + > + DEBUG ((DEBUG_INFO, "PrintPeiCoreEntryPointParam in PlatformInit\n")); > + DEBUG ((DEBUG_INFO, "FspHobList - 0x%x\n", FspHobList)); > + DEBUG ((DEBUG_INFO, "StartOfRange - 0x%x\n", StartOfRange)); > + DEBUG ((DEBUG_INFO, "EndOfRange - 0x%x\n", EndOfRange)); > + > + BoardAfterTempRamInit (); > + > + TestPointTempMemoryFunction (StartOfRange, EndOfRange); > +} > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecF= spWrapperPlatformSecLib/SecFspWrapperPlatformSecLib.inf b/Platform/Intel/Al= derlakeOpenBoardPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecFspWr= apperPlatformSecLib.inf > new file mode 100644 > index 00000000..71c19d1c > --- /dev/null > +++ b/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/SecFspWrapperPlatformSecLib.inf > @@ -0,0 +1,106 @@ > +## @file > +# Provide FSP wrapper platform sec related function. > +# > +# Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved. > +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +# > +## > + > +########################################################################= ######## > +# > +# Defines Section - statements that will be processed to create a Makefi= le. > +# > +########################################################################= ######## > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D SecFspWrapperPlatformSecLib > + FILE_GUID =3D 5C3B04E1-60BC-4CE7-AD6B-60E395EF005= 1 > + MODULE_TYPE =3D SEC > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D PlatformSecLib > + > + > +# > +# The following information is for reference only and not required by th= e build tools. > +# > +# VALID_ARCHITECTURES =3D IA32 X64 > +# > + > +########################################################################= ######## > +# > +# Sources Section - list of files that are required for the build to suc= ceed. > +# > +########################################################################= ######## > + > +[Sources] > + FspWrapperPlatformSecLib.c > + SecRamInitData.c > + SecPlatformInformation.c > + SecGetPerformance.c > + SecTempRamDone.c > + PlatformInit.c > + FsptCoreUpd.h > + > +[Sources.IA32] > + Ia32/SecEntry.nasm > + Ia32/PeiCoreEntry.nasm > + Ia32/Stack.nasm > + Ia32/Fsp.h > + > +########################################################################= ######## > +# > +# Package Dependency Section - list of Package files that are required f= or > +# this module. > +# > +########################################################################= ######## > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + UefiCpuPkg/UefiCpuPkg.dec > + IntelFsp2Pkg/IntelFsp2Pkg.dec > + IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec > + MinPlatformPkg/MinPlatformPkg.dec > + AlderlakeSiliconPkg/SiPkg.dec > + AlderLakeFspBinPkg/Client/AlderLakeP/AlderLakeFspBinPkg.dec > + AlderlakeOpenBoardPkg/OpenBoardPkg.dec > + > +[LibraryClasses] > + LocalApicLib > + SerialPortLib > + FspWrapperPlatformLib > + FspWrapperApiLib > + SecBoardInitLib > + TestPointCheckLib > + PeiServicesTablePointerLib > + > +[Ppis] > + gEfiSecPlatformInformationPpiGuid ## CONSUMES > + gPeiSecPerformancePpiGuid ## CONSUMES > + gTopOfTemporaryRamPpiGuid ## PRODUCES > + gEfiPeiFirmwareVolumeInfoPpiGuid ## PRODUCES > + gFspTempRamExitPpiGuid ## CONSUMES > + gPlatformInitTempRamExitPpiGuid ## CONSUMES > + > +[Pcd] > + gUefiCpuPkgTokenSpaceGuid.PcdPeiTemporaryRamStackSize ##= CONSUMES > + gIntelFsp2WrapperTokenSpaceGuid.PcdFsptBaseAddress ##= CONSUMES > + gIntelFsp2PkgTokenSpaceGuid.PcdFspTemporaryRamSize ##= CONSUMES > + gMinPlatformPkgTokenSpaceGuid.PcdSecSerialPortDebugEnable ##= CONSUMES > + > +[FixedPcd] > + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvMicrocodeBase ##= CONSUMES > + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvMicrocodeSize ##= CONSUMES > + gMinPlatformPkgTokenSpaceGuid.PcdMicrocodeOffsetInFv ##= CONSUMES > + gIntelFsp2WrapperTokenSpaceGuid.PcdFlashCodeCacheAddress ##= CONSUMES > + gIntelFsp2WrapperTokenSpaceGuid.PcdFlashCodeCacheSize ##= CONSUMES > + gIntelFsp2WrapperTokenSpaceGuid.PcdFspmBaseAddress ##= CONSUMES > + gIntelFsp2WrapperTokenSpaceGuid.PcdFspModeSelection ##= CONSUMES > + gSiPkgTokenSpaceGuid.PcdSerialIoUartDebugEnable ##= CONSUMES > + gSiPkgTokenSpaceGuid.PcdSerialIoUartNumber ##= CONSUMES > + gSiPkgTokenSpaceGuid.PcdSerialIoUartMode ##= CONSUMES > + gSiPkgTokenSpaceGuid.PcdSerialIoUartBaudRate ##= CONSUMES > + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress ##= PRODUCES > + gMinPlatformPkgTokenSpaceGuid.PcdFspDispatchModeUseFspPeiMain ##= CONSUMES > \ No newline at end of file > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecF= spWrapperPlatformSecLib/SecGetPerformance.c b/Platform/Intel/AlderlakeOpenB= oardPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecGetPerformance.c > new file mode 100644 > index 00000000..a59ee9a3 > --- /dev/null > +++ b/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/SecGetPerformance.c > @@ -0,0 +1,89 @@ > +/** @file > + Sample to provide SecGetPerformance function. > + > +Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.
> +SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > + > +#include > +#include > + > +#include > +#include > +#include > + > +/** > + This interface conveys performance information out of the Security (SE= C) phase into PEI. > + > + This service is published by the SEC phase. The SEC phase handoff has = an optional > + EFI_PEI_PPI_DESCRIPTOR list as its final argument when control is pass= ed from SEC into the > + PEI Foundation. As such, if the platform supports collecting performan= ce data in SEC, > + this information is encapsulated into the data structure abstracted by= this service. > + This information is collected for the boot-strap processor (BSP) on IA= -32. > + > + @param[in] PeiServices The pointer to the PEI Services Table. > + @param[in] This The pointer to this instance of the PEI_SEC_P= ERFORMANCE_PPI. > + @param[out] Performance The pointer to performance data collected in = SEC phase. > + > + @retval EFI_SUCCESS The data was successfully returned. > + > +**/ > +EFI_STATUS > +EFIAPI > +SecGetPerformance ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN PEI_SEC_PERFORMANCE_PPI *This, > + OUT FIRMWARE_SEC_PERFORMANCE *Performance > + ) > +{ > + UINT32 Size; > + UINT32 Count; > + UINTN TopOfTemporaryRam; > + UINT64 Ticker; > + VOID *TopOfTemporaryRamPpi; > + EFI_STATUS Status; > + > + DEBUG ((DEBUG_INFO, "SecGetPerformance\n")); > + > + Status =3D (*PeiServices)->LocatePpi ( > + PeiServices, > + &gTopOfTemporaryRamPpiGuid, > + 0, > + NULL, > + (VOID **) &TopOfTemporaryRamPpi > + ); > + if (EFI_ERROR (Status)) { > + return EFI_NOT_FOUND; > + } > + // > + // |--------------| <- TopOfTemporaryRam - BL > + // | List Ptr | > + // |--------------| > + // | BL RAM Start | > + // |--------------| > + // | BL RAM End | > + // |--------------| > + // |Number of BSPs| > + // |--------------| > + // | BIST | > + // |--------------| > + // | .... | > + // |--------------| > + // | TSC[63:32] | > + // |--------------| > + // | TSC[31:00] | > + // |--------------| > + // > + TopOfTemporaryRam =3D (UINTN) TopOfTemporaryRamPpi - sizeof (UINT32); > + TopOfTemporaryRam -=3D sizeof (UINT32) * 2; > + Count =3D *(UINT32 *)(TopOfTemporaryRam - sizeof (UINT32))= ; > + Size =3D Count * sizeof (UINT32); > + > + Ticker =3D *(UINT64 *) (TopOfTemporaryRam - sizeof (UINT32) - Size - s= izeof (UINT32) * 2); > + Performance->ResetEnd =3D GetTimeInNanoSecond (Ticker); > + > + return EFI_SUCCESS; > +} > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecF= spWrapperPlatformSecLib/SecPlatformInformation.c b/Platform/Intel/Alderlake= OpenBoardPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecPlatformInfo= rmation.c > new file mode 100644 > index 00000000..401f84e5 > --- /dev/null > +++ b/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/SecPlatformInformation.c > @@ -0,0 +1,78 @@ > +/** @file > + Provide SecPlatformInformation function. > + > +Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.
> +SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > + > +#include > +#include > + > +#include > +#include > + > +/** > + This interface conveys state information out of the Security (SEC) pha= se into PEI. > + > + @param[in] PeiServices Pointer to the PEI Services T= able. > + @param[in,out] StructureSize Pointer to the variable descr= ibing size of the input buffer. > + @param[out] PlatformInformationRecord Pointer to the EFI_SEC_PLATFO= RM_INFORMATION_RECORD. > + > + @retval EFI_SUCCESS The data was successfully returned. > + @retval EFI_BUFFER_TOO_SMALL The buffer was too small. > + > +**/ > +EFI_STATUS > +EFIAPI > +SecPlatformInformation ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN OUT UINT64 *StructureSize, > + OUT EFI_SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationReco= rd > + ) > +{ > + UINT32 *Bist; > + UINT32 Size; > + UINT32 Count; > + UINTN TopOfTemporaryRam; > + VOID *TopOfTemporaryRamPpi; > + EFI_STATUS Status; > + > + DEBUG ((DEBUG_INFO, "SecPlatformInformation\n")); > + > + Status =3D (*PeiServices)->LocatePpi ( > + PeiServices, > + &gTopOfTemporaryRamPpiGuid, > + 0, > + NULL, > + (VOID **) &TopOfTemporaryRamPpi > + ); > + if (EFI_ERROR (Status)) { > + return EFI_NOT_FOUND; > + } > + > + // > + // The entries of BIST information, together with the number of them, > + // reside in the bottom of stack, left untouched by normal stack opera= tion. > + // This routine copies the BIST information to the buffer pointed by > + // PlatformInformationRecord for output. > + // > + TopOfTemporaryRam =3D (UINTN) TopOfTemporaryRamPpi - sizeof (UINT32); > + TopOfTemporaryRam -=3D sizeof (UINT32) * 2; > + Count =3D *((UINT32 *)(TopOfTemporaryRam - sizeof (UINT32)= )); > + Size =3D Count * sizeof (IA32_HANDOFF_STATUS); > + > + if ((*StructureSize) < (UINT64) Size) { > + *StructureSize =3D Size; > + return EFI_BUFFER_TOO_SMALL; > + } > + > + *StructureSize =3D Size; > + Bist =3D (UINT32 *) (TopOfTemporaryRam - sizeof (UINT32) - = Size); > + > + CopyMem (PlatformInformationRecord, Bist, Size); > + > + return EFI_SUCCESS; > +} > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecF= spWrapperPlatformSecLib/SecRamInitData.c b/Platform/Intel/AlderlakeOpenBoar= dPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecRamInitData.c > new file mode 100644 > index 00000000..a3cc8741 > --- /dev/null > +++ b/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/SecRamInitData.c > @@ -0,0 +1,57 @@ > +/** @file > + Provide TempRamInitParams data. > + > +Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.
> +SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include "FsptCoreUpd.h" > + > +GLOBAL_REMOVE_IF_UNREFERENCED CONST FSPT_UPD FsptUpdDataPtr =3D { > + { > + FSPT_UPD_SIGNATURE, > + 0x02, > + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > + 0x00, 0x00, 0x00 > + } > + }, > + { > + 0x01, > + { > + 0x00, 0x00, 0x00 > + }, > + 0x00000020, > + 0x00000000, > + { > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 > + } > + }, > + { > + FixedPcdGet32 (PcdFlashFvMicrocodeBase) + FixedPcdGet32 (PcdMicrocod= eOffsetInFv), > + FixedPcdGet64 (PcdFlashFvMicrocodeSize) - FixedPcdGet32 (PcdMicrocod= eOffsetInFv), > + 0, // Set CodeRegionBase as 0, so that caching will be 4GB-= (CodeRegionSize > LLCSize ? LLCSize : CodeRegionSize) will be used. > + FixedPcdGet32 (PcdFlashCodeCacheSize), > + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 > + } > + }, > + { > + FixedPcdGet8 (PcdSerialIoUartDebugEnable), > + FixedPcdGet8 (PcdSerialIoUartNumber), > + FixedPcdGet8 (PcdSerialIoUartMode), > + 0, > + FixedPcdGet32 (PcdSerialIoUartBaudRate), > + FixedPcdGet64 (PcdPciExpressBaseAddress), > + { > + 0x00 > + } > + }, > + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 > + }, > + 0x55AA > +}; > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecF= spWrapperPlatformSecLib/SecTempRamDone.c b/Platform/Intel/AlderlakeOpenBoar= dPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecTempRamDone.c > new file mode 100644 > index 00000000..d28e9b7c > --- /dev/null > +++ b/Platform/Intel/AlderlakeOpenBoardPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/SecTempRamDone.c > @@ -0,0 +1,93 @@ > +/** @file > + Provide SecTemporaryRamDone function. > + > +Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.
> +SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > + > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +/** > +This interface disables temporary memory in SEC Phase. > +**/ > +VOID > +EFIAPI > +SecPlatformDisableTemporaryMemory ( > + VOID > + ) > +{ > + EFI_STATUS Status; > + VOID *TempRamExitParam; > + CONST EFI_PEI_SERVICES **PeiServices; > + FSP_TEMP_RAM_EXIT_PPI *TempRamExitPpi; > + PLATFORM_INIT_TEMP_RAM_EXIT_PPI *PlatformInitTempRamExitPpi; > + > + DEBUG ((DEBUG_INFO, "SecPlatformDisableTemporaryMemory enter\n")); > + PeiServices =3D GetPeiServicesTablePointer (); > + ASSERT (PeiServices !=3D NULL); > + if (PeiServices =3D=3D NULL) { > + return; > + } > + ASSERT ((*PeiServices) !=3D NULL); > + if ((*PeiServices) =3D=3D NULL) { > + return; > + } > + Status =3D (*PeiServices)->LocatePpi ( > + PeiServices, > + &gPlatformInitTempRamExitPpiGuid, > + 0, > + NULL, > + (VOID **) &PlatformInitTempRamExitPpi > + ); > + ASSERT_EFI_ERROR (Status); > + if (EFI_ERROR (Status)) { > + return; > + } > + > + Status =3D PlatformInitTempRamExitPpi->PlatformInitBeforeTempRamExit (= ); > + ASSERT_EFI_ERROR (Status); > + > + if (PcdGet8 (PcdFspModeSelection) =3D=3D 1) { > + // > + // FSP API mode > + // > + TempRamExitParam =3D UpdateTempRamExitParam (); > + Status =3D CallTempRamExit (TempRamExitParam); > + DEBUG ((DEBUG_INFO, "TempRamExit status: 0x%x\n", Status)); > + ASSERT_EFI_ERROR (Status); > + } else { > + // > + // FSP Dispatch mode > + // > + Status =3D (*PeiServices)->LocatePpi ( > + PeiServices, > + &gFspTempRamExitPpiGuid, > + 0, > + NULL, > + (VOID **) &TempRamExitPpi > + ); > + ASSERT_EFI_ERROR (Status); > + if (EFI_ERROR (Status)) { > + return; > + } > + TempRamExitPpi->TempRamExit (NULL); > + } > + > + Status =3D PlatformInitTempRamExitPpi->PlatformInitAfterTempRamExit ()= ; > + ASSERT_EFI_ERROR (Status); > + > + return ; > +} > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/Include/Library/SpiFlas= hCommon.h b/Platform/Intel/AlderlakeOpenBoardPkg/Include/Library/SpiFlashCo= mmon.h > deleted file mode 100644 > index 76ba3a80..00000000 > --- a/Platform/Intel/AlderlakeOpenBoardPkg/Include/Library/SpiFlashCommon= .h > +++ /dev/null > @@ -1,99 +0,0 @@ > -/** @file > - The header file includes the common header files, defines > - internal structure and functions used by SpiFlashCommonLib. > - > - Copyright (c) 2022, Intel Corporation. All rights reserved.
> - SPDX-License-Identifier: BSD-2-Clause-Patent > - > -**/ > - > -#ifndef __SPI_FLASH_COMMON_H__ > -#define __SPI_FLASH_COMMON_H__ > - > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > - > -#define SECTOR_SIZE_4KB 0x1000 // Common 4kBytes sector size > -/** > - Enable block protection on the Serial Flash device. > - > - @retval EFI_SUCCESS Opertion is successful. > - @retval EFI_DEVICE_ERROR If there is any device errors. > - > -**/ > -EFI_STATUS > -EFIAPI > -SpiFlashLock ( > - VOID > - ); > - > -/** > - Read NumBytes bytes of data from the address specified by > - PAddress into Buffer. > - > - @param[in] Address The starting physical address of the rea= d. > - @param[in,out] NumBytes On input, the number of bytes to read. O= n output, the number > - of bytes actually read. > - @param[out] Buffer The destination data buffer for the read= . > - > - @retval EFI_SUCCESS Opertion is successful. > - @retval EFI_DEVICE_ERROR If there is any device errors. > - > -**/ > -EFI_STATUS > -EFIAPI > -SpiFlashRead ( > - IN UINTN Address, > - IN OUT UINT32 *NumBytes, > - OUT UINT8 *Buffer > - ); > - > -/** > - Write NumBytes bytes of data from Buffer to the address specified by > - PAddresss. > - > - @param[in] Address The starting physical address of the w= rite. > - @param[in,out] NumBytes On input, the number of bytes to write= . On output, > - the actual number of bytes written. > - @param[in] Buffer The source data buffer for the write. > - > - @retval EFI_SUCCESS Opertion is successful. > - @retval EFI_DEVICE_ERROR If there is any device errors. > - > -**/ > -EFI_STATUS > -EFIAPI > -SpiFlashWrite ( > - IN UINTN Address, > - IN OUT UINT32 *NumBytes, > - IN UINT8 *Buffer > - ); > - > -/** > - Erase the block starting at Address. > - > - @param[in] Address The starting physical address of the block= to be erased. > - This library assume that caller garantee t= hat the PAddress > - is at the starting address of this block. > - @param[in] NumBytes On input, the number of bytes of the logic= al block to be erased. > - On output, the actual number of bytes eras= ed. > - > - @retval EFI_SUCCESS. Opertion is successful. > - @retval EFI_DEVICE_ERROR If there is any device errors. > - > -**/ > -EFI_STATUS > -EFIAPI > -SpiFlashBlockErase ( > - IN UINTN Address, > - IN UINTN *NumBytes > - ); > - > -#endif > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/Library/SmmSpiFlashComm= onLib/SmmSpiFlashCommonLib.inf b/Platform/Intel/AlderlakeOpenBoardPkg/Libra= ry/SmmSpiFlashCommonLib/SmmSpiFlashCommonLib.inf > deleted file mode 100644 > index cf6ca0d0..00000000 > --- a/Platform/Intel/AlderlakeOpenBoardPkg/Library/SmmSpiFlashCommonLib/S= mmSpiFlashCommonLib.inf > +++ /dev/null > @@ -1,49 +0,0 @@ > -### @file > -# SMM Library instance of Spi Flash Common Library Class > -# > -# Copyright (c) 2022, Intel Corporation. All rights reserved.
> -# SPDX-License-Identifier: BSD-2-Clause-Patent > -# > -### > - > -[Defines] > - INF_VERSION =3D 0x00010017 > - BASE_NAME =3D SmmSpiFlashCommonLib > - FILE_GUID =3D 9632D96E-E849-4217-9217-DC500B8AAE4= 7 > - VERSION_STRING =3D 1.0 > - MODULE_TYPE =3D DXE_SMM_DRIVER > - LIBRARY_CLASS =3D SpiFlashCommonLib|DXE_SMM_DRIVER > - CONSTRUCTOR =3D SmmSpiFlashCommonLibConstructor > -# > -# The following information is for reference only and not required by th= e build tools. > -# > -# VALID_ARCHITECTURES =3D IA32 X64 > -# > - > -[LibraryClasses] > - IoLib > - MemoryAllocationLib > - BaseLib > - UefiLib > - SmmServicesTableLib > - BaseMemoryLib > - DebugLib > - > -[Packages] > - MdePkg/MdePkg.dec > - AlderlakeSiliconPkg/SiPkg.dec > - AlderlakeOpenBoardPkg/OpenBoardPkg.dec > - > -[Pcd] > - gSiPkgTokenSpaceGuid.PcdBiosAreaBaseAddress ## CONSUMES > - gSiPkgTokenSpaceGuid.PcdBiosSize ## CONSUMES > - > -[Sources] > - SpiFlashCommonSmmLib.c > - SpiFlashCommon.c > - > -[Protocols] > - gPchSmmSpiProtocolGuid ## CONSUMES > - > -[Depex.X64.DXE_SMM_DRIVER] > - gPchSmmSpiProtocolGuid > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/Library/SmmSpiFlashComm= onLib/SpiFlashCommon.c b/Platform/Intel/AlderlakeOpenBoardPkg/Library/SmmSp= iFlashCommonLib/SpiFlashCommon.c > deleted file mode 100644 > index 3f7c52ac..00000000 > --- a/Platform/Intel/AlderlakeOpenBoardPkg/Library/SmmSpiFlashCommonLib/S= piFlashCommon.c > +++ /dev/null > @@ -1,215 +0,0 @@ > -/** @file > - Wrap EFI_SPI_PROTOCOL to provide some library level interfaces > - for module use. > - > - Copyright (c) 2022, Intel Corporation. All rights reserved.
> - SPDX-License-Identifier: BSD-2-Clause-Patent > - > - > -**/ > - > -#include > -#include > - > -PCH_SPI_PROTOCOL *mSpiProtocol; > - > -// > -// Variables for boottime and runtime usage. > -// > -UINTN mBiosAreaBaseAddress =3D 0; > -UINTN mBiosSize =3D 0; > -UINTN mBiosOffset =3D 0; > - > -/** > - Enable block protection on the Serial Flash device. > - > - @retval EFI_SUCCESS Operation is successful. > - @retval EFI_DEVICE_ERROR If there is any device errors. > - > -**/ > -EFI_STATUS > -EFIAPI > -SpiFlashLock ( > - VOID > - ) > -{ > - EFI_STATUS Status; > - > - Status =3D EFI_SUCCESS; > - > - return Status; > -} > - > -/** > - Read NumBytes bytes of data from the address specified by > - PAddress into Buffer. > - > - @param[in] Address The starting physical address of the rea= d. > - @param[in,out] NumBytes On input, the number of bytes to read. O= n output, the number > - of bytes actually read. > - @param[out] Buffer The destination data buffer for the read= . > - > - @retval EFI_SUCCESS Operation is successful. > - @retval EFI_DEVICE_ERROR If there is any device errors. > - > -**/ > -EFI_STATUS > -EFIAPI > -SpiFlashRead ( > - IN UINTN Address, > - IN OUT UINT32 *NumBytes, > - OUT UINT8 *Buffer > - ) > -{ > - ASSERT ((NumBytes !=3D NULL) && (Buffer !=3D NULL)); > - if ((NumBytes =3D=3D NULL) || (Buffer =3D=3D NULL)) { > - return EFI_INVALID_PARAMETER; > - } > - > - // > - // This function is implemented specifically for those platforms > - // at which the SPI device is memory mapped for read. So this > - // function just do a memory copy for Spi Flash Read. > - // > - CopyMem (Buffer, (VOID *) Address, *NumBytes); > - > - return EFI_SUCCESS; > -} > - > -/** > - Write NumBytes bytes of data from Buffer to the address specified by > - PAddresss. > - > - @param[in] Address The starting physical address of the w= rite. > - @param[in,out] NumBytes On input, the number of bytes to write= . On output, > - the actual number of bytes written. > - @param[in] Buffer The source data buffer for the write. > - > - @retval EFI_SUCCESS Operation is successful. > - @retval EFI_DEVICE_ERROR If there is any device errors. > - @retval EFI_INVALID_PARAMETER Invalid parameter. > - @retval EFI_BAD_BUFFER_SIZE DataSectionSize in BGUP header= exceeds the > - size ofBIOS Guard script buffe= r > - > -**/ > -EFI_STATUS > -EFIAPI > -SpiFlashWrite ( > - IN UINTN Address, > - IN OUT UINT32 *NumBytes, > - IN UINT8 *Buffer > - ) > -{ > - EFI_STATUS Status; > - UINTN Offset; > - UINT32 Length; > - UINT32 RemainingBytes; > - > - ASSERT ((NumBytes !=3D NULL) && (Buffer !=3D NULL)); > - if ((NumBytes =3D=3D NULL) || (Buffer =3D=3D NULL)) { > - return EFI_INVALID_PARAMETER; > - } > - > - ASSERT (Address >=3D mBiosAreaBaseAddress); > - if (Address < mBiosAreaBaseAddress) { > - return EFI_INVALID_PARAMETER; > - } > - > - Offset =3D Address - mBiosAreaBaseAddress; > - > - ASSERT ((*NumBytes + Offset) <=3D mBiosSize); > - if ((*NumBytes + Offset) > mBiosSize) { > - return EFI_INVALID_PARAMETER; > - } > - > - Status =3D EFI_SUCCESS; > - RemainingBytes =3D *NumBytes; > - > - while (RemainingBytes > 0) { > - if (RemainingBytes > SECTOR_SIZE_4KB) { > - Length =3D SECTOR_SIZE_4KB; > - } else { > - Length =3D RemainingBytes; > - } > - Status =3D mSpiProtocol->FlashWrite ( > - mSpiProtocol, > - FlashRegionBios, > - (UINT32) Offset, > - Length, > - Buffer > - ); > - if (EFI_ERROR (Status)) { > - break; > - } > - RemainingBytes -=3D Length; > - Offset +=3D Length; > - Buffer +=3D Length; > - } > - > - // > - // Actual number of bytes written > - // > - *NumBytes -=3D RemainingBytes; > - > - return Status; > -} > - > -/** > - Erase the block starting at Address. > - > - @param[in] Address The starting physical address of the block= to be erased. > - This library assume that caller garantee t= hat the PAddress > - is at the starting address of this block. > - @param[in] NumBytes On input, the number of bytes of the logic= al block to be erased. > - On output, the actual number of bytes eras= ed. > - > - @retval EFI_SUCCESS. Operation is successful. > - @retval EFI_DEVICE_ERROR If there is any device errors. > - @retval EFI_INVALID_PARAMETER Invalid parameter. > - > -**/ > -EFI_STATUS > -EFIAPI > -SpiFlashBlockErase ( > - IN UINTN Address, > - IN UINTN *NumBytes > - ) > -{ > - EFI_STATUS Status; > - UINTN Offset; > - UINTN RemainingBytes; > - > - ASSERT (NumBytes !=3D NULL); > - if (NumBytes =3D=3D NULL) { > - return EFI_INVALID_PARAMETER; > - } > - > - ASSERT (Address >=3D mBiosAreaBaseAddress); > - if (Address < mBiosAreaBaseAddress) { > - return EFI_INVALID_PARAMETER; > - } > - > - Offset =3D Address - mBiosAreaBaseAddress; > - > - ASSERT ((*NumBytes % SECTOR_SIZE_4KB) =3D=3D 0); > - if ((*NumBytes % SECTOR_SIZE_4KB) !=3D 0) { > - return EFI_INVALID_PARAMETER; > - } > - > - ASSERT ((*NumBytes + Offset) <=3D mBiosSize); > - if ((*NumBytes + Offset) > mBiosSize) { > - return EFI_INVALID_PARAMETER; > - } > - > - Status =3D EFI_SUCCESS; > - RemainingBytes =3D *NumBytes; > - > - Status =3D mSpiProtocol->FlashErase ( > - mSpiProtocol, > - FlashRegionBios, > - (UINT32) Offset, > - (UINT32) RemainingBytes > - ); > - return Status; > -} > - > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/Library/SmmSpiFlashComm= onLib/SpiFlashCommonSmmLib.c b/Platform/Intel/AlderlakeOpenBoardPkg/Library= /SmmSpiFlashCommonLib/SpiFlashCommonSmmLib.c > deleted file mode 100644 > index 897d8574..00000000 > --- a/Platform/Intel/AlderlakeOpenBoardPkg/Library/SmmSpiFlashCommonLib/S= piFlashCommonSmmLib.c > +++ /dev/null > @@ -1,60 +0,0 @@ > -/** @file > - SMM Library instance of SPI Flash Common Library Class > - > - Copyright (c) 2022, Intel Corporation. All rights reserved.
> - SPDX-License-Identifier: BSD-2-Clause-Patent > - > - > -**/ > - > -#include > -#include > - > -extern PCH_SPI_PROTOCOL *mSpiProtocol; > - > -extern UINTN mBiosAreaBaseAddress; > -extern UINTN mBiosSize; > -extern UINTN mBiosOffset; > - > -/** > - The library constructuor. > - > - The function does the necessary initialization work for this library > - instance. > - > - @param[in] ImageHandle The firmware allocated handle for the UE= FI image. > - @param[in] SystemTable A pointer to the EFI system table. > - > - @retval EFI_SUCCESS The function always return EFI_SUCCESS f= or now. > - It will ASSERT on error for debug versio= n. > - @retval EFI_ERROR Please reference LocateProtocol for erro= r code details. > -**/ > -EFI_STATUS > -EFIAPI > -SmmSpiFlashCommonLibConstructor ( > - IN EFI_HANDLE ImageHandle, > - IN EFI_SYSTEM_TABLE *SystemTable > - ) > -{ > - EFI_STATUS Status; > - UINT32 BaseAddr; > - UINT32 RegionSize; > - > - mBiosAreaBaseAddress =3D (UINTN) PcdGet32 (PcdBiosAreaBaseAddress); > - mBiosSize =3D (UINTN) PcdGet32 (PcdBiosSize); > - > - // > - // Locate the SMM SPI protocol. > - // > - Status =3D gSmst->SmmLocateProtocol ( > - &gPchSmmSpiProtocolGuid, > - NULL, > - (VOID **) &mSpiProtocol > - ); > - ASSERT_EFI_ERROR (Status); > - > - mSpiProtocol->GetRegionAddress (mSpiProtocol, FlashRegionBios, &BaseAd= dr, &RegionSize); > - mBiosOffset =3D BaseAddr; > - > - return Status; > -} > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/OpenBoardPlatformInit/O= penBoardPlatformInitPei/OpenBoardPlatformInitPostMem.c b/Platform/Intel/Ald= erlakeOpenBoardPkg/OpenBoardPlatformInit/OpenBoardPlatformInitPei/OpenBoard= PlatformInitPostMem.c > index 4fab4ad8..fab53ed8 100644 > --- a/Platform/Intel/AlderlakeOpenBoardPkg/OpenBoardPlatformInit/OpenBoar= dPlatformInitPei/OpenBoardPlatformInitPostMem.c > +++ b/Platform/Intel/AlderlakeOpenBoardPkg/OpenBoardPlatformInit/OpenBoar= dPlatformInitPei/OpenBoardPlatformInitPostMem.c > @@ -5,52 +5,14 @@ > SPDX-License-Identifier: BSD-2-Clause-Patent > =20 > **/ > - > -#include > -#include > -#include > #include > #include > -#include > #include > #include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > -#include > #include > -#include > #include > #include > =20 > - > -EFI_STATUS > -EFIAPI > -OpenBoardPlatformInitEndOfPei ( > - IN CONST EFI_PEI_SERVICES **PeiServices, > - IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, > - IN VOID *Ppi > - ); > - > -static EFI_PEI_NOTIFY_DESCRIPTOR mEndOfPeiNotifyList =3D { > - (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMI= NATE_LIST), > - &gEfiEndOfPeiSignalPpiGuid, > - (EFI_PEIM_NOTIFY_ENTRY_POINT) OpenBoardPlatformInitEndOfPei > -}; > - > EFI_STATUS > EFIAPI > GetPeiPlatformLidStatus ( > @@ -127,58 +89,10 @@ GetPeiPlatformLidStatus ( > OUT LID_STATUS *CurrentLidStatus > ) > { > - DEBUG ((DEBUG_INFO, "LidStatus Unsupported\n")); > - return EFI_UNSUPPORTED; > -} > - > -/** > - Configure PciHostBridge related PCDs > -**/ > -VOID > -ConfigurePciHostBridgePcds ( > - VOID > - ) > -{ > - // > - // Provide 256GB available above 4GB MMIO resource > - // limited to use single variable MTRR to cover this above 4GB MMIO re= gion. > - // > - PcdSet64S (PcdPciReservedMemAbove4GBBase, BASE_256GB); > - PcdSet64S (PcdPciReservedMemAbove4GBLimit, BASE_256GB + SIZE_256GB - 1= ); > - if (PcdGet64 (PcdPciReservedMemAbove4GBBase) < PcdGet64 (PcdPciReserve= dMemAbove4GBLimit)) { > - DEBUG ((DEBUG_INFO, " PCI space that above 4GB MMIO is from 0x%lX", = PcdGet64 (PcdPciReservedMemAbove4GBBase))); > - DEBUG ((DEBUG_INFO, " to 0x%lX\n", PcdGet64 (PcdPciReservedMemAbove4= GBLimit))); > - } > -} > - > -/** > - This function handles PlatformInit task at the end of PEI > - > - @param[in] PeiServices Pointer to PEI Services Table. > - @param[in] NotifyDesc Pointer to the descriptor for the Notificatio= n event that > - caused this function to execute. > - @param[in] Ppi Pointer to the PPI data associated with this = function. > - > - @retval EFI_SUCCESS The function completes successfully > - @retval others > -**/ > -EFI_STATUS > -EFIAPI > -OpenBoardPlatformInitEndOfPei ( > - IN CONST EFI_PEI_SERVICES **PeiServices, > - IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, > - IN VOID *Ppi > - ) > -{ > - // > - // Configure PciHostBridge related PCDs before DXE phase > - // > - ConfigurePciHostBridgePcds (); > - > + *CurrentLidStatus =3D LidOpen; > return EFI_SUCCESS; > } > =20 > - > /** > Platform Init PEI module entry point > =20 > @@ -201,8 +115,6 @@ OpenBoardPlatformInitPostMemEntryPoint ( > PEI_CORE_FV_HANDLE *CoreFvHandle; > VOID *HobData; > =20 > - PostCode (PLATFORM_INIT_POSTMEM_ENTRY); > - > // > // Build a HOB to show current FV location for SA policy update code t= o consume. > // > @@ -223,11 +135,5 @@ OpenBoardPlatformInitPostMemEntryPoint ( > DEBUG ((DEBUG_INFO, "Install mPeiGraphicsPlatformPpi \n")); > Status =3D PeiServicesInstallPpi (&mPeiGraphicsPlatformPpi); > =20 > - // > - // Performing PlatformInitEndOfPei after EndOfPei PPI produced > - // > - Status =3D PeiServicesNotifyPpi (&mEndOfPeiNotifyList); > - PostCode (PLATFORM_INIT_POSTMEM_EXIT); > - > return Status; > } > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/OpenBoardPlatformInit/O= penBoardPlatformInitPei/OpenBoardPlatformInitPostMem.inf b/Platform/Intel/A= lderlakeOpenBoardPkg/OpenBoardPlatformInit/OpenBoardPlatformInitPei/OpenBoa= rdPlatformInitPostMem.inf > index b2bfd97f..31c01919 100644 > --- a/Platform/Intel/AlderlakeOpenBoardPkg/OpenBoardPlatformInit/OpenBoar= dPlatformInitPei/OpenBoardPlatformInitPostMem.inf > +++ b/Platform/Intel/AlderlakeOpenBoardPkg/OpenBoardPlatformInit/OpenBoar= dPlatformInitPei/OpenBoardPlatformInitPostMem.inf > @@ -17,20 +17,11 @@ > [LibraryClasses] > PeimEntryPoint > DebugLib > - IoLib > MemoryAllocationLib > BaseMemoryLib > HobLib > PeiServicesLib > - PciSegmentLib > - MtrrLib > - PchInfoLib > - PostCodeLib > - SiPolicyLib > - FspCommonLib > PcdLib > - PchPciBdfLib > - GpioLib > PeiGetFvInfoLib > =20 > [Packages] > @@ -49,27 +40,16 @@ > OpenBoardPlatformInitPostMem.c > =20 > [Ppis] > - gEfiEndOfPeiSignalPpiGuid ## CONSUMES > - gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMES > gPeiGraphicsPlatformPpiGuid ## PRODUCES > - gFspSiliconInitDonePpiGuid ## CONSUMES > =20 > [Protocols] > =20 > [Guids] > - gEfiSmmSmramMemoryGuid ## CONSUMES > gPlatformInitFvLocationGuid ## PRODUCES > =20 > [Depex] > gEfiPeiMemoryDiscoveredPpiGuid > =20 > [Pcd] > - gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress ## CON= SUMES > - gMinPlatformPkgTokenSpaceGuid.PcdPciReservedIobase ## CON= SUMES > - gMinPlatformPkgTokenSpaceGuid.PcdPciReservedIoLimit ## CON= SUMES > - gMinPlatformPkgTokenSpaceGuid.PcdPciReservedMemAbove4GBBase ## CON= SUMES > - gMinPlatformPkgTokenSpaceGuid.PcdPciReservedMemAbove4GBLimit ## CON= SUMES > - gMinPlatformPkgTokenSpaceGuid.PcdPciSegmentCount ## CON= SUMES > - > gIntelSiliconPkgTokenSpaceGuid.PcdIntelGraphicsVbtFileGuid ## CON= SUMES > =20 > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/DxeSilic= onPolicyUpdateLib/DxeSaPolicyInit.c b/Platform/Intel/AlderlakeOpenBoardPkg/= Policy/Library/DxeSiliconPolicyUpdateLib/DxeSaPolicyInit.c > index da2f568e..fac1fb7a 100644 > --- a/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/DxeSiliconPolic= yUpdateLib/DxeSaPolicyInit.c > +++ b/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/DxeSiliconPolic= yUpdateLib/DxeSaPolicyInit.c > @@ -10,7 +10,32 @@ > #include > #include > #include > +#include > + > #include > +#include > + > +// > +// The boot script private data. > +// > +typedef struct { > + UINT8 *TableBase; > + UINT32 TableLength; // Record the actual memory length > + UINT16 TableMemoryPageNumber; // Record the page number Allocated = for the table > + BOOLEAN InSmm; // Record if this library is in SMM. > + BOOLEAN AtRuntime; // Record if current state is after = SmmExitBootServices or SmmLegacyBoot. > + UINT32 BootTimeScriptLength; // Maintain boot time script length = in LockBox after SmmReadyToLock in SMM. > + BOOLEAN SmmLocked; // Record if current state is after = SmmReadyToLock > + BOOLEAN BackFromS3; // Indicate that the system is back = from S3. > +} SCRIPT_TABLE_PRIVATE_DATA; > + > +SCRIPT_TABLE_PRIVATE_DATA *mS3BootScriptTablePtr; > +VOID > +EFIAPI > +S3SmmLockedCallback ( > + IN EFI_EVENT Event, > + IN VOID *Context > + ); > =20 > EFI_STATUS > EFIAPI > @@ -43,6 +68,7 @@ SaPolicyInitDxe ( > { > EFI_STATUS Status; > SA_POLICY_PROTOCOL *SaPolicy; > + VOID *Registration; > =20 > // > // Call CreateSaDxeConfigBlocks to create & initialize platform policy= structure > @@ -52,6 +78,17 @@ SaPolicyInitDxe ( > DEBUG ((DEBUG_INFO, "SaPolicy->TableHeader.NumberOfBlocks =3D 0x%x\n "= , SaPolicy->TableHeader.NumberOfBlocks)); > ASSERT_EFI_ERROR (Status); > =20 > + /// > + /// Create S3 SmmLocked callback to fix assert > + /// > + EfiCreateProtocolNotifyEvent ( > + &gEfiPciEnumerationCompleteProtocolGuid, > + TPL_CALLBACK, > + S3SmmLockedCallback, > + NULL, > + &Registration > + ); > + =20 > // > // Install SaInstallPolicyProtocol. > // While installed, RC assumes the Policy is ready and finalized. So p= lease > @@ -62,3 +99,37 @@ SaPolicyInitDxe ( > =20 > return EFI_SUCCESS; > } > + > +/** > + This function gets registered as a callback to Enable S3 SmmLocked bef= ore EndOfDxe > + > + @param[in] Event - A pointer to the Event that triggered the callb= ack. > + @param[in] Context - A pointer to private data registered with the c= allback function. > +**/ > +VOID > +EFIAPI > +S3SmmLockedCallback ( > + IN EFI_EVENT Event, > + IN VOID *Context > + ) > +{ > + EFI_STATUS Status; > + VOID *ProtocolPointer; > + SCRIPT_TABLE_PRIVATE_DATA *S3TablePtr; > + > + DEBUG ((DEBUG_INFO, "S3SmmLockedCallback Start\n")); > + > + Status =3D gBS->LocateProtocol (&gEfiPciEnumerationCompleteProtocolGui= d, NULL, (VOID **) &ProtocolPointer); > + if (EFI_SUCCESS !=3D Status) { > + return; > + } > + =20 > + gBS->CloseEvent (Event); > + > + S3TablePtr =3D (SCRIPT_TABLE_PRIVATE_DATA *)(UINTN)PcdGet64 (PcdS3Boot= ScriptTablePrivateDataPtr); > + mS3BootScriptTablePtr =3D S3TablePtr; > + mS3BootScriptTablePtr->SmmLocked =3D TRUE; > + > + DEBUG ((DEBUG_INFO, "S3SmmLockedCallback End\n")); > + return; > +} > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/DxeSilic= onPolicyUpdateLib/DxeSiliconPolicyUpdateLib.inf b/Platform/Intel/AlderlakeO= penBoardPkg/Policy/Library/DxeSiliconPolicyUpdateLib/DxeSiliconPolicyUpdate= Lib.inf > index 54b4d7b1..25fc411b 100644 > --- a/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/DxeSiliconPolic= yUpdateLib/DxeSiliconPolicyUpdateLib.inf > +++ b/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/DxeSiliconPolic= yUpdateLib/DxeSiliconPolicyUpdateLib.inf > @@ -42,12 +42,14 @@ > gBoardModuleTokenSpaceGuid.PcdIntelGopEnable > gIntelSiliconPkgTokenSpaceGuid.PcdIntelGraphicsVbtFileGuid > gPlatformModuleTokenSpaceGuid.PcdSmbiosOemTypeFirmwareVersionInfo = ## CONSUMES > + gEfiMdeModulePkgTokenSpaceGuid.PcdS3BootScriptTablePrivateDataPtr > =20 > [Protocols] > gEfiFirmwareVolume2ProtocolGuid ## CONSUMES > gSaPolicyProtocolGuid ## CONSUMES > gDxeSiPolicyProtocolGuid ## PRODUCES > gGopPolicyProtocolGuid ## PRODUCES > + gEfiPciEnumerationCompleteProtocolGuid ## PRODUCES > =20 > [Depex] > gEfiVariableArchProtocolGuid > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolic= yUpdateLib/PeiCpuPolicyUpdatePreMem.c b/Platform/Intel/AlderlakeOpenBoardPk= g/Policy/Library/PeiPolicyUpdateLib/PeiCpuPolicyUpdatePreMem.c > index b23e2cec..1139277f 100644 > --- a/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdate= Lib/PeiCpuPolicyUpdatePreMem.c > +++ b/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdate= Lib/PeiCpuPolicyUpdatePreMem.c > @@ -15,8 +15,6 @@ > #include > #include > #include > -#include > -#include > #include > #include > #include > @@ -73,7 +71,6 @@ UpdatePeiCpuPolicyPreMem ( > =20 > UPDATE_POLICY (((FSPM_UPD *) FspmUpd)->FspmConfig.SkipStopPbet, CpuSec= urityPreMemConfig->SkipStopPbet, FALSE); > =20 > - SpiServiceInit (); > DEBUG ((DEBUG_INFO, "BIOS Guard PCD and Policy are disabled\n")); > UPDATE_POLICY (((FSPM_UPD *) FspmUpd)->FspmConfig.BiosGuard, CpuSecuri= tyPreMemConfig->BiosGuard, CPU_FEATURE_DISABLE); > =20 > diff --git a/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolic= yUpdateLib/PeiPolicyUpdateLib.inf b/Platform/Intel/AlderlakeOpenBoardPkg/Po= licy/Library/PeiPolicyUpdateLib/PeiPolicyUpdateLib.inf > index 844e4c99..d6bb07fa 100644 > --- a/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdate= Lib/PeiPolicyUpdateLib.inf > +++ b/Platform/Intel/AlderlakeOpenBoardPkg/Policy/Library/PeiPolicyUpdate= Lib/PeiPolicyUpdateLib.inf > @@ -32,7 +32,6 @@ > SiPolicyLib > PeiServicesLib > FirmwareBootMediaLib > - SpiLib > BmpSupportLib > PeiGetFvInfoLib > TimerLib > @@ -205,4 +204,4 @@ > gPchPcieConfigGuid ## CONSUMES > gSerialIoConfigGuid ## CONSUMES > gPcieRpPreMemConfigGuid ## CONSUMES > - gSaMiscPeiPreMemConfigGuid ## CONSUMES > + gSaMiscPeiPreMemConfigGuid ## CONSUMES > \ No newline at end of file > --=20 > 2.26.2.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 (#117510): https://edk2.groups.io/g/devel/message/117510 Mute This Topic: https://groups.io/mt/105153727/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-