Garrett,
The 10,000 foot view of the concept behind the code is to work around the
limitation of NOR flash. Basically one of the bit state transitions for a bit
(usually setting 0 to 1) requires erasing an entire block.
So to flip one bit in the block could require you to erase the entire block. So
the FTB lets you store away a copy of the block prior to the erase so if the
system is reset you can recover the state of the FLASH device. Thus the
requirement for fault tolerance is at least one extra block (as big as the
biggest block in the FLASH device) must be available, at all times, for a fault
tolerant write.
Higher level code can manage updating more than one block in a fault tolerant
way, but your working set is limited by how big your extra store is. Also
remember that you can set 1 to 0 without in the FLASH without doing an erase.
If you need to do an update that spans blocks in an safe fashion then you need
a larger FTW spare block.
Thanks,
Andrew Fish
PS Some devices reverse the bit states, and the FV abstraction deals with
that.
On Apr 18, 2014, at 12:32 PM, Kirkendall, Garrett <[email protected]>
wrote:
> Is there any good documentation for how the Fault Tolerant Write is supposed
> to work?
>
> I understand that NV storage, FTW working space and FTW spare space are
> supposed to be in the same Firmware Volume.
>
> I’m having trouble deciphering how big the FTW working and spare areas should
> be in relation to the NV storage space.
>
> Also, in a bunch of places, it looks like the code was written such that the
> working space must fit within one block size. What happens if need space
> spanning multiple blocks? Below are parts from two functions that end in an
> ASSERT because only one block gets read and returns an error when the
> requested FVB->Read input size is larger than one block of data.
>
> MdeModulePkg/Universal/FaultTolerantDxe/UpdateWorkingBlock.c
>
> EFI_STATUS
> WorkSpaceRefresh (
> IN EFI_FTW_DEVICE *FtwDevice
> )
> {
> EFI_STATUS Status;
> UINTN Length;
> UINTN RemainingSpaceSize;
> .
> .
> .
> //
> // Read from working block
> //
> Length = FtwDevice->FtwWorkSpaceSize;
> Status = FtwDevice->FtwFvBlock->Read (
> FtwDevice->FtwFvBlock,
> FtwDevice->FtwWorkSpaceLba,
> FtwDevice->FtwWorkSpaceBase,
> &Length,
> FtwDevice->FtwWorkSpace
> );
> if (EFI_ERROR (Status)) {
> return EFI_ABORTED;
> }
> When Length > one block, Return EFI_ABORTED because
> FtwDevice->FtwFvBlock->Read() returns EFI_BAD_BUFFER_SIZE as specified in PI
> 1.3 Vol3 3.4.2 EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL.Read()
>
>
>
> MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c
>
> EFI_STATUS
> InitFtwProtocol (
> IN OUT EFI_FTW_DEVICE *FtwDevice
> )
> {
> .
> .
> .
> //
> // Refresh the working space data from working block
> //
> Status = WorkSpaceRefresh (FtwDevice);
> ASSERT_EFI_ERROR (Status);
>
> ASSERT because EFI_ABORTED returned.
>
> GARRETT KIRKENDALL <image002.png>
> SMTS Firmware Engineer | AMD Technology & Engineering
> 7171 Southwest Parkway, Austin, TX 78735 USA
> <image003.png> facebook | amd.com
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech_______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel