From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 2B1CDD8026F for ; Thu, 9 May 2024 23:02:48 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=8PGBlLQNOh8Njtj0ouFTg0woubikbLZ67dEZd9Dx0CY=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20240206; t=1715295766; v=1; b=R4xdWLxMg2/XbnfvTuIXzdYe2qU1iNdllCsqTBpytdcummFSgVUMxqsWjikYnDBvDvse/Dmb VEJI+havuGR5zOjRErACdtBqhsEuoK7nnyi03viCgf2+iF4fgpgN01MwaSp73lG51uidKVA6ykB hacHszhhTgEQOdGF79F+k6D6UL3lLTB5mPyIswndkxXUh1IxZf7yMxuLbb5q7esrqeYArnA6y0B f6gRXAm36dWD0sU+8hugYDgBX4NBYhNTbtI51Bp5kPi2V/rAjz4+ce26tsnaxQ+kxPBXniNb7P1 hAc5LfV60BgyHuQz3qnDvjfXas3J9CCj0LF1s2M/sE4KA== X-Received: by 127.0.0.2 with SMTP id kRSFYY7687511x91iCth3qS4; Thu, 09 May 2024 16:02:46 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by mx.groups.io with SMTP id smtpd.web10.257.1715295765460566765 for ; Thu, 09 May 2024 16:02:45 -0700 X-CSE-ConnectionGUID: omUgQMO0QGqbT2xvbKGpjQ== X-CSE-MsgGUID: tLkN/6reQuezCv3zH65s8w== X-IronPort-AV: E=McAfee;i="6600,9927,11068"; a="11087155" X-IronPort-AV: E=Sophos;i="6.08,149,1712646000"; d="scan'208";a="11087155" X-Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2024 16:02:45 -0700 X-CSE-ConnectionGUID: sYUW97MvTBK4PMxvcPT9sw== X-CSE-MsgGUID: FI3hz3W8SOecU7JNrmT+aA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,149,1712646000"; d="scan'208";a="52614173" X-Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmviesa002.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 09 May 2024 16:02:44 -0700 X-Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 9 May 2024 16:02:43 -0700 X-Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 9 May 2024 16:02:43 -0700 X-Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Thu, 9 May 2024 16:02:43 -0700 X-Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.168) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Thu, 9 May 2024 16:02:43 -0700 X-Received: from CH0PR11MB5475.namprd11.prod.outlook.com (2603:10b6:610:d6::21) by CH3PR11MB8704.namprd11.prod.outlook.com (2603:10b6:610:1c7::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.46; Thu, 9 May 2024 23:02:41 +0000 X-Received: from CH0PR11MB5475.namprd11.prod.outlook.com ([fe80::63bf:7377:124e:e607]) by CH0PR11MB5475.namprd11.prod.outlook.com ([fe80::63bf:7377:124e:e607%6]) with mapi id 15.20.7544.045; Thu, 9 May 2024 23:02:41 +0000 From: "Chiu, Chasel" To: "Desimone, Nathaniel L" , "devel@edk2.groups.io" CC: Liming Gao , "Dong, Eric" , "Chaganty, Rangasai V" , "Chuang, Rosen" , "Kasbekar, Saloni" Subject: Re: [edk2-devel] [edk2-platforms] [PATCH v1 1/2] MinPlatform: Add MpInfo2HobPei Thread-Topic: [edk2-platforms] [PATCH v1 1/2] MinPlatform: Add MpInfo2HobPei Thread-Index: AQHaoaUsxXrrwr5x+EuuZYJoQAi43bGPhYCg Date: Thu, 9 May 2024 23:02:41 +0000 Message-ID: References: <20240509000918.2336-1-nathaniel.l.desimone@intel.com> <20240509000918.2336-2-nathaniel.l.desimone@intel.com> In-Reply-To: <20240509000918.2336-2-nathaniel.l.desimone@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CH0PR11MB5475:EE_|CH3PR11MB8704:EE_ x-ms-office365-filtering-correlation-id: daffdbc0-a9f4-4734-06f8-08dc707c20ff x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: =?us-ascii?Q?yg/Ir3txTILgb2NxCnqr1fU7D3ZWuvBILXjudtXVxmR7Ry/V1FgXRgiC+/Xm?= =?us-ascii?Q?fXsAttQq1LmsV3rCMlnZXW1pDuauHIWX7qcKbOVnlaxXWqul0TKCDRi60+bX?= =?us-ascii?Q?BPEM2zY7hblkayrCYDzB/mffC/wIa7bfkMv5EleOAorI/cSzDbIkkVgThCcc?= =?us-ascii?Q?sRui3vJYhh/+oyVNmjZFQ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QMSV7S7?= =?us-ascii?Q?UjoedkUPt7icdxSUhA8ClEv0uquP0nZe3Eo6upYcs0KVC+40NjUa6SWMhlxh?= =?us-ascii?Q?WLFfrxKPAqqpnK4I30Gofz9GGncvnhkZqTQhTR4mJiOJCeXi+U8idif7xsVj?= =?us-ascii?Q?fwAKIbK/sBKF+bBf+bdCBiSpMJGu/EumMNui/gN7xLM+d3HARq38z4QgzPN1?= =?us-ascii?Q?5iOIhQZkTgTjND9L7k5vKptjvgE5iBzFbWq67D9R0toviMfhKm78/MXSNAoH?= =?us-ascii?Q?I5rmweE/+sehhVq7yEYXdmo7sxmvGu67Doy91KMaJGOCqw=3D=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?nEuvPy4vZtGcRBQbKDqR5jGUeM2U7Y/m8stbv6vtF89I2XfXanZPpBUqXuG/?= =?us-ascii?Q?45CSNbvz/ScDoyciG58wY4ehqzQ9j9JmchlWWtWuWYCLXyIzMoI5TCDxB84S?= =?us-ascii?Q?2OsrE5YXuOXyOSQXhhfXFZNb4sMw9s0sWrq3j2+4CRSvgm2lqQy6AAkE5saQ?= =?us-ascii?Q?jzg3gfGvcOUZs+IjDhY/V/Sosc46/c7w9ZoPJC3Ur+GPiXYiaajS2E8vZHe5?= =?us-ascii?Q?e8QOgt5S1FTjy3LIeHRFFpuytd3Ct4pW/cGrKiiWeqI3jugCq2Al5cVeImLO?= =?us-ascii?Q?kksUC1h2/YWkRuP6cvPCbmsYIpI0FfLQ6KpmYRAEoXZhYfJHfq8BToXkQuE8?= =?us-ascii?Q?3iCbN8hiHLbf7WPgjN/2S9eFw8RL8HeuOWuCARgYrSZdQgmJeWfmctK66Dqx?= =?us-ascii?Q?3uBM22K3t6o+SetrN9c5Fr76hA4AE0s5S7DRyYWTWkAs+wsMDZmG2reQTf7p?= =?us-ascii?Q?cXd31pOwEVB4AZOxn8eS0xoCyO+YGNFOHQbVhb22I0itwDeFU6e0aMl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UJXK+nKW+PlcskNaGFoJcIvRjhSvC+Skb?= =?us-ascii?Q?H1rWS/6ZZ9CTTpQ+M/wpm+m+T4emrC0SvTngtZOewdBJEmmBLDNkFCXNhRLV?= =?us-ascii?Q?326Oxsho2Tlh148Vg1N/tgYU1RplzjR9KBQbyuVYJrb5dC9TT81j/ZZem3Qs?= =?us-ascii?Q?elpN9yBG5IG6F5108cKtcChb907QDwynAghJBKLR?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CH0PR11MB5475.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: daffdbc0-a9f4-4734-06f8-08dc707c20ff X-MS-Exchange-CrossTenant-originalarrivaltime: 09 May 2024 23:02:41.1000 (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: i9WrNefQQMLJo4DPSAfrFOP+5bFxXcqLOzFSy1TkYaCogqPF3Gx8HqTBEqK3IHfwXZWk4kcxIveuUJf+GNcqag== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB8704 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Thu, 09 May 2024 16:02:45 -0700 Resent-From: chasel.chiu@intel.com Reply-To: devel@edk2.groups.io,chasel.chiu@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: UDJPGVnmR2Qnt3KDPh48C7gQx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=R4xdWLxM; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 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) Hi Nate, Change looks good. Reviewed-by: Chasel Chiu Just one minor optimization you might consider in below inline when merging= this patch series. Thanks, Chasel > -----Original Message----- > From: Desimone, Nathaniel L > Sent: Wednesday, May 8, 2024 5:09 PM > To: devel@edk2.groups.io > Cc: Chiu, Chasel ; Liming Gao > ; Dong, Eric ; Chaganty, > Rangasai V ; Chuang, Rosen > ; Kasbekar, Saloni > Subject: [edk2-platforms] [PATCH v1 1/2] MinPlatform: Add MpInfo2HobPei >=20 > MpInfo2HobPei provides backwards compatibility between FSP binaries built= with > older versions of EDK II and the latest EDK II. >=20 > Newer versions of CpuMpPei produce the gMpInformation2HobGuid. This HOB i= s > required by newer implementations of the CPU DXE driver, however older > versions of CpuMpPei do not produce it. This PEIM will check if CpuMpPei = creates > gMpInformation2HobGuid and if it does not it creates it. >=20 > Cc: Chasel Chiu > Cc: Liming Gao > Cc: Eric Dong > Cc: Sai Chaganty > Cc: Rosen Chuang > Cc: Saloni Kasbekar > Signed-off-by: Nate DeSimone > --- > .../FspWrapper/MpInfo2HobPei/MpInfo2HobPei.c | 236 ++++++++++++++++++ > .../MpInfo2HobPei/MpInfo2HobPei.inf | 47 ++++ > .../Intel/MinPlatformPkg/MinPlatformPkg.dsc | 3 +- > 3 files changed, 285 insertions(+), 1 deletion(-) create mode 100644 > Platform/Intel/MinPlatformPkg/FspWrapper/MpInfo2HobPei/MpInfo2HobPei.c > create mode 100644 > Platform/Intel/MinPlatformPkg/FspWrapper/MpInfo2HobPei/MpInfo2HobPei.inf >=20 > diff --git > a/Platform/Intel/MinPlatformPkg/FspWrapper/MpInfo2HobPei/MpInfo2HobPei.c > b/Platform/Intel/MinPlatformPkg/FspWrapper/MpInfo2HobPei/MpInfo2HobPei.c > new file mode 100644 > index 0000000000..4cbc4cf7e6 > --- /dev/null > +++ > b/Platform/Intel/MinPlatformPkg/FspWrapper/MpInfo2HobPei/MpInfo2HobP > +++ ei.c > @@ -0,0 +1,236 @@ > +/** @file > + Multi-processor Info 2 HOB PEIM. > + > + The purpose of this PEIM is to provide backwards compatibility > + between FSP binaries built with older versions of EDK II and the lates= t EDK II. > + > + Newer versions of CpuMpPei produce the gMpInformation2HobGuid. This > + HOB is required by newer implementations of the CPU DXE driver, > + however older versions of CpuMpPei do not produce it. This PEIM will > + check if CpuMpPei creates gMpInformation2HobGuid and if it does not it > creates it. > + > +Copyright (c) 2024, Intel Corporation. All rights reserved.
> + > +SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > +#include > +#include > +#include #include > + > + > +#include > +#include > +#include > + > +typedef struct { > + EDKII_PEI_MP_SERVICES2_PPI *CpuMpPpi2; > + UINT8 *CoreTypes; > +} GET_PROCESSOR_CORE_TYPE_BUFFER; > + > +/** > + Get CPU core type. > + > + @param[in, out] Buffer Argument of the procedure. > +**/ > +VOID > +EFIAPI > +GetProcessorCoreType ( > + IN OUT VOID *Buffer > + ) > +{ > + EFI_STATUS Status; > + UINT8 *CoreTypes; > + CPUID_NATIVE_MODEL_ID_AND_CORE_TYPE_EAX > NativeModelIdAndCoreTypeEax; > + UINTN ProcessorIndex; > + GET_PROCESSOR_CORE_TYPE_BUFFER *Params; > + > + Params =3D (GET_PROCESSOR_CORE_TYPE_BUFFER *)Buffer; Status =3D > + Params->CpuMpPpi2->WhoAmI (Params->CpuMpPpi2, &ProcessorIndex); > + ASSERT_EFI_ERROR (Status); > + > + CoreTypes =3D Params->CoreTypes; > + AsmCpuidEx (CPUID_HYBRID_INFORMATION, > +CPUID_HYBRID_INFORMATION_MAIN_LEAF, > +&NativeModelIdAndCoreTypeEax.Uint32, NULL, NULL, NULL); > + CoreTypes[ProcessorIndex] =3D > +(UINT8)NativeModelIdAndCoreTypeEax.Bits.CoreType; > +} > + > +/** > + Create gMpInformation2HobGuid. > +**/ > +VOID > +BuildMpInformationHob ( > + IN EDKII_PEI_MP_SERVICES2_PPI *CpuMpPpi2 > + ) > +{ > + GET_PROCESSOR_CORE_TYPE_BUFFER Buffer; > + EFI_STATUS Status; > + UINTN ProcessorIndex; > + UINTN NumberOfProcessors; > + UINTN NumberOfEnabledProcessors; > + UINTN NumberOfProcessorsInHob; > + UINTN MaxProcessorsPerHob; > + MP_INFORMATION2_HOB_DATA *MpInformation2HobData; > + MP_INFORMATION2_ENTRY *MpInformation2Entry; > + UINTN Index; > + UINT8 *CoreTypes; > + UINT32 CpuidMaxInput; > + UINTN CoreTypePages; > + > + ProcessorIndex =3D 0; > + MpInformation2HobData =3D NULL; > + MpInformation2Entry =3D NULL; > + CoreTypes =3D NULL; > + CoreTypePages =3D 0; > + > + Status =3D CpuMpPpi2->GetNumberOfProcessors ( > + CpuMpPpi2, > + &NumberOfProcessors, > + &NumberOfEnabledProcessors > + ); > + ASSERT_EFI_ERROR (Status); > + if (EFI_ERROR (Status)) { > + goto Done; > + } > + > + // > + // Get Processors CoreType > + // > + AsmCpuid (CPUID_SIGNATURE, &CpuidMaxInput, NULL, NULL, NULL); if > + (CpuidMaxInput >=3D CPUID_HYBRID_INFORMATION) { > + CoreTypePages =3D EFI_SIZE_TO_PAGES (sizeof (UINT8) * NumberOfProces= sors); > + CoreTypes =3D AllocatePages (CoreTypePages); > + ASSERT (CoreTypes !=3D NULL); > + if (CoreTypes =3D=3D NULL) { > + goto Done; > + } > + > + Buffer.CoreTypes =3D CoreTypes; > + Buffer.CpuMpPpi2 =3D CpuMpPpi2; > + Status =3D CpuMpPpi2->StartupAllCPUs ( > + CpuMpPpi2, > + GetProcessorCoreType, > + 0, > + (VOID *)&Buffer > + ); > + ASSERT_EFI_ERROR (Status); > + } > + > + MaxProcessorsPerHob =3D ((MAX_UINT16 & ~7) - sizeof > (EFI_HOB_GUID_TYPE) - sizeof (MP_INFORMATION2_HOB_DATA)) / sizeof > (MP_INFORMATION2_ENTRY); > + NumberOfProcessorsInHob =3D MaxProcessorsPerHob; > + > + // > + // Create MP_INFORMATION2_HOB. when the max HobLength 0xFFF8 is not > + enough, there // will be a MP_INFORMATION2_HOB series in the HOB list. > + // In the HOB list, there is a gMpInformation2HobGuid with 0 value > + NumberOfProcessors // fields to indicate it's the last > MP_INFORMATION2_HOB. > + // > + while (NumberOfProcessorsInHob !=3D 0) { > + NumberOfProcessorsInHob =3D MIN (NumberOfProcessors - ProcessorIndex= , > MaxProcessorsPerHob); > + MpInformation2HobData =3D BuildGuidHob ( > + &gMpInformation2HobGuid, > + sizeof (MP_INFORMATION2_HOB_DATA) + size= of > (MP_INFORMATION2_ENTRY) * NumberOfProcessorsInHob > + ); > + ASSERT (MpInformation2HobData !=3D NULL); > + if (MpInformation2HobData =3D=3D NULL) { > + goto Done; > + } > + > + MpInformation2HobData->Version =3D > MP_INFORMATION2_HOB_REVISION; > + MpInformation2HobData->ProcessorIndex =3D ProcessorIndex; > + MpInformation2HobData->NumberOfProcessors =3D > (UINT16)NumberOfProcessorsInHob; > + MpInformation2HobData->EntrySize =3D sizeof > (MP_INFORMATION2_ENTRY); > + > + DEBUG ((DEBUG_INFO, "Creating MpInformation2 HOB...\n")); > + > + for (Index =3D 0; Index < NumberOfProcessorsInHob; Index++) { > + MpInformation2Entry =3D &MpInformation2HobData->Entry[Index]; > + Status =3D CpuMpPpi2->GetProcessorInfo ( > + CpuMpPpi2, > + (Index + ProcessorIndex) | > CPU_V2_EXTENDED_TOPOLOGY, > + &MpInformation2Entry->Processor= Info > + ); > + ASSERT_EFI_ERROR (Status); > + > + MpInformation2Entry->CoreType =3D (CoreTypes !=3D NULL) ? > + CoreTypes[Index + ProcessorIndex] : 0; > + > + DEBUG (( > + DEBUG_INFO, > + " Processor[%04d]: ProcessorId =3D 0x%lx, StatusFlag =3D 0x%x, = CoreType =3D > 0x%x\n", > + Index + ProcessorIndex, > + MpInformation2Entry->ProcessorInfo.ProcessorId, > + MpInformation2Entry->ProcessorInfo.StatusFlag, > + MpInformation2Entry->CoreType > + )); > + DEBUG (( > + DEBUG_INFO, > + " Location =3D Package:%d Core:%d Thread:%d\n", > + MpInformation2Entry->ProcessorInfo.Location.Package, > + MpInformation2Entry->ProcessorInfo.Location.Core, > + MpInformation2Entry->ProcessorInfo.Location.Thread > + )); > + DEBUG (( > + DEBUG_INFO, > + " Location2 =3D Package:%d Die:%d Tile:%d Module:%d Core:%d > Thread:%d\n", > + MpInformation2Entry- > >ProcessorInfo.ExtendedInformation.Location2.Package, > + MpInformation2Entry->ProcessorInfo.ExtendedInformation.Location2= .Die, > + MpInformation2Entry->ProcessorInfo.ExtendedInformation.Location2= .Tile, > + MpInformation2Entry- > >ProcessorInfo.ExtendedInformation.Location2.Module, > + MpInformation2Entry->ProcessorInfo.ExtendedInformation.Location2= .Core, > + MpInformation2Entry- > >ProcessorInfo.ExtendedInformation.Location2.Thread > + )); > + } > + > + ProcessorIndex +=3D NumberOfProcessorsInHob; } > + > +Done: > + if (CoreTypes !=3D NULL) { > + FreePages (CoreTypes, CoreTypePages); > + } > +} > + > +/** > + Check if CpuMpPei creates gMpInformation2HobGuid and if it does not > +it > + creates it. > + > + @param[in] ImageHandle Handle for the image of this driver > + @param[in] SystemTable Pointer to the EFI System Table > + > + @retval EFI_UNSUPPORTED > +**/ > +EFI_STATUS > +EFIAPI > +MpInfo2HobPeiEntryPoint ( > + IN EFI_PEI_FILE_HANDLE FileHandle, > + IN CONST EFI_PEI_SERVICES **PeiServices > + ) > +{ > + EFI_STATUS Status; > + EFI_PEI_PPI_DESCRIPTOR *TempPpiDescriptor; > + EDKII_PEI_MP_SERVICES2_PPI *CpuMpPpi2; > + EFI_HOB_GUID_TYPE *GuidHob; > + > + Status =3D PeiServicesLocatePpi ( > + &gEdkiiPeiMpServices2PpiGuid, > + 0, > + &TempPpiDescriptor, > + (VOID **)&CpuMpPpi2 > + ); > + ASSERT_EFI_ERROR (Status); > + if (EFI_ERROR (Status)) { > + goto Done; > + } > + > + GuidHob =3D GetFirstGuidHob (&gMpInformation2HobGuid); if (GuidHob = =3D=3D > + NULL) { You might want to move PPI allocation code here as we only consume it when = GuidHob =3D=3D NULL. > + DEBUG ((DEBUG_INFO, "gMpInformation2HobGuid was not created by > CpuMpPei, creating now\n")); > + BuildMpInformationHob (CpuMpPpi2); > + } > + > +Done: > + return Status; > +} > diff --git > a/Platform/Intel/MinPlatformPkg/FspWrapper/MpInfo2HobPei/MpInfo2HobPei.i > nf > b/Platform/Intel/MinPlatformPkg/FspWrapper/MpInfo2HobPei/MpInfo2HobPei.i > nf > new file mode 100644 > index 0000000000..eecfdbf422 > --- /dev/null > +++ > b/Platform/Intel/MinPlatformPkg/FspWrapper/MpInfo2HobPei/MpInfo2HobP > +++ ei.inf > @@ -0,0 +1,47 @@ > +### @file > +# Component information file for the Multi-processor Info 2 HOB PEIM. > +# > +# The purpose of this PEIM is to provide backwards compatibility > +between FSP # binaries built with older versions of EDK II and the lates= t EDK II. > +# > +# Newer versions of CpuMpPei produce the gMpInformation2HobGuid. This > +HOB is # required by newer implementations of the CPU DXE driver, > +however older # versions of CpuMpPei do not produce it. This PEIM will > +check if CpuMpPei # creates gMpInformation2HobGuid and if it does not it > creates it. > +# > +# Copyright (c) 2024, Intel Corporation. All rights reserved.
# # > +SPDX-License-Identifier: BSD-2-Clause-Patent # ### > + > +[Defines] > + INF_VERSION =3D 0x00010017 > + BASE_NAME =3D MpInfo2HobPei > + FILE_GUID =3D 010B5607-D5B3-4302-BCBC-C1A68087E9B= E > + VERSION_STRING =3D 1.0 > + MODULE_TYPE =3D PEIM > + ENTRY_POINT =3D MpInfo2HobPeiEntryPoint > + > +[LibraryClasses] > + PeimEntryPoint > + DebugLib > + MemoryAllocationLib > + HobLib > + > +[Packages] > + MdePkg/MdePkg.dec > + UefiCpuPkg/UefiCpuPkg.dec > + MinPlatformPkg/MinPlatformPkg.dec > + > +[Sources] > + MpInfo2HobPei.c > + > +[Guids] > + gMpInformation2HobGuid ## SOMETIMES_PRODUCES = ## HOB > + > +[Ppis] > + gEdkiiPeiMpServices2PpiGuid ## CONSUMES > + > +[Depex] > + gEdkiiPeiMpServices2PpiGuid > diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc > b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc > index ecb4d8f65e..30cdf1fb82 100644 > --- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc > +++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc > @@ -1,7 +1,7 @@ > ## @file > # Platform description. > # > -# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
> +# Copyright (c) 2017 - 2024, Intel Corporation. All rights > +reserved.
> # Copyright (c) Microsoft Corporation.
# # SPDX-License-Identifier= : BSD-2- > Clause-Patent @@ -150,6 +150,7 @@ >=20 > MinPlatformPkg/Bds/Library/DxePlatformBootManagerLib/DxePlatformBootMan > agerLib.inf >=20 > MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.inf > + MinPlatformPkg/FspWrapper/MpInfo2HobPei/MpInfo2HobPei.inf >=20 > MinPlatformPkg/FspWrapper/Library/PeiFspWrapperHobProcessLib/PeiFspWrapp > erHobProcessLib.inf >=20 > MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecFspWrap > perPlatformSecLib.inf >=20 > MinPlatformPkg/FspWrapper/Library/PeiFspWrapperPlatformLib/PeiFspWrapper > PlatformLib.inf > -- > 2.44.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118773): https://edk2.groups.io/g/devel/message/118773 Mute This Topic: https://groups.io/mt/105992897/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-