VirtioRing-solaris.c revision 38b0f04a36431d57eed1de01653dd0a015eae4c3
/* $Id$ */
/** @file
* VirtualBox Guest Additions: Virtio Driver for Solaris, Ring implementation.
*/
/*
* Copyright (C) 2010 Oracle Corporation
*
* Oracle Corporation confidential
* All rights reserved
*/
/*******************************************************************************
* 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;
}