* [Patch v2 0/4] Simplify CPU Features solution.
@ 2019-03-01 5:39 Eric Dong
2019-03-01 5:39 ` [Patch v2 1/4] UefiCpuPkg/RegisterCpuFeaturesLib: Remove useless functions Eric Dong
` (4 more replies)
0 siblings, 5 replies; 14+ messages in thread
From: Eric Dong @ 2019-03-01 5:39 UTC (permalink / raw)
To: edk2-devel; +Cc: Ray Ni, Laszlo Ersek
V2 Changes include:
1. Add ASSERT to make sure PcdCpuFeaturesSetting and
PcdCpuFeaturesCapability have equal size.
2. Correct comment block on IsCpuFeatureSetInCpuPcd() references
"PcdCpuFeaturesSupport". It should reference "CpuBitMask".
V1 Changes includes:
1. Optimize PCD PcdCpuFeaturesUserConfiguration
2. Limit useage of PcdCpuFeaturesSupport
3. Remove some useless APIs.
Detail explanation please check each patch's introduction.
Cc: Ray Ni <Ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Eric Dong (4):
UefiCpuPkg/RegisterCpuFeaturesLib: Remove useless functions.
UefiCpuPkg/RegisterCpuFeaturesLib: Optimize PCD
PcdCpuFeaturesUserConfiguration.
UefiCpuPkg/RegisterCpuFeaturesLib: Simplify PcdCpuFeaturesSupport.
UefiCpuPkg/RegisterCpuFeaturesLib: Correct comments.
.../Include/Library/RegisterCpuFeaturesLib.h | 34 ------
.../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 114 ++++++---------------
.../DxeRegisterCpuFeaturesLib.inf | 3 +-
.../PeiRegisterCpuFeaturesLib.inf | 3 +-
.../RegisterCpuFeaturesLib/RegisterCpuFeatures.h | 2 -
.../RegisterCpuFeaturesLib.c | 64 ++----------
UefiCpuPkg/UefiCpuPkg.dec | 9 +-
7 files changed, 45 insertions(+), 184 deletions(-)
--
2.15.0.windows.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Patch v2 1/4] UefiCpuPkg/RegisterCpuFeaturesLib: Remove useless functions.
2019-03-01 5:39 [Patch v2 0/4] Simplify CPU Features solution Eric Dong
@ 2019-03-01 5:39 ` Eric Dong
2019-04-02 7:07 ` Ni, Ray
2019-03-01 5:39 ` [Patch v2 2/4] UefiCpuPkg/RegisterCpuFeaturesLib: Optimize PCD PcdCpuFeaturesUserConfiguration Eric Dong
` (3 subsequent siblings)
4 siblings, 1 reply; 14+ messages in thread
From: Eric Dong @ 2019-03-01 5:39 UTC (permalink / raw)
To: edk2-devel
Remove useless APIs, simplify the code logic.
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1375
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
.../Include/Library/RegisterCpuFeaturesLib.h | 34 ---------------
.../RegisterCpuFeaturesLib.c | 50 ----------------------
2 files changed, 84 deletions(-)
diff --git a/UefiCpuPkg/Include/Library/RegisterCpuFeaturesLib.h b/UefiCpuPkg/Include/Library/RegisterCpuFeaturesLib.h
index 2f7e71c833..073f020d0b 100644
--- a/UefiCpuPkg/Include/Library/RegisterCpuFeaturesLib.h
+++ b/UefiCpuPkg/Include/Library/RegisterCpuFeaturesLib.h
@@ -166,40 +166,6 @@ IsCpuFeatureInSetting (
IN UINT32 Feature
);
-/**
- Determines if a CPU feature is set in PcdCpuFeaturesCapability bit mask.
-
- @param[in] Feature The bit number of the CPU feature to check in the PCD
- PcdCpuFeaturesCapability.
-
- @retval TRUE The CPU feature is set in PcdCpuFeaturesCapability.
- @retval FALSE The CPU feature is not set in PcdCpuFeaturesCapability.
-
- @note This service could be called by BSP only.
-**/
-BOOLEAN
-EFIAPI
-IsCpuFeatureCapability (
- IN UINT32 Feature
- );
-
-/**
- Determines if a CPU feature is set in PcdCpuFeaturesUserConfiguration bit mask.
-
- @param[in] Feature The bit number of the CPU feature to check in the PCD
- PcdCpuFeaturesUserConfiguration.
-
- @retval TRUE The CPU feature is set in PcdCpuFeaturesUserConfiguration.
- @retval FALSE The CPU feature is not set in PcdCpuFeaturesUserConfiguration.
-
- @note This service could be called by BSP only.
-**/
-BOOLEAN
-EFIAPI
-IsCpuFeatureUserConfiguration (
- IN UINT32 Feature
- );
-
/**
Prepares for the data used by CPU feature detection and initialization.
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
index ed8d526325..3540029079 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
@@ -1242,56 +1242,6 @@ IsCpuFeatureInSetting (
);
}
-/**
- Determines if a CPU feature is set in PcdCpuFeaturesCapability bit mask.
-
- @param[in] Feature The bit number of the CPU feature to check in the PCD
- PcdCpuFeaturesCapability
-
- @retval TRUE The CPU feature is set in PcdCpuFeaturesCapability.
- @retval FALSE The CPU feature is not set in PcdCpuFeaturesCapability.
-
- @note This service could be called by BSP only.
-**/
-BOOLEAN
-EFIAPI
-IsCpuFeatureCapability (
- IN UINT32 Feature
- )
-{
- return IsCpuFeatureSetInCpuPcd (
- (UINT8 *)PcdGetPtr (PcdCpuFeaturesCapability),
- PcdGetSize (PcdCpuFeaturesCapability),
- Feature
- );
-
-}
-
-/**
- Determines if a CPU feature is set in PcdCpuFeaturesUserConfiguration bit mask.
-
- @param[in] Feature The bit number of the CPU feature to check in the PCD
- PcdCpuFeaturesUserConfiguration
-
- @retval TRUE The CPU feature is set in PcdCpuFeaturesUserConfiguration.
- @retval FALSE The CPU feature is not set in PcdCpuFeaturesUserConfiguration.
-
- @note This service could be called by BSP only.
-**/
-BOOLEAN
-EFIAPI
-IsCpuFeatureUserConfiguration (
- IN UINT32 Feature
- )
-{
- return IsCpuFeatureSetInCpuPcd (
- (UINT8 *)PcdGetPtr (PcdCpuFeaturesUserConfiguration),
- PcdGetSize (PcdCpuFeaturesUserConfiguration),
- Feature
- );
-
-}
-
/**
Switches to assigned BSP after CPU features initialization.
--
2.15.0.windows.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Patch v2 2/4] UefiCpuPkg/RegisterCpuFeaturesLib: Optimize PCD PcdCpuFeaturesUserConfiguration.
2019-03-01 5:39 [Patch v2 0/4] Simplify CPU Features solution Eric Dong
2019-03-01 5:39 ` [Patch v2 1/4] UefiCpuPkg/RegisterCpuFeaturesLib: Remove useless functions Eric Dong
@ 2019-03-01 5:39 ` Eric Dong
2019-03-05 9:55 ` Zeng, Star
2019-04-02 7:15 ` Ni, Ray
2019-03-01 5:39 ` [Patch v2 3/4] UefiCpuPkg/RegisterCpuFeaturesLib: Simplify PcdCpuFeaturesSupport Eric Dong
` (2 subsequent siblings)
4 siblings, 2 replies; 14+ messages in thread
From: Eric Dong @ 2019-03-01 5:39 UTC (permalink / raw)
To: edk2-devel
Merge PcdCpuFeaturesUserConfiguration into PcdCpuFeaturesSetting.
Use PcdCpuFeaturesSetting as input for the user input feature setting
Use PcdCpuFeaturesSetting as output for the final CPU feature setting
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1375
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
.../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 71 +++++-----------------
.../DxeRegisterCpuFeaturesLib.inf | 3 +-
.../PeiRegisterCpuFeaturesLib.inf | 3 +-
.../RegisterCpuFeaturesLib/RegisterCpuFeatures.h | 1 -
UefiCpuPkg/UefiCpuPkg.dec | 9 +--
5 files changed, 21 insertions(+), 66 deletions(-)
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index bae92b89a6..d877caff74 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -21,16 +21,21 @@ CHAR16 *mRegisterTypeStr[] = {L"MSR", L"CR", L"MMIO", L"CACHE", L"SEMAP", L"INVA
Worker function to save PcdCpuFeaturesCapability.
@param[in] SupportedFeatureMask The pointer to CPU feature bits mask buffer
+ @param[in] FeatureMaskSize CPU feature bits mask buffer size.
+
**/
VOID
SetCapabilityPcd (
- IN UINT8 *SupportedFeatureMask
+ IN UINT8 *SupportedFeatureMask,
+ IN UINT32 FeatureMaskSize
)
{
EFI_STATUS Status;
UINTN BitMaskSize;
BitMaskSize = PcdGetSize (PcdCpuFeaturesCapability);
+ ASSERT (FeatureMaskSize == BitMaskSize);
+
Status = PcdSetPtrS (PcdCpuFeaturesCapability, &BitMaskSize, SupportedFeatureMask);
ASSERT_EFI_ERROR (Status);
}
@@ -53,48 +58,6 @@ SetSettingPcd (
ASSERT_EFI_ERROR (Status);
}
-/**
- Worker function to get PcdCpuFeaturesSupport.
-
- @return The pointer to CPU feature bits mask buffer.
-**/
-UINT8 *
-GetSupportPcd (
- VOID
- )
-{
- UINT8 *SupportBitMask;
-
- SupportBitMask = AllocateCopyPool (
- PcdGetSize (PcdCpuFeaturesSupport),
- PcdGetPtr (PcdCpuFeaturesSupport)
- );
- ASSERT (SupportBitMask != NULL);
-
- return SupportBitMask;
-}
-
-/**
- Worker function to get PcdCpuFeaturesUserConfiguration.
-
- @return The pointer to CPU feature bits mask buffer.
-**/
-UINT8 *
-GetConfigurationPcd (
- VOID
- )
-{
- UINT8 *SupportBitMask;
-
- SupportBitMask = AllocateCopyPool (
- PcdGetSize (PcdCpuFeaturesUserConfiguration),
- PcdGetPtr (PcdCpuFeaturesUserConfiguration)
- );
- ASSERT (SupportBitMask != NULL);
-
- return SupportBitMask;
-}
-
/**
Collects CPU type and feature information.
@@ -287,7 +250,6 @@ CpuInitDataInitialize (
// Get support and configuration PCDs
//
CpuFeaturesData->SupportPcd = GetSupportPcd ();
- CpuFeaturesData->ConfigurationPcd = GetConfigurationPcd ();
}
/**
@@ -610,16 +572,9 @@ AnalysisProcessorFeatures (
//
// Calculate the last setting
//
-
CpuFeaturesData->SettingPcd = AllocateCopyPool (CpuFeaturesData->BitMaskSize, CpuFeaturesData->CapabilityPcd);
ASSERT (CpuFeaturesData->SettingPcd != NULL);
- SupportedMaskAnd (CpuFeaturesData->SettingPcd, CpuFeaturesData->ConfigurationPcd);
-
- //
- // Save PCDs and display CPU PCDs
- //
- SetCapabilityPcd (CpuFeaturesData->CapabilityPcd);
- SetSettingPcd (CpuFeaturesData->SettingPcd);
+ SupportedMaskAnd (CpuFeaturesData->SettingPcd, PcdGetPtr (PcdCpuFeaturesSetting));
//
// Dump the last CPU feature list
@@ -643,14 +598,20 @@ AnalysisProcessorFeatures (
}
DEBUG ((DEBUG_INFO, "PcdCpuFeaturesSupport:\n"));
DumpCpuFeatureMask (CpuFeaturesData->SupportPcd);
- DEBUG ((DEBUG_INFO, "PcdCpuFeaturesUserConfiguration:\n"));
- DumpCpuFeatureMask (CpuFeaturesData->ConfigurationPcd);
DEBUG ((DEBUG_INFO, "PcdCpuFeaturesCapability:\n"));
DumpCpuFeatureMask (CpuFeaturesData->CapabilityPcd);
- DEBUG ((DEBUG_INFO, "PcdCpuFeaturesSetting:\n"));
+ DEBUG ((DEBUG_INFO, "Origin PcdCpuFeaturesSetting:\n"));
+ DumpCpuFeatureMask (PcdGetPtr (PcdCpuFeaturesSetting));
+ DEBUG ((DEBUG_INFO, "Final PcdCpuFeaturesSetting:\n"));
DumpCpuFeatureMask (CpuFeaturesData->SettingPcd);
);
+ //
+ // Save PCDs and display CPU PCDs
+ //
+ SetCapabilityPcd (CpuFeaturesData->CapabilityPcd, CpuFeaturesData->BitMaskSize);
+ SetSettingPcd (CpuFeaturesData->SettingPcd);
+
for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) {
CpuInitOrder = &CpuFeaturesData->InitOrder[ProcessorNumber];
Entry = GetFirstNode (&CpuFeaturesData->FeatureList);
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.inf b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.inf
index 362e0c6cd1..957ca87ff1 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.inf
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.inf
@@ -56,9 +56,8 @@
[Pcd]
gUefiCpuPkgTokenSpaceGuid.PcdCpuS3DataAddress ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSupport ## CONSUMES
- gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesUserConfiguration ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability ## PRODUCES
- gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ## PRODUCES
+ gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ## PRODUCES ## CONSUMES
[Depex]
gEfiMpServiceProtocolGuid AND gEdkiiCpuFeaturesSetDoneGuid
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf
index f3907e25d3..659aa9eaaf 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf
@@ -57,9 +57,8 @@
[Pcd]
gUefiCpuPkgTokenSpaceGuid.PcdCpuS3DataAddress ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSupport ## CONSUMES
- gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesUserConfiguration ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability ## PRODUCES
- gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ## PRODUCES
+ gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ## CONSUMES ## PRODUCES
[Depex]
gEfiPeiMpServicesPpiGuid AND gEdkiiCpuFeaturesSetDoneGuid
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
index 21dd5773a6..3e0a342fd1 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
@@ -83,7 +83,6 @@ typedef struct {
CPU_FEATURES_INIT_ORDER *InitOrder;
UINT8 *SupportPcd;
UINT8 *CapabilityPcd;
- UINT8 *ConfigurationPcd;
UINT8 *SettingPcd;
UINT32 NumberOfCpus;
diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec
index cb05fa2660..cd9b2d1b03 100644
--- a/UefiCpuPkg/UefiCpuPkg.dec
+++ b/UefiCpuPkg/UefiCpuPkg.dec
@@ -261,10 +261,6 @@
# @Prompt SMM CPU Synchronization Method.
gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x00|UINT8|0x60000014
- ## Specifies user's desired settings for enabling/disabling processor features.
- # @Prompt User settings for enabling/disabling processor features.
- gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesUserConfiguration|{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000017
-
## Specifies the On-demand clock modulation duty cycle when ACPI feature is enabled.
# @Prompt The encoded values for target duty cycle modulation.
# @ValidRange 0x80000001 | 0 - 15
@@ -292,8 +288,9 @@
# @ValidList 0x80000001 | 0
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability|{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000018
- ## Specifies actual settings for processor features, each bit corresponding to a specific feature.
- # @Prompt Actual processor feature settings.
+ ## As input, specifies user's desired settings for enabling/disabling processor features.
+ ## As output, specifies actual settings for processor features, each bit corresponding to a specific feature.
+ # @Prompt As input, specifies user's desired processor feature settings. As output, specifies actual processor feature settings.
# @ValidList 0x80000001 | 0
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting|{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000019
--
2.15.0.windows.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Patch v2 3/4] UefiCpuPkg/RegisterCpuFeaturesLib: Simplify PcdCpuFeaturesSupport.
2019-03-01 5:39 [Patch v2 0/4] Simplify CPU Features solution Eric Dong
2019-03-01 5:39 ` [Patch v2 1/4] UefiCpuPkg/RegisterCpuFeaturesLib: Remove useless functions Eric Dong
2019-03-01 5:39 ` [Patch v2 2/4] UefiCpuPkg/RegisterCpuFeaturesLib: Optimize PCD PcdCpuFeaturesUserConfiguration Eric Dong
@ 2019-03-01 5:39 ` Eric Dong
2019-04-02 7:22 ` Ni, Ray
2019-03-01 5:39 ` [Patch v2 4/4] UefiCpuPkg/RegisterCpuFeaturesLib: Correct comments Eric Dong
2019-03-01 15:30 ` [Patch v2 0/4] Simplify CPU Features solution Laszlo Ersek
4 siblings, 1 reply; 14+ messages in thread
From: Eric Dong @ 2019-03-01 5:39 UTC (permalink / raw)
To: edk2-devel
PcdCpuFeaturesSupport used to specify the platform policy about
what CPU features this platform supports. This PCD will be used
in IsCpuFeatureSupported only.
Now RegisterCpuFeaturesLib use this PCD as an template to Get the
pcd size. Update the code logic to replace it with
PcdCpuFeaturesSetting.
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1375
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
.../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 43 +++++++++-------------
.../RegisterCpuFeaturesLib/RegisterCpuFeatures.h | 1 -
.../RegisterCpuFeaturesLib.c | 10 ++---
3 files changed, 22 insertions(+), 32 deletions(-)
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index d877caff74..c82f848b97 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -245,11 +245,6 @@ CpuInitDataInitialize (
ASSERT (CpuFeaturesData->CpuFlags.CoreSemaphoreCount != NULL);
CpuFeaturesData->CpuFlags.PackageSemaphoreCount = AllocateZeroPool (sizeof (UINT32) * CpuStatus->PackageCount * CpuStatus->MaxCoreCount * CpuStatus->MaxThreadCount);
ASSERT (CpuFeaturesData->CpuFlags.PackageSemaphoreCount != NULL);
-
- //
- // Get support and configuration PCDs
- //
- CpuFeaturesData->SupportPcd = GetSupportPcd ();
}
/**
@@ -269,7 +264,7 @@ SupportedMaskOr (
UINT8 *Data1;
UINT8 *Data2;
- BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
+ BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting);
Data1 = SupportedFeatureMask;
Data2 = OrFeatureBitMask;
for (Index = 0; Index < BitMaskSize; Index++) {
@@ -294,7 +289,7 @@ SupportedMaskAnd (
UINT8 *Data1;
UINT8 *Data2;
- BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
+ BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting);
Data1 = SupportedFeatureMask;
Data2 = AndFeatureBitMask;
for (Index = 0; Index < BitMaskSize; Index++) {
@@ -319,7 +314,7 @@ SupportedMaskCleanBit (
UINT8 *Data1;
UINT8 *Data2;
- BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
+ BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting);
Data1 = SupportedFeatureMask;
Data2 = AndFeatureBitMask;
for (Index = 0; Index < BitMaskSize; Index++) {
@@ -350,7 +345,7 @@ IsBitMaskMatch (
UINT8 *Data1;
UINT8 *Data2;
- BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
+ BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting);
Data1 = SupportedFeatureMask;
Data2 = ComparedFeatureBitMask;
@@ -389,21 +384,19 @@ CollectProcessorData (
Entry = GetFirstNode (&CpuFeaturesData->FeatureList);
while (!IsNull (&CpuFeaturesData->FeatureList, Entry)) {
CpuFeature = CPU_FEATURE_ENTRY_FROM_LINK (Entry);
- if (IsBitMaskMatch (CpuFeaturesData->SupportPcd, CpuFeature->FeatureMask)) {
- if (CpuFeature->SupportFunc == NULL) {
- //
- // If SupportFunc is NULL, then the feature is supported.
- //
- SupportedMaskOr (
- CpuFeaturesData->InitOrder[ProcessorNumber].FeaturesSupportedMask,
- CpuFeature->FeatureMask
- );
- } else if (CpuFeature->SupportFunc (ProcessorNumber, CpuInfo, CpuFeature->ConfigData)) {
- SupportedMaskOr (
- CpuFeaturesData->InitOrder[ProcessorNumber].FeaturesSupportedMask,
- CpuFeature->FeatureMask
- );
- }
+ if (CpuFeature->SupportFunc == NULL) {
+ //
+ // If SupportFunc is NULL, then the feature is supported.
+ //
+ SupportedMaskOr (
+ CpuFeaturesData->InitOrder[ProcessorNumber].FeaturesSupportedMask,
+ CpuFeature->FeatureMask
+ );
+ } else if (CpuFeature->SupportFunc (ProcessorNumber, CpuInfo, CpuFeature->ConfigData)) {
+ SupportedMaskOr (
+ CpuFeaturesData->InitOrder[ProcessorNumber].FeaturesSupportedMask,
+ CpuFeature->FeatureMask
+ );
}
Entry = Entry->ForwardLink;
}
@@ -596,8 +589,6 @@ AnalysisProcessorFeatures (
DumpCpuFeature (CpuFeature);
Entry = Entry->ForwardLink;
}
- DEBUG ((DEBUG_INFO, "PcdCpuFeaturesSupport:\n"));
- DumpCpuFeatureMask (CpuFeaturesData->SupportPcd);
DEBUG ((DEBUG_INFO, "PcdCpuFeaturesCapability:\n"));
DumpCpuFeatureMask (CpuFeaturesData->CapabilityPcd);
DEBUG ((DEBUG_INFO, "Origin PcdCpuFeaturesSetting:\n"));
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
index 3e0a342fd1..836ed3549c 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
@@ -81,7 +81,6 @@ typedef struct {
LIST_ENTRY FeatureList;
CPU_FEATURES_INIT_ORDER *InitOrder;
- UINT8 *SupportPcd;
UINT8 *CapabilityPcd;
UINT8 *SettingPcd;
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
index 3540029079..3e8e899766 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
@@ -31,7 +31,7 @@ IsCpuFeatureMatch (
{
UINTN BitMaskSize;
- BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
+ BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting);
if (CompareMem (FirstFeatureMask, SecondFeatureMask, BitMaskSize) == 0) {
return TRUE;
} else {
@@ -53,7 +53,7 @@ DumpCpuFeatureMask (
UINT8 *Data8;
UINTN BitMaskSize;
- BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
+ BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting);
Data8 = (UINT8 *) FeatureMask;
for (Index = 0; Index < BitMaskSize; Index++) {
DEBUG ((DEBUG_INFO, " %02x ", *Data8++));
@@ -100,7 +100,7 @@ IsBitMaskMatchCheck (
UINT8 *Data1;
UINT8 *Data2;
- BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
+ BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting);
Data1 = FeatureMask;
Data2 = DependentBitMask;
@@ -656,7 +656,7 @@ RegisterCpuFeatureWorker (
UINTN BitMaskSize;
BOOLEAN FeatureExist;
- BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
+ BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting);
CpuFeaturesData = GetCpuFeaturesData ();
if (CpuFeaturesData->FeaturesCount == 0) {
InitializeListHead (&CpuFeaturesData->FeatureList);
@@ -870,7 +870,7 @@ RegisterCpuFeature (
BeforeAll = FALSE;
AfterAll = FALSE;
- BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
+ BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting);
VA_START (Marker, InitializeFunc);
Feature = VA_ARG (Marker, UINT32);
--
2.15.0.windows.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Patch v2 4/4] UefiCpuPkg/RegisterCpuFeaturesLib: Correct comments.
2019-03-01 5:39 [Patch v2 0/4] Simplify CPU Features solution Eric Dong
` (2 preceding siblings ...)
2019-03-01 5:39 ` [Patch v2 3/4] UefiCpuPkg/RegisterCpuFeaturesLib: Simplify PcdCpuFeaturesSupport Eric Dong
@ 2019-03-01 5:39 ` Eric Dong
2019-03-01 15:32 ` Laszlo Ersek
2019-04-02 7:22 ` Ni, Ray
2019-03-01 15:30 ` [Patch v2 0/4] Simplify CPU Features solution Laszlo Ersek
4 siblings, 2 replies; 14+ messages in thread
From: Eric Dong @ 2019-03-01 5:39 UTC (permalink / raw)
To: edk2-devel; +Cc: Ray Ni, Laszlo Ersek
Cc: Ray Ni <Ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
index 3e8e899766..a78ef44491 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
@@ -1174,8 +1174,8 @@ PreSmmCpuRegisterTableWrite (
@param[in] CpuBitMaskSize The size of CPU feature bit mask buffer
@param[in] Feature The bit number of the CPU feature
- @retval TRUE The CPU feature is set in PcdCpuFeaturesSupport.
- @retval FALSE The CPU feature is not set in PcdCpuFeaturesSupport.
+ @retval TRUE The CPU feature is set in CpuBitMask.
+ @retval FALSE The CPU feature is not set in CpuBitMask.
**/
BOOLEAN
--
2.15.0.windows.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [Patch v2 0/4] Simplify CPU Features solution.
2019-03-01 5:39 [Patch v2 0/4] Simplify CPU Features solution Eric Dong
` (3 preceding siblings ...)
2019-03-01 5:39 ` [Patch v2 4/4] UefiCpuPkg/RegisterCpuFeaturesLib: Correct comments Eric Dong
@ 2019-03-01 15:30 ` Laszlo Ersek
4 siblings, 0 replies; 14+ messages in thread
From: Laszlo Ersek @ 2019-03-01 15:30 UTC (permalink / raw)
To: Eric Dong, edk2-devel
Hi Eric,
On 03/01/19 06:39, Eric Dong wrote:
> V2 Changes include:
> 1. Add ASSERT to make sure PcdCpuFeaturesSetting and
> PcdCpuFeaturesCapability have equal size.
> 2. Correct comment block on IsCpuFeatureSetInCpuPcd() references
> "PcdCpuFeaturesSupport". It should reference "CpuBitMask".
>
> V1 Changes includes:
> 1. Optimize PCD PcdCpuFeaturesUserConfiguration
> 2. Limit useage of PcdCpuFeaturesSupport
> 3. Remove some useless APIs.
> Detail explanation please check each patch's introduction.
>
> Cc: Ray Ni <Ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Eric Dong (4):
> UefiCpuPkg/RegisterCpuFeaturesLib: Remove useless functions.
> UefiCpuPkg/RegisterCpuFeaturesLib: Optimize PCD
> PcdCpuFeaturesUserConfiguration.
> UefiCpuPkg/RegisterCpuFeaturesLib: Simplify PcdCpuFeaturesSupport.
> UefiCpuPkg/RegisterCpuFeaturesLib: Correct comments.
>
> .../Include/Library/RegisterCpuFeaturesLib.h | 34 ------
> .../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 114 ++++++---------------
> .../DxeRegisterCpuFeaturesLib.inf | 3 +-
> .../PeiRegisterCpuFeaturesLib.inf | 3 +-
> .../RegisterCpuFeaturesLib/RegisterCpuFeatures.h | 2 -
> .../RegisterCpuFeaturesLib.c | 64 ++----------
> UefiCpuPkg/UefiCpuPkg.dec | 9 +-
> 7 files changed, 45 insertions(+), 184 deletions(-)
>
sorry, I'm overloaded. Given that the platforms that I co-maintain don't
use RegisterCpuFeaturesLib, I'd like to skip the v2 review.
Please remember to push this series *after* the edk2-stable201903 tag is
made. Because this is not a bugfix.
Thanks
Laszlo
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Patch v2 4/4] UefiCpuPkg/RegisterCpuFeaturesLib: Correct comments.
2019-03-01 5:39 ` [Patch v2 4/4] UefiCpuPkg/RegisterCpuFeaturesLib: Correct comments Eric Dong
@ 2019-03-01 15:32 ` Laszlo Ersek
2019-04-02 7:22 ` Ni, Ray
1 sibling, 0 replies; 14+ messages in thread
From: Laszlo Ersek @ 2019-03-01 15:32 UTC (permalink / raw)
To: Eric Dong, edk2-devel
On 03/01/19 06:39, Eric Dong wrote:
> Cc: Ray Ni <Ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Dong <eric.dong@intel.com>
> ---
> UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
> index 3e8e899766..a78ef44491 100644
> --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
> +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
> @@ -1174,8 +1174,8 @@ PreSmmCpuRegisterTableWrite (
> @param[in] CpuBitMaskSize The size of CPU feature bit mask buffer
> @param[in] Feature The bit number of the CPU feature
>
> - @retval TRUE The CPU feature is set in PcdCpuFeaturesSupport.
> - @retval FALSE The CPU feature is not set in PcdCpuFeaturesSupport.
> + @retval TRUE The CPU feature is set in CpuBitMask.
> + @retval FALSE The CPU feature is not set in CpuBitMask.
>
> **/
> BOOLEAN
>
Okay, this patch is simple enough, and I vaguely remember that I
suggested it.
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Thanks!
Laszlo
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Patch v2 2/4] UefiCpuPkg/RegisterCpuFeaturesLib: Optimize PCD PcdCpuFeaturesUserConfiguration.
2019-03-01 5:39 ` [Patch v2 2/4] UefiCpuPkg/RegisterCpuFeaturesLib: Optimize PCD PcdCpuFeaturesUserConfiguration Eric Dong
@ 2019-03-05 9:55 ` Zeng, Star
2019-03-05 9:56 ` Zeng, Star
2019-04-02 7:15 ` Ni, Ray
1 sibling, 1 reply; 14+ messages in thread
From: Zeng, Star @ 2019-03-05 9:55 UTC (permalink / raw)
To: Dong, Eric, edk2-devel@lists.01.org
Cc: Ni, Ray, Laszlo Ersek (lersek@redhat.com), Gao, Liming,
Zeng, Star
It should be an incompatible change to remove PcdCpuFeaturesUserConfiguration.
Please add upgrade notes for it. I know upgrade notes for 2019 Q1 stable tag is at https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Release-Notes. I do not know where is the link for 2019 Q1 stable tag. Liming may know it.
Thanks,
Star
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Eric Dong
Sent: Friday, March 1, 2019 1:40 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch v2 2/4] UefiCpuPkg/RegisterCpuFeaturesLib: Optimize PCD PcdCpuFeaturesUserConfiguration.
Merge PcdCpuFeaturesUserConfiguration into PcdCpuFeaturesSetting.
Use PcdCpuFeaturesSetting as input for the user input feature setting Use PcdCpuFeaturesSetting as output for the final CPU feature setting
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1375
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
.../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 71 +++++-----------------
.../DxeRegisterCpuFeaturesLib.inf | 3 +-
.../PeiRegisterCpuFeaturesLib.inf | 3 +-
.../RegisterCpuFeaturesLib/RegisterCpuFeatures.h | 1 -
UefiCpuPkg/UefiCpuPkg.dec | 9 +--
5 files changed, 21 insertions(+), 66 deletions(-)
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index bae92b89a6..d877caff74 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -21,16 +21,21 @@ CHAR16 *mRegisterTypeStr[] = {L"MSR", L"CR", L"MMIO", L"CACHE", L"SEMAP", L"INVA
Worker function to save PcdCpuFeaturesCapability.
@param[in] SupportedFeatureMask The pointer to CPU feature bits mask buffer
+ @param[in] FeatureMaskSize CPU feature bits mask buffer size.
+
**/
VOID
SetCapabilityPcd (
- IN UINT8 *SupportedFeatureMask
+ IN UINT8 *SupportedFeatureMask,
+ IN UINT32 FeatureMaskSize
)
{
EFI_STATUS Status;
UINTN BitMaskSize;
BitMaskSize = PcdGetSize (PcdCpuFeaturesCapability);
+ ASSERT (FeatureMaskSize == BitMaskSize);
+
Status = PcdSetPtrS (PcdCpuFeaturesCapability, &BitMaskSize, SupportedFeatureMask);
ASSERT_EFI_ERROR (Status);
}
@@ -53,48 +58,6 @@ SetSettingPcd (
ASSERT_EFI_ERROR (Status);
}
-/**
- Worker function to get PcdCpuFeaturesSupport.
-
- @return The pointer to CPU feature bits mask buffer.
-**/
-UINT8 *
-GetSupportPcd (
- VOID
- )
-{
- UINT8 *SupportBitMask;
-
- SupportBitMask = AllocateCopyPool (
- PcdGetSize (PcdCpuFeaturesSupport),
- PcdGetPtr (PcdCpuFeaturesSupport)
- );
- ASSERT (SupportBitMask != NULL);
-
- return SupportBitMask;
-}
-
-/**
- Worker function to get PcdCpuFeaturesUserConfiguration.
-
- @return The pointer to CPU feature bits mask buffer.
-**/
-UINT8 *
-GetConfigurationPcd (
- VOID
- )
-{
- UINT8 *SupportBitMask;
-
- SupportBitMask = AllocateCopyPool (
- PcdGetSize (PcdCpuFeaturesUserConfiguration),
- PcdGetPtr (PcdCpuFeaturesUserConfiguration)
- );
- ASSERT (SupportBitMask != NULL);
-
- return SupportBitMask;
-}
-
/**
Collects CPU type and feature information.
@@ -287,7 +250,6 @@ CpuInitDataInitialize (
// Get support and configuration PCDs
//
CpuFeaturesData->SupportPcd = GetSupportPcd ();
- CpuFeaturesData->ConfigurationPcd = GetConfigurationPcd (); }
/**
@@ -610,16 +572,9 @@ AnalysisProcessorFeatures (
//
// Calculate the last setting
//
-
CpuFeaturesData->SettingPcd = AllocateCopyPool (CpuFeaturesData->BitMaskSize, CpuFeaturesData->CapabilityPcd);
ASSERT (CpuFeaturesData->SettingPcd != NULL);
- SupportedMaskAnd (CpuFeaturesData->SettingPcd, CpuFeaturesData->ConfigurationPcd);
-
- //
- // Save PCDs and display CPU PCDs
- //
- SetCapabilityPcd (CpuFeaturesData->CapabilityPcd);
- SetSettingPcd (CpuFeaturesData->SettingPcd);
+ SupportedMaskAnd (CpuFeaturesData->SettingPcd, PcdGetPtr
+ (PcdCpuFeaturesSetting));
//
// Dump the last CPU feature list
@@ -643,14 +598,20 @@ AnalysisProcessorFeatures (
}
DEBUG ((DEBUG_INFO, "PcdCpuFeaturesSupport:\n"));
DumpCpuFeatureMask (CpuFeaturesData->SupportPcd);
- DEBUG ((DEBUG_INFO, "PcdCpuFeaturesUserConfiguration:\n"));
- DumpCpuFeatureMask (CpuFeaturesData->ConfigurationPcd);
DEBUG ((DEBUG_INFO, "PcdCpuFeaturesCapability:\n"));
DumpCpuFeatureMask (CpuFeaturesData->CapabilityPcd);
- DEBUG ((DEBUG_INFO, "PcdCpuFeaturesSetting:\n"));
+ DEBUG ((DEBUG_INFO, "Origin PcdCpuFeaturesSetting:\n"));
+ DumpCpuFeatureMask (PcdGetPtr (PcdCpuFeaturesSetting));
+ DEBUG ((DEBUG_INFO, "Final PcdCpuFeaturesSetting:\n"));
DumpCpuFeatureMask (CpuFeaturesData->SettingPcd);
);
+ //
+ // Save PCDs and display CPU PCDs
+ //
+ SetCapabilityPcd (CpuFeaturesData->CapabilityPcd,
+ CpuFeaturesData->BitMaskSize); SetSettingPcd
+ (CpuFeaturesData->SettingPcd);
+
for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) {
CpuInitOrder = &CpuFeaturesData->InitOrder[ProcessorNumber];
Entry = GetFirstNode (&CpuFeaturesData->FeatureList); diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.inf b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.inf
index 362e0c6cd1..957ca87ff1 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.inf
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLi
+++ b.inf
@@ -56,9 +56,8 @@
[Pcd]
gUefiCpuPkgTokenSpaceGuid.PcdCpuS3DataAddress ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSupport ## CONSUMES
- gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesUserConfiguration ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability ## PRODUCES
- gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ## PRODUCES
+ gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ## PRODUCES ## CONSUMES
[Depex]
gEfiMpServiceProtocolGuid AND gEdkiiCpuFeaturesSetDoneGuid diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf
index f3907e25d3..659aa9eaaf 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLi
+++ b.inf
@@ -57,9 +57,8 @@
[Pcd]
gUefiCpuPkgTokenSpaceGuid.PcdCpuS3DataAddress ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSupport ## CONSUMES
- gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesUserConfiguration ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability ## PRODUCES
- gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ## PRODUCES
+ gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ## CONSUMES ## PRODUCES
[Depex]
gEfiPeiMpServicesPpiGuid AND gEdkiiCpuFeaturesSetDoneGuid diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
index 21dd5773a6..3e0a342fd1 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
@@ -83,7 +83,6 @@ typedef struct {
CPU_FEATURES_INIT_ORDER *InitOrder;
UINT8 *SupportPcd;
UINT8 *CapabilityPcd;
- UINT8 *ConfigurationPcd;
UINT8 *SettingPcd;
UINT32 NumberOfCpus;
diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index cb05fa2660..cd9b2d1b03 100644
--- a/UefiCpuPkg/UefiCpuPkg.dec
+++ b/UefiCpuPkg/UefiCpuPkg.dec
@@ -261,10 +261,6 @@
# @Prompt SMM CPU Synchronization Method.
gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x00|UINT8|0x60000014
- ## Specifies user's desired settings for enabling/disabling processor features.
- # @Prompt User settings for enabling/disabling processor features.
- gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesUserConfiguration|{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000017
-
## Specifies the On-demand clock modulation duty cycle when ACPI feature is enabled.
# @Prompt The encoded values for target duty cycle modulation.
# @ValidRange 0x80000001 | 0 - 15
@@ -292,8 +288,9 @@
# @ValidList 0x80000001 | 0
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability|{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000018
- ## Specifies actual settings for processor features, each bit corresponding to a specific feature.
- # @Prompt Actual processor feature settings.
+ ## As input, specifies user's desired settings for enabling/disabling processor features.
+ ## As output, specifies actual settings for processor features, each bit corresponding to a specific feature.
+ # @Prompt As input, specifies user's desired processor feature settings. As output, specifies actual processor feature settings.
# @ValidList 0x80000001 | 0
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting|{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000019
--
2.15.0.windows.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [Patch v2 2/4] UefiCpuPkg/RegisterCpuFeaturesLib: Optimize PCD PcdCpuFeaturesUserConfiguration.
2019-03-05 9:55 ` Zeng, Star
@ 2019-03-05 9:56 ` Zeng, Star
2019-03-07 2:48 ` Dong, Eric
0 siblings, 1 reply; 14+ messages in thread
From: Zeng, Star @ 2019-03-05 9:56 UTC (permalink / raw)
To: Dong, Eric, edk2-devel@lists.01.org
Cc: Ni, Ray, Laszlo Ersek (lersek@redhat.com), Gao, Liming,
Zeng, Star
And suggest update the title to be like "UefiCpuPkg: Retire PcdCpuFeaturesUserConfiguration".
Thanks,
Star
-----Original Message-----
From: Zeng, Star
Sent: Tuesday, March 5, 2019 5:55 PM
To: Dong, Eric <eric.dong@intel.com>; edk2-devel@lists.01.org
Cc: Ni, Ray <ray.ni@intel.com>; Laszlo Ersek (lersek@redhat.com) <lersek@redhat.com>; Gao, Liming <liming.gao@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: RE: [edk2] [Patch v2 2/4] UefiCpuPkg/RegisterCpuFeaturesLib: Optimize PCD PcdCpuFeaturesUserConfiguration.
It should be an incompatible change to remove PcdCpuFeaturesUserConfiguration.
Please add upgrade notes for it. I know upgrade notes for 2019 Q1 stable tag is at https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Release-Notes. I do not know where is the link for 2019 Q1 stable tag. Liming may know it.
Thanks,
Star
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Eric Dong
Sent: Friday, March 1, 2019 1:40 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch v2 2/4] UefiCpuPkg/RegisterCpuFeaturesLib: Optimize PCD PcdCpuFeaturesUserConfiguration.
Merge PcdCpuFeaturesUserConfiguration into PcdCpuFeaturesSetting.
Use PcdCpuFeaturesSetting as input for the user input feature setting Use PcdCpuFeaturesSetting as output for the final CPU feature setting
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1375
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
.../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 71 +++++-----------------
.../DxeRegisterCpuFeaturesLib.inf | 3 +-
.../PeiRegisterCpuFeaturesLib.inf | 3 +-
.../RegisterCpuFeaturesLib/RegisterCpuFeatures.h | 1 -
UefiCpuPkg/UefiCpuPkg.dec | 9 +--
5 files changed, 21 insertions(+), 66 deletions(-)
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index bae92b89a6..d877caff74 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -21,16 +21,21 @@ CHAR16 *mRegisterTypeStr[] = {L"MSR", L"CR", L"MMIO", L"CACHE", L"SEMAP", L"INVA
Worker function to save PcdCpuFeaturesCapability.
@param[in] SupportedFeatureMask The pointer to CPU feature bits mask buffer
+ @param[in] FeatureMaskSize CPU feature bits mask buffer size.
+
**/
VOID
SetCapabilityPcd (
- IN UINT8 *SupportedFeatureMask
+ IN UINT8 *SupportedFeatureMask,
+ IN UINT32 FeatureMaskSize
)
{
EFI_STATUS Status;
UINTN BitMaskSize;
BitMaskSize = PcdGetSize (PcdCpuFeaturesCapability);
+ ASSERT (FeatureMaskSize == BitMaskSize);
+
Status = PcdSetPtrS (PcdCpuFeaturesCapability, &BitMaskSize, SupportedFeatureMask);
ASSERT_EFI_ERROR (Status);
}
@@ -53,48 +58,6 @@ SetSettingPcd (
ASSERT_EFI_ERROR (Status);
}
-/**
- Worker function to get PcdCpuFeaturesSupport.
-
- @return The pointer to CPU feature bits mask buffer.
-**/
-UINT8 *
-GetSupportPcd (
- VOID
- )
-{
- UINT8 *SupportBitMask;
-
- SupportBitMask = AllocateCopyPool (
- PcdGetSize (PcdCpuFeaturesSupport),
- PcdGetPtr (PcdCpuFeaturesSupport)
- );
- ASSERT (SupportBitMask != NULL);
-
- return SupportBitMask;
-}
-
-/**
- Worker function to get PcdCpuFeaturesUserConfiguration.
-
- @return The pointer to CPU feature bits mask buffer.
-**/
-UINT8 *
-GetConfigurationPcd (
- VOID
- )
-{
- UINT8 *SupportBitMask;
-
- SupportBitMask = AllocateCopyPool (
- PcdGetSize (PcdCpuFeaturesUserConfiguration),
- PcdGetPtr (PcdCpuFeaturesUserConfiguration)
- );
- ASSERT (SupportBitMask != NULL);
-
- return SupportBitMask;
-}
-
/**
Collects CPU type and feature information.
@@ -287,7 +250,6 @@ CpuInitDataInitialize (
// Get support and configuration PCDs
//
CpuFeaturesData->SupportPcd = GetSupportPcd ();
- CpuFeaturesData->ConfigurationPcd = GetConfigurationPcd (); }
/**
@@ -610,16 +572,9 @@ AnalysisProcessorFeatures (
//
// Calculate the last setting
//
-
CpuFeaturesData->SettingPcd = AllocateCopyPool (CpuFeaturesData->BitMaskSize, CpuFeaturesData->CapabilityPcd);
ASSERT (CpuFeaturesData->SettingPcd != NULL);
- SupportedMaskAnd (CpuFeaturesData->SettingPcd, CpuFeaturesData->ConfigurationPcd);
-
- //
- // Save PCDs and display CPU PCDs
- //
- SetCapabilityPcd (CpuFeaturesData->CapabilityPcd);
- SetSettingPcd (CpuFeaturesData->SettingPcd);
+ SupportedMaskAnd (CpuFeaturesData->SettingPcd, PcdGetPtr
+ (PcdCpuFeaturesSetting));
//
// Dump the last CPU feature list
@@ -643,14 +598,20 @@ AnalysisProcessorFeatures (
}
DEBUG ((DEBUG_INFO, "PcdCpuFeaturesSupport:\n"));
DumpCpuFeatureMask (CpuFeaturesData->SupportPcd);
- DEBUG ((DEBUG_INFO, "PcdCpuFeaturesUserConfiguration:\n"));
- DumpCpuFeatureMask (CpuFeaturesData->ConfigurationPcd);
DEBUG ((DEBUG_INFO, "PcdCpuFeaturesCapability:\n"));
DumpCpuFeatureMask (CpuFeaturesData->CapabilityPcd);
- DEBUG ((DEBUG_INFO, "PcdCpuFeaturesSetting:\n"));
+ DEBUG ((DEBUG_INFO, "Origin PcdCpuFeaturesSetting:\n"));
+ DumpCpuFeatureMask (PcdGetPtr (PcdCpuFeaturesSetting));
+ DEBUG ((DEBUG_INFO, "Final PcdCpuFeaturesSetting:\n"));
DumpCpuFeatureMask (CpuFeaturesData->SettingPcd);
);
+ //
+ // Save PCDs and display CPU PCDs
+ //
+ SetCapabilityPcd (CpuFeaturesData->CapabilityPcd,
+ CpuFeaturesData->BitMaskSize); SetSettingPcd
+ (CpuFeaturesData->SettingPcd);
+
for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) {
CpuInitOrder = &CpuFeaturesData->InitOrder[ProcessorNumber];
Entry = GetFirstNode (&CpuFeaturesData->FeatureList); diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.inf b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.inf
index 362e0c6cd1..957ca87ff1 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.inf
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLi
+++ b.inf
@@ -56,9 +56,8 @@
[Pcd]
gUefiCpuPkgTokenSpaceGuid.PcdCpuS3DataAddress ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSupport ## CONSUMES
- gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesUserConfiguration ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability ## PRODUCES
- gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ## PRODUCES
+ gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ## PRODUCES ## CONSUMES
[Depex]
gEfiMpServiceProtocolGuid AND gEdkiiCpuFeaturesSetDoneGuid diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf
index f3907e25d3..659aa9eaaf 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLi
+++ b.inf
@@ -57,9 +57,8 @@
[Pcd]
gUefiCpuPkgTokenSpaceGuid.PcdCpuS3DataAddress ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSupport ## CONSUMES
- gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesUserConfiguration ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability ## PRODUCES
- gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ## PRODUCES
+ gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ## CONSUMES ## PRODUCES
[Depex]
gEfiPeiMpServicesPpiGuid AND gEdkiiCpuFeaturesSetDoneGuid diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
index 21dd5773a6..3e0a342fd1 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
@@ -83,7 +83,6 @@ typedef struct {
CPU_FEATURES_INIT_ORDER *InitOrder;
UINT8 *SupportPcd;
UINT8 *CapabilityPcd;
- UINT8 *ConfigurationPcd;
UINT8 *SettingPcd;
UINT32 NumberOfCpus;
diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index cb05fa2660..cd9b2d1b03 100644
--- a/UefiCpuPkg/UefiCpuPkg.dec
+++ b/UefiCpuPkg/UefiCpuPkg.dec
@@ -261,10 +261,6 @@
# @Prompt SMM CPU Synchronization Method.
gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x00|UINT8|0x60000014
- ## Specifies user's desired settings for enabling/disabling processor features.
- # @Prompt User settings for enabling/disabling processor features.
- gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesUserConfiguration|{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000017
-
## Specifies the On-demand clock modulation duty cycle when ACPI feature is enabled.
# @Prompt The encoded values for target duty cycle modulation.
# @ValidRange 0x80000001 | 0 - 15
@@ -292,8 +288,9 @@
# @ValidList 0x80000001 | 0
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability|{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000018
- ## Specifies actual settings for processor features, each bit corresponding to a specific feature.
- # @Prompt Actual processor feature settings.
+ ## As input, specifies user's desired settings for enabling/disabling processor features.
+ ## As output, specifies actual settings for processor features, each bit corresponding to a specific feature.
+ # @Prompt As input, specifies user's desired processor feature settings. As output, specifies actual processor feature settings.
# @ValidList 0x80000001 | 0
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting|{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000019
--
2.15.0.windows.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [Patch v2 2/4] UefiCpuPkg/RegisterCpuFeaturesLib: Optimize PCD PcdCpuFeaturesUserConfiguration.
2019-03-05 9:56 ` Zeng, Star
@ 2019-03-07 2:48 ` Dong, Eric
0 siblings, 0 replies; 14+ messages in thread
From: Dong, Eric @ 2019-03-07 2:48 UTC (permalink / raw)
To: Zeng, Star, edk2-devel@lists.01.org
Cc: Ni, Ray, Laszlo Ersek (lersek@redhat.com), Gao, Liming
Hi Star,
Thanks for your comments. It's more clear when mine. Will update it in my next version changes.
Also I will add this change info in the upgrade notes.
Thanks,
Eric
> -----Original Message-----
> From: Zeng, Star
> Sent: Tuesday, March 5, 2019 5:57 PM
> To: Dong, Eric <eric.dong@intel.com>; edk2-devel@lists.01.org
> Cc: Ni, Ray <ray.ni@intel.com>; Laszlo Ersek (lersek@redhat.com)
> <lersek@redhat.com>; Gao, Liming <liming.gao@intel.com>; Zeng, Star
> <star.zeng@intel.com>
> Subject: RE: [edk2] [Patch v2 2/4] UefiCpuPkg/RegisterCpuFeaturesLib:
> Optimize PCD PcdCpuFeaturesUserConfiguration.
>
> And suggest update the title to be like "UefiCpuPkg: Retire
> PcdCpuFeaturesUserConfiguration".
>
> Thanks,
> Star
> -----Original Message-----
> From: Zeng, Star
> Sent: Tuesday, March 5, 2019 5:55 PM
> To: Dong, Eric <eric.dong@intel.com>; edk2-devel@lists.01.org
> Cc: Ni, Ray <ray.ni@intel.com>; Laszlo Ersek (lersek@redhat.com)
> <lersek@redhat.com>; Gao, Liming <liming.gao@intel.com>; Zeng, Star
> <star.zeng@intel.com>
> Subject: RE: [edk2] [Patch v2 2/4] UefiCpuPkg/RegisterCpuFeaturesLib:
> Optimize PCD PcdCpuFeaturesUserConfiguration.
>
> It should be an incompatible change to remove
> PcdCpuFeaturesUserConfiguration.
> Please add upgrade notes for it. I know upgrade notes for 2019 Q1 stable tag
> is at https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Release-
> Notes. I do not know where is the link for 2019 Q1 stable tag. Liming may
> know it.
>
>
> Thanks,
> Star
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Eric Dong
> Sent: Friday, March 1, 2019 1:40 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [Patch v2 2/4] UefiCpuPkg/RegisterCpuFeaturesLib: Optimize
> PCD PcdCpuFeaturesUserConfiguration.
>
> Merge PcdCpuFeaturesUserConfiguration into PcdCpuFeaturesSetting.
> Use PcdCpuFeaturesSetting as input for the user input feature setting Use
> PcdCpuFeaturesSetting as output for the final CPU feature setting
>
> BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1375
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Dong <eric.dong@intel.com>
> ---
> .../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 71 +++++-----------------
> .../DxeRegisterCpuFeaturesLib.inf | 3 +-
> .../PeiRegisterCpuFeaturesLib.inf | 3 +-
> .../RegisterCpuFeaturesLib/RegisterCpuFeatures.h | 1 -
> UefiCpuPkg/UefiCpuPkg.dec | 9 +--
> 5 files changed, 21 insertions(+), 66 deletions(-)
>
> diff --git
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> index bae92b89a6..d877caff74 100644
> --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> @@ -21,16 +21,21 @@ CHAR16 *mRegisterTypeStr[] = {L"MSR", L"CR",
> L"MMIO", L"CACHE", L"SEMAP", L"INVA
> Worker function to save PcdCpuFeaturesCapability.
>
> @param[in] SupportedFeatureMask The pointer to CPU feature bits mask
> buffer
> + @param[in] FeatureMaskSize CPU feature bits mask buffer size.
> +
> **/
> VOID
> SetCapabilityPcd (
> - IN UINT8 *SupportedFeatureMask
> + IN UINT8 *SupportedFeatureMask,
> + IN UINT32 FeatureMaskSize
> )
> {
> EFI_STATUS Status;
> UINTN BitMaskSize;
>
> BitMaskSize = PcdGetSize (PcdCpuFeaturesCapability);
> + ASSERT (FeatureMaskSize == BitMaskSize);
> +
> Status = PcdSetPtrS (PcdCpuFeaturesCapability, &BitMaskSize,
> SupportedFeatureMask);
> ASSERT_EFI_ERROR (Status);
> }
> @@ -53,48 +58,6 @@ SetSettingPcd (
> ASSERT_EFI_ERROR (Status);
> }
>
> -/**
> - Worker function to get PcdCpuFeaturesSupport.
> -
> - @return The pointer to CPU feature bits mask buffer.
> -**/
> -UINT8 *
> -GetSupportPcd (
> - VOID
> - )
> -{
> - UINT8 *SupportBitMask;
> -
> - SupportBitMask = AllocateCopyPool (
> - PcdGetSize (PcdCpuFeaturesSupport),
> - PcdGetPtr (PcdCpuFeaturesSupport)
> - );
> - ASSERT (SupportBitMask != NULL);
> -
> - return SupportBitMask;
> -}
> -
> -/**
> - Worker function to get PcdCpuFeaturesUserConfiguration.
> -
> - @return The pointer to CPU feature bits mask buffer.
> -**/
> -UINT8 *
> -GetConfigurationPcd (
> - VOID
> - )
> -{
> - UINT8 *SupportBitMask;
> -
> - SupportBitMask = AllocateCopyPool (
> - PcdGetSize (PcdCpuFeaturesUserConfiguration),
> - PcdGetPtr (PcdCpuFeaturesUserConfiguration)
> - );
> - ASSERT (SupportBitMask != NULL);
> -
> - return SupportBitMask;
> -}
> -
> /**
> Collects CPU type and feature information.
>
> @@ -287,7 +250,6 @@ CpuInitDataInitialize (
> // Get support and configuration PCDs
> //
> CpuFeaturesData->SupportPcd = GetSupportPcd ();
> - CpuFeaturesData->ConfigurationPcd = GetConfigurationPcd (); }
>
> /**
> @@ -610,16 +572,9 @@ AnalysisProcessorFeatures (
> //
> // Calculate the last setting
> //
> -
> CpuFeaturesData->SettingPcd = AllocateCopyPool (CpuFeaturesData-
> >BitMaskSize, CpuFeaturesData->CapabilityPcd);
> ASSERT (CpuFeaturesData->SettingPcd != NULL);
> - SupportedMaskAnd (CpuFeaturesData->SettingPcd, CpuFeaturesData-
> >ConfigurationPcd);
> -
> - //
> - // Save PCDs and display CPU PCDs
> - //
> - SetCapabilityPcd (CpuFeaturesData->CapabilityPcd);
> - SetSettingPcd (CpuFeaturesData->SettingPcd);
> + SupportedMaskAnd (CpuFeaturesData->SettingPcd, PcdGetPtr
> + (PcdCpuFeaturesSetting));
>
> //
> // Dump the last CPU feature list
> @@ -643,14 +598,20 @@ AnalysisProcessorFeatures (
> }
> DEBUG ((DEBUG_INFO, "PcdCpuFeaturesSupport:\n"));
> DumpCpuFeatureMask (CpuFeaturesData->SupportPcd);
> - DEBUG ((DEBUG_INFO, "PcdCpuFeaturesUserConfiguration:\n"));
> - DumpCpuFeatureMask (CpuFeaturesData->ConfigurationPcd);
> DEBUG ((DEBUG_INFO, "PcdCpuFeaturesCapability:\n"));
> DumpCpuFeatureMask (CpuFeaturesData->CapabilityPcd);
> - DEBUG ((DEBUG_INFO, "PcdCpuFeaturesSetting:\n"));
> + DEBUG ((DEBUG_INFO, "Origin PcdCpuFeaturesSetting:\n"));
> + DumpCpuFeatureMask (PcdGetPtr (PcdCpuFeaturesSetting));
> + DEBUG ((DEBUG_INFO, "Final PcdCpuFeaturesSetting:\n"));
> DumpCpuFeatureMask (CpuFeaturesData->SettingPcd);
> );
>
> + //
> + // Save PCDs and display CPU PCDs
> + //
> + SetCapabilityPcd (CpuFeaturesData->CapabilityPcd,
> + CpuFeaturesData->BitMaskSize); SetSettingPcd
> + (CpuFeaturesData->SettingPcd);
> +
> for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus;
> ProcessorNumber++) {
> CpuInitOrder = &CpuFeaturesData->InitOrder[ProcessorNumber];
> Entry = GetFirstNode (&CpuFeaturesData->FeatureList); diff --git
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.i
> nf
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.i
> nf
> index 362e0c6cd1..957ca87ff1 100644
> ---
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.i
> nf
> +++
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLi
> +++ b.inf
> @@ -56,9 +56,8 @@
> [Pcd]
> gUefiCpuPkgTokenSpaceGuid.PcdCpuS3DataAddress ##
> CONSUMES
> gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSupport ##
> CONSUMES
> - gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesUserConfiguration ##
> CONSUMES
> gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability ##
> PRODUCES
> - gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ##
> PRODUCES
> + gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ##
> PRODUCES ## CONSUMES
>
> [Depex]
> gEfiMpServiceProtocolGuid AND gEdkiiCpuFeaturesSetDoneGuid diff --git
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.in
> f
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.in
> f
> index f3907e25d3..659aa9eaaf 100644
> ---
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.in
> f
> +++
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLi
> +++ b.inf
> @@ -57,9 +57,8 @@
> [Pcd]
> gUefiCpuPkgTokenSpaceGuid.PcdCpuS3DataAddress ##
> CONSUMES
> gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSupport ##
> CONSUMES
> - gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesUserConfiguration ##
> CONSUMES
> gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability ##
> PRODUCES
> - gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ##
> PRODUCES
> + gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ##
> CONSUMES ## PRODUCES
>
> [Depex]
> gEfiPeiMpServicesPpiGuid AND gEdkiiCpuFeaturesSetDoneGuid diff --git
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
> index 21dd5773a6..3e0a342fd1 100644
> --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
> +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
> @@ -83,7 +83,6 @@ typedef struct {
> CPU_FEATURES_INIT_ORDER *InitOrder;
> UINT8 *SupportPcd;
> UINT8 *CapabilityPcd;
> - UINT8 *ConfigurationPcd;
> UINT8 *SettingPcd;
>
> UINT32 NumberOfCpus;
> diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec
> index cb05fa2660..cd9b2d1b03 100644
> --- a/UefiCpuPkg/UefiCpuPkg.dec
> +++ b/UefiCpuPkg/UefiCpuPkg.dec
> @@ -261,10 +261,6 @@
> # @Prompt SMM CPU Synchronization Method.
>
> gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x00|UINT8|0x60000
> 014
>
> - ## Specifies user's desired settings for enabling/disabling processor
> features.
> - # @Prompt User settings for enabling/disabling processor features.
> - gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesUserConfiguration|{0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000017
> -
> ## Specifies the On-demand clock modulation duty cycle when ACPI
> feature is enabled.
> # @Prompt The encoded values for target duty cycle modulation.
> # @ValidRange 0x80000001 | 0 - 15
> @@ -292,8 +288,9 @@
> # @ValidList 0x80000001 | 0
> gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability|{0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000018
>
> - ## Specifies actual settings for processor features, each bit corresponding
> to a specific feature.
> - # @Prompt Actual processor feature settings.
> + ## As input, specifies user's desired settings for enabling/disabling
> processor features.
> + ## As output, specifies actual settings for processor features, each bit
> corresponding to a specific feature.
> + # @Prompt As input, specifies user's desired processor feature settings. As
> output, specifies actual processor feature settings.
> # @ValidList 0x80000001 | 0
> gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting|{0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000019
>
> --
> 2.15.0.windows.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Patch v2 1/4] UefiCpuPkg/RegisterCpuFeaturesLib: Remove useless functions.
2019-03-01 5:39 ` [Patch v2 1/4] UefiCpuPkg/RegisterCpuFeaturesLib: Remove useless functions Eric Dong
@ 2019-04-02 7:07 ` Ni, Ray
0 siblings, 0 replies; 14+ messages in thread
From: Ni, Ray @ 2019-04-02 7:07 UTC (permalink / raw)
To: Dong, Eric, edk2-devel@lists.01.org
Reviewed-by: Ray Ni <ray.ni@intel.com>
Please remember to update the year in copyright when pushing.
> -----Original Message-----
> From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of Eric Dong
> Sent: Friday, March 1, 2019 1:40 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [Patch v2 1/4] UefiCpuPkg/RegisterCpuFeaturesLib: Remove
> useless functions.
>
> Remove useless APIs, simplify the code logic.
>
> BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1375
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Dong <eric.dong@intel.com>
> ---
> .../Include/Library/RegisterCpuFeaturesLib.h | 34 ---------------
> .../RegisterCpuFeaturesLib.c | 50 ----------------------
> 2 files changed, 84 deletions(-)
>
> diff --git a/UefiCpuPkg/Include/Library/RegisterCpuFeaturesLib.h
> b/UefiCpuPkg/Include/Library/RegisterCpuFeaturesLib.h
> index 2f7e71c833..073f020d0b 100644
> --- a/UefiCpuPkg/Include/Library/RegisterCpuFeaturesLib.h
> +++ b/UefiCpuPkg/Include/Library/RegisterCpuFeaturesLib.h
> @@ -166,40 +166,6 @@ IsCpuFeatureInSetting (
> IN UINT32 Feature
> );
>
> -/**
> - Determines if a CPU feature is set in PcdCpuFeaturesCapability bit mask.
> -
> - @param[in] Feature The bit number of the CPU feature to check in the PCD
> - PcdCpuFeaturesCapability.
> -
> - @retval TRUE The CPU feature is set in PcdCpuFeaturesCapability.
> - @retval FALSE The CPU feature is not set in PcdCpuFeaturesCapability.
> -
> - @note This service could be called by BSP only.
> -**/
> -BOOLEAN
> -EFIAPI
> -IsCpuFeatureCapability (
> - IN UINT32 Feature
> - );
> -
> -/**
> - Determines if a CPU feature is set in PcdCpuFeaturesUserConfiguration bit
> mask.
> -
> - @param[in] Feature The bit number of the CPU feature to check in the PCD
> - PcdCpuFeaturesUserConfiguration.
> -
> - @retval TRUE The CPU feature is set in PcdCpuFeaturesUserConfiguration.
> - @retval FALSE The CPU feature is not set in
> PcdCpuFeaturesUserConfiguration.
> -
> - @note This service could be called by BSP only.
> -**/
> -BOOLEAN
> -EFIAPI
> -IsCpuFeatureUserConfiguration (
> - IN UINT32 Feature
> - );
> -
> /**
> Prepares for the data used by CPU feature detection and initialization.
>
> diff --git
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
> index ed8d526325..3540029079 100644
> --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
> +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
> @@ -1242,56 +1242,6 @@ IsCpuFeatureInSetting (
> );
> }
>
> -/**
> - Determines if a CPU feature is set in PcdCpuFeaturesCapability bit mask.
> -
> - @param[in] Feature The bit number of the CPU feature to check in the PCD
> - PcdCpuFeaturesCapability
> -
> - @retval TRUE The CPU feature is set in PcdCpuFeaturesCapability.
> - @retval FALSE The CPU feature is not set in PcdCpuFeaturesCapability.
> -
> - @note This service could be called by BSP only.
> -**/
> -BOOLEAN
> -EFIAPI
> -IsCpuFeatureCapability (
> - IN UINT32 Feature
> - )
> -{
> - return IsCpuFeatureSetInCpuPcd (
> - (UINT8 *)PcdGetPtr (PcdCpuFeaturesCapability),
> - PcdGetSize (PcdCpuFeaturesCapability),
> - Feature
> - );
> -
> -}
> -
> -/**
> - Determines if a CPU feature is set in PcdCpuFeaturesUserConfiguration bit
> mask.
> -
> - @param[in] Feature The bit number of the CPU feature to check in the PCD
> - PcdCpuFeaturesUserConfiguration
> -
> - @retval TRUE The CPU feature is set in PcdCpuFeaturesUserConfiguration.
> - @retval FALSE The CPU feature is not set in
> PcdCpuFeaturesUserConfiguration.
> -
> - @note This service could be called by BSP only.
> -**/
> -BOOLEAN
> -EFIAPI
> -IsCpuFeatureUserConfiguration (
> - IN UINT32 Feature
> - )
> -{
> - return IsCpuFeatureSetInCpuPcd (
> - (UINT8 *)PcdGetPtr (PcdCpuFeaturesUserConfiguration),
> - PcdGetSize (PcdCpuFeaturesUserConfiguration),
> - Feature
> - );
> -
> -}
> -
> /**
> Switches to assigned BSP after CPU features initialization.
>
> --
> 2.15.0.windows.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Patch v2 2/4] UefiCpuPkg/RegisterCpuFeaturesLib: Optimize PCD PcdCpuFeaturesUserConfiguration.
2019-03-01 5:39 ` [Patch v2 2/4] UefiCpuPkg/RegisterCpuFeaturesLib: Optimize PCD PcdCpuFeaturesUserConfiguration Eric Dong
2019-03-05 9:55 ` Zeng, Star
@ 2019-04-02 7:15 ` Ni, Ray
1 sibling, 0 replies; 14+ messages in thread
From: Ni, Ray @ 2019-04-02 7:15 UTC (permalink / raw)
To: Dong, Eric, edk2-devel@lists.01.org
Minor comments:
1. Please add "CONST" before AndFeatureBitMask to declare that it won't be changed in the routine.
SupportedMaskAnd (
IN UINT8 *SupportedFeatureMask,
IN CONST UINT8 *AndFeatureBitMask
)
2. Please update the year in the copyright.
With these comments addressed, Reviewed-by: Ray Ni <ray.ni@intel.com>
> -----Original Message-----
> From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of Eric Dong
> Sent: Friday, March 1, 2019 1:40 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [Patch v2 2/4] UefiCpuPkg/RegisterCpuFeaturesLib: Optimize
> PCD PcdCpuFeaturesUserConfiguration.
>
> Merge PcdCpuFeaturesUserConfiguration into PcdCpuFeaturesSetting.
> Use PcdCpuFeaturesSetting as input for the user input feature setting Use
> PcdCpuFeaturesSetting as output for the final CPU feature setting
>
> BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1375
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Dong <eric.dong@intel.com>
> ---
> .../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 71 +++++-----------------
> .../DxeRegisterCpuFeaturesLib.inf | 3 +-
> .../PeiRegisterCpuFeaturesLib.inf | 3 +-
> .../RegisterCpuFeaturesLib/RegisterCpuFeatures.h | 1 -
> UefiCpuPkg/UefiCpuPkg.dec | 9 +--
> 5 files changed, 21 insertions(+), 66 deletions(-)
>
> diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> index bae92b89a6..d877caff74 100644
> --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> @@ -21,16 +21,21 @@ CHAR16 *mRegisterTypeStr[] = {L"MSR", L"CR",
> L"MMIO", L"CACHE", L"SEMAP", L"INVA
> Worker function to save PcdCpuFeaturesCapability.
>
> @param[in] SupportedFeatureMask The pointer to CPU feature bits mask
> buffer
> + @param[in] FeatureMaskSize CPU feature bits mask buffer size.
> +
> **/
> VOID
> SetCapabilityPcd (
> - IN UINT8 *SupportedFeatureMask
> + IN UINT8 *SupportedFeatureMask,
> + IN UINT32 FeatureMaskSize
> )
> {
> EFI_STATUS Status;
> UINTN BitMaskSize;
>
> BitMaskSize = PcdGetSize (PcdCpuFeaturesCapability);
> + ASSERT (FeatureMaskSize == BitMaskSize);
> +
> Status = PcdSetPtrS (PcdCpuFeaturesCapability, &BitMaskSize,
> SupportedFeatureMask);
> ASSERT_EFI_ERROR (Status);
> }
> @@ -53,48 +58,6 @@ SetSettingPcd (
> ASSERT_EFI_ERROR (Status);
> }
>
> -/**
> - Worker function to get PcdCpuFeaturesSupport.
> -
> - @return The pointer to CPU feature bits mask buffer.
> -**/
> -UINT8 *
> -GetSupportPcd (
> - VOID
> - )
> -{
> - UINT8 *SupportBitMask;
> -
> - SupportBitMask = AllocateCopyPool (
> - PcdGetSize (PcdCpuFeaturesSupport),
> - PcdGetPtr (PcdCpuFeaturesSupport)
> - );
> - ASSERT (SupportBitMask != NULL);
> -
> - return SupportBitMask;
> -}
> -
> -/**
> - Worker function to get PcdCpuFeaturesUserConfiguration.
> -
> - @return The pointer to CPU feature bits mask buffer.
> -**/
> -UINT8 *
> -GetConfigurationPcd (
> - VOID
> - )
> -{
> - UINT8 *SupportBitMask;
> -
> - SupportBitMask = AllocateCopyPool (
> - PcdGetSize (PcdCpuFeaturesUserConfiguration),
> - PcdGetPtr (PcdCpuFeaturesUserConfiguration)
> - );
> - ASSERT (SupportBitMask != NULL);
> -
> - return SupportBitMask;
> -}
> -
> /**
> Collects CPU type and feature information.
>
> @@ -287,7 +250,6 @@ CpuInitDataInitialize (
> // Get support and configuration PCDs
> //
> CpuFeaturesData->SupportPcd = GetSupportPcd ();
> - CpuFeaturesData->ConfigurationPcd = GetConfigurationPcd (); }
>
> /**
> @@ -610,16 +572,9 @@ AnalysisProcessorFeatures (
> //
> // Calculate the last setting
> //
> -
> CpuFeaturesData->SettingPcd = AllocateCopyPool (CpuFeaturesData-
> >BitMaskSize, CpuFeaturesData->CapabilityPcd);
> ASSERT (CpuFeaturesData->SettingPcd != NULL);
> - SupportedMaskAnd (CpuFeaturesData->SettingPcd, CpuFeaturesData-
> >ConfigurationPcd);
> -
> - //
> - // Save PCDs and display CPU PCDs
> - //
> - SetCapabilityPcd (CpuFeaturesData->CapabilityPcd);
> - SetSettingPcd (CpuFeaturesData->SettingPcd);
> + SupportedMaskAnd (CpuFeaturesData->SettingPcd, PcdGetPtr
> + (PcdCpuFeaturesSetting));
>
> //
> // Dump the last CPU feature list
> @@ -643,14 +598,20 @@ AnalysisProcessorFeatures (
> }
> DEBUG ((DEBUG_INFO, "PcdCpuFeaturesSupport:\n"));
> DumpCpuFeatureMask (CpuFeaturesData->SupportPcd);
> - DEBUG ((DEBUG_INFO, "PcdCpuFeaturesUserConfiguration:\n"));
> - DumpCpuFeatureMask (CpuFeaturesData->ConfigurationPcd);
> DEBUG ((DEBUG_INFO, "PcdCpuFeaturesCapability:\n"));
> DumpCpuFeatureMask (CpuFeaturesData->CapabilityPcd);
> - DEBUG ((DEBUG_INFO, "PcdCpuFeaturesSetting:\n"));
> + DEBUG ((DEBUG_INFO, "Origin PcdCpuFeaturesSetting:\n"));
> + DumpCpuFeatureMask (PcdGetPtr (PcdCpuFeaturesSetting));
> + DEBUG ((DEBUG_INFO, "Final PcdCpuFeaturesSetting:\n"));
> DumpCpuFeatureMask (CpuFeaturesData->SettingPcd);
> );
>
> + //
> + // Save PCDs and display CPU PCDs
> + //
> + SetCapabilityPcd (CpuFeaturesData->CapabilityPcd,
> + CpuFeaturesData->BitMaskSize); SetSettingPcd
> + (CpuFeaturesData->SettingPcd);
> +
> for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus;
> ProcessorNumber++) {
> CpuInitOrder = &CpuFeaturesData->InitOrder[ProcessorNumber];
> Entry = GetFirstNode (&CpuFeaturesData->FeatureList); diff --git
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.inf
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.inf
> index 362e0c6cd1..957ca87ff1 100644
> ---
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.inf
> +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLi
> +++ b.inf
> @@ -56,9 +56,8 @@
> [Pcd]
> gUefiCpuPkgTokenSpaceGuid.PcdCpuS3DataAddress ##
> CONSUMES
> gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSupport ##
> CONSUMES
> - gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesUserConfiguration ##
> CONSUMES
> gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability ##
> PRODUCES
> - gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ##
> PRODUCES
> + gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ##
> PRODUCES ## CONSUMES
>
> [Depex]
> gEfiMpServiceProtocolGuid AND gEdkiiCpuFeaturesSetDoneGuid diff --git
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf
> index f3907e25d3..659aa9eaaf 100644
> --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf
> +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLi
> +++ b.inf
> @@ -57,9 +57,8 @@
> [Pcd]
> gUefiCpuPkgTokenSpaceGuid.PcdCpuS3DataAddress ##
> CONSUMES
> gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSupport ##
> CONSUMES
> - gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesUserConfiguration ##
> CONSUMES
> gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability ##
> PRODUCES
> - gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ##
> PRODUCES
> + gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ##
> CONSUMES ## PRODUCES
>
> [Depex]
> gEfiPeiMpServicesPpiGuid AND gEdkiiCpuFeaturesSetDoneGuid diff --git
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
> index 21dd5773a6..3e0a342fd1 100644
> --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
> +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
> @@ -83,7 +83,6 @@ typedef struct {
> CPU_FEATURES_INIT_ORDER *InitOrder;
> UINT8 *SupportPcd;
> UINT8 *CapabilityPcd;
> - UINT8 *ConfigurationPcd;
> UINT8 *SettingPcd;
>
> UINT32 NumberOfCpus;
> diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index
> cb05fa2660..cd9b2d1b03 100644
> --- a/UefiCpuPkg/UefiCpuPkg.dec
> +++ b/UefiCpuPkg/UefiCpuPkg.dec
> @@ -261,10 +261,6 @@
> # @Prompt SMM CPU Synchronization Method.
>
> gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x00|UINT8|0x60000014
>
> - ## Specifies user's desired settings for enabling/disabling processor features.
> - # @Prompt User settings for enabling/disabling processor features.
> - gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesUserConfiguration|{0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000017
> -
> ## Specifies the On-demand clock modulation duty cycle when ACPI feature is
> enabled.
> # @Prompt The encoded values for target duty cycle modulation.
> # @ValidRange 0x80000001 | 0 - 15
> @@ -292,8 +288,9 @@
> # @ValidList 0x80000001 | 0
> gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability|{0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000018
>
> - ## Specifies actual settings for processor features, each bit corresponding to a
> specific feature.
> - # @Prompt Actual processor feature settings.
> + ## As input, specifies user's desired settings for enabling/disabling processor
> features.
> + ## As output, specifies actual settings for processor features, each bit
> corresponding to a specific feature.
> + # @Prompt As input, specifies user's desired processor feature settings. As
> output, specifies actual processor feature settings.
> # @ValidList 0x80000001 | 0
> gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting|{0x00, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000019
>
> --
> 2.15.0.windows.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Patch v2 3/4] UefiCpuPkg/RegisterCpuFeaturesLib: Simplify PcdCpuFeaturesSupport.
2019-03-01 5:39 ` [Patch v2 3/4] UefiCpuPkg/RegisterCpuFeaturesLib: Simplify PcdCpuFeaturesSupport Eric Dong
@ 2019-04-02 7:22 ` Ni, Ray
0 siblings, 0 replies; 14+ messages in thread
From: Ni, Ray @ 2019-04-02 7:22 UTC (permalink / raw)
To: Dong, Eric, edk2-devel@lists.01.org
Reviewed-by: Ray Ni <ray.ni@intel.com>
> -----Original Message-----
> From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of Eric Dong
> Sent: Friday, March 1, 2019 1:40 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [Patch v2 3/4] UefiCpuPkg/RegisterCpuFeaturesLib: Simplify
> PcdCpuFeaturesSupport.
>
> PcdCpuFeaturesSupport used to specify the platform policy about what CPU
> features this platform supports. This PCD will be used in IsCpuFeatureSupported
> only.
>
> Now RegisterCpuFeaturesLib use this PCD as an template to Get the pcd size.
> Update the code logic to replace it with PcdCpuFeaturesSetting.
>
> BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1375
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Dong <eric.dong@intel.com>
> ---
> .../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 43 +++++++++-------------
> .../RegisterCpuFeaturesLib/RegisterCpuFeatures.h | 1 -
> .../RegisterCpuFeaturesLib.c | 10 ++---
> 3 files changed, 22 insertions(+), 32 deletions(-)
>
> diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> index d877caff74..c82f848b97 100644
> --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> @@ -245,11 +245,6 @@ CpuInitDataInitialize (
> ASSERT (CpuFeaturesData->CpuFlags.CoreSemaphoreCount != NULL);
> CpuFeaturesData->CpuFlags.PackageSemaphoreCount = AllocateZeroPool
> (sizeof (UINT32) * CpuStatus->PackageCount * CpuStatus->MaxCoreCount *
> CpuStatus->MaxThreadCount);
> ASSERT (CpuFeaturesData->CpuFlags.PackageSemaphoreCount != NULL);
> -
> - //
> - // Get support and configuration PCDs
> - //
> - CpuFeaturesData->SupportPcd = GetSupportPcd ();
> }
>
> /**
> @@ -269,7 +264,7 @@ SupportedMaskOr (
> UINT8 *Data1;
> UINT8 *Data2;
>
> - BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
> + BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting);
> Data1 = SupportedFeatureMask;
> Data2 = OrFeatureBitMask;
> for (Index = 0; Index < BitMaskSize; Index++) { @@ -294,7 +289,7 @@
> SupportedMaskAnd (
> UINT8 *Data1;
> UINT8 *Data2;
>
> - BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
> + BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting);
> Data1 = SupportedFeatureMask;
> Data2 = AndFeatureBitMask;
> for (Index = 0; Index < BitMaskSize; Index++) { @@ -319,7 +314,7 @@
> SupportedMaskCleanBit (
> UINT8 *Data1;
> UINT8 *Data2;
>
> - BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
> + BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting);
> Data1 = SupportedFeatureMask;
> Data2 = AndFeatureBitMask;
> for (Index = 0; Index < BitMaskSize; Index++) { @@ -350,7 +345,7 @@
> IsBitMaskMatch (
> UINT8 *Data1;
> UINT8 *Data2;
>
> - BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
> + BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting);
>
> Data1 = SupportedFeatureMask;
> Data2 = ComparedFeatureBitMask;
> @@ -389,21 +384,19 @@ CollectProcessorData (
> Entry = GetFirstNode (&CpuFeaturesData->FeatureList);
> while (!IsNull (&CpuFeaturesData->FeatureList, Entry)) {
> CpuFeature = CPU_FEATURE_ENTRY_FROM_LINK (Entry);
> - if (IsBitMaskMatch (CpuFeaturesData->SupportPcd, CpuFeature-
> >FeatureMask)) {
> - if (CpuFeature->SupportFunc == NULL) {
> - //
> - // If SupportFunc is NULL, then the feature is supported.
> - //
> - SupportedMaskOr (
> - CpuFeaturesData->InitOrder[ProcessorNumber].FeaturesSupportedMask,
> - CpuFeature->FeatureMask
> - );
> - } else if (CpuFeature->SupportFunc (ProcessorNumber, CpuInfo, CpuFeature-
> >ConfigData)) {
> - SupportedMaskOr (
> - CpuFeaturesData->InitOrder[ProcessorNumber].FeaturesSupportedMask,
> - CpuFeature->FeatureMask
> - );
> - }
> + if (CpuFeature->SupportFunc == NULL) {
> + //
> + // If SupportFunc is NULL, then the feature is supported.
> + //
> + SupportedMaskOr (
> + CpuFeaturesData->InitOrder[ProcessorNumber].FeaturesSupportedMask,
> + CpuFeature->FeatureMask
> + );
> + } else if (CpuFeature->SupportFunc (ProcessorNumber, CpuInfo, CpuFeature-
> >ConfigData)) {
> + SupportedMaskOr (
> + CpuFeaturesData->InitOrder[ProcessorNumber].FeaturesSupportedMask,
> + CpuFeature->FeatureMask
> + );
> }
> Entry = Entry->ForwardLink;
> }
> @@ -596,8 +589,6 @@ AnalysisProcessorFeatures (
> DumpCpuFeature (CpuFeature);
> Entry = Entry->ForwardLink;
> }
> - DEBUG ((DEBUG_INFO, "PcdCpuFeaturesSupport:\n"));
> - DumpCpuFeatureMask (CpuFeaturesData->SupportPcd);
> DEBUG ((DEBUG_INFO, "PcdCpuFeaturesCapability:\n"));
> DumpCpuFeatureMask (CpuFeaturesData->CapabilityPcd);
> DEBUG ((DEBUG_INFO, "Origin PcdCpuFeaturesSetting:\n")); diff --git
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
> index 3e0a342fd1..836ed3549c 100644
> --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
> +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h
> @@ -81,7 +81,6 @@ typedef struct {
> LIST_ENTRY FeatureList;
>
> CPU_FEATURES_INIT_ORDER *InitOrder;
> - UINT8 *SupportPcd;
> UINT8 *CapabilityPcd;
> UINT8 *SettingPcd;
>
> diff --git
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
> index 3540029079..3e8e899766 100644
> --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
> +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
> @@ -31,7 +31,7 @@ IsCpuFeatureMatch (
> {
> UINTN BitMaskSize;
>
> - BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
> + BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting);
> if (CompareMem (FirstFeatureMask, SecondFeatureMask, BitMaskSize) == 0) {
> return TRUE;
> } else {
> @@ -53,7 +53,7 @@ DumpCpuFeatureMask (
> UINT8 *Data8;
> UINTN BitMaskSize;
>
> - BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
> + BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting);
> Data8 = (UINT8 *) FeatureMask;
> for (Index = 0; Index < BitMaskSize; Index++) {
> DEBUG ((DEBUG_INFO, " %02x ", *Data8++)); @@ -100,7 +100,7 @@
> IsBitMaskMatchCheck (
> UINT8 *Data1;
> UINT8 *Data2;
>
> - BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
> + BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting);
>
> Data1 = FeatureMask;
> Data2 = DependentBitMask;
> @@ -656,7 +656,7 @@ RegisterCpuFeatureWorker (
> UINTN BitMaskSize;
> BOOLEAN FeatureExist;
>
> - BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
> + BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting);
> CpuFeaturesData = GetCpuFeaturesData ();
> if (CpuFeaturesData->FeaturesCount == 0) {
> InitializeListHead (&CpuFeaturesData->FeatureList); @@ -870,7 +870,7 @@
> RegisterCpuFeature (
> BeforeAll = FALSE;
> AfterAll = FALSE;
>
> - BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
> + BitMaskSize = PcdGetSize (PcdCpuFeaturesSetting);
>
> VA_START (Marker, InitializeFunc);
> Feature = VA_ARG (Marker, UINT32);
> --
> 2.15.0.windows.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Patch v2 4/4] UefiCpuPkg/RegisterCpuFeaturesLib: Correct comments.
2019-03-01 5:39 ` [Patch v2 4/4] UefiCpuPkg/RegisterCpuFeaturesLib: Correct comments Eric Dong
2019-03-01 15:32 ` Laszlo Ersek
@ 2019-04-02 7:22 ` Ni, Ray
1 sibling, 0 replies; 14+ messages in thread
From: Ni, Ray @ 2019-04-02 7:22 UTC (permalink / raw)
To: Dong, Eric, edk2-devel@lists.01.org; +Cc: Laszlo Ersek
Reviewed-by: Ray Ni <ray.ni@intel.com>
> -----Original Message-----
> From: Dong, Eric <eric.dong@intel.com>
> Sent: Friday, March 1, 2019 1:40 PM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ray <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>
> Subject: [Patch v2 4/4] UefiCpuPkg/RegisterCpuFeaturesLib: Correct comments.
>
> Cc: Ray Ni <Ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Dong <eric.dong@intel.com>
> ---
> UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
> index 3e8e899766..a78ef44491 100644
> --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
> +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c
> @@ -1174,8 +1174,8 @@ PreSmmCpuRegisterTableWrite (
> @param[in] CpuBitMaskSize The size of CPU feature bit mask buffer
> @param[in] Feature The bit number of the CPU feature
>
> - @retval TRUE The CPU feature is set in PcdCpuFeaturesSupport.
> - @retval FALSE The CPU feature is not set in PcdCpuFeaturesSupport.
> + @retval TRUE The CPU feature is set in CpuBitMask.
> + @retval FALSE The CPU feature is not set in CpuBitMask.
>
> **/
> BOOLEAN
> --
> 2.15.0.windows.1
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2019-04-02 7:26 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-01 5:39 [Patch v2 0/4] Simplify CPU Features solution Eric Dong
2019-03-01 5:39 ` [Patch v2 1/4] UefiCpuPkg/RegisterCpuFeaturesLib: Remove useless functions Eric Dong
2019-04-02 7:07 ` Ni, Ray
2019-03-01 5:39 ` [Patch v2 2/4] UefiCpuPkg/RegisterCpuFeaturesLib: Optimize PCD PcdCpuFeaturesUserConfiguration Eric Dong
2019-03-05 9:55 ` Zeng, Star
2019-03-05 9:56 ` Zeng, Star
2019-03-07 2:48 ` Dong, Eric
2019-04-02 7:15 ` Ni, Ray
2019-03-01 5:39 ` [Patch v2 3/4] UefiCpuPkg/RegisterCpuFeaturesLib: Simplify PcdCpuFeaturesSupport Eric Dong
2019-04-02 7:22 ` Ni, Ray
2019-03-01 5:39 ` [Patch v2 4/4] UefiCpuPkg/RegisterCpuFeaturesLib: Correct comments Eric Dong
2019-03-01 15:32 ` Laszlo Ersek
2019-04-02 7:22 ` Ni, Ray
2019-03-01 15:30 ` [Patch v2 0/4] Simplify CPU Features solution Laszlo Ersek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox