mirror of https://github.com/acidanthera/audk.git
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> Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
parent
79be3d2751
commit
6214ffb410
|
@ -21,16 +21,21 @@ CHAR16 *mRegisterTypeStr[] = {L"MSR", L"CR", L"MMIO", L"CACHE", L"SEMAP", L"INVA
|
||||||
Worker function to save PcdCpuFeaturesCapability.
|
Worker function to save PcdCpuFeaturesCapability.
|
||||||
|
|
||||||
@param[in] SupportedFeatureMask The pointer to CPU feature bits mask buffer
|
@param[in] SupportedFeatureMask The pointer to CPU feature bits mask buffer
|
||||||
|
@param[in] FeatureMaskSize CPU feature bits mask buffer size.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
SetCapabilityPcd (
|
SetCapabilityPcd (
|
||||||
IN UINT8 *SupportedFeatureMask
|
IN UINT8 *SupportedFeatureMask,
|
||||||
|
IN UINT32 FeatureMaskSize
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINTN BitMaskSize;
|
UINTN BitMaskSize;
|
||||||
|
|
||||||
BitMaskSize = PcdGetSize (PcdCpuFeaturesCapability);
|
BitMaskSize = PcdGetSize (PcdCpuFeaturesCapability);
|
||||||
|
ASSERT (FeatureMaskSize == BitMaskSize);
|
||||||
|
|
||||||
Status = PcdSetPtrS (PcdCpuFeaturesCapability, &BitMaskSize, SupportedFeatureMask);
|
Status = PcdSetPtrS (PcdCpuFeaturesCapability, &BitMaskSize, SupportedFeatureMask);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
}
|
}
|
||||||
|
@ -53,48 +58,6 @@ SetSettingPcd (
|
||||||
ASSERT_EFI_ERROR (Status);
|
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.
|
Collects CPU type and feature information.
|
||||||
|
|
||||||
|
@ -287,7 +250,6 @@ CpuInitDataInitialize (
|
||||||
// Get support and configuration PCDs
|
// Get support and configuration PCDs
|
||||||
//
|
//
|
||||||
CpuFeaturesData->SupportPcd = GetSupportPcd ();
|
CpuFeaturesData->SupportPcd = GetSupportPcd ();
|
||||||
CpuFeaturesData->ConfigurationPcd = GetConfigurationPcd ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -323,14 +285,14 @@ SupportedMaskOr (
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
SupportedMaskAnd (
|
SupportedMaskAnd (
|
||||||
IN UINT8 *SupportedFeatureMask,
|
IN UINT8 *SupportedFeatureMask,
|
||||||
IN UINT8 *AndFeatureBitMask
|
IN CONST UINT8 *AndFeatureBitMask
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
UINTN BitMaskSize;
|
UINTN BitMaskSize;
|
||||||
UINT8 *Data1;
|
UINT8 *Data1;
|
||||||
UINT8 *Data2;
|
CONST UINT8 *Data2;
|
||||||
|
|
||||||
BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
|
BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
|
||||||
Data1 = SupportedFeatureMask;
|
Data1 = SupportedFeatureMask;
|
||||||
|
@ -610,16 +572,9 @@ AnalysisProcessorFeatures (
|
||||||
//
|
//
|
||||||
// Calculate the last setting
|
// Calculate the last setting
|
||||||
//
|
//
|
||||||
|
|
||||||
CpuFeaturesData->SettingPcd = AllocateCopyPool (CpuFeaturesData->BitMaskSize, CpuFeaturesData->CapabilityPcd);
|
CpuFeaturesData->SettingPcd = AllocateCopyPool (CpuFeaturesData->BitMaskSize, CpuFeaturesData->CapabilityPcd);
|
||||||
ASSERT (CpuFeaturesData->SettingPcd != NULL);
|
ASSERT (CpuFeaturesData->SettingPcd != NULL);
|
||||||
SupportedMaskAnd (CpuFeaturesData->SettingPcd, CpuFeaturesData->ConfigurationPcd);
|
SupportedMaskAnd (CpuFeaturesData->SettingPcd, PcdGetPtr (PcdCpuFeaturesSetting));
|
||||||
|
|
||||||
//
|
|
||||||
// Save PCDs and display CPU PCDs
|
|
||||||
//
|
|
||||||
SetCapabilityPcd (CpuFeaturesData->CapabilityPcd);
|
|
||||||
SetSettingPcd (CpuFeaturesData->SettingPcd);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Dump the last CPU feature list
|
// Dump the last CPU feature list
|
||||||
|
@ -643,14 +598,20 @@ AnalysisProcessorFeatures (
|
||||||
}
|
}
|
||||||
DEBUG ((DEBUG_INFO, "PcdCpuFeaturesSupport:\n"));
|
DEBUG ((DEBUG_INFO, "PcdCpuFeaturesSupport:\n"));
|
||||||
DumpCpuFeatureMask (CpuFeaturesData->SupportPcd);
|
DumpCpuFeatureMask (CpuFeaturesData->SupportPcd);
|
||||||
DEBUG ((DEBUG_INFO, "PcdCpuFeaturesUserConfiguration:\n"));
|
|
||||||
DumpCpuFeatureMask (CpuFeaturesData->ConfigurationPcd);
|
|
||||||
DEBUG ((DEBUG_INFO, "PcdCpuFeaturesCapability:\n"));
|
DEBUG ((DEBUG_INFO, "PcdCpuFeaturesCapability:\n"));
|
||||||
DumpCpuFeatureMask (CpuFeaturesData->CapabilityPcd);
|
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);
|
DumpCpuFeatureMask (CpuFeaturesData->SettingPcd);
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Save PCDs and display CPU PCDs
|
||||||
|
//
|
||||||
|
SetCapabilityPcd (CpuFeaturesData->CapabilityPcd, CpuFeaturesData->BitMaskSize);
|
||||||
|
SetSettingPcd (CpuFeaturesData->SettingPcd);
|
||||||
|
|
||||||
for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) {
|
for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) {
|
||||||
CpuInitOrder = &CpuFeaturesData->InitOrder[ProcessorNumber];
|
CpuInitOrder = &CpuFeaturesData->InitOrder[ProcessorNumber];
|
||||||
Entry = GetFirstNode (&CpuFeaturesData->FeatureList);
|
Entry = GetFirstNode (&CpuFeaturesData->FeatureList);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# Register CPU Features Library DXE instance.
|
# Register CPU Features Library DXE instance.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -56,9 +56,8 @@
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuS3DataAddress ## CONSUMES
|
gUefiCpuPkgTokenSpaceGuid.PcdCpuS3DataAddress ## CONSUMES
|
||||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSupport ## CONSUMES
|
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSupport ## CONSUMES
|
||||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesUserConfiguration ## CONSUMES
|
|
||||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability ## PRODUCES
|
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability ## PRODUCES
|
||||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ## PRODUCES
|
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ## PRODUCES ## CONSUMES
|
||||||
|
|
||||||
[Depex]
|
[Depex]
|
||||||
gEfiMpServiceProtocolGuid AND gEdkiiCpuFeaturesSetDoneGuid
|
gEfiMpServiceProtocolGuid AND gEdkiiCpuFeaturesSetDoneGuid
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# Register CPU Features Library PEI instance.
|
# Register CPU Features Library PEI instance.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -56,9 +56,8 @@
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuS3DataAddress ## CONSUMES
|
gUefiCpuPkgTokenSpaceGuid.PcdCpuS3DataAddress ## CONSUMES
|
||||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSupport ## CONSUMES
|
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSupport ## CONSUMES
|
||||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesUserConfiguration ## CONSUMES
|
|
||||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability ## PRODUCES
|
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability ## PRODUCES
|
||||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ## PRODUCES
|
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting ## CONSUMES ## PRODUCES
|
||||||
|
|
||||||
[Depex]
|
[Depex]
|
||||||
gEfiPeiMpServicesPpiGuid AND gEdkiiCpuFeaturesSetDoneGuid
|
gEfiPeiMpServicesPpiGuid AND gEdkiiCpuFeaturesSetDoneGuid
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
CPU Register Table Library definitions.
|
CPU Register Table Library definitions.
|
||||||
|
|
||||||
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -83,7 +83,6 @@ typedef struct {
|
||||||
CPU_FEATURES_INIT_ORDER *InitOrder;
|
CPU_FEATURES_INIT_ORDER *InitOrder;
|
||||||
UINT8 *SupportPcd;
|
UINT8 *SupportPcd;
|
||||||
UINT8 *CapabilityPcd;
|
UINT8 *CapabilityPcd;
|
||||||
UINT8 *ConfigurationPcd;
|
|
||||||
UINT8 *SettingPcd;
|
UINT8 *SettingPcd;
|
||||||
|
|
||||||
UINT32 NumberOfCpus;
|
UINT32 NumberOfCpus;
|
||||||
|
|
|
@ -262,10 +262,6 @@
|
||||||
# @Prompt SMM CPU Synchronization Method.
|
# @Prompt SMM CPU Synchronization Method.
|
||||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x00|UINT8|0x60000014
|
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.
|
## Specifies the On-demand clock modulation duty cycle when ACPI feature is enabled.
|
||||||
# @Prompt The encoded values for target duty cycle modulation.
|
# @Prompt The encoded values for target duty cycle modulation.
|
||||||
# @ValidRange 0x80000001 | 0 - 15
|
# @ValidRange 0x80000001 | 0 - 15
|
||||||
|
@ -293,8 +289,9 @@
|
||||||
# @ValidList 0x80000001 | 0
|
# @ValidList 0x80000001 | 0
|
||||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesCapability|{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000018
|
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.
|
## As input, specifies user's desired settings for enabling/disabling processor features.
|
||||||
# @Prompt Actual processor feature settings.
|
## 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
|
# @ValidList 0x80000001 | 0
|
||||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting|{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000019
|
gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesSetting|{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}|VOID*|0x00000019
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue