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 D279B941E26 for ; Mon, 13 May 2024 20:48:36 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=JSrAkflk5c9pD+L+8i64OwKidTkEePDoXemJ/NI0foM=; 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=1715633315; v=1; b=fiM5vNsOJ3PgyEJkWq7Y13hc/Z/jeg65wc7MUmMtj6aijdHQWPs0bia1LnFf8dORhIM0HE0Z 5+Bn3ESx9zvgTPnRIjj8KhCKYNYb7OVlx8iPdsWDTZDLAtmmIqTwoTRYNVcLJCIPVcda5lHQSBt Vb5djku6QxKrNdvJz20n9L69tSPfAOgRb2FC2cUIRmh1aDOHptLfoaQfGX8UmuAcz+vpw00LkIK eFrufARISAme13T/vnGXbMNDxyTFk0hHM16nMAVSBBpsxA6XchEdtictp7New0It4d1gh927tzn 557gmkqyRU82o52teNm8FGSUnjaLlWbeSp5lK9iJ36AiA== X-Received: by 127.0.0.2 with SMTP id tUbKYY7687511x74cIdQ65YI; Mon, 13 May 2024 13:48:35 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by mx.groups.io with SMTP id smtpd.web11.4716.1715633314181299529 for ; Mon, 13 May 2024 13:48:34 -0700 X-CSE-ConnectionGUID: adcYhp0ZTeOXTrwUEH7+iQ== X-CSE-MsgGUID: ihLK3muPSyyX8zn+hOmFyg== X-IronPort-AV: E=McAfee;i="6600,9927,11072"; a="15425859" X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="15425859" X-Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2024 13:48:34 -0700 X-CSE-ConnectionGUID: YpkAey3cShqlZQHnT8hd1w== X-CSE-MsgGUID: fLrVNkZrTSiWlsb3e4HEYQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="35001246" X-Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmviesa004.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 13 May 2024 13:48:33 -0700 X-Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 13 May 2024 13:48:32 -0700 X-Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 13 May 2024 13:48:32 -0700 X-Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 13 May 2024 13:48:32 -0700 X-Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.40) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 13 May 2024 13:48:32 -0700 X-Received: from PH0PR11MB5832.namprd11.prod.outlook.com (2603:10b6:510:141::7) by PH0PR11MB4936.namprd11.prod.outlook.com (2603:10b6:510:42::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Mon, 13 May 2024 20:48:30 +0000 X-Received: from PH0PR11MB5832.namprd11.prod.outlook.com ([fe80::c338:32f0:7c75:67d8]) by PH0PR11MB5832.namprd11.prod.outlook.com ([fe80::c338:32f0:7c75:67d8%7]) with mapi id 15.20.7544.052; Mon, 13 May 2024 20:48:30 +0000 From: "Nate DeSimone" To: "Chaganty, Rangasai V" , "devel@edk2.groups.io" CC: "Chiu, Chasel" , Liming Gao , "Dong, Eric" , "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: AQHaondsxXrrwr5x+EuuZYJoQAi43bGVfMyg Date: Mon, 13 May 2024 20:48:30 +0000 Message-ID: References: <20240509000918.2336-1-nathaniel.l.desimone@intel.com> <20240509000918.2336-2-nathaniel.l.desimone@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH0PR11MB5832:EE_|PH0PR11MB4936:EE_ x-ms-office365-filtering-correlation-id: eabfccd8-fa26-4d8f-deb5-08dc738e0c28 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: =?us-ascii?Q?UBw3CexUQ7iwq+re+2x/0CISA4vRDpAABvo3AoXmysJe+G/EpX1DTwZ6c/dZ?= =?us-ascii?Q?sBAQ64r1awpRdVsLhbChd8BZzdZHN2c7kiWQDK94+eHzGY35GNwNChsUk3EO?= =?us-ascii?Q?Wm6IY8eclAbpH+geSiGTVPw8wmdxhRasIvohye0BXiTCUR9F7uMM/xfCe2UT?= =?us-ascii?Q?J85n4LLaaJSC8hlAQqpUalBASuWI87paVk+ggbasDYVdAEvZHv3+P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U/kPTycXiEnqPnPIhz+fawcZRyGdKh0d2AnosEjScnG?= =?us-ascii?Q?ZNiPjGMqqk6yl21/0dtcA+kEXjwR40iauW74i5TOKuNPNqOE/o1xfJ1Teja7?= =?us-ascii?Q?rhDaiA1WKsg7W3J6PFHmrma9R0W9zBReTNc6pl6QaoaVzdzI3nl+8zSLq5gO?= =?us-ascii?Q?JXErfZF1NwuXiW+BN/e+2N3sLzqJkm/LqzcApuhSOynsB0Sw9zOxyHMvpzSZ?= =?us-ascii?Q?AhzHYE9qfBhFeoa8xx2Y3/eOZIPnmZQg5P09hBdfRMrPxQ=3D=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?zXqcjuEZsfHlIoyNAntrjOc4mjC+BUiBbDu2GsxmJDvlgT6lsOh78tp2How3?= =?us-ascii?Q?a0qlvMdKk1H1oRvsN2Qu0GgpGKiKPiC8/EvLSY/MGlXL0RHFbFgC5PMUKXUB?= =?us-ascii?Q?2GICFVudlC3o6kk6PadkotgV6LKOyDQTvI9lN0KJkXuKFc6iGCMxYm/ZF9iQ?= =?us-ascii?Q?fXe+hSccMF4Pt4SgIv9juJgKp8GDW6HaKuNNyMSrPM3aEZtIeZLf2I7CKxAW?= =?us-ascii?Q?BveDsRKTSaZ/oj9ndKdVOa4xXWQ7nOLGE3mFSm1KlyW+ZqYwR5+jF9KHt/Yt?= =?us-ascii?Q?GXQp2k/1SyxyGD9EGGt/8Vwn5yGj3iUuj7X/1EmhKd9uQy7G0F/TFllmMqKC?= =?us-ascii?Q?EEzrycN/GXjq0G5px8+uYVTl1roqEqGZRNaqr+evoCKBmgRjsa6e1XI2cE/8?= =?us-ascii?Q?t67xTMHIoG6rd37qpi+qLV+HGQKM1C/sQkG9Sfdi4yKSGuigqArgNlqsTHBv?= =?us-ascii?Q?MDzvLSM/u/P1h1B7xN8MdmEZoLS6B1PTej265YvR9CsKneev3rPPoFehEOhG?= =?us-ascii?Q?kUHS9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NGPv+64EPs?= =?us-ascii?Q?Q9Ewod3WpAEhn6/nXOyN0hum6V4TEjVJGa9eikFsEG7vMqO1ZQjJfwG/vG/O?= =?us-ascii?Q?oceNgOkPk+LCJMPUKfOFQWxXAV2oDNUdMDnLonngdUX7wmCzihAKpsh8eM8U?= =?us-ascii?Q?e90+U0lLJecy5P2v9mW+P1YPe6f6tM2oHLbIKK7KIpPK/uLYw2TNOkdeslj6?= =?us-ascii?Q?3A=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5832.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: eabfccd8-fa26-4d8f-deb5-08dc738e0c28 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 May 2024 20:48:30.5821 (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: 3/CR9uaVZCrNmif7+ZpfN5IJpsaCkZUqpQP/OQY9A2zjaKg5Tv4D+B8FNUjSVYWj+OibfW9cTl5ROYd62VSUFAqX3ORQ7voyP1AFjXohqy4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4936 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Mon, 13 May 2024 13:48:34 -0700 Resent-From: nathaniel.l.desimone@intel.com Reply-To: devel@edk2.groups.io,nathaniel.l.desimone@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: FFZUDtYfCGI4H7cGBxcZNGcVx7686176AA= 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=fiM5vNsO; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io Thanks for the feedback Chasel and Sai! I have incorporated all your sugges= tions. > -----Original Message----- > From: Chaganty, Rangasai V > Sent: Thursday, May 9, 2024 6:15 PM > To: Desimone, Nathaniel L ; > devel@edk2.groups.io > Cc: Chiu, Chasel ; Liming Gao > ; Dong, Eric ; Chuang, > Rosen ; Kasbekar, Saloni > > Subject: RE: [edk2-platforms] [PATCH v1 1/2] MinPlatform: Add > MpInfo2HobPei >=20 > Hi Nate, > Looks good. > In addition to optimization suggested by Chasel to save unnecessary call = to > locate PPI, you might also want to consider checking for checking "no err= or" > status for locate PPI and perhaps avoid a "goto" label. > With that, Reviewed-by: Sai Chaganty for > the whole patch series. >=20 > Thanks, > Sai >=20 >=20 > -----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 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. >=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/MpInfo2HobPe > i.c > create mode 100644 > Platform/Intel/MinPlatformPkg/FspWrapper/MpInfo2HobPei/MpInfo2HobPe > i.inf >=20 > diff --git > a/Platform/Intel/MinPlatformPkg/FspWrapper/MpInfo2HobPei/MpInfo2Hob > Pei.c > b/Platform/Intel/MinPlatformPkg/FspWrapper/MpInfo2HobPei/MpInfo2Hob > Pei.c > new file mode 100644 > index 0000000000..4cbc4cf7e6 > --- /dev/null > +++ > b/Platform/Intel/MinPlatformPkg/FspWrapper/MpInfo2HobPei/MpInfo2Hob > P > +++ 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) * > NumberOfProcessors); > + 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) { > + 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/MpInfo2Hob > Pei.inf > b/Platform/Intel/MinPlatformPkg/FspWrapper/MpInfo2HobPei/MpInfo2Hob > Pei.inf > new file mode 100644 > index 0000000000..eecfdbf422 > --- /dev/null > +++ > b/Platform/Intel/MinPlatformPkg/FspWrapper/MpInfo2HobPei/MpInfo2Hob > P > +++ 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/DxePlatformBoot > ManagerLib.inf >=20 > MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.inf > + MinPlatformPkg/FspWrapper/MpInfo2HobPei/MpInfo2HobPei.inf >=20 > MinPlatformPkg/FspWrapper/Library/PeiFspWrapperHobProcessLib/PeiFspW > rapperHobProcessLib.inf >=20 > MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecFsp > WrapperPlatformSecLib.inf >=20 > MinPlatformPkg/FspWrapper/Library/PeiFspWrapperPlatformLib/PeiFspWrap > perPlatformLib.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 (#118874): https://edk2.groups.io/g/devel/message/118874 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-