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

Go to the source code of this file.

Functions

VOID InitializeLocalWorkSpaceHeader (IN UINTN WorkSpaceLength)
 
BOOLEAN IsValidWorkSpace (IN EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *WorkingHeader)
 
EFI_STATUS InitWorkSpaceHeader (IN EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *WorkingHeader)
 
EFI_STATUS ReadWorkSpaceData (IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock, IN UINTN BlockSize, IN EFI_LBA Lba, IN UINTN Offset, IN UINTN Length, OUT UINT8 *Buffer)
 
EFI_STATUS WriteWorkSpaceData (IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock, IN UINTN BlockSize, IN EFI_LBA Lba, IN UINTN Offset, IN UINTN Length, IN UINT8 *Buffer)
 
EFI_STATUS WorkSpaceRefresh (IN EFI_FTW_DEVICE *FtwDevice)
 
EFI_STATUS FtwReclaimWorkSpace (IN EFI_FTW_DEVICE *FtwDevice, IN BOOLEAN PreserveRecord)
 

Variables

EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER mWorkingBlockHeader = { ZERO_GUID, 0, 0, 0, 0, { 0, 0, 0 }, 0 }
 

Detailed Description

Internal functions to operate Working Block Space.

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

Definition in file UpdateWorkingBlock.c.

Function Documentation

◆ FtwReclaimWorkSpace()

EFI_STATUS FtwReclaimWorkSpace ( IN EFI_FTW_DEVICE FtwDevice,
IN BOOLEAN  PreserveRecord 
)

Reclaim the work space on the working block.

Parameters
FtwDevicePoint to private data of FTW driver
PreserveRecordWhether to preserve the working record is needed
Return values
EFI_SUCCESSThe function completed successfully
EFI_OUT_OF_RESOURCESAllocate memory error
EFI_ABORTEDThe function could not complete successfully

Definition at line 366 of file UpdateWorkingBlock.c.

◆ InitializeLocalWorkSpaceHeader()

VOID InitializeLocalWorkSpaceHeader ( IN UINTN  WorkSpaceLength)

Initialize a local work space header.

Since Signature and WriteQueueSize have been known, Crc can be calculated out, then the work space header will be fixed.

Parameters
[in]WorkSpaceLengthLength in bytes of the FTW workspace area.

Definition at line 24 of file UpdateWorkingBlock.c.

◆ InitWorkSpaceHeader()

EFI_STATUS InitWorkSpaceHeader ( IN EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER WorkingHeader)

Initialize a work space when there is no work space.

Parameters
WorkingHeaderPointer of working block header
Return values
EFI_SUCCESSThe function completed successfully
EFI_ABORTEDThe function could not complete successfully.

Definition at line 107 of file UpdateWorkingBlock.c.

◆ IsValidWorkSpace()

BOOLEAN IsValidWorkSpace ( IN EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER WorkingHeader)

Check to see if it is a valid work space.

Parameters
WorkingHeaderPointer of working block header
Return values
TRUEThe work space is valid.
FALSEThe work space is invalid.

Definition at line 81 of file UpdateWorkingBlock.c.

◆ ReadWorkSpaceData()

EFI_STATUS ReadWorkSpaceData ( IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FvBlock,
IN UINTN  BlockSize,
IN EFI_LBA  Lba,
IN UINTN  Offset,
IN UINTN  Length,
OUT UINT8 *  Buffer 
)

Read work space data from work block or spare block.

Parameters
FvBlockFVB Protocol interface to access the block.
BlockSizeThe size of the block.
LbaLba of the block.
OffsetThe offset within the block.
LengthThe number of bytes to read from the block.
BufferThe data is read.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_ABORTEDThe function could not complete successfully.

Definition at line 135 of file UpdateWorkingBlock.c.

◆ WorkSpaceRefresh()

EFI_STATUS WorkSpaceRefresh ( IN EFI_FTW_DEVICE FtwDevice)

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

Parameters
FtwDevicePoint to private data of FTW driver
Return values
EFI_SUCCESSThe function completed successfully
EFI_ABORTEDThe function could not complete successfully.

Definition at line 258 of file UpdateWorkingBlock.c.

◆ WriteWorkSpaceData()

EFI_STATUS WriteWorkSpaceData ( IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FvBlock,
IN UINTN  BlockSize,
IN EFI_LBA  Lba,
IN UINTN  Offset,
IN UINTN  Length,
IN UINT8 *  Buffer 
)

Write work space data to work block.

Parameters
FvBlockFVB Protocol interface to access the block.
BlockSizeThe size of the block.
LbaLba of the block.
OffsetThe offset within the block to place the data.
LengthThe number of bytes to write to the block.
BufferThe data to write.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_ABORTEDThe function could not complete successfully.

Definition at line 199 of file UpdateWorkingBlock.c.

Variable Documentation

◆ mWorkingBlockHeader

EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER mWorkingBlockHeader = { ZERO_GUID, 0, 0, 0, 0, { 0, 0, 0 }, 0 }

Definition at line 12 of file UpdateWorkingBlock.c.