Exemplo n.º 1
0
/**
  SMM Firmware Volume Block Protocol notification event handler.
  
  @param[in]  Protocol      Points to the protocol's unique identifier
  @param[in]  Interface     Points to the interface instance
  @param[in]  Handle        The handle on which the interface was installed

  @retval EFI_SUCCESS       SmmEventCallback runs successfully
  
 **/
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;
  
  //
  // Just return to avoid install SMM FaultTolerantWriteProtocol again
  // if SMM Fault Tolerant Write protocol had been installed.
  //  
  Status = gSmst->SmmLocateProtocol (
                    &gEfiSmmFaultTolerantWriteProtocolGuid, 
                    NULL, 
                    (VOID **) &FtwProtocol
                    );
  if (!EFI_ERROR (Status)) {
    return EFI_SUCCESS;
  }

  //
  // Found proper FVB protocol and initialize FtwDevice for protocol installation
  //
  Status = InitFtwProtocol (mFtwDevice);
  if (EFI_ERROR(Status)) {
    return Status;
  }
  
  //
  // Install protocol interface
  //
  Status = gSmst->SmmInstallProtocolInterface (
                    &mFtwDevice->Handle,
                    &gEfiSmmFaultTolerantWriteProtocolGuid,
                    EFI_NATIVE_INTERFACE,
                    &mFtwDevice->FtwInstance
                    );
  ASSERT_EFI_ERROR (Status); 

  //
  // Notify the Ftw wrapper driver SMM Ftw is ready
  //
  SmmFtwHandle = NULL;
  Status = gBS->InstallProtocolInterface (
                  &SmmFtwHandle,
                  &gEfiSmmFaultTolerantWriteProtocolGuid,
                  EFI_NATIVE_INTERFACE,
                  NULL
                  );
  ASSERT_EFI_ERROR (Status);
  
  return EFI_SUCCESS;
}
Exemplo n.º 2
0
/**
  Firmware Volume Block Protocol notification event handler.

  @param[in] Event    Event whose notification function is being invoked.
  @param[in] Context  Pointer to the notification function's context.

**/
VOID
EFIAPI
FvbNotificationEvent (
  IN  EFI_EVENT                           Event,
  IN  VOID                                *Context
  )
{
  EFI_STATUS                              Status;
  EFI_FAULT_TOLERANT_WRITE_PROTOCOL       *FtwProtocol;
  EFI_FTW_DEVICE                          *FtwDevice;

  //
  // Just return to avoid installing FaultTolerantWriteProtocol again
  // if Fault Tolerant Write protocol has been installed.
  //
  Status = gBS->LocateProtocol (
                  &gEfiFaultTolerantWriteProtocolGuid,
                  NULL,
                  (VOID **) &FtwProtocol
                  );
  if (!EFI_ERROR (Status)) {
    return ;
  }

  //
  // Found proper FVB protocol and initialize FtwDevice for protocol installation
  //
  FtwDevice = (EFI_FTW_DEVICE *)Context;
  Status = InitFtwProtocol (FtwDevice);
  if (EFI_ERROR(Status)) {
    return ;
  }

  //
  // Install protocol interface
  //
  Status = gBS->InstallProtocolInterface (
                  &FtwDevice->Handle,
                  &gEfiFaultTolerantWriteProtocolGuid,
                  EFI_NATIVE_INTERFACE,
                  &FtwDevice->FtwInstance
                  );
  ASSERT_EFI_ERROR (Status);

  Status = gBS->CloseEvent (Event);
  ASSERT_EFI_ERROR (Status);

  return;
}