From nobody Mon Feb 9 22:39:52 2026 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1499662240258124.19727625660744; Sun, 9 Jul 2017 21:50:40 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 09FEB2095D2CD; Sun, 9 Jul 2017 21:48:44 -0700 (PDT) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 496382095D2C4 for ; Sun, 9 Jul 2017 21:48:42 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jul 2017 21:50:26 -0700 Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.51]) by orsmga001.jf.intel.com with ESMTP; 09 Jul 2017 21:50:24 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,338,1496127600"; d="scan'208";a="1149870125" From: Eric Dong To: edk2-devel@lists.01.org Date: Mon, 10 Jul 2017 12:50:20 +0800 Message-Id: <1499662221-21760-2-git-send-email-eric.dong@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 In-Reply-To: <1499662221-21760-1-git-send-email-eric.dong@intel.com> References: <1499662221-21760-1-git-send-email-eric.dong@intel.com> Subject: [edk2] [Patch 1/2] UefiCpuPkg RegisterCpuFeaturesLib: Add error handling code. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add error handling code when initialize the CPU feature failed. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Eric Dong Reviewed-by: Jeff Fan --- .../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 38 ++++++++++++++++++= +++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitializ= e.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 ( } =20 /** + Worker function to clean bit operation on CPU feature supported bits mas= k buffer. + + @param[in] SupportedFeatureMask The pointer to CPU feature bits mask b= uffer + @param[in] AndFeatureBitMask The feature bit mask to do XOR operati= on +**/ +VOID +SupportedMaskCleanBit ( + IN UINT8 *SupportedFeatureMask, + IN UINT8 *AndFeatureBitMask + ) +{ + UINTN Index; + UINTN BitMaskSize; + UINT8 *Data1; + UINT8 *Data2; + + BitMaskSize =3D PcdGetSize (PcdCpuFeaturesSupport); + Data1 =3D SupportedFeatureMask; + Data2 =3D AndFeatureBitMask; + for (Index =3D 0; Index < BitMaskSize; Index++) { + *(Data1++) &=3D ~(*(Data2++)); + } +} + +/** Worker function to check if the compared CPU feature set in the CPU feat= ure supported bits mask buffer. =20 @@ -500,7 +525,18 @@ AnalysisProcessorFeatures ( } else { Status =3D CpuFeatureInOrder->InitializeFunc (ProcessorNumber, Cpu= Info, CpuFeatureInOrder->ConfigData, FALSE); } - ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + // + // Clean the CpuFeatureInOrder->FeatureMask in setting PCD. + // + SupportedMaskCleanBit (CpuFeaturesData->SettingPcds, CpuFeatureInO= rder->FeatureMask); + if (CpuFeatureInOrder->FeatureName !=3D NULL) { + DEBUG ((DEBUG_WARN, "Feature %a failed to initialize, status =3D= %x!\n", CpuFeatureInOrder->FeatureName, Status)); + } else { + DEBUG ((DEBUG_WARN, "Feature %x failed to initialize, status =3D= %x!\n", CpuFeatureInOrder->FeatureMask, Status)); + } + } + Entry =3D Entry->ForwardLink; } // --=20 2.7.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel