From: Eric Dong <eric.dong@intel.com>
To: edk2-devel@lists.01.org
Subject: [Patch 1/2] UefiCpuPkg RegisterCpuFeaturesLib: Add error handling code.
Date: Mon, 10 Jul 2017 12:50:20 +0800 [thread overview]
Message-ID: <1499662221-21760-2-git-send-email-eric.dong@intel.com> (raw)
In-Reply-To: <1499662221-21760-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>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
---
.../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 38 +++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
index 5e11b2b..ccdfcda 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.
@@ -500,7 +525,18 @@ AnalysisProcessorFeatures (
} else {
Status = CpuFeatureInOrder->InitializeFunc (ProcessorNumber, CpuInfo, CpuFeatureInOrder->ConfigData, FALSE);
}
- ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ //
+ // Clean the CpuFeatureInOrder->FeatureMask in setting PCD.
+ //
+ SupportedMaskCleanBit (CpuFeaturesData->SettingPcds, CpuFeatureInOrder->FeatureMask);
+ if (CpuFeatureInOrder->FeatureName != NULL) {
+ DEBUG ((DEBUG_WARN, "Feature %a failed to initialize, status = %x!\n", CpuFeatureInOrder->FeatureName, Status));
+ } else {
+ DEBUG ((DEBUG_WARN, "Feature %x failed to initialize, status = %x!\n", CpuFeatureInOrder->FeatureMask, Status));
+ }
+ }
+
Entry = Entry->ForwardLink;
}
//
--
2.7.0.windows.1
next prev parent reply other threads:[~2017-07-10 4:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-10 4:50 [Patch 0/2] Fix enable Smx/Vmx error Eric Dong
2017-07-10 4:50 ` Eric Dong [this message]
2017-07-10 4:50 ` [Patch 2/2] UefiCpuPkg CpuCommonFeaturesLib: Fix smx/vmx enable logic error Eric Dong
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=1499662221-21760-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