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 0D50AD800F3 for ; Sun, 23 Jul 2023 00:04:52 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=/LZUSiQcBFxOgaHpx8iFzV8ybGEQJq1bK2AcPMicMKM=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-IronPort-AV:X-IronPort-AV:X-Received:X-ExtLoop1:X-IronPort-AV:X-IronPort-AV:X-Received:X-Received:X-Received:X-Received:ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:X-Received:X-Received:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:X-MS-Has-Attach:X-MS-TNEF-Correlator:x-ms-publictraffictype:x-ms-traffictypediagnostic:x-ms-office365-filtering-correlation-id:x-ms-exchange-senderadcheck:x-ms-exchange-antispam-relay:x-microsoft-antispam-message-info:x-ms-exchange-antispam-messagedata-chunkcount:x-ms-exchange-antispam-messagedata-0:MIME-Version:X-MS-Exchange-CrossTenant-AuthAs:X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-Network-Message-Id:X-MS-Exchange-CrossTenant-originalarrivaltime:X-MS-Exchange-CrossTenant-fromentityheader:X-MS-Exchange-CrossTenant-id:X-MS-Exchange-CrossTenant-mailboxtype:X-MS-Exchange-CrossTenant-userprincipalname:X-MS-Exchange-Transport-CrossTenantHeaders Stamped:X-OriginatorOrg:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:X-Gm-Message-State:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1690070691; v=1; b=tBAbiaMCiZ70JgIDJfyt0+sUqJ7lx7XBBVbJ+UBMJs8xvQXm+pv7FzbULwF/EJ0t7H7GGVIk VlNtiCl/A3SxHw1mf2aE8ZkCNrFnqbZHw5BdC0hTMVWElSYC/TP+pIn7W5M7hpZwtjHGsTIjafS yo9mOnyOJKyMV2I2XnBd6lRM= X-Received: by 127.0.0.2 with SMTP id dUZfYY7687511x3b8BqyJx4m; Sat, 22 Jul 2023 17:04:51 -0700 X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web11.16751.1690070690339020600 for ; Sat, 22 Jul 2023 17:04:50 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10779"; a="364694583" X-IronPort-AV: E=Sophos;i="6.01,224,1684825200"; d="scan'208";a="364694583" X-Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2023 17:04:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10779"; a="795373019" X-IronPort-AV: E=Sophos;i="6.01,224,1684825200"; d="scan'208";a="795373019" X-Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga004.fm.intel.com with ESMTP; 22 Jul 2023 17:04:49 -0700 X-Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sat, 22 Jul 2023 17:04:49 -0700 X-Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27 via Frontend Transport; Sat, 22 Jul 2023 17:04:49 -0700 X-Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.47) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.27; Sat, 22 Jul 2023 17:04:47 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EYpudyzolGC8xLeJXPweZiQDY2MF8+gvlwGDD9rryTHfAtv3SmBOcPyHAdIDjRCkLKJcIOUn9YB1WZWjtnsI2zVWMxCnsdeHdN+mFWtuxCI+X1dvOXQmdXIhMla/WmwCFzn3oMeAh6KPspSEQ9qNnNoUesfqPqvIAeiXGqmBmta7YBaeQSrZD37Z+mAXa9T8z3l/rmZea/8T2Lj809tBbs0+OAnbWkg6AuC3ja9brRBteLvsUtcLw0aGZ5XtLcjqE7RFE0Et0/rBHQ8lWfePk+NscDLOhXNEbA1Zo2vImOMkeHKeWw2l/XCdYgzqZsV5IMcI+Z3zy5M3W16gHVCsuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=w/iEKlhJeuLKC0PVxAgB/1JXB+njJc24C5F2uEct2I4=; b=L87wNcBr9Zw+gYUmMIBz6TAS0m3B9qzeXFN173zLZFi1W+ycUR75BuzjR+hWvNRh7goB+AH96crt9aUOcXMY+Cu+pSsPMsxerThA7quBCVJ3csjO6sRCfBv85VgYm9TmY4R+VFYhnUw8vwyqce0PVSVzwhmbQbEx9Ln9qHOUNmw4THrnnl23etfrV1fCriL99vinbdeDanjNxOSbiJcyciiQ1MONd1odFM22zDq1iiIOfDzOlcBKHdV9bH1O5i6xtikSFininyDwOjpoTH0sZ4V10hGbGaQNqtgJmFRfa2Bdrs+mWUsYG7qN3nUyrJrwJM9DrVVNYiiFBkvybsXpww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none X-Received: from MW4PR11MB5776.namprd11.prod.outlook.com (2603:10b6:303:183::9) by DM4PR11MB6312.namprd11.prod.outlook.com (2603:10b6:8:a5::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.30; Sun, 23 Jul 2023 00:04:45 +0000 X-Received: from MW4PR11MB5776.namprd11.prod.outlook.com ([fe80::5842:74bc:4aaf:a4fb]) by MW4PR11MB5776.namprd11.prod.outlook.com ([fe80::5842:74bc:4aaf:a4fb%7]) with mapi id 15.20.6609.031; Sun, 23 Jul 2023 00:04:45 +0000 From: "Chaganty, Rangasai V" To: "Kasbekar, Saloni" , "devel@edk2.groups.io" CC: "Desimone, Nathaniel L" , "Oram, Isaac W" , "Chuang, Rosen" Subject: Re: [edk2-devel] [PATCH 1/8] AlderlakeSiliconPkg: Add package and library instances Thread-Topic: [PATCH 1/8] AlderlakeSiliconPkg: Add package and library instances Thread-Index: AQHZn7JEVsfHcYy0kkex5zwt8w87La/Gr0Tg Date: Sun, 23 Jul 2023 00:04:45 +0000 Message-ID: References: <6b58dd187980204b74c6ec718dad122674c213e1.1686851565.git.saloni.kasbekar@intel.com> In-Reply-To: <6b58dd187980204b74c6ec718dad122674c213e1.1686851565.git.saloni.kasbekar@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW4PR11MB5776:EE_|DM4PR11MB6312:EE_ x-ms-office365-filtering-correlation-id: 910fc7ff-33b1-4408-05e1-08db8b106c0c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: FXHxsztxs9M5sTi2j7Nx/tH2u9qHBPkuKLpk/IxDf1f8ThpabzQRCKq1cMVz6UDq9x4aXVWDGgqROHBOYl91PUo57EsAERO6+Qe0NWyYwtw7hCWMVs6TpdVOwI4cObNvtBk9+BVE+JQeMHEQM457L+zRS7sSetgX/f1cAfc7Zf5YBykg1z3FzN8bCPZuEW/KU+d9TtF8BhFy7Q7pbgaKuLx/oH8m/5/ChRj/NoROfBym1VgDWY+Et+wfTXNjDOLDbpK4dSxccHlycr0H2xXaziBySfdBR9gqVuZaaf1kq8fceRyq3x7r+n59ztyxle/UH5X8f2EM+lZ4psA2xUtR/Mqzo7Zg9PC939v0TMLjUIDDxPAPX9EhLrvmh0F7mT/os329dS+/vherQCXEbKbCqv1dSluYTVr6B4ud6/supBVfisq5be1sPlssl3LLL+2X9XKU6B6oRfxHLINmPOgkiIcKoUdKccU+Yt6IlyWi52S7r+IzxYy6wKFLTM5sfIhvgOMododOyEg3rVLDBV5MYKLKWDUwNxkGdLCrjVxnYgfDqtF+AK+WjGqpImHWBoxUlcDc5GkBBHYBZEIlHFvhsXpOyMr6yQHKg8zli8wvYPIYoMr3q72tvP8xt0Nk4SWK x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?oSsWh0H+mGv/gevVAV6O2kcLc6I1hgO8/fRrzlj0NiaaR0yIp5BDWUFEwHna?= =?us-ascii?Q?oYXHvIY5DMXeeCV5Wjq+5Ky8MIkbdHei+aeV/Xwoe1scjcgTjpw9IsJIS6QX?= =?us-ascii?Q?Tla3KpUgOm3Vh4zZn+Li9Qs0oT4Jp3HTedmODQC3k0VmqXnVTEgoooSF84qw?= =?us-ascii?Q?7AxUST1aueNhOwevxCshq78rkk533WDdccqddzFOuAlwE25+sBomavaSbXgO?= =?us-ascii?Q?TnHwCAWIwdNXxHQbzL1LK+UpID/g35XfpMpb2EXFGwb/P03lBe3GccJ3IN6B?= =?us-ascii?Q?yUSN4zi80T4xw6hCNWLz/WjvFeMMD1/8E0OLw80ttQOQLPN5+IySpIgbAtJ8?= =?us-ascii?Q?icfyZbigSztuGLG79maY9oWIIGfKiHrUOkf9tm0iUJ7zeTRnPJmpoF2PfmtD?= =?us-ascii?Q?dVkheuQjOMdUWNVGRaOSiIfpQWoMfb1pOyWVeCJ/E5u3V0lSDo1098bOYCnS?= =?us-ascii?Q?WL3Ee4cUc7PDKc1iaDP4Ulmk0S7p/lUyQq8bYIU8r4Rky/CrLNBotOrI6OFf?= =?us-ascii?Q?kkhEf8/P3+R6jCSjH/OVayA6ynEhOhzQiiNuYyW61CO/REm7ByM3GvlzOUSn?= =?us-ascii?Q?ybHI+LW8zls6/XhgU0XHSEoRNbT4ZntMwTA9Hqo6BZcHoPIMwgJL35NGHNmu?= =?us-ascii?Q?9aBzMpNyI5gMI52V/8ajVglpRx3mgZB5Vg4VFusLui8b9G33UrJS2veOhs2h?= =?us-ascii?Q?AHzS3tNWrsdUO1SxEDXltpvYxmVguC9OVdT8W1Tagbu4UQylVvRj/v36shpo?= =?us-ascii?Q?f4kCQj4Lcsf6qSKcptJQILoy0GxHFNZxW1KMxKaySFSNGV6nkOSmMM9mF/sM?= =?us-ascii?Q?oKjIQdFPWqQ2dCdjpf7eBaZr4A5e7T2u8kiVv3ZfLX9rex5zIBa8yxz0ySi5?= =?us-ascii?Q?tuDtrbo4JIUBATWGMBl3MKPPcpdy2lKi4iJ/OBQmjvAuIseng1pu4UY8Ztdb?= =?us-ascii?Q?pYFRJExOvgfRGp/6M6AxbvSxX9M7apymqse1DxiVnMlgUNNacb8hoT8BsyGm?= =?us-ascii?Q?0tCKyDtXudelJ1Hqi5+lcgt2g0WPGVMvZQ9FmdLcr3hR24DCs83GpL9HRHTZ?= =?us-ascii?Q?tBOXBLiLjWc4Z1SZAtDQcgAUNhNmArrg/3Up2KXRa0XY5aN4fUT6BJjM4SLG?= =?us-ascii?Q?1ZEYji0y1BSybHMmZyITs9N2dM+8nfqXr32HE+hcIB5QkkiE+sXesSnpekfK?= =?us-ascii?Q?oPrY8th3/01eZVG1nxRRBWWe8wE7q3xtOK51k9CWm7+rqFbEKtV5SkJeGT0k?= =?us-ascii?Q?rPixnhJDuDVqVObQlLINGe4EAkc2YAdV9zWd0FiClS/3Nr8eLlxgVbmDTYZg?= =?us-ascii?Q?YP5SfNYuxbbmFnpibW3TkCLfIWjHZ+C2UkZcjRm2z6GvaQiyRP9PXHAMCaJM?= =?us-ascii?Q?a7OIXyynEG9i51Gzf915NBcpDdTBSNd82Y1WY5G8ErzNPEXx+RAGOaPsBbv2?= =?us-ascii?Q?UIXi/eLLWR+JTnsH+qai1LIyiaeVQZnEZmn5F7yKHSWuH6/MMW09aXgTay5r?= =?us-ascii?Q?4V/NLc9nGagLBF5e3HnBjv8Jn/IZU/yGoTf1DaqVdOKH06Baffe0gcxT4w8I?= =?us-ascii?Q?ZjEaAlmaKR7dg/fd39VNWdSv1fiBsMEt6wq0WXamryIDl0pkEyDgbo6BSfpl?= =?us-ascii?Q?Mg=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB5776.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 910fc7ff-33b1-4408-05e1-08db8b106c0c X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jul 2023 00:04:45.1213 (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: PrmCLqcXdpCeJ6qCj0iei0egej+PpPE06LLsff5IBU4GHN5d6ryVLBmLYRH3dqEKkUgtiBhw+yxHPj1oW0BIiuiH/mCWaFod23nA7tZqxyY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB6312 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 Reply-To: devel@edk2.groups.io,rangasai.v.chaganty@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: S6La4OzpVVvmYDJTR8rcmeOUx7686176AA= 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=20140610 header.b=tBAbiaMC; 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); arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") Looks good. One feedback though, in PeiDxeSmmReserveMmioSizeLib.inf. The file comments states that the functions in the library are available fo= r PEI, DXE and SMM only.=20 Yet, MODULE_TYPE is set to BASE, which contradicts the above the line.=20 >From the .inf specification, we have the following guideline around MODULE_= TYPE MODULE_TYPE=09 This is the type of module. One of the EDK II Module Types. For Library Mod= ules, the MODULE_TYPE must specify the MODULE_TYPE of the module that will = typically use the library.=20 As such, I think MODULE_TYPE for the library .inf should be set to PEIM, in= stead of BASE. With that, Reviewed-by: Sai Chaganty Regards, Sai -----Original Message----- From: Kasbekar, Saloni =20 Sent: Thursday, June 15, 2023 10:53 AM To: devel@edk2.groups.io Cc: Kasbekar, Saloni ; Chaganty, Rangasai V ; Desimone, Nathaniel L ; Oram, Isaac W ; Chuang, Rosen Subject: [PATCH 1/8] AlderlakeSiliconPkg: Add package and library instances Create the AlderlakeSiliconPkg to provide an initial package for silicon in= itialization code for Alder Lake (ADL) products. Add the following librarie= s - - BasePciSegmentMultiSegLibPci - BaseSiConfigBlockLib - PeiDxeSmmReserveMmio64SizeLib - PeiPostMemSiliconPolicyInitLib Cc: Sai Chaganty Cc: Nate DeSimone Cc: Isaac Oram Cc: Rosen Chuang Signed-off-by: Saloni Kasbekar --- .../BasePciSegmentMultiSegLibPci.inf | 37 ++ .../BasePciSegmentMultiSegLibPci.uni | 14 + .../PciSegmentLib.c | 597 ++++++++++++++++++ .../BaseSiConfigBlockLib.c | 87 +++ .../BaseSiConfigBlockLib.inf | 32 + .../PeiDxeSmmReserveMmio64SizeLib.c | 22 + .../PeiDxeSmmReserveMmio64SizeLib.inf | 28 + .../PeiPostMemSiliconPolicyInitLib.c | 94 +++ .../PeiPostMemSiliconPolicyInitLib.inf | 39 ++ .../PeiPreMemSiliconPolicyInitLib.c | 98 +++ .../PeiPreMemSiliconPolicyInitLib.inf | 36 ++ 11 files changed, 1084 insertions(+) create mode 100644 Silicon/Intel/AlderlakeSiliconPkg/Library/BasePciSegmen= tMultiSegLibPci/BasePciSegmentMultiSegLibPci.inf create mode 100644 Silicon/Intel/AlderlakeSiliconPkg/Library/BasePciSegmen= tMultiSegLibPci/BasePciSegmentMultiSegLibPci.uni create mode 100644 Silicon/Intel/AlderlakeSiliconPkg/Library/BasePciSegmen= tMultiSegLibPci/PciSegmentLib.c create mode 100644 Silicon/Intel/AlderlakeSiliconPkg/Library/BaseSiConfigB= lockLib/BaseSiConfigBlockLib.c create mode 100644 Silicon/Intel/AlderlakeSiliconPkg/Library/BaseSiConfigB= lockLib/BaseSiConfigBlockLib.inf create mode 100644 Silicon/Intel/AlderlakeSiliconPkg/Library/PeiDxeSmmRese= rveMmio64SizeLib/PeiDxeSmmReserveMmio64SizeLib.c create mode 100644 Silicon/Intel/AlderlakeSiliconPkg/Library/PeiDxeSmmRese= rveMmio64SizeLib/PeiDxeSmmReserveMmio64SizeLib.inf create mode 100644 Silicon/Intel/AlderlakeSiliconPkg/Library/PeiPostMemSil= iconPolicyInitLib/PeiPostMemSiliconPolicyInitLib.c create mode 100644 Silicon/Intel/AlderlakeSiliconPkg/Library/PeiPostMemSil= iconPolicyInitLib/PeiPostMemSiliconPolicyInitLib.inf create mode 100644 Silicon/Intel/AlderlakeSiliconPkg/Library/PeiPreMemSili= conPolicyInitLib/PeiPreMemSiliconPolicyInitLib.c create mode 100644 Silicon/Intel/AlderlakeSiliconPkg/Library/PeiPreMemSili= conPolicyInitLib/PeiPreMemSiliconPolicyInitLib.inf diff --git a/Silicon/Intel/AlderlakeSiliconPkg/Library/BasePciSegmentMultiS= egLibPci/BasePciSegmentMultiSegLibPci.inf b/Silicon/Intel/AlderlakeSiliconP= kg/Library/BasePciSegmentMultiSegLibPci/BasePciSegmentMultiSegLibPci.inf new file mode 100644 index 0000000000..f3764d0187 --- /dev/null +++ b/Silicon/Intel/AlderlakeSiliconPkg/Library/BasePciSegmentMultiSegLi +++ bPci/BasePciSegmentMultiSegLibPci.inf @@ -0,0 +1,37 @@ +## @file +# Instance of PCI Segment Library based on PCI Library. +# +# PCI Segment Library that layers on top of the PCI Library which only=20 +# supports segment 0 and segment 1 PCI configuration access. +# +# Copyright (c) 2022, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D BasePciSegmentMultiSegLibPci + MODULE_UNI_FILE =3D BasePciSegmentMultiSegLibPci.uni + FILE_GUID =3D AC65B409-DF03-466e-8D2B-6FCE1079F0B2 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D PciSegmentLib + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC +# + +[Sources] + PciSegmentLib.c + +[Packages] + MdePkg/MdePkg.dec + AlderlakeSiliconPkg/SiPkg.dec + +[LibraryClasses] + BaseLib + PciLib + DebugLib + PcdLib diff --git a/Silicon/Intel/AlderlakeSiliconPkg/Library/BasePciSegmentMultiS= egLibPci/BasePciSegmentMultiSegLibPci.uni b/Silicon/Intel/AlderlakeSiliconP= kg/Library/BasePciSegmentMultiSegLibPci/BasePciSegmentMultiSegLibPci.uni new file mode 100644 index 0000000000..dd8d74bee8 --- /dev/null +++ b/Silicon/Intel/AlderlakeSiliconPkg/Library/BasePciSegmentMultiSegLi +++ bPci/BasePciSegmentMultiSegLibPci.uni @@ -0,0 +1,14 @@ +// /** @file +// Instance of PCI Segment Library based on PCI Library. +// +// PCI Segment Library that layers on top of the PCI Library which only=20 +// supports segment 0 and segment 1 PCI configuration access. +// +// Copyright (c) 2022, Intel Corporation. All rights reserved.
+// SPDX-License-Identifier: BSD-2-Clause-Patent +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "Instance of PCI S= egment Library based on PCI Library." + +#string STR_MODULE_DESCRIPTION #language en-US "PCI Segment Libra= ry that layers on top of the PCI Library which only supports segment 0 and = segment 1 PCI configuration access." diff --git a/Silicon/Intel/AlderlakeSiliconPkg/Library/BasePciSegmentMultiS= egLibPci/PciSegmentLib.c b/Silicon/Intel/AlderlakeSiliconPkg/Library/BasePc= iSegmentMultiSegLibPci/PciSegmentLib.c new file mode 100644 index 0000000000..9bcb388016 --- /dev/null +++ b/Silicon/Intel/AlderlakeSiliconPkg/Library/BasePciSegmentMultiSegLi +++ bPci/PciSegmentLib.c @@ -0,0 +1,597 @@ +/** @file + PCI Segment Library that layers on top of the PCI Library which only + supports segment 0 and segment 1 PCI configuration access. + + Copyright (c) 2022, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent **/ + +#include +#include +#include +#include +#include + +/** + Assert the validity of a PCI Segment address. + A valid PCI Segment address should not contain 1's in bits 28..31 and=20 +33..63 + and the segment should be 0 or 1. + + @param A The address to validate. + @param M Additional bits to assert to be zero. + +**/ +#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A,M) \ + ASSERT (((A) & (0xfffffffef0000000ULL | (M))) =3D=3D 0) + +/** + Convert the PCI Segment library address to PCI library address. + From ICL generation support the multiple segment, and the segment=20 +number start from BIT28, + So we convert the Segment Number offset from BIT32 to BIT28 + + @param A The address to convert. +**/ +#define PCI_SEGMENT_TO_PCI_ADDRESS(A) ((UINTN) (UINT32) ((A) |=20 +((RShiftU64 ((A) & BIT32, 4))))) + + + +/** + Reads an 8-bit PCI configuration register. + + Reads and returns the 8-bit PCI configuration register specified by Addr= ess. + This function must guarantee that all PCI read and write operations are = serialized. + + If any reserved bits in Address are set, then ASSERT(). + + @param Address The address that encodes the PCI Segment, Bus, Device,= Function, and Register. + + @return The 8-bit PCI configuration register specified by Address. + +**/ +UINT8 +EFIAPI +PciSegmentRead8 ( + IN UINT64 Address + ) +{ + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0); + + return PciRead8 (PCI_SEGMENT_TO_PCI_ADDRESS (Address)); } + +/** + Writes an 8-bit PCI configuration register. + + Writes the 8-bit PCI configuration register specified by Address with th= e value specified by Value. + Value is returned. This function must guarantee that all PCI read and w= rite operations are serialized. + + If any reserved bits in Address are set, then ASSERT(). + + @param Address The address that encodes the PCI Segment, Bus, Devic= e, Function, and Register. + @param Value The value to write. + + @return The value written to the PCI configuration register. + +**/ +UINT8 +EFIAPI +PciSegmentWrite8 ( + IN UINT64 Address, + IN UINT8 Value + ) +{ + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0); + + return PciWrite8 (PCI_SEGMENT_TO_PCI_ADDRESS (Address), Value); } + +/** + Performs a bitwise OR of an 8-bit PCI configuration register with an 8-b= it value. + + Reads the 8-bit PCI configuration register specified by Address, =20 + performs a bitwise OR between the read result and the value specified=20 + by OrData, and writes the result to the 8-bit PCI configuration register= specified by Address. + The value written to the PCI configuration register is returned. + This function must guarantee that all PCI read and write operations are = serialized. + + If any reserved bits in Address are set, then ASSERT(). + + @param Address The address that encodes the PCI Segment, Bus, Device,= Function, and Register. + @param OrData The value to OR with the PCI configuration register. + + @return The value written to the PCI configuration register. + +**/ +UINT8 +EFIAPI +PciSegmentOr8 ( + IN UINT64 Address, + IN UINT8 OrData + ) +{ + return PciWrite8 (PCI_SEGMENT_TO_PCI_ADDRESS (Address), (UINT8)=20 +(PciSegmentRead8 (Address) | OrData)); } + +/** + Performs a bitwise AND of an 8-bit PCI configuration register with an 8-= bit value. + + Reads the 8-bit PCI configuration register specified by Address, =20 + performs a bitwise AND between the read result and the value specified=20 + by AndData, and writes the result to the 8-bit PCI configuration registe= r specified by Address. + The value written to the PCI configuration register is returned. + This function must guarantee that all PCI read and write operations are = serialized. + If any reserved bits in Address are set, then ASSERT(). + + @param Address The address that encodes the PCI Segment, Bus, Device,= Function, and Register. + @param AndData The value to AND with the PCI configuration register. + + @return The value written to the PCI configuration register. + +**/ +UINT8 +EFIAPI +PciSegmentAnd8 ( + IN UINT64 Address, + IN UINT8 AndData + ) +{ + return PciSegmentWrite8 (Address, (UINT8) (PciSegmentRead8 (Address)=20 +& AndData)); } + +/** + Performs a bitwise AND of an 8-bit PCI configuration register with an=20 +8-bit value, + followed a bitwise OR with another 8-bit value. + + Reads the 8-bit PCI configuration register specified by Address, =20 + performs a bitwise AND between the read result and the value specified=20 + by AndData, performs a bitwise OR between the result of the AND=20 + operation and the value specified by OrData, and writes the result to th= e 8-bit PCI configuration register specified by Address. + The value written to the PCI configuration register is returned. + This function must guarantee that all PCI read and write operations are = serialized. + + If any reserved bits in Address are set, then ASSERT(). + + @param Address The address that encodes the PCI Segment, Bus, Device,= Function, and Register. + @param AndData The value to AND with the PCI configuration register. + @param OrData The value to OR with the PCI configuration register. + + @return The value written to the PCI configuration register. + +**/ +UINT8 +EFIAPI +PciSegmentAndThenOr8 ( + IN UINT64 Address, + IN UINT8 AndData, + IN UINT8 OrData + ) +{ + return PciSegmentWrite8 (Address, (UINT8) ((PciSegmentRead8 (Address)=20 +& AndData) | OrData)); } + +/** + Reads a 16-bit PCI configuration register. + + Reads and returns the 16-bit PCI configuration register specified by Add= ress. + This function must guarantee that all PCI read and write operations are = serialized. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 16-bit boundary, then ASSERT(). + + @param Address The address that encodes the PCI Segment, Bus, Device,= Function, and Register. + + @return The 16-bit PCI configuration register specified by Address. + +**/ +UINT16 +EFIAPI +PciSegmentRead16 ( + IN UINT64 Address + ) +{ + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1); + + return PciRead16 (PCI_SEGMENT_TO_PCI_ADDRESS (Address)); } + +/** + Writes a 16-bit PCI configuration register. + + Writes the 16-bit PCI configuration register specified by Address with t= he value specified by Value. + Value is returned. This function must guarantee that all PCI read and w= rite operations are serialized. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 16-bit boundary, then ASSERT(). + + @param Address The address that encodes the PCI Segment, Bus, Devic= e, Function, and Register. + @param Value The value to write. + + @return The parameter of Value. + +**/ +UINT16 +EFIAPI +PciSegmentWrite16 ( + IN UINT64 Address, + IN UINT16 Value + ) +{ + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1); + + return PciWrite16 (PCI_SEGMENT_TO_PCI_ADDRESS (Address), Value); } + +/** + Performs a bitwise OR of a 16-bit PCI configuration register with + a 16-bit value. + + Reads the 16-bit PCI configuration register specified by Address,=20 + performs a bitwise OR between the read result and the value specified=20 + by OrData, and writes the result to the 16-bit PCI configuration=20 + register specified by Address. The value written to the PCI=20 + configuration register is returned. This function must guarantee that=20 + all PCI read and write operations are serialized. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 16-bit boundary, then ASSERT(). + + @param Address The address that encodes the PCI Segment, Bus, Device, F= unction and + Register. + @param OrData The value to OR with the PCI configuration register. + + @return The value written back to the PCI configuration register. + +**/ +UINT16 +EFIAPI +PciSegmentOr16 ( + IN UINT64 Address, + IN UINT16 OrData + ) +{ + return PciSegmentWrite16 (Address, (UINT16) (PciSegmentRead16=20 +(Address) | OrData)); } + +/** + Performs a bitwise AND of a 16-bit PCI configuration register with a=20 +16-bit value, + followed a bitwise OR with another 16-bit value. + + Reads the 16-bit PCI configuration register specified by Address, =20 + performs a bitwise AND between the read result and the value specified=20 + by AndData, performs a bitwise OR between the result of the AND=20 + operation and the value specified by OrData, and writes the result to th= e 16-bit PCI configuration register specified by Address. + The value written to the PCI configuration register is returned. + This function must guarantee that all PCI read and write operations are = serialized. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 16-bit boundary, then ASSERT(). + + @param Address The address that encodes the PCI Segment, Bus, Device,= Function, and Register. + @param AndData The value to AND with the PCI configuration register. + @param OrData The value to OR with the PCI configuration register. + + @return The value written to the PCI configuration register. + +**/ +UINT16 +EFIAPI +PciSegmentAndThenOr16 ( + IN UINT64 Address, + IN UINT16 AndData, + IN UINT16 OrData + ) +{ + return PciSegmentWrite16 (Address, (UINT16) ((PciSegmentRead16=20 +(Address) & AndData) | OrData)); } + +/** + Reads a 32-bit PCI configuration register. + + Reads and returns the 32-bit PCI configuration register specified by Add= ress. + This function must guarantee that all PCI read and write operations are = serialized. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 32-bit boundary, then ASSERT(). + + @param Address The address that encodes the PCI Segment, Bus, Device,= Function, and Register. + + @return The 32-bit PCI configuration register specified by Address. + +**/ +UINT32 +EFIAPI +PciSegmentRead32 ( + IN UINT64 Address + ) +{ + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 3); + + return PciRead32 (PCI_SEGMENT_TO_PCI_ADDRESS (Address)); } + +/** + Writes a 32-bit PCI configuration register. + + Writes the 32-bit PCI configuration register specified by Address with t= he value specified by Value. + Value is returned. This function must guarantee that all PCI read and w= rite operations are serialized. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 32-bit boundary, then ASSERT(). + + @param Address The address that encodes the PCI Segment, Bus, Devic= e, Function, and Register. + @param Value The value to write. + + @return The parameter of Value. + +**/ +UINT32 +EFIAPI +PciSegmentWrite32 ( + IN UINT64 Address, + IN UINT32 Value + ) +{ + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 3); + + return PciWrite32 (PCI_SEGMENT_TO_PCI_ADDRESS (Address), Value); } + +/** + Performs a bitwise OR of a 32-bit PCI configuration register with a 32-b= it value. + + Reads the 32-bit PCI configuration register specified by Address, =20 + performs a bitwise OR between the read result and the value specified=20 + by OrData, and writes the result to the 32-bit PCI configuration registe= r specified by Address. + The value written to the PCI configuration register is returned. + This function must guarantee that all PCI read and write operations are = serialized. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 32-bit boundary, then ASSERT(). + + @param Address The address that encodes the PCI Segment, Bus, Device,= Function, and Register. + @param OrData The value to OR with the PCI configuration register. + + @return The value written to the PCI configuration register. + +**/ +UINT32 +EFIAPI +PciSegmentOr32 ( + IN UINT64 Address, + IN UINT32 OrData + ) +{ + return PciSegmentWrite32 (Address, PciSegmentRead32 (Address) |=20 +OrData); } + +/** + Performs a bitwise AND of a 32-bit PCI configuration register with a=20 +32-bit value, + followed a bitwise OR with another 32-bit value. + + Reads the 32-bit PCI configuration register specified by Address, =20 + performs a bitwise AND between the read result and the value specified=20 + by AndData, performs a bitwise OR between the result of the AND=20 + operation and the value specified by OrData, and writes the result to th= e 32-bit PCI configuration register specified by Address. + The value written to the PCI configuration register is returned. + This function must guarantee that all PCI read and write operations are = serialized. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 32-bit boundary, then ASSERT(). + + @param Address The address that encodes the PCI Segment, Bus, Device,= Function, and Register. + @param AndData The value to AND with the PCI configuration register. + @param OrData The value to OR with the PCI configuration register. + + @return The value written to the PCI configuration register. + +**/ +UINT32 +EFIAPI +PciSegmentAndThenOr32 ( + IN UINT64 Address, + IN UINT32 AndData, + IN UINT32 OrData + ) +{ + return PciSegmentWrite32 (Address, (PciSegmentRead32 (Address) &=20 +AndData) | OrData); } +/** + Reads a range of PCI configuration registers into a caller supplied buff= er. + + Reads the range of PCI configuration registers specified by=20 + StartAddress and Size into the buffer specified by Buffer. This=20 + function only allows the PCI configuration registers from a single=20 + PCI function to be read. Size is returned. When possible 32-bit PCI=20 + configuration read cycles are used to read from StartAdress to=20 + StartAddress + Size. Due to alignment restrictions, 8-bit and 16-bit=20 + PCI configuration read cycles may be used at the beginning and the end o= f the range. + + If any reserved bits in StartAddress are set, then ASSERT(). + If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). + If Size > 0 and Buffer is NULL, then ASSERT(). + + @param StartAddress The starting address that encodes the PCI Segment,= Bus, Device, + Function and Register. + @param Size The size in bytes of the transfer. + @param Buffer The pointer to a buffer receiving the data read. + + @return Size + +**/ +UINTN +EFIAPI +PciSegmentReadBuffer ( + IN UINT64 StartAddress, + IN UINTN Size, + OUT VOID *Buffer + ) +{ + UINTN ReturnValue; + + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (StartAddress, 0); ASSERT=20 + (((StartAddress & 0xFFF) + Size) <=3D 0x1000); + + if (Size =3D=3D 0) { + return Size; + } + + ASSERT (Buffer !=3D NULL); + if (Buffer =3D=3D NULL) { + return 0; + } + + // + // Save Size for return + // + ReturnValue =3D Size; + + if ((StartAddress & BIT0) !=3D 0) { + // + // Read a byte if StartAddress is byte aligned + // + *(volatile UINT8 *)Buffer =3D PciSegmentRead8 (StartAddress); + StartAddress +=3D sizeof (UINT8); + Size -=3D sizeof (UINT8); + Buffer =3D (UINT8*)Buffer + 1; + } + + if (Size >=3D sizeof (UINT16) && (StartAddress & BIT1) !=3D 0) { + // + // Read a word if StartAddress is word aligned + // + WriteUnaligned16 (Buffer, PciSegmentRead16 (StartAddress)); + StartAddress +=3D sizeof (UINT16); + Size -=3D sizeof (UINT16); + Buffer =3D (UINT16*)Buffer + 1; + } + + while (Size >=3D sizeof (UINT32)) { + // + // Read as many double words as possible + // + WriteUnaligned32 (Buffer, PciSegmentRead32 (StartAddress)); + StartAddress +=3D sizeof (UINT32); + Size -=3D sizeof (UINT32); + Buffer =3D (UINT32*)Buffer + 1; + } + + if (Size >=3D sizeof (UINT16)) { + // + // Read the last remaining word if exist + // + WriteUnaligned16 (Buffer, PciSegmentRead16 (StartAddress)); + StartAddress +=3D sizeof (UINT16); + Size -=3D sizeof (UINT16); + Buffer =3D (UINT16*)Buffer + 1; + } + + if (Size >=3D sizeof (UINT8)) { + // + // Read the last remaining byte if exist + // + *(volatile UINT8 *)Buffer =3D PciSegmentRead8 (StartAddress); } + + return ReturnValue; +} + +/** + Copies the data in a caller supplied buffer to a specified range of=20 +PCI + configuration space. + + Writes the range of PCI configuration registers specified by=20 + StartAddress and Size from the buffer specified by Buffer. This=20 + function only allows the PCI configuration registers from a single=20 + PCI function to be written. Size is returned. When possible 32-bit=20 + PCI configuration write cycles are used to write from StartAdress to=20 + StartAddress + Size. Due to alignment restrictions, 8-bit and 16-bit=20 + PCI configuration write cycles may be used at the beginning and the end = of the range. + + If any reserved bits in StartAddress are set, then ASSERT(). + If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). + If Size > 0 and Buffer is NULL, then ASSERT(). + + @param StartAddress The starting address that encodes the PCI Segment,= Bus, Device, + Function and Register. + @param Size The size in bytes of the transfer. + @param Buffer The pointer to a buffer containing the data to wri= te. + + @return The parameter of Size. + +**/ +UINTN +EFIAPI +PciSegmentWriteBuffer ( + IN UINT64 StartAddress, + IN UINTN Size, + IN VOID *Buffer + ) +{ + UINTN ReturnValue; + + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (StartAddress, 0); ASSERT=20 + (((StartAddress & 0xFFF) + Size) <=3D 0x1000); + + if (Size =3D=3D 0) { + return 0; + } + + ASSERT (Buffer !=3D NULL); + if (Buffer =3D=3D NULL) { + return 0; + } + + // + // Save Size for return + // + ReturnValue =3D Size; + + if ((StartAddress & BIT0) !=3D 0) { + // + // Write a byte if StartAddress is byte aligned + // + PciSegmentWrite8 (StartAddress, *(UINT8*) Buffer); + StartAddress +=3D sizeof (UINT8); + Size -=3D sizeof (UINT8); + Buffer =3D (UINT8*) Buffer + 1; + } + + if (Size >=3D sizeof (UINT16) && (StartAddress & BIT1) !=3D 0) { + // + // Write a word if StartAddress is word aligned + // + PciSegmentWrite16 (StartAddress, ReadUnaligned16 (Buffer)); + StartAddress +=3D sizeof (UINT16); + Size -=3D sizeof (UINT16); + Buffer =3D (UINT16*) Buffer + 1; + } + + while (Size >=3D sizeof (UINT32)) { + // + // Write as many double words as possible + // + PciSegmentWrite32 (StartAddress, ReadUnaligned32 (Buffer)); + StartAddress +=3D sizeof (UINT32); + Size -=3D sizeof (UINT32); + Buffer =3D (UINT32*) Buffer + 1; + } + + if (Size >=3D sizeof (UINT16)) { + // + // Write the last remaining word if exist + // + PciSegmentWrite16 (StartAddress, ReadUnaligned16 (Buffer)); + StartAddress +=3D sizeof (UINT16); + Size -=3D sizeof (UINT16); + Buffer =3D (UINT16*) Buffer + 1; + } + + if (Size >=3D sizeof (UINT8)) { + // + // Write the last remaining byte if exist + // + PciSegmentWrite8 (StartAddress, *(UINT8*) Buffer); } + + return ReturnValue; +} diff --git a/Silicon/Intel/AlderlakeSiliconPkg/Library/BaseSiConfigBlockLib= /BaseSiConfigBlockLib.c b/Silicon/Intel/AlderlakeSiliconPkg/Library/BaseSiC= onfigBlockLib/BaseSiConfigBlockLib.c new file mode 100644 index 0000000000..93290d8371 --- /dev/null +++ b/Silicon/Intel/AlderlakeSiliconPkg/Library/BaseSiConfigBlockLib/Bas +++ eSiConfigBlockLib.c @@ -0,0 +1,87 @@ +/** @file + This file is BaseSiConfigBlockLib library is used to add config=20 +blocks + to config block header. + + Copyright (c) 2022, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include=20 + #include #include=20 + #include #include=20 + #include + + +/** + GetComponentConfigBlockTotalSize get config block table total size. + + @param[in] ComponentBlocks Component blocks array + @param[in] TotalBlockCount Number of blocks + + @retval Size of config block table +**/ +UINT16 +EFIAPI +GetComponentConfigBlockTotalSize ( + IN COMPONENT_BLOCK_ENTRY *ComponentBlocks, + IN UINT16 TotalBlockCount + ) +{ + UINT16 TotalBlockSize; + UINT16 BlockCount; + + TotalBlockSize =3D 0; + for (BlockCount =3D 0 ; BlockCount < TotalBlockCount; BlockCount++) { + TotalBlockSize +=3D (UINT32) ComponentBlocks[BlockCount].Size; } + + return TotalBlockSize; +} + +/** + AddComponentConfigBlocks add all config blocks. + + @param[in] ConfigBlockTableAddress The pointer to add config blocks + @param[in] ComponentBlocks Config blocks array + @param[in] TotalBlockCount Number of blocks + + @retval EFI_SUCCESS The policy default is initialized. + @retval EFI_OUT_OF_RESOURCES Insufficient resources to create b= uffer +**/ +EFI_STATUS +EFIAPI +AddComponentConfigBlocks ( + IN VOID *ConfigBlockTableAddress, + IN COMPONENT_BLOCK_ENTRY *ComponentBlocks, + IN UINT16 TotalBlockCount + ) +{ + UINT16 BlockCount; + VOID *ConfigBlockPointer; + CONFIG_BLOCK ConfigBlockBuf; + EFI_STATUS Status; + + Status =3D EFI_SUCCESS; + + // + // Initialize ConfigBlockPointer to NULL + // + ConfigBlockPointer =3D NULL; + // + // Loop to identify each config block from ComponentBlocks[] Table=20 +and add each of them + // + for (BlockCount =3D 0; BlockCount < TotalBlockCount; BlockCount++) { + ZeroMem (&ConfigBlockBuf, sizeof (CONFIG_BLOCK)); + CopyMem (&(ConfigBlockBuf.Header.GuidHob.Name), ComponentBlocks[BlockC= ount].Guid, sizeof (EFI_GUID)); + ConfigBlockBuf.Header.GuidHob.Header.HobLength =3D ComponentBlocks[Blo= ckCount].Size; + ConfigBlockBuf.Header.Revision =3D ComponentBlocks[Blo= ckCount].Revision; + ConfigBlockPointer =3D (VOID *)&ConfigBlockBuf; + Status =3D AddConfigBlock ((VOID *)ConfigBlockTableAddress, (VOID *)&C= onfigBlockPointer); + ASSERT_EFI_ERROR (Status); + if (ComponentBlocks[BlockCount].LoadDefault !=3D NULL) { + ComponentBlocks[BlockCount].LoadDefault (ConfigBlockPointer); + } + } + return Status; +} diff --git a/Silicon/Intel/AlderlakeSiliconPkg/Library/BaseSiConfigBlockLib= /BaseSiConfigBlockLib.inf b/Silicon/Intel/AlderlakeSiliconPkg/Library/BaseS= iConfigBlockLib/BaseSiConfigBlockLib.inf new file mode 100644 index 0000000000..097095ef0d --- /dev/null +++ b/Silicon/Intel/AlderlakeSiliconPkg/Library/BaseSiConfigBlockLib/Bas +++ eSiConfigBlockLib.inf @@ -0,0 +1,32 @@ +## @file +# Component description file for the BaseSiConfigBlockLib library. +# +# Copyright (c) 2022, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +[Defines] +INF_VERSION =3D 0x00010017 +BASE_NAME =3D BaseSiConfigBlockLib +FILE_GUID =3D 6C068D0F-F48E-48CB-B369-433E507AF4A2 +VERSION_STRING =3D 1.0 +MODULE_TYPE =3D BASE +LIBRARY_CLASS =3D SiConfigBlockLib + + +[LibraryClasses] +DebugLib +IoLib +ConfigBlockLib + + +[Packages] +MdePkg/MdePkg.dec +AlderlakeSiliconPkg/SiPkg.dec + + +[Sources] +BaseSiConfigBlockLib.c + + diff --git a/Silicon/Intel/AlderlakeSiliconPkg/Library/PeiDxeSmmReserveMmio= 64SizeLib/PeiDxeSmmReserveMmio64SizeLib.c b/Silicon/Intel/AlderlakeSiliconP= kg/Library/PeiDxeSmmReserveMmio64SizeLib/PeiDxeSmmReserveMmio64SizeLib.c new file mode 100644 index 0000000000..90d6be2feb --- /dev/null +++ b/Silicon/Intel/AlderlakeSiliconPkg/Library/PeiDxeSmmReserveMmio64Si +++ zeLib/PeiDxeSmmReserveMmio64SizeLib.c @@ -0,0 +1,22 @@ +/** @file + PEI/DXE/SMM library for reserved 64-bit MMIO space. + + Copyright (c) 2022, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent **/ + +#include +#include + +/** + The function return the 64 bit MMIO size to reserve. + + @retval The 64-bit MMIO size +**/ +UINT64 +ReserveMmio64Size ( + VOID + ) +{ + return 0; +} \ No newline at end of file diff --git a/Silicon/Intel/AlderlakeSiliconPkg/Library/PeiDxeSmmReserveMmio= 64SizeLib/PeiDxeSmmReserveMmio64SizeLib.inf b/Silicon/Intel/AlderlakeSilico= nPkg/Library/PeiDxeSmmReserveMmio64SizeLib/PeiDxeSmmReserveMmio64SizeLib.in= f new file mode 100644 index 0000000000..ed2b7d6d50 --- /dev/null +++ b/Silicon/Intel/AlderlakeSiliconPkg/Library/PeiDxeSmmReserveMmio64Si +++ zeLib/PeiDxeSmmReserveMmio64SizeLib.inf @@ -0,0 +1,28 @@ +## @file +# PEI/DXE/SMM library for reserved 64-bit MMIO space. +# +# All function in this library is available for PEI, DXE, and SMM, #=20 +But do not support UEFI RUNTIME environment call. +# +# Copyright (c) 2022, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] +INF_VERSION =3D 0x00010017 +BASE_NAME =3D PeiDxeSmmReserveMmio64Size +FILE_GUID =3D 4CF5E3F4-025A-48CA-8E97-7B2BD5D4391F +VERSION_STRING =3D 1.0 +MODULE_TYPE =3D BASE +LIBRARY_CLASS =3D PeiDxeSmmReserveMmio64Size + +[LibraryClasses] + +[Packages] +MdePkg/MdePkg.dec +AlderlakeSiliconPkg/SiPkg.dec + +[Sources] +PeiDxeSmmReserveMmio64SizeLib.c + +[Pcd] diff --git a/Silicon/Intel/AlderlakeSiliconPkg/Library/PeiPostMemSiliconPol= icyInitLib/PeiPostMemSiliconPolicyInitLib.c b/Silicon/Intel/AlderlakeSilico= nPkg/Library/PeiPostMemSiliconPolicyInitLib/PeiPostMemSiliconPolicyInitLib.= c new file mode 100644 index 0000000000..a9d6c7e265 --- /dev/null +++ b/Silicon/Intel/AlderlakeSiliconPkg/Library/PeiPostMemSiliconPolicyI +++ nitLib/PeiPostMemSiliconPolicyInitLib.c @@ -0,0 +1,94 @@ +/** @file + This library initialize Silicon Policy for PostMemory. + + Copyright (c) 2022, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include=20 + #include #include=20 + #include #include=20 + #include + +/** + Performs silicon post-mem policy initialization. + + The returned data must be used as input data for=20 + SiliconPolicyDonePostMem (), and SiliconPolicyUpdateLib.SiliconPolicyUpd= atePostMem (). + + @param[in, out] Policy Pointer to policy. + @return the initialized policy. +**/ +VOID * +EFIAPI +SiliconPolicyInitPostMem ( + IN OUT VOID *Policy + ) +{ + EFI_STATUS Status; + SI_POLICY_PPI *SiPolicyPpi; + PEI_SI_DEFAULT_POLICY_INIT_PPI *PeiSiDefaultPolicyInitPpi; + + DEBUG ((DEBUG_INFO, "Silicon PEI Policy Initialization Start in=20 + Post-Memory...\n")); + + ASSERT (Policy =3D=3D NULL); + SiPolicyPpi =3D NULL; + PeiSiDefaultPolicyInitPpi =3D NULL; + + // + // Locate Policy init PPI to install default silicon policy // =20 + Status =3D PeiServicesLocatePpi ( + &gSiDefaultPolicyInitPpiGuid, + 0, + NULL, + (VOID **) &PeiSiDefaultPolicyInitPpi + ); + ASSERT_EFI_ERROR (Status); + if (PeiSiDefaultPolicyInitPpi !=3D NULL) { + Status =3D PeiSiDefaultPolicyInitPpi->PeiPolicyInit (); + ASSERT_EFI_ERROR (Status); + if (Status =3D=3D EFI_SUCCESS) { + Status =3D PeiServicesLocatePpi ( + &gSiPolicyPpiGuid, + 0, + NULL, + (VOID **) &SiPolicyPpi + ); + ASSERT_EFI_ERROR (Status); + } + } + + if (SiPolicyPpi =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "Fail to create default policy!\n")); + return NULL; + } + + + return SiPolicyPpi; +} + +/** + The silicon post-mem policy is finalized. + Silicon code can do initialization based upon the policy data. + + The input Policy must be returned by SiliconPolicyInitPostMem(). + + @param[in] Policy Pointer to policy. + @retval RETURN_SUCCESS The policy is handled consumed by silicon code. +**/ +RETURN_STATUS +EFIAPI +SiliconPolicyDonePostMem ( + IN VOID *Policy + ) +{ + EFI_STATUS Status; + + Status =3D SiInstallPolicyReadyPpi (); + ASSERT_EFI_ERROR (Status); + DEBUG ((DEBUG_INFO, "Silicon PEI Policy Initialization Done in=20 + Post-Memory\n")); + + return Status; +} diff --git a/Silicon/Intel/AlderlakeSiliconPkg/Library/PeiPostMemSiliconPol= icyInitLib/PeiPostMemSiliconPolicyInitLib.inf b/Silicon/Intel/AlderlakeSili= conPkg/Library/PeiPostMemSiliconPolicyInitLib/PeiPostMemSiliconPolicyInitLi= b.inf new file mode 100644 index 0000000000..62184b39d2 --- /dev/null +++ b/Silicon/Intel/AlderlakeSiliconPkg/Library/PeiPostMemSiliconPolicyI +++ nitLib/PeiPostMemSiliconPolicyInitLib.inf @@ -0,0 +1,39 @@ +## @file +# Component information file for Silicon Policy Init Library # This=20 +library implements Silicon Policy Initialization for PostMemory. +# +# Copyright (c) 2022, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D PeiPostMemSiliconPolicyInitLib + FILE_GUID =3D 20B51FFB-93D3-4546-9F13-2C91AEEF9212 + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D SiliconPolicyInitLib + +[LibraryClasses] + BaseLib + PcdLib + PeiServicesLib + DebugLib + SiPolicyLib + +[Packages] + MdePkg/MdePkg.dec + AlderlakeSiliconPkg/SiPkg.dec + +[Sources] + PeiPostMemSiliconPolicyInitLib.c + +[Pcd] + gSiPkgTokenSpaceGuid.PcdDumpDefaultSiliconPolicy + +[Ppis] + gSiDefaultPolicyInitPpiGuid + gEfiPeiMpServicesPpiGuid + +[Depex] + gSiDefaultPolicyInitPpiGuid diff --git a/Silicon/Intel/AlderlakeSiliconPkg/Library/PeiPreMemSiliconPoli= cyInitLib/PeiPreMemSiliconPolicyInitLib.c b/Silicon/Intel/AlderlakeSiliconP= kg/Library/PeiPreMemSiliconPolicyInitLib/PeiPreMemSiliconPolicyInitLib.c new file mode 100644 index 0000000000..74fb47a73d --- /dev/null +++ b/Silicon/Intel/AlderlakeSiliconPkg/Library/PeiPreMemSiliconPolicyIn +++ itLib/PeiPreMemSiliconPolicyInitLib.c @@ -0,0 +1,98 @@ +/** @file + This library initialize Silicon Policy for PreMemory. + + Copyright (c) 2022, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include=20 + #include #include=20 + #include #include=20 + + + +/** + Performs silicon pre-mem policy initialization. + + The returned data must be used as input data for=20 + SiliconPolicyDonePreMem (), and SiliconPolicyUpdateLib.SiliconPolicyUpda= tePreMem (). + + @param[in, out] Policy Pointer to policy. + @return the initialized policy. +**/ +VOID * +EFIAPI +SiliconPolicyInitPreMem ( + IN OUT VOID *Policy + ) +{ + EFI_STATUS Status; + SI_PREMEM_POLICY_PPI *SiPreMemPolicyPpi; + PEI_PREMEM_SI_DEFAULT_POLICY_INIT_PPI =20 +*PeiPreMemSiDefaultPolicyInitPpi; + + DEBUG ((DEBUG_INFO, "Silicon PEI Policy Initialization Start in=20 + Pre-Memory...\n")); + + ASSERT (Policy =3D=3D NULL); + SiPreMemPolicyPpi =3D NULL; + PeiPreMemSiDefaultPolicyInitPpi =3D NULL; + + // + // Locate Policy init PPI to install default silicon policy // =20 + Status =3D PeiServicesLocatePpi ( + &gSiPreMemDefaultPolicyInitPpiGuid, + 0, + NULL, + (VOID **) &PeiPreMemSiDefaultPolicyInitPpi + ); + ASSERT_EFI_ERROR (Status); + if (PeiPreMemSiDefaultPolicyInitPpi !=3D NULL) { + Status =3D PeiPreMemSiDefaultPolicyInitPpi->PeiPreMemPolicyInit (); + ASSERT_EFI_ERROR (Status); + if (Status =3D=3D EFI_SUCCESS) { + Status =3D PeiServicesLocatePpi ( + &gSiPreMemPolicyPpiGuid, + 0, + NULL, + (VOID **) &SiPreMemPolicyPpi + ); + ASSERT_EFI_ERROR (Status); + } + } + + if (SiPreMemPolicyPpi =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "Fail to create default policy!\n")); + return NULL; + } + + return SiPreMemPolicyPpi; +} + +/** + The silicon pre-mem policy is finalized. + Silicon code can do initialization based upon the policy data. + + The input Policy must be returned by SiliconPolicyInitPreMem(). + + @param[in] Policy Pointer to policy. + @retval RETURN_SUCCESS The policy is handled consumed by silicon code. +**/ +RETURN_STATUS +EFIAPI +SiliconPolicyDonePreMem ( + IN VOID *Policy + ) +{ + EFI_STATUS Status; + // + // Install PreMem Policy Ready PPI + // While installs PreMemPolicyReadyPpi, RC assumes the Policy is=20 +ready and finalized. So please + // update and override any setting before calling this function. + // + Status =3D SiPreMemInstallPolicyReadyPpi (); + ASSERT_EFI_ERROR (Status); + + DEBUG ((DEBUG_INFO, "Silicon PEI Policy Initialization Done in=20 + Pre-Memory\n")); + + return Status; +} diff --git a/Silicon/Intel/AlderlakeSiliconPkg/Library/PeiPreMemSiliconPoli= cyInitLib/PeiPreMemSiliconPolicyInitLib.inf b/Silicon/Intel/AlderlakeSilico= nPkg/Library/PeiPreMemSiliconPolicyInitLib/PeiPreMemSiliconPolicyInitLib.in= f new file mode 100644 index 0000000000..d5ce714ce5 --- /dev/null +++ b/Silicon/Intel/AlderlakeSiliconPkg/Library/PeiPreMemSiliconPolicyIn +++ itLib/PeiPreMemSiliconPolicyInitLib.inf @@ -0,0 +1,36 @@ +## @file +# Component information file for Silicon Policy Init Library # This=20 +library implements Silicon Policy Initialization for PreMemory. +# +# Copyright (c) 2022, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D PeiPreMemSiliconPolicyInitLib + FILE_GUID =3D 1FB4B175-0BB6-4137-A4AC-EA48FCE83862 + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D SiliconPolicyInitLib + +[LibraryClasses] + BaseLib + PeiServicesLib + DebugLib + SiPolicyLib + +[Packages] + MdePkg/MdePkg.dec + AlderlakeSiliconPkg/SiPkg.dec + +[Sources] + PeiPreMemSiliconPolicyInitLib.c + +[Pcd] + +[Ppis] + gSiPreMemDefaultPolicyInitPpiGuid + +[Depex] + gSiPreMemDefaultPolicyInitPpiGuid -- 2.36.1.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 (#107144): https://edk2.groups.io/g/devel/message/107144 Mute This Topic: https://groups.io/mt/99554471/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-