From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web11.2420.1686030487002877309 for ; Mon, 05 Jun 2023 22:48:07 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=bmIvxDXQ; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: ray.ni@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686030486; x=1717566486; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=DcCl75OA+vGJmGzGZ7HrvXJIximSdJt1IgFr5Z6kAuU=; b=bmIvxDXQntBqC10nIVSlQO2bwIiU9gNLwezymM+5Mjx2e8bxxdSlJ0ur vZOZHBdqNLOSEjUbqiTA7/YGAb77MoT98QAtPhUQdCP/IDXV+IOe36gxN SoyjHtIg/6ShQRbXu5btcAy5eZPlw9k8Rv544zIBN4VF2iL2K52u8KV0f Ma8SRoN1WaMi3Mmy4byzbRIWD6e42W1Scc30Ychz5/zSLVEcjJFhf9Xei FqUQOi3V/df58lkgS9IA0Kc75vjYUnUu0rbIT7/HqacduqZup/gkWaXzM 4hbZ9QeIVAwahR9S3sQnA+ZaQgy9gK/GYTnrzK30eHkKA7KuiOzrUnvP7 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="384878396" X-IronPort-AV: E=Sophos;i="6.00,219,1681196400"; d="scan'208";a="384878396" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 22:48:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="883192115" X-IronPort-AV: E=Sophos;i="6.00,219,1681196400"; d="scan'208";a="883192115" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga005.jf.intel.com with ESMTP; 05 Jun 2023 22:47:53 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 5 Jun 2023 22:47:53 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Mon, 5 Jun 2023 22:47:53 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.107) 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.23; Mon, 5 Jun 2023 22:47:51 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nx6VSA4UOx+I3ud2He5yUrpQrkPfxS+3V/vVNPXSnHyYIBbxAvyKurVtOsXXVeJ9wzOQGPXb/wLVUleVuOXuTdKv3l+qKQTa1wC7ol4m3hv4CeOiSaUXRwALKOJ30Vej2+y5UzjRwVgPBS4JAHdY1RX6jUbSjgR04FtdMfxqitaPQSqgAInxRwUSwE4yNKajd+bZoxJEjFOGzEa+eGivPyC5GF0gnsSIW1lCLLn3nIR6kaBkf30AyCmlVxsQSEILUSSs6AbXMvMWoWuJX0lVst+yYQaaB/L0eh9DIwlOZhM6A76vQ//9MJjAAoAWmpa54snTu/TBwwJNF3j6HRk5FQ== 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=Ty61cmH4TKrxlscIumG/bwbaiOp4awLRgDWkGivbZ3k=; b=mhvTsFtjhcx5bS5EJvX/olNBbKuEO7xBah3RIZZtuNDGfoP+epezrCqzXVA5Utc+yYlttXwlJgEcz764fl0xG2BGu4OiT3nIDLxHqBfTE0Bor/Uw/SOyP5h7sa+Nhd5fDWLabvt9OXq1Pmrnljhxu17ZuZw8oeQyMeymJG5TC/0xWm4C1QmUAqiXgWJBrDqogkind1YYZBFH+fQwqSx8KhGRIHWcZ5o69iIoU63UZP0BGIOtWVbF09ufIDxe2aA7L1xCdB8dIa3fBNf5yOxEHCsc2EODqqzipkFYvxMtgkFbMqnGsgL7Ds+C7JopmOZ9Qzj9Ai4cc+m6hfcZ+IHUOg== 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 Received: from MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by PH7PR11MB8249.namprd11.prod.outlook.com (2603:10b6:510:1a7::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 6 Jun 2023 05:47:46 +0000 Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::892b:b8e6:bab7:635d]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::892b:b8e6:bab7:635d%3]) with mapi id 15.20.6455.027; Tue, 6 Jun 2023 05:47:46 +0000 From: "Ni, Ray" To: "devel@edk2.groups.io" , "Liu, Zhiguang" CC: "Kinney, Michael D" , Michael Kubacki , Sean Brogan Subject: Re: [edk2-devel] [PATCH v2] UnitTestFrameworkPkg: Add UnitTestPeiServicesTablePointerLib Thread-Topic: [edk2-devel] [PATCH v2] UnitTestFrameworkPkg: Add UnitTestPeiServicesTablePointerLib Thread-Index: AQHZmDmEwpCk1I0pv0GyWx2XFwbIQK99RFeA Date: Tue, 6 Jun 2023 05:47:45 +0000 Message-ID: References: <20230606054001.1289-1-zhiguang.liu@intel.com> In-Reply-To: <20230606054001.1289-1-zhiguang.liu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN6PR11MB8244:EE_|PH7PR11MB8249:EE_ x-ms-office365-filtering-correlation-id: f56e5a1e-cad7-4753-f7b0-08db66518dc5 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: rEk01lPM1KtNNdVua3lLfEtSA5qXxk/cIxkOxGv7l9W6PI3GGXdEhE6V2LK3WiKEl3H7SryLMWsX/RVJIQYbSRv57Kby/8dCA1eqpVLhRBOQkFglOht+5oeYT5yn7Hm0qTFXjKGTbEB65nqeGBdBR1BkWpx8lQAZf3DKm3M191otqIYv4qZppC9Brkn6bscda1B9Y9sAsuSWK577dixJ+mCDm2h7Z0Q97mRV1BCViGjrYMxvLO7xYjgCBBMyshBxnTnukLji3GuXoQ6a2YD4QOk56IeRcdic3m3yR0UYI76zoKAsaJde9pOMeq9acWxWSyymLGKvVbpYkCbkS/QrG4GtsrYGaQiiccmAPFAo03MFsM+alKPRyGFBzwnKW7XDoyWh8Oi8PK+aKX/GtWRdNoN10kt5tRTTAAC2jW8SwkpNB2Okat+xyqQO8aL2HHVAe6O6HEGYqKVF0JItfYDv+H7DyYOZb4thAnUnE9CP5i+Ppsam6Q19J862nC/k5khve6whCLrFT85QFxGn7PEIycD//Y2xpLRgQWL7+LM+tbCzTK+cy5Wz0XeWNcFZUsiXXLYuVU7N1r8yBg+l+1LOMFNdxvQ4FUEsDclqUlJx8czH9TiBxV5CUVGIo+QE47kbaHX9Bt2Hw4ypwGWaT1PK0KzdUq+H+yvtJq4Z8aZyY/M= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN6PR11MB8244.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(376002)(39860400002)(346002)(396003)(136003)(366004)(451199021)(53546011)(9686003)(7696005)(6506007)(38100700002)(41300700001)(26005)(186003)(966005)(83380400001)(71200400001)(66899021)(478600001)(110136005)(19627235002)(54906003)(64756008)(66476007)(66446008)(66556008)(6636002)(55016003)(82960400001)(316002)(76116006)(66946007)(122000001)(5660300002)(4326008)(8676002)(52536014)(8936002)(2906002)(30864003)(33656002)(38070700005)(86362001)(213903007)(579004)(559001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?6sJrC0GWmAtJ82WqpYPLcYpisE67IOZuigNinT76jrcBOcxVJ37SeUGS/5p9?= =?us-ascii?Q?A38p9+HavoDL7ZEe0ZrSPQj/wEEpWttdqPmQWliF1UUzGCYFdtszEzcMrLT2?= =?us-ascii?Q?8dcwiZdFLqLObfRe+7VRT5D1yDS0AwV4TCuelPJqj/WOFH76KJZxWvF7Arv/?= =?us-ascii?Q?zra52RzuASmyXGbmPTZyRvmITTSmfedZCCOUsiWmHmXuNYVldsQctU3AIc6a?= =?us-ascii?Q?hbWfj6v9k3V2LMUv6lnJDE0gKyJKnmMKyOrKJQ4vAy27ovKAB+edMCS9WUCC?= =?us-ascii?Q?b/7J3Re1XthrxuPGcLU+eFUzONz05l3G/kUMpny0DjbDF6BkJWAg9YiBFkQ9?= =?us-ascii?Q?Be3MTk8fHUnHpLHrM/Z7GoI915xTEqQ3sIC8/o7iUUwJEmW+XVAqQgPC/ehe?= =?us-ascii?Q?SHTY/CWoYTJFfIGt1wNgQFh8wPowS2BhOkGmiOPJf8V5+Zr+9oBbj46i/lSq?= =?us-ascii?Q?TU7zKUEADNPHbUbFb+RvlJflFMJulJC3VT6ntPukxUI9bDqRy+HFX5bxBvgU?= =?us-ascii?Q?hzM/TmbNyTianjX1iW+mCzraX6ovTbvyWHlC2zKQ4GLoFh8gQBxI9IGRKSxk?= =?us-ascii?Q?1h1+uGpC2kd7xu7ZB4aV4ejuNvPBFeASaeOO+kmSRMo9mQfXqT2r+acxBHx8?= =?us-ascii?Q?cYobfqV6R01dzEUpjCMyJpcoUQlz4vyXA61W+iBRBeWxRyzE1vkPjNDzTyfA?= =?us-ascii?Q?SPsKN4Kvp1d5bph5nXmz4p2HJRkw6k/6LB3er5FO+7Tt5XQ0a4nllNYMFJJl?= =?us-ascii?Q?VDRP17yaXLe5syAiVHYTC0v/JcQtOmDDqZOIrabXDM26CGROOLz7a/cd5G4n?= =?us-ascii?Q?HzGBXt0j10WPQ+JizCo5VONbRxiCGukE7iIXCxw0cB3/w89+wEq/qAWb5APk?= =?us-ascii?Q?cX1dj85W6IbReP0eqvNT8NqmqsVKaONjovhacGzy7jrDZ9ftMbpISE6laFDF?= =?us-ascii?Q?FjqAqEKWtvUi0QId64XH4creD6WJyynrASZHWjxsTQcOD0lCbUin4giooRUY?= =?us-ascii?Q?rKBlSl1fPZgCHh7Nz+wIYf3Ph/eLZi2JyNENdITO5tNp8P/Z25RzxXePABwE?= =?us-ascii?Q?6PPehKi0I39BIKavAxydxAe2Uz1CFIaWx6RRB9z5xe3PJo9KB2EWMzMFr0+U?= =?us-ascii?Q?lJwSTFU8hyXLDuFl8AgngFlhYtbpW3Lt9olS1ivi6gd0EHo1xd9neErQNqOn?= =?us-ascii?Q?0/s7Q6143BEWRsRfdbC2t1kSTQyy9NooAQDfh9wbfETO3JqExXv2VlCh07pn?= =?us-ascii?Q?ekoFE+hZeON2L3qlvYnU3XYzwwIYg3CSDFb+CTw47zOpPv9XBHsHnLtawBOC?= =?us-ascii?Q?QJ+bfnnGpL3UJA1OUqj8HuJouR1iP2KL7PMK3lfjnsmSNT89LAQNdk9t8ZjV?= =?us-ascii?Q?ZiM8eVQykVrSX+c7kvTHy93Ci1J+E28ButifNXzO67oN16chiylhG4B0fqlt?= =?us-ascii?Q?p7hHgrmMlXfcYatuVKUy0/QmK/3UCZzKI7rS1uLh3q2iCUwfM+Q6SXpbGVMF?= =?us-ascii?Q?YrFM/9iFSRAwL/21SZjgw8JwvY6xGOF1Fa3wYJsx8PcCpoNBEuTJ/6IYmAeg?= =?us-ascii?Q?MuggagrTBx/d8Y7OqZ4=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN6PR11MB8244.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f56e5a1e-cad7-4753-f7b0-08db66518dc5 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jun 2023 05:47:45.9460 (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: 6Tf8WkrKRNZ5Ra+/FNhuI5sLN5dVzITn8/MIqZcla3ddsExTqrkTBEw/+OhPqdeKqnvdCzXnvrU7UjdLonrLhA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB8249 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Zhiguang L= iu > Sent: Tuesday, June 6, 2023 1:40 PM > To: devel@edk2.groups.io > Cc: Liu, Zhiguang ; Kinney, Michael D > ; Michael Kubacki > ; Sean Brogan > Subject: [edk2-devel] [PATCH v2] UnitTestFrameworkPkg: Add > UnitTestPeiServicesTablePointerLib >=20 > This library supports a PeiServicesTablePointerLib implementation > that allows code dependent upon PeiServicesTable to operate in an > isolated execution environment such as within the context of a > host-based unit test framework. >=20 > The unit test should initialize the PeiServicesTable database with > any required elements (e.g. PPIs, Hob etc.) prior to the services > being invoked by code under test. >=20 > It is strongly recommended to clean any global databases by using > EFI_PEI_SERVICES.ResetSystem2 after every unit test so the tests > execute in a predictable manner from a clean state. >=20 > Cc: Michael D Kinney > Cc: Michael Kubacki > Cc: Sean Brogan > Signed-off-by: Zhiguang Liu > --- > .../UnitTestPeiServicesTablePointerLib.c | 187 +++++ > .../UnitTestPeiServicesTablePointerLib.h | 653 ++++++++++++++++++ > .../UnitTestPeiServicesTablePointerLib.inf | 37 + > .../UnitTestPeiServicesTablePointerLib.uni | 12 + > .../UnitTestPeiServicesTablePointerLibHob.c | 162 +++++ > .../UnitTestPeiServicesTablePointerLibMisc.c | 430 ++++++++++++ > .../UnitTestPeiServicesTablePointerLibPpi.c | 485 +++++++++++++ > UnitTestFrameworkPkg/UnitTestFrameworkPkg.dsc | 1 + > .../UnitTestFrameworkPkgHost.dsc.inc | 1 + > 9 files changed, 1968 insertions(+) > create mode 100644 > UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTestP= eiS > ervicesTablePointerLib.c > create mode 100644 > UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTestP= eiS > ervicesTablePointerLib.h > create mode 100644 > UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTestP= eiS > ervicesTablePointerLib.inf > create mode 100644 > UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTestP= eiS > ervicesTablePointerLib.uni > create mode 100644 > UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTestP= eiS > ervicesTablePointerLibHob.c > create mode 100644 > UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTestP= eiS > ervicesTablePointerLibMisc.c > create mode 100644 > UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTestP= eiS > ervicesTablePointerLibPpi.c >=20 > diff --git > a/UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTes= tPe > iServicesTablePointerLib.c > b/UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTes= tPe > iServicesTablePointerLib.c > new file mode 100644 > index 0000000000..a1b982fbae > --- /dev/null > +++ > b/UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTes= tPe > iServicesTablePointerLib.c > @@ -0,0 +1,187 @@ > +/** @file > + This library supports a PEI Service table Pointer library implementati= on that > + allows code dependent upon PEI Service to operate in an isolated execu= tion > environment > + such as within the context of a host-based unit test framework. > + > + Copyright (c) 2023, Intel Corporation. All rights reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "UnitTestPeiServicesTablePointerLib.h" > + > +/// > +/// Pei service instance > +/// > +EFI_PEI_SERVICES mPeiServices =3D { > + { > + PEI_SERVICES_SIGNATURE, > + PEI_SERVICES_REVISION, > + sizeof (EFI_PEI_SERVICES), > + 0, > + 0 > + }, > + UnitTestInstallPpi, // InstallPpi > + UnitTestReInstallPpi, // ReInstallPpi > + UnitTestLocatePpi, // LocatePpi > + UnitTestNotifyPpi, // NotifyPpi > + > + UnitTestGetBootMode, // GetBootMode > + UnitTestSetBootMode, // SetBootMode > + > + UnitTestGetHobList, // GetHobList > + UnitTestCreateHob, // CreateHob > + > + UnitTestFfsFindNextVolume, // FfsFindNextVolume > + UnitTestFfsFindNextFile, // FfsFindNextFile > + UnitTestFfsFindSectionData, // FfsFindSectionData > + > + UnitTestInstallPeiMemory, // InstallPeiMemory > + UnitTestAllocatePages, // AllocatePages > + UnitTestAllocatePool, // AllocatePool > + (EFI_PEI_COPY_MEM)CopyMem, > + (EFI_PEI_SET_MEM)SetMem, > + > + UnitTestReportStatusCode, // ReportStatusCode > + UnitTestResetSystem, // ResetSystem > + > + NULL, // CpuIo > + NULL, // PciCfg > + > + UnitTestFfsFindFileByName, // FfsFindFileByName > + UnitTestFfsGetFileInfo, // FfsGetFileInfo > + UnitTestFfsGetVolumeInfo, // FfsGetVolumeInfo > + UnitTestRegisterForShadow, // RegisterForShadow > + UnitTestFfsFindSectionData3, // FfsFindSectionData3 > + UnitTestFfsGetFileInfo2, // FfsGetFileInfo2 > + UnitTestResetSystem2, // ResetSystem2 > + UnitTestFreePages, // FreePages > +}; > + > +PEI_CORE_INSTANCE mPrivateData; > +UINT8 mHobBuffer[MAX_HOB_SIZE]; > +VOID *mPeiServicesPointer; > + > +/** > + Clear Buffer For Global Data. > +**/ > +VOID > +ClearGlobalData ( > + VOID > + ) > +{ > + ZeroMem (&mPrivateData, sizeof (mPrivateData)); > + mPrivateData.PpiData.PpiList.MaxCount =3D MAX_PPI_COUNT; > + mPrivateData.PpiData.CallbackNotifyList.MaxCount =3D MAX_PPI_COUNT; > + mPrivateData.PpiData.DispatchNotifyList.MaxCount =3D MAX_PPI_COUNT; > + > + ZeroMem (mHobBuffer, MAX_HOB_SIZE); > + mPrivateData.HobList.Raw =3D mHobBuffer; > + UnitTestCoreBuildHobHandoffInfoTable (0, > (EFI_PHYSICAL_ADDRESS)(UINTN)mHobBuffer, MAX_HOB_SIZE); > +} > + > +/** > + Resets the entire platform. > + > + @param[in] ResetType The type of reset to perform. > + @param[in] ResetStatus The status code for the reset. > + @param[in] DataSize The size, in bytes, of ResetData. > + @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWar= m, or > EfiResetShutdown > + the data buffer starts with a Null-terminate= d string, optionally > + followed by additional binary data. The stri= ng is a description > + that the caller may use to further indicate = the reason for the > + system reset. > + > +**/ > +VOID > +EFIAPI > +UnitTestResetSystem2 ( > + IN EFI_RESET_TYPE ResetType, > + IN EFI_STATUS ResetStatus, > + IN UINTN DataSize, > + IN VOID *ResetData OPTIONAL > + ) > +{ > + ClearGlobalData (); > +} > + > +/** > + Retrieves the cached value of the PEI Services Table pointer. > + > + Returns the cached value of the PEI Services Table pointer in a CPU sp= ecific > manner > + as specified in the CPU binding section of the Platform Initialization= Pre-EFI > + Initialization Core Interface Specification. > + > + If the cached PEI Services Table pointer is NULL, then ASSERT(). > + > + @return The pointer to PeiServices. > + > +**/ > +CONST EFI_PEI_SERVICES ** > +EFIAPI > +GetPeiServicesTablePointer ( > + VOID > + ) > +{ > + mPeiServicesPointer =3D &mPeiServices; > + return (CONST EFI_PEI_SERVICES **)&mPeiServicesPointer; > +} > + > +/** > + Caches a pointer PEI Services Table. > + > + Caches the pointer to the PEI Services Table specified by > PeiServicesTablePointer > + in a CPU specific manner as specified in the CPU binding section of th= e > Platform Initialization > + Pre-EFI Initialization Core Interface Specification. > + > + If PeiServicesTablePointer is NULL, then ASSERT(). > + > + @param PeiServicesTablePointer The address of PeiServices pointer= . > +**/ > +VOID > +EFIAPI > +SetPeiServicesTablePointer ( > + IN CONST EFI_PEI_SERVICES **PeiServicesTablePointer > + ) > +{ > + ASSERT (FALSE); > +} > + > +/** > + Perform CPU specific actions required to migrate the PEI Services Tabl= e > + pointer from temporary RAM to permanent RAM. > + > + For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes > + immediately preceding the Interrupt Descriptor Table (IDT) in memory. > + For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes > + immediately preceding the Interrupt Descriptor Table (IDT) in memory. > + For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored i= n > + a dedicated CPU register. This means that there is no memory storage > + associated with storing the PEI Services Table pointer, so no addition= al > + migration actions are required for Itanium or ARM CPUs. > + > +**/ > +VOID > +EFIAPI > +MigratePeiServicesTablePointer ( > + VOID > + ) > +{ > + ASSERT (FALSE); > +} > + > +/** > + The constructor function init PeiServicesTable with clean buffer. > + > + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestPeiServicesTablePointerLibConstructor ( > + VOID > + ) > +{ > + ClearGlobalData (); > + return EFI_SUCCESS; > +} > diff --git > a/UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTes= tPe > iServicesTablePointerLib.h > b/UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTes= tPe > iServicesTablePointerLib.h > new file mode 100644 > index 0000000000..e411d08a86 > --- /dev/null > +++ > b/UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTes= tPe > iServicesTablePointerLib.h > @@ -0,0 +1,653 @@ > +/** @file > + An internal header file for the Unit Test instance of the PEI services= Table > Pointer Library. > + > + Copyright (c) 2023, Intel Corporation. All rights reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef PEI_SERVICES_TABLE_POINTER_LIB_UNIT_TEST_H_ > +#define PEI_SERVICES_TABLE_POINTER_LIB_UNIT_TEST_H_ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define MAX_PPI_COUNT 100 > +#define MAX_HOB_SIZE SIZE_32MB > + > +/// > +/// Forward declaration for PEI_CORE_INSTANCE > +/// > +typedef struct _PEI_CORE_INSTANCE PEI_CORE_INSTANCE; > + > +/// > +/// Pei Core private data structures > +/// > +typedef union { > + EFI_PEI_PPI_DESCRIPTOR *Ppi; > + EFI_PEI_NOTIFY_DESCRIPTOR *Notify; > + VOID *Raw; > +} PEI_PPI_LIST_POINTERS; > + > +typedef struct { > + UINTN CurrentCount; > + UINTN MaxCount; > + UINTN LastDispatchedCount; > + /// > + /// MaxCount number of entries. > + /// > + PEI_PPI_LIST_POINTERS PpiPtrs[MAX_PPI_COUNT]; > +} PEI_PPI_LIST; > + > +typedef struct { > + UINTN CurrentCount; > + UINTN MaxCount; > + /// > + /// MaxCount number of entries. > + /// > + PEI_PPI_LIST_POINTERS NotifyPtrs[MAX_PPI_COUNT]; > +} PEI_CALLBACK_NOTIFY_LIST; > + > +typedef struct { > + UINTN CurrentCount; > + UINTN MaxCount; > + UINTN LastDispatchedCount; > + /// > + /// MaxCount number of entries. > + /// > + PEI_PPI_LIST_POINTERS NotifyPtrs[MAX_PPI_COUNT]; > +} PEI_DISPATCH_NOTIFY_LIST; > + > +/// > +/// PPI database structure which contains three links: > +/// PpiList, CallbackNotifyList and DispatchNotifyList. > +/// > +typedef struct { > + /// > + /// PPI List. > + /// > + PEI_PPI_LIST PpiList; > + /// > + /// Notify List at dispatch level. > + /// > + PEI_CALLBACK_NOTIFY_LIST CallbackNotifyList; > + /// > + /// Notify List at callback level. > + /// > + PEI_DISPATCH_NOTIFY_LIST DispatchNotifyList; > +} PEI_PPI_DATABASE; > + > +/// > +/// Pei Core private data structure instance > +/// > +struct _PEI_CORE_INSTANCE { > + PEI_PPI_DATABASE PpiData; > + EFI_PEI_HOB_POINTERS HobList; > +}; > + > +extern PEI_CORE_INSTANCE mPrivateData; > +#define PEI_CORE_INSTANCE_FROM_PS_THIS(a) &mPrivateData > + > +VOID > +ProcessNotify ( > + IN PEI_CORE_INSTANCE *PrivateData, > + IN UINTN NotifyType, > + IN INTN InstallStartIndex, > + IN INTN InstallStopIndex, > + IN INTN NotifyStartIndex, > + IN INTN NotifyStopIndex > + ); > + > +/** > + > + This function installs an interface in the PEI PPI database by GUID. > + The purpose of the service is to publish an interface that other parti= es > + can use to call additional PEIMs. > + > + @param PeiServices An indirect pointer to the EFI_PEI_S= ERVICES table > published by the PEI Foundation. > + @param PpiList Pointer to a list of PEI PPI Descrip= tors. > + > + @retval EFI_SUCCESS if all PPIs in PpiList are successful= ly installed. > + @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer > + if any PPI in PpiList is not valid > + @retval EFI_OUT_OF_RESOURCES if there is no more memory resource t= o > install PPI > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestInstallPpi ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList > + ); > + > +/** > + > + This function reinstalls an interface in the PEI PPI database by GUID. > + The purpose of the service is to publish an interface that other parti= es can > + use to replace an interface of the same name in the protocol database = with a > + different interface. > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVI= CES table > published by the PEI Foundation. > + @param OldPpi Pointer to the old PEI PPI Descriptors. > + @param NewPpi Pointer to the new PEI PPI Descriptors. > + > + @retval EFI_SUCCESS if the operation was successful > + @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL > + @retval EFI_INVALID_PARAMETER if NewPpi is not valid > + @retval EFI_NOT_FOUND if the PPI was not in the database > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestReInstallPpi ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi, > + IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi > + ); > + > +/** > + > + Locate a given named PPI. > + > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES = table > published by the PEI Foundation. > + @param Guid Pointer to GUID of the PPI. > + @param Instance Instance Number to discover. > + @param PpiDescriptor Pointer to reference the found descriptor. I= f not > NULL, > + returns a pointer to the descriptor (include= s flags, etc) > + @param Ppi Pointer to reference the found PPI > + > + @retval EFI_SUCCESS if the PPI is in the database > + @retval EFI_NOT_FOUND if the PPI is not in the database > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestLocatePpi ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN CONST EFI_GUID *Guid, > + IN UINTN Instance, > + IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor, > + IN OUT VOID **Ppi > + ); > + > +/** > + > + This function installs a notification service to be called back when a= given > + interface is installed or reinstalled. The purpose of the service is t= o publish > + an interface that other parties can use to call additional PPIs that m= ay > materialize later. > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES = table > published by the PEI Foundation. > + @param NotifyList Pointer to list of Descriptors to notify upo= n. > + > + @retval EFI_SUCCESS if successful > + @retval EFI_OUT_OF_RESOURCES if no space in the database > + @retval EFI_INVALID_PARAMETER if not a good descriptor > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestNotifyPpi ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList > + ); > + > +/** > + Gets the pointer to the HOB List. > + > + @param PeiServices An indirect pointer to the EFI_PE= I_SERVICES > table published by the PEI Foundation. > + @param HobList Pointer to the HOB List. > + > + @retval EFI_SUCCESS Get the pointer of HOB List > + @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published > + @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode) > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestGetHobList ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN OUT VOID **HobList > + ); > + > +/** > + Add a new HOB to the HOB List. > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES ta= ble > published by the PEI Foundation. > + @param Type Type of the new HOB. > + @param Length Length of the new HOB to allocate. > + @param Hob Pointer to the new HOB. > + > + @return EFI_SUCCESS Success to create HOB. > + @retval EFI_INVALID_PARAMETER if Hob is NULL > + @retval EFI_NOT_AVAILABLE_YET if HobList is still not available. > + @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the > Hoblist. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestCreateHob ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN UINT16 Type, > + IN UINT16 Length, > + IN OUT VOID **Hob > + ); > + > +/** > + > + Builds a Handoff Information Table HOB > + > + @param BootMode - Current Bootmode > + @param MemoryBegin - Start Memory Address. > + @param MemoryLength - Length of Memory. > + > + @return EFI_SUCCESS Always success to initialize HOB. > + > +**/ > +EFI_STATUS > +UnitTestCoreBuildHobHandoffInfoTable ( > + IN EFI_BOOT_MODE BootMode, > + IN EFI_PHYSICAL_ADDRESS MemoryBegin, > + IN UINT64 MemoryLength > + ); > + > +/** > + Resets the entire platform. > + > + @param[in] ResetType The type of reset to perform. > + @param[in] ResetStatus The status code for the reset. > + @param[in] DataSize The size, in bytes, of ResetData. > + @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWar= m, or > EfiResetShutdown > + the data buffer starts with a Null-terminate= d string, optionally > + followed by additional binary data. The stri= ng is a description > + that the caller may use to further indicate = the reason for the > + system reset. > + > +**/ > +VOID > +EFIAPI > +UnitTestResetSystem2 ( > + IN EFI_RESET_TYPE ResetType, > + IN EFI_STATUS ResetStatus, > + IN UINTN DataSize, > + IN VOID *ResetData OPTIONAL > + ); > + > +/** > + This service enables PEIMs to ascertain the present value of the boot = mode. > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVI= CES table > published by the PEI Foundation. > + @param BootMode A pointer to contain the value of the bo= ot mode. > + > + @retval EFI_SUCCESS The boot mode was returned successfully. > + @retval EFI_INVALID_PARAMETER BootMode is NULL. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestGetBootMode ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN OUT EFI_BOOT_MODE *BootMode > + ); > + > +/** > + This service enables PEIMs to update the boot mode variable. > + > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES ta= ble > published by the PEI Foundation. > + @param BootMode The value of the boot mode to set. > + > + @return EFI_SUCCESS The value was successfully updated > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestSetBootMode ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN EFI_BOOT_MODE BootMode > + ); > + > +/** > + Search the firmware volumes by index > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES tab= le > published by the PEI Foundation > + @param Instance This instance of the firmware volume to find. T= he value > 0 is the Boot Firmware > + Volume (BFV). > + @param VolumeHandle On exit, points to the next volume handle or NU= LL if > it does not exist. > + > + @retval EFI_INVALID_PARAMETER VolumeHandle is NULL > + @retval EFI_NOT_FOUND The volume was not found. > + @retval EFI_SUCCESS The volume was found. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestFfsFindNextVolume ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN UINTN Instance, > + IN OUT EFI_PEI_FV_HANDLE *VolumeHandle > + ); > + > +/** > + Searches for the next matching file in the firmware volume. > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES tab= le > published by the PEI Foundation. > + @param SearchType Filter to find only files of this type. > + Type EFI_FV_FILETYPE_ALL causes no filtering to= be done. > + @param FvHandle Handle of firmware volume in which to search. > + @param FileHandle On entry, points to the current handle from whi= ch to > begin searching or NULL to start > + at the beginning of the firmware volume. On exi= t, points the file > handle of the next file > + in the volume or NULL if there are no more file= s. > + > + @retval EFI_NOT_FOUND The file was not found. > + @retval EFI_NOT_FOUND The header checksum was not zero. > + @retval EFI_SUCCESS The file was found. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestFfsFindNextFile ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN UINT8 SearchType, > + IN EFI_PEI_FV_HANDLE FvHandle, > + IN OUT EFI_PEI_FILE_HANDLE *FileHandle > + ); > + > +/** > + Searches for the next matching section within the specified file. > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES tab= le > published by the PEI Foundation > + @param SectionType Filter to find only sections of this type. > + @param FileHandle Pointer to the current file to search. > + @param SectionData A pointer to the discovered section, if success= ful. > + NULL if section not found > + > + @retval EFI_NOT_FOUND The section was not found. > + @retval EFI_SUCCESS The section was found. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestFfsFindSectionData ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN EFI_SECTION_TYPE SectionType, > + IN EFI_PEI_FILE_HANDLE FileHandle, > + OUT VOID **SectionData > + ); > + > +/** > + > + This function registers the found memory configuration with the PEI > Foundation. > + > + The usage model is that the PEIM that discovers the permanent memory s= hall > invoke this service. > + This routine will hold discoveried memory information into PeiCore's p= rivate > data, > + and set SwitchStackSignal flag. After PEIM who discovery memory is > dispatched, > + PeiDispatcher will migrate temporary memory to permanent memory. > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES = table > published by the PEI Foundation. > + @param MemoryBegin Start of memory address. > + @param MemoryLength Length of memory. > + > + @return EFI_SUCCESS Always success. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestInstallPeiMemory ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN EFI_PHYSICAL_ADDRESS MemoryBegin, > + IN UINT64 MemoryLength > + ); > + > +/** > + The purpose of the service is to publish an interface that allows > + PEIMs to allocate memory ranges that are managed by the PEI Foundation= . > + > + Prior to InstallPeiMemory() being called, PEI will allocate pages from= the heap. > + After InstallPeiMemory() is called, PEI will allocate pages within the= region > + of memory provided by InstallPeiMemory() service in a best-effort fash= ion. > + Location-specific allocations are not managed by the PEI foundation co= de. > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES t= able > published by the PEI Foundation. > + @param MemoryType The type of memory to allocate. > + @param Pages The number of contiguous 4 KB pages to alloca= te. > + @param Memory Pointer to a physical address. On output, the= address is > set to the base > + of the page range that was allocated. > + > + @retval EFI_SUCCESS The memory range was successfully alloca= ted. > + @retval EFI_OUT_OF_RESOURCES The pages could not be allocated. > + @retval EFI_INVALID_PARAMETER Type is not equal to EfiLoaderCode, > EfiLoaderData, EfiRuntimeServicesCode, > + EfiRuntimeServicesData, EfiBootServicesC= ode, > EfiBootServicesData, > + EfiACPIReclaimMemory, EfiReservedMemoryT= ype, or > EfiACPIMemoryNVS. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestAllocatePages ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN EFI_MEMORY_TYPE MemoryType, > + IN UINTN Pages, > + OUT EFI_PHYSICAL_ADDRESS *Memory > + ); > + > +/** > + > + Pool allocation service. Before permanent memory is discovered, the po= ol will > + be allocated in the heap in temporary memory. Generally, the size of t= he heap > in temporary > + memory does not exceed 64K, so the biggest pool size could be allocate= d is > + 64K. > + > + @param PeiServices An indirect pointer to the EFI_PEI_SE= RVICES table > published by the PEI Foundation. > + @param Size Amount of memory required > + @param Buffer Address of pointer to the buffer > + > + @retval EFI_SUCCESS The allocation was successful > + @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy t= he > requirement > + to allocate the requested size. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestAllocatePool ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN UINTN Size, > + OUT VOID **Buffer > + ); > + > +/** > + > + Core version of the Status Code reporter > + > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES tab= le > published by the PEI Foundation. > + @param CodeType Type of Status Code. > + @param Value Value to output for Status Code. > + @param Instance Instance Number of this status code. > + @param CallerId ID of the caller of this status code. > + @param Data Optional data associated with this status code. > + > + @retval EFI_SUCCESS if status code is successfully reporte= d > + @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installe= d > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestReportStatusCode ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN EFI_STATUS_CODE_TYPE CodeType, > + IN EFI_STATUS_CODE_VALUE Value, > + IN UINT32 Instance, > + IN CONST EFI_GUID *CallerId, > + IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL > + ); > + > +/** > + > +Core version of the Reset System > + > + > +@param PeiServices An indirect pointer to the EFI_PEI_SER= VICES table > published by the PEI Foundation. > + > +@retval EFI_NOT_AVAILABLE_YET PPI not available yet. > +@retval EFI_DEVICE_ERROR Did not reset system. > + Otherwise, resets the system. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestResetSystem ( > + IN CONST EFI_PEI_SERVICES **PeiServices > + ); > + > +/** > + Find a file within a volume by its name. > + > + @param FileName A pointer to the name of the file to find withi= n the > firmware volume. > + @param VolumeHandle The firmware volume to search > + @param FileHandle Upon exit, points to the found file's handle > + or NULL if it could not be found. > + > + @retval EFI_SUCCESS File was found. > + @retval EFI_NOT_FOUND File was not found. > + @retval EFI_INVALID_PARAMETER VolumeHandle or FileHandle or FileName > was NULL. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestFfsFindFileByName ( > + IN CONST EFI_GUID *FileName, > + IN EFI_PEI_FV_HANDLE VolumeHandle, > + OUT EFI_PEI_FILE_HANDLE *FileHandle > + ); > + > +/** > + Returns information about a specific file. > + > + @param FileHandle Handle of the file. > + @param FileInfo Upon exit, points to the file's information. > + > + @retval EFI_INVALID_PARAMETER If FileInfo is NULL. > + @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid= file. > + @retval EFI_SUCCESS File information returned. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestFfsGetFileInfo ( > + IN EFI_PEI_FILE_HANDLE FileHandle, > + OUT EFI_FV_FILE_INFO *FileInfo > + ); > + > +/** > + Returns information about the specified volume. > + > + This function returns information about a specific firmware > + volume, including its name, type, attributes, starting address > + and size. > + > + @param VolumeHandle Handle of the volume. > + @param VolumeInfo Upon exit, points to the volume's information. > + > + @retval EFI_SUCCESS Volume information returned. > + @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a > valid volume. > + @retval EFI_INVALID_PARAMETER If VolumeHandle is NULL. > + @retval EFI_SUCCESS Information successfully returned. > + @retval EFI_INVALID_PARAMETER The volume designated by the > VolumeHandle is not available. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestFfsGetVolumeInfo ( > + IN EFI_PEI_FV_HANDLE VolumeHandle, > + OUT EFI_FV_INFO *VolumeInfo > + ); > + > +/** > +This routine enables a PEIM to register itself for shadow when the PEI > Foundation > +discovers permanent memory. > + > +@param FileHandle File handle of a PEIM. > + > +@retval EFI_NOT_FOUND The file handle doesn't point to PEIM itse= lf. > +@retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered > itself. > +@retval EFI_SUCCESS Successfully to register itself. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestRegisterForShadow ( > + IN EFI_PEI_FILE_HANDLE FileHandle > + ); > + > +/** > +Searches for the next matching section within the specified file. > + > +@param PeiServices An indirect pointer to the EFI_PEI_SERVICE= S table > published by the PEI Foundation. > +@param SectionType The value of the section type to find. > +@param SectionInstance Section instance to find. > +@param FileHandle Handle of the firmware file to search. > +@param SectionData A pointer to the discovered section, if su= ccessful. > +@param AuthenticationStatus A pointer to the authentication status for= this > section. > + > +@retval EFI_SUCCESS The section was found. > +@retval EFI_NOT_FOUND The section was not found. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestFfsFindSectionData3 ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN EFI_SECTION_TYPE SectionType, > + IN UINTN SectionInstance, > + IN EFI_PEI_FILE_HANDLE FileHandle, > + OUT VOID **SectionData, > + OUT UINT32 *AuthenticationStatus > + ); > + > +/** > +Returns information about a specific file. > + > +@param FileHandle Handle of the file. > +@param FileInfo Upon exit, points to the file's information. > + > +@retval EFI_INVALID_PARAMETER If FileInfo is NULL. > +@retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid f= ile. > +@retval EFI_SUCCESS File information returned. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestFfsGetFileInfo2 ( > + IN EFI_PEI_FILE_HANDLE FileHandle, > + OUT EFI_FV_FILE_INFO2 *FileInfo > + ); > + > +/** > +Frees memory pages. > + > +@param[in] PeiServices An indirect pointer to the EFI_PEI_SERVICE= S table > published by the PEI Foundation. > +@param[in] Memory The base physical address of the pages to = be freed. > +@param[in] Pages The number of contiguous 4 KB pages to fre= e. > + > +@retval EFI_SUCCESS The requested pages were freed. > +@retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or > Pages is invalid. > +@retval EFI_NOT_FOUND The requested memory pages were not alloca= ted > with > + AllocatePages(). > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestFreePages ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN EFI_PHYSICAL_ADDRESS Memory, > + IN UINTN Pages > + ); > + > +#endif > diff --git > a/UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTes= tPe > iServicesTablePointerLib.inf > b/UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTes= tPe > iServicesTablePointerLib.inf > new file mode 100644 > index 0000000000..59d86c9db8 > --- /dev/null > +++ > b/UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTes= tPe > iServicesTablePointerLib.inf > @@ -0,0 +1,37 @@ > +## @file > +# Pei Services Table Pointer Lib for unit tests implementation. > +# > +# Copyright (c) 2023, Intel Corporation. All rights reserved.
> +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D UnitTestPeiServicesTablePointerLib > + MODULE_UNI_FILE =3D UnitTestPeiServicesTablePointerLib.= uni > + FILE_GUID =3D 55F23CD2-9BB1-41EE-AB10-550B638210E= 1 > + MODULE_TYPE =3D BASE > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D PeiServicesTablePointerLib > + > + CONSTRUCTOR =3D UnitTestPeiServicesTablePointerLibC= onstructor > +# > +# VALID_ARCHITECTURES =3D IA32 X64 EBC > +# > + > +[Sources] > + UnitTestPeiServicesTablePointerLib.h > + UnitTestPeiServicesTablePointerLib.c > + UnitTestPeiServicesTablePointerLibMisc.c > + UnitTestPeiServicesTablePointerLibPpi.c > + UnitTestPeiServicesTablePointerLibHob.c > + > +[Packages] > + MdePkg/MdePkg.dec > + > +[LibraryClasses] > + BaseLib > + BaseMemoryLib > + DebugLib > + UnitTestLib > diff --git > a/UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTes= tPe > iServicesTablePointerLib.uni > b/UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTes= tPe > iServicesTablePointerLib.uni > new file mode 100644 > index 0000000000..ca2118533a > --- /dev/null > +++ > b/UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTes= tPe > iServicesTablePointerLib.uni > @@ -0,0 +1,12 @@ > +// /** @file > +// Pei Services Table Pointer Lib for unit tests implementation. > +// > +// Copyright (c) 2023, Intel Corporation. All rights reserved.
> +// > +// SPDX-License-Identifier: BSD-2-Clause-Patent > +// > +// **/ > + > +#string STR_MODULE_ABSTRACT #language en-US "Pei Services Ta= ble > Pointer Lib for unit tests." > + > +#string STR_MODULE_DESCRIPTION #language en-US "Pei Services Ta= ble > Pointer Lib for unit tests." > diff --git > a/UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTes= tPe > iServicesTablePointerLibHob.c > b/UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTes= tPe > iServicesTablePointerLibHob.c > new file mode 100644 > index 0000000000..2d4ffe8c59 > --- /dev/null > +++ > b/UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTes= tPe > iServicesTablePointerLibHob.c > @@ -0,0 +1,162 @@ > +/** @file > + This file implements some PEI services about Hob. > + > + Copyright (c) 2023, Intel Corporation. All rights reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "UnitTestPeiServicesTablePointerLib.h" > + > +/** > + > + Gets the pointer to the HOB List. > + > + @param PeiServices An indirect pointer to the EFI_PE= I_SERVICES > table published by the PEI Foundation. > + @param HobList Pointer to the HOB List. > + > + @retval EFI_SUCCESS Get the pointer of HOB List > + @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published > + @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode) > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestGetHobList ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN OUT VOID **HobList > + ) > +{ > + PEI_CORE_INSTANCE *PrivateData; > + > + // > + // Only check this parameter in debug mode > + // > + > + DEBUG_CODE_BEGIN (); > + if (HobList =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + DEBUG_CODE_END (); > + > + PrivateData =3D PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices); > + > + *HobList =3D PrivateData->HobList.Raw; > + > + return EFI_SUCCESS; > +} > + > +/** > + Add a new HOB to the HOB List. > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES ta= ble > published by the PEI Foundation. > + @param Type Type of the new HOB. > + @param Length Length of the new HOB to allocate. > + @param Hob Pointer to the new HOB. > + > + @return EFI_SUCCESS Success to create HOB. > + @retval EFI_INVALID_PARAMETER if Hob is NULL > + @retval EFI_NOT_AVAILABLE_YET if HobList is still not available. > + @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the > Hoblist. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestCreateHob ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN UINT16 Type, > + IN UINT16 Length, > + IN OUT VOID **Hob > + ) > +{ > + EFI_STATUS Status; > + EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob; > + EFI_HOB_GENERIC_HEADER *HobEnd; > + EFI_PHYSICAL_ADDRESS FreeMemory; > + > + Status =3D UnitTestGetHobList (PeiServices, Hob); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + > + HandOffHob =3D *Hob; > + > + // > + // Check Length to avoid data overflow. > + // > + if (0x10000 - Length <=3D 0x7) { > + return EFI_INVALID_PARAMETER; > + } > + > + Length =3D (UINT16)((Length + 0x7) & (~0x7)); > + > + FreeMemory =3D HandOffHob->EfiFreeMemoryTop - > + HandOffHob->EfiFreeMemoryBottom; > + > + if (FreeMemory < Length) { > + DEBUG ((DEBUG_ERROR, "PeiCreateHob fail: Length - 0x%08x\n", > (UINTN)Length)); > + DEBUG ((DEBUG_ERROR, " FreeMemoryTop - 0x%08x\n", > (UINTN)HandOffHob->EfiFreeMemoryTop)); > + DEBUG ((DEBUG_ERROR, " FreeMemoryBottom - 0x%08x\n", > (UINTN)HandOffHob->EfiFreeMemoryBottom)); > + return EFI_OUT_OF_RESOURCES; > + } > + > + *Hob =3D (VOID *)(UINTN)HandOff= Hob->EfiEndOfHobList; > + ((EFI_HOB_GENERIC_HEADER *)*Hob)->HobType =3D Type; > + ((EFI_HOB_GENERIC_HEADER *)*Hob)->HobLength =3D Length; > + ((EFI_HOB_GENERIC_HEADER *)*Hob)->Reserved =3D 0; > + > + HobEnd =3D (EFI_HOB_GENERIC_HEADER *)((UINTN)*Hob= + Length); > + HandOffHob->EfiEndOfHobList =3D (EFI_PHYSICAL_ADDRESS)(UINTN)HobEnd; > + > + HobEnd->HobType =3D EFI_HOB_TYPE_END_OF_HOB_LIST; > + HobEnd->HobLength =3D (UINT16)sizeof (EFI_HOB_GENERIC_HEADER); > + HobEnd->Reserved =3D 0; > + HobEnd++; > + HandOffHob->EfiFreeMemoryBottom =3D > (EFI_PHYSICAL_ADDRESS)(UINTN)HobEnd; > + > + return EFI_SUCCESS; > +} > + > +/** > + > + Builds a Handoff Information Table HOB > + > + @param BootMode - Current Bootmode > + @param MemoryBegin - Start Memory Address. > + @param MemoryLength - Length of Memory. > + > + @return EFI_SUCCESS Always success to initialize HOB. > + > +**/ > +EFI_STATUS > +UnitTestCoreBuildHobHandoffInfoTable ( > + IN EFI_BOOT_MODE BootMode, > + IN EFI_PHYSICAL_ADDRESS MemoryBegin, > + IN UINT64 MemoryLength > + ) > +{ > + EFI_HOB_HANDOFF_INFO_TABLE *Hob; > + EFI_HOB_GENERIC_HEADER *HobEnd; > + > + Hob =3D (VOID *)(UINTN)MemoryBegin; > + HobEnd =3D (EFI_HOB_GENERIC_HEADER *)(Hob+1); > + Hob->Header.HobType =3D EFI_HOB_TYPE_HANDOFF; > + Hob->Header.HobLength =3D (UINT16)sizeof (EFI_HOB_HANDOFF_INFO_TABLE); > + Hob->Header.Reserved =3D 0; > + > + HobEnd->HobType =3D EFI_HOB_TYPE_END_OF_HOB_LIST; > + HobEnd->HobLength =3D (UINT16)sizeof (EFI_HOB_GENERIC_HEADER); > + HobEnd->Reserved =3D 0; > + > + Hob->Version =3D EFI_HOB_HANDOFF_TABLE_VERSION; > + Hob->BootMode =3D BootMode; > + > + Hob->EfiMemoryTop =3D MemoryBegin + MemoryLength; > + Hob->EfiMemoryBottom =3D MemoryBegin; > + Hob->EfiFreeMemoryTop =3D MemoryBegin + MemoryLength; > + Hob->EfiFreeMemoryBottom =3D (EFI_PHYSICAL_ADDRESS)(UINTN)(HobEnd + 1)= ; > + Hob->EfiEndOfHobList =3D (EFI_PHYSICAL_ADDRESS)(UINTN)HobEnd; > + > + return EFI_SUCCESS; > +} > diff --git > a/UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTes= tPe > iServicesTablePointerLibMisc.c > b/UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTes= tPe > iServicesTablePointerLibMisc.c > new file mode 100644 > index 0000000000..90955bf482 > --- /dev/null > +++ > b/UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTes= tPe > iServicesTablePointerLibMisc.c > @@ -0,0 +1,430 @@ > +/** @file > + This file implements some PEI services. > + > + Copyright (c) 2023, Intel Corporation. All rights reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "UnitTestPeiServicesTablePointerLib.h" > + > +/** > + This service enables PEIMs to ascertain the present value of the boot = mode. > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVI= CES table > published by the PEI Foundation. > + @param BootMode A pointer to contain the value of the bo= ot mode. > + > + @retval EFI_SUCCESS The boot mode was returned successfully. > + @retval EFI_INVALID_PARAMETER BootMode is NULL. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestGetBootMode ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN OUT EFI_BOOT_MODE *BootMode > + ) > +{ > + return EFI_NOT_AVAILABLE_YET; > +} > + > +/** > + This service enables PEIMs to update the boot mode variable. > + > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES ta= ble > published by the PEI Foundation. > + @param BootMode The value of the boot mode to set. > + > + @return EFI_SUCCESS The value was successfully updated > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestSetBootMode ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN EFI_BOOT_MODE BootMode > + ) > +{ > + return EFI_NOT_AVAILABLE_YET; > +} > + > +/** > + Search the firmware volumes by index > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES tab= le > published by the PEI Foundation > + @param Instance This instance of the firmware volume to find. T= he value > 0 is the Boot Firmware > + Volume (BFV). > + @param VolumeHandle On exit, points to the next volume handle or NU= LL if > it does not exist. > + > + @retval EFI_INVALID_PARAMETER VolumeHandle is NULL > + @retval EFI_NOT_FOUND The volume was not found. > + @retval EFI_SUCCESS The volume was found. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestFfsFindNextVolume ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN UINTN Instance, > + IN OUT EFI_PEI_FV_HANDLE *VolumeHandle > + ) > +{ > + return EFI_NOT_AVAILABLE_YET; > +} > + > +/** > + Searches for the next matching file in the firmware volume. > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES tab= le > published by the PEI Foundation. > + @param SearchType Filter to find only files of this type. > + Type EFI_FV_FILETYPE_ALL causes no filtering to= be done. > + @param FvHandle Handle of firmware volume in which to search. > + @param FileHandle On entry, points to the current handle from whi= ch to > begin searching or NULL to start > + at the beginning of the firmware volume. On exi= t, points the file > handle of the next file > + in the volume or NULL if there are no more file= s. > + > + @retval EFI_NOT_FOUND The file was not found. > + @retval EFI_NOT_FOUND The header checksum was not zero. > + @retval EFI_SUCCESS The file was found. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestFfsFindNextFile ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN UINT8 SearchType, > + IN EFI_PEI_FV_HANDLE FvHandle, > + IN OUT EFI_PEI_FILE_HANDLE *FileHandle > + ) > +{ > + return EFI_NOT_AVAILABLE_YET; > +} > + > +/** > + Searches for the next matching section within the specified file. > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES tab= le > published by the PEI Foundation > + @param SectionType Filter to find only sections of this type. > + @param FileHandle Pointer to the current file to search. > + @param SectionData A pointer to the discovered section, if success= ful. > + NULL if section not found > + > + @retval EFI_NOT_FOUND The section was not found. > + @retval EFI_SUCCESS The section was found. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestFfsFindSectionData ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN EFI_SECTION_TYPE SectionType, > + IN EFI_PEI_FILE_HANDLE FileHandle, > + OUT VOID **SectionData > + ) > +{ > + return EFI_NOT_AVAILABLE_YET; > +} > + > +/** > + > + This function registers the found memory configuration with the PEI > Foundation. > + > + The usage model is that the PEIM that discovers the permanent memory s= hall > invoke this service. > + This routine will hold discoveried memory information into PeiCore's p= rivate > data, > + and set SwitchStackSignal flag. After PEIM who discovery memory is > dispatched, > + PeiDispatcher will migrate temporary memory to permanent memory. > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES = table > published by the PEI Foundation. > + @param MemoryBegin Start of memory address. > + @param MemoryLength Length of memory. > + > + @return EFI_SUCCESS Always success. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestInstallPeiMemory ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN EFI_PHYSICAL_ADDRESS MemoryBegin, > + IN UINT64 MemoryLength > + ) > +{ > + return EFI_NOT_AVAILABLE_YET; > +} > + > +/** > + The purpose of the service is to publish an interface that allows > + PEIMs to allocate memory ranges that are managed by the PEI Foundation= . > + > + Prior to InstallPeiMemory() being called, PEI will allocate pages from= the heap. > + After InstallPeiMemory() is called, PEI will allocate pages within the= region > + of memory provided by InstallPeiMemory() service in a best-effort fash= ion. > + Location-specific allocations are not managed by the PEI foundation co= de. > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES t= able > published by the PEI Foundation. > + @param MemoryType The type of memory to allocate. > + @param Pages The number of contiguous 4 KB pages to alloca= te. > + @param Memory Pointer to a physical address. On output, the= address is > set to the base > + of the page range that was allocated. > + > + @retval EFI_SUCCESS The memory range was successfully alloca= ted. > + @retval EFI_OUT_OF_RESOURCES The pages could not be allocated. > + @retval EFI_INVALID_PARAMETER Type is not equal to EfiLoaderCode, > EfiLoaderData, EfiRuntimeServicesCode, > + EfiRuntimeServicesData, EfiBootServicesC= ode, > EfiBootServicesData, > + EfiACPIReclaimMemory, EfiReservedMemoryT= ype, or > EfiACPIMemoryNVS. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestAllocatePages ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN EFI_MEMORY_TYPE MemoryType, > + IN UINTN Pages, > + OUT EFI_PHYSICAL_ADDRESS *Memory > + ) > +{ > + return EFI_NOT_AVAILABLE_YET; > +} > + > +/** > + > + Pool allocation service. Before permanent memory is discovered, the po= ol will > + be allocated in the heap in temporary memory. Generally, the size of t= he heap > in temporary > + memory does not exceed 64K, so the biggest pool size could be allocate= d is > + 64K. > + > + @param PeiServices An indirect pointer to the EFI_PEI_SE= RVICES table > published by the PEI Foundation. > + @param Size Amount of memory required > + @param Buffer Address of pointer to the buffer > + > + @retval EFI_SUCCESS The allocation was successful > + @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy t= he > requirement > + to allocate the requested size. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestAllocatePool ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN UINTN Size, > + OUT VOID **Buffer > + ) > +{ > + return EFI_NOT_AVAILABLE_YET; > +} > + > +/** > + > + Core version of the Status Code reporter > + > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES tab= le > published by the PEI Foundation. > + @param CodeType Type of Status Code. > + @param Value Value to output for Status Code. > + @param Instance Instance Number of this status code. > + @param CallerId ID of the caller of this status code. > + @param Data Optional data associated with this status code. > + > + @retval EFI_SUCCESS if status code is successfully reporte= d > + @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installe= d > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestReportStatusCode ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN EFI_STATUS_CODE_TYPE CodeType, > + IN EFI_STATUS_CODE_VALUE Value, > + IN UINT32 Instance, > + IN CONST EFI_GUID *CallerId, > + IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL > + ) > +{ > + return EFI_NOT_AVAILABLE_YET; > +} > + > +/** > + > +Core version of the Reset System > + > + > +@param PeiServices An indirect pointer to the EFI_PEI_SER= VICES table > published by the PEI Foundation. > + > +@retval EFI_NOT_AVAILABLE_YET PPI not available yet. > +@retval EFI_DEVICE_ERROR Did not reset system. > + Otherwise, resets the system. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestResetSystem ( > + IN CONST EFI_PEI_SERVICES **PeiServices > + ) > +{ > + return EFI_NOT_AVAILABLE_YET; > +} > + > +/** > + Find a file within a volume by its name. > + > + @param FileName A pointer to the name of the file to find withi= n the > firmware volume. > + @param VolumeHandle The firmware volume to search > + @param FileHandle Upon exit, points to the found file's handle > + or NULL if it could not be found. > + > + @retval EFI_SUCCESS File was found. > + @retval EFI_NOT_FOUND File was not found. > + @retval EFI_INVALID_PARAMETER VolumeHandle or FileHandle or FileName > was NULL. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestFfsFindFileByName ( > + IN CONST EFI_GUID *FileName, > + IN EFI_PEI_FV_HANDLE VolumeHandle, > + OUT EFI_PEI_FILE_HANDLE *FileHandle > + ) > +{ > + return EFI_NOT_AVAILABLE_YET; > +} > + > +/** > + Returns information about a specific file. > + > + @param FileHandle Handle of the file. > + @param FileInfo Upon exit, points to the file's information. > + > + @retval EFI_INVALID_PARAMETER If FileInfo is NULL. > + @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid= file. > + @retval EFI_SUCCESS File information returned. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestFfsGetFileInfo ( > + IN EFI_PEI_FILE_HANDLE FileHandle, > + OUT EFI_FV_FILE_INFO *FileInfo > + ) > +{ > + return EFI_NOT_AVAILABLE_YET; > +} > + > +/** > + Returns information about the specified volume. > + > + This function returns information about a specific firmware > + volume, including its name, type, attributes, starting address > + and size. > + > + @param VolumeHandle Handle of the volume. > + @param VolumeInfo Upon exit, points to the volume's information. > + > + @retval EFI_SUCCESS Volume information returned. > + @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a > valid volume. > + @retval EFI_INVALID_PARAMETER If VolumeHandle is NULL. > + @retval EFI_SUCCESS Information successfully returned. > + @retval EFI_INVALID_PARAMETER The volume designated by the > VolumeHandle is not available. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestFfsGetVolumeInfo ( > + IN EFI_PEI_FV_HANDLE VolumeHandle, > + OUT EFI_FV_INFO *VolumeInfo > + ) > +{ > + return EFI_NOT_AVAILABLE_YET; > +} > + > +/** > +This routine enables a PEIM to register itself for shadow when the PEI > Foundation > +discovers permanent memory. > + > +@param FileHandle File handle of a PEIM. > + > +@retval EFI_NOT_FOUND The file handle doesn't point to PEIM itse= lf. > +@retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered > itself. > +@retval EFI_SUCCESS Successfully to register itself. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestRegisterForShadow ( > + IN EFI_PEI_FILE_HANDLE FileHandle > + ) > +{ > + return EFI_NOT_AVAILABLE_YET; > +} > + > +/** > +Searches for the next matching section within the specified file. > + > +@param PeiServices An indirect pointer to the EFI_PEI_SERVICE= S table > published by the PEI Foundation. > +@param SectionType The value of the section type to find. > +@param SectionInstance Section instance to find. > +@param FileHandle Handle of the firmware file to search. > +@param SectionData A pointer to the discovered section, if su= ccessful. > +@param AuthenticationStatus A pointer to the authentication status for= this > section. > + > +@retval EFI_SUCCESS The section was found. > +@retval EFI_NOT_FOUND The section was not found. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestFfsFindSectionData3 ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN EFI_SECTION_TYPE SectionType, > + IN UINTN SectionInstance, > + IN EFI_PEI_FILE_HANDLE FileHandle, > + OUT VOID **SectionData, > + OUT UINT32 *AuthenticationStatus > + ) > +{ > + return EFI_NOT_AVAILABLE_YET; > +} > + > +/** > +Returns information about a specific file. > + > +@param FileHandle Handle of the file. > +@param FileInfo Upon exit, points to the file's information. > + > +@retval EFI_INVALID_PARAMETER If FileInfo is NULL. > +@retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid f= ile. > +@retval EFI_SUCCESS File information returned. > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestFfsGetFileInfo2 ( > + IN EFI_PEI_FILE_HANDLE FileHandle, > + OUT EFI_FV_FILE_INFO2 *FileInfo > + ) > +{ > + return EFI_NOT_AVAILABLE_YET; > +} > + > +/** > +Frees memory pages. > + > +@param[in] PeiServices An indirect pointer to the EFI_PEI_SERVICE= S table > published by the PEI Foundation. > +@param[in] Memory The base physical address of the pages to = be freed. > +@param[in] Pages The number of contiguous 4 KB pages to fre= e. > + > +@retval EFI_SUCCESS The requested pages were freed. > +@retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or > Pages is invalid. > +@retval EFI_NOT_FOUND The requested memory pages were not alloca= ted > with > + AllocatePages(). > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestFreePages ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN EFI_PHYSICAL_ADDRESS Memory, > + IN UINTN Pages > + ) > +{ > + return EFI_NOT_AVAILABLE_YET; > +} > diff --git > a/UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTes= tPe > iServicesTablePointerLibPpi.c > b/UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTes= tPe > iServicesTablePointerLibPpi.c > new file mode 100644 > index 0000000000..09f4094dad > --- /dev/null > +++ > b/UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTes= tPe > iServicesTablePointerLibPpi.c > @@ -0,0 +1,485 @@ > +/** @file > + This file implements some PEI services about PPI. > + > + Copyright (c) 2023, Intel Corporation. All rights reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "UnitTestPeiServicesTablePointerLib.h" > + > +/** > + > + This function installs an interface in the PEI PPI database by GUID. > + The purpose of the service is to publish an interface that other parti= es > + can use to call additional PEIMs. > + > + @param PeiServices An indirect pointer to the EFI_PEI_S= ERVICES table > published by the PEI Foundation. > + @param PpiList Pointer to a list of PEI PPI Descrip= tors. > + @param Single TRUE if only single entry in the Ppi= List. > + FALSE if the PpiList is ended with a= n entry which has the > + EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIS= T flag set in its > Flags field. > + > + @retval EFI_SUCCESS if all PPIs in PpiList are successful= ly installed. > + @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer > + if any PPI in PpiList is not valid > + @retval EFI_OUT_OF_RESOURCES if there is no more memory resource t= o > install PPI > + > +**/ > +EFI_STATUS > +InternalPeiInstallPpi ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList, > + IN BOOLEAN Single > + ) > +{ > + PEI_CORE_INSTANCE *PrivateData; > + PEI_PPI_LIST *PpiListPointer; > + UINTN Index; > + UINTN LastCount; > + > + if (PpiList =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + PrivateData =3D PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices); > + > + PpiListPointer =3D &PrivateData->PpiData.PpiList; > + Index =3D PpiListPointer->CurrentCount; > + LastCount =3D Index; > + > + // > + // This is loop installs all PPI descriptors in the PpiList. It is te= rminated > + // by the EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST being set in the last > + // EFI_PEI_PPI_DESCRIPTOR in the list. > + // > + > + for ( ; ;) { > + // > + // Check if it is a valid PPI. > + // If not, rollback list to exclude all in this list. > + // Try to indicate which item failed. > + // > + if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_PPI) =3D=3D 0) { > + PpiListPointer->CurrentCount =3D LastCount; > + DEBUG ((DEBUG_ERROR, "ERROR -> InstallPpi: %g %p\n", PpiList->Guid= , > PpiList->Ppi)); > + return EFI_INVALID_PARAMETER; > + } > + > + if (Index >=3D PpiListPointer->MaxCount) { > + // > + // Run out of room, assert. > + // > + ASSERT (Index < PpiListPointer->MaxCount); > + } > + > + DEBUG ((DEBUG_INFO, "Install PPI: %g\n", PpiList->Guid)); > + PpiListPointer->PpiPtrs[Index].Ppi =3D (EFI_PEI_PPI_DESCRIPTOR *)Ppi= List; > + Index++; > + PpiListPointer->CurrentCount++; > + > + if (Single) { > + // > + // Only single entry in the PpiList. > + // > + break; > + } else if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) = =3D=3D > + EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) > + { > + // > + // Continue until the end of the PPI List. > + // > + break; > + } > + > + // > + // Go to the next descriptor. > + // > + PpiList++; > + } > + > + // > + // Process any callback level notifies for newly installed PPIs. > + // > + ProcessNotify ( > + PrivateData, > + EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK, > + LastCount, > + PpiListPointer->CurrentCount, > + 0, > + PrivateData->PpiData.CallbackNotifyList.CurrentCount > + ); > + > + return EFI_SUCCESS; > +} > + > +/** > + > + This function installs an interface in the PEI PPI database by GUID. > + The purpose of the service is to publish an interface that other parti= es > + can use to call additional PEIMs. > + > + @param PeiServices An indirect pointer to the EFI_PEI_S= ERVICES table > published by the PEI Foundation. > + @param PpiList Pointer to a list of PEI PPI Descrip= tors. > + > + @retval EFI_SUCCESS if all PPIs in PpiList are successful= ly installed. > + @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer > + if any PPI in PpiList is not valid > + @retval EFI_OUT_OF_RESOURCES if there is no more memory resource t= o > install PPI > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestInstallPpi ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList > + ) > +{ > + return InternalPeiInstallPpi (PeiServices, PpiList, FALSE); > +} > + > +/** > + > + This function reinstalls an interface in the PEI PPI database by GUID. > + The purpose of the service is to publish an interface that other parti= es can > + use to replace an interface of the same name in the protocol database = with a > + different interface. > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVI= CES table > published by the PEI Foundation. > + @param OldPpi Pointer to the old PEI PPI Descriptors. > + @param NewPpi Pointer to the new PEI PPI Descriptors. > + > + @retval EFI_SUCCESS if the operation was successful > + @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL > + @retval EFI_INVALID_PARAMETER if NewPpi is not valid > + @retval EFI_NOT_FOUND if the PPI was not in the database > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestReInstallPpi ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi, > + IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi > + ) > +{ > + PEI_CORE_INSTANCE *PrivateData; > + UINTN Index; > + > + if ((OldPpi =3D=3D NULL) || (NewPpi =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + if ((NewPpi->Flags & EFI_PEI_PPI_DESCRIPTOR_PPI) =3D=3D 0) { > + return EFI_INVALID_PARAMETER; > + } > + > + PrivateData =3D PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices); > + > + // > + // Find the old PPI instance in the database. If we can not find it, > + // return the EFI_NOT_FOUND error. > + // > + for (Index =3D 0; Index < PrivateData->PpiData.PpiList.CurrentCount; I= ndex++) { > + if (OldPpi =3D=3D PrivateData->PpiData.PpiList.PpiPtrs[Index].Ppi) { > + break; > + } > + } > + > + if (Index =3D=3D PrivateData->PpiData.PpiList.CurrentCount) { > + return EFI_NOT_FOUND; > + } > + > + // > + // Replace the old PPI with the new one. > + // > + DEBUG ((DEBUG_INFO, "Reinstall PPI: %g\n", NewPpi->Guid)); > + PrivateData->PpiData.PpiList.PpiPtrs[Index].Ppi =3D (EFI_PEI_PPI_DESCR= IPTOR > *)NewPpi; > + > + // > + // Process any callback level notifies for the newly installed PPI. > + // > + ProcessNotify ( > + PrivateData, > + EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK, > + Index, > + Index+1, > + 0, > + PrivateData->PpiData.CallbackNotifyList.CurrentCount > + ); > + > + return EFI_SUCCESS; > +} > + > +/** > + > + Locate a given named PPI. > + > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES = table > published by the PEI Foundation. > + @param Guid Pointer to GUID of the PPI. > + @param Instance Instance Number to discover. > + @param PpiDescriptor Pointer to reference the found descriptor. I= f not > NULL, > + returns a pointer to the descriptor (include= s flags, etc) > + @param Ppi Pointer to reference the found PPI > + > + @retval EFI_SUCCESS if the PPI is in the database > + @retval EFI_NOT_FOUND if the PPI is not in the database > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestLocatePpi ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN CONST EFI_GUID *Guid, > + IN UINTN Instance, > + IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor, > + IN OUT VOID **Ppi > + ) > +{ > + PEI_CORE_INSTANCE *PrivateData; > + UINTN Index; > + EFI_GUID *CheckGuid; > + EFI_PEI_PPI_DESCRIPTOR *TempPtr; > + > + PrivateData =3D PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices); > + > + // > + // Search the data base for the matching instance of the GUIDed PPI. > + // > + for (Index =3D 0; Index < PrivateData->PpiData.PpiList.CurrentCount; I= ndex++) { > + TempPtr =3D PrivateData->PpiData.PpiList.PpiPtrs[Index].Ppi; > + CheckGuid =3D TempPtr->Guid; > + > + // > + // Don't use CompareGuid function here for performance reasons. > + // Instead we compare the GUID as INT32 at a time and branch > + // on the first failed comparison. > + // > + if ((((INT32 *)Guid)[0] =3D=3D ((INT32 *)CheckGuid)[0]) && > + (((INT32 *)Guid)[1] =3D=3D ((INT32 *)CheckGuid)[1]) && > + (((INT32 *)Guid)[2] =3D=3D ((INT32 *)CheckGuid)[2]) && > + (((INT32 *)Guid)[3] =3D=3D ((INT32 *)CheckGuid)[3])) > + { > + if (Instance =3D=3D 0) { > + if (PpiDescriptor !=3D NULL) { > + *PpiDescriptor =3D TempPtr; > + } > + > + if (Ppi !=3D NULL) { > + *Ppi =3D TempPtr->Ppi; > + } > + > + return EFI_SUCCESS; > + } > + > + Instance--; > + } > + } > + > + return EFI_NOT_FOUND; > +} > + > +/** > + > + This function installs a notification service to be called back when a= given > + interface is installed or reinstalled. The purpose of the service is t= o publish > + an interface that other parties can use to call additional PPIs that m= ay > materialize later. > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES = table > published by the PEI Foundation. > + @param NotifyList Pointer to list of Descriptors to notify upo= n. > + @param Single TRUE if only single entry in the NotifyList. > + FALSE if the NotifyList is ended with an ent= ry which has the > + EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST flag s= et in its Flags > field. > + > + @retval EFI_SUCCESS if successful > + @retval EFI_OUT_OF_RESOURCES if no space in the database > + @retval EFI_INVALID_PARAMETER if not a good descriptor > + > +**/ > +EFI_STATUS > +InternalPeiNotifyPpi ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList, > + IN BOOLEAN Single > + ) > +{ > + PEI_CORE_INSTANCE *PrivateData; > + PEI_CALLBACK_NOTIFY_LIST *CallbackNotifyListPointer; > + UINTN CallbackNotifyIndex; > + UINTN LastCallbackNotifyCount; > + PEI_DISPATCH_NOTIFY_LIST *DispatchNotifyListPointer; > + UINTN DispatchNotifyIndex; > + UINTN LastDispatchNotifyCount; > + > + if (NotifyList =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + PrivateData =3D PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices); > + > + CallbackNotifyListPointer =3D &PrivateData->PpiData.CallbackNotifyList= ; > + CallbackNotifyIndex =3D CallbackNotifyListPointer->CurrentCount; > + LastCallbackNotifyCount =3D CallbackNotifyIndex; > + > + DispatchNotifyListPointer =3D &PrivateData->PpiData.DispatchNotifyList= ; > + DispatchNotifyIndex =3D DispatchNotifyListPointer->CurrentCount; > + LastDispatchNotifyCount =3D DispatchNotifyIndex; > + > + // > + // This is loop installs all Notify descriptors in the NotifyList. It= is > + // terminated by the EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST being set i= n > the last > + // EFI_PEI_NOTIFY_DESCRIPTOR in the list. > + // > + > + for ( ; ;) { > + // > + // If some of the PPI data is invalid restore original Notify PPI da= tabase value > + // > + if ((NotifyList->Flags & EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES) =3D=3D= 0) { > + CallbackNotifyListPointer->CurrentCount =3D LastCallbackNotifyCoun= t; > + DispatchNotifyListPointer->CurrentCount =3D LastDispatchNotifyCoun= t; > + DEBUG ((DEBUG_ERROR, "ERROR -> NotifyPpi: %g %p\n", NotifyList->Gu= id, > NotifyList->Notify)); > + return EFI_INVALID_PARAMETER; > + } > + > + if ((NotifyList->Flags & EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK) != =3D 0) { > + if (CallbackNotifyIndex >=3D CallbackNotifyListPointer->MaxCount) = { > + // > + // Run out of room, assert. > + // > + ASSERT (CallbackNotifyIndex < CallbackNotifyListPointer->MaxCoun= t); > + } > + > + CallbackNotifyListPointer->NotifyPtrs[CallbackNotifyIndex].Notify = =3D > (EFI_PEI_NOTIFY_DESCRIPTOR *)NotifyList; > + CallbackNotifyIndex++; > + CallbackNotifyListPointer->CurrentCount++; > + } else { > + ASSERT ((NotifyList->Flags & > EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK) !=3D 0); > + } > + > + DEBUG ((DEBUG_INFO, "Register PPI Notify: %g\n", NotifyList->Guid)); > + > + if (Single) { > + // > + // Only single entry in the NotifyList. > + // > + break; > + } else if ((NotifyList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIS= T) =3D=3D > + EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) > + { > + // > + // Continue until the end of the Notify List. > + // > + break; > + } > + > + // > + // Go to the next descriptor. > + // > + NotifyList++; > + } > + > + // > + // Process any callback level notifies for all previously installed PP= Is. > + // > + ProcessNotify ( > + PrivateData, > + EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK, > + 0, > + PrivateData->PpiData.PpiList.CurrentCount, > + LastCallbackNotifyCount, > + CallbackNotifyListPointer->CurrentCount > + ); > + > + return EFI_SUCCESS; > +} > + > +/** > + > + This function installs a notification service to be called back when a= given > + interface is installed or reinstalled. The purpose of the service is t= o publish > + an interface that other parties can use to call additional PPIs that m= ay > materialize later. > + > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES = table > published by the PEI Foundation. > + @param NotifyList Pointer to list of Descriptors to notify upo= n. > + > + @retval EFI_SUCCESS if successful > + @retval EFI_OUT_OF_RESOURCES if no space in the database > + @retval EFI_INVALID_PARAMETER if not a good descriptor > + > +**/ > +EFI_STATUS > +EFIAPI > +UnitTestNotifyPpi ( > + IN CONST EFI_PEI_SERVICES **PeiServices, > + IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList > + ) > +{ > + return InternalPeiNotifyPpi (PeiServices, NotifyList, FALSE); > +} > + > +/** > + > + Process notifications. > + > + @param PrivateData PeiCore's private data structure > + @param NotifyType Type of notify to fire. > + @param InstallStartIndex Install Beginning index. > + @param InstallStopIndex Install Ending index. > + @param NotifyStartIndex Notify Beginning index. > + @param NotifyStopIndex Notify Ending index. > + > +**/ > +VOID > +ProcessNotify ( > + IN PEI_CORE_INSTANCE *PrivateData, > + IN UINTN NotifyType, > + IN INTN InstallStartIndex, > + IN INTN InstallStopIndex, > + IN INTN NotifyStartIndex, > + IN INTN NotifyStopIndex > + ) > +{ > + INTN Index1; > + INTN Index2; > + EFI_GUID *SearchGuid; > + EFI_GUID *CheckGuid; > + EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor; > + > + for (Index1 =3D NotifyStartIndex; Index1 < NotifyStopIndex; Index1++) = { > + if (NotifyType =3D=3D EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK) { > + NotifyDescriptor =3D PrivateData- > >PpiData.CallbackNotifyList.NotifyPtrs[Index1].Notify; > + } else { > + NotifyDescriptor =3D PrivateData- > >PpiData.DispatchNotifyList.NotifyPtrs[Index1].Notify; > + } > + > + CheckGuid =3D NotifyDescriptor->Guid; > + > + for (Index2 =3D InstallStartIndex; Index2 < InstallStopIndex; Index2= ++) { > + SearchGuid =3D PrivateData->PpiData.PpiList.PpiPtrs[Index2].Ppi->G= uid; > + // > + // Don't use CompareGuid function here for performance reasons. > + // Instead we compare the GUID as INT32 at a time and branch > + // on the first failed comparison. > + // > + if ((((INT32 *)SearchGuid)[0] =3D=3D ((INT32 *)CheckGuid)[0]) && > + (((INT32 *)SearchGuid)[1] =3D=3D ((INT32 *)CheckGuid)[1]) && > + (((INT32 *)SearchGuid)[2] =3D=3D ((INT32 *)CheckGuid)[2]) && > + (((INT32 *)SearchGuid)[3] =3D=3D ((INT32 *)CheckGuid)[3])) > + { > + DEBUG (( > + DEBUG_INFO, > + "Notify: PPI Guid: %g, Peim notify entry point: %p\n", > + SearchGuid, > + NotifyDescriptor->Notify > + )); > + NotifyDescriptor->Notify ( > + (EFI_PEI_SERVICES **)GetPeiServicesTablePoin= ter (), > + NotifyDescriptor, > + (PrivateData->PpiData.PpiList.PpiPtrs[Index2= ].Ppi)->Ppi > + ); > + } > + } > + } > +} > diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.dsc > b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.dsc > index a76e31d97d..872d9c0d8c 100644 > --- a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.dsc > +++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.dsc > @@ -35,6 +35,7 @@ >=20 > UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem/UnitT= est > PersistenceLibSimpleFileSystem.inf >=20 > UnitTestFrameworkPkg/Library/UnitTestDebugAssertLib/UnitTestDebugAssertLi= b. > inf >=20 > UnitTestFrameworkPkg/Library/UnitTestUefiBootServicesTableLib/UnitTestUef= iB > ootServicesTableLib.inf > + > UnitTestFrameworkPkg/Library/UnitTestPeiServicesTablePointerLib/UnitTestP= eiS > ervicesTablePointerLib.inf >=20 >=20 > UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTest/SampleUnitTestD > xe.inf >=20 > UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTest/SampleUnitTestP > ei.inf > diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc > b/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc > index 7866c36e66..5217de31e4 100644 > --- a/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc > +++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc > @@ -21,6 +21,7 @@ >=20 > DebugLib|UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.i= n > f >=20 > MemoryAllocationLib|UnitTestFrameworkPkg/Library/Posix/MemoryAllocationLi= b > Posix/MemoryAllocationLibPosix.inf >=20 > UefiBootServicesTableLib|UnitTestFrameworkPkg/Library/UnitTestUefiBootSer= vi > cesTableLib/UnitTestUefiBootServicesTableLib.inf > + > PeiServicesTablePointerLib|UnitTestFrameworkPkg/Library/UnitTestPeiServic= esT > ablePointerLib/UnitTestPeiServicesTablePointerLib.inf >=20 > [BuildOptions] > GCC:*_*_*_CC_FLAGS =3D -fno-pie > -- > 2.31.1.windows.1 >=20 >=20 >=20 >=20 >=20