/* Get the base address and size for the fault tolerant write (FTW) working area used for UEFI variable storage. */
EFI_STATUS EFIAPI GetVariableFlashFtwWorkingInfo(OUT EFI_PHYSICAL_ADDRESS *BaseAddress, OUT UINT64 *Length)
/* Get the base address and size for the fault tolerant write (FTW) working area used for UEFI variable storage. */
EFI_STATUS EFIAPI GetVariableFlashFtwWorkingInfo(OUT EFI_PHYSICAL_ADDRESS *BaseAddress, OUT UINT64 *Length)
{
  EFI_STATUS           Status;
  VARIABLE_FLASH_INFO  *VariableFlashInfo;
  if ((BaseAddress == NULL) || (Length == NULL)) {
    return EFI_INVALID_PARAMETER;
  }
  Status = GetVariableFlashInfoFromHob (&VariableFlashInfo);
  if (!EFI_ERROR (Status)) {
    *BaseAddress = VariableFlashInfo->FtwWorkingBaseAddress;
    *Length      = VariableFlashInfo->FtwWorkingLength;
  } else {
    *BaseAddress = (EFI_PHYSICAL_ADDRESS)(PcdGet64 (PcdFlashNvStorageFtwWorkingBase64) != 0 ?
                                          PcdGet64 (PcdFlashNvStorageFtwWorkingBase64) :
                                          PcdGet32 (PcdFlashNvStorageFtwWorkingBase)
                                          );
    *Length = (UINT64)PcdGet32 (PcdFlashNvStorageFtwWorkingSize);
  }
  return EFI_SUCCESS;
}