ftwlite.h

来自「EFI BIOS是Intel提出的下一代的BIOS标准。这里上传的Edk源代码是」· C头文件 代码 · 共 686 行 · 第 1/2 页

H
686
字号
;

EFI_STATUS
GetFvbByAddress (
  IN  EFI_PHYSICAL_ADDRESS               Address,
  OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvBlock
  )
/*++

Routine Description:

  Get firmware block by address.

Arguments:

  Address - Address specified the block
  FvBlock - The block caller wanted

Returns:

  Status code

  EFI_NOT_FOUND - Block not found

--*/
;

BOOLEAN
IsInWorkingBlock (
  EFI_FTW_LITE_DEVICE                 *FtwLiteDevice,
  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *FvBlock,
  EFI_LBA                             Lba
  )
/*++

Routine Description:

  Is it in working block?

Arguments:

  FtwLiteDevice - Calling context
  FvBlock       - Fvb protocol instance
  Lba           - The block specified

Returns:

  In working block or not

--*/
;

BOOLEAN
IsBootBlock (
  EFI_FTW_LITE_DEVICE                 *FtwLiteDevice,
  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *FvBlock,
  EFI_LBA                             Lba
  )
/*++

Routine Description:

  Check whether the block is a boot block.

Arguments:

  FtwLiteDevice - Calling context
  FvBlock       - Fvb protocol instance
  Lba           - Lba value

Returns:

  Is a boot block or not

--*/
;

EFI_STATUS
FlushSpareBlockToTargetBlock (
  EFI_FTW_LITE_DEVICE                 *FtwLiteDevice,
  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *FvBlock,
  EFI_LBA                             Lba
  )
/*++

Routine Description:
    Copy the content of spare block to a target block. Size is FTW_BLOCK_SIZE.
    Spare block is accessed by FTW backup FVB protocol interface. LBA is 
    FtwLiteDevice->FtwSpareLba.
    Target block is accessed by FvBlock protocol interface. LBA is Lba.

Arguments:
    FtwLiteDevice  - The private data of FTW_LITE driver
    FvBlock        - FVB Protocol interface to access target block
    Lba            - Lba of the target block

Returns:
    EFI_SUCCESS              - Spare block content is copied to target block
    EFI_INVALID_PARAMETER    - Input parameter error
    EFI_OUT_OF_RESOURCES     - Allocate memory error
    EFI_ABORTED              - The function could not complete successfully

--*/
;

EFI_STATUS
FlushSpareBlockToWorkingBlock (
  EFI_FTW_LITE_DEVICE                 *FtwLiteDevice
  )
/*++

Routine Description:
    Copy the content of spare block to working block. Size is FTW_BLOCK_SIZE.
    Spare block is accessed by FTW backup FVB protocol interface. LBA is 
    FtwLiteDevice->FtwSpareLba.
    Working block is accessed by FTW working FVB protocol interface. LBA is 
    FtwLiteDevice->FtwWorkBlockLba.

Arguments:
    FtwLiteDevice  - The private data of FTW_LITE driver

Returns:
    EFI_SUCCESS              - Spare block content is copied to target block
    EFI_OUT_OF_RESOURCES     - Allocate memory error
    EFI_ABORTED              - The function could not complete successfully

Notes:
    Since the working block header is important when FTW initializes, the 
    state of the operation should be handled carefully. The Crc value is 
    calculated without STATE element. 

--*/
;

EFI_STATUS
FlushSpareBlockToBootBlock (
  EFI_FTW_LITE_DEVICE                 *FtwLiteDevice
  )
/*++

Routine Description:
    Copy the content of spare block to a boot block. Size is FTW_BLOCK_SIZE.
    Spare block is accessed by FTW backup FVB protocol interface. LBA is 
    FtwLiteDevice->FtwSpareLba.
    Boot block is accessed by BootFvb protocol interface. LBA is 0.

Arguments:
    FtwLiteDevice  - The private data of FTW_LITE driver

Returns:
    EFI_SUCCESS              - Spare block content is copied to boot block
    EFI_INVALID_PARAMETER    - Input parameter error
    EFI_OUT_OF_RESOURCES     - Allocate memory error
    EFI_ABORTED              - The function could not complete successfully

Notes:

--*/
;

EFI_STATUS
FtwUpdateFvState (
  IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *FvBlock,
  IN EFI_LBA                             Lba,
  IN UINTN                               Offset,
  IN UINT8                               NewBit
  )
/*++

Routine Description:
    Update a bit of state on a block device. The location of the bit is 
    calculated by the (Lba, Offset, bit). Here bit is determined by the 
    the name of a certain bit.

Arguments:
    FvBlock    - FVB Protocol interface to access SrcBlock and DestBlock
    Lba        - Lba of a block
    Offset     - Offset on the Lba
    NewBit     - New value that will override the old value if it can be change

Returns:
    EFI_SUCCESS   - A state bit has been updated successfully
    Others        - Access block device error.

Notes:
    Assume all bits of State are inside the same BYTE. 

    EFI_ABORTED   - Read block fail
--*/
;

EFI_STATUS
FtwGetLastRecord (
  IN  EFI_FTW_LITE_DEVICE  *FtwLiteDevice,
  OUT EFI_FTW_LITE_RECORD  **FtwLastRecord
  )
/*++

Routine Description:
    Get the last Write record pointer. 
    The last record is the record whose 'complete' state hasn't been set.
    After all, this header may be a EMPTY header entry for next Allocate. 

Arguments:
    FtwLiteDevice   - Private data of this driver
    FtwLastRecord   - Pointer to retrieve the last write record

Returns:
    EFI_SUCCESS     - Get the last write record successfully
    EFI_ABORTED     - The FTW work space is damaged

--*/
;

BOOLEAN
IsErasedFlashBuffer (
  IN BOOLEAN         Polarity,
  IN UINT8           *Buffer,
  IN UINTN           BufferSize
  )
/*++

Routine Description:

  Check whether a flash buffer is erased.

Arguments:

  Polarity    - All 1 or all 0
  Buffer      - Buffer to check
  BufferSize  - Size of the buffer

Returns:

  Erased or not.

--*/
;

EFI_STATUS
InitWorkSpaceHeader (
  IN EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *WorkingHeader
  )
/*++

Routine Description:
    Initialize a work space when there is no work space.

Arguments:
    WorkingHeader - Pointer of working block header 

Returns:
    EFI_SUCCESS   - The function completed successfully
    EFI_ABORTED   - The function could not complete successfully.

--*/
;

EFI_STATUS
WorkSpaceRefresh (
  IN EFI_FTW_LITE_DEVICE  *FtwLiteDevice
  )
/*++

Routine Description:
    Read from working block to refresh the work space in memory.

Arguments:
    FtwLiteDevice     - Point to private data of FTW driver

Returns:
    EFI_SUCCESS   - The function completed successfully
    EFI_ABORTED   - The function could not complete successfully.

--*/
;

BOOLEAN
IsValidWorkSpace (
  IN EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *WorkingHeader
  )
/*++

Routine Description:
    Check to see if it is a valid work space.

Arguments:
    WorkingHeader - Pointer of working block header 

Returns:
    EFI_SUCCESS   - The function completed successfully
    EFI_ABORTED   - The function could not complete successfully.

--*/
;

EFI_STATUS
CleanupWorkSpace (
  IN EFI_FTW_LITE_DEVICE  *FtwLiteDevice,
  IN OUT UINT8            *BlockBuffer,
  IN UINTN                BufferSize
  )
/*++

Routine Description:
    Reclaim the work space. Get rid of all the completed write records
    and write records in the Fault Tolerant work space.

Arguments:
    FtwLiteDevice   - Point to private data of FTW driver
    FtwSpaceBuffer  - Buffer to contain the reclaimed clean data
    BufferSize      - Size of the FtwSpaceBuffer

Returns:
    EFI_SUCCESS           - The function completed successfully
    EFI_BUFFER_TOO_SMALL  - The FtwSpaceBuffer is too small
    EFI_ABORTED           - The function could not complete successfully.

--*/
;

EFI_STATUS
FtwReclaimWorkSpace (
  IN EFI_FTW_LITE_DEVICE  *FtwLiteDevice
  )
/*++

Routine Description:
    Reclaim the work space on the working block.

Arguments:
    FtwLiteDevice     - Point to private data of FTW driver

Returns:
    EFI_SUCCESS           - The function completed successfully
    EFI_OUT_OF_RESOURCES  - Allocate memory error
    EFI_ABORTED           - The function could not complete successfully

--*/
;

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?