pdmdrv.h revision 5e0d5717f4742e9fc86690c4406e0af249336bbf
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * PDM - Pluggable Device Manager, Drivers.
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * Copyright (C) 2006-2007 Sun Microsystems, Inc.
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * This file is part of VirtualBox Open Source Edition (OSE), as
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * available from http://www.virtualbox.org. This file is free software;
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * you can redistribute it and/or modify it under the terms of the GNU
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * General Public License (GPL) as published by the Free Software
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * Foundation, in version 2 as it comes in the "COPYING" file of the
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * The contents of this file may alternatively be used under the terms
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * of the Common Development and Distribution License Version 1.0
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * VirtualBox OSE distribution, in which case the provisions of the
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * CDDL are applicable instead of those of the GPL.
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * You may elect to license modified versions of this file under the
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * terms and conditions of either the GPL or the CDDL or both.
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * Clara, CA 95054 USA or visit http://www.sun.com if you need
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * additional information or have any questions.
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper/** @defgroup grp_pdm_driver The PDM Drivers API
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * @ingroup grp_pdm
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * Construct a driver instance for a VM.
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * @returns VBox status.
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * @param pDrvIns The driver instance data.
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * If the registration structure is needed, pDrvIns->pDrvReg points to it.
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * @param pCfgHandle Configuration node handle for the driver. Use this to obtain the configuration
typedef struct PDMDRVREG
const char *pszDescription;
} PDMDRVREG;
typedef struct PDMUSBHUBREG
DECLR3CALLBACKMEMBER(int, pfnAttachDevice,(PPDMDRVINS pDrvIns, PPDMUSBINS pUsbIns, uint32_t *piPort));
DECLR3CALLBACKMEMBER(int, pfnDetachDevice,(PPDMDRVINS pDrvIns, PPDMUSBINS pUsbIns, uint32_t iPort));
} PDMUSBHUBREG;
typedef struct PDMUSBHUBHLP
} PDMUSBHUBHLP;
#ifdef IN_RING3
typedef struct PDMDRVHLP
* @param pszCoreDriver Core driver name. NULL will cause autodetection. Ignored if pszFilanem is NULL.
DECLR3CALLBACKMEMBER(int, pfnMountPrepare,(PPDMDRVINS pDrvIns, const char *pszFilename, const char *pszCoreDriver));
DECLR3CALLBACKMEMBER(bool, pfnAssertEMT,(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction));
DECLR3CALLBACKMEMBER(bool, pfnAssertOther,(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction));
DECLR3CALLBACKMEMBER(int, pfnVMSetError,(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...));
DECLR3CALLBACKMEMBER(int, pfnVMSetErrorV,(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va));
DECLR3CALLBACKMEMBER(int, pfnVMSetRuntimeError,(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...));
DECLR3CALLBACKMEMBER(int, pfnVMSetRuntimeErrorV,(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, va_list va));
DECLR3CALLBACKMEMBER(int, pfnPDMQueueCreate,(PPDMDRVINS pDrvIns, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval, PFNPDMQUEUEDRV pfnCallback, PPDMQUEUE *ppQueue));
DECLR3CALLBACKMEMBER(int, pfnTMTimerCreate,(PPDMDRVINS pDrvIns, TMCLOCK enmClock, PFNTMTIMERDRV pfnCallback, void *pvUser, uint32_t fFlags, const char *pszDesc, PPTMTIMERR3 ppTimer));
DECLR3CALLBACKMEMBER(int, pfnSSMRegister,(PPDMDRVINS pDrvIns, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess,
DECLR3CALLBACKMEMBER(int, pfnSSMDeregister,(PPDMDRVINS pDrvIns, const char *pszName, uint32_t u32Instance));
DECLR3CALLBACKMEMBER(void, pfnSTAMRegister,(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, const char *pszName,
* @param enmVisibility Visibility type specifying whether unused statistics should be visible or not.
DECLR3CALLBACKMEMBER(void, pfnSTAMRegisterF,(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
* @param enmVisibility Visibility type specifying whether unused statistics should be visible or not.
DECLR3CALLBACKMEMBER(void, pfnSTAMRegisterV,(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
DECLR3CALLBACKMEMBER(int, pfnSUPCallVMMR0Ex,(PPDMDRVINS pDrvIns, unsigned uOperation, void *pvArg, unsigned cbArg));
DECLR3CALLBACKMEMBER(int, pfnUSBRegisterHub,(PPDMDRVINS pDrvIns, uint32_t fVersions, uint32_t cPorts, PCPDMUSBHUBREG pUsbHubReg, PPCPDMUSBHUBHLP ppUsbHubHlp));
DECLR3CALLBACKMEMBER(int, pfnPDMThreadCreate,(PPDMDRVINS pDrvIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDRV pfnThread,
DECLR3CALLBACKMEMBER(int, pfnPDMAsyncCompletionTemplateCreate,(PPDMDRVINS pDrvIns, PPPDMASYNCCOMPLETIONTEMPLATE ppTemplate,
const char *pszDesc));
} PDMDRVHLP;
typedef struct PDMDRVINS
#ifdef PDMDRVINSINT_DECLARED
PDMDRVINSINT s;
} Internal;
} PDMDRVINS;
#define PDMIBASE_2_PDMDRV(pInterface) ( (PPDMDRVINS)((char *)(pInterface) - RT_OFFSETOF(PDMDRVINS, IBase)) )
DECLINLINE(int) PDMDrvHlpVMSetError(PPDMDRVINS pDrvIns, const int rc, RT_SRC_POS_DECL, const char *pszFormat, ...)
return rc;
DECLINLINE(int) PDMDrvHlpVMSetRuntimeError(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...)
int rc;
return rc;
#ifdef VBOX_STRICT
# define PDMDRV_ASSERT_EMT(pDrvIns) pDrvIns->pDrvHlp->pfnAssertEMT(pDrvIns, __FILE__, __LINE__, __FUNCTION__)
#ifdef VBOX_STRICT
# define PDMDRV_ASSERT_OTHER(pDrvIns) pDrvIns->pDrvHlp->pfnAssertOther(pDrvIns, __FILE__, __LINE__, __FUNCTION__)
#ifdef IN_RING3
DECLINLINE(int) PDMDrvHlpPDMQueueCreate(PPDMDRVINS pDrvIns, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
return pDrvIns->pDrvHlp->pfnPDMQueueCreate(pDrvIns, cbItem, cItems, cMilliesInterval, pfnCallback, ppQueue);
DECLINLINE(int) PDMDrvHlpTMTimerCreate(PPDMDRVINS pDrvIns, TMCLOCK enmClock, PFNTMTIMERDRV pfnCallback, void *pvUser, uint32_t fFlags, const char *pszDesc, PPTMTIMERR3 ppTimer)
return pDrvIns->pDrvHlp->pfnTMTimerCreate(pDrvIns, enmClock, pfnCallback, pvUser, fFlags, pszDesc, ppTimer);
DECLINLINE(int) PDMDrvHlpSSMRegister(PPDMDRVINS pDrvIns, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess,
DECLINLINE(void) PDMDrvHlpSTAMRegister(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, const char *pszName, STAMUNIT enmUnit, const char *pszDesc)
DECLINLINE(void) PDMDrvHlpSTAMRegisterF(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, STAMUNIT enmUnit,
pDrvIns->pDrvHlp->pfnSTAMRegisterV(pDrvIns, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, va);
DECLINLINE(int) PDMDrvHlpUSBRegisterHub(PPDMDRVINS pDrvIns, uint32_t fVersions, uint32_t cPorts, PCPDMUSBHUBREG pUsbHubReg, PPCPDMUSBHUBHLP ppUsbHubHlp)
DECLINLINE(int) PDMDrvHlpPDMThreadCreate(PPDMDRVINS pDrvIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDRV pfnThread,
return pDrvIns->pDrvHlp->pfnPDMThreadCreate(pDrvIns, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName);
DECLINLINE(int) PDMDrvHlpPDMAsyncCompletionTemplateCreate(PPDMDRVINS pDrvIns, PPPDMASYNCCOMPLETIONTEMPLATE ppTemplate,
return pDrvIns->pDrvHlp->pfnPDMAsyncCompletionTemplateCreate(pDrvIns, ppTemplate, pfnCompleted, pvTemplateUser, pszDesc);
typedef struct PDMDRVREGCB
} PDMDRVREGCB;