]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c
UefiCpuPkg: Clean up source files
[mirror_edk2.git] / UefiCpuPkg / Library / CpuCommonFeaturesLib / MachineCheck.c
index 58dc45aedaf0469490684b370eec8c2022fef1a0..c4eca062fdcdecda72235e9035ff4805c6161c2e 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Machine Check features.\r
 \r
-  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -140,25 +140,27 @@ McaInitialize (
   MSR_IA32_MCG_CAP_REGISTER  McgCap;\r
   UINT32                     BankIndex;\r
 \r
-  McgCap.Uint64 = AsmReadMsr64 (MSR_IA32_MCG_CAP);\r
-  for (BankIndex = 0; BankIndex < (UINT32) McgCap.Bits.Count; BankIndex++) {\r
-    CPU_REGISTER_TABLE_WRITE64 (\r
-      ProcessorNumber,\r
-      Msr,\r
-      MSR_IA32_MC0_CTL + BankIndex * 4,\r
-      MAX_UINT64\r
-      );\r
-  }\r
-\r
-  if (PcdGetBool (PcdIsPowerOnReset)) {\r
-    for (BankIndex = 0; BankIndex < (UINTN) McgCap.Bits.Count; BankIndex++) {\r
+  if (State) {\r
+    McgCap.Uint64 = AsmReadMsr64 (MSR_IA32_MCG_CAP);\r
+    for (BankIndex = 0; BankIndex < (UINT32) McgCap.Bits.Count; BankIndex++) {\r
       CPU_REGISTER_TABLE_WRITE64 (\r
         ProcessorNumber,\r
         Msr,\r
-        MSR_IA32_MC0_STATUS + BankIndex * 4,\r
-        0\r
+        MSR_IA32_MC0_CTL + BankIndex * 4,\r
+        MAX_UINT64\r
         );\r
     }\r
+\r
+    if (PcdGetBool (PcdIsPowerOnReset)) {\r
+      for (BankIndex = 0; BankIndex < (UINTN) McgCap.Bits.Count; BankIndex++) {\r
+        CPU_REGISTER_TABLE_WRITE64 (\r
+          ProcessorNumber,\r
+          Msr,\r
+          MSR_IA32_MC0_STATUS + BankIndex * 4,\r
+          0\r
+          );\r
+      }\r
+    }\r
   }\r
 \r
   return RETURN_SUCCESS;\r
@@ -233,7 +235,7 @@ McgCtlInitialize (
 }\r
 \r
 /**\r
-  Detects if Local machine check exception feature supported on current \r
+  Detects if Local machine check exception feature supported on current\r
   processor.\r
 \r
   @param[in]  ProcessorNumber  The index of the CPU executing this function.\r