summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dong <eric.dong@intel.com>2017-08-17 11:33:30 +0800
committerEric Dong <eric.dong@intel.com>2017-08-28 15:23:21 +0800
commitac401975581daf1e4e353898f7441eeb668ba304 (patch)
tree488fb4567cea977b82d7c54c057c1f9f1e89bf0d
parentef5e0db22cdd73e9727afcaa5c7fe8e55b7b3671 (diff)
downloadedk2-ac401975581daf1e4e353898f7441eeb668ba304.tar.gz
edk2-ac401975581daf1e4e353898f7441eeb668ba304.tar.bz2
edk2-ac401975581daf1e4e353898f7441eeb668ba304.zip
UefiCpuPkg/CpuCommonFeaturesLib: Add CPUID MCA support check
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> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
-rw-r--r--UefiCpuPkg/Library/CpuCommonFeaturesLib/Lmce.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Lmce.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Lmce.c
index 65e5cd3ca5..bf7e26b851 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)));