[edk2] [Patch 1/2] UefiCpuPkg/CpuCommonFeaturesLib: Add CPUID MCA support check

Eric Dong posted 2 patches 7 years, 4 months ago
[edk2] [Patch 1/2] UefiCpuPkg/CpuCommonFeaturesLib: Add CPUID MCA support check
Posted by Eric Dong 7 years, 4 months ago
Add CPUID check to see if the CPU supports the Machine Check
Architecture before accessing the Machine Check Architecture
related MSRs.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
 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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel