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