From: Eric Dong <eric.dong@intel.com>
To: edk2-devel@lists.01.org
Cc: Jeff Fan <jeff.fan@intel.com>
Subject: [Patch V2 1/2] UefiCpuPkg RegisterCpuFeaturesLib: Add error handling code.
Date: Tue, 11 Jul 2017 10:19:15 +0800 [thread overview]
Message-ID: <1499739556-14440-2-git-send-email-eric.dong@intel.com> (raw)
In-Reply-To: <1499739556-14440-1-git-send-email-eric.dong@intel.com>
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>
Cc: Jeff Fan <jeff.fan@intel.com>
---
.../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 47 +++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index 5e11b2b..e91a438 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
@@ -235,6 +235,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
supported bits mask buffer.
@@ -497,12 +522,32 @@ AnalysisProcessorFeatures (
CpuFeatureInOrder = CPU_FEATURE_ENTRY_FROM_LINK (Entry);
if (IsBitMaskMatch (CpuFeatureInOrder->FeatureMask, CpuFeaturesData->SettingPcds)) {
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 {
Status = CpuFeatureInOrder->InitializeFunc (ProcessorNumber, CpuInfo, CpuFeatureInOrder->ConfigData, FALSE);
+ ASSERT_EFI_ERROR (Status);
}
- ASSERT_EFI_ERROR (Status);
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
//
--
2.7.0.windows.1
next prev parent reply other threads:[~2017-07-11 2:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-11 2:19 [Patch V2 0/2] Fix enable Smx/Vmx error Eric Dong
2017-07-11 2:19 ` Eric Dong [this message]
2017-07-11 2:19 ` [Patch V2 2/2] UefiCpuPkg CpuCommonFeaturesLib: Fix smx/vmx enable logic error Eric Dong
2017-07-11 6:25 ` [Patch V2 0/2] Fix enable Smx/Vmx error Fan, Jeff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1499739556-14440-2-git-send-email-eric.dong@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox