X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FFirmwareVolume%2FFaultTolerantWriteDxe%2FFtwLite.h;h=dfc5b36ffa360dd0fd9a8c26599b97f6c1aaf098;hb=276a49b699785cb3faf99744265f7051b08dc20d;hp=91512dd3314091b9be868884816c07318f56fbe9;hpb=f3f2e05db8c89628498ec4efdb16184747824c63;p=mirror_edk2.git diff --git a/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteDxe/FtwLite.h b/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteDxe/FtwLite.h index 91512dd331..dfc5b36ffa 100644 --- a/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteDxe/FtwLite.h +++ b/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteDxe/FtwLite.h @@ -20,7 +20,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include -#include #include #include #include @@ -35,9 +34,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include -#define EFI_D_FTW_LITE EFI_D_ERROR -#define EFI_D_FTW_INFO EFI_D_INFO - // // Flash erase polarity is 1 // @@ -69,36 +65,10 @@ typedef struct { #define FTW_LITE_DEVICE_SIGNATURE SIGNATURE_32 ('F', 'T', 'W', 'L') -// -// MACRO for Block size. -// Flash Erasing will do in block granularity. -// -#ifdef FV_BLOCK_SIZE -#define FTW_BLOCK_SIZE FV_BLOCK_SIZE -#else -#define FV_BLOCK_SIZE 0x10000 -#define FTW_BLOCK_SIZE FV_BLOCK_SIZE -#endif -// -// MACRO for FTW WORK SPACE Base & Size -// -#ifdef EFI_FTW_WORKING_OFFSET -#define FTW_WORK_SPACE_BASE EFI_FTW_WORKING_OFFSET -#else -#define FTW_WORK_SPACE_BASE 0x00E000 -#endif - -#ifdef EFI_FTW_WORKING_LENGTH -#define FTW_WORK_SPACE_SIZE EFI_FTW_WORKING_LENGTH -#else -#define FTW_WORK_SPACE_SIZE 0x002000 -#endif // // MACRO for FTW header and record // -#define FTW_WORKING_QUEUE_SIZE (FTW_WORK_SPACE_SIZE - sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER)) #define FTW_LITE_RECORD_SIZE (sizeof (EFI_FTW_LITE_RECORD)) -#define WRITE_TOTAL_SIZE FTW_LITE_RECORD_SIZE // // EFI Fault tolerant protocol private data structure @@ -107,22 +77,22 @@ typedef struct { UINTN Signature; EFI_HANDLE Handle; EFI_FTW_LITE_PROTOCOL FtwLiteInstance; - EFI_PHYSICAL_ADDRESS WorkSpaceAddress; - UINTN WorkSpaceLength; - EFI_PHYSICAL_ADDRESS SpareAreaAddress; - UINTN SpareAreaLength; - UINTN NumberOfSpareBlock; // Number of the blocks in spare block - UINTN SizeOfSpareBlock; // Block size in bytes of the blocks in spare block - EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *FtwWorkSpaceHeader; - EFI_FTW_LITE_RECORD *FtwLastRecord; + EFI_PHYSICAL_ADDRESS WorkSpaceAddress; // Base address of working space range in flash. + UINTN WorkSpaceLength; // Size of working space range in flash. + EFI_PHYSICAL_ADDRESS SpareAreaAddress; // Base address of spare range in flash. + UINTN SpareAreaLength; // Size of spare range in flash. + UINTN NumberOfSpareBlock; // Number of the blocks in spare block. + UINTN BlockSize; // Block size in bytes of the blocks in flash + EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *FtwWorkSpaceHeader;// Pointer to Working Space Header in memory buffer + EFI_FTW_LITE_RECORD *FtwLastRecord; // Pointer to last record in memory buffer EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FtwFvBlock; // FVB of working block EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FtwBackupFvb; // FVB of spare block - EFI_LBA FtwSpareLba; - EFI_LBA FtwWorkBlockLba; // Start LBA of working block + EFI_LBA FtwSpareLba; // Start LBA of spare block + EFI_LBA FtwWorkBlockLba; // Start LBA of working block that contains working space in its last block. EFI_LBA FtwWorkSpaceLba; // Start LBA of working space - UINTN FtwWorkSpaceBase; // Offset from LBA start addr - UINTN FtwWorkSpaceSize; - UINT8 *FtwWorkSpace; + UINTN FtwWorkSpaceBase; // Offset into the FtwWorkSpaceLba block. + UINTN FtwWorkSpaceSize; // Size of working space range that stores write record. + UINT8 *FtwWorkSpace; // Point to Work Space in memory buffer // // Following a buffer of FtwWorkSpace[FTW_WORK_SPACE_SIZE], // Allocated with EFI_FTW_LITE_DEVICE. @@ -138,9 +108,9 @@ typedef struct { This function is the entry point of the Fault Tolerant Write driver. - @param ImageHandle EFI_HANDLE: A handle for the image that is initializing + @param ImageHandle A handle for the image that is initializing this driver - @param SystemTable EFI_SYSTEM_TABLE: A pointer to the EFI system table + @param SystemTable A pointer to the EFI system table @retval EFI_SUCCESS FTW has finished the initialization @retval EFI_ABORTED FTW initialization error @@ -252,7 +222,7 @@ FtwWriteRecord ( ); /** - To Erase one block. The size is FTW_BLOCK_SIZE + To erase the block with the spare block size. @param FtwLiteDevice Calling context @@ -351,26 +321,6 @@ IsInWorkingBlock ( EFI_LBA Lba ); -/** - - Check whether the block is a boot block. - - - @param FtwLiteDevice Calling context - @param FvBlock Fvb protocol instance - @param Lba Lba value - - @retval FALSE This is a boot block. - @retval TRUE This is not a boot block. - -**/ -BOOLEAN -IsBootBlock ( - EFI_FTW_LITE_DEVICE *FtwLiteDevice, - EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock, - EFI_LBA Lba - ); - /** 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 @@ -419,27 +369,6 @@ FlushSpareBlockToWorkingBlock ( EFI_FTW_LITE_DEVICE *FtwLiteDevice ); -/** - 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. - - - @param FtwLiteDevice The private data of FTW_LITE driver - - @retval EFI_SUCCESS Spare block content is copied to boot block - @retval EFI_INVALID_PARAMETER Input parameter error - @retval EFI_OUT_OF_RESOURCES Allocate memory error - @retval EFI_ABORTED The function could not complete successfully - Notes: - -**/ -EFI_STATUS -FlushSpareBlockToBootBlock ( - EFI_FTW_LITE_DEVICE *FtwLiteDevice - ); - /** 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