TianoCore EDK2 master
Loading...
Searching...
No Matches
FaultTolerantWrite.c File Reference

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI FtwGetMaxBlockSize (IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This, OUT UINTN *BlockSize)
 
EFI_STATUS EFIAPI FtwAllocate (IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This, IN EFI_GUID *CallerId, IN UINTN PrivateDataSize, IN UINTN NumberOfWrites)
 
EFI_STATUS FtwWriteRecord (IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This, IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb, IN UINTN BlockSize)
 
EFI_STATUS EFIAPI FtwWrite (IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This, IN EFI_LBA Lba, IN UINTN Offset, IN UINTN Length, IN VOID *PrivateData, IN EFI_HANDLE FvBlockHandle, IN VOID *Buffer)
 
EFI_STATUS EFIAPI FtwRestart (IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This, IN EFI_HANDLE FvBlockHandle)
 
EFI_STATUS EFIAPI FtwAbort (IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This)
 
EFI_STATUS EFIAPI FtwGetLastWrite (IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This, OUT EFI_GUID *CallerId, OUT EFI_LBA *Lba, OUT UINTN *Offset, OUT UINTN *Length, IN OUT UINTN *PrivateDataSize, OUT VOID *PrivateData, OUT BOOLEAN *Complete)
 

Detailed Description

These are the common Fault Tolerant Write (FTW) functions that are shared by DXE FTW driver and SMM FTW driver.

Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file FaultTolerantWrite.c.

Function Documentation

◆ FtwAbort()

EFI_STATUS EFIAPI FtwAbort ( IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL This)

Aborts all previous allocated writes.

Parameters
ThisThe pointer to this protocol instance.
Return values
EFI_SUCCESSThe function completed successfully
EFI_ABORTEDThe function could not complete successfully.
EFI_NOT_FOUNDNo allocated writes exist.

Definition at line 750 of file FaultTolerantWrite.c.

◆ FtwAllocate()

EFI_STATUS EFIAPI FtwAllocate ( IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL This,
IN EFI_GUID CallerId,
IN UINTN  PrivateDataSize,
IN UINTN  NumberOfWrites 
)

Allocates space for the protocol to maintain information about writes. Since writes must be completed in a fault tolerant manner and multiple updates will require more resources to be successful, this function enables the protocol to ensure that enough space exists to track information about the upcoming writes.

All writes must be completed or aborted before another fault tolerant write can occur.

Parameters
ThisThe pointer to this protocol instance.
CallerIdThe GUID identifying the write.
PrivateDataSizeThe size of the caller's private data that must be recorded for each write.
NumberOfWritesThe number of fault tolerant block writes that will need to occur.
Returns
EFI_SUCCESS The function completed successfully
Return values
EFI_ABORTEDThe function could not complete successfully.
EFI_ACCESS_DENIEDAll allocated writes have not been completed.

Definition at line 71 of file FaultTolerantWrite.c.

◆ FtwGetLastWrite()

EFI_STATUS EFIAPI FtwGetLastWrite ( IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL This,
OUT EFI_GUID CallerId,
OUT EFI_LBA Lba,
OUT UINTN Offset,
OUT UINTN Length,
IN OUT UINTN PrivateDataSize,
OUT VOID *  PrivateData,
OUT BOOLEAN *  Complete 
)

Starts a target block update. This records information about the write in fault tolerant storage and will complete the write in a recoverable manner, ensuring at all times that either the original contents or the modified contents are available.

Parameters
ThisThe pointer to this protocol instance.
CallerIdThe GUID identifying the last write.
LbaThe logical block address of the last write.
OffsetThe offset within the block of the last write.
LengthThe length of the last write.
PrivateDataSizebytes from the private data stored for this write.
PrivateDataA pointer to a buffer. The function will copy
CompleteA Boolean value with TRUE indicating that the write was completed.
Return values
EFI_SUCCESSThe function completed successfully
EFI_ABORTEDThe function could not complete successfully
EFI_NOT_FOUNDNo allocated writes exist
EFI_BUFFER_TOO_SMALLInput buffer is not larget enough

Definition at line 819 of file FaultTolerantWrite.c.

◆ FtwGetMaxBlockSize()

EFI_STATUS EFIAPI FtwGetMaxBlockSize ( IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL This,
OUT UINTN BlockSize 
)

Query the largest block that may be updated in a fault tolerant manner.

Parameters
ThisThe pointer to this protocol instance.
BlockSizeA pointer to a caller allocated UINTN that is updated to indicate the size of the largest block that can be updated.
Returns
EFI_SUCCESS The function completed successfully

Definition at line 30 of file FaultTolerantWrite.c.

◆ FtwRestart()

EFI_STATUS EFIAPI FtwRestart ( IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL This,
IN EFI_HANDLE  FvBlockHandle 
)

Restarts a previously interrupted write. The caller must provide the block protocol needed to complete the interrupted write.

Parameters
ThisThe pointer to this protocol instance.
FvBlockHandleThe handle of FVB protocol that provides services for reading, writing, and erasing the target block.
Return values
EFI_SUCCESSThe function completed successfully
EFI_ACCESS_DENIEDNo pending writes exist
EFI_NOT_FOUNDFVB protocol not found by the handle
EFI_ABORTEDThe function could not complete successfully

Definition at line 657 of file FaultTolerantWrite.c.

◆ FtwWrite()

EFI_STATUS EFIAPI FtwWrite ( IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL This,
IN EFI_LBA  Lba,
IN UINTN  Offset,
IN UINTN  Length,
IN VOID *  PrivateData,
IN EFI_HANDLE  FvBlockHandle,
IN VOID *  Buffer 
)

Starts a target block update. This function will record data about write in fault tolerant storage and will complete the write in a recoverable manner, ensuring at all times that either the original contents or the modified contents are available.

Parameters
ThisThe pointer to this protocol instance.
LbaThe logical block address of the target block.
OffsetThe offset within the target block to place the data.
LengthThe number of bytes to write to the target block.
PrivateDataA pointer to private data that the caller requires to complete any pending writes in the event of a fault.
FvBlockHandleThe handle of FVB protocol that provides services for reading, writing, and erasing the target block.
BufferThe data to write.
Return values
EFI_SUCCESSThe function completed successfully
EFI_ABORTEDThe function could not complete successfully.
EFI_BAD_BUFFER_SIZEThe input data can't fit within the spare block. Offset + *NumBytes > SpareAreaLength.
EFI_ACCESS_DENIEDNo writes have been allocated.
EFI_OUT_OF_RESOURCESCannot allocate enough memory resource.
EFI_NOT_FOUNDCannot find FVB protocol by handle.

Definition at line 313 of file FaultTolerantWrite.c.

◆ FtwWriteRecord()

EFI_STATUS FtwWriteRecord ( IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL This,
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL Fvb,
IN UINTN  BlockSize 
)

Write a record with fault tolerant manner. Since the content has already backuped in spare block, the write is guaranteed to be completed with fault tolerant manner.

Parameters
ThisThe pointer to this protocol instance.
FvbThe FVB protocol that provides services for reading, writing, and erasing the target block.
BlockSizeThe size of the block.
Return values
EFI_SUCCESSThe function completed successfully
EFI_ABORTEDThe function could not complete successfully

Definition at line 186 of file FaultTolerantWrite.c.