mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg RegisterCpuFeaturesLib: Add error handling code.
Add error handling code when initialize the CPU feature failed. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com>
This commit is contained in:
parent
e508e069a8
commit
05973f9e8a
|
@ -234,6 +234,31 @@ SupportedMaskAnd (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Worker function to clean bit operation on CPU feature supported bits mask buffer.
|
||||||
|
|
||||||
|
@param[in] SupportedFeatureMask The pointer to CPU feature bits mask buffer
|
||||||
|
@param[in] AndFeatureBitMask The feature bit mask to do XOR operation
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
SupportedMaskCleanBit (
|
||||||
|
IN UINT8 *SupportedFeatureMask,
|
||||||
|
IN UINT8 *AndFeatureBitMask
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINTN Index;
|
||||||
|
UINTN BitMaskSize;
|
||||||
|
UINT8 *Data1;
|
||||||
|
UINT8 *Data2;
|
||||||
|
|
||||||
|
BitMaskSize = PcdGetSize (PcdCpuFeaturesSupport);
|
||||||
|
Data1 = SupportedFeatureMask;
|
||||||
|
Data2 = AndFeatureBitMask;
|
||||||
|
for (Index = 0; Index < BitMaskSize; Index++) {
|
||||||
|
*(Data1++) &= ~(*(Data2++));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Worker function to check if the compared CPU feature set in the CPU feature
|
Worker function to check if the compared CPU feature set in the CPU feature
|
||||||
supported bits mask buffer.
|
supported bits mask buffer.
|
||||||
|
@ -497,12 +522,32 @@ AnalysisProcessorFeatures (
|
||||||
CpuFeatureInOrder = CPU_FEATURE_ENTRY_FROM_LINK (Entry);
|
CpuFeatureInOrder = CPU_FEATURE_ENTRY_FROM_LINK (Entry);
|
||||||
if (IsBitMaskMatch (CpuFeatureInOrder->FeatureMask, CpuFeaturesData->SettingPcds)) {
|
if (IsBitMaskMatch (CpuFeatureInOrder->FeatureMask, CpuFeaturesData->SettingPcds)) {
|
||||||
Status = CpuFeatureInOrder->InitializeFunc (ProcessorNumber, CpuInfo, CpuFeatureInOrder->ConfigData, TRUE);
|
Status = CpuFeatureInOrder->InitializeFunc (ProcessorNumber, CpuInfo, CpuFeatureInOrder->ConfigData, TRUE);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
//
|
||||||
|
// Clean the CpuFeatureInOrder->FeatureMask in setting PCD.
|
||||||
|
//
|
||||||
|
SupportedMaskCleanBit (CpuFeaturesData->SettingPcds, CpuFeatureInOrder->FeatureMask);
|
||||||
|
if (CpuFeatureInOrder->FeatureName != NULL) {
|
||||||
|
DEBUG ((DEBUG_WARN, "Warning :: Failed to enable Feature Name = %a.\n", CpuFeatureInOrder->FeatureName));
|
||||||
|
} else {
|
||||||
|
DEBUG ((DEBUG_WARN, "Warning :: Failed to enable Feature Mask = "));
|
||||||
|
DumpCpuFeatureMask (CpuFeatureInOrder->FeatureMask);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Status = CpuFeatureInOrder->InitializeFunc (ProcessorNumber, CpuInfo, CpuFeatureInOrder->ConfigData, FALSE);
|
Status = CpuFeatureInOrder->InitializeFunc (ProcessorNumber, CpuInfo, CpuFeatureInOrder->ConfigData, FALSE);
|
||||||
}
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
Entry = Entry->ForwardLink;
|
Entry = Entry->ForwardLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Dump PcdCpuFeaturesSetting again because this value maybe updated
|
||||||
|
// again during initialize the features.
|
||||||
|
//
|
||||||
|
DEBUG ((DEBUG_INFO, "Dump final value for PcdCpuFeaturesSetting:\n"));
|
||||||
|
DumpCpuFeatureMask (CpuFeaturesData->SettingPcds);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Dump the RegisterTable
|
// Dump the RegisterTable
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue