]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Update PiSmmCore to always invoke SmiManage (NULL, NULL, NULL, NULL) when SMI...
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 25 Sep 2012 02:44:53 +0000 (02:44 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 25 Sep 2012 02:44:53 +0000 (02:44 +0000)
2. Fix issue that PlatformHookAfterSmiDispatch() and PERF_END() are not called in the case mInLegacyBoot is TRUE.

signed-off-by: Jeff Fan <jeff.fan@intel.com>
reviewed-by: Kinney, Michael D <michael.d.kinney@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13740 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/PiSmmCore/PiSmmCore.c

index 90812ac76a797e729695b87fdf34ec5449d141e4..3c9d863346b0fd01db19ae8c19c0b4236fa6b01f 100644 (file)
@@ -261,49 +261,43 @@ SmmEntryPoint (
   //\r
   // If a legacy boot has occured, then make sure gSmmCorePrivate is not accessed\r
   //\r
-  if (mInLegacyBoot) {\r
+  if (!mInLegacyBoot) {\r
     //\r
-    // Asynchronous SMI\r
+    // Mark the InSmm flag as TRUE, it will be used by SmmBase2 protocol\r
     //\r
-    SmiManage (NULL, NULL, NULL, NULL);\r
-    return;\r
-  }\r
-\r
-  //\r
-  // Mark the InSmm flag as TRUE, it will be used by SmmBase2 protocol\r
-  //\r
-  gSmmCorePrivate->InSmm = TRUE;\r
-\r
-  //\r
-  // Check to see if this is a Synchronous SMI sent through the SMM Communication \r
-  // Protocol or an Asynchronous SMI\r
-  //\r
-  if (gSmmCorePrivate->CommunicationBuffer != NULL) {\r
-    //\r
-    // Synchronous SMI for SMM Core or request from Communicate protocol\r
-    //\r
-    CommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *)gSmmCorePrivate->CommunicationBuffer;\r
-    gSmmCorePrivate->BufferSize -= OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data);\r
-    Status = SmiManage (\r
-               &CommunicateHeader->HeaderGuid, \r
-               NULL, \r
-               CommunicateHeader->Data, \r
-               &gSmmCorePrivate->BufferSize\r
-               );\r
+    gSmmCorePrivate->InSmm = TRUE;\r
 \r
     //\r
-    // Update CommunicationBuffer, BufferSize and ReturnStatus\r
-    // Communicate service finished, reset the pointer to CommBuffer to NULL\r
+    // Check to see if this is a Synchronous SMI sent through the SMM Communication \r
+    // Protocol or an Asynchronous SMI\r
     //\r
-    gSmmCorePrivate->BufferSize += OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data);\r
-    gSmmCorePrivate->CommunicationBuffer = NULL;\r
-    gSmmCorePrivate->ReturnStatus = (Status == EFI_SUCCESS) ? EFI_SUCCESS : EFI_NOT_FOUND;\r
-  } else {\r
-    //\r
-    // Asynchronous SMI\r
-    //\r
-    SmiManage (NULL, NULL, NULL, NULL);\r
+    if (gSmmCorePrivate->CommunicationBuffer != NULL) {\r
+      //\r
+      // Synchronous SMI for SMM Core or request from Communicate protocol\r
+      //\r
+      CommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *)gSmmCorePrivate->CommunicationBuffer;\r
+      gSmmCorePrivate->BufferSize -= OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data);\r
+      Status = SmiManage (\r
+                 &CommunicateHeader->HeaderGuid, \r
+                 NULL, \r
+                 CommunicateHeader->Data, \r
+                 &gSmmCorePrivate->BufferSize\r
+                 );\r
+\r
+      //\r
+      // Update CommunicationBuffer, BufferSize and ReturnStatus\r
+      // Communicate service finished, reset the pointer to CommBuffer to NULL\r
+      //\r
+      gSmmCorePrivate->BufferSize += OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data);\r
+      gSmmCorePrivate->CommunicationBuffer = NULL;\r
+      gSmmCorePrivate->ReturnStatus = (Status == EFI_SUCCESS) ? EFI_SUCCESS : EFI_NOT_FOUND;\r
+    }\r
   }\r
+\r
+  //\r
+  // Process Asynchronous SMI sources\r
+  //\r
+  SmiManage (NULL, NULL, NULL, NULL);\r
   \r
   //\r
   // Call platform hook after Smm Dispatch\r
@@ -311,9 +305,14 @@ SmmEntryPoint (
   PlatformHookAfterSmmDispatch ();\r
 \r
   //\r
-  // Clear the InSmm flag as we are going to leave SMM\r
+  // If a legacy boot has occured, then make sure gSmmCorePrivate is not accessed\r
   //\r
-  gSmmCorePrivate->InSmm = FALSE;\r
+  if (!mInLegacyBoot) {\r
+    //\r
+    // Clear the InSmm flag as we are going to leave SMM\r
+    //\r
+    gSmmCorePrivate->InSmm = FALSE;\r
+  }\r
 \r
   PERF_END (NULL, "SMM", NULL, 0) ;\r
 }\r