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:11 -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:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,244,1571727600"; d="scan'208";a="408557843" Received: from ray-dev.ccr.corp.intel.com ([10.239.9.9]) by fmsmga005.fm.intel.com with ESMTP; 25 Nov 2019 22:17:10 -0800 From: Ray Ni To: devel@edk2.groups.io Cc: Ray Ni , Eric Dong Subject: [PATCH v2 2/3] UefiCpuPkg/RegisterCpuFeaturesLib: Rename [Before|After]FeatureBitMask Date: Tue, 26 Nov 2019 14:15:49 +0800 Message-Id: <20191126061550.494828-3-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 The patch doesn't have any functionality impact. Signed-off-by: Ray Ni Cc: Eric Dong --- .../RegisterCpuFeatures.h | 4 +- .../RegisterCpuFeaturesLib.c | 68 +++++++++++-------- 2 files changed, 40 insertions(+), 32 deletions(-) diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h index 7c48b0a645..4780f792d9 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h @@ -43,8 +43,8 @@ typedef struct { CPU_FEATURE_GET_CONFIG_DATA GetConfigDataFunc; CPU_FEATURE_SUPPORT SupportFunc; CPU_FEATURE_INITIALIZE InitializeFunc; - UINT8 *BeforeFeatureBitMask; - UINT8 *AfterFeatureBitMask; + UINT8 *ThreadBeforeFeatureBitMask; + UINT8 *ThreadAfterFeatureBitMask; UINT8 *CoreBeforeFeatureBitMask; UINT8 *CoreAfterFeatureBitMask; UINT8 *PackageBeforeFeatureBitMask; diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c index 1f953832b9..3d18b5916f 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c @@ -194,8 +194,8 @@ DetectFeatureScope ( return CoreDepType; } - if ((CpuFeature->BeforeFeatureBitMask != NULL) && - IsBitMaskMatchCheck (NextCpuFeatureMask, CpuFeature->BeforeFeatureBitMask)) { + if ((CpuFeature->ThreadBeforeFeatureBitMask != NULL) && + IsBitMaskMatchCheck (NextCpuFeatureMask, CpuFeature->ThreadBeforeFeatureBitMask)) { return ThreadDepType; } @@ -212,8 +212,8 @@ DetectFeatureScope ( return CoreDepType; } - if ((CpuFeature->AfterFeatureBitMask != NULL) && - IsBitMaskMatchCheck (NextCpuFeatureMask, CpuFeature->AfterFeatureBitMask)) { + if ((CpuFeature->ThreadAfterFeatureBitMask != NULL) && + IsBitMaskMatchCheck (NextCpuFeatureMask, CpuFeature->ThreadAfterFeatureBitMask)) { return ThreadDepType; } @@ -247,8 +247,8 @@ DetectNoneNeighborhoodFeatureScope ( return CoreDepType; } - if ((CpuFeature->BeforeFeatureBitMask != NULL) && - FindSpecifyFeature(FeatureList, &CpuFeature->Link, FALSE, CpuFeature->BeforeFeatureBitMask)) { + if ((CpuFeature->ThreadBeforeFeatureBitMask != NULL) && + FindSpecifyFeature(FeatureList, &CpuFeature->Link, FALSE, CpuFeature->ThreadBeforeFeatureBitMask)) { return ThreadDepType; } @@ -265,8 +265,8 @@ DetectNoneNeighborhoodFeatureScope ( return CoreDepType; } - if ((CpuFeature->AfterFeatureBitMask != NULL) && - FindSpecifyFeature(FeatureList, &CpuFeature->Link, TRUE, CpuFeature->AfterFeatureBitMask)) { + if ((CpuFeature->ThreadAfterFeatureBitMask != NULL) && + FindSpecifyFeature(FeatureList, &CpuFeature->Link, TRUE, CpuFeature->ThreadAfterFeatureBitMask)) { return ThreadDepType; } @@ -561,15 +561,15 @@ CheckCpuFeaturesDependency ( } } - if (CpuFeature->BeforeFeatureBitMask != NULL) { - Swapped = InsertToBeforeEntry (FeatureList, CurrentEntry, CpuFeature->BeforeFeatureBitMask); + if (CpuFeature->ThreadBeforeFeatureBitMask != NULL) { + Swapped = InsertToBeforeEntry (FeatureList, CurrentEntry, CpuFeature->ThreadBeforeFeatureBitMask); if (Swapped) { continue; } } - if (CpuFeature->AfterFeatureBitMask != NULL) { - Swapped = InsertToAfterEntry (FeatureList, CurrentEntry, CpuFeature->AfterFeatureBitMask); + if (CpuFeature->ThreadAfterFeatureBitMask != NULL) { + Swapped = InsertToAfterEntry (FeatureList, CurrentEntry, CpuFeature->ThreadAfterFeatureBitMask); if (Swapped) { continue; } @@ -676,17 +676,17 @@ RegisterCpuFeatureWorker ( ASSERT_EFI_ERROR (Status); FreePool (CpuFeature->FeatureName); } - if (CpuFeature->BeforeFeatureBitMask != NULL) { - if (CpuFeatureEntry->BeforeFeatureBitMask != NULL) { - FreePool (CpuFeatureEntry->BeforeFeatureBitMask); + if (CpuFeature->ThreadBeforeFeatureBitMask != NULL) { + if (CpuFeatureEntry->ThreadBeforeFeatureBitMask != NULL) { + FreePool (CpuFeatureEntry->ThreadBeforeFeatureBitMask); } - CpuFeatureEntry->BeforeFeatureBitMask = CpuFeature->BeforeFeatureBitMask; + CpuFeatureEntry->ThreadBeforeFeatureBitMask = CpuFeature->ThreadBeforeFeatureBitMask; } - if (CpuFeature->AfterFeatureBitMask != NULL) { - if (CpuFeatureEntry->AfterFeatureBitMask != NULL) { - FreePool (CpuFeatureEntry->AfterFeatureBitMask); + if (CpuFeature->ThreadAfterFeatureBitMask != NULL) { + if (CpuFeatureEntry->ThreadAfterFeatureBitMask != NULL) { + FreePool (CpuFeatureEntry->ThreadAfterFeatureBitMask); } - CpuFeatureEntry->AfterFeatureBitMask = CpuFeature->AfterFeatureBitMask; + CpuFeatureEntry->ThreadAfterFeatureBitMask = CpuFeature->ThreadAfterFeatureBitMask; } if (CpuFeature->CoreBeforeFeatureBitMask != NULL) { if (CpuFeatureEntry->CoreBeforeFeatureBitMask != NULL) { @@ -815,8 +815,8 @@ RegisterCpuFeature ( UINT32 Feature; CPU_FEATURES_ENTRY *CpuFeature; UINT8 *FeatureMask; - UINT8 *BeforeFeatureBitMask; - UINT8 *AfterFeatureBitMask; + UINT8 *ThreadBeforeFeatureBitMask; + UINT8 *ThreadAfterFeatureBitMask; UINT8 *CoreBeforeFeatureBitMask; UINT8 *CoreAfterFeatureBitMask; UINT8 *PackageBeforeFeatureBitMask; @@ -826,8 +826,8 @@ RegisterCpuFeature ( CPU_FEATURES_DATA *CpuFeaturesData; FeatureMask = NULL; - BeforeFeatureBitMask = NULL; - AfterFeatureBitMask = NULL; + ThreadBeforeFeatureBitMask = NULL; + ThreadAfterFeatureBitMask = NULL; CoreBeforeFeatureBitMask = NULL; CoreAfterFeatureBitMask = NULL; PackageBeforeFeatureBitMask = NULL; @@ -850,10 +850,18 @@ RegisterCpuFeature ( VA_START (Marker, InitializeFunc); Feature = VA_ARG (Marker, UINT32); while (Feature != CPU_FEATURE_END) { - ASSERT ((Feature & (CPU_FEATURE_BEFORE | CPU_FEATURE_AFTER)) - != (CPU_FEATURE_BEFORE | CPU_FEATURE_AFTER)); + // + // It's invalid to require a feature is before AND after all other features. + // ASSERT ((Feature & (CPU_FEATURE_BEFORE_ALL | CPU_FEATURE_AFTER_ALL)) != (CPU_FEATURE_BEFORE_ALL | CPU_FEATURE_AFTER_ALL)); + + // + // It's invalid to require feature A is before AND after before feature B, + // either in thread level, core level or package level. + // + ASSERT ((Feature & (CPU_FEATURE_THREAD_BEFORE | CPU_FEATURE_THREAD_AFTER)) + != (CPU_FEATURE_THREAD_BEFORE | CPU_FEATURE_THREAD_AFTER)); ASSERT ((Feature & (CPU_FEATURE_CORE_BEFORE | CPU_FEATURE_CORE_AFTER)) != (CPU_FEATURE_CORE_BEFORE | CPU_FEATURE_CORE_AFTER)); ASSERT ((Feature & (CPU_FEATURE_PACKAGE_BEFORE | CPU_FEATURE_PACKAGE_AFTER)) @@ -865,9 +873,9 @@ RegisterCpuFeature ( ASSERT (FeatureMask == NULL); SetCpuFeaturesBitMask (&FeatureMask, Feature, CpuFeaturesData->BitMaskSize); } else if ((Feature & CPU_FEATURE_THREAD_BEFORE) != 0) { - SetCpuFeaturesBitMask (&BeforeFeatureBitMask, Feature & ~CPU_FEATURE_THREAD_BEFORE, CpuFeaturesData->BitMaskSize); + SetCpuFeaturesBitMask (&ThreadBeforeFeatureBitMask, Feature & ~CPU_FEATURE_THREAD_BEFORE, CpuFeaturesData->BitMaskSize); } else if ((Feature & CPU_FEATURE_THREAD_AFTER) != 0) { - SetCpuFeaturesBitMask (&AfterFeatureBitMask, Feature & ~CPU_FEATURE_THREAD_AFTER, CpuFeaturesData->BitMaskSize); + SetCpuFeaturesBitMask (&ThreadAfterFeatureBitMask, 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) { @@ -885,8 +893,8 @@ RegisterCpuFeature ( ASSERT (CpuFeature != NULL); CpuFeature->Signature = CPU_FEATURE_ENTRY_SIGNATURE; CpuFeature->FeatureMask = FeatureMask; - CpuFeature->BeforeFeatureBitMask = BeforeFeatureBitMask; - CpuFeature->AfterFeatureBitMask = AfterFeatureBitMask; + CpuFeature->ThreadBeforeFeatureBitMask = ThreadBeforeFeatureBitMask; + CpuFeature->ThreadAfterFeatureBitMask = ThreadAfterFeatureBitMask; CpuFeature->CoreBeforeFeatureBitMask = CoreBeforeFeatureBitMask; CpuFeature->CoreAfterFeatureBitMask = CoreAfterFeatureBitMask; CpuFeature->PackageBeforeFeatureBitMask = PackageBeforeFeatureBitMask; -- 2.21.0.windows.1