Add CPUID check to see if the CPU supports the Machine Check
Architecture before accessing the Machine Check Architecture
related MSRs.

Cc: Michael Kinney <[email protected]>
Cc: Ruiyu Ni <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <[email protected]>
---
 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
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to