]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/PiSmmCore/Dispatcher.c
MdeModulePkg DxeCore/PiSmmCore: Add UEFI memory and SMRAM profile support.
[mirror_edk2.git] / MdeModulePkg / Core / PiSmmCore / Dispatcher.c
index d83224e322aa33dd05394852f8bcd6df23a49087..178681ec90aecc58fd7d46c093afc3943dfefc74 100644 (file)
@@ -2,7 +2,7 @@
   SMM Driver Dispatcher.\r
 \r
   Step #1 - When a FV protocol is added to the system every driver in the FV\r
-            is added to the mDiscoveredList. The SOR, Before, and After Depex are\r
+            is added to the mDiscoveredList. The Before, and After Depex are\r
             pre-processed as drivers are added to the mDiscoveredList. If an Apriori\r
             file exists in the FV those drivers are addeded to the\r
             mScheduledQueue. The mFvHandleList is used to make sure a\r
@@ -26,9 +26,9 @@
   is the state diagram for the DXE dispatcher\r
 \r
   Depex - Dependency Expresion.\r
-  SOR   - Schedule On Request - Don't schedule if this bit is set.\r
 \r
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2014, Hewlett-Packard Development Company, L.P.\r
+  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials are licensed and made available \r
   under the terms and conditions of the BSD License which accompanies this \r
   distribution.  The full text of the license may be found at        \r
@@ -121,6 +121,7 @@ FV_FILEPATH_DEVICE_PATH  mFvDevicePath;
 // DXE Architecture Protocols\r
 //\r
 EFI_SECURITY_ARCH_PROTOCOL  *mSecurity = NULL;\r
+EFI_SECURITY2_ARCH_PROTOCOL *mSecurity2 = NULL;\r
 \r
 //\r
 // The global variable is defined for Loading modules at fixed address feature to track the SMM code\r
@@ -321,6 +322,12 @@ SmmLoadImage (
   EFI_DEVICE_PATH_PROTOCOL       *HandleFilePath;\r
   EFI_FIRMWARE_VOLUME2_PROTOCOL  *Fv;\r
   PE_COFF_LOADER_IMAGE_CONTEXT   ImageContext;\r
+  UINT64                         Tick;\r
+\r
+  Tick = 0;\r
+  PERF_CODE (\r
+    Tick = GetPerformanceCounter ();\r
+  );\r
    \r
   Buffer               = NULL;\r
   Size                 = 0;\r
@@ -344,27 +351,19 @@ SmmLoadImage (
   }\r
 \r
   //\r
-  // If the Security Architectural Protocol has not been located yet, then attempt to locate it\r
+  // If the Security2 and Security Architectural Protocol has not been located yet, then attempt to locate it\r
   //\r
+  if (mSecurity2 == NULL) {\r
+    gBS->LocateProtocol (&gEfiSecurity2ArchProtocolGuid, NULL, (VOID**)&mSecurity2);\r
+  }\r
   if (mSecurity == NULL) {\r
     gBS->LocateProtocol (&gEfiSecurityArchProtocolGuid, NULL, (VOID**)&mSecurity);\r
   }\r
-\r
   //\r
-  // Verify the Authentication Status through the Security Architectural Protocol\r
+  // When Security2 is installed, Security Architectural Protocol must be published.\r
   //\r
-  if ((mSecurity != NULL) && (OriginalFilePath != NULL)) {\r
-    SecurityStatus = mSecurity->FileAuthenticationState (\r
-                                  mSecurity,\r
-                                  AuthenticationStatus,\r
-                                  OriginalFilePath\r
-                                  );\r
-    if (EFI_ERROR (SecurityStatus) && SecurityStatus != EFI_SECURITY_VIOLATION) {\r
-      Status = SecurityStatus;\r
-      return Status;\r
-    }\r
-  }\r
-  \r
+  ASSERT (mSecurity2 == NULL || mSecurity != NULL);\r
+\r
   //\r
   // Pull out just the file portion of the DevicePath for the LoadedImage FilePath\r
   //\r
@@ -407,11 +406,42 @@ SmmLoadImage (
   \r
   if (EFI_ERROR (Status)) {\r
     if (Buffer != NULL) {\r
-      Status = gBS->FreePool (Buffer);\r
+      gBS->FreePool (Buffer);\r
     }\r
     return Status;\r
   }\r
 \r
+  //\r
+  // Verify File Authentication through the Security2 Architectural Protocol\r
+  //\r
+  if (mSecurity2 != NULL) {\r
+    SecurityStatus = mSecurity2->FileAuthentication (\r
+                                  mSecurity2,\r
+                                  OriginalFilePath,\r
+                                  Buffer,\r
+                                  Size,\r
+                                  FALSE\r
+                                  );\r
+  }\r
+\r
+  //\r
+  // Verify the Authentication Status through the Security Architectural Protocol\r
+  // Only on images that have been read using Firmware Volume protocol.\r
+  // All SMM images are from FV protocol. \r
+  //\r
+  if (!EFI_ERROR (SecurityStatus) && (mSecurity != NULL)) {\r
+    SecurityStatus = mSecurity->FileAuthenticationState (\r
+                                  mSecurity,\r
+                                  AuthenticationStatus,\r
+                                  OriginalFilePath\r
+                                  );\r
+  }\r
+\r
+  if (EFI_ERROR (SecurityStatus) && SecurityStatus != EFI_SECURITY_VIOLATION) {\r
+    Status = SecurityStatus;\r
+    return Status;\r
+  }\r
+  \r
   //\r
   // Initialize ImageContext\r
   //\r
@@ -424,7 +454,7 @@ SmmLoadImage (
   Status = PeCoffLoaderGetImageInfo (&ImageContext);\r
   if (EFI_ERROR (Status)) {\r
     if (Buffer != NULL) {\r
-      Status = gBS->FreePool (Buffer);\r
+      gBS->FreePool (Buffer);\r
     }\r
     return Status;\r
   }\r
@@ -449,7 +479,7 @@ SmmLoadImage (
        //\r
        // allocate the memory to load the SMM driver\r
        //\r
-       PageCount = (UINTN)EFI_SIZE_TO_PAGES(ImageContext.ImageSize + ImageContext.SectionAlignment);\r
+       PageCount = (UINTN)EFI_SIZE_TO_PAGES((UINTN)ImageContext.ImageSize + ImageContext.SectionAlignment);\r
        DstBuffer = (UINTN)(-1);\r
      \r
        Status = SmmAllocatePages (\r
@@ -460,14 +490,14 @@ SmmLoadImage (
                    );\r
        if (EFI_ERROR (Status)) {\r
          if (Buffer != NULL) {\r
-           Status = gBS->FreePool (Buffer);\r
+           gBS->FreePool (Buffer);\r
          } \r
          return Status;\r
        }     \r
       ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)DstBuffer;\r
     }\r
   } else {\r
-     PageCount = (UINTN)EFI_SIZE_TO_PAGES(ImageContext.ImageSize + ImageContext.SectionAlignment);\r
+     PageCount = (UINTN)EFI_SIZE_TO_PAGES((UINTN)ImageContext.ImageSize + ImageContext.SectionAlignment);\r
      DstBuffer = (UINTN)(-1);\r
      \r
      Status = SmmAllocatePages (\r
@@ -478,7 +508,7 @@ SmmLoadImage (
                   );\r
      if (EFI_ERROR (Status)) {\r
        if (Buffer != NULL) {\r
-         Status = gBS->FreePool (Buffer);\r
+         gBS->FreePool (Buffer);\r
        }\r
        return Status;\r
      }\r
@@ -489,7 +519,7 @@ SmmLoadImage (
   // Align buffer on section boundry\r
   //\r
   ImageContext.ImageAddress += ImageContext.SectionAlignment - 1;\r
-  ImageContext.ImageAddress &= ~(ImageContext.SectionAlignment - 1);\r
+  ImageContext.ImageAddress &= ~((EFI_PHYSICAL_ADDRESS)(ImageContext.SectionAlignment - 1));\r
 \r
   //\r
   // Load the image to our new buffer\r
@@ -497,7 +527,7 @@ SmmLoadImage (
   Status = PeCoffLoaderLoadImage (&ImageContext);\r
   if (EFI_ERROR (Status)) {\r
     if (Buffer != NULL) {\r
-      Status = gBS->FreePool (Buffer);\r
+      gBS->FreePool (Buffer);\r
     }\r
     SmmFreePages (DstBuffer, PageCount);\r
     return Status;\r
@@ -509,7 +539,7 @@ SmmLoadImage (
   Status = PeCoffLoaderRelocateImage (&ImageContext);\r
   if (EFI_ERROR (Status)) {\r
     if (Buffer != NULL) {\r
-      Status = gBS->FreePool (Buffer);\r
+      gBS->FreePool (Buffer);\r
     }\r
     SmmFreePages (DstBuffer, PageCount);\r
     return Status;\r
@@ -533,12 +563,13 @@ SmmLoadImage (
   Status = gBS->AllocatePool (EfiBootServicesData, sizeof (EFI_LOADED_IMAGE_PROTOCOL), (VOID **)&DriverEntry->LoadedImage);\r
   if (EFI_ERROR (Status)) {\r
     if (Buffer != NULL) {\r
-      Status = gBS->FreePool (Buffer);\r
+      gBS->FreePool (Buffer);\r
     }\r
     SmmFreePages (DstBuffer, PageCount);\r
     return Status;\r
   }\r
 \r
+  ZeroMem (DriverEntry->LoadedImage, sizeof (EFI_LOADED_IMAGE_PROTOCOL));\r
   //\r
   // Fill in the remaining fields of the Loaded Image Protocol instance.\r
   // Note: ImageBase is an SMRAM address that can not be accessed outside of SMRAM if SMRAM window is closed.\r
@@ -554,7 +585,7 @@ SmmLoadImage (
   Status = gBS->AllocatePool (EfiBootServicesData, GetDevicePathSize (FilePath), (VOID **)&DriverEntry->LoadedImage->FilePath);\r
   if (EFI_ERROR (Status)) {\r
     if (Buffer != NULL) {\r
-      Status = gBS->FreePool (Buffer);\r
+      gBS->FreePool (Buffer);\r
     }\r
     SmmFreePages (DstBuffer, PageCount);\r
     return Status;\r
@@ -576,6 +607,9 @@ SmmLoadImage (
                   NULL\r
                   );\r
 \r
+  PERF_START (DriverEntry->ImageHandle, "LoadImage:", NULL, Tick);\r
+  PERF_END (DriverEntry->ImageHandle, "LoadImage:", NULL, 0);\r
+\r
   //\r
   // Print the load address and the PDB file name if it is available\r
   //\r
@@ -588,7 +622,7 @@ SmmLoadImage (
 \r
 \r
     DEBUG ((DEBUG_INFO | DEBUG_LOAD,\r
-           "Loading driver at 0x%11p EntryPoint=0x%11p ",\r
+           "Loading SMM driver at 0x%11p EntryPoint=0x%11p ",\r
            (VOID *)(UINTN) ImageContext.ImageAddress,\r
            FUNCTION_ENTRY_POINT (ImageContext.EntryPoint)));\r
 \r
@@ -639,15 +673,16 @@ SmmLoadImage (
   // used the UEFI Boot Services AllocatePool() function\r
   //\r
   Status = gBS->FreePool(Buffer);\r
+  if (!EFI_ERROR (Status) && EFI_ERROR (SecurityStatus)) {\r
+    Status = SecurityStatus;\r
+  }\r
   return Status;  \r
 }\r
 \r
 /**\r
   Preprocess dependency expression and update DriverEntry to reflect the\r
-  state of  Before, After, and SOR dependencies. If DriverEntry->Before\r
-  or DriverEntry->After is set it will never be cleared. If SOR is set\r
-  it will be cleared by SmmSchedule(), and then the driver can be\r
-  dispatched.\r
+  state of  Before and After dependencies. If DriverEntry->Before\r
+  or DriverEntry->After is set it will never be cleared. \r
 \r
   @param  DriverEntry           DriverEntry element to update .\r
 \r
@@ -662,11 +697,7 @@ SmmPreProcessDepex (
   UINT8  *Iterator;\r
 \r
   Iterator = DriverEntry->Depex;\r
-  if (*Iterator == EFI_DEP_SOR) {\r
-    DriverEntry->Unrequested = TRUE;\r
-  } else {\r
-    DriverEntry->Dependent = TRUE;\r
-  }\r
+  DriverEntry->Dependent = TRUE;\r
 \r
   if (*Iterator == EFI_DEP_BEFORE) {\r
     DriverEntry->Before = TRUE;\r
@@ -735,8 +766,8 @@ SmmGetDepexSectionAndPreProccess (
     }\r
   } else {\r
     //\r
-    // Set Before, After, and Unrequested state information based on Depex\r
-    // Driver will be put in Dependent or Unrequested state\r
+    // Set Before and After state information based on Depex\r
+    // Driver will be put in Dependent state\r
     //\r
     SmmPreProcessDepex (DriverEntry);\r
     DriverEntry->DepexProtocolError = FALSE;\r
@@ -745,66 +776,20 @@ SmmGetDepexSectionAndPreProccess (
   return Status;\r
 }\r
 \r
-/**\r
-  Check every driver and locate a matching one. If the driver is found, the Unrequested\r
-  state flag is cleared.\r
-\r
-  @param  FirmwareVolumeHandle  The handle of the Firmware Volume that contains\r
-                                the firmware  file specified by DriverName.\r
-  @param  DriverName            The Driver name to put in the Dependent state.\r
-\r
-  @retval EFI_SUCCESS           The DriverName was found and it's SOR bit was\r
-                                cleared\r
-  @retval EFI_NOT_FOUND         The DriverName does not exist or it's SOR bit was\r
-                                not set.\r
-\r
-**/\r
-EFI_STATUS\r
-SmmSchedule (\r
-  IN  EFI_HANDLE  FirmwareVolumeHandle,\r
-  IN  EFI_GUID    *DriverName\r
-  )\r
-{\r
-  LIST_ENTRY            *Link;\r
-  EFI_SMM_DRIVER_ENTRY  *DriverEntry;\r
-\r
-  //\r
-  // Check every driver\r
-  //\r
-  for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {\r
-    DriverEntry = CR(Link, EFI_SMM_DRIVER_ENTRY, Link, EFI_SMM_DRIVER_ENTRY_SIGNATURE);\r
-    if (DriverEntry->FvHandle == FirmwareVolumeHandle &&\r
-        DriverEntry->Unrequested &&\r
-        CompareGuid (DriverName, &DriverEntry->FileName)) {\r
-      //\r
-      // Move the driver from the Unrequested to the Dependent state\r
-      //\r
-      DriverEntry->Unrequested  = FALSE;\r
-      DriverEntry->Dependent    = TRUE;\r
-\r
-      DEBUG ((DEBUG_DISPATCH, "Schedule FFS(%g) - EFI_SUCCESS\n", DriverName));\r
-\r
-      return EFI_SUCCESS;\r
-    }\r
-  }\r
-  \r
-  DEBUG ((DEBUG_DISPATCH, "Schedule FFS(%g) - EFI_NOT_FOUND\n", DriverName));\r
-  \r
-  return EFI_NOT_FOUND;\r
-}\r
-\r
 /**\r
   This is the main Dispatcher for SMM and it exits when there are no more\r
   drivers to run. Drain the mScheduledQueue and load and start a PE\r
   image for each driver. Search the mDiscoveredList to see if any driver can\r
   be placed on the mScheduledQueue. If no drivers are placed on the\r
-  mScheduledQueue exit the function. On exit it is assumed the Bds()\r
-  will be called, and when the Bds() exits the Dispatcher will be called\r
-  again.\r
-\r
+  mScheduledQueue exit the function. \r
+\r
+  @retval EFI_SUCCESS           All of the SMM Drivers that could be dispatched\r
+                                have been run and the SMM Entry Point has been\r
+                                registered.\r
+  @retval EFI_NOT_READY         The SMM Driver that registered the SMM Entry Point\r
+                                was just dispatched.\r
+  @retval EFI_NOT_FOUND         There are no SMM Drivers available to be dispatched.\r
   @retval EFI_ALREADY_STARTED   The SMM Dispatcher is already running\r
-  @retval EFI_NOT_FOUND         No SMM Drivers were dispatched\r
-  @retval EFI_SUCCESS           One or more SMM Drivers were dispatched\r
 \r
 **/\r
 EFI_STATUS\r
@@ -813,10 +798,10 @@ SmmDispatcher (
   )\r
 {\r
   EFI_STATUS            Status;\r
-  EFI_STATUS            ReturnStatus;\r
   LIST_ENTRY            *Link;\r
   EFI_SMM_DRIVER_ENTRY  *DriverEntry;\r
   BOOLEAN               ReadyToRun;\r
+  BOOLEAN               PreviousSmmEntryPointRegistered;\r
 \r
   if (!gRequestDispatch) {\r
     return EFI_NOT_FOUND;\r
@@ -831,7 +816,6 @@ SmmDispatcher (
 \r
   gDispatcherRunning = TRUE;\r
 \r
-  ReturnStatus = EFI_NOT_FOUND;\r
   do {\r
     //\r
     // Drain the Scheduled Queue\r
@@ -856,22 +840,11 @@ SmmDispatcher (
         // Update the driver state to reflect that it's been loaded\r
         //\r
         if (EFI_ERROR (Status)) {\r
-\r
-          if (Status == EFI_SECURITY_VIOLATION) {\r
-            //\r
-            // Take driver from Scheduled to Untrused state\r
-            //\r
-            DriverEntry->Untrusted = TRUE;\r
-          } else {\r
-            //\r
-            // The SMM Driver could not be loaded, and do not attempt to load or start it again.\r
-            // Take driver from Scheduled to Initialized.\r
-            //\r
-            // This case include the Never Trusted state if EFI_ACCESS_DENIED is returned\r
-            //\r
-            DriverEntry->Initialized  = TRUE;\r
-          }\r
-\r
+          //\r
+          // The SMM Driver could not be loaded, and do not attempt to load or start it again.\r
+          // Take driver from Scheduled to Initialized.\r
+          //\r
+          DriverEntry->Initialized  = TRUE;\r
           DriverEntry->Scheduled = FALSE;\r
           RemoveEntryList (&DriverEntry->ScheduledLink);\r
 \r
@@ -893,11 +866,20 @@ SmmDispatcher (
         sizeof (DriverEntry->ImageHandle)\r
         );\r
 \r
+      //\r
+      // Cache state of SmmEntryPointRegistered before calling entry point\r
+      //\r
+      PreviousSmmEntryPointRegistered = gSmmCorePrivate->SmmEntryPointRegistered;\r
+\r
       //\r
       // For each SMM driver, pass NULL as ImageHandle\r
       //\r
+      RegisterSmramProfileImage (DriverEntry, TRUE);\r
+      PERF_START (DriverEntry->ImageHandle, "StartImage:", NULL, 0);\r
       Status = ((EFI_IMAGE_ENTRY_POINT)(UINTN)DriverEntry->ImageEntryPoint)(DriverEntry->ImageHandle, gST);\r
+      PERF_END (DriverEntry->ImageHandle, "StartImage:", NULL, 0);\r
       if (EFI_ERROR(Status)){\r
+        UnregisterSmramProfileImage (DriverEntry, TRUE);\r
         SmmFreePages(DriverEntry->ImageBuffer, DriverEntry->NumberOfPage);\r
       }\r
 \r
@@ -908,7 +890,19 @@ SmmDispatcher (
         sizeof (DriverEntry->ImageHandle)\r
         );\r
 \r
-      ReturnStatus = EFI_SUCCESS;\r
+      if (!PreviousSmmEntryPointRegistered && gSmmCorePrivate->SmmEntryPointRegistered) {\r
+        //\r
+        // Return immediately if the SMM Entry Point was registered by the SMM \r
+        // Driver that was just dispatched.  The SMM IPL will reinvoke the SMM\r
+        // Core Dispatcher.  This is required so SMM Mode may be enabled as soon \r
+        // as all the dependent SMM Drivers for SMM Mode have been dispatched.  \r
+        // Once the SMM Entry Point has been registered, then SMM Mode will be \r
+        // used.\r
+        //\r
+        gRequestDispatch = TRUE;\r
+        gDispatcherRunning = FALSE;\r
+        return EFI_NOT_READY;\r
+      }\r
     }\r
 \r
     //\r
@@ -930,12 +924,6 @@ SmmDispatcher (
           SmmInsertOnScheduledQueueWhileProcessingBeforeAndAfter (DriverEntry);\r
           ReadyToRun = TRUE;\r
         }\r
-      } else {\r
-        if (DriverEntry->Unrequested) {\r
-          DEBUG ((DEBUG_DISPATCH, "Evaluate SMM DEPEX for FFS(%g)\n", &DriverEntry->FileName));\r
-          DEBUG ((DEBUG_DISPATCH, "  SOR                                             = Not Requested\n"));\r
-          DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE\n"));\r
-        }\r
       }\r
     }\r
   } while (ReadyToRun);\r
@@ -958,7 +946,7 @@ SmmDispatcher (
 \r
   gDispatcherRunning = FALSE;\r
 \r
-  return ReturnStatus;\r
+  return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
@@ -1131,7 +1119,7 @@ SmmFvToDevicePath (
 /**\r
   Add an entry to the mDiscoveredList. Allocate memory to store the DriverEntry,\r
   and initilize any state variables. Read the Depex from the FV and store it\r
-  in DriverEntry. Pre-process the Depex to set the SOR, Before and After state.\r
+  in DriverEntry. Pre-process the Depex to set the Before and After state.\r
   The Discovered list is never free'ed and contains booleans that represent the\r
   other possible SMM driver states.\r
 \r
@@ -1216,7 +1204,6 @@ SmmDriverDispatchHandler (
   UINTN                         HandleCount;\r
   EFI_HANDLE                    *HandleBuffer;\r
   EFI_STATUS                    GetNextFileStatus;\r
-  EFI_STATUS                    SecurityStatus;\r
   EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;\r
   EFI_DEVICE_PATH_PROTOCOL      *FvDevicePath;\r
   EFI_HANDLE                    FvHandle;\r
@@ -1277,31 +1264,6 @@ SmmDriverDispatchHandler (
       continue;\r
     }\r
 \r
-    //\r
-    // If the Security Architectural Protocol has not been located yet, then attempt to locate it\r
-    //\r
-    if (mSecurity == NULL) {\r
-      gBS->LocateProtocol (&gEfiSecurityArchProtocolGuid, NULL, (VOID**)&mSecurity);\r
-    }\r
-\r
-    //\r
-    // Evaluate the authentication status of the Firmware Volume through\r
-    // Security Architectural Protocol\r
-    //\r
-    if (mSecurity != NULL) {\r
-      SecurityStatus = mSecurity->FileAuthenticationState (\r
-                                    mSecurity,\r
-                                    0,\r
-                                    FvDevicePath\r
-                                    );\r
-      if (SecurityStatus != EFI_SUCCESS) {\r
-        //\r
-        // Security check failed. The firmware volume should not be used for any purpose.\r
-        //\r
-        continue;\r
-      }\r
-    }\r
-\r
     //\r
     // Discover Drivers in FV and add them to the Discovered Driver List.\r
     // Process EFI_FV_FILETYPE_SMM type and then EFI_FV_FILETYPE_COMBINED_SMM_DXE\r
@@ -1381,7 +1343,34 @@ SmmDriverDispatchHandler (
   // Execute the SMM Dispatcher on any newly discovered FVs and previously \r
   // discovered SMM drivers that have been discovered but not dispatched.\r
   //\r
-  return SmmDispatcher ();\r
+  Status = SmmDispatcher ();\r
+\r
+  //\r
+  // Check to see if CommBuffer and CommBufferSize are valid\r
+  //\r
+  if (CommBuffer != NULL && CommBufferSize != NULL) {\r
+    if (*CommBufferSize > 0) {\r
+      if (Status == EFI_NOT_READY) {\r
+        //\r
+        // If a the SMM Core Entry Point was just registered, then set flag to \r
+        // request the SMM Dispatcher to be restarted.\r
+        //\r
+        *(UINT8 *)CommBuffer = COMM_BUFFER_SMM_DISPATCH_RESTART;\r
+      } else if (!EFI_ERROR (Status)) {\r
+        //\r
+        // Set the flag to show that the SMM Dispatcher executed without errors\r
+        //\r
+        *(UINT8 *)CommBuffer = COMM_BUFFER_SMM_DISPATCH_SUCCESS;\r
+      } else {\r
+        //\r
+        // Set the flag to show that the SMM Dispatcher encountered an error\r
+        //\r
+        *(UINT8 *)CommBuffer = COMM_BUFFER_SMM_DISPATCH_ERROR;\r
+      }\r
+    }\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
 }\r
 \r
 /**\r