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 1C85CD80A5F for ; Mon, 13 May 2024 02:26:47 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=vXGmVk6JcRBSyEFUZsU8mCpMOZ3bZ46SDNT4rxuQNng=; 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=1715567206; v=1; b=M4djlyWVxgZlC57+583vCFrF3hmSXcjiTJR6O1fBgfwZ+jray8b5OBb08ShPqbALM0YDzZRy zW06KPp7c00yIHtidcE9nz3//Gu/gNXrKQY/h32u4aGoEaF33Tyr2zKMOJk2ShlbeYZFERugrQu 32zXbZpMgatGaq0Zvvj5hqyNKuLyHR6ojxoIrpyusFuSu6w65V6spisMnCnjqaItD/tkGarJNHW 77pPLanU4tbOS1W2DxC/dXN/ArGwbcc4s32eX6ltE5nzF6ZT+MGNzlutxL7c8g/KuvCwhVkyjSh Nyzpk93grmu2Kzcj3I//65EB5GH7s2JNsxC51RNYqmd9A== X-Received: by 127.0.0.2 with SMTP id ZeIHYY7687511xTm8DKYTkAz; Sun, 12 May 2024 19:26:46 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by mx.groups.io with SMTP id smtpd.web10.51099.1715567205459166544 for ; Sun, 12 May 2024 19:26:45 -0700 X-CSE-ConnectionGUID: ZSSJBKF8RPuw27swTWvO9A== X-CSE-MsgGUID: ZW6AMrH+QuKJNHBv18b1RQ== X-IronPort-AV: E=McAfee;i="6600,9927,11071"; a="15294688" X-IronPort-AV: E=Sophos;i="6.08,157,1712646000"; d="scan'208,217";a="15294688" X-Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2024 19:26:45 -0700 X-CSE-ConnectionGUID: UYPY8OuTQ9252oBGHZsyNA== X-CSE-MsgGUID: e3UTP0yxTw+FIDDy5Vlbxw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,157,1712646000"; d="scan'208,217";a="34872015" X-Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orviesa003.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 12 May 2024 19:26:45 -0700 X-Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) 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; Sun, 12 May 2024 19:26:44 -0700 X-Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx612.amr.corp.intel.com (10.18.126.92) 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:26:43 -0700 X-Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) 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; Sun, 12 May 2024 19:26:43 -0700 X-Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) 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:26:43 -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:26:41 +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:26:41 +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 14/18] UefiCpuPkg: Remove code to set register table Thread-Topic: [PATCH 14/18] UefiCpuPkg: Remove code to set register table Thread-Index: AQHaosImRHmBjVHzHUaM7KJ0ViVborGUdFxW Date: Mon, 13 May 2024 02:26:41 +0000 Message-ID: References: <20240510100827.1903-1-dun.tan@intel.com> <20240510100827.1903-15-dun.tan@intel.com> In-Reply-To: <20240510100827.1903-15-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: 856d0024-c9b2-4eba-2a2f-08dc72f41fdb x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: =?us-ascii?Q?6bRGc+oj4THjEMk2YxhG9JqKX6O31uAdm2ZHY24/ck9fhrAeuBnt9SHtQ55L?= =?us-ascii?Q?MrU1E/CB2P6Wc4yED0+CP4oAwQd70RbYWCp6+i2laCU2FXx5Ur30SYbAKHfR?= =?us-ascii?Q?nZKJZiZsuBhtuKwojEFmNxHReLCUm8IbvkPfSb/4wKCcL9DhymzEQR+e+3XV?= =?us-ascii?Q?NPwvecIoqPl3TwAW/g9g64vvVpAkm4xZoWwvUxk34YJlchbtlLS0cZiAjSv2?= =?us-ascii?Q?VxgErzKq8KWmzzZ+JFyqRiygMlHRmrRzwwKggL8rkke41ht+4/hYCQBS46L2?= =?us-ascii?Q?MrAHaNSY0RMdtSN4cCbaPh7ohu+quSuSQJhBrKT+Q7TlDZ4rX+dgC1d1ndd9?= =?us-ascii?Q?YjIRefUD/gckkMP0fhMRz6qZMeeIEZthC9STvRbFs10VLGIF4QMYM7+FMpMo?= =?us-ascii?Q?UV30QuA8RTHa2PB167ah6TPEfLY45gCD3/ZgmdaVWEQ5NJBKqV7y6n5blHCx?= =?us-ascii?Q?rx7BYSlLMNDZNzpam9crO6CUlww4NW8UyfTUrFH1GM1ixVolpD6MPw7EkuyG?= =?us-ascii?Q?1B+ypnOymnOBsynj/5FJqyqFZlf4Jd3wiwodRvtq0S39sMqthLpYYJfEhN+f?= =?us-ascii?Q?pfoih7a4N6f/uuPpfX+j4mXybJHbiSI1fe0Oe7zzACMaFUOpWa5EcPQoQU2T?= =?us-ascii?Q?sGF9rZlRmiTmGA3L4gXeMgcsfCDb9lrjnlp1wOMX7shHZm+oN+Iqygmb2GwZ?= =?us-ascii?Q?Nt2gCbcSHUZxOPvHxs20CkZBcsjBEBX6Er4GbqOAtmj5tveHHpK3yHfK+avX?= =?us-ascii?Q?1EiDVtJ2TZ6WdiEur/Y1tQmeBuCnBRJbrl85/PdrxKOguSLCU25jihVi41Vz?= =?us-ascii?Q?j19fAMzkXtdkwI+auYyyJHYBWeKMfOgn8ekFEyISKouVlk+gfOKPhUsqI8a5?= =?us-ascii?Q?LQDOX8C3FiplTwKfljXE2wS9/1LAf/GsjFOXeXpQo4fVmcn7VJQ9DZh+318a?= =?us-ascii?Q?7K6ZS+r/iXgcqkPrAJJ/UwWzqO7bakUEaiuyScb8+9/G9Ko1CSwq6xqw2BLU?= =?us-ascii?Q?omK03yDBNrkwEmzaVsvmXSO9/Aml8Od8ncReb7jCtEmnpbA5RF1V6VQD2sxT?= =?us-ascii?Q?7z6wOTAhGgqD0Of7SoeEYjZyn469JK4LO7e9ydTWSXjnyt6x0p2lonO+ChG1?= =?us-ascii?Q?jnPEhKeJ4BXwVpUbr+QeQwESHJLcdXopqytOthFtcjCdiM14A6DooqTNdFY6?= =?us-ascii?Q?rdW8sCdzMHnOUEqf0pNhjxT4Jta5TvI+/ql9HyO3VXUOAz+RgywnmaRdGADw?= =?us-ascii?Q?wvbDYSCylNutgK5jTr7BeVm8yGfRtcS9IEvRO+gIHJmwitiNTChtHkDB6n2V?= =?us-ascii?Q?99afe8Wm2RYFDS9x7b68z+5fnPPnPOieSE6APg4PygrfMg=3D=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?OROZPDNxjY7IkD3DFpqy55VjIE2ImSrqFPheiYhRxn6bL50KW81unRg+DMJP?= =?us-ascii?Q?IUIYk72xcAVN/PHvrkjjI7CwAOx7IRNpJL1jnFmFY1C8qBVv3aVGbbAoatxO?= =?us-ascii?Q?DkVQxtI0Xv8YiW6618xV2lkLGzVgYMrhso+7+KESAGSuAlFR0z6wlgykuNbL?= =?us-ascii?Q?rZElVwoqWhHYo5hlMMRP/ZitAz3gGnnyaQ4t4kqoMeplDBN505TtebeAbM5C?= =?us-ascii?Q?b00LgctLHtQrJJl7iUZOps6NQTinTe/YRyx3MGoO6hER2VnoE8nDoEx1NHEO?= =?us-ascii?Q?O1PZOddnWyrF40iAYFW+9rAvfZGn5KpCxlpkAKImkJnCY4+2RmYxoXyHDvPR?= =?us-ascii?Q?6qSPR/S7HjphYDLFoMxOxZwInR7avWVvCLAcZt8BXkZ+0GUJI1yjDOYLAyo8?= =?us-ascii?Q?4uZfpnRsX/H3RBfYqHgT2tznZU3yCwTxFtvBv/6UmjXgpA/CN/tkC1HjilZd?= =?us-ascii?Q?wqGaWT8N8eBbX88EDaFtavolUx5hdfqKudGT0fmlsnD2xGXc3iiU9oDBK7QL?= =?us-ascii?Q?kdbMOht1nlLxXNAhB0StLQcw5a0ddtgMJB4jH/ziaCX1htp903K9lC3ThtWH?= =?us-ascii?Q?0nUOdF77hbV3SB4m9waPMPdug3M3128qIYqjpsonkBhEFzLrLcCmOzlM5llY?= =?us-ascii?Q?aDwzscM7xkBtpfM9tdAuPOJw6wK9HlWUeyY4te7eBx0QsD5FVc/YZHN1dwjx?= =?us-ascii?Q?OLGFQXjcrU6n/zwnKhw+5rbcAen/2JK8wN1edIA6OC00Eyy4BOmnlZbm8sWF?= =?us-ascii?Q?+n1DziwPfmTjy3XkC3dO0c9aSoiKB1hezoLWuzruk/7VGOCuuryJRTF0uocd?= =?us-ascii?Q?+mMOF4Yid5kDpCAQk6wk3ArDXCOK0L1fSoFvJFkAKkGcSeuJOxqy8eZM43SR?= =?us-ascii?Q?GTRW+vZKoFKBAr4I16crUGyVgDATguqZlFEgoJBrVJvfl3H6IExvXRlC/WVJ?= =?us-ascii?Q?SdLVimf8vcB7JrCEOHiblszCQI1goDhacIy0BVEBUPq5bmBSSxKRqG/wMdsl?= =?us-ascii?Q?2vfjsrkIqBahlzN1/X9Be0f6tqPMu//uQIAddFuTLuuqB75F5SQ2Kve3j7yj?= =?us-ascii?Q?HN9uRVIeerJ07awcznL+B3bnrtL1R8Ez3QIwpKGR/Cu8y+CgseCix2/SPX11?= =?us-ascii?Q?OqLExDT6nnJOYMelt/KeoinDLcM/6olVm8zW1e5iL8hVxNOkn2pT7dCuUcSo?= =?us-ascii?Q?ZltiOk+E/c3jo3a8hzmc8lnvcM9f0zl3/naiQHjoQW4fI9AI5N3wJoepfQM1?= =?us-ascii?Q?cE2ow6dE6H6Pu2/wqKqKWFOC6Ut64WR/7Y6otGBJE/HdA2kf8tSMBzatDS6Q?= =?us-ascii?Q?jc75P7pKObAghbvzsX2DdqEjbmZbVxs7QZIB2/7t3Z1WM8H8eZw/UaolOJnB?= =?us-ascii?Q?dYylf5OIbO+XcYShk5IdKU4JDY7gbhWdJY8DsdfzYji5ZtRVZHVM5ocacUfJ?= =?us-ascii?Q?IfvK5i6ZIrn5ub1r843gyiy9R19li53GRJKSYgM/GhA8vUXtROPUeQSp1NRc?= =?us-ascii?Q?hXxZn8/KyN/lStPQW9rkogfKG1UbE81J2wSPx5dr+tKKcfPOdL4reLvUPPPQ?= =?us-ascii?Q?ENDQWYDZtwN/El8KjTE=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: 856d0024-c9b2-4eba-2a2f-08dc72f41fdb X-MS-Exchange-CrossTenant-originalarrivaltime: 13 May 2024 02:26:41.1236 (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: 8ZxpLqkYG+geKhvAglw8BF3CjvWHEnA9YQYy0R/8hCFvz6cJmkmHWM8il0B/aAC3+Iv0igWCrh1/+pVnF2OdFg== 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:26:45 -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: eiOXyXaIKduMPZp6OfB3ZZOmx7686176AA= Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_MN6PR11MB82449A0E04BC605E8B4A52238CE22MN6PR11MB8244namp_" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=M4djlyWV; 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_MN6PR11MB82449A0E04BC605E8B4A52238CE22MN6PR11MB8244namp_ 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 14/18] UefiCpuPkg: Remove code to set register table Remove code to set register table in CpuS3.c. In previous commit, PcdCpuFeaturesInitOnS3Resume has been set to TRUE. So that CpuFeaturesPei PEIM will initialize the CPU registers and perform CPU features initialization. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu --- UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 423 ----------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= -------------- 1 file changed, 423 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c b/UefiCpuPkg/PiSmmCpuDxeSmm/= CpuS3.c index 7ac6b62676..9520451d92 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c @@ -91,425 +91,6 @@ UINT8 mApHltLoopCodeTemplate[] =3D { 0xEB, 0xFC // jmp $-2 }; -/** - Increment semaphore by 1. - - @param Sem IN: 32-bit unsigned integer - -**/ -VOID -S3ReleaseSemaphore ( - IN OUT volatile UINT32 *Sem - ) -{ - InterlockedIncrement (Sem); -} - -/** - Decrement the semaphore by 1 if it is not zero. - - Performs an atomic decrement operation for semaphore. - The compare exchange operation must be performed using - MP safe mechanisms. - - @param Sem IN: 32-bit unsigned integer - -**/ -VOID -S3WaitForSemaphore ( - IN OUT volatile UINT32 *Sem - ) -{ - UINT32 Value; - - do { - Value =3D *Sem; - } while (Value =3D=3D 0 || - InterlockedCompareExchange32 ( - Sem, - Value, - Value - 1 - ) !=3D Value); -} - -/** - Read / write CR value. - - @param[in] CrIndex The CR index which need to read/write. - @param[in] Read Read or write. TRUE is read. - @param[in,out] CrValue CR value. - - @retval EFI_SUCCESS means read/write success, else return EFI_UNSUPPO= RTED. -**/ -UINTN -ReadWriteCr ( - IN UINT32 CrIndex, - IN BOOLEAN Read, - IN OUT UINTN *CrValue - ) -{ - switch (CrIndex) { - case 0: - if (Read) { - *CrValue =3D AsmReadCr0 (); - } else { - AsmWriteCr0 (*CrValue); - } - - break; - case 2: - if (Read) { - *CrValue =3D AsmReadCr2 (); - } else { - AsmWriteCr2 (*CrValue); - } - - break; - case 3: - if (Read) { - *CrValue =3D AsmReadCr3 (); - } else { - AsmWriteCr3 (*CrValue); - } - - break; - case 4: - if (Read) { - *CrValue =3D AsmReadCr4 (); - } else { - AsmWriteCr4 (*CrValue); - } - - break; - default: - return EFI_UNSUPPORTED; - } - - return EFI_SUCCESS; -} - -/** - Initialize the CPU registers from a register table. - - @param[in] RegisterTable The register table for this AP. - @param[in] ApLocation AP location info for this ap. - @param[in] CpuStatus CPU status info for this CPU. - @param[in] CpuFlags Flags data structure used when program= the register. - - @note This service could be called by BSP/APs. -**/ -VOID -ProgramProcessorRegister ( - IN CPU_REGISTER_TABLE *RegisterTable, - IN EFI_CPU_PHYSICAL_LOCATION *ApLocation, - IN CPU_STATUS_INFORMATION *CpuStatus, - IN PROGRAM_CPU_REGISTER_FLAGS *CpuFlags - ) -{ - CPU_REGISTER_TABLE_ENTRY *RegisterTableEntry; - UINTN Index; - UINTN Value; - CPU_REGISTER_TABLE_ENTRY *RegisterTableEntryHead; - volatile UINT32 *SemaphorePtr; - UINT32 FirstThread; - UINT32 CurrentThread; - UINT32 CurrentCore; - UINTN ProcessorIndex; - UINT32 *ThreadCountPerPackage; - UINT8 *ThreadCountPerCore; - EFI_STATUS Status; - UINT64 CurrentValue; - - // - // Traverse Register Table of this logical processor - // - RegisterTableEntryHead =3D (CPU_REGISTER_TABLE_ENTRY *)(UINTN)RegisterTa= ble->RegisterTableEntry; - - for (Index =3D 0; Index < RegisterTable->TableLength; Index++) { - RegisterTableEntry =3D &RegisterTableEntryHead[Index]; - - // - // Check the type of specified register - // - switch (RegisterTableEntry->RegisterType) { - // - // The specified register is Control Register - // - case ControlRegister: - Status =3D ReadWriteCr (RegisterTableEntry->Index, TRUE, &Value); - if (EFI_ERROR (Status)) { - break; - } - - if (RegisterTableEntry->TestThenWrite) { - CurrentValue =3D BitFieldRead64 ( - Value, - RegisterTableEntry->ValidBitStart, - RegisterTableEntry->ValidBitStart + RegisterTab= leEntry->ValidBitLength - 1 - ); - if (CurrentValue =3D=3D RegisterTableEntry->Value) { - break; - } - } - - Value =3D (UINTN)BitFieldWrite64 ( - Value, - RegisterTableEntry->ValidBitStart, - RegisterTableEntry->ValidBitStart + RegisterTable= Entry->ValidBitLength - 1, - RegisterTableEntry->Value - ); - ReadWriteCr (RegisterTableEntry->Index, FALSE, &Value); - break; - // - // The specified register is Model Specific Register - // - case Msr: - if (RegisterTableEntry->TestThenWrite) { - Value =3D (UINTN)AsmReadMsr64 (RegisterTableEntry->Index); - if (RegisterTableEntry->ValidBitLength >=3D 64) { - if (Value =3D=3D RegisterTableEntry->Value) { - break; - } - } else { - CurrentValue =3D BitFieldRead64 ( - Value, - RegisterTableEntry->ValidBitStart, - RegisterTableEntry->ValidBitStart + RegisterT= ableEntry->ValidBitLength - 1 - ); - if (CurrentValue =3D=3D RegisterTableEntry->Value) { - break; - } - } - } - - // - // If this function is called to restore register setting after IN= IT signal, - // there is no need to restore MSRs in register table. - // - if (RegisterTableEntry->ValidBitLength >=3D 64) { - // - // If length is not less than 64 bits, then directly write witho= ut reading - // - AsmWriteMsr64 ( - RegisterTableEntry->Index, - RegisterTableEntry->Value - ); - } else { - // - // Set the bit section according to bit start and length - // - AsmMsrBitFieldWrite64 ( - RegisterTableEntry->Index, - RegisterTableEntry->ValidBitStart, - RegisterTableEntry->ValidBitStart + RegisterTableEntry->ValidB= itLength - 1, - RegisterTableEntry->Value - ); - } - - break; - // - // MemoryMapped operations - // - case MemoryMapped: - AcquireSpinLock (&CpuFlags->MemoryMappedLock); - MmioBitFieldWrite32 ( - (UINTN)(RegisterTableEntry->Index | LShiftU64 (RegisterTableEntr= y->HighIndex, 32)), - RegisterTableEntry->ValidBitStart, - RegisterTableEntry->ValidBitStart + RegisterTableEntry->ValidBit= Length - 1, - (UINT32)RegisterTableEntry->Value - ); - ReleaseSpinLock (&CpuFlags->MemoryMappedLock); - break; - // - // Enable or disable cache - // - case CacheControl: - // - // If value of the entry is 0, then disable cache. Otherwise, ena= ble cache. - // - if (RegisterTableEntry->Value =3D=3D 0) { - AsmDisableCache (); - } else { - AsmEnableCache (); - } - - break; - - case Semaphore: - // Semaphore works logic like below: - // - // V(x) =3D LibReleaseSemaphore (Semaphore[FirstThread + x]); - // P(x) =3D LibWaitForSemaphore (Semaphore[FirstThread + x]); - // - // All threads (T0...Tn) waits in P() line and continues running - // together. - // - // - // T0 T1 ... Tn - // - // V(0...n) V(0...n) ... V(0...n) - // n * P(0) n * P(1) ... n * P(n) - // - ASSERT ( - (ApLocation !=3D NULL) && - (CpuStatus->ThreadCountPerPackage !=3D 0) && - (CpuStatus->ThreadCountPerCore !=3D 0) && - (CpuFlags->CoreSemaphoreCount !=3D NULL) && - (CpuFlags->PackageSemaphoreCount !=3D NULL) - ); - switch (RegisterTableEntry->Value) { - case CoreDepType: - SemaphorePtr =3D CpuFlags->CoreSemaphoreCount; - ThreadCountPerCore =3D (UINT8 *)(UINTN)CpuStatus->ThreadCountP= erCore; - - CurrentCore =3D ApLocation->Package * CpuStatus->MaxCoreCount = + ApLocation->Core; - // - // Get Offset info for the first thread in the core which curr= ent thread belongs to. - // - FirstThread =3D CurrentCore * CpuStatus->MaxThreadCount; - CurrentThread =3D FirstThread + ApLocation->Thread; - - // - // Different cores may have different valid threads in them. I= f driver maintail clearly - // thread index in different cores, the logic will be much com= plicated. - // Here driver just simply records the max thread number in al= l cores and use it as expect - // thread number for all cores. - // In below two steps logic, first current thread will Release= semaphore for each thread - // in current core. Maybe some threads are not valid in this c= ore, but driver don't - // care. Second, driver will let current thread wait semaphore= for all valid threads in - // current core. Because only the valid threads will do releas= e semaphore for this - // thread, driver here only need to wait the valid thread coun= t. - // - - // - // First Notify ALL THREADs in current Core that this thread i= s ready. - // - for (ProcessorIndex =3D 0; ProcessorIndex < CpuStatus->MaxThre= adCount; ProcessorIndex++) { - S3ReleaseSemaphore (&SemaphorePtr[FirstThread + ProcessorInd= ex]); - } - - // - // Second, check whether all VALID THREADs (not all threads) i= n current core are ready. - // - for (ProcessorIndex =3D 0; ProcessorIndex < ThreadCountPerCore= [CurrentCore]; ProcessorIndex++) { - S3WaitForSemaphore (&SemaphorePtr[CurrentThread]); - } - - break; - - case PackageDepType: - SemaphorePtr =3D CpuFlags->PackageSemaphoreCount; - ThreadCountPerPackage =3D (UINT32 *)(UINTN)CpuStatus->ThreadCo= untPerPackage; - // - // Get Offset info for the first thread in the package which c= urrent thread belongs to. - // - FirstThread =3D ApLocation->Package * CpuStatus->MaxCoreCount = * CpuStatus->MaxThreadCount; - // - // Get the possible threads count for current package. - // - CurrentThread =3D FirstThread + CpuStatus->MaxThreadCount * Ap= Location->Core + ApLocation->Thread; - - // - // Different packages may have different valid threads in them= . If driver maintail clearly - // thread index in different packages, the logic will be much = complicated. - // Here driver just simply records the max thread number in al= l packages and use it as expect - // thread number for all packages. - // In below two steps logic, first current thread will Release= semaphore for each thread - // in current package. Maybe some threads are not valid in thi= s package, but driver don't - // care. Second, driver will let current thread wait semaphore= for all valid threads in - // current package. Because only the valid threads will do rel= ease semaphore for this - // thread, driver here only need to wait the valid thread coun= t. - // - - // - // First Notify ALL THREADS in current package that this threa= d is ready. - // - for (ProcessorIndex =3D 0; ProcessorIndex < CpuStatus->MaxThre= adCount * CpuStatus->MaxCoreCount; ProcessorIndex++) { - S3ReleaseSemaphore (&SemaphorePtr[FirstThread + ProcessorInd= ex]); - } - - // - // Second, check whether VALID THREADS (not all threads) in cu= rrent package are ready. - // - for (ProcessorIndex =3D 0; ProcessorIndex < ThreadCountPerPack= age[ApLocation->Package]; ProcessorIndex++) { - S3WaitForSemaphore (&SemaphorePtr[CurrentThread]); - } - - break; - - default: - break; - } - - break; - - default: - break; - } - } -} - -/** - - Set Processor register for one AP. - - @param PreSmmRegisterTable Use pre Smm register table or registe= r table. - -**/ -VOID -SetRegister ( - IN BOOLEAN PreSmmRegisterTable - ) -{ - CPU_FEATURE_INIT_DATA *FeatureInitData; - CPU_REGISTER_TABLE *RegisterTable; - CPU_REGISTER_TABLE *RegisterTables; - UINT32 InitApicId; - UINTN ProcIndex; - UINTN Index; - - FeatureInitData =3D &mAcpiCpuData.CpuFeatureInitData; - - if (PreSmmRegisterTable) { - RegisterTables =3D (CPU_REGISTER_TABLE *)(UINTN)FeatureInitData->PreSm= mInitRegisterTable; - } else { - RegisterTables =3D (CPU_REGISTER_TABLE *)(UINTN)FeatureInitData->Regis= terTable; - } - - if (RegisterTables =3D=3D NULL) { - return; - } - - InitApicId =3D GetInitialApicId (); - RegisterTable =3D NULL; - ProcIndex =3D (UINTN)-1; - for (Index =3D 0; Index < mAcpiCpuData.NumberOfCpus; Index++) { - if (RegisterTables[Index].InitialApicId =3D=3D InitApicId) { - RegisterTable =3D &RegisterTables[Index]; - ProcIndex =3D Index; - break; - } - } - - ASSERT (RegisterTable !=3D NULL); - - if (FeatureInitData->ApLocation !=3D 0) { - ProgramProcessorRegister ( - RegisterTable, - (EFI_CPU_PHYSICAL_LOCATION *)(UINTN)FeatureInitData->ApLocation + Pr= ocIndex, - &FeatureInitData->CpuStatus, - &mCpuFlags - ); - } else { - ProgramProcessorRegister ( - RegisterTable, - NULL, - &FeatureInitData->CpuStatus, - &mCpuFlags - ); - } -} - /** The function is invoked before SMBASE relocation in S3 path to restores = CPU status. @@ -524,8 +105,6 @@ InitializeCpuBeforeRebase ( IN BOOLEAN IsBsp ) { - SetRegister (TRUE); - ProgramVirtualWireMode (); if (!IsBsp) { DisableLvtInterrupts (); @@ -563,8 +142,6 @@ InitializeCpuAfterRebase ( UINTN TopOfStack; UINT8 Stack[128]; - SetRegister (FALSE); - if (mSmmS3ResumeState->MpService2Ppi =3D=3D 0) { if (IsBsp) { while (mNumberToFinish > 0) { -- 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 (#118845): https://edk2.groups.io/g/devel/message/118845 Mute This Topic: https://groups.io/mt/106018140/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_MN6PR11MB82449A0E04BC605E8B4A52238CE22MN6PR11MB8244namp_ 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 14/18] UefiCpuPkg: Remove code to set register table=
 
Remove code to set register table in CpuS3.c.
In previous commit, PcdCpuFeaturesInitOnS3Resume
has been set to TRUE. So that CpuFeaturesPei PEIM
will initialize the CPU registers and perform CPU
features initialization.

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 | 423 -----------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= -------------------
 1 file changed, 423 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c b/UefiCpuPkg/PiSmmCpuDxeSmm/= CpuS3.c
index 7ac6b62676..9520451d92 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
@@ -91,425 +91,6 @@ UINT8  mApHltLoopCodeTemplate[] =3D {
   0xEB, 0xFC        &nbs= p;     // jmp $-2
 };
 
-/**
-  Increment semaphore by 1.
-
-  @param      Sem    &nb= sp;       IN:  32-bit unsigned integer -
-**/
-VOID
-S3ReleaseSemaphore (
-  IN OUT  volatile UINT32  *Sem
-  )
-{
-  InterlockedIncrement (Sem);
-}
-
-/**
-  Decrement the semaphore by 1 if it is not zero.
-
-  Performs an atomic decrement operation for semaphore.
-  The compare exchange operation must be performed using
-  MP safe mechanisms.
-
-  @param      Sem    &nb= sp;       IN:  32-bit unsigned integer -
-**/
-VOID
-S3WaitForSemaphore (
-  IN OUT  volatile UINT32  *Sem
-  )
-{
-  UINT32  Value;
-
-  do {
-    Value =3D *Sem;
-  } while (Value =3D=3D 0 ||
-           InterlockedCo= mpareExchange32 (
-             S= em,
-             V= alue,
-             V= alue - 1
-             )= !=3D Value);
-}
-
-/**
-  Read / write CR value.
-
-  @param[in]      CrIndex   &= nbsp;     The CR index which need to read/write.
-  @param[in]      Read   &nbs= p;        Read or write. TRUE is read. -  @param[in,out]  CrValue      &nb= sp;  CR value.
-
-  @retval    EFI_SUCCESS means read/write success, els= e return EFI_UNSUPPORTED.
-**/
-UINTN
-ReadWriteCr (
-  IN     UINT32   CrIndex,
-  IN     BOOLEAN  Read,
-  IN OUT UINTN    *CrValue
-  )
-{
-  switch (CrIndex) {
-    case 0:
-      if (Read) {
-        *CrValue =3D AsmReadCr0 ();
-      } else {
-        AsmWriteCr0 (*CrValue);
-      }
-
-      break;
-    case 2:
-      if (Read) {
-        *CrValue =3D AsmReadCr2 ();
-      } else {
-        AsmWriteCr2 (*CrValue);
-      }
-
-      break;
-    case 3:
-      if (Read) {
-        *CrValue =3D AsmReadCr3 ();
-      } else {
-        AsmWriteCr3 (*CrValue);
-      }
-
-      break;
-    case 4:
-      if (Read) {
-        *CrValue =3D AsmReadCr4 ();
-      } else {
-        AsmWriteCr4 (*CrValue);
-      }
-
-      break;
-    default:
-      return EFI_UNSUPPORTED;
-  }
-
-  return EFI_SUCCESS;
-}
-
-/**
-  Initialize the CPU registers from a register table.
-
-  @param[in]  RegisterTable      &= nbsp;  The register table for this AP.
-  @param[in]  ApLocation      &nbs= p;     AP location info for this ap.
-  @param[in]  CpuStatus       = ;      CPU status info for this CPU.
-  @param[in]  CpuFlags       =        Flags data structure used when program= the register.
-
-  @note This service could be called by BSP/APs.
-**/
-VOID
-ProgramProcessorRegister (
-  IN CPU_REGISTER_TABLE       &nbs= p;  *RegisterTable,
-  IN EFI_CPU_PHYSICAL_LOCATION   *ApLocation,
-  IN CPU_STATUS_INFORMATION      *CpuStatus,=
-  IN PROGRAM_CPU_REGISTER_FLAGS  *CpuFlags
-  )
-{
-  CPU_REGISTER_TABLE_ENTRY  *RegisterTableEntry;
-  UINTN          &n= bsp;          Index;
-  UINTN          &n= bsp;          Value;
-  CPU_REGISTER_TABLE_ENTRY  *RegisterTableEntryHead;
-  volatile UINT32        &nbs= p;  *SemaphorePtr;
-  UINT32          &= nbsp;         FirstThread;
-  UINT32          &= nbsp;         CurrentThread;
-  UINT32          &= nbsp;         CurrentCore;
-  UINTN          &n= bsp;          ProcessorIndex;<= br> -  UINT32          &= nbsp;         *ThreadCountPerPackag= e;
-  UINT8          &n= bsp;          *ThreadCountPerC= ore;
-  EFI_STATUS         &nb= sp;      Status;
-  UINT64          &= nbsp;         CurrentValue;
-
-  //
-  // Traverse Register Table of this logical processor
-  //
-  RegisterTableEntryHead =3D (CPU_REGISTER_TABLE_ENTRY *)(UINTN)Regis= terTable->RegisterTableEntry;
-
-  for (Index =3D 0; Index < RegisterTable->TableLength; Index++= ) {
-    RegisterTableEntry =3D &RegisterTableEntryHead[Inde= x];
-
-    //
-    // Check the type of specified register
-    //
-    switch (RegisterTableEntry->RegisterType) {
-      //
-      // The specified register is Control Regist= er
-      //
-      case ControlRegister:
-        Status =3D ReadWriteCr (Registe= rTableEntry->Index, TRUE, &Value);
-        if (EFI_ERROR (Status)) {
-          break;
-        }
-
-        if (RegisterTableEntry->Test= ThenWrite) {
-          CurrentValue =3D Bi= tFieldRead64 (
-            &n= bsp;            = ;  Value,
-            &n= bsp;            = ;  RegisterTableEntry->ValidBitStart,
-            &n= bsp;            = ;  RegisterTableEntry->ValidBitStart + RegisterTableEntry->Valid= BitLength - 1
-            &n= bsp;            = ;  );
-          if (CurrentValue = =3D=3D RegisterTableEntry->Value) {
-            break;<= br> -          }
-        }
-
-        Value =3D (UINTN)BitFieldWrite6= 4 (
-            &n= bsp;            Valu= e,
-            &n= bsp;            Regi= sterTableEntry->ValidBitStart,
-            &n= bsp;            Regi= sterTableEntry->ValidBitStart + RegisterTableEntry->ValidBitLength - = 1,
-            &n= bsp;            Regi= sterTableEntry->Value
-            &n= bsp;            ); -        ReadWriteCr (RegisterTableEntry= ->Index, FALSE, &Value);
-        break;
-      //
-      // The specified register is Model Specific= Register
-      //
-      case Msr:
-        if (RegisterTableEntry->Test= ThenWrite) {
-          Value =3D (UINTN)As= mReadMsr64 (RegisterTableEntry->Index);
-          if (RegisterTableEn= try->ValidBitLength >=3D 64) {
-            if (Val= ue =3D=3D RegisterTableEntry->Value) {
-            &n= bsp; break;
-            }
-          } else {
-            Current= Value =3D BitFieldRead64 (
-            &n= bsp;            = ;    Value,
-            &n= bsp;            = ;    RegisterTableEntry->ValidBitStart,
-            &n= bsp;            = ;    RegisterTableEntry->ValidBitStart + RegisterTableEnt= ry->ValidBitLength - 1
-            &n= bsp;            = ;    );
-            if (Cur= rentValue =3D=3D RegisterTableEntry->Value) {
-            &n= bsp; break;
-            }
-          }
-        }
-
-        //
-        // If this function is called t= o restore register setting after INIT signal,
-        // there is no need to restore = MSRs in register table.
-        //
-        if (RegisterTableEntry->Vali= dBitLength >=3D 64) {
-          //
-          // If length is not= less than 64 bits, then directly write without reading
-          //
-          AsmWriteMsr64 (
-            Registe= rTableEntry->Index,
-            Registe= rTableEntry->Value
-            );
-        } else {
-          //
-          // Set the bit sect= ion according to bit start and length
-          //
-          AsmMsrBitFieldWrite= 64 (
-            Registe= rTableEntry->Index,
-            Registe= rTableEntry->ValidBitStart,
-            Registe= rTableEntry->ValidBitStart + RegisterTableEntry->ValidBitLength - 1,<= br> -            Registe= rTableEntry->Value
-            );
-        }
-
-        break;
-      //
-      // MemoryMapped operations
-      //
-      case MemoryMapped:
-        AcquireSpinLock (&CpuFlags-= >MemoryMappedLock);
-        MmioBitFieldWrite32 (
-          (UINTN)(RegisterTab= leEntry->Index | LShiftU64 (RegisterTableEntry->HighIndex, 32)),
-          RegisterTableEntry-= >ValidBitStart,
-          RegisterTableEntry-= >ValidBitStart + RegisterTableEntry->ValidBitLength - 1,
-          (UINT32)RegisterTab= leEntry->Value
-          );
-        ReleaseSpinLock (&CpuFlags-= >MemoryMappedLock);
-        break;
-      //
-      // Enable or disable cache
-      //
-      case CacheControl:
-        //
-        // If value of the entry is 0, = then disable cache.  Otherwise, enable cache.
-        //
-        if (RegisterTableEntry->Valu= e =3D=3D 0) {
-          AsmDisableCache ();=
-        } else {
-          AsmEnableCache ();<= br> -        }
-
-        break;
-
-      case Semaphore:
-        // Semaphore works logic like b= elow:
-        //
-        //  V(x) =3D LibReleaseSem= aphore (Semaphore[FirstThread + x]);
-        //  P(x) =3D LibWaitForSem= aphore (Semaphore[FirstThread + x]);
-        //
-        //  All threads (T0...Tn) = waits in P() line and continues running
-        //  together.
-        //
-        //
-        //  T0   &n= bsp;         T1   &n= bsp;        ...    &= nbsp;      Tn
-        //
-        //  V(0...n)  &n= bsp;    V(0...n)      ... &nbs= p;         V(0...n)
-        //  n * P(0)  &n= bsp;    n * P(1)      ... &nbs= p;         n * P(n)
-        //
-        ASSERT (
-          (ApLocation !=3D NU= LL) &&
-          (CpuStatus->Thre= adCountPerPackage !=3D 0) &&
-          (CpuStatus->Thre= adCountPerCore !=3D 0) &&
-          (CpuFlags->CoreS= emaphoreCount !=3D NULL) &&
-          (CpuFlags->Packa= geSemaphoreCount !=3D NULL)
-          );
-        switch (RegisterTableEntry->= Value) {
-          case CoreDepType: -            Semapho= rePtr       =3D CpuFlags->CoreSemaphoreCou= nt;
-            ThreadC= ountPerCore =3D (UINT8 *)(UINTN)CpuStatus->ThreadCountPerCore;
-
-            Current= Core =3D ApLocation->Package * CpuStatus->MaxCoreCount + ApLocation-&= gt;Core;
-            //
-            // Get = Offset info for the first thread in the core which current thread belongs t= o.
-            //
-            FirstTh= read   =3D CurrentCore * CpuStatus->MaxThreadCount;
-            Current= Thread =3D FirstThread + ApLocation->Thread;
-
-            //
-            // Diff= erent cores may have different valid threads in them. If driver maintail cl= early
-            // thre= ad index in different cores, the logic will be much complicated.
-            // Here= driver just simply records the max thread number in all cores and use it a= s expect
-            // thre= ad number for all cores.
-            // In b= elow two steps logic, first current thread will Release semaphore for each = thread
-            // in c= urrent core. Maybe some threads are not valid in this core, but driver don'= t
-            // care= . Second, driver will let current thread wait semaphore for all valid threa= ds in
-            // curr= ent core. Because only the valid threads will do release semaphore for this=
-            // thre= ad, driver here only need to wait the valid thread count.
-            //
-
-            //
-            // Firs= t Notify ALL THREADs in current Core that this thread is ready.
-            //
-            for (Pr= ocessorIndex =3D 0; ProcessorIndex < CpuStatus->MaxThreadCount; Proce= ssorIndex++) {
-            &n= bsp; S3ReleaseSemaphore (&SemaphorePtr[FirstThread + ProcessorIndex]);<= br> -            }
-
-            //
-            // Seco= nd, check whether all VALID THREADs (not all threads) in current core are r= eady.
-            //
-            for (Pr= ocessorIndex =3D 0; ProcessorIndex < ThreadCountPerCore[CurrentCore]; Pr= ocessorIndex++) {
-            &n= bsp; S3WaitForSemaphore (&SemaphorePtr[CurrentThread]);
-            }
-
-            break;<= br> -
-          case PackageDepType= :
-            Semapho= rePtr          =3D CpuFlags-&g= t;PackageSemaphoreCount;
-            ThreadC= ountPerPackage =3D (UINT32 *)(UINTN)CpuStatus->ThreadCountPerPackage; -            //
-            // Get = Offset info for the first thread in the package which current thread belong= s to.
-            //
-            FirstTh= read =3D ApLocation->Package * CpuStatus->MaxCoreCount * CpuStatus-&g= t;MaxThreadCount;
-            //
-            // Get = the possible threads count for current package.
-            //
-            Current= Thread =3D FirstThread + CpuStatus->MaxThreadCount * ApLocation->Core= + ApLocation->Thread;
-
-            //
-            // Diff= erent packages may have different valid threads in them. If driver maintail= clearly
-            // thre= ad index in different packages, the logic will be much complicated.
-            // Here= driver just simply records the max thread number in all packages and use i= t as expect
-            // thre= ad number for all packages.
-            // In b= elow two steps logic, first current thread will Release semaphore for each = thread
-            // in c= urrent package. Maybe some threads are not valid in this package, but drive= r don't
-            // care= . Second, driver will let current thread wait semaphore for all valid threa= ds in
-            // curr= ent package. Because only the valid threads will do release semaphore for t= his
-            // thre= ad, driver here only need to wait the valid thread count.
-            //
-
-            //
-            // Firs= t Notify ALL THREADS in current package that this thread is ready.
-            //
-            for (Pr= ocessorIndex =3D 0; ProcessorIndex < CpuStatus->MaxThreadCount * CpuS= tatus->MaxCoreCount; ProcessorIndex++) {
-            &n= bsp; S3ReleaseSemaphore (&SemaphorePtr[FirstThread + ProcessorIndex]);<= br> -            }
-
-            //
-            // Seco= nd, check whether VALID THREADS (not all threads) in current package are re= ady.
-            //
-            for (Pr= ocessorIndex =3D 0; ProcessorIndex < ThreadCountPerPackage[ApLocation-&g= t;Package]; ProcessorIndex++) {
-            &n= bsp; S3WaitForSemaphore (&SemaphorePtr[CurrentThread]);
-            }
-
-            break;<= br> -
-          default:
-            break;<= br> -        }
-
-        break;
-
-      default:
-        break;
-    }
-  }
-}
-
-/**
-
-  Set Processor register for one AP.
-
-  @param     PreSmmRegisterTable   = ;  Use pre Smm register table or register table.
-
-**/
-VOID
-SetRegister (
-  IN BOOLEAN  PreSmmRegisterTable
-  )
-{
-  CPU_FEATURE_INIT_DATA  *FeatureInitData;
-  CPU_REGISTER_TABLE     *RegisterTable;
-  CPU_REGISTER_TABLE     *RegisterTables;
-  UINT32          &= nbsp;      InitApicId;
-  UINTN          &n= bsp;       ProcIndex;
-  UINTN          &n= bsp;       Index;
-
-  FeatureInitData =3D &mAcpiCpuData.CpuFeatureInitData;
-
-  if (PreSmmRegisterTable) {
-    RegisterTables =3D (CPU_REGISTER_TABLE *)(UINTN)Feature= InitData->PreSmmInitRegisterTable;
-  } else {
-    RegisterTables =3D (CPU_REGISTER_TABLE *)(UINTN)Feature= InitData->RegisterTable;
-  }
-
-  if (RegisterTables =3D=3D NULL) {
-    return;
-  }
-
-  InitApicId    =3D GetInitialApicId ();
-  RegisterTable =3D NULL;
-  ProcIndex     =3D (UINTN)-1;
-  for (Index =3D 0; Index < mAcpiCpuData.NumberOfCpus; Index++) {<= br> -    if (RegisterTables[Index].InitialApicId =3D=3D InitApic= Id) {
-      RegisterTable =3D &RegisterTables[Index= ];
-      ProcIndex     =3D Index= ;
-      break;
-    }
-  }
-
-  ASSERT (RegisterTable !=3D NULL);
-
-  if (FeatureInitData->ApLocation !=3D 0) {
-    ProgramProcessorRegister (
-      RegisterTable,
-      (EFI_CPU_PHYSICAL_LOCATION *)(UINTN)Feature= InitData->ApLocation + ProcIndex,
-      &FeatureInitData->CpuStatus,
-      &mCpuFlags
-      );
-  } else {
-    ProgramProcessorRegister (
-      RegisterTable,
-      NULL,
-      &FeatureInitData->CpuStatus,
-      &mCpuFlags
-      );
-  }
-}
-
 /**
   The function is invoked before SMBASE relocation in S3 path to= restores CPU status.
 
@@ -524,8 +105,6 @@ InitializeCpuBeforeRebase (
   IN BOOLEAN  IsBsp
   )
 {
-  SetRegister (TRUE);
-
   ProgramVirtualWireMode ();
   if (!IsBsp) {
     DisableLvtInterrupts ();
@@ -563,8 +142,6 @@ InitializeCpuAfterRebase (
   UINTN  TopOfStack;
   UINT8  Stack[128];
 
-  SetRegister (FALSE);
-
   if (mSmmS3ResumeState->MpService2Ppi =3D=3D 0) {
     if (IsBsp) {
       while (mNumberToFinish > 0) {
--
2.31.1.windows.1

_._,_._,_

Groups.io Links:

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

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

_._,_._,_
--_000_MN6PR11MB82449A0E04BC605E8B4A52238CE22MN6PR11MB8244namp_--