From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 AF51421E2DA48 for ; Wed, 16 Aug 2017 20:41:49 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP; 16 Aug 2017 20:44:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,386,1498546800"; d="scan'208";a="124570786" Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.51]) by orsmga002.jf.intel.com with ESMTP; 16 Aug 2017 20:44:15 -0700 From: Eric Dong To: edk2-devel@lists.01.org Cc: Michael Kinney , Ruiyu Ni Date: Thu, 17 Aug 2017 11:44:12 +0800 Message-Id: <1502941453-12332-2-git-send-email-eric.dong@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 In-Reply-To: <1502941453-12332-1-git-send-email-eric.dong@intel.com> References: <1502941453-12332-1-git-send-email-eric.dong@intel.com> Subject: [Patch 1/2] UefiCpuPkg/CpuCommonFeaturesLib: Add CPUID MCA support check 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: , X-List-Received-Date: Thu, 17 Aug 2017 03:41:49 -0000 Add CPUID check to see if the CPU supports the Machine Check Architecture before accessing the Machine Check Architecture related MSRs. Cc: Michael Kinney Cc: Ruiyu Ni Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Dong --- UefiCpuPkg/Library/CpuCommonFeaturesLib/Lmce.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Lmce.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Lmce.c index 65e5cd3..bf7e26b 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Lmce.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Lmce.c @@ -41,6 +41,10 @@ LmceSupport ( { MSR_IA32_MCG_CAP_REGISTER McgCap; + if (!McaSupport (ProcessorNumber, CpuInfo, ConfigData)) { + return FALSE; + } + McgCap.Uint64 = AsmReadMsr64 (MSR_IA32_MCG_CAP); if (ProcessorNumber == 0) { DEBUG ((EFI_D_INFO, "LMCE eanble = %x\n", (BOOLEAN) (McgCap.Bits.MCG_LMCE_P != 0))); -- 2.7.0.windows.1