MdeModulePkg/FaultTolerantWrite: Consume Variable Flash Info

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3479

Adds support to the UEFI variable fault tolerant write (FTW) drivers
to receive FTW base and size information dynamically via the Variable
Flash Information library.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
This commit is contained in:
Michael Kubacki
2022-04-05 21:40:17 -04:00
committed by mergify[bot]
parent 4dbebc2d10
commit 8db39c60cd
8 changed files with 63 additions and 60 deletions

View File

@ -16,10 +16,13 @@ EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER mWorkingBlockHeader = { ZERO_GUID, 0, 0
Since Signature and WriteQueueSize have been known, Crc can be calculated out,
then the work space header will be fixed.
@param[in] WorkSpaceLength Length in bytes of the FTW workspace area.
**/
VOID
InitializeLocalWorkSpaceHeader (
VOID
IN UINTN WorkSpaceLength
)
{
//
@ -46,7 +49,7 @@ InitializeLocalWorkSpaceHeader (
&gEdkiiWorkingBlockSignatureGuid,
sizeof (EFI_GUID)
);
mWorkingBlockHeader.WriteQueueSize = PcdGet32 (PcdFlashNvStorageFtwWorkingSize) - sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER);
mWorkingBlockHeader.WriteQueueSize = WorkSpaceLength - sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER);
//
// Crc is calculated with all the fields except Crc and STATE, so leave them as FTW_ERASED_BYTE.