]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/Event/Tpl.c
Update DXE Core to be compatible with PI 1.2 SMM Drivers.
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / Event / Tpl.c
index 43bc8add36f772a6d0cd6a87ad671b5ef6ce15ba..265204f3160d591e4860ab8ba747f6c6c16ad27b 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Task priority (TPL) functions.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
+Copyright (c) 2006 - 2010, Intel Corporation. <BR>\r
 All rights reserved. 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
@@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 #include "DxeMain.h"\r
-\r
+#include "Event.h"\r
 \r
 /**\r
   Set Interrupt State.\r
@@ -26,12 +26,23 @@ CoreSetInterruptState (
   IN BOOLEAN      Enable\r
   )\r
 {\r
-  if (gCpu != NULL) {\r
-    if (Enable) {\r
-      gCpu->EnableInterrupt(gCpu);\r
-    } else {\r
-      gCpu->DisableInterrupt(gCpu);\r
-    }\r
+  EFI_STATUS  Status;\r
+  BOOLEAN     InSmm;\r
+  \r
+  if (gCpu == NULL) {\r
+    return;\r
+  }\r
+  if (!Enable) {\r
+    gCpu->DisableInterrupt (gCpu);\r
+    return;\r
+  }\r
+  if (gSmmBase2 == NULL) {\r
+    gCpu->EnableInterrupt (gCpu);\r
+    return;\r
+  }\r
+  Status = gSmmBase2->InSmm (gSmmBase2, &InSmm);\r
+  if (!EFI_ERROR (Status) && !InSmm) {\r
+    gCpu->EnableInterrupt(gCpu);\r
   }\r
 }\r
 \r