VirtioRing-solaris.c revision 1a9a76385f412e8c5762baadaa30afe308b1cd12
/* $Id$ */
/** @file
* VirtualBox Guest Additions: Virtio Driver for Solaris, Ring implementation.
*/
/*
* Copyright (C) 2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include "Virtio-solaris.h"
#if defined(DEBUG_ramshankar)
# define LogFlowFunc LogRel
#endif
/**
* Returns the size of the ring in bytes given the number of elements and
* alignment requirements.
*
* @param cElements Number of elements.
* @param Align Alignment (must be a power of two).
*
* @return Size of the Virtio ring.
*/
{
return cbAlign;
}
/**
* Initializes a ring of a queue. This associates the DMA virtual address
* with the Ring structure's "pRingDesc".
*
* @param pQueue Pointer to the Virtio Queue.
* @param cDescs Number of descriptors.
* @param virtBuf Buffer associated with the ring.
* @param Align Alignment (must be power of two).
*/
{
pRing->pRingUsedElem = RT_ALIGN_PT(pRing->pRingAvail + RT_OFFSETOF(VIRTIORINGAVAIL, aRings[pQueue->Ring.cDesc]), Align,
pQueue->FreeHeadIndex = 0;
cmn_err(CE_NOTE, "cDesc=%u pRingDesc=%p pRingAvail=%p\n", pRing->cDesc, pRing->pRingDesc, pRing->pRingAvail);
}
/**
* Push a buffer into the ring.
*
* @param pQueue Pointer to the Virtio queue.
* @param physBuf Physical address of the buffer.
* @param cbBuf Size of the buffer in bytes.
* @param fFlags Buffer flags, see VIRTIO_FLAGS_RING_DESC_*.
*
* @return IPRT error code.
*/
{
/*
* Claim a slot, fill the buffer and move head pointer.
*/
{
return VERR_BUFFER_OVERFLOW;
}
return VINF_SUCCESS;
}