From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com []) by mx.groups.io with SMTP id smtpd.web11.8122.1574749029253111288 for ; Mon, 25 Nov 2019 22:17:10 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: users.noreply.github.com, ip: , mailfrom: niruiyu@users.noreply.github.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Nov 2019 22:17:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,244,1571727600"; d="scan'208";a="408557829" Received: from ray-dev.ccr.corp.intel.com ([10.239.9.9]) by fmsmga005.fm.intel.com with ESMTP; 25 Nov 2019 22:17:09 -0800 From: Ray Ni To: devel@edk2.groups.io Cc: Ray Ni , Eric Dong , Star Zeng Subject: [PATCH v2 1/3] UefiCpuPkg/RegisterCpuFeaturesLib: Delete CPU_FEATURE_[BEFORE|AFTER] Date: Tue, 26 Nov 2019 14:15:48 +0800 Message-Id: <20191126061550.494828-2-niruiyu@users.noreply.github.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20191126061550.494828-1-niruiyu@users.noreply.github.com> References: <20191126061550.494828-1-niruiyu@users.noreply.github.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Ray Ni REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1366 Commit b3c71b472dff2c02f0cc38d7a1959cfb2ba8420d supported MSR setting in different scopes. It added below macro: CPU_FEATURE_THREAD_BEFORE CPU_FEATURE_THREAD_AFTER CPU_FEATURE_CORE_BEFORE CPU_FEATURE_CORE_AFTER CPU_FEATURE_PACKAGE_BEFORE CPU_FEATURE_PACKAGE_AFTER And it re-interpreted CPU_FEATURE_BEFORE as CPU_FEATURE_THREAD_BEFORE and CPU_FEATURE_AFTER as CPU_FEATURE_THREAD_AFTER. This patch retires CPU_FEATURE_BEFORE and CPU_FEATURE_AFTER completely. Signed-off-by: Ray Ni Cc: Eric Dong Cc: Star Zeng --- UefiCpuPkg/Include/Library/RegisterCpuFeaturesLib.h | 13 ++----------- .../CpuCommonFeaturesLib/CpuCommonFeaturesLib.c | 6 +++--- .../RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c | 10 +++++----- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/UefiCpuPkg/Include/Library/RegisterCpuFeaturesLib.h b/UefiCpuPkg/Include/Library/RegisterCpuFeaturesLib.h index f370373d63..d075606cdb 100644 --- a/UefiCpuPkg/Include/Library/RegisterCpuFeaturesLib.h +++ b/UefiCpuPkg/Include/Library/RegisterCpuFeaturesLib.h @@ -69,17 +69,8 @@ #define CPU_FEATURE_BEFORE_ALL BIT23 #define CPU_FEATURE_AFTER_ALL BIT24 -// -// CPU_FEATURE_BEFORE and CPU_FEATURE_AFTER only mean Thread scope -// before and Thread scope after. -// It will be replace with CPU_FEATURE_THREAD_BEFORE and -// CPU_FEATURE_THREAD_AFTER, and should not be used anymore. -// -#define CPU_FEATURE_BEFORE BIT25 -#define CPU_FEATURE_AFTER BIT26 - -#define CPU_FEATURE_THREAD_BEFORE CPU_FEATURE_BEFORE -#define CPU_FEATURE_THREAD_AFTER CPU_FEATURE_AFTER +#define CPU_FEATURE_THREAD_BEFORE BIT25 +#define CPU_FEATURE_THREAD_AFTER BIT26 #define CPU_FEATURE_CORE_BEFORE BIT27 #define CPU_FEATURE_CORE_AFTER BIT28 #define CPU_FEATURE_PACKAGE_BEFORE BIT29 diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.c index 3ebd9392a9..d1fe14f519 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeaturesLib.c @@ -95,7 +95,7 @@ CpuCommonFeaturesLibConstructor ( SmxSupport, SmxInitialize, CPU_FEATURE_SMX, - CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER | CPU_FEATURE_BEFORE, + CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER | CPU_FEATURE_THREAD_BEFORE, CPU_FEATURE_END ); ASSERT_EFI_ERROR (Status); @@ -107,7 +107,7 @@ CpuCommonFeaturesLibConstructor ( VmxSupport, VmxInitialize, CPU_FEATURE_VMX, - CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER | CPU_FEATURE_BEFORE, + CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER | CPU_FEATURE_THREAD_BEFORE, CPU_FEATURE_END ); ASSERT_EFI_ERROR (Status); @@ -207,7 +207,7 @@ CpuCommonFeaturesLibConstructor ( LmceSupport, LmceInitialize, CPU_FEATURE_LMCE, - CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER | CPU_FEATURE_BEFORE, + CPU_FEATURE_LOCK_FEATURE_CONTROL_REGISTER | CPU_FEATURE_THREAD_BEFORE, CPU_FEATURE_END ); ASSERT_EFI_ERROR (Status); diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c index 58910b8891..1f953832b9 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c @@ -858,16 +858,16 @@ RegisterCpuFeature ( != (CPU_FEATURE_CORE_BEFORE | CPU_FEATURE_CORE_AFTER)); ASSERT ((Feature & (CPU_FEATURE_PACKAGE_BEFORE | CPU_FEATURE_PACKAGE_AFTER)) != (CPU_FEATURE_PACKAGE_BEFORE | CPU_FEATURE_PACKAGE_AFTER)); - if (Feature < CPU_FEATURE_BEFORE) { + if (Feature < CPU_FEATURE_THREAD_BEFORE) { BeforeAll = ((Feature & CPU_FEATURE_BEFORE_ALL) != 0) ? TRUE : FALSE; AfterAll = ((Feature & CPU_FEATURE_AFTER_ALL) != 0) ? TRUE : FALSE; Feature &= ~(CPU_FEATURE_BEFORE_ALL | CPU_FEATURE_AFTER_ALL); ASSERT (FeatureMask == NULL); SetCpuFeaturesBitMask (&FeatureMask, Feature, CpuFeaturesData->BitMaskSize); - } else if ((Feature & CPU_FEATURE_BEFORE) != 0) { - SetCpuFeaturesBitMask (&BeforeFeatureBitMask, Feature & ~CPU_FEATURE_BEFORE, CpuFeaturesData->BitMaskSize); - } else if ((Feature & CPU_FEATURE_AFTER) != 0) { - SetCpuFeaturesBitMask (&AfterFeatureBitMask, Feature & ~CPU_FEATURE_AFTER, CpuFeaturesData->BitMaskSize); + } else if ((Feature & CPU_FEATURE_THREAD_BEFORE) != 0) { + SetCpuFeaturesBitMask (&BeforeFeatureBitMask, Feature & ~CPU_FEATURE_THREAD_BEFORE, CpuFeaturesData->BitMaskSize); + } else if ((Feature & CPU_FEATURE_THREAD_AFTER) != 0) { + SetCpuFeaturesBitMask (&AfterFeatureBitMask, Feature & ~CPU_FEATURE_THREAD_AFTER, CpuFeaturesData->BitMaskSize); } else if ((Feature & CPU_FEATURE_CORE_BEFORE) != 0) { SetCpuFeaturesBitMask (&CoreBeforeFeatureBitMask, Feature & ~CPU_FEATURE_CORE_BEFORE, CpuFeaturesData->BitMaskSize); } else if ((Feature & CPU_FEATURE_CORE_AFTER) != 0) { -- 2.21.0.windows.1