-/*++\r
+/** @file\r
\r
-Copyright (c) 2006, Intel Corporation \r
+ The internal header file includes the common header files, defines\r
+ internal structure and functions used by FtwLite module.\r
+\r
+Copyright (c) 2006 - 2008, Intel Corporation \r
All rights reserved. This program and the accompanying materials \r
are licensed and made available under the terms and conditions of the BSD License \r
which accompanies this distribution. The full text of the license may be found at \r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
\r
-\r
-Module Name:\r
-\r
- FtwLite.h\r
-\r
-Abstract:\r
-\r
- This is a simple fault tolerant write driver, based on PlatformFd library.\r
- And it only supports write BufferSize <= SpareAreaLength.\r
-\r
- This boot service only protocol provides fault tolerant write capability for \r
- block devices. The protocol has internal non-volatile intermediate storage \r
- of the data and private information. It should be able to recover \r
- automatically from a critical fault, such as power failure. \r
-\r
---*/\r
+**/\r
\r
#ifndef _EFI_FAULT_TOLERANT_WRITE_LITE_H_\r
#define _EFI_FAULT_TOLERANT_WRITE_LITE_H_\r
#include <Library/MemoryAllocationLib.h>\r
#include <Library/UefiBootServicesTableLib.h>\r
\r
-#include <Common/WorkingBlockHeader.h>\r
+#include <WorkingBlockHeader.h>\r
\r
#define EFI_D_FTW_LITE EFI_D_ERROR\r
#define EFI_D_FTW_INFO EFI_D_INFO\r
//\r
// Driver entry point\r
//\r
+/**\r
+ This function is the entry point of the Fault Tolerant Write driver.\r
+\r
+\r
+ @param ImageHandle EFI_HANDLE: A handle for the image that is initializing\r
+ this driver\r
+ @param SystemTable EFI_SYSTEM_TABLE: A pointer to the EFI system table\r
+\r
+ @retval EFI_SUCCESS FTW has finished the initialization\r
+ @retval EFI_ABORTED FTW initialization error\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
InitializeFtwLite (\r
IN EFI_HANDLE ImageHandle,\r
IN EFI_SYSTEM_TABLE *SystemTable\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- This function is the entry point of the Fault Tolerant Write driver.\r
-\r
-Arguments:\r
- ImageHandle - EFI_HANDLE: A handle for the image that is initializing \r
- this driver\r
- SystemTable - EFI_SYSTEM_TABLE: A pointer to the EFI system table\r
-\r
-Returns:\r
- EFI_SUCCESS - FTW has finished the initialization\r
- EFI_ABORTED - FTW initialization error\r
-\r
---*/\r
-;\r
+ );\r
\r
//\r
// Fault Tolerant Write Protocol API\r
//\r
+/**\r
+ Starts a target block update. This function will record data about write\r
+ in fault tolerant storage and will complete the write in a recoverable\r
+ manner, ensuring at all times that either the original contents or\r
+ the modified contents are available.\r
+\r
+\r
+ @param This Calling context\r
+ @param FvbHandle The handle of FVB protocol that provides services for\r
+ reading, writing, and erasing the target block.\r
+ @param Lba The logical block address of the target block.\r
+ @param Offset The offset within the target block to place the data.\r
+ @param NumBytes The number of bytes to write to the target block.\r
+ @param Buffer The data to write.\r
+\r
+ @retval EFI_SUCCESS The function completed successfully\r
+ @retval EFI_BAD_BUFFER_SIZE The write would span a target block, which is not\r
+ a valid action.\r
+ @retval EFI_ACCESS_DENIED No writes have been allocated.\r
+ @retval EFI_NOT_FOUND Cannot find FVB by handle.\r
+ @retval EFI_OUT_OF_RESOURCES Cannot allocate memory.\r
+ @retval EFI_ABORTED The function could not complete successfully.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
FtwLiteWrite (\r
- IN EFI_FTW_LITE_PROTOCOL *This,\r
- IN EFI_HANDLE FvbHandle,\r
- IN EFI_LBA Lba,\r
- IN UINTN Offset,\r
- IN UINTN *NumBytes,\r
- IN VOID *Buffer\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Starts a target block update. This function will record data about write \r
- in fault tolerant storage and will complete the write in a recoverable \r
- manner, ensuring at all times that either the original contents or \r
- the modified contents are available.\r
-\r
-Arguments:\r
- This - Calling context\r
- FvbHandle - The handle of FVB protocol that provides services for \r
- reading, writing, and erasing the target block.\r
- Lba - The logical block address of the target block. \r
- Offset - The offset within the target block to place the data.\r
- NumBytes - The number of bytes to write to the target block.\r
- Buffer - The data to write.\r
-\r
-Returns:\r
- EFI_SUCCESS - The function completed successfully\r
- EFI_BAD_BUFFER_SIZE - The write would span a target block, which is not \r
- a valid action.\r
- EFI_ACCESS_DENIED - No writes have been allocated.\r
- EFI_NOT_FOUND - Cannot find FVB by handle.\r
- EFI_OUT_OF_RESOURCES - Cannot allocate memory.\r
- EFI_ABORTED - The function could not complete successfully.\r
-\r
---*/\r
-;\r
+ IN EFI_FTW_LITE_PROTOCOL *This,\r
+ IN EFI_HANDLE FvbHandle,\r
+ IN EFI_LBA Lba,\r
+ IN UINTN Offset,\r
+ IN OUT UINTN *NumBytes,\r
+ IN VOID *Buffer\r
+ );\r
\r
//\r
// Internal functions\r
//\r
+/**\r
+ Restarts a previously interrupted write. The caller must provide the\r
+ block protocol needed to complete the interrupted write.\r
+\r
+\r
+ @param FtwLiteDevice The private data of FTW_LITE driver\r
+ FvbHandle - The handle of FVB protocol that provides services for\r
+ reading, writing, and erasing the target block.\r
+\r
+ @retval EFI_SUCCESS The function completed successfully\r
+ @retval EFI_ACCESS_DENIED No pending writes exist\r
+ @retval EFI_NOT_FOUND FVB protocol not found by the handle\r
+ @retval EFI_ABORTED The function could not complete successfully\r
+\r
+**/\r
EFI_STATUS\r
FtwRestart (\r
IN EFI_FTW_LITE_DEVICE *FtwLiteDevice\r
- )\r
-/*++\r
+ );\r
\r
-Routine Description:\r
- Restarts a previously interrupted write. The caller must provide the \r
- block protocol needed to complete the interrupted write.\r
+/**\r
+ Aborts all previous allocated writes.\r
\r
-Arguments:\r
- FtwLiteDevice - The private data of FTW_LITE driver\r
- FvbHandle - The handle of FVB protocol that provides services for \r
- reading, writing, and erasing the target block.\r
\r
-Returns:\r
- EFI_SUCCESS - The function completed successfully\r
- EFI_ACCESS_DENIED - No pending writes exist\r
- EFI_NOT_FOUND - FVB protocol not found by the handle\r
- EFI_ABORTED - The function could not complete successfully\r
+ @param FtwLiteDevice The private data of FTW_LITE driver\r
\r
---*/\r
-;\r
+ @retval EFI_SUCCESS The function completed successfully\r
+ @retval EFI_ABORTED The function could not complete successfully.\r
+ @retval EFI_NOT_FOUND No allocated writes exist.\r
\r
+**/\r
EFI_STATUS\r
FtwAbort (\r
IN EFI_FTW_LITE_DEVICE *FtwLiteDevice\r
- )\r
-/*++\r
+ );\r
\r
-Routine Description:\r
- Aborts all previous allocated writes.\r
\r
-Arguments:\r
- FtwLiteDevice - The private data of FTW_LITE driver\r
+/**\r
+ Write a record with fault tolerant mannaer.\r
+ Since the content has already backuped in spare block, the write is\r
+ guaranteed to be completed with fault tolerant manner.\r
\r
-Returns:\r
- EFI_SUCCESS - The function completed successfully\r
- EFI_ABORTED - The function could not complete successfully.\r
- EFI_NOT_FOUND - No allocated writes exist.\r
\r
---*/\r
-;\r
+ @param FtwLiteDevice The private data of FTW_LITE driver\r
+ @param Fvb The FVB protocol that provides services for\r
+ reading, writing, and erasing the target block.\r
\r
+ @retval EFI_SUCCESS The function completed successfully\r
+ @retval EFI_ABORTED The function could not complete successfully\r
\r
+**/\r
EFI_STATUS\r
FtwWriteRecord (\r
IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,\r
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb\r
- )\r
-/*++\r
+ );\r
\r
-Routine Description:\r
- Write a record with fault tolerant mannaer.\r
- Since the content has already backuped in spare block, the write is \r
- guaranteed to be completed with fault tolerant manner.\r
+/**\r
+ To Erase one block. The size is FTW_BLOCK_SIZE\r
\r
-Arguments:\r
- FtwLiteDevice - The private data of FTW_LITE driver\r
- Fvb - The FVB protocol that provides services for \r
- reading, writing, and erasing the target block.\r
\r
-Returns:\r
- EFI_SUCCESS - The function completed successfully\r
- EFI_ABORTED - The function could not complete successfully\r
+ @param FtwLiteDevice Calling context\r
+ @param FvBlock FVB Protocol interface\r
+ @param Lba Lba of the firmware block\r
\r
---*/\r
-;\r
+ @retval EFI_SUCCESS Block LBA is Erased successfully\r
+ @retval Others Error occurs\r
\r
+**/\r
EFI_STATUS\r
FtwEraseBlock (\r
IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,\r
EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,\r
EFI_LBA Lba\r
- )\r
-/*++\r
+ );\r
+\r
+/**\r
\r
-Routine Description:\r
- To Erase one block. The size is FTW_BLOCK_SIZE\r
+ Erase spare block.\r
\r
-Arguments:\r
- FtwLiteDevice - Calling context\r
- FvBlock - FVB Protocol interface\r
- Lba - Lba of the firmware block\r
\r
-Returns:\r
- EFI_SUCCESS - Block LBA is Erased successfully\r
- Others - Error occurs\r
+ @param FtwLiteDevice Calling context\r
\r
---*/\r
-;\r
+ @retval EFI_SUCCESS The erase request was successfully\r
+ completed.\r
+ \r
+ @retval EFI_ACCESS_DENIED The firmware volume is in the\r
+ WriteDisabled state.\r
+ @retval EFI_DEVICE_ERROR The block device is not functioning\r
+ correctly and could not be written.\r
+ The firmware device may have been\r
+ partially erased.\r
+ @retval EFI_INVALID_PARAMETER One or more of the LBAs listed\r
+ in the variable argument list do\r
+ not exist in the firmware volume. \r
\r
+**/\r
EFI_STATUS\r
FtwEraseSpareBlock (\r
IN EFI_FTW_LITE_DEVICE *FtwLiteDevice\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Erase spare block.\r
+ );\r
\r
-Arguments:\r
+/**\r
+ Retrive the proper FVB protocol interface by HANDLE.\r
\r
- FtwLiteDevice - Calling context\r
\r
-Returns:\r
+ @param FvBlockHandle The handle of FVB protocol that provides services for\r
+ reading, writing, and erasing the target block.\r
+ @param FvBlock The interface of FVB protocol\r
\r
- Status code\r
-\r
---*/\r
-;\r
+ @retval EFI_SUCCESS The function completed successfully\r
+ @retval EFI_ABORTED The function could not complete successfully\r
\r
+**/\r
EFI_STATUS\r
FtwGetFvbByHandle (\r
IN EFI_HANDLE FvBlockHandle,\r
OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvBlock\r
- )\r
-/*++\r
+ );\r
+\r
+/**\r
+\r
+ Get firmware block by address.\r
\r
-Routine Description:\r
- Retrive the proper FVB protocol interface by HANDLE.\r
\r
-Arguments:\r
- FvBlockHandle - The handle of FVB protocol that provides services for \r
- reading, writing, and erasing the target block.\r
- FvBlock - The interface of FVB protocol\r
+ @param Address Address specified the block\r
+ @param FvBlock The block caller wanted\r
\r
-Returns:\r
- EFI_SUCCESS - The function completed successfully\r
- EFI_ABORTED - The function could not complete successfully\r
---*/\r
-;\r
+ @retval EFI_SUCCESS The protocol instance if found.\r
+ @retval EFI_NOT_FOUND Block not found\r
\r
+**/\r
EFI_STATUS\r
GetFvbByAddress (\r
IN EFI_PHYSICAL_ADDRESS Address,\r
OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvBlock\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Get firmware block by address.\r
-\r
-Arguments:\r
+ );\r
\r
- Address - Address specified the block\r
- FvBlock - The block caller wanted\r
+/**\r
\r
-Returns:\r
+ Is it in working block?\r
\r
- Status code\r
\r
- EFI_NOT_FOUND - Block not found\r
+ @param FtwLiteDevice Calling context\r
+ @param FvBlock Fvb protocol instance\r
+ @param Lba The block specified\r
\r
---*/\r
-;\r
+ @return A BOOLEAN value indicating in working block or not.\r
\r
+**/\r
BOOLEAN\r
IsInWorkingBlock (\r
EFI_FTW_LITE_DEVICE *FtwLiteDevice,\r
EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,\r
EFI_LBA Lba\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Is it in working block?\r
+ );\r
\r
-Arguments:\r
+/**\r
\r
- FtwLiteDevice - Calling context\r
- FvBlock - Fvb protocol instance\r
- Lba - The block specified\r
+ Check whether the block is a boot block.\r
\r
-Returns:\r
\r
- In working block or not\r
+ @param FtwLiteDevice Calling context\r
+ @param FvBlock Fvb protocol instance\r
+ @param Lba Lba value\r
\r
---*/\r
-;\r
+ @retval FALSE This is a boot block.\r
+ @retval TRUE This is not a boot block.\r
\r
+**/\r
BOOLEAN\r
IsBootBlock (\r
EFI_FTW_LITE_DEVICE *FtwLiteDevice,\r
EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,\r
EFI_LBA Lba\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Check whether the block is a boot block.\r
+ );\r
\r
-Arguments:\r
+/**\r
+ Copy the content of spare block to a target block. Size is FTW_BLOCK_SIZE.\r
+ Spare block is accessed by FTW backup FVB protocol interface. LBA is\r
+ FtwLiteDevice->FtwSpareLba.\r
+ Target block is accessed by FvBlock protocol interface. LBA is Lba.\r
\r
- FtwLiteDevice - Calling context\r
- FvBlock - Fvb protocol instance\r
- Lba - Lba value\r
\r
-Returns:\r
+ @param FtwLiteDevice The private data of FTW_LITE driver\r
+ @param FvBlock FVB Protocol interface to access target block\r
+ @param Lba Lba of the target block\r
\r
- Is a boot block or not\r
-\r
---*/\r
-;\r
+ @retval EFI_SUCCESS Spare block content is copied to target block\r
+ @retval EFI_INVALID_PARAMETER Input parameter error\r
+ @retval EFI_OUT_OF_RESOURCES Allocate memory error\r
+ @retval EFI_ABORTED The function could not complete successfully\r
\r
+**/\r
EFI_STATUS\r
FlushSpareBlockToTargetBlock (\r
EFI_FTW_LITE_DEVICE *FtwLiteDevice,\r
EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,\r
EFI_LBA Lba\r
- )\r
-/*++\r
+ );\r
\r
-Routine Description:\r
- Copy the content of spare block to a target block. Size is FTW_BLOCK_SIZE.\r
- Spare block is accessed by FTW backup FVB protocol interface. LBA is \r
- FtwLiteDevice->FtwSpareLba.\r
- Target block is accessed by FvBlock protocol interface. LBA is Lba.\r
+/**\r
+ Copy the content of spare block to working block. Size is FTW_BLOCK_SIZE.\r
+ Spare block is accessed by FTW backup FVB protocol interface. LBA is\r
+ FtwLiteDevice->FtwSpareLba.\r
+ Working block is accessed by FTW working FVB protocol interface. LBA is\r
+ FtwLiteDevice->FtwWorkBlockLba.\r
\r
-Arguments:\r
- FtwLiteDevice - The private data of FTW_LITE driver\r
- FvBlock - FVB Protocol interface to access target block\r
- Lba - Lba of the target block\r
\r
-Returns:\r
- EFI_SUCCESS - Spare block content is copied to target block\r
- EFI_INVALID_PARAMETER - Input parameter error\r
- EFI_OUT_OF_RESOURCES - Allocate memory error\r
- EFI_ABORTED - The function could not complete successfully\r
+ @param FtwLiteDevice The private data of FTW_LITE driver\r
\r
---*/\r
-;\r
+ @retval EFI_SUCCESS Spare block content is copied to target block\r
+ @retval EFI_OUT_OF_RESOURCES Allocate memory error\r
+ @retval EFI_ABORTED The function could not complete successfully\r
+ Notes:\r
+ Since the working block header is important when FTW initializes, the\r
+ state of the operation should be handled carefully. The Crc value is\r
+ calculated without STATE element.\r
\r
+**/\r
EFI_STATUS\r
FlushSpareBlockToWorkingBlock (\r
EFI_FTW_LITE_DEVICE *FtwLiteDevice\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Copy the content of spare block to working block. Size is FTW_BLOCK_SIZE.\r
- Spare block is accessed by FTW backup FVB protocol interface. LBA is \r
- FtwLiteDevice->FtwSpareLba.\r
- Working block is accessed by FTW working FVB protocol interface. LBA is \r
- FtwLiteDevice->FtwWorkBlockLba.\r
+ );\r
\r
-Arguments:\r
- FtwLiteDevice - The private data of FTW_LITE driver\r
+/**\r
+ Copy the content of spare block to a boot block. Size is FTW_BLOCK_SIZE.\r
+ Spare block is accessed by FTW backup FVB protocol interface. LBA is\r
+ FtwLiteDevice->FtwSpareLba.\r
+ Boot block is accessed by BootFvb protocol interface. LBA is 0.\r
\r
-Returns:\r
- EFI_SUCCESS - Spare block content is copied to target block\r
- EFI_OUT_OF_RESOURCES - Allocate memory error\r
- EFI_ABORTED - The function could not complete successfully\r
\r
-Notes:\r
- Since the working block header is important when FTW initializes, the \r
- state of the operation should be handled carefully. The Crc value is \r
- calculated without STATE element. \r
+ @param FtwLiteDevice The private data of FTW_LITE driver\r
\r
---*/\r
-;\r
+ @retval EFI_SUCCESS Spare block content is copied to boot block\r
+ @retval EFI_INVALID_PARAMETER Input parameter error\r
+ @retval EFI_OUT_OF_RESOURCES Allocate memory error\r
+ @retval EFI_ABORTED The function could not complete successfully\r
+ Notes:\r
\r
+**/\r
EFI_STATUS\r
FlushSpareBlockToBootBlock (\r
EFI_FTW_LITE_DEVICE *FtwLiteDevice\r
- )\r
-/*++\r
+ );\r
\r
-Routine Description:\r
- Copy the content of spare block to a boot block. Size is FTW_BLOCK_SIZE.\r
- Spare block is accessed by FTW backup FVB protocol interface. LBA is \r
- FtwLiteDevice->FtwSpareLba.\r
- Boot block is accessed by BootFvb protocol interface. LBA is 0.\r
+/**\r
+ Update a bit of state on a block device. The location of the bit is\r
+ calculated by the (Lba, Offset, bit). Here bit is determined by the\r
+ the name of a certain bit.\r
\r
-Arguments:\r
- FtwLiteDevice - The private data of FTW_LITE driver\r
\r
-Returns:\r
- EFI_SUCCESS - Spare block content is copied to boot block\r
- EFI_INVALID_PARAMETER - Input parameter error\r
- EFI_OUT_OF_RESOURCES - Allocate memory error\r
- EFI_ABORTED - The function could not complete successfully\r
+ @param FvBlock FVB Protocol interface to access SrcBlock and DestBlock\r
+ @param Lba Lba of a block\r
+ @param Offset Offset on the Lba\r
+ @param NewBit New value that will override the old value if it can be change\r
\r
-Notes:\r
-\r
---*/\r
-;\r
+ @retval EFI_SUCCESS A state bit has been updated successfully\r
+ @retval Others Access block device error.\r
+ Notes:\r
+ Assume all bits of State are inside the same BYTE.\r
+ @retval EFI_ABORTED Read block fail\r
\r
+**/\r
EFI_STATUS\r
FtwUpdateFvState (\r
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,\r
IN EFI_LBA Lba,\r
IN UINTN Offset,\r
IN UINT8 NewBit\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Update a bit of state on a block device. The location of the bit is \r
- calculated by the (Lba, Offset, bit). Here bit is determined by the \r
- the name of a certain bit.\r
+ );\r
\r
-Arguments:\r
- FvBlock - FVB Protocol interface to access SrcBlock and DestBlock\r
- Lba - Lba of a block\r
- Offset - Offset on the Lba\r
- NewBit - New value that will override the old value if it can be change\r
+/**\r
+ Get the last Write record pointer.\r
+ The last record is the record whose 'complete' state hasn't been set.\r
+ After all, this header may be a EMPTY header entry for next Allocate.\r
\r
-Returns:\r
- EFI_SUCCESS - A state bit has been updated successfully\r
- Others - Access block device error.\r
\r
-Notes:\r
- Assume all bits of State are inside the same BYTE. \r
+ @param FtwLiteDevice Private data of this driver\r
+ @param FtwLastRecord Pointer to retrieve the last write record\r
\r
- EFI_ABORTED - Read block fail\r
---*/\r
-;\r
+ @retval EFI_SUCCESS Get the last write record successfully\r
+ @retval EFI_ABORTED The FTW work space is damaged\r
\r
+**/\r
EFI_STATUS\r
FtwGetLastRecord (\r
IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,\r
OUT EFI_FTW_LITE_RECORD **FtwLastRecord\r
- )\r
-/*++\r
+ );\r
\r
-Routine Description:\r
- Get the last Write record pointer. \r
- The last record is the record whose 'complete' state hasn't been set.\r
- After all, this header may be a EMPTY header entry for next Allocate. \r
+/**\r
+\r
+ Check whether a flash buffer is erased.\r
\r
-Arguments:\r
- FtwLiteDevice - Private data of this driver\r
- FtwLastRecord - Pointer to retrieve the last write record\r
\r
-Returns:\r
- EFI_SUCCESS - Get the last write record successfully\r
- EFI_ABORTED - The FTW work space is damaged\r
+ @param Polarity All 1 or all 0\r
+ @param Buffer Buffer to check\r
+ @param BufferSize Size of the buffer\r
\r
---*/\r
-;\r
+ @return A BOOLEAN value indicating erased or not.\r
\r
+**/\r
BOOLEAN\r
IsErasedFlashBuffer (\r
IN BOOLEAN Polarity,\r
IN UINT8 *Buffer,\r
IN UINTN BufferSize\r
- )\r
-/*++\r
+ );\r
\r
-Routine Description:\r
-\r
- Check whether a flash buffer is erased.\r
+/**\r
+ Initialize a work space when there is no work space.\r
\r
-Arguments:\r
\r
- Polarity - All 1 or all 0\r
- Buffer - Buffer to check\r
- BufferSize - Size of the buffer\r
+ @param WorkingHeader Pointer of working block header\r
\r
-Returns:\r
-\r
- Erased or not.\r
-\r
---*/\r
-;\r
+ @retval EFI_SUCCESS The function completed successfully\r
+ @retval EFI_ABORTED The function could not complete successfully.\r
\r
+**/\r
EFI_STATUS\r
InitWorkSpaceHeader (\r
IN EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *WorkingHeader\r
- )\r
-/*++\r
+ );\r
\r
-Routine Description:\r
- Initialize a work space when there is no work space.\r
+/**\r
+ Read from working block to refresh the work space in memory.\r
\r
-Arguments:\r
- WorkingHeader - Pointer of working block header \r
\r
-Returns:\r
- EFI_SUCCESS - The function completed successfully\r
- EFI_ABORTED - The function could not complete successfully.\r
+ @param FtwLiteDevice Point to private data of FTW driver\r
\r
---*/\r
-;\r
+ @retval EFI_SUCCESS The function completed successfully\r
+ @retval EFI_ABORTED The function could not complete successfully.\r
\r
+**/\r
EFI_STATUS\r
WorkSpaceRefresh (\r
IN EFI_FTW_LITE_DEVICE *FtwLiteDevice\r
- )\r
-/*++\r
+ );\r
\r
-Routine Description:\r
- Read from working block to refresh the work space in memory.\r
+/**\r
+ Check to see if it is a valid work space.\r
\r
-Arguments:\r
- FtwLiteDevice - Point to private data of FTW driver\r
\r
-Returns:\r
- EFI_SUCCESS - The function completed successfully\r
- EFI_ABORTED - The function could not complete successfully.\r
+ @param WorkingHeader Pointer of working block header\r
\r
---*/\r
-;\r
+ @retval EFI_SUCCESS The function completed successfully\r
+ @retval EFI_ABORTED The function could not complete successfully.\r
\r
+**/\r
BOOLEAN\r
IsValidWorkSpace (\r
IN EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *WorkingHeader\r
- )\r
-/*++\r
+ );\r
\r
-Routine Description:\r
- Check to see if it is a valid work space.\r
+/**\r
+ Reclaim the work space on the working block.\r
\r
-Arguments:\r
- WorkingHeader - Pointer of working block header \r
\r
-Returns:\r
- EFI_SUCCESS - The function completed successfully\r
- EFI_ABORTED - The function could not complete successfully.\r
+ @param FtwLiteDevice Point to private data of FTW driver\r
+ @param PreserveRecord Whether to preserve the working record is needed\r
\r
---*/\r
-;\r
-\r
-EFI_STATUS\r
-CleanupWorkSpace (\r
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,\r
- IN OUT UINT8 *BlockBuffer,\r
- IN UINTN BufferSize\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Reclaim the work space. Get rid of all the completed write records\r
- and write records in the Fault Tolerant work space.\r
-\r
-Arguments:\r
- FtwLiteDevice - Point to private data of FTW driver\r
- FtwSpaceBuffer - Buffer to contain the reclaimed clean data\r
- BufferSize - Size of the FtwSpaceBuffer\r
-\r
-Returns:\r
- EFI_SUCCESS - The function completed successfully\r
- EFI_BUFFER_TOO_SMALL - The FtwSpaceBuffer is too small\r
- EFI_ABORTED - The function could not complete successfully.\r
-\r
---*/\r
-;\r
+ @retval EFI_SUCCESS The function completed successfully\r
+ @retval EFI_OUT_OF_RESOURCES Allocate memory error\r
+ @retval EFI_ABORTED The function could not complete successfully\r
\r
+**/\r
EFI_STATUS\r
FtwReclaimWorkSpace (\r
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Reclaim the work space on the working block.\r
-\r
-Arguments:\r
- FtwLiteDevice - Point to private data of FTW driver\r
-\r
-Returns:\r
- EFI_SUCCESS - The function completed successfully\r
- EFI_OUT_OF_RESOURCES - Allocate memory error\r
- EFI_ABORTED - The function could not complete successfully\r
-\r
---*/\r
-;\r
+ IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,\r
+ IN BOOLEAN PreserveRecord\r
+ );\r
\r
#endif\r