Virtio.h revision 53a101648921e6d3e1d4e48556a477741a0e41d7
/* $Id$ */
/** @file
* Virtio.h - Virtio Declarations
*/
/*
* Copyright (C) 2009-2013 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.
*/
#ifndef ___VBox_Virtio_h
#define ___VBox_Virtio_h
/** @name Saved state versions.
* The saved state version is changed if either common or any of specific
* parts are changed. That is, it is perfectly possible that the version
* of saved vnet state will increase as a result of change in vblk structure
* for example.
*/
#define VIRTIO_SAVEDSTATE_VERSION_3_1_BETA1 1
#define VIRTIO_SAVEDSTATE_VERSION 2
/** @} */
#define DEVICE_PCI_VENDOR_ID 0x1AF4
#define DEVICE_PCI_DEVICE_ID 0x1000
#define DEVICE_PCI_SUBSYSTEM_VENDOR_ID 0x1AF4
#define VIRTIO_MAX_NQUEUES 3
#define VPCI_HOST_FEATURES 0x0
#define VPCI_GUEST_FEATURES 0x4
#define VPCI_QUEUE_PFN 0x8
#define VPCI_QUEUE_NUM 0xC
#define VPCI_QUEUE_SEL 0xE
#define VPCI_QUEUE_NOTIFY 0x10
#define VPCI_STATUS 0x12
#define VPCI_ISR 0x13
#define VPCI_CONFIG 0x14
#define VPCI_ISR_QUEUE 0x1
#define VPCI_ISR_CONFIG 0x3
#define VPCI_STATUS_ACK 0x01
#define VPCI_STATUS_DRV 0x02
#define VPCI_STATUS_DRV_OK 0x04
#define VPCI_STATUS_FAILED 0x80
#define VPCI_F_NOTIFY_ON_EMPTY 0x01000000
#define VPCI_F_BAD_FEATURE 0x40000000
#define VRINGDESC_F_NEXT 0x01
#define VRINGDESC_F_WRITE 0x02
typedef struct VRingDesc
{
} VRINGDESC;
typedef VRINGDESC *PVRINGDESC;
#define VRINGAVAIL_F_NO_INTERRUPT 0x01
typedef struct VRingAvail
{
} VRINGAVAIL;
typedef struct VRingUsedElem
{
#define VRINGUSED_F_NO_NOTIFY 0x01
typedef struct VRingUsed
{
} VRINGUSED;
typedef VRINGUSED *PVRINGUSED;
#define VRING_MAX_SIZE 1024
typedef struct VRing
{
} VRING;
/**
* Queue callback (consumer?).
*
* @param pvState Pointer to the VirtIO PCI core state, VPCISTATE.
* @param pQueue Pointer to the queue structure.
*/
/** Pointer to a VQUEUE callback function. */
typedef FNVPCIQUEUECALLBACK *PFNVPCIQUEUECALLBACK;
typedef struct VQueue
{
} VQUEUE;
typedef struct VQueueElemSeg
{
void *pv;
} VQUEUESEG;
typedef struct VQueueElem
{
} VQUEUEELEM;
typedef VQUEUEELEM *PVQUEUEELEM;
enum VirtioDeviceType
{
VIRTIO_NET_ID = 0,
VIRTIO_BLK_ID = 1,
VIRTIO_32BIT_HACK = 0x7fffffff
};
/**
* The core (/common) state of the VirtIO PCI device
*
* @implements PDMILEDPORTS
*/
typedef struct VPCIState_st
{
/* Read-only part, never changes after initialization. */
#if HC_ARCH_BITS != 64
#endif
/** Status LUN: Base interface. */
/** Status LUN: LED port interface. */
/** Status LUN: LED connector (peer). */
#if HC_ARCH_BITS == 64
#endif
/** TODO */
/** Base port of I/O space region. */
/** Status LED. */
#if HC_ARCH_BITS != 64
#endif
#if defined(VBOX_WITH_STATISTICS)
#endif /* VBOX_WITH_STATISTICS */
} VPCISTATE;
/** Pointer to the core (/common) state of a VirtIO PCI device. */
typedef VPCISTATE *PVPCISTATE;
typedef FNGETHOSTFEATURES *PFNGETHOSTFEATURES;
/** @name VirtIO port I/O callbacks.
* @{ */
typedef struct VPCIIOCALLBACKS
{
/** Pointer to a const VirtIO port I/O callback structure. */
typedef const VPCIIOCALLBACKS *PCVPCIIOCALLBACKS;
/** @} */
void *pvUser,
unsigned cb,
void *pvUser,
unsigned cb,
int vpciLoadExec(PVPCISTATE pState, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass, uint32_t nQueues);
PVQUEUE vpciAddQueue(VPCISTATE* pState, unsigned uSize, PFNVPCIQUEUECALLBACK pfnCallback, const char *pcszName);
#define VPCI_CS
{
#ifdef VPCI_CS
return rc;
#else
return VINF_SUCCESS;
#endif
}
{
#ifdef VPCI_CS
#endif
}
{
return tmp;
}
void vqueuePut(PVPCISTATE pState, PVQUEUE pQueue, PVQUEUEELEM pElem, uint32_t uLen, uint32_t uReserved = 0);
{
}
{
}
{
}
#endif /* !___VBox_Virtio_h */