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 C674BD80229 for ; Mon, 13 May 2024 02:34:03 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=zQp2HKM3RpMewOG6S+6Nt9+cNZqM4ALuMeO64+eEIGA=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:msip_labels: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; s=20240206; t=1715567642; v=1; b=NZMaOlhBR8gUao7Yhqy+cv2KAW7LQQkVno8/m4ZLQljbpqLOlANlgHKVCHQYBmzae3WUNUxl yti142KKMGQ4ziH60+c9HWJpUw2u0Mo4jX/G/oXWySs2iTDO11CDJSHvv0YsIINE4Su8dN/mHNc WPZtMMyAhRzHfmRqKQMUDtNrwtzg1M9OR6twYqUIpdWbxbGiceoHA4sgN9wgw71ognBqOMYPxKI DhHhXWD+auwCOn6E9KCzpxdY6Ou5phWSJLFTC50BxLGs/9xPiD3QXkT7v1EK5EgRQcVB+mu1wQu 1yhmAHry4lvgGRIiYnheDEtk2YOaR5ktAtKWZ863CspQA== X-Received: by 127.0.0.2 with SMTP id l9kTYY7687511xLUBoz1nX55; Sun, 12 May 2024 19:34:02 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by mx.groups.io with SMTP id smtpd.web11.51434.1715567640884192636 for ; Sun, 12 May 2024 19:34:00 -0700 X-CSE-ConnectionGUID: QzFz+KP5RcqHEzsO6aMJPw== X-CSE-MsgGUID: P4Rbo4IaSZqcdpn8XEBOWQ== X-IronPort-AV: E=McAfee;i="6600,9927,11071"; a="22883826" X-IronPort-AV: E=Sophos;i="6.08,157,1712646000"; d="scan'208,217";a="22883826" X-Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2024 19:34:01 -0700 X-CSE-ConnectionGUID: 1zA+J0FKQSGllyKTZ4mzjg== X-CSE-MsgGUID: Wfcms4e7RzOHzP8jdoq0Og== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,157,1712646000"; d="scan'208,217";a="34704403" X-Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmviesa003.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 12 May 2024 19:34:00 -0700 X-Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sun, 12 May 2024 19:34:00 -0700 X-Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) 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; Sun, 12 May 2024 19:33:59 -0700 X-Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Sun, 12 May 2024 19:33:59 -0700 X-Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.101) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Sun, 12 May 2024 19:33:59 -0700 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by SJ2PR11MB8537.namprd11.prod.outlook.com (2603:10b6:a03:56f::9) 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 02:33:57 +0000 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::41a4:c775:32e6:76a8]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::41a4:c775:32e6:76a8%4]) with mapi id 15.20.7544.052; Mon, 13 May 2024 02:33:57 +0000 From: "Ni, Ray" To: "Tan, Dun" , "devel@edk2.groups.io" CC: Laszlo Ersek , "Kumar, Rahul R" , Gerd Hoffmann , "Wu, Jiaxin" Subject: Re: [edk2-devel] [PATCH 17/18] UefiCpuPkg: Remove GetAcpiCpuData() in CpuS3.c Thread-Topic: [PATCH 17/18] UefiCpuPkg: Remove GetAcpiCpuData() in CpuS3.c Thread-Index: AQHaosIsbhxy0k/FyUG6jsNLAzItu7GUdmae Date: Mon, 13 May 2024 02:33:57 +0000 Message-ID: References: <20240510100827.1903-1-dun.tan@intel.com> <20240510100827.1903-18-dun.tan@intel.com> In-Reply-To: <20240510100827.1903-18-dun.tan@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN6PR11MB8244:EE_|SJ2PR11MB8537:EE_ x-ms-office365-filtering-correlation-id: e70db6d8-424c-452e-a022-08dc72f523ae x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: =?us-ascii?Q?fRRWuyTitcJSR8nzDEgUgv/ebtbf9k6FLZJgoeYAIRxkX2K1nP4B0jimoPpU?= =?us-ascii?Q?Hlg0DgLi6ms8JUpwGLDqo3Au86EDkp8BGL2Teiq+WI46nJbPSHXNhh/XNc6e?= =?us-ascii?Q?nYsI997gggTBe8a7PJGIaKRMfLiqToPZN4MAjSjIyz5Gu/Z2WXNWh/Aa/fjh?= =?us-ascii?Q?uGp8+rHYQ+JKVNrNK8H5/O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I9gkJF6zMqfzTqQZPjAlAE38Xv7YLfxMlH3C3dT7UUUjMA9?= =?us-ascii?Q?ASAjyBP/x/k4hBOd9znT30S0haE+AK8MCTUKEPnYaEfHPPuQmDgAzpoNAw1K?= =?us-ascii?Q?p0Zr9AcsANnziHWRi9A/kTN1CfRv7hPF6EqKiPjFh/oYYpvG5ZEbQbwBwCqL?= =?us-ascii?Q?tEhKRXlEZvl98TRwijc=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: e70db6d8-424c-452e-a022-08dc72f523ae X-MS-Exchange-CrossTenant-originalarrivaltime: 13 May 2024 02:33:57.0410 (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: u//u6Itl+Z/bIQqSRcUGnf9t/4YiG+KRwbj+9oHKfwSgUQlyjAV3Vu/5GAhhaxSkFcBnb1RvgYi23nHGuUfkJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR11MB8537 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: Sun, 12 May 2024 19:34:00 -0700 Resent-From: ray.ni@intel.com Reply-To: devel@edk2.groups.io,ray.ni@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: ZZgtri8jafGUxTz04Moe4syQx7686176AA= Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_MN6PR11MB824457EF940B59C1C35731C28CE22MN6PR11MB8244namp_" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=NZMaOlhB; 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) --_000_MN6PR11MB824457EF940B59C1C35731C28CE22MN6PR11MB8244namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni Thanks, Ray ________________________________ From: Tan, Dun Sent: Friday, May 10, 2024 18:08 To: devel@edk2.groups.io Cc: Ni, Ray ; Laszlo Ersek ; Kumar, Ra= hul R ; Gerd Hoffmann ; Wu, Jia= xin Subject: [PATCH 17/18] UefiCpuPkg: Remove GetAcpiCpuData() in CpuS3.c Remove GetAcpiCpuData() in CpuS3.c. The mAcpiCpuData is not needed in S3 boot anymore. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu --- UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 243 +------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= -------------------------------------------------------------------- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 6 ++---- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 24 ------------------------ 3 files changed, 3 insertions(+), 270 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c b/UefiCpuPkg/PiSmmCpuDxeSmm/= CpuS3.c index e84bc14de0..78ecf4efc6 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c @@ -9,22 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include "PiSmmCpuDxeSmm.h" #include -// -// Flags used when program the register. -// -typedef struct { - volatile UINTN MemoryMappedLock; // Spinlock used to pr= ogram mmio - volatile UINT32 *CoreSemaphoreCount; // Semaphore container= used to program - // core level semaphor= e. - volatile UINT32 *PackageSemaphoreCount; // Semaphore container= used to program - // package level semap= hore. -} PROGRAM_CPU_REGISTER_FLAGS; - -#define LEGACY_REGION_SIZE (2 * 0x1000) -#define LEGACY_REGION_BASE (0xA0000 - LEGACY_REGION_SIZE) - -ACPI_CPU_DATA mAcpiCpuData; -BOOLEAN mRestoreSmmConfigurationInS3 =3D FALSE; +BOOLEAN mRestoreSmmConfigurationInS3 =3D FALSE; // // S3 boot flag @@ -266,232 +251,6 @@ InitSmmS3ResumeState ( } } -/** - Copy register table from non-SMRAM into SMRAM. - - @param[in] DestinationRegisterTableList Points to destination register = table. - @param[in] SourceRegisterTableList Points to source register table= . - @param[in] NumberOfCpus Number of CPUs. - -**/ -VOID -CopyRegisterTable ( - IN CPU_REGISTER_TABLE *DestinationRegisterTableList, - IN CPU_REGISTER_TABLE *SourceRegisterTableList, - IN UINT32 NumberOfCpus - ) -{ - UINTN Index; - CPU_REGISTER_TABLE_ENTRY *RegisterTableEntry; - - CopyMem (DestinationRegisterTableList, SourceRegisterTableList, NumberOf= Cpus * sizeof (CPU_REGISTER_TABLE)); - for (Index =3D 0; Index < NumberOfCpus; Index++) { - if (DestinationRegisterTableList[Index].TableLength !=3D 0) { - DestinationRegisterTableList[Index].AllocatedSize =3D DestinationReg= isterTableList[Index].TableLength * sizeof (CPU_REGISTER_TABLE_ENTRY); - RegisterTableEntry =3D AllocateCopyPo= ol ( - DestinationReg= isterTableList[Index].AllocatedSize, - (VOID *)(UINTN= )SourceRegisterTableList[Index].RegisterTableEntry - ); - ASSERT (RegisterTableEntry !=3D NULL); - DestinationRegisterTableList[Index].RegisterTableEntry =3D (EFI_PHYS= ICAL_ADDRESS)(UINTN)RegisterTableEntry; - } - } -} - -/** - Check whether the register table is empty or not. - - @param[in] RegisterTable Point to the register table. - @param[in] NumberOfCpus Number of CPUs. - - @retval TRUE The register table is empty. - @retval FALSE The register table is not empty. -**/ -BOOLEAN -IsRegisterTableEmpty ( - IN CPU_REGISTER_TABLE *RegisterTable, - IN UINT32 NumberOfCpus - ) -{ - UINTN Index; - - if (RegisterTable !=3D NULL) { - for (Index =3D 0; Index < NumberOfCpus; Index++) { - if (RegisterTable[Index].TableLength !=3D 0) { - return FALSE; - } - } - } - - return TRUE; -} - -/** - Copy the data used to initialize processor register into SMRAM. - - @param[in,out] CpuFeatureInitDataDst Pointer to the destination CPU_F= EATURE_INIT_DATA structure. - @param[in] CpuFeatureInitDataSrc Pointer to the source CPU_FEATUR= E_INIT_DATA structure. - -**/ -VOID -CopyCpuFeatureInitDatatoSmram ( - IN OUT CPU_FEATURE_INIT_DATA *CpuFeatureInitDataDst, - IN CPU_FEATURE_INIT_DATA *CpuFeatureInitDataSrc - ) -{ - CPU_STATUS_INFORMATION *CpuStatus; - - if (!IsRegisterTableEmpty ((CPU_REGISTER_TABLE *)(UINTN)CpuFeatureInitDa= taSrc->PreSmmInitRegisterTable, mAcpiCpuData.NumberOfCpus)) { - CpuFeatureInitDataDst->PreSmmInitRegisterTable =3D (EFI_PHYSICAL_ADDRE= SS)(UINTN)AllocatePool (mAcpiCpuData.NumberOfCpus * sizeof (CPU_REGISTER_TA= BLE)); - ASSERT (CpuFeatureInitDataDst->PreSmmInitRegisterTable !=3D 0); - - CopyRegisterTable ( - (CPU_REGISTER_TABLE *)(UINTN)CpuFeatureInitDataDst->PreSmmInitRegist= erTable, - (CPU_REGISTER_TABLE *)(UINTN)CpuFeatureInitDataSrc->PreSmmInitRegist= erTable, - mAcpiCpuData.NumberOfCpus - ); - } - - if (!IsRegisterTableEmpty ((CPU_REGISTER_TABLE *)(UINTN)CpuFeatureInitDa= taSrc->RegisterTable, mAcpiCpuData.NumberOfCpus)) { - CpuFeatureInitDataDst->RegisterTable =3D (EFI_PHYSICAL_ADDRESS)(UINTN)= AllocatePool (mAcpiCpuData.NumberOfCpus * sizeof (CPU_REGISTER_TABLE)); - ASSERT (CpuFeatureInitDataDst->RegisterTable !=3D 0); - - CopyRegisterTable ( - (CPU_REGISTER_TABLE *)(UINTN)CpuFeatureInitDataDst->RegisterTable, - (CPU_REGISTER_TABLE *)(UINTN)CpuFeatureInitDataSrc->RegisterTable, - mAcpiCpuData.NumberOfCpus - ); - } - - CpuStatus =3D &CpuFeatureInitDataDst->CpuStatus; - CopyMem (CpuStatus, &CpuFeatureInitDataSrc->CpuStatus, sizeof (CPU_STATU= S_INFORMATION)); - - if (CpuFeatureInitDataSrc->CpuStatus.ThreadCountPerPackage !=3D 0) { - CpuStatus->ThreadCountPerPackage =3D (EFI_PHYSICAL_ADDRESS)(UINTN)Allo= cateCopyPool ( - size= of (UINT32) * CpuStatus->PackageCount, - (UIN= T32 *)(UINTN)CpuFeatureInitDataSrc->CpuStatus.ThreadCountPerPackage - ); - ASSERT (CpuStatus->ThreadCountPerPackage !=3D 0); - } - - if (CpuFeatureInitDataSrc->CpuStatus.ThreadCountPerCore !=3D 0) { - CpuStatus->ThreadCountPerCore =3D (EFI_PHYSICAL_ADDRESS)(UINTN)Allocat= eCopyPool ( - sizeof = (UINT8) * (CpuStatus->PackageCount * CpuStatus->MaxCoreCount), - (UINT32= *)(UINTN)CpuFeatureInitDataSrc->CpuStatus.ThreadCountPerCore - ); - ASSERT (CpuStatus->ThreadCountPerCore !=3D 0); - } - - if (CpuFeatureInitDataSrc->ApLocation !=3D 0) { - CpuFeatureInitDataDst->ApLocation =3D (EFI_PHYSICAL_ADDRESS)(UINTN)All= ocateCopyPool ( - mAc= piCpuData.NumberOfCpus * sizeof (EFI_CPU_PHYSICAL_LOCATION), - (EF= I_CPU_PHYSICAL_LOCATION *)(UINTN)CpuFeatureInitDataSrc->ApLocation - ); - ASSERT (CpuFeatureInitDataDst->ApLocation !=3D 0); - } -} - -/** - Get ACPI CPU data. - -**/ -VOID -GetAcpiCpuData ( - VOID - ) -{ - ACPI_CPU_DATA *AcpiCpuData; - IA32_DESCRIPTOR *Gdtr; - IA32_DESCRIPTOR *Idtr; - VOID *GdtForAp; - VOID *IdtForAp; - VOID *MachineCheckHandlerForAp; - CPU_STATUS_INFORMATION *CpuStatus; - - if (!mAcpiS3Enable) { - return; - } - - // - // Prevent use of mAcpiCpuData by initialize NumberOfCpus to 0 - // - mAcpiCpuData.NumberOfCpus =3D 0; - - // - // If PcdCpuS3DataAddress was never set, then do not copy CPU S3 Data in= to SMRAM - // - AcpiCpuData =3D (ACPI_CPU_DATA *)(UINTN)PcdGet64 (PcdCpuS3DataAddress); - if (AcpiCpuData =3D=3D 0) { - return; - } - - // - // For a native platform, copy the CPU S3 data into SMRAM for use on CPU= S3 Resume. - // - CopyMem (&mAcpiCpuData, AcpiCpuData, sizeof (mAcpiCpuData)); - - mAcpiCpuData.MtrrTable =3D (EFI_PHYSICAL_ADDRESS)(UINTN)AllocatePool (si= zeof (MTRR_SETTINGS)); - ASSERT (mAcpiCpuData.MtrrTable !=3D 0); - - CopyMem ((VOID *)(UINTN)mAcpiCpuData.MtrrTable, (VOID *)(UINTN)AcpiCpuDa= ta->MtrrTable, sizeof (MTRR_SETTINGS)); - - mAcpiCpuData.GdtrProfile =3D (EFI_PHYSICAL_ADDRESS)(UINTN)AllocatePool (= sizeof (IA32_DESCRIPTOR)); - ASSERT (mAcpiCpuData.GdtrProfile !=3D 0); - - CopyMem ((VOID *)(UINTN)mAcpiCpuData.GdtrProfile, (VOID *)(UINTN)AcpiCpu= Data->GdtrProfile, sizeof (IA32_DESCRIPTOR)); - - mAcpiCpuData.IdtrProfile =3D (EFI_PHYSICAL_ADDRESS)(UINTN)AllocatePool (= sizeof (IA32_DESCRIPTOR)); - ASSERT (mAcpiCpuData.IdtrProfile !=3D 0); - - CopyMem ((VOID *)(UINTN)mAcpiCpuData.IdtrProfile, (VOID *)(UINTN)AcpiCpu= Data->IdtrProfile, sizeof (IA32_DESCRIPTOR)); - - // - // Copy AP's GDT, IDT and Machine Check handler into SMRAM. - // - Gdtr =3D (IA32_DESCRIPTOR *)(UINTN)mAcpiCpuData.GdtrProfile; - Idtr =3D (IA32_DESCRIPTOR *)(UINTN)mAcpiCpuData.IdtrProfile; - - GdtForAp =3D AllocatePool ((Gdtr->Limit + 1) + (Idtr->Limit + 1) + mAcpi= CpuData.ApMachineCheckHandlerSize); - ASSERT (GdtForAp !=3D NULL); - IdtForAp =3D (VOID *)((UINTN)GdtForAp + (Gdtr->Limit + 1= )); - MachineCheckHandlerForAp =3D (VOID *)((UINTN)IdtForAp + (Idtr->Limit + 1= )); - - CopyMem (GdtForAp, (VOID *)Gdtr->Base, Gdtr->Limit + 1); - CopyMem (IdtForAp, (VOID *)Idtr->Base, Idtr->Limit + 1); - CopyMem (MachineCheckHandlerForAp, (VOID *)(UINTN)mAcpiCpuData.ApMachine= CheckHandlerBase, mAcpiCpuData.ApMachineCheckHandlerSize); - - Gdtr->Base =3D (UINTN)GdtForAp; - Idtr->Base =3D (UINTN)IdtForAp; - mAcpiCpuData.ApMachineCheckHandlerBase =3D (EFI_PHYSICAL_ADDRESS)(UINTN)= MachineCheckHandlerForAp; - - ZeroMem (&mAcpiCpuData.CpuFeatureInitData, sizeof (CPU_FEATURE_INIT_DATA= )); - - if (!PcdGetBool (PcdCpuFeaturesInitOnS3Resume)) { - // - // If the CPU features will not be initialized by CpuFeaturesPei modul= e during - // next ACPI S3 resume, copy the CPU features initialization data into= SMRAM, - // which will be consumed in SmmRestoreCpu during next S3 resume. - // - CopyCpuFeatureInitDatatoSmram (&mAcpiCpuData.CpuFeatureInitData, &Acpi= CpuData->CpuFeatureInitData); - - CpuStatus =3D &mAcpiCpuData.CpuFeatureInitData.CpuStatus; - - mCpuFlags.CoreSemaphoreCount =3D AllocateZeroPool ( - sizeof (UINT32) * CpuStatus->PackageC= ount * - CpuStatus->MaxCoreCount * CpuStatus->= MaxThreadCount - ); - ASSERT (mCpuFlags.CoreSemaphoreCount !=3D NULL); - - mCpuFlags.PackageSemaphoreCount =3D AllocateZeroPool ( - sizeof (UINT32) * CpuStatus->Packa= geCount * - CpuStatus->MaxCoreCount * CpuStatu= s->MaxThreadCount - ); - ASSERT (mCpuFlags.PackageSemaphoreCount !=3D NULL); - - InitializeSpinLock ((SPIN_LOCK *)&mCpuFlags.MemoryMappedLock); - } -} - /** Get ACPI S3 enable flag. diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmC= puDxeSmm/PiSmmCpuDxeSmm.c index e400bee8d5..f5e113d99f 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c @@ -435,8 +435,8 @@ ExecuteFirstSmiInit ( /** SMM Ready To Lock event notification handler. - The CPU S3 data is copied to SMRAM for security and mSmmReadyToLock is s= et to - perform additional lock actions that must be performed from SMM on the n= ext SMI. + mSmmReadyToLock is set to perform additional lock actions that must be + performed from SMM on the next SMI. @param[in] Protocol Points to the protocol's unique identifier. @param[in] Interface Points to the interface instance. @@ -452,8 +452,6 @@ SmmReadyToLockEventNotify ( IN EFI_HANDLE Handle ) { - GetAcpiCpuData (); - // // Cache a copy of UEFI memory map before we start profiling feature. // diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h b/UefiCpuPkg/PiSmmC= puDxeSmm/PiSmmCpuDxeSmm.h index f42910ddf1..af0fda4da1 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h @@ -1048,15 +1048,6 @@ InitSmmS3ResumeState ( IN UINT32 Cr3 ); -/** - Get ACPI CPU data. - -**/ -VOID -GetAcpiCpuData ( - VOID - ); - /** Restore SMM Configuration in S3 boot path. @@ -1075,21 +1066,6 @@ GetAcpiS3EnableFlag ( VOID ); -/** - Transfer AP to safe hlt-loop after it finished restore CPU features on S= 3 patch. - - @param[in] ApHltLoopCode The address of the safe hlt-loop funct= ion. - @param[in] TopOfStack A pointer to the new stack to use for = the ApHltLoopCode. - @param[in] NumberToFinishAddress Address of Semaphore of APs finish cou= nt. - -**/ -VOID -TransferApToSafeState ( - IN UINTN ApHltLoopCode, - IN UINTN TopOfStack, - IN UINTN NumberToFinishAddress - ); - /** Set ShadowStack memory. -- 2.31.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118848): https://edk2.groups.io/g/devel/message/118848 Mute This Topic: https://groups.io/mt/106018144/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- --_000_MN6PR11MB824457EF940B59C1C35731C28CE22MN6PR11MB8244namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Reviewed-by: Ray Ni <ray.ni@intel.com>

Thanks,
Ray

From: Tan, Dun <dun.tan@= intel.com>
Sent: Friday, May 10, 2024 18:08
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Ni, Ray <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat= .com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; Gerd Hoffmann <= ;kraxel@redhat.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
Subject: [PATCH 17/18] UefiCpuPkg: Remove GetAcpiCpuData() in CpuS3.= c
 
Remove GetAcpiCpuData() in CpuS3.c. The mAcpiCpuDa= ta
is not needed in S3 boot anymore.

Signed-off-by: Dun Tan <dun.tan@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
---
 UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c      =     | 243 +-------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= -------------------------------------------
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c |   6 ++----
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h |  24 ---------------= ---------
 3 files changed, 3 insertions(+), 270 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c b/UefiCpuPkg/PiSmmCpuDxeSmm/= CpuS3.c
index e84bc14de0..78ecf4efc6 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
@@ -9,22 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include "PiSmmCpuDxeSmm.h"
 #include <PiPei.h>
 
-//
-// Flags used when program the register.
-//
-typedef struct {
-  volatile UINTN     MemoryMappedLock;  = ;            // Spin= lock used to program mmio
-  volatile UINT32    *CoreSemaphoreCount;  &= nbsp;        // Semaphore container used= to program
-            &n= bsp;            = ;            &n= bsp;            = ;  // core level semaphore.
-  volatile UINT32    *PackageSemaphoreCount; &nbs= p;      // Semaphore container used to program
-            &n= bsp;            = ;            &n= bsp;            = ;  // package level semaphore.
-} PROGRAM_CPU_REGISTER_FLAGS;
-
-#define LEGACY_REGION_SIZE  (2 * 0x1000)
-#define LEGACY_REGION_BASE  (0xA0000 - LEGACY_REGION_SIZE)
-
-ACPI_CPU_DATA  mAcpiCpuData;
-BOOLEAN        mRestoreSmmConfiguration= InS3 =3D FALSE;
+BOOLEAN  mRestoreSmmConfigurationInS3 =3D FALSE;
 
 //
 // S3 boot flag
@@ -266,232 +251,6 @@ InitSmmS3ResumeState (
   }
 }
 
-/**
-  Copy register table from non-SMRAM into SMRAM.
-
-  @param[in] DestinationRegisterTableList  Points to destination= register table.
-  @param[in] SourceRegisterTableList     &nb= sp; Points to source register table.
-  @param[in] NumberOfCpus       &n= bsp;          Number of CPUs.<= br> -
-**/
-VOID
-CopyRegisterTable (
-  IN CPU_REGISTER_TABLE  *DestinationRegisterTableList,
-  IN CPU_REGISTER_TABLE  *SourceRegisterTableList,
-  IN UINT32         &nbs= p;    NumberOfCpus
-  )
-{
-  UINTN          &n= bsp;          Index;
-  CPU_REGISTER_TABLE_ENTRY  *RegisterTableEntry;
-
-  CopyMem (DestinationRegisterTableList, SourceRegisterTableList, Num= berOfCpus * sizeof (CPU_REGISTER_TABLE));
-  for (Index =3D 0; Index < NumberOfCpus; Index++) {
-    if (DestinationRegisterTableList[Index].TableLength != =3D 0) {
-      DestinationRegisterTableList[Index].Allocat= edSize =3D DestinationRegisterTableList[Index].TableLength * sizeof (CPU_RE= GISTER_TABLE_ENTRY);
-      RegisterTableEntry    &= nbsp;           &nbs= p;            &= nbsp;  =3D AllocateCopyPool (
-            &n= bsp;            = ;            &n= bsp;            = ;          DestinationRegister= TableList[Index].AllocatedSize,
-            &n= bsp;            = ;            &n= bsp;            = ;          (VOID *)(UINTN)Sour= ceRegisterTableList[Index].RegisterTableEntry
-            &n= bsp;            = ;            &n= bsp;            = ;          );
-      ASSERT (RegisterTableEntry !=3D NULL);
-      DestinationRegisterTableList[Index].Registe= rTableEntry =3D (EFI_PHYSICAL_ADDRESS)(UINTN)RegisterTableEntry;
-    }
-  }
-}
-
-/**
-  Check whether the register table is empty or not.
-
-  @param[in] RegisterTable  Point to the register table.
-  @param[in] NumberOfCpus   Number of CPUs.
-
-  @retval TRUE         &= nbsp;    The register table is empty.
-  @retval FALSE         =     The register table is not empty.
-**/
-BOOLEAN
-IsRegisterTableEmpty (
-  IN CPU_REGISTER_TABLE  *RegisterTable,
-  IN UINT32         &nbs= p;    NumberOfCpus
-  )
-{
-  UINTN  Index;
-
-  if (RegisterTable !=3D NULL) {
-    for (Index =3D 0; Index < NumberOfCpus; Index++) { -      if (RegisterTable[Index].TableLength !=3D 0= ) {
-        return FALSE;
-      }
-    }
-  }
-
-  return TRUE;
-}
-
-/**
-  Copy the data used to initialize processor register into SMRAM.
-
-  @param[in,out]  CpuFeatureInitDataDst   Pointer to t= he destination CPU_FEATURE_INIT_DATA structure.
-  @param[in]      CpuFeatureInitDataSrc = ;  Pointer to the source CPU_FEATURE_INIT_DATA structure.
-
-**/
-VOID
-CopyCpuFeatureInitDatatoSmram (
-  IN OUT CPU_FEATURE_INIT_DATA  *CpuFeatureInitDataDst,
-  IN     CPU_FEATURE_INIT_DATA  *CpuFeatureI= nitDataSrc
-  )
-{
-  CPU_STATUS_INFORMATION  *CpuStatus;
-
-  if (!IsRegisterTableEmpty ((CPU_REGISTER_TABLE *)(UINTN)CpuFeatureI= nitDataSrc->PreSmmInitRegisterTable, mAcpiCpuData.NumberOfCpus)) {
-    CpuFeatureInitDataDst->PreSmmInitRegisterTable =3D (= EFI_PHYSICAL_ADDRESS)(UINTN)AllocatePool (mAcpiCpuData.NumberOfCpus * sizeo= f (CPU_REGISTER_TABLE));
-    ASSERT (CpuFeatureInitDataDst->PreSmmInitRegisterTab= le !=3D 0);
-
-    CopyRegisterTable (
-      (CPU_REGISTER_TABLE *)(UINTN)CpuFeatureInit= DataDst->PreSmmInitRegisterTable,
-      (CPU_REGISTER_TABLE *)(UINTN)CpuFeatureInit= DataSrc->PreSmmInitRegisterTable,
-      mAcpiCpuData.NumberOfCpus
-      );
-  }
-
-  if (!IsRegisterTableEmpty ((CPU_REGISTER_TABLE *)(UINTN)CpuFeatureI= nitDataSrc->RegisterTable, mAcpiCpuData.NumberOfCpus)) {
-    CpuFeatureInitDataDst->RegisterTable =3D (EFI_PHYSIC= AL_ADDRESS)(UINTN)AllocatePool (mAcpiCpuData.NumberOfCpus * sizeof (CPU_REG= ISTER_TABLE));
-    ASSERT (CpuFeatureInitDataDst->RegisterTable !=3D 0)= ;
-
-    CopyRegisterTable (
-      (CPU_REGISTER_TABLE *)(UINTN)CpuFeatureInit= DataDst->RegisterTable,
-      (CPU_REGISTER_TABLE *)(UINTN)CpuFeatureInit= DataSrc->RegisterTable,
-      mAcpiCpuData.NumberOfCpus
-      );
-  }
-
-  CpuStatus =3D &CpuFeatureInitDataDst->CpuStatus;
-  CopyMem (CpuStatus, &CpuFeatureInitDataSrc->CpuStatus, sizeo= f (CPU_STATUS_INFORMATION));
-
-  if (CpuFeatureInitDataSrc->CpuStatus.ThreadCountPerPackage !=3D = 0) {
-    CpuStatus->ThreadCountPerPackage =3D (EFI_PHYSICAL_A= DDRESS)(UINTN)AllocateCopyPool (
-            &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;       sizeof (UINT32) * CpuStatus->Pa= ckageCount,
-            &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;       (UINT32 *)(UINTN)CpuFeatureInitDat= aSrc->CpuStatus.ThreadCountPerPackage
-            &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;       );
-    ASSERT (CpuStatus->ThreadCountPerPackage !=3D 0); -  }
-
-  if (CpuFeatureInitDataSrc->CpuStatus.ThreadCountPerCore !=3D 0) = {
-    CpuStatus->ThreadCountPerCore =3D (EFI_PHYSICAL_ADDR= ESS)(UINTN)AllocateCopyPool (
-            &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;    sizeof (UINT8) * (CpuStatus->PackageCount * CpuSt= atus->MaxCoreCount),
-            &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;    (UINT32 *)(UINTN)CpuFeatureInitDataSrc->CpuStatus= .ThreadCountPerCore
-            &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;    );
-    ASSERT (CpuStatus->ThreadCountPerCore !=3D 0);
-  }
-
-  if (CpuFeatureInitDataSrc->ApLocation !=3D 0) {
-    CpuFeatureInitDataDst->ApLocation =3D (EFI_PHYSICAL_= ADDRESS)(UINTN)AllocateCopyPool (
-            &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;        mAcpiCpuData.NumberOfCpus * = sizeof (EFI_CPU_PHYSICAL_LOCATION),
-            &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;        (EFI_CPU_PHYSICAL_LOCATION *= )(UINTN)CpuFeatureInitDataSrc->ApLocation
-            &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;        );
-    ASSERT (CpuFeatureInitDataDst->ApLocation !=3D 0); -  }
-}
-
-/**
-  Get ACPI CPU data.
-
-**/
-VOID
-GetAcpiCpuData (
-  VOID
-  )
-{
-  ACPI_CPU_DATA         =   *AcpiCpuData;
-  IA32_DESCRIPTOR         *Gd= tr;
-  IA32_DESCRIPTOR         *Id= tr;
-  VOID          &nb= sp;         *GdtForAp;
-  VOID          &nb= sp;         *IdtForAp;
-  VOID          &nb= sp;         *MachineCheckHandlerFor= Ap;
-  CPU_STATUS_INFORMATION  *CpuStatus;
-
-  if (!mAcpiS3Enable) {
-    return;
-  }
-
-  //
-  // Prevent use of mAcpiCpuData by initialize NumberOfCpus to 0
-  //
-  mAcpiCpuData.NumberOfCpus =3D 0;
-
-  //
-  // If PcdCpuS3DataAddress was never set, then do not copy CPU S3 Da= ta into SMRAM
-  //
-  AcpiCpuData =3D (ACPI_CPU_DATA *)(UINTN)PcdGet64 (PcdCpuS3DataAddre= ss);
-  if (AcpiCpuData =3D=3D 0) {
-    return;
-  }
-
-  //
-  // For a native platform, copy the CPU S3 data into SMRAM for use o= n CPU S3 Resume.
-  //
-  CopyMem (&mAcpiCpuData, AcpiCpuData, sizeof (mAcpiCpuData)); -
-  mAcpiCpuData.MtrrTable =3D (EFI_PHYSICAL_ADDRESS)(UINTN)AllocatePoo= l (sizeof (MTRR_SETTINGS));
-  ASSERT (mAcpiCpuData.MtrrTable !=3D 0);
-
-  CopyMem ((VOID *)(UINTN)mAcpiCpuData.MtrrTable, (VOID *)(UINTN)Acpi= CpuData->MtrrTable, sizeof (MTRR_SETTINGS));
-
-  mAcpiCpuData.GdtrProfile =3D (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateP= ool (sizeof (IA32_DESCRIPTOR));
-  ASSERT (mAcpiCpuData.GdtrProfile !=3D 0);
-
-  CopyMem ((VOID *)(UINTN)mAcpiCpuData.GdtrProfile, (VOID *)(UINTN)Ac= piCpuData->GdtrProfile, sizeof (IA32_DESCRIPTOR));
-
-  mAcpiCpuData.IdtrProfile =3D (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateP= ool (sizeof (IA32_DESCRIPTOR));
-  ASSERT (mAcpiCpuData.IdtrProfile !=3D 0);
-
-  CopyMem ((VOID *)(UINTN)mAcpiCpuData.IdtrProfile, (VOID *)(UINTN)Ac= piCpuData->IdtrProfile, sizeof (IA32_DESCRIPTOR));
-
-  //
-  // Copy AP's GDT, IDT and Machine Check handler into SMRAM.
-  //
-  Gdtr =3D (IA32_DESCRIPTOR *)(UINTN)mAcpiCpuData.GdtrProfile;
-  Idtr =3D (IA32_DESCRIPTOR *)(UINTN)mAcpiCpuData.IdtrProfile;
-
-  GdtForAp =3D AllocatePool ((Gdtr->Limit + 1) + (Idtr->Limit += 1) + mAcpiCpuData.ApMachineCheckHandlerSize);
-  ASSERT (GdtForAp !=3D NULL);
-  IdtForAp          = ;       =3D (VOID *)((UINTN)GdtForAp + (Gdtr-= >Limit + 1));
-  MachineCheckHandlerForAp =3D (VOID *)((UINTN)IdtForAp + (Idtr->L= imit + 1));
-
-  CopyMem (GdtForAp, (VOID *)Gdtr->Base, Gdtr->Limit + 1);
-  CopyMem (IdtForAp, (VOID *)Idtr->Base, Idtr->Limit + 1);
-  CopyMem (MachineCheckHandlerForAp, (VOID *)(UINTN)mAcpiCpuData.ApMa= chineCheckHandlerBase, mAcpiCpuData.ApMachineCheckHandlerSize);
-
-  Gdtr->Base         =             &nb= sp;       =3D (UINTN)GdtForAp;
-  Idtr->Base         =             &nb= sp;       =3D (UINTN)IdtForAp;
-  mAcpiCpuData.ApMachineCheckHandlerBase =3D (EFI_PHYSICAL_ADDRESS)(U= INTN)MachineCheckHandlerForAp;
-
-  ZeroMem (&mAcpiCpuData.CpuFeatureInitData, sizeof (CPU_FEATURE_= INIT_DATA));
-
-  if (!PcdGetBool (PcdCpuFeaturesInitOnS3Resume)) {
-    //
-    // If the CPU features will not be initialized by CpuFe= aturesPei module during
-    // next ACPI S3 resume, copy the CPU features initializ= ation data into SMRAM,
-    // which will be consumed in SmmRestoreCpu during next = S3 resume.
-    //
-    CopyCpuFeatureInitDatatoSmram (&mAcpiCpuData.CpuFea= tureInitData, &AcpiCpuData->CpuFeatureInitData);
-
-    CpuStatus =3D &mAcpiCpuData.CpuFeatureInitData.CpuS= tatus;
-
-    mCpuFlags.CoreSemaphoreCount =3D AllocateZeroPool (
-            &n= bsp;            = ;            sizeof = (UINT32) * CpuStatus->PackageCount *
-            &n= bsp;            = ;            CpuStat= us->MaxCoreCount * CpuStatus->MaxThreadCount
-            &n= bsp;            = ;            );
-    ASSERT (mCpuFlags.CoreSemaphoreCount !=3D NULL);
-
-    mCpuFlags.PackageSemaphoreCount =3D AllocateZeroPool (<= br> -            &n= bsp;            = ;            &n= bsp;  sizeof (UINT32) * CpuStatus->PackageCount *
-            &n= bsp;            = ;            &n= bsp;  CpuStatus->MaxCoreCount * CpuStatus->MaxThreadCount
-            &n= bsp;            = ;            &n= bsp;  );
-    ASSERT (mCpuFlags.PackageSemaphoreCount !=3D NULL);
-
-    InitializeSpinLock ((SPIN_LOCK *)&mCpuFlags.MemoryM= appedLock);
-  }
-}
-
 /**
   Get ACPI S3 enable flag.
 
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmC= puDxeSmm/PiSmmCpuDxeSmm.c
index e400bee8d5..f5e113d99f 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
@@ -435,8 +435,8 @@ ExecuteFirstSmiInit (
 /**
   SMM Ready To Lock event notification handler.
 
-  The CPU S3 data is copied to SMRAM for security and mSmmReadyToLock= is set to
-  perform additional lock actions that must be performed from SMM on = the next SMI.
+  mSmmReadyToLock is set to perform additional lock actions that must= be
+  performed from SMM on the next SMI.
 
   @param[in] Protocol   Points to the protocol's uniqu= e identifier.
   @param[in] Interface  Points to the interface instance. @@ -452,8 +452,6 @@ SmmReadyToLockEventNotify (
   IN EFI_HANDLE      Handle
   )
 {
-  GetAcpiCpuData ();
-
   //
   // Cache a copy of UEFI memory map before we start profiling f= eature.
   //
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h b/UefiCpuPkg/PiSmmC= puDxeSmm/PiSmmCpuDxeSmm.h
index f42910ddf1..af0fda4da1 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
@@ -1048,15 +1048,6 @@ InitSmmS3ResumeState (
   IN UINT32  Cr3
   );
 
-/**
-  Get ACPI CPU data.
-
-**/
-VOID
-GetAcpiCpuData (
-  VOID
-  );
-
 /**
   Restore SMM Configuration in S3 boot path.
 
@@ -1075,21 +1066,6 @@ GetAcpiS3EnableFlag (
   VOID
   );
 
-/**
-  Transfer AP to safe hlt-loop after it finished restore CPU features= on S3 patch.
-
-  @param[in] ApHltLoopCode       &= nbsp;  The address of the safe hlt-loop function.
-  @param[in] TopOfStack       &nbs= p;     A pointer to the new stack to use for the ApHltL= oopCode.
-  @param[in] NumberToFinishAddress  Address of Semaphore of APs = finish count.
-
-**/
-VOID
-TransferApToSafeState (
-  IN UINTN  ApHltLoopCode,
-  IN UINTN  TopOfStack,
-  IN UINTN  NumberToFinishAddress
-  );
-
 /**
   Set ShadowStack memory.
 
--
2.31.1.windows.1

_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#118848) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--_000_MN6PR11MB824457EF940B59C1C35731C28CE22MN6PR11MB8244namp_--