]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteDxe/FtwLite.h
Add full version FaultTolerantWrite Dxe driver.
[mirror_edk2.git] / MdeModulePkg / Universal / FirmwareVolume / FaultTolerantWriteDxe / FtwLite.h
index 0c6bf34f9555ef8248142392e9e164c8ba810ad7..c33e1798b2b7da51a609ccf95b5ee0fd5294f0a0 100644 (file)
@@ -32,11 +32,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/DevicePathLib.h>\r
 \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
 //\r
 // Flash erase polarity is 1\r
 //\r
@@ -68,30 +63,6 @@ typedef struct {
 \r
 #define FTW_LITE_DEVICE_SIGNATURE SIGNATURE_32 ('F', 'T', 'W', 'L')\r
 \r
-//\r
-// MACRO for Block size.\r
-// Flash Erasing will do in block granularity.\r
-//\r
-#ifdef FV_BLOCK_SIZE\r
-#define FTW_BLOCK_SIZE  FV_BLOCK_SIZE\r
-#else\r
-#define FV_BLOCK_SIZE   0x10000\r
-#define FTW_BLOCK_SIZE  FV_BLOCK_SIZE\r
-#endif\r
-//\r
-// MACRO for FTW WORK SPACE Base & Size\r
-//\r
-#ifdef EFI_FTW_WORKING_OFFSET\r
-#define FTW_WORK_SPACE_BASE EFI_FTW_WORKING_OFFSET\r
-#else\r
-#define FTW_WORK_SPACE_BASE 0x00E000\r
-#endif\r
-\r
-#ifdef EFI_FTW_WORKING_LENGTH\r
-#define FTW_WORK_SPACE_SIZE EFI_FTW_WORKING_LENGTH\r
-#else\r
-#define FTW_WORK_SPACE_SIZE 0x002000\r
-#endif\r
 //\r
 // MACRO for FTW header and record\r
 //\r
@@ -104,22 +75,22 @@ typedef struct {
   UINTN                                   Signature;\r
   EFI_HANDLE                              Handle;\r
   EFI_FTW_LITE_PROTOCOL                   FtwLiteInstance;\r
-  EFI_PHYSICAL_ADDRESS                    WorkSpaceAddress;\r
-  UINTN                                   WorkSpaceLength;\r
-  EFI_PHYSICAL_ADDRESS                    SpareAreaAddress;\r
-  UINTN                                   SpareAreaLength;\r
-  UINTN                                   NumberOfSpareBlock; // Number of the blocks in spare block\r
-  UINTN                                   SizeOfSpareBlock;   // Block size in bytes of the blocks in spare block\r
-  EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *FtwWorkSpaceHeader;\r
-  EFI_FTW_LITE_RECORD                     *FtwLastRecord;\r
+  EFI_PHYSICAL_ADDRESS                    WorkSpaceAddress;   // Base address of working space range in flash.\r
+  UINTN                                   WorkSpaceLength;    // Size of working space range in flash.\r
+  EFI_PHYSICAL_ADDRESS                    SpareAreaAddress;   // Base address of spare range in flash.\r
+  UINTN                                   SpareAreaLength;    // Size of spare range in flash.\r
+  UINTN                                   NumberOfSpareBlock; // Number of the blocks in spare block.\r
+  UINTN                                   BlockSize;          // Block size in bytes of the blocks in flash\r
+  EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *FtwWorkSpaceHeader;// Pointer to Working Space Header in memory buffer\r
+  EFI_FTW_LITE_RECORD                     *FtwLastRecord;     // Pointer to last record in memory buffer\r
   EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL      *FtwFvBlock;        // FVB of working block\r
   EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL      *FtwBackupFvb;      // FVB of spare block\r
-  EFI_LBA                                 FtwSpareLba;\r
-  EFI_LBA                                 FtwWorkBlockLba;    // Start LBA of working block\r
+  EFI_LBA                                 FtwSpareLba;        // Start LBA of spare block\r
+  EFI_LBA                                 FtwWorkBlockLba;    // Start LBA of working block that contains working space in its last block.\r
   EFI_LBA                                 FtwWorkSpaceLba;    // Start LBA of working space\r
-  UINTN                                   FtwWorkSpaceBase;   // Offset from LBA start addr\r
-  UINTN                                   FtwWorkSpaceSize;\r
-  UINT8                                   *FtwWorkSpace;\r
+  UINTN                                   FtwWorkSpaceBase;   // Offset into the FtwWorkSpaceLba block.\r
+  UINTN                                   FtwWorkSpaceSize;   // Size of working space range that stores write record.\r
+  UINT8                                   *FtwWorkSpace;      // Point to Work Space in memory buffer \r
   //\r
   // Following a buffer of FtwWorkSpace[FTW_WORK_SPACE_SIZE],\r
   // Allocated with EFI_FTW_LITE_DEVICE.\r
@@ -249,7 +220,7 @@ FtwWriteRecord (
   );\r
 \r
 /**\r
-  To Erase one block. The size is FTW_BLOCK_SIZE\r
+  To erase the block with the spare block size.\r
 \r
 \r
   @param FtwLiteDevice   Calling context\r
@@ -348,26 +319,6 @@ IsInWorkingBlock (
   EFI_LBA                             Lba\r
   );\r
 \r
-/**\r
-\r
-  Check whether the block is a boot block.\r
-\r
-\r
-  @param FtwLiteDevice   Calling context\r
-  @param FvBlock         Fvb protocol instance\r
-  @param Lba             Lba value\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
   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
@@ -416,27 +367,6 @@ FlushSpareBlockToWorkingBlock (
   EFI_FTW_LITE_DEVICE                 *FtwLiteDevice\r
   );\r
 \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
-\r
-  @param FtwLiteDevice   The private data of FTW_LITE driver\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
   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