/** @file\r
CPU Features Initialize functions.\r
\r
- Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
@return The pointer to CPU feature bits mask buffer.\r
**/\r
UINT8 *\r
-GetSupportPcds (\r
+GetSupportPcd (\r
VOID\r
)\r
{\r
- UINTN BitMaskSize;\r
UINT8 *SupportBitMask;\r
\r
- BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);\r
- SupportBitMask = AllocateZeroPool (BitMaskSize);\r
+ SupportBitMask = AllocateCopyPool (\r
+ PcdGetSize (PcdCpuFeaturesSupport),\r
+ PcdGetPtr (PcdCpuFeaturesSupport)\r
+ );\r
ASSERT (SupportBitMask != NULL);\r
- SupportBitMask = (UINT8 *) PcdGetPtr (PcdCpuFeaturesSupport);\r
\r
return SupportBitMask;\r
}\r
@return The pointer to CPU feature bits mask buffer.\r
**/\r
UINT8 *\r
-GetConfigurationPcds (\r
+GetConfigurationPcd (\r
VOID\r
)\r
{\r
- UINTN BitMaskSize;\r
UINT8 *SupportBitMask;\r
\r
- BitMaskSize = PcdGetSize (PcdCpuFeaturesUserConfiguration);\r
- SupportBitMask = AllocateZeroPool (BitMaskSize);\r
+ SupportBitMask = AllocateCopyPool (\r
+ PcdGetSize (PcdCpuFeaturesUserConfiguration),\r
+ PcdGetPtr (PcdCpuFeaturesUserConfiguration)\r
+ );\r
ASSERT (SupportBitMask != NULL);\r
- SupportBitMask = (UINT8 *) PcdGetPtr (PcdCpuFeaturesUserConfiguration);\r
\r
return SupportBitMask;\r
}\r
CpuFeaturesData = GetCpuFeaturesData ();\r
CpuFeaturesData->InitOrder = AllocateZeroPool (sizeof (CPU_FEATURES_INIT_ORDER) * NumberOfCpus);\r
ASSERT (CpuFeaturesData->InitOrder != NULL);\r
- CpuFeaturesData->BitMaskSize = (UINT32) PcdGetSize (PcdCpuFeaturesSupport);\r
\r
//\r
// Collect CPU Features information\r
//\r
// Get support and configuration PCDs\r
//\r
- CpuFeaturesData->SupportPcds = GetSupportPcds ();\r
- CpuFeaturesData->ConfigurationPcds = GetConfigurationPcds ();\r
+ CpuFeaturesData->SupportPcd = GetSupportPcd ();\r
+ CpuFeaturesData->ConfigurationPcd = GetConfigurationPcd ();\r
}\r
\r
/**\r
Entry = GetFirstNode (&CpuFeaturesData->FeatureList);\r
while (!IsNull (&CpuFeaturesData->FeatureList, Entry)) {\r
CpuFeature = CPU_FEATURE_ENTRY_FROM_LINK (Entry);\r
- if (IsBitMaskMatch (CpuFeaturesData->SupportPcds, CpuFeature->FeatureMask)) {\r
+ if (IsBitMaskMatch (CpuFeaturesData->SupportPcd, CpuFeature->FeatureMask)) {\r
if (CpuFeature->SupportFunc == NULL) {\r
//\r
// If SupportFunc is NULL, then the feature is supported.\r
CPU_FEATURES_DATA *CpuFeaturesData;\r
\r
CpuFeaturesData = GetCpuFeaturesData ();\r
- CpuFeaturesData->CapabilityPcds = AllocatePool (CpuFeaturesData->BitMaskSize);\r
- ASSERT (CpuFeaturesData->CapabilityPcds != NULL);\r
- SetMem (CpuFeaturesData->CapabilityPcds, CpuFeaturesData->BitMaskSize, 0xFF);\r
+ CpuFeaturesData->CapabilityPcd = AllocatePool (CpuFeaturesData->BitMaskSize);\r
+ ASSERT (CpuFeaturesData->CapabilityPcd != NULL);\r
+ SetMem (CpuFeaturesData->CapabilityPcd, CpuFeaturesData->BitMaskSize, 0xFF);\r
for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) {\r
CpuInitOrder = &CpuFeaturesData->InitOrder[ProcessorNumber];\r
//\r
// Calculate the last capability on all processors\r
//\r
- SupportedMaskAnd (CpuFeaturesData->CapabilityPcds, CpuInitOrder->FeaturesSupportedMask);\r
+ SupportedMaskAnd (CpuFeaturesData->CapabilityPcd, CpuInitOrder->FeaturesSupportedMask);\r
}\r
//\r
// Calculate the last setting\r
//\r
\r
- CpuFeaturesData->SettingPcds = AllocateCopyPool (CpuFeaturesData->BitMaskSize, CpuFeaturesData->CapabilityPcds);\r
- ASSERT (CpuFeaturesData->SettingPcds != NULL);\r
- SupportedMaskAnd (CpuFeaturesData->SettingPcds, CpuFeaturesData->ConfigurationPcds);\r
+ CpuFeaturesData->SettingPcd = AllocateCopyPool (CpuFeaturesData->BitMaskSize, CpuFeaturesData->CapabilityPcd);\r
+ ASSERT (CpuFeaturesData->SettingPcd != NULL);\r
+ SupportedMaskAnd (CpuFeaturesData->SettingPcd, CpuFeaturesData->ConfigurationPcd);\r
\r
//\r
// Save PCDs and display CPU PCDs\r
//\r
- SetCapabilityPcd (CpuFeaturesData->CapabilityPcds);\r
- SetSettingPcd (CpuFeaturesData->SettingPcds);\r
+ SetCapabilityPcd (CpuFeaturesData->CapabilityPcd);\r
+ SetSettingPcd (CpuFeaturesData->SettingPcd);\r
\r
//\r
// Dump the last CPU feature list\r
Entry = GetFirstNode (&CpuFeaturesData->FeatureList);\r
while (!IsNull (&CpuFeaturesData->FeatureList, Entry)) {\r
CpuFeature = CPU_FEATURE_ENTRY_FROM_LINK (Entry);\r
- if (IsBitMaskMatch (CpuFeature->FeatureMask, CpuFeaturesData->CapabilityPcds)) {\r
- if (IsBitMaskMatch (CpuFeature->FeatureMask, CpuFeaturesData->SettingPcds)) {\r
+ if (IsBitMaskMatch (CpuFeature->FeatureMask, CpuFeaturesData->CapabilityPcd)) {\r
+ if (IsBitMaskMatch (CpuFeature->FeatureMask, CpuFeaturesData->SettingPcd)) {\r
DEBUG ((DEBUG_INFO, "[Enable ] "));\r
} else {\r
DEBUG ((DEBUG_INFO, "[Disable ] "));\r
Entry = Entry->ForwardLink;\r
}\r
DEBUG ((DEBUG_INFO, "PcdCpuFeaturesSupport:\n"));\r
- DumpCpuFeatureMask (CpuFeaturesData->SupportPcds);\r
+ DumpCpuFeatureMask (CpuFeaturesData->SupportPcd);\r
DEBUG ((DEBUG_INFO, "PcdCpuFeaturesUserConfiguration:\n"));\r
- DumpCpuFeatureMask (CpuFeaturesData->ConfigurationPcds);\r
+ DumpCpuFeatureMask (CpuFeaturesData->ConfigurationPcd);\r
DEBUG ((DEBUG_INFO, "PcdCpuFeaturesCapability:\n"));\r
- DumpCpuFeatureMask (CpuFeaturesData->CapabilityPcds);\r
+ DumpCpuFeatureMask (CpuFeaturesData->CapabilityPcd);\r
DEBUG ((DEBUG_INFO, "PcdCpuFeaturesSetting:\n"));\r
- DumpCpuFeatureMask (CpuFeaturesData->SettingPcds);\r
+ DumpCpuFeatureMask (CpuFeaturesData->SettingPcd);\r
);\r
\r
for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) {\r
// Insert each feature into processor's order list\r
//\r
CpuFeature = CPU_FEATURE_ENTRY_FROM_LINK (Entry);\r
- if (IsBitMaskMatch (CpuFeature->FeatureMask, CpuFeaturesData->CapabilityPcds)) {\r
+ if (IsBitMaskMatch (CpuFeature->FeatureMask, CpuFeaturesData->CapabilityPcd)) {\r
CpuFeatureInOrder = AllocateCopyPool (sizeof (CPU_FEATURES_ENTRY), CpuFeature);\r
ASSERT (CpuFeatureInOrder != NULL);\r
InsertTailList (&CpuInitOrder->OrderList, &CpuFeatureInOrder->Link);\r
Entry = GetFirstNode (&CpuInitOrder->OrderList);\r
while (!IsNull (&CpuInitOrder->OrderList, Entry)) {\r
CpuFeatureInOrder = CPU_FEATURE_ENTRY_FROM_LINK (Entry);\r
- if (IsBitMaskMatch (CpuFeatureInOrder->FeatureMask, CpuFeaturesData->SettingPcds)) {\r
+ if (IsBitMaskMatch (CpuFeatureInOrder->FeatureMask, CpuFeaturesData->SettingPcd)) {\r
Status = CpuFeatureInOrder->InitializeFunc (ProcessorNumber, CpuInfo, CpuFeatureInOrder->ConfigData, TRUE);\r
if (EFI_ERROR (Status)) {\r
//\r
// Clean the CpuFeatureInOrder->FeatureMask in setting PCD.\r
//\r
- SupportedMaskCleanBit (CpuFeaturesData->SettingPcds, CpuFeatureInOrder->FeatureMask);\r
+ SupportedMaskCleanBit (CpuFeaturesData->SettingPcd, CpuFeatureInOrder->FeatureMask);\r
if (CpuFeatureInOrder->FeatureName != NULL) {\r
DEBUG ((DEBUG_WARN, "Warning :: Failed to enable Feature: Name = %a.\n", CpuFeatureInOrder->FeatureName));\r
} else {\r
// again during initialize the features.\r
//\r
DEBUG ((DEBUG_INFO, "Dump final value for PcdCpuFeaturesSetting:\n"));\r
- DumpCpuFeatureMask (CpuFeaturesData->SettingPcds);\r
+ DumpCpuFeatureMask (CpuFeaturesData->SettingPcd);\r
\r
//\r
// Dump the RegisterTable\r