/* This helper function locates the shared comm buffer and assigns it to input pointers. */
STATIC EFI_STATUS InitMmCommonCommBuffer(IN OUT UINTN *BufferSize, OUT VOID **LocatedBuffer)
/* This helper function locates the shared comm buffer and assigns it to input pointers. */
STATIC EFI_STATUS InitMmCommonCommBuffer(IN OUT UINTN *BufferSize, OUT VOID **LocatedBuffer)
{
  EFI_STATUS  Status;
  Status = EFI_SUCCESS;
  if ((BufferSize == NULL) || (LocatedBuffer == NULL)) {
    return EFI_INVALID_PARAMETER;
  }
  *LocatedBuffer = AllocateRuntimePool (*BufferSize);
  if (*LocatedBuffer == NULL) {
    Status      = EFI_OUT_OF_RESOURCES;
    *BufferSize = 0;
  }
  EfiInitializeLock (&mMmCommunicationLock, TPL_NOTIFY);
  return Status;
}