/* SMM Firmware Volume Block Protocol notification event handler. */
EFI_STATUS EFIAPI FvbNotificationEvent(IN CONST EFI_GUID *Protocol, IN VOID *Interface, IN EFI_HANDLE Handle)
/* SMM Firmware Volume Block Protocol notification event handler. */
EFI_STATUS EFIAPI FvbNotificationEvent(IN CONST EFI_GUID *Protocol, IN VOID *Interface, IN EFI_HANDLE Handle)
{
  EFI_STATUS                             Status;
  EFI_SMM_FAULT_TOLERANT_WRITE_PROTOCOL  *FtwProtocol;
  EFI_HANDLE                             SmmFtwHandle;
  Status = gMmst->MmLocateProtocol (
                    &gEfiSmmFaultTolerantWriteProtocolGuid,
                    NULL,
                    (VOID **)&FtwProtocol
                    );
  if (!EFI_ERROR (Status)) {
    return EFI_SUCCESS;
  }
  Status = InitFtwProtocol (mFtwDevice);
  if (EFI_ERROR (Status)) {
    return Status;
  }
  Status = gMmst->MmInstallProtocolInterface (
                    &mFtwDevice->Handle,
                    &gEfiSmmFaultTolerantWriteProtocolGuid,
                    EFI_NATIVE_INTERFACE,
                    &mFtwDevice->FtwInstance
                    );
  ASSERT_EFI_ERROR (Status);
  Status = gMmst->MmiHandlerRegister (SmmFaultTolerantWriteHandler, &gEfiSmmFaultTolerantWriteProtocolGuid, &SmmFtwHandle);
  ASSERT_EFI_ERROR (Status);
  FtwNotifySmmReady ();
  return EFI_SUCCESS;
}