/* Software SMI handler that is called when an Exit Boot Services event is signalled. Then the SMM Core also install SMM Exit Boot Services protocol to notify SMM driver that system enter exit boot services. */
EFI_STATUS EFIAPI SmmExitBootServicesHandler(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
/* Software SMI handler that is called when an Exit Boot Services event is signalled. Then the SMM Core also install SMM Exit Boot Services protocol to notify SMM driver that system enter exit boot services. */
EFI_STATUS EFIAPI SmmExitBootServicesHandler(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
{
  EFI_STATUS  Status;
  EFI_HANDLE  SmmHandle;
  UINTN       Index;
  SmmHandle = NULL;
  Status    = SmmInstallProtocolInterface (
                &SmmHandle,
                &gEdkiiSmmExitBootServicesProtocolGuid,
                EFI_NATIVE_INTERFACE,
                NULL
                );
  SmiHandlerUnRegister (DispatchHandle);
  for (Index = 0; mSmmCoreSmiHandlers[Index].HandlerType != NULL; Index++) {
    if (CompareGuid (mSmmCoreSmiHandlers[Index].HandlerType, &gEfiEventLegacyBootGuid)) {
      SmiHandlerUnRegister (mSmmCoreSmiHandlers[Index].DispatchHandle);
      break;
    }
  }
  return Status;
}