pdmdrv.h revision 29ffc69bf52217e6fa2386588fcf649bbac42589
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews/** @file
7d32c065c7bb56f281651ae3dd2888f32ce4f1d9Bob Halley * PDM - Pluggable Device Manager, Drivers.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence */
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews/*
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews * Copyright (C) 2006-2007 innotek GmbH
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence *
15a44745412679c30a6d022733925af70a38b715David Lawrence * This file is part of VirtualBox Open Source Edition (OSE), as
15a44745412679c30a6d022733925af70a38b715David Lawrence * available from http://www.virtualbox.org. This file is free software;
15a44745412679c30a6d022733925af70a38b715David Lawrence * you can redistribute it and/or modify it under the terms of the GNU
15a44745412679c30a6d022733925af70a38b715David Lawrence * General Public License as published by the Free Software Foundation,
15a44745412679c30a6d022733925af70a38b715David Lawrence * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
15a44745412679c30a6d022733925af70a38b715David Lawrence * distribution. VirtualBox OSE is distributed in the hope that it will
15a44745412679c30a6d022733925af70a38b715David Lawrence * be useful, but WITHOUT ANY WARRANTY of any kind.
15a44745412679c30a6d022733925af70a38b715David Lawrence */
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews#ifndef ___VBox_pdmdrv_h
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence#define ___VBox_pdmdrv_h
8cb85014a7e31d5edcfcc521ae4bd610b8eabfc3David Lawrence
8cb85014a7e31d5edcfcc521ae4bd610b8eabfc3David Lawrence#include <VBox/pdmqueue.h>
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews#include <VBox/pdmcritsect.h>
926234e867548c8c27428d0486a9a792535f8396David Lawrence#include <VBox/pdmthread.h>
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews#include <VBox/pdmifs.h>
854d0238dbc2908490197984b3b9d558008a53dfMark Andrews#include <VBox/pdmins.h>
854d0238dbc2908490197984b3b9d558008a53dfMark Andrews#include <VBox/tm.h>
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews#include <VBox/ssm.h>
6324997211a5e2d82528dcde98e8981190a35faeMichael Graff#include <VBox/cfgm.h>
6324997211a5e2d82528dcde98e8981190a35faeMichael Graff#include <VBox/dbgf.h>
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Graff#include <VBox/mm.h>
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrence#include <VBox/err.h>
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews#include <iprt/stdarg.h>
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews__BEGIN_DECLS
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews/** @defgroup grp_pdm_driver Drivers
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews * @ingroup grp_pdm
926234e867548c8c27428d0486a9a792535f8396David Lawrence * @{
926234e867548c8c27428d0486a9a792535f8396David Lawrence */
926234e867548c8c27428d0486a9a792535f8396David Lawrence
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews/**
34b394b43e2207e8f8f3703f0402422121455638David Lawrence * Construct a driver instance for a VM.
34b394b43e2207e8f8f3703f0402422121455638David Lawrence *
34b394b43e2207e8f8f3703f0402422121455638David Lawrence * @returns VBox status.
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews * @param pDrvIns The driver instance data.
3ddd92da6651bc72aa79a04195ad389d86fd1a66Andreas Gustafsson * If the registration structure is needed, pDrvIns->pDrvReg points to it.
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews * @param pCfgHandle Configuration node handle for the driver. Use this to obtain the configuration
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * of the driver instance. It's also found in pDrvIns->pCfgHandle as it's expected
34b394b43e2207e8f8f3703f0402422121455638David Lawrence * to be used frequently in this function.
34b394b43e2207e8f8f3703f0402422121455638David Lawrence */
34b394b43e2207e8f8f3703f0402422121455638David Lawrencetypedef DECLCALLBACK(int) FNPDMDRVCONSTRUCT(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews/** Pointer to a FNPDMDRVCONSTRUCT() function. */
c661868379d709416c773f6d53b5cec69c88e00fMark Andrewstypedef FNPDMDRVCONSTRUCT *PFNPDMDRVCONSTRUCT;
34b394b43e2207e8f8f3703f0402422121455638David Lawrence
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews/**
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews * Destruct a driver instance.
34b394b43e2207e8f8f3703f0402422121455638David Lawrence *
34b394b43e2207e8f8f3703f0402422121455638David Lawrence * Most VM resources are freed by the VM. This callback is provided so that
34b394b43e2207e8f8f3703f0402422121455638David Lawrence * any non-VM resources can be freed correctly.
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews *
3ddd92da6651bc72aa79a04195ad389d86fd1a66Andreas Gustafsson * @param pDrvIns The driver instance data.
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews */
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrewstypedef DECLCALLBACK(void) FNPDMDRVDESTRUCT(PPDMDRVINS pDrvIns);
822f6cdabb1edd44472c7a758b5cae71376fa9beBrian Wellington/** Pointer to a FNPDMDRVDESTRUCT() function. */
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrewstypedef FNPDMDRVDESTRUCT *PFNPDMDRVDESTRUCT;
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Graff/**
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrence * Driver I/O Control interface.
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews *
0e8cf9a887c70f96ac448b06c069d90b830215ccMark Andrews * This is used by external components, such as the COM interface, to
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews * communicate with a driver using a driver specific interface. Generally,
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews * the driver interfaces are used for this task.
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews *
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews * @returns VBox status code.
926234e867548c8c27428d0486a9a792535f8396David Lawrence * @param pDrvIns Pointer to the driver instance.
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews * @param uFunction Function to perform.
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews * @param pvIn Pointer to input data.
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews * @param cbIn Size of input data.
34b394b43e2207e8f8f3703f0402422121455638David Lawrence * @param pvOut Pointer to output data.
34b394b43e2207e8f8f3703f0402422121455638David Lawrence * @param cbOut Size of output data.
34b394b43e2207e8f8f3703f0402422121455638David Lawrence * @param pcbOut Where to store the actual size of the output data.
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews */
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrewstypedef DECLCALLBACK(int) FNPDMDRVIOCTL(PPDMDRVINS pDrvIns, RTUINT uFunction,
722cc17289e2bacad75cf16a7170485853f66274David Lawrence void *pvIn, RTUINT cbIn,
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews void *pvOut, RTUINT cbOut, PRTUINT pcbOut);
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews/** Pointer to a FNPDMDRVIOCTL() function. */
34b394b43e2207e8f8f3703f0402422121455638David Lawrencetypedef FNPDMDRVIOCTL *PFNPDMDRVIOCTL;
34b394b43e2207e8f8f3703f0402422121455638David Lawrence
34b394b43e2207e8f8f3703f0402422121455638David Lawrence/**
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews * Power On notification.
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews *
0e8cf9a887c70f96ac448b06c069d90b830215ccMark Andrews * @param pDrvIns The driver instance data.
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews */
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrewstypedef DECLCALLBACK(void) FNPDMDRVPOWERON(PPDMDRVINS pDrvIns);
34b394b43e2207e8f8f3703f0402422121455638David Lawrence/** Pointer to a FNPDMDRVPOWERON() function. */
34b394b43e2207e8f8f3703f0402422121455638David Lawrencetypedef FNPDMDRVPOWERON *PFNPDMDRVPOWERON;
34b394b43e2207e8f8f3703f0402422121455638David Lawrence
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews/**
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews * Reset notification.
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews *
34b394b43e2207e8f8f3703f0402422121455638David Lawrence * @returns VBox status.
34b394b43e2207e8f8f3703f0402422121455638David Lawrence * @param pDrvIns The driver instance data.
34b394b43e2207e8f8f3703f0402422121455638David Lawrence */
fad44a20eede1bbc66716241dede225500c91caaAndreas Gustafssontypedef DECLCALLBACK(void) FNPDMDRVRESET(PPDMDRVINS pDrvIns);
fad44a20eede1bbc66716241dede225500c91caaAndreas Gustafsson/** Pointer to a FNPDMDRVRESET() function. */
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafssontypedef FNPDMDRVRESET *PFNPDMDRVRESET;
926234e867548c8c27428d0486a9a792535f8396David Lawrence
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson/**
fad44a20eede1bbc66716241dede225500c91caaAndreas Gustafsson * Suspend notification.
fad44a20eede1bbc66716241dede225500c91caaAndreas Gustafsson *
419590499823ce15b5d2ad4fe71eaf04bd5a86c0Michael Graff * @returns VBox status.
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews * @param pDrvIns The driver instance data.
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews */
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Grafftypedef DECLCALLBACK(void) FNPDMDRVSUSPEND(PPDMDRVINS pDrvIns);
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrence/** Pointer to a FNPDMDRVSUSPEND() function. */
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrewstypedef FNPDMDRVSUSPEND *PFNPDMDRVSUSPEND;
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews/**
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * Resume notification.
926234e867548c8c27428d0486a9a792535f8396David Lawrence *
926234e867548c8c27428d0486a9a792535f8396David Lawrence * @returns VBox status.
926234e867548c8c27428d0486a9a792535f8396David Lawrence * @param pDrvIns The driver instance data.
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews */
6e49e91bd08778d7eae45a2229dcf41ed97cc636David Lawrencetypedef DECLCALLBACK(void) FNPDMDRVRESUME(PPDMDRVINS pDrvIns);
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews/** Pointer to a FNPDMDRVRESUME() function. */
419590499823ce15b5d2ad4fe71eaf04bd5a86c0Michael Grafftypedef FNPDMDRVRESUME *PFNPDMDRVRESUME;
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews/**
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews * Power Off notification.
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews *
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews * @param pDrvIns The driver instance data.
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Graff */
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrencetypedef DECLCALLBACK(void) FNPDMDRVPOWEROFF(PPDMDRVINS pDrvIns);
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews/** Pointer to a FNPDMDRVPOWEROFF() function. */
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrewstypedef FNPDMDRVPOWEROFF *PFNPDMDRVPOWEROFF;
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews/**
926234e867548c8c27428d0486a9a792535f8396David Lawrence * Detach notification.
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews *
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews * This is called when a driver below it in the chain is detaching itself
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews * from it. The driver should adjust it's state to reflect this.
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews *
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews * This is like ejecting a cdrom or floppy.
4529cdaedaf1a0a5f8ff89aeca510b7a4475446cBob Halley *
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrence * @param pDrvIns The driver instance.
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews */
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrewstypedef DECLCALLBACK(void) FNPDMDRVDETACH(PPDMDRVINS pDrvIns);
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews/** Pointer to a FNPDMDRVDETACH() function. */
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrewstypedef FNPDMDRVDETACH *PFNPDMDRVDETACH;
d981ca645597116d227a48bf37cc5edc061c854dBob Halley
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews/** PDM Driver Registration Structure,
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews * This structure is used when registering a driver from
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews * VBoxInitDrivers() (HC Ring-3). PDM will continue use till
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews * the VM is terminated.
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews */
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Grafftypedef struct PDMDRVREG
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrence{
373ce67419680a398ba3dc51a14a486caaf0afb0Mark Andrews /** Structure version. PDM_DRVREG_VERSION defines the current version. */
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews uint32_t u32Version;
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews /** Driver name. */
373ce67419680a398ba3dc51a14a486caaf0afb0Mark Andrews char szDriverName[32];
373ce67419680a398ba3dc51a14a486caaf0afb0Mark Andrews /** The description of the driver. The UTF-8 string pointed to shall, like this structure,
373ce67419680a398ba3dc51a14a486caaf0afb0Mark Andrews * remain unchanged from registration till VM destruction. */
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence const char *pszDescription;
373ce67419680a398ba3dc51a14a486caaf0afb0Mark Andrews
373ce67419680a398ba3dc51a14a486caaf0afb0Mark Andrews /** Flags, combination of the PDM_DRVREG_FLAGS_* \#defines. */
373ce67419680a398ba3dc51a14a486caaf0afb0Mark Andrews RTUINT fFlags;
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews /** Driver class(es), combination of the PDM_DRVREG_CLASS_* \#defines. */
373ce67419680a398ba3dc51a14a486caaf0afb0Mark Andrews RTUINT fClass;
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews /** Maximum number of instances (per VM). */
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews RTUINT cMaxInstances;
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Graff /** Size of the instance data. */
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrence RTUINT cbInstance;
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews /** Construct instance - required. */
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews PFNPDMDRVCONSTRUCT pfnConstruct;
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews /** Destruct instance - optional. */
3ef59f5561610808b3b52c1b254dc40d27bde5f9Mark Andrews PFNPDMDRVDESTRUCT pfnDestruct;
82ca33427bdd4f3bc4ed3431e86bd810fe751674Andreas Gustafsson /** I/O control - optional. */
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews PFNPDMDRVIOCTL pfnIOCtl;
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews /** Power on notification - optional. */
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews PFNPDMDRVPOWERON pfnPowerOn;
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews /** Reset notification - optional. */
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews PFNPDMDRVRESET pfnReset;
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews /** Suspend notification - optional. */
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews PFNPDMDRVSUSPEND pfnSuspend;
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews /** Resume notification - optional. */
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews PFNPDMDRVRESUME pfnResume;
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews /** Detach notification - optional. */
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews PFNPDMDRVDETACH pfnDetach;
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews /** Power off notification - optional. */
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews PFNPDMDRVPOWEROFF pfnPowerOff;
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews} PDMDRVREG;
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews/** Pointer to a PDM Driver Structure. */
9281e7aa775026dc47c01745fdcc438645146877Mark Andrewstypedef PDMDRVREG *PPDMDRVREG;
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews/** Const pointer to a PDM Driver Structure. */
9281e7aa775026dc47c01745fdcc438645146877Mark Andrewstypedef PDMDRVREG const *PCPDMDRVREG;
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews/** Current DRVREG version number. */
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews#define PDM_DRVREG_VERSION 0x80010000
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews/** PDM Device Flags.
12a12d8ab469ba71e8593a71c28d91d4b25d5863Mark Andrews * @{ */
94a3bcd132e515b4baa0884ba9dd0f361d2e17bcMark Andrews/** @def PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT
4529cdaedaf1a0a5f8ff89aeca510b7a4475446cBob Halley * The bit count for the current host. */
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrence#if HC_ARCH_BITS == 32
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrence# define PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT 0x000000001
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews#elif HC_ARCH_BITS == 64
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrence# define PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT 0x000000002
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews#else
82ca33427bdd4f3bc4ed3431e86bd810fe751674Andreas Gustafsson# error Unsupported HC_ARCH_BITS value.
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews#endif
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews/** The host bit count mask. */
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews#define PDM_DRVREG_FLAGS_HOST_BITS_MASK 0x000000003
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews/** @} */
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews
94a3bcd132e515b4baa0884ba9dd0f361d2e17bcMark Andrews
d981ca645597116d227a48bf37cc5edc061c854dBob Halley/** PDM Driver Classes.
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Graff * @{ */
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrence/** Mouse input driver. */
d981ca645597116d227a48bf37cc5edc061c854dBob Halley#define PDM_DRVREG_CLASS_MOUSE BIT(0)
d981ca645597116d227a48bf37cc5edc061c854dBob Halley/** Keyboard input driver. */
82ca33427bdd4f3bc4ed3431e86bd810fe751674Andreas Gustafsson#define PDM_DRVREG_CLASS_KEYBOARD BIT(1)
926234e867548c8c27428d0486a9a792535f8396David Lawrence/** Display driver. */
926234e867548c8c27428d0486a9a792535f8396David Lawrence#define PDM_DRVREG_CLASS_DISPLAY BIT(2)
d981ca645597116d227a48bf37cc5edc061c854dBob Halley/** Network transport driver. */
419590499823ce15b5d2ad4fe71eaf04bd5a86c0Michael Graff#define PDM_DRVREG_CLASS_NETWORK BIT(3)
d981ca645597116d227a48bf37cc5edc061c854dBob Halley/** Block driver. */
d981ca645597116d227a48bf37cc5edc061c854dBob Halley#define PDM_DRVREG_CLASS_BLOCK BIT(4)
3ddd814a97de1d152ba0913c592d6e6dc83d38a6Michael Graff/** Media driver. */
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrence#define PDM_DRVREG_CLASS_MEDIA BIT(5)
e27a69f8bd9538e08f775265167ba6cc5f47c587Bob Halley/** Mountable driver. */
e27a69f8bd9538e08f775265167ba6cc5f47c587Bob Halley#define PDM_DRVREG_CLASS_MOUNTABLE BIT(6)
e27a69f8bd9538e08f775265167ba6cc5f47c587Bob Halley/** Audio driver. */
e27a69f8bd9538e08f775265167ba6cc5f47c587Bob Halley#define PDM_DRVREG_CLASS_AUDIO BIT(7)
e27a69f8bd9538e08f775265167ba6cc5f47c587Bob Halley/** VMMDev driver. */
e27a69f8bd9538e08f775265167ba6cc5f47c587Bob Halley#define PDM_DRVREG_CLASS_VMMDEV BIT(8)
e27a69f8bd9538e08f775265167ba6cc5f47c587Bob Halley/** Status driver. */
e27a69f8bd9538e08f775265167ba6cc5f47c587Bob Halley#define PDM_DRVREG_CLASS_STATUS BIT(9)
e27a69f8bd9538e08f775265167ba6cc5f47c587Bob Halley/** ACPI driver. */
854d0238dbc2908490197984b3b9d558008a53dfMark Andrews#define PDM_DRVREG_CLASS_ACPI BIT(10)
/** USB related driver. */
#define PDM_DRVREG_CLASS_USB BIT(11)
/** ISCSI Transport related driver. */
#define PDM_DRVREG_CLASS_ISCSITRANSPORT BIT(12)
/** Char driver. */
#define PDM_DRVREG_CLASS_CHAR BIT(13)
/** Stream driver. */
#define PDM_DRVREG_CLASS_STREAM BIT(14)
/** @} */
/**
* Poller callback.
*
* @param pDrvIns The driver instance.
*/
typedef DECLCALLBACK(void) FNPDMDRVPOLLER(PPDMDRVINS pDrvIns);
/** Pointer to a FNPDMDRVPOLLER function. */
typedef FNPDMDRVPOLLER *PFNPDMDRVPOLLER;
#ifdef IN_RING3
/**
* PDM Driver API.
*/
typedef struct PDMDRVHLP
{
/** Structure version. PDM_DRVHLP_VERSION defines the current version. */
uint32_t u32Version;
/**
* Attaches a driver (chain) to the driver.
*
* @returns VBox status code.
* @param pDrvIns Driver instance.
* @param ppBaseInterface Where to store the pointer to the base interface.
*/
DECLR3CALLBACKMEMBER(int, pfnAttach,(PPDMDRVINS pDrvIns, PPDMIBASE *ppBaseInterface));
/**
* Detach the driver the drivers below us.
*
* @returns VBox status code.
* @param pDrvIns Driver instance.
*/
DECLR3CALLBACKMEMBER(int, pfnDetach,(PPDMDRVINS pDrvIns));
/**
* Detach the driver from the driver above it and destroy this
* driver and all drivers below it.
*
* @returns VBox status code.
* @param pDrvIns Driver instance.
*/
DECLR3CALLBACKMEMBER(int, pfnDetachSelf,(PPDMDRVINS pDrvIns));
/**
* Prepare a media mount.
*
* The driver must not have anything attached to itself
* when calling this function as the purpose is to set up the configuration
* of an future attachment.
*
* @returns VBox status code
* @param pDrvIns Driver instance.
* @param pszFilename Pointer to filename. If this is NULL it assumed that the caller have
* constructed a configuration which can be attached to the bottom driver.
* @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));
/**
* Assert that the current thread is the emulation thread.
*
* @returns True if correct.
* @returns False if wrong.
* @param pDrvIns Driver instance.
* @param pszFile Filename of the assertion location.
* @param iLine Linenumber of the assertion location.
* @param pszFunction Function of the assertion location.
*/
DECLR3CALLBACKMEMBER(bool, pfnAssertEMT,(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction));
/**
* Assert that the current thread is NOT the emulation thread.
*
* @returns True if correct.
* @returns False if wrong.
* @param pDrvIns Driver instance.
* @param pszFile Filename of the assertion location.
* @param iLine Linenumber of the assertion location.
* @param pszFunction Function of the assertion location.
*/
DECLR3CALLBACKMEMBER(bool, pfnAssertOther,(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction));
/**
* Set the VM error message
*
* @returns rc.
* @param pDrvIns Driver instance.
* @param rc VBox status code.
* @param RT_SRC_POS_DECL Use RT_SRC_POS.
* @param pszFormat Error message format string.
* @param ... Error message arguments.
*/
DECLR3CALLBACKMEMBER(int, pfnVMSetError,(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...));
/**
* Set the VM error message
*
* @returns rc.
* @param pDrvIns Driver instance.
* @param rc VBox status code.
* @param RT_SRC_POS_DECL Use RT_SRC_POS.
* @param pszFormat Error message format string.
* @param va Error message arguments.
*/
DECLR3CALLBACKMEMBER(int, pfnVMSetErrorV,(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va));
/**
* Set the VM runtime error message
*
* @returns VBox status code.
* @param pDrvIns Driver instance.
* @param fFatal Whether it is a fatal error or not.
* @param pszErrorID Error ID string.
* @param pszFormat Error message format string.
* @param ... Error message arguments.
*/
DECLR3CALLBACKMEMBER(int, pfnVMSetRuntimeError,(PPDMDRVINS pDrvIns, bool fFatal, const char *pszErrorID, const char *pszFormat, ...));
/**
* Set the VM runtime error message
*
* @returns VBox status code.
* @param pDrvIns Driver instance.
* @param fFatal Whether it is a fatal error or not.
* @param pszErrorID Error ID string.
* @param pszFormat Error message format string.
* @param va Error message arguments.
*/
DECLR3CALLBACKMEMBER(int, pfnVMSetRuntimeErrorV,(PPDMDRVINS pDrvIns, bool fFatal, const char *pszErrorID, const char *pszFormat, va_list va));
/**
* Create a queue.
*
* @returns VBox status code.
* @param pDrvIns Driver instance.
* @param cbItem Size a queue item.
* @param cItems Number of items in the queue.
* @param cMilliesInterval Number of milliseconds between polling the queue.
* If 0 then the emulation thread will be notified whenever an item arrives.
* @param pfnCallback The consumer function.
* @param ppQueue Where to store the queue handle on success.
* @thread The emulation thread.
*/
DECLR3CALLBACKMEMBER(int, pfnPDMQueueCreate,(PPDMDRVINS pDrvIns, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval, PFNPDMQUEUEDRV pfnCallback, PPDMQUEUE *ppQueue));
/**
* Register a poller function.
* TEMPORARY HACK FOR NETWORKING! DON'T USE!
*
* @returns VBox status code.
* @param pDrvIns Driver instance.
* @param pfnPoller The callback function.
*/
DECLR3CALLBACKMEMBER(int, pfnPDMPollerRegister,(PPDMDRVINS pDrvIns, PFNPDMDRVPOLLER pfnPoller));
/**
* Query the virtual timer frequency.
*
* @returns Frequency in Hz.
* @param pDrvIns Driver instance.
* @thread Any thread.
*/
DECLR3CALLBACKMEMBER(uint64_t, pfnTMGetVirtualFreq,(PPDMDRVINS pDrvIns));
/**
* Query the virtual time.
*
* @returns The current virtual time.
* @param pDrvIns Driver instance.
* @thread Any thread.
*/
DECLR3CALLBACKMEMBER(uint64_t, pfnTMGetVirtualTime,(PPDMDRVINS pDrvIns));
/**
* Creates a timer.
*
* @returns VBox status.
* @param pDrvIns Driver instance.
* @param enmClock The clock to use on this timer.
* @param pfnCallback Callback function.
* @param pszDesc Pointer to description string which must stay around
* until the timer is fully destroyed (i.e. a bit after TMTimerDestroy()).
* @param ppTimer Where to store the timer on success.
*/
DECLR3CALLBACKMEMBER(int, pfnTMTimerCreate,(PPDMDRVINS pDrvIns, TMCLOCK enmClock, PFNTMTIMERDRV pfnCallback, const char *pszDesc, PPTMTIMERR3 ppTimer));
/**
* Register a save state data unit.
*
* @returns VBox status.
* @param pDrvIns Driver instance.
* @param pszName Data unit name.
* @param u32Instance The instance identifier of the data unit.
* This must together with the name be unique.
* @param u32Version Data layout version number.
* @param cbGuess The approximate amount of data in the unit.
* Only for progress indicators.
* @param pfnSavePrep Prepare save callback, optional.
* @param pfnSaveExec Execute save callback, optional.
* @param pfnSaveDone Done save callback, optional.
* @param pfnLoadPrep Prepare load callback, optional.
* @param pfnLoadExec Execute load callback, optional.
* @param pfnLoadDone Done load callback, optional.
*/
DECLR3CALLBACKMEMBER(int, pfnSSMRegister,(PPDMDRVINS pDrvIns, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess,
PFNSSMDRVSAVEPREP pfnSavePrep, PFNSSMDRVSAVEEXEC pfnSaveExec, PFNSSMDRVSAVEDONE pfnSaveDone,
PFNSSMDRVLOADPREP pfnLoadPrep, PFNSSMDRVLOADEXEC pfnLoadExec, PFNSSMDRVLOADDONE pfnLoadDone));
/**
* Deregister a save state data unit.
*
* @returns VBox status.
* @param pDrvIns Driver instance.
* @param pszName Data unit name.
* @param u32Instance The instance identifier of the data unit.
* This must together with the name be unique.
*/
DECLR3CALLBACKMEMBER(int, pfnSSMDeregister,(PPDMDRVINS pDrvIns, const char *pszName, uint32_t u32Instance));
/**
* Registers a statistics sample if statistics are enabled.
*
* @param pDrvIns Driver instance.
* @param pvSample Pointer to the sample.
* @param enmType Sample type. This indicates what pvSample is pointing at.
* @param pszName Sample name. The name is on this form "/<component>/<sample>".
* Further nesting is possible.
* @param enmUnit Sample unit.
* @param pszDesc Sample description.
*/
DECLR3CALLBACKMEMBER(void, pfnSTAMRegister,(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, const char *pszName,
STAMUNIT enmUnit, const char *pszDesc));
/**
* Same as pfnSTAMRegister except that the name is specified in a
* RTStrPrintf like fashion.
*
* @returns VBox status.
* @param pDrvIns Driver instance.
* @param pvSample Pointer to the sample.
* @param enmType Sample type. This indicates what pvSample is pointing at.
* @param enmVisibility Visibility type specifying whether unused statistics should be visible or not.
* @param enmUnit Sample unit.
* @param pszDesc Sample description.
* @param pszName The sample name format string.
* @param ... Arguments to the format string.
*/
DECLR3CALLBACKMEMBER(void, pfnSTAMRegisterF,(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
STAMUNIT enmUnit, const char *pszDesc, const char *pszName, ...));
/**
* Same as pfnSTAMRegister except that the name is specified in a
* RTStrPrintfV like fashion.
*
* @returns VBox status.
* @param pDrvIns Driver instance.
* @param pvSample Pointer to the sample.
* @param enmType Sample type. This indicates what pvSample is pointing at.
* @param enmVisibility Visibility type specifying whether unused statistics should be visible or not.
* @param enmUnit Sample unit.
* @param pszDesc Sample description.
* @param pszName The sample name format string.
* @param args Arguments to the format string.
*/
DECLR3CALLBACKMEMBER(void, pfnSTAMRegisterV,(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
STAMUNIT enmUnit, const char *pszDesc, const char *pszName, va_list args));
/**
* Calls the HC R0 VMM entry point, in a safer but slower manner than SUPCallVMMR0.
*
* When entering using this call the R0 components can call into the host kernel
* (i.e. use the SUPR0 and RT APIs).
*
* See VMMR0Entry() for more details.
*
* @returns error code specific to uFunction.
* @param pDrvIns The driver instance.
* @param uOperation Operation to execute.
* This is limited to services.
* @param pvArg Pointer to argument structure or if cbArg is 0 just an value.
* @param cbArg The size of the argument. This is used to copy whatever the argument
* points at into a kernel buffer to avoid problems like the user page
* being invalidated while we're executing the call.
*/
DECLR3CALLBACKMEMBER(int, pfnSUPCallVMMR0Ex,(PPDMDRVINS pDrvIns, unsigned uOperation, void *pvArg, unsigned cbArg));
/**
* Registers a USB HUB.
*
* @returns VBox status code.
* @param pDrvIns The driver instance.
* @param pvReserved Reserved for future inteface callback structure.
* @param ppvReservedHlp Reserved for future helper callback structure.
*
* @thread EMT.
*/
DECLR3CALLBACKMEMBER(int, pfnUSBRegisterHub,(PPDMDRVINS pDrvIns, void *pvReservedIn, void **ppvReservedHlp));
/**
* Creates a PDM thread.
*
* This differs from the RTThreadCreate() API in that PDM takes care of suspending,
* resuming, and destroying the thread as the VM state changes.
*
* @returns VBox status code.
* @param pDrvIns The driver instance.
* @param ppThread Where to store the thread 'handle'.
* @param pvUser The user argument to the thread function.
* @param pfnThread The thread function.
* @param pfnWakeup The wakup callback. This is called on the EMT thread when
* a state change is pending.
* @param cbStack See RTThreadCreate.
* @param enmType See RTThreadCreate.
* @param pszName See RTThreadCreate.
*/
DECLR3CALLBACKMEMBER(int, pfnPDMThreadCreate,(PPDMDRVINS pDrvIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDRV pfnThread,
PFNPDMTHREADWAKEUPDRV pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName));
/** Just a safety precaution. */
uint32_t u32TheEnd;
} PDMDRVHLP;
/** Pointer PDM Driver API. */
typedef PDMDRVHLP *PPDMDRVHLP;
/** Pointer const PDM Driver API. */
typedef const PDMDRVHLP *PCPDMDRVHLP;
/** Current DRVHLP version number. */
#define PDM_DRVHLP_VERSION 0x90020000
/**
* PDM Driver Instance.
*/
typedef struct PDMDRVINS
{
/** Structure version. PDM_DRVINS_VERSION defines the current version. */
uint32_t u32Version;
/** Internal data. */
union
{
#ifdef PDMDRVINSINT_DECLARED
PDMDRVINSINT s;
#endif
uint8_t padding[HC_ARCH_BITS == 32 ? 32 : 64];
} Internal;
/** Pointer the PDM Driver API. */
R3PTRTYPE(PCPDMDRVHLP) pDrvHlp;
/** Pointer to driver registration structure. */
R3PTRTYPE(PCPDMDRVREG) pDrvReg;
/** Configuration handle. */
R3PTRTYPE(PCFGMNODE) pCfgHandle;
/** Driver instance number. */
RTUINT iInstance;
/** Pointer to the base interface of the device/driver instance above. */
R3PTRTYPE(PPDMIBASE) pUpBase;
/** Pointer to the base interface of the driver instance below. */
R3PTRTYPE(PPDMIBASE) pDownBase;
/** The base interface of the driver.
* The driver constructor initializes this. */
PDMIBASE IBase;
/* padding to make achInstanceData aligned at 16 byte boundrary. */
uint32_t au32Padding[HC_ARCH_BITS == 32 ? 3 : 1];
/** Pointer to driver instance data. */
R3PTRTYPE(void *) pvInstanceData;
/** Driver instance data. The size of this area is defined
* in the PDMDRVREG::cbInstanceData field. */
char achInstanceData[4];
} PDMDRVINS;
/** Current DRVREG version number. */
#define PDM_DRVINS_VERSION 0xa0010000
/** Converts a pointer to the PDMDRVINS::IBase to a pointer to PDMDRVINS. */
#define PDMIBASE_2_PDMDRV(pInterface) ( (PPDMDRVINS)((char *)(pInterface) - RT_OFFSETOF(PDMDRVINS, IBase)) )
/**
* @copydoc PDMDRVHLP::pfnVMSetError
*/
DECLINLINE(int) PDMDrvHlpVMSetError(PPDMDRVINS pDrvIns, const int rc, RT_SRC_POS_DECL, const char *pszFormat, ...)
{
va_list va;
va_start(va, pszFormat);
pDrvIns->pDrvHlp->pfnVMSetErrorV(pDrvIns, rc, RT_SRC_POS_ARGS, pszFormat, va);
va_end(va);
return rc;
}
/** @def PDMDRV_SET_ERROR
* Set the VM error. See PDMDrvHlpVMSetError() for printf like message formatting.
*/
#define PDMDRV_SET_ERROR(pDrvIns, rc, pszError) \
PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, "%s", pszError)
/**
* @copydoc PDMDRVHLP::pfnVMSetRuntimeError
*/
DECLINLINE(int) PDMDrvHlpVMSetRuntimeError(PPDMDRVINS pDrvIns, bool fFatal, const char *pszErrorID, const char *pszFormat, ...)
{
va_list va;
int rc;
va_start(va, pszFormat);
rc = pDrvIns->pDrvHlp->pfnVMSetRuntimeErrorV(pDrvIns, fFatal, pszErrorID, pszFormat, va);
va_end(va);
return rc;
}
/** @def PDMDRV_SET_RUNTIME_ERROR
* Set the VM runtime error. See PDMDrvHlpVMSetRuntimeError() for printf like message formatting.
*/
#define PDMDRV_SET_RUNTIME_ERROR(pDrvIns, fFatal, pszErrorID, pszError) \
PDMDrvHlpVMSetRuntimeError(pDrvIns, fFatal, pszErrorID, "%s", pszError)
#endif /* IN_RING3 */
/** @def PDMDRV_ASSERT_EMT
* Assert that the current thread is the emulation thread.
*/
#ifdef VBOX_STRICT
# define PDMDRV_ASSERT_EMT(pDrvIns) pDrvIns->pDrvHlp->pfnAssertEMT(pDrvIns, __FILE__, __LINE__, __FUNCTION__)
#else
# define PDMDRV_ASSERT_EMT(pDrvIns) do { } while (0)
#endif
/** @def PDMDRV_ASSERT_OTHER
* Assert that the current thread is NOT the emulation thread.
*/
#ifdef VBOX_STRICT
# define PDMDRV_ASSERT_OTHER(pDrvIns) pDrvIns->pDrvHlp->pfnAssertOther(pDrvIns, __FILE__, __LINE__, __FUNCTION__)
#else
# define PDMDRV_ASSERT_OTHER(pDrvIns) do { } while (0)
#endif
#ifdef IN_RING3
/**
* @copydoc PDMDRVHLP::pfnSTAMRegister
*/
DECLINLINE(void) PDMDrvHlpSTAMRegister(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, const char *pszName, STAMUNIT enmUnit, const char *pszDesc)
{
pDrvIns->pDrvHlp->pfnSTAMRegister(pDrvIns, pvSample, enmType, pszName, enmUnit, pszDesc);
}
/**
* @copydoc PDMDRVHLP::pfnSTAMRegisterF
*/
DECLINLINE(void) PDMDrvHlpSTAMRegisterF(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, STAMUNIT enmUnit,
const char *pszDesc, const char *pszName, ...)
{
va_list va;
va_start(va, pszName);
pDrvIns->pDrvHlp->pfnSTAMRegisterV(pDrvIns, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, va);
va_end(va);
}
/**
* @copydoc PDMDRVHLP::pfnUSBRegisterHub
*/
DECLINLINE(int) PDMDrvHlpUSBRegisterHub(PPDMDRVINS pDrvIns, void *pvReservedIn, void **ppvReservedHlp)
{
return pDrvIns->pDrvHlp->pfnUSBRegisterHub(pDrvIns, pvReservedIn, ppvReservedHlp);
}
/**
* @copydoc PDMDRVHLP::pfnPDMThreadCreate
*/
DECLINLINE(int) PDMDrvHlpPDMThreadCreate(PPDMDRVINS pDrvIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDRV pfnThread,
PFNPDMTHREADWAKEUPDRV pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName)
{
return pDrvIns->pDrvHlp->pfnPDMThreadCreate(pDrvIns, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName);
}
#endif /* IN_RING3 */
/** Pointer to callbacks provided to the VBoxDriverRegister() call. */
typedef struct PDMDRVREGCB *PPDMDRVREGCB;
/** Pointer to const callbacks provided to the VBoxDriverRegister() call. */
typedef const struct PDMDRVREGCB *PCPDMDRVREGCB;
/**
* Callbacks for VBoxDriverRegister().
*/
typedef struct PDMDRVREGCB
{
/** Interface version.
* This is set to PDM_DRVREG_CB_VERSION. */
uint32_t u32Version;
/**
* Registers a driver with the current VM instance.
*
* @returns VBox status code.
* @param pCallbacks Pointer to the callback table.
* @param pDrvReg Pointer to the driver registration record.
* This data must be permanent and readonly.
*/
DECLR3CALLBACKMEMBER(int, pfnRegister,(PCPDMDRVREGCB pCallbacks, PCPDMDRVREG pDrvReg));
} PDMDRVREGCB;
/** Current version of the PDMDRVREGCB structure. */
#define PDM_DRVREG_CB_VERSION 0xb0010000
/**
* The VBoxDriverRegister callback function.
*
* PDM will invoke this function after loading a driver module and letting
* the module decide which drivers to register and how to handle conflicts.
*
* @returns VBox status code.
* @param pCallbacks Pointer to the callback table.
* @param u32Version VBox version number.
*/
typedef DECLCALLBACK(int) FNPDMVBOXDRIVERSREGISTER(PCPDMDRVREGCB pCallbacks, uint32_t u32Version);
/**
* Register external drivers
*
* @returns VBox status code.
* @param pVM The VM to operate on.
* @param pfnCallback Driver registration callback
*/
PDMR3DECL(int) PDMR3RegisterDrivers(PVM pVM, FNPDMVBOXDRIVERSREGISTER pfnCallback);
/** @} */
__END_DECLS
#endif