/* Allocates space for the protocol to maintain information about writes. Since writes must be completed in a fault-tolerant manner and multiple writes require more resources to be successful, this function enables the protocol to ensure that enough space exists to track information about upcoming writes. */
EFI_STATUS EFIAPI FtwAllocate(IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This, IN EFI_GUID *CallerId, IN UINTN PrivateDataSize, IN UINTN NumberOfWrites)
/* Allocates space for the protocol to maintain information about writes. Since writes must be completed in a fault-tolerant manner and multiple writes require more resources to be successful, this function enables the protocol to ensure that enough space exists to track information about upcoming writes. */
EFI_STATUS EFIAPI FtwAllocate(IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This, IN EFI_GUID *CallerId, IN UINTN PrivateDataSize, IN UINTN NumberOfWrites)
{
  EFI_STATUS                 Status;
  UINTN                      PayloadSize;
  EFI_MM_COMMUNICATE_HEADER  *SmmCommunicateHeader;
  SMM_FTW_ALLOCATE_HEADER    *SmmFtwAllocateHeader;
  PayloadSize = sizeof (SMM_FTW_ALLOCATE_HEADER);
  InitCommunicateBuffer ((VOID **)&SmmCommunicateHeader, (VOID **)&SmmFtwAllocateHeader, PayloadSize, FTW_FUNCTION_ALLOCATE);
  CopyGuid (&SmmFtwAllocateHeader->CallerId, CallerId);
  SmmFtwAllocateHeader->PrivateDataSize = PrivateDataSize;
  SmmFtwAllocateHeader->NumberOfWrites  = NumberOfWrites;
  Status = SendCommunicateBuffer (SmmCommunicateHeader, PayloadSize);
  if (!EFI_ERROR (Status)) {
    mPrivateDataSize = PrivateDataSize;
  }
  FreePool (SmmCommunicateHeader);
  return Status;
}