1 | /** @file
|
---|
2 | * PDM - Pluggable Device Manager, Drivers.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef ___VBox_pdmdrv_h
|
---|
27 | #define ___VBox_pdmdrv_h
|
---|
28 |
|
---|
29 | #include <VBox/pdmqueue.h>
|
---|
30 | #include <VBox/pdmcritsect.h>
|
---|
31 | #include <VBox/pdmthread.h>
|
---|
32 | #include <VBox/pdmifs.h>
|
---|
33 | #include <VBox/pdmins.h>
|
---|
34 | #include <VBox/tm.h>
|
---|
35 | #include <VBox/ssm.h>
|
---|
36 | #include <VBox/cfgm.h>
|
---|
37 | #include <VBox/dbgf.h>
|
---|
38 | #include <VBox/mm.h>
|
---|
39 | #include <VBox/err.h>
|
---|
40 | #include <iprt/stdarg.h>
|
---|
41 |
|
---|
42 | __BEGIN_DECLS
|
---|
43 |
|
---|
44 | /** @defgroup grp_pdm_driver Drivers
|
---|
45 | * @ingroup grp_pdm
|
---|
46 | * @{
|
---|
47 | */
|
---|
48 |
|
---|
49 | /**
|
---|
50 | * Construct a driver instance for a VM.
|
---|
51 | *
|
---|
52 | * @returns VBox status.
|
---|
53 | * @param pDrvIns The driver instance data.
|
---|
54 | * If the registration structure is needed, pDrvIns->pDrvReg points to it.
|
---|
55 | * @param pCfgHandle Configuration node handle for the driver. Use this to obtain the configuration
|
---|
56 | * of the driver instance. It's also found in pDrvIns->pCfgHandle as it's expected
|
---|
57 | * to be used frequently in this function.
|
---|
58 | */
|
---|
59 | typedef DECLCALLBACK(int) FNPDMDRVCONSTRUCT(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
|
---|
60 | /** Pointer to a FNPDMDRVCONSTRUCT() function. */
|
---|
61 | typedef FNPDMDRVCONSTRUCT *PFNPDMDRVCONSTRUCT;
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * Destruct a driver instance.
|
---|
65 | *
|
---|
66 | * Most VM resources are freed by the VM. This callback is provided so that
|
---|
67 | * any non-VM resources can be freed correctly.
|
---|
68 | *
|
---|
69 | * @param pDrvIns The driver instance data.
|
---|
70 | */
|
---|
71 | typedef DECLCALLBACK(void) FNPDMDRVDESTRUCT(PPDMDRVINS pDrvIns);
|
---|
72 | /** Pointer to a FNPDMDRVDESTRUCT() function. */
|
---|
73 | typedef FNPDMDRVDESTRUCT *PFNPDMDRVDESTRUCT;
|
---|
74 |
|
---|
75 | /**
|
---|
76 | * Driver I/O Control interface.
|
---|
77 | *
|
---|
78 | * This is used by external components, such as the COM interface, to
|
---|
79 | * communicate with a driver using a driver specific interface. Generally,
|
---|
80 | * the driver interfaces are used for this task.
|
---|
81 | *
|
---|
82 | * @returns VBox status code.
|
---|
83 | * @param pDrvIns Pointer to the driver instance.
|
---|
84 | * @param uFunction Function to perform.
|
---|
85 | * @param pvIn Pointer to input data.
|
---|
86 | * @param cbIn Size of input data.
|
---|
87 | * @param pvOut Pointer to output data.
|
---|
88 | * @param cbOut Size of output data.
|
---|
89 | * @param pcbOut Where to store the actual size of the output data.
|
---|
90 | */
|
---|
91 | typedef DECLCALLBACK(int) FNPDMDRVIOCTL(PPDMDRVINS pDrvIns, RTUINT uFunction,
|
---|
92 | void *pvIn, RTUINT cbIn,
|
---|
93 | void *pvOut, RTUINT cbOut, PRTUINT pcbOut);
|
---|
94 | /** Pointer to a FNPDMDRVIOCTL() function. */
|
---|
95 | typedef FNPDMDRVIOCTL *PFNPDMDRVIOCTL;
|
---|
96 |
|
---|
97 | /**
|
---|
98 | * Power On notification.
|
---|
99 | *
|
---|
100 | * @param pDrvIns The driver instance data.
|
---|
101 | */
|
---|
102 | typedef DECLCALLBACK(void) FNPDMDRVPOWERON(PPDMDRVINS pDrvIns);
|
---|
103 | /** Pointer to a FNPDMDRVPOWERON() function. */
|
---|
104 | typedef FNPDMDRVPOWERON *PFNPDMDRVPOWERON;
|
---|
105 |
|
---|
106 | /**
|
---|
107 | * Reset notification.
|
---|
108 | *
|
---|
109 | * @returns VBox status.
|
---|
110 | * @param pDrvIns The driver instance data.
|
---|
111 | */
|
---|
112 | typedef DECLCALLBACK(void) FNPDMDRVRESET(PPDMDRVINS pDrvIns);
|
---|
113 | /** Pointer to a FNPDMDRVRESET() function. */
|
---|
114 | typedef FNPDMDRVRESET *PFNPDMDRVRESET;
|
---|
115 |
|
---|
116 | /**
|
---|
117 | * Suspend notification.
|
---|
118 | *
|
---|
119 | * @returns VBox status.
|
---|
120 | * @param pDrvIns The driver instance data.
|
---|
121 | */
|
---|
122 | typedef DECLCALLBACK(void) FNPDMDRVSUSPEND(PPDMDRVINS pDrvIns);
|
---|
123 | /** Pointer to a FNPDMDRVSUSPEND() function. */
|
---|
124 | typedef FNPDMDRVSUSPEND *PFNPDMDRVSUSPEND;
|
---|
125 |
|
---|
126 | /**
|
---|
127 | * Resume notification.
|
---|
128 | *
|
---|
129 | * @returns VBox status.
|
---|
130 | * @param pDrvIns The driver instance data.
|
---|
131 | */
|
---|
132 | typedef DECLCALLBACK(void) FNPDMDRVRESUME(PPDMDRVINS pDrvIns);
|
---|
133 | /** Pointer to a FNPDMDRVRESUME() function. */
|
---|
134 | typedef FNPDMDRVRESUME *PFNPDMDRVRESUME;
|
---|
135 |
|
---|
136 | /**
|
---|
137 | * Power Off notification.
|
---|
138 | *
|
---|
139 | * @param pDrvIns The driver instance data.
|
---|
140 | */
|
---|
141 | typedef DECLCALLBACK(void) FNPDMDRVPOWEROFF(PPDMDRVINS pDrvIns);
|
---|
142 | /** Pointer to a FNPDMDRVPOWEROFF() function. */
|
---|
143 | typedef FNPDMDRVPOWEROFF *PFNPDMDRVPOWEROFF;
|
---|
144 |
|
---|
145 | /**
|
---|
146 | * Detach notification.
|
---|
147 | *
|
---|
148 | * This is called when a driver below it in the chain is detaching itself
|
---|
149 | * from it. The driver should adjust it's state to reflect this.
|
---|
150 | *
|
---|
151 | * This is like ejecting a cdrom or floppy.
|
---|
152 | *
|
---|
153 | * @param pDrvIns The driver instance.
|
---|
154 | */
|
---|
155 | typedef DECLCALLBACK(void) FNPDMDRVDETACH(PPDMDRVINS pDrvIns);
|
---|
156 | /** Pointer to a FNPDMDRVDETACH() function. */
|
---|
157 | typedef FNPDMDRVDETACH *PFNPDMDRVDETACH;
|
---|
158 |
|
---|
159 |
|
---|
160 |
|
---|
161 | /** PDM Driver Registration Structure,
|
---|
162 | * This structure is used when registering a driver from
|
---|
163 | * VBoxInitDrivers() (HC Ring-3). PDM will continue use till
|
---|
164 | * the VM is terminated.
|
---|
165 | */
|
---|
166 | typedef struct PDMDRVREG
|
---|
167 | {
|
---|
168 | /** Structure version. PDM_DRVREG_VERSION defines the current version. */
|
---|
169 | uint32_t u32Version;
|
---|
170 | /** Driver name. */
|
---|
171 | char szDriverName[32];
|
---|
172 | /** The description of the driver. The UTF-8 string pointed to shall, like this structure,
|
---|
173 | * remain unchanged from registration till VM destruction. */
|
---|
174 | const char *pszDescription;
|
---|
175 |
|
---|
176 | /** Flags, combination of the PDM_DRVREG_FLAGS_* \#defines. */
|
---|
177 | RTUINT fFlags;
|
---|
178 | /** Driver class(es), combination of the PDM_DRVREG_CLASS_* \#defines. */
|
---|
179 | RTUINT fClass;
|
---|
180 | /** Maximum number of instances (per VM). */
|
---|
181 | RTUINT cMaxInstances;
|
---|
182 | /** Size of the instance data. */
|
---|
183 | RTUINT cbInstance;
|
---|
184 |
|
---|
185 | /** Construct instance - required. */
|
---|
186 | PFNPDMDRVCONSTRUCT pfnConstruct;
|
---|
187 | /** Destruct instance - optional. */
|
---|
188 | PFNPDMDRVDESTRUCT pfnDestruct;
|
---|
189 | /** I/O control - optional. */
|
---|
190 | PFNPDMDRVIOCTL pfnIOCtl;
|
---|
191 | /** Power on notification - optional. */
|
---|
192 | PFNPDMDRVPOWERON pfnPowerOn;
|
---|
193 | /** Reset notification - optional. */
|
---|
194 | PFNPDMDRVRESET pfnReset;
|
---|
195 | /** Suspend notification - optional. */
|
---|
196 | PFNPDMDRVSUSPEND pfnSuspend;
|
---|
197 | /** Resume notification - optional. */
|
---|
198 | PFNPDMDRVRESUME pfnResume;
|
---|
199 | /** Detach notification - optional. */
|
---|
200 | PFNPDMDRVDETACH pfnDetach;
|
---|
201 | /** Power off notification - optional. */
|
---|
202 | PFNPDMDRVPOWEROFF pfnPowerOff;
|
---|
203 |
|
---|
204 | } PDMDRVREG;
|
---|
205 | /** Pointer to a PDM Driver Structure. */
|
---|
206 | typedef PDMDRVREG *PPDMDRVREG;
|
---|
207 | /** Const pointer to a PDM Driver Structure. */
|
---|
208 | typedef PDMDRVREG const *PCPDMDRVREG;
|
---|
209 |
|
---|
210 | /** Current DRVREG version number. */
|
---|
211 | #define PDM_DRVREG_VERSION 0x80010000
|
---|
212 |
|
---|
213 | /** PDM Device Flags.
|
---|
214 | * @{ */
|
---|
215 | /** @def PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT
|
---|
216 | * The bit count for the current host. */
|
---|
217 | #if HC_ARCH_BITS == 32
|
---|
218 | # define PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT 0x000000001
|
---|
219 | #elif HC_ARCH_BITS == 64
|
---|
220 | # define PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT 0x000000002
|
---|
221 | #else
|
---|
222 | # error Unsupported HC_ARCH_BITS value.
|
---|
223 | #endif
|
---|
224 | /** The host bit count mask. */
|
---|
225 | #define PDM_DRVREG_FLAGS_HOST_BITS_MASK 0x000000003
|
---|
226 |
|
---|
227 | /** @} */
|
---|
228 |
|
---|
229 |
|
---|
230 | /** PDM Driver Classes.
|
---|
231 | * @{ */
|
---|
232 | /** Mouse input driver. */
|
---|
233 | #define PDM_DRVREG_CLASS_MOUSE RT_BIT(0)
|
---|
234 | /** Keyboard input driver. */
|
---|
235 | #define PDM_DRVREG_CLASS_KEYBOARD RT_BIT(1)
|
---|
236 | /** Display driver. */
|
---|
237 | #define PDM_DRVREG_CLASS_DISPLAY RT_BIT(2)
|
---|
238 | /** Network transport driver. */
|
---|
239 | #define PDM_DRVREG_CLASS_NETWORK RT_BIT(3)
|
---|
240 | /** Block driver. */
|
---|
241 | #define PDM_DRVREG_CLASS_BLOCK RT_BIT(4)
|
---|
242 | /** Media driver. */
|
---|
243 | #define PDM_DRVREG_CLASS_MEDIA RT_BIT(5)
|
---|
244 | /** Mountable driver. */
|
---|
245 | #define PDM_DRVREG_CLASS_MOUNTABLE RT_BIT(6)
|
---|
246 | /** Audio driver. */
|
---|
247 | #define PDM_DRVREG_CLASS_AUDIO RT_BIT(7)
|
---|
248 | /** VMMDev driver. */
|
---|
249 | #define PDM_DRVREG_CLASS_VMMDEV RT_BIT(8)
|
---|
250 | /** Status driver. */
|
---|
251 | #define PDM_DRVREG_CLASS_STATUS RT_BIT(9)
|
---|
252 | /** ACPI driver. */
|
---|
253 | #define PDM_DRVREG_CLASS_ACPI RT_BIT(10)
|
---|
254 | /** USB related driver. */
|
---|
255 | #define PDM_DRVREG_CLASS_USB RT_BIT(11)
|
---|
256 | /** ISCSI Transport related driver. */
|
---|
257 | #define PDM_DRVREG_CLASS_ISCSITRANSPORT RT_BIT(12)
|
---|
258 | /** Char driver. */
|
---|
259 | #define PDM_DRVREG_CLASS_CHAR RT_BIT(13)
|
---|
260 | /** Stream driver. */
|
---|
261 | #define PDM_DRVREG_CLASS_STREAM RT_BIT(14)
|
---|
262 | /** @} */
|
---|
263 |
|
---|
264 |
|
---|
265 | /**
|
---|
266 | * USB hub registration structure.
|
---|
267 | */
|
---|
268 | typedef struct PDMUSBHUBREG
|
---|
269 | {
|
---|
270 | /** Structure version number. PDM_USBHUBREG_VERSION defines the current version. */
|
---|
271 | uint32_t u32Version;
|
---|
272 |
|
---|
273 | /**
|
---|
274 | * Request the hub to attach of the specified device.
|
---|
275 | *
|
---|
276 | * @returns VBox status code.
|
---|
277 | * @param pDrvIns The hub instance.
|
---|
278 | * @param pUsbIns The device to attach.
|
---|
279 | * @param piPort Where to store the port number the device was attached to.
|
---|
280 | * @thread EMT.
|
---|
281 | */
|
---|
282 | DECLR3CALLBACKMEMBER(int, pfnAttachDevice,(PPDMDRVINS pDrvIns, PPDMUSBINS pUsbIns, uint32_t *piPort));
|
---|
283 |
|
---|
284 | /**
|
---|
285 | * Request the hub to detach of the specified device.
|
---|
286 | *
|
---|
287 | * The device has previously been attached to the hub with the
|
---|
288 | * pfnAttachDevice call. This call is not currently expected to
|
---|
289 | * fail.
|
---|
290 | *
|
---|
291 | * @returns VBox status code.
|
---|
292 | * @param pDrvIns The hub instance.
|
---|
293 | * @param pUsbIns The device to detach.
|
---|
294 | * @param iPort The port number returned by the attach call.
|
---|
295 | * @thread EMT.
|
---|
296 | */
|
---|
297 | DECLR3CALLBACKMEMBER(int, pfnDetachDevice,(PPDMDRVINS pDrvIns, PPDMUSBINS pUsbIns, uint32_t iPort));
|
---|
298 |
|
---|
299 | /** Counterpart to u32Version, same value. */
|
---|
300 | uint32_t u32TheEnd;
|
---|
301 | } PDMUSBHUBREG;
|
---|
302 | /** Pointer to a const USB hub registration structure. */
|
---|
303 | typedef const PDMUSBHUBREG *PCPDMUSBHUBREG;
|
---|
304 |
|
---|
305 | /** Current PDMUSBHUBREG version number. */
|
---|
306 | #define PDM_USBHUBREG_VERSION 0xeb010000
|
---|
307 |
|
---|
308 |
|
---|
309 | /**
|
---|
310 | * USB hub helpers.
|
---|
311 | * This is currently just a place holder.
|
---|
312 | */
|
---|
313 | typedef struct PDMUSBHUBHLP
|
---|
314 | {
|
---|
315 | /** Structure version. PDM_USBHUBHLP_VERSION defines the current version. */
|
---|
316 | uint32_t u32Version;
|
---|
317 |
|
---|
318 | /** Just a safety precaution. */
|
---|
319 | uint32_t u32TheEnd;
|
---|
320 | } PDMUSBHUBHLP;
|
---|
321 | /** Pointer to PCI helpers. */
|
---|
322 | typedef PDMUSBHUBHLP *PPDMUSBHUBHLP;
|
---|
323 | /** Pointer to const PCI helpers. */
|
---|
324 | typedef const PDMUSBHUBHLP *PCPDMUSBHUBHLP;
|
---|
325 | /** Pointer to const PCI helpers pointer. */
|
---|
326 | typedef PCPDMUSBHUBHLP *PPCPDMUSBHUBHLP;
|
---|
327 |
|
---|
328 | /** Current PDMUSBHUBHLP version number. */
|
---|
329 | #define PDM_USBHUBHLP_VERSION 0xea010000
|
---|
330 |
|
---|
331 |
|
---|
332 |
|
---|
333 | /**
|
---|
334 | * Poller callback.
|
---|
335 | *
|
---|
336 | * @param pDrvIns The driver instance.
|
---|
337 | */
|
---|
338 | typedef DECLCALLBACK(void) FNPDMDRVPOLLER(PPDMDRVINS pDrvIns);
|
---|
339 | /** Pointer to a FNPDMDRVPOLLER function. */
|
---|
340 | typedef FNPDMDRVPOLLER *PFNPDMDRVPOLLER;
|
---|
341 |
|
---|
342 | #ifdef IN_RING3
|
---|
343 | /**
|
---|
344 | * PDM Driver API.
|
---|
345 | */
|
---|
346 | typedef struct PDMDRVHLP
|
---|
347 | {
|
---|
348 | /** Structure version. PDM_DRVHLP_VERSION defines the current version. */
|
---|
349 | uint32_t u32Version;
|
---|
350 |
|
---|
351 | /**
|
---|
352 | * Attaches a driver (chain) to the driver.
|
---|
353 | *
|
---|
354 | * @returns VBox status code.
|
---|
355 | * @param pDrvIns Driver instance.
|
---|
356 | * @param ppBaseInterface Where to store the pointer to the base interface.
|
---|
357 | */
|
---|
358 | DECLR3CALLBACKMEMBER(int, pfnAttach,(PPDMDRVINS pDrvIns, PPDMIBASE *ppBaseInterface));
|
---|
359 |
|
---|
360 | /**
|
---|
361 | * Detach the driver the drivers below us.
|
---|
362 | *
|
---|
363 | * @returns VBox status code.
|
---|
364 | * @param pDrvIns Driver instance.
|
---|
365 | */
|
---|
366 | DECLR3CALLBACKMEMBER(int, pfnDetach,(PPDMDRVINS pDrvIns));
|
---|
367 |
|
---|
368 | /**
|
---|
369 | * Detach the driver from the driver above it and destroy this
|
---|
370 | * driver and all drivers below it.
|
---|
371 | *
|
---|
372 | * @returns VBox status code.
|
---|
373 | * @param pDrvIns Driver instance.
|
---|
374 | */
|
---|
375 | DECLR3CALLBACKMEMBER(int, pfnDetachSelf,(PPDMDRVINS pDrvIns));
|
---|
376 |
|
---|
377 | /**
|
---|
378 | * Prepare a media mount.
|
---|
379 | *
|
---|
380 | * The driver must not have anything attached to itself
|
---|
381 | * when calling this function as the purpose is to set up the configuration
|
---|
382 | * of an future attachment.
|
---|
383 | *
|
---|
384 | * @returns VBox status code
|
---|
385 | * @param pDrvIns Driver instance.
|
---|
386 | * @param pszFilename Pointer to filename. If this is NULL it assumed that the caller have
|
---|
387 | * constructed a configuration which can be attached to the bottom driver.
|
---|
388 | * @param pszCoreDriver Core driver name. NULL will cause autodetection. Ignored if pszFilanem is NULL.
|
---|
389 | */
|
---|
390 | DECLR3CALLBACKMEMBER(int, pfnMountPrepare,(PPDMDRVINS pDrvIns, const char *pszFilename, const char *pszCoreDriver));
|
---|
391 |
|
---|
392 | /**
|
---|
393 | * Assert that the current thread is the emulation thread.
|
---|
394 | *
|
---|
395 | * @returns True if correct.
|
---|
396 | * @returns False if wrong.
|
---|
397 | * @param pDrvIns Driver instance.
|
---|
398 | * @param pszFile Filename of the assertion location.
|
---|
399 | * @param iLine Linenumber of the assertion location.
|
---|
400 | * @param pszFunction Function of the assertion location.
|
---|
401 | */
|
---|
402 | DECLR3CALLBACKMEMBER(bool, pfnAssertEMT,(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction));
|
---|
403 |
|
---|
404 | /**
|
---|
405 | * Assert that the current thread is NOT the emulation thread.
|
---|
406 | *
|
---|
407 | * @returns True if correct.
|
---|
408 | * @returns False if wrong.
|
---|
409 | * @param pDrvIns Driver instance.
|
---|
410 | * @param pszFile Filename of the assertion location.
|
---|
411 | * @param iLine Linenumber of the assertion location.
|
---|
412 | * @param pszFunction Function of the assertion location.
|
---|
413 | */
|
---|
414 | DECLR3CALLBACKMEMBER(bool, pfnAssertOther,(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction));
|
---|
415 |
|
---|
416 | /**
|
---|
417 | * Set the VM error message
|
---|
418 | *
|
---|
419 | * @returns rc.
|
---|
420 | * @param pDrvIns Driver instance.
|
---|
421 | * @param rc VBox status code.
|
---|
422 | * @param RT_SRC_POS_DECL Use RT_SRC_POS.
|
---|
423 | * @param pszFormat Error message format string.
|
---|
424 | * @param ... Error message arguments.
|
---|
425 | */
|
---|
426 | DECLR3CALLBACKMEMBER(int, pfnVMSetError,(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...));
|
---|
427 |
|
---|
428 | /**
|
---|
429 | * Set the VM error message
|
---|
430 | *
|
---|
431 | * @returns rc.
|
---|
432 | * @param pDrvIns Driver instance.
|
---|
433 | * @param rc VBox status code.
|
---|
434 | * @param RT_SRC_POS_DECL Use RT_SRC_POS.
|
---|
435 | * @param pszFormat Error message format string.
|
---|
436 | * @param va Error message arguments.
|
---|
437 | */
|
---|
438 | DECLR3CALLBACKMEMBER(int, pfnVMSetErrorV,(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va));
|
---|
439 |
|
---|
440 | /**
|
---|
441 | * Set the VM runtime error message
|
---|
442 | *
|
---|
443 | * @returns VBox status code.
|
---|
444 | * @param pDrvIns Driver instance.
|
---|
445 | * @param fFatal Whether it is a fatal error or not.
|
---|
446 | * @param pszErrorID Error ID string.
|
---|
447 | * @param pszFormat Error message format string.
|
---|
448 | * @param ... Error message arguments.
|
---|
449 | */
|
---|
450 | DECLR3CALLBACKMEMBER(int, pfnVMSetRuntimeError,(PPDMDRVINS pDrvIns, bool fFatal, const char *pszErrorID, const char *pszFormat, ...));
|
---|
451 |
|
---|
452 | /**
|
---|
453 | * Set the VM runtime error message
|
---|
454 | *
|
---|
455 | * @returns VBox status code.
|
---|
456 | * @param pDrvIns Driver instance.
|
---|
457 | * @param fFatal Whether it is a fatal error or not.
|
---|
458 | * @param pszErrorID Error ID string.
|
---|
459 | * @param pszFormat Error message format string.
|
---|
460 | * @param va Error message arguments.
|
---|
461 | */
|
---|
462 | DECLR3CALLBACKMEMBER(int, pfnVMSetRuntimeErrorV,(PPDMDRVINS pDrvIns, bool fFatal, const char *pszErrorID, const char *pszFormat, va_list va));
|
---|
463 |
|
---|
464 | /**
|
---|
465 | * Create a queue.
|
---|
466 | *
|
---|
467 | * @returns VBox status code.
|
---|
468 | * @param pDrvIns Driver instance.
|
---|
469 | * @param cbItem Size a queue item.
|
---|
470 | * @param cItems Number of items in the queue.
|
---|
471 | * @param cMilliesInterval Number of milliseconds between polling the queue.
|
---|
472 | * If 0 then the emulation thread will be notified whenever an item arrives.
|
---|
473 | * @param pfnCallback The consumer function.
|
---|
474 | * @param ppQueue Where to store the queue handle on success.
|
---|
475 | * @thread The emulation thread.
|
---|
476 | */
|
---|
477 | DECLR3CALLBACKMEMBER(int, pfnPDMQueueCreate,(PPDMDRVINS pDrvIns, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval, PFNPDMQUEUEDRV pfnCallback, PPDMQUEUE *ppQueue));
|
---|
478 |
|
---|
479 | /**
|
---|
480 | * Register a poller function.
|
---|
481 | * TEMPORARY HACK FOR NETWORKING! DON'T USE!
|
---|
482 | *
|
---|
483 | * @returns VBox status code.
|
---|
484 | * @param pDrvIns Driver instance.
|
---|
485 | * @param pfnPoller The callback function.
|
---|
486 | */
|
---|
487 | DECLR3CALLBACKMEMBER(int, pfnPDMPollerRegister,(PPDMDRVINS pDrvIns, PFNPDMDRVPOLLER pfnPoller));
|
---|
488 |
|
---|
489 | /**
|
---|
490 | * Query the virtual timer frequency.
|
---|
491 | *
|
---|
492 | * @returns Frequency in Hz.
|
---|
493 | * @param pDrvIns Driver instance.
|
---|
494 | * @thread Any thread.
|
---|
495 | */
|
---|
496 | DECLR3CALLBACKMEMBER(uint64_t, pfnTMGetVirtualFreq,(PPDMDRVINS pDrvIns));
|
---|
497 |
|
---|
498 | /**
|
---|
499 | * Query the virtual time.
|
---|
500 | *
|
---|
501 | * @returns The current virtual time.
|
---|
502 | * @param pDrvIns Driver instance.
|
---|
503 | * @thread Any thread.
|
---|
504 | */
|
---|
505 | DECLR3CALLBACKMEMBER(uint64_t, pfnTMGetVirtualTime,(PPDMDRVINS pDrvIns));
|
---|
506 |
|
---|
507 | /**
|
---|
508 | * Creates a timer.
|
---|
509 | *
|
---|
510 | * @returns VBox status.
|
---|
511 | * @param pDrvIns Driver instance.
|
---|
512 | * @param enmClock The clock to use on this timer.
|
---|
513 | * @param pfnCallback Callback function.
|
---|
514 | * @param pszDesc Pointer to description string which must stay around
|
---|
515 | * until the timer is fully destroyed (i.e. a bit after TMTimerDestroy()).
|
---|
516 | * @param ppTimer Where to store the timer on success.
|
---|
517 | */
|
---|
518 | DECLR3CALLBACKMEMBER(int, pfnTMTimerCreate,(PPDMDRVINS pDrvIns, TMCLOCK enmClock, PFNTMTIMERDRV pfnCallback, const char *pszDesc, PPTMTIMERR3 ppTimer));
|
---|
519 |
|
---|
520 | /**
|
---|
521 | * Register a save state data unit.
|
---|
522 | *
|
---|
523 | * @returns VBox status.
|
---|
524 | * @param pDrvIns Driver instance.
|
---|
525 | * @param pszName Data unit name.
|
---|
526 | * @param u32Instance The instance identifier of the data unit.
|
---|
527 | * This must together with the name be unique.
|
---|
528 | * @param u32Version Data layout version number.
|
---|
529 | * @param cbGuess The approximate amount of data in the unit.
|
---|
530 | * Only for progress indicators.
|
---|
531 | * @param pfnSavePrep Prepare save callback, optional.
|
---|
532 | * @param pfnSaveExec Execute save callback, optional.
|
---|
533 | * @param pfnSaveDone Done save callback, optional.
|
---|
534 | * @param pfnLoadPrep Prepare load callback, optional.
|
---|
535 | * @param pfnLoadExec Execute load callback, optional.
|
---|
536 | * @param pfnLoadDone Done load callback, optional.
|
---|
537 | */
|
---|
538 | DECLR3CALLBACKMEMBER(int, pfnSSMRegister,(PPDMDRVINS pDrvIns, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess,
|
---|
539 | PFNSSMDRVSAVEPREP pfnSavePrep, PFNSSMDRVSAVEEXEC pfnSaveExec, PFNSSMDRVSAVEDONE pfnSaveDone,
|
---|
540 | PFNSSMDRVLOADPREP pfnLoadPrep, PFNSSMDRVLOADEXEC pfnLoadExec, PFNSSMDRVLOADDONE pfnLoadDone));
|
---|
541 |
|
---|
542 | /**
|
---|
543 | * Deregister a save state data unit.
|
---|
544 | *
|
---|
545 | * @returns VBox status.
|
---|
546 | * @param pDrvIns Driver instance.
|
---|
547 | * @param pszName Data unit name.
|
---|
548 | * @param u32Instance The instance identifier of the data unit.
|
---|
549 | * This must together with the name be unique.
|
---|
550 | */
|
---|
551 | DECLR3CALLBACKMEMBER(int, pfnSSMDeregister,(PPDMDRVINS pDrvIns, const char *pszName, uint32_t u32Instance));
|
---|
552 |
|
---|
553 | /**
|
---|
554 | * Registers a statistics sample if statistics are enabled.
|
---|
555 | *
|
---|
556 | * @param pDrvIns Driver instance.
|
---|
557 | * @param pvSample Pointer to the sample.
|
---|
558 | * @param enmType Sample type. This indicates what pvSample is pointing at.
|
---|
559 | * @param pszName Sample name. The name is on this form "/<component>/<sample>".
|
---|
560 | * Further nesting is possible.
|
---|
561 | * @param enmUnit Sample unit.
|
---|
562 | * @param pszDesc Sample description.
|
---|
563 | */
|
---|
564 | DECLR3CALLBACKMEMBER(void, pfnSTAMRegister,(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, const char *pszName,
|
---|
565 | STAMUNIT enmUnit, const char *pszDesc));
|
---|
566 |
|
---|
567 | /**
|
---|
568 | * Same as pfnSTAMRegister except that the name is specified in a
|
---|
569 | * RTStrPrintf like fashion.
|
---|
570 | *
|
---|
571 | * @returns VBox status.
|
---|
572 | * @param pDrvIns Driver instance.
|
---|
573 | * @param pvSample Pointer to the sample.
|
---|
574 | * @param enmType Sample type. This indicates what pvSample is pointing at.
|
---|
575 | * @param enmVisibility Visibility type specifying whether unused statistics should be visible or not.
|
---|
576 | * @param enmUnit Sample unit.
|
---|
577 | * @param pszDesc Sample description.
|
---|
578 | * @param pszName The sample name format string.
|
---|
579 | * @param ... Arguments to the format string.
|
---|
580 | */
|
---|
581 | DECLR3CALLBACKMEMBER(void, pfnSTAMRegisterF,(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
|
---|
582 | STAMUNIT enmUnit, const char *pszDesc, const char *pszName, ...));
|
---|
583 |
|
---|
584 | /**
|
---|
585 | * Same as pfnSTAMRegister except that the name is specified in a
|
---|
586 | * RTStrPrintfV like fashion.
|
---|
587 | *
|
---|
588 | * @returns VBox status.
|
---|
589 | * @param pDrvIns Driver instance.
|
---|
590 | * @param pvSample Pointer to the sample.
|
---|
591 | * @param enmType Sample type. This indicates what pvSample is pointing at.
|
---|
592 | * @param enmVisibility Visibility type specifying whether unused statistics should be visible or not.
|
---|
593 | * @param enmUnit Sample unit.
|
---|
594 | * @param pszDesc Sample description.
|
---|
595 | * @param pszName The sample name format string.
|
---|
596 | * @param args Arguments to the format string.
|
---|
597 | */
|
---|
598 | DECLR3CALLBACKMEMBER(void, pfnSTAMRegisterV,(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
|
---|
599 | STAMUNIT enmUnit, const char *pszDesc, const char *pszName, va_list args));
|
---|
600 |
|
---|
601 | /**
|
---|
602 | * Calls the HC R0 VMM entry point, in a safer but slower manner than SUPCallVMMR0.
|
---|
603 | *
|
---|
604 | * When entering using this call the R0 components can call into the host kernel
|
---|
605 | * (i.e. use the SUPR0 and RT APIs).
|
---|
606 | *
|
---|
607 | * See VMMR0Entry() for more details.
|
---|
608 | *
|
---|
609 | * @returns error code specific to uFunction.
|
---|
610 | * @param pDrvIns The driver instance.
|
---|
611 | * @param uOperation Operation to execute.
|
---|
612 | * This is limited to services.
|
---|
613 | * @param pvArg Pointer to argument structure or if cbArg is 0 just an value.
|
---|
614 | * @param cbArg The size of the argument. This is used to copy whatever the argument
|
---|
615 | * points at into a kernel buffer to avoid problems like the user page
|
---|
616 | * being invalidated while we're executing the call.
|
---|
617 | */
|
---|
618 | DECLR3CALLBACKMEMBER(int, pfnSUPCallVMMR0Ex,(PPDMDRVINS pDrvIns, unsigned uOperation, void *pvArg, unsigned cbArg));
|
---|
619 |
|
---|
620 | /**
|
---|
621 | * Registers a USB HUB.
|
---|
622 | *
|
---|
623 | * @returns VBox status code.
|
---|
624 | * @param pDrvIns The driver instance.
|
---|
625 | * @param fVersions Indicates the kinds of USB devices that can be attached to this HUB.
|
---|
626 | * @param cPorts The number of ports.
|
---|
627 | * @param pUsbHubReg The hub callback structure that PDMUsb uses to interact with it.
|
---|
628 | * @param ppUsbHubHlp The helper callback structure that the hub uses to talk to PDMUsb.
|
---|
629 | *
|
---|
630 | * @thread EMT.
|
---|
631 | */
|
---|
632 | DECLR3CALLBACKMEMBER(int, pfnUSBRegisterHub,(PPDMDRVINS pDrvIns, uint32_t fVersions, uint32_t cPorts, PCPDMUSBHUBREG pUsbHubReg, PPCPDMUSBHUBHLP ppUsbHubHlp));
|
---|
633 |
|
---|
634 | /**
|
---|
635 | * Creates a PDM thread.
|
---|
636 | *
|
---|
637 | * This differs from the RTThreadCreate() API in that PDM takes care of suspending,
|
---|
638 | * resuming, and destroying the thread as the VM state changes.
|
---|
639 | *
|
---|
640 | * @returns VBox status code.
|
---|
641 | * @param pDrvIns The driver instance.
|
---|
642 | * @param ppThread Where to store the thread 'handle'.
|
---|
643 | * @param pvUser The user argument to the thread function.
|
---|
644 | * @param pfnThread The thread function.
|
---|
645 | * @param pfnWakeup The wakup callback. This is called on the EMT thread when
|
---|
646 | * a state change is pending.
|
---|
647 | * @param cbStack See RTThreadCreate.
|
---|
648 | * @param enmType See RTThreadCreate.
|
---|
649 | * @param pszName See RTThreadCreate.
|
---|
650 | */
|
---|
651 | DECLR3CALLBACKMEMBER(int, pfnPDMThreadCreate,(PPDMDRVINS pDrvIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDRV pfnThread,
|
---|
652 | PFNPDMTHREADWAKEUPDRV pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName));
|
---|
653 |
|
---|
654 | /** Just a safety precaution. */
|
---|
655 | uint32_t u32TheEnd;
|
---|
656 | } PDMDRVHLP;
|
---|
657 | /** Pointer PDM Driver API. */
|
---|
658 | typedef PDMDRVHLP *PPDMDRVHLP;
|
---|
659 | /** Pointer const PDM Driver API. */
|
---|
660 | typedef const PDMDRVHLP *PCPDMDRVHLP;
|
---|
661 |
|
---|
662 | /** Current DRVHLP version number. */
|
---|
663 | #define PDM_DRVHLP_VERSION 0x90020000
|
---|
664 |
|
---|
665 |
|
---|
666 |
|
---|
667 | /**
|
---|
668 | * PDM Driver Instance.
|
---|
669 | */
|
---|
670 | typedef struct PDMDRVINS
|
---|
671 | {
|
---|
672 | /** Structure version. PDM_DRVINS_VERSION defines the current version. */
|
---|
673 | uint32_t u32Version;
|
---|
674 |
|
---|
675 | /** Internal data. */
|
---|
676 | union
|
---|
677 | {
|
---|
678 | #ifdef PDMDRVINSINT_DECLARED
|
---|
679 | PDMDRVINSINT s;
|
---|
680 | #endif
|
---|
681 | uint8_t padding[HC_ARCH_BITS == 32 ? 32 : 64];
|
---|
682 | } Internal;
|
---|
683 |
|
---|
684 | /** Pointer the PDM Driver API. */
|
---|
685 | R3PTRTYPE(PCPDMDRVHLP) pDrvHlp;
|
---|
686 | /** Pointer to driver registration structure. */
|
---|
687 | R3PTRTYPE(PCPDMDRVREG) pDrvReg;
|
---|
688 | /** Configuration handle. */
|
---|
689 | R3PTRTYPE(PCFGMNODE) pCfgHandle;
|
---|
690 | /** Driver instance number. */
|
---|
691 | RTUINT iInstance;
|
---|
692 | /** Pointer to the base interface of the device/driver instance above. */
|
---|
693 | R3PTRTYPE(PPDMIBASE) pUpBase;
|
---|
694 | /** Pointer to the base interface of the driver instance below. */
|
---|
695 | R3PTRTYPE(PPDMIBASE) pDownBase;
|
---|
696 | /** The base interface of the driver.
|
---|
697 | * The driver constructor initializes this. */
|
---|
698 | PDMIBASE IBase;
|
---|
699 | /* padding to make achInstanceData aligned at 16 byte boundrary. */
|
---|
700 | uint32_t au32Padding[HC_ARCH_BITS == 32 ? 3 : 1];
|
---|
701 | /** Pointer to driver instance data. */
|
---|
702 | R3PTRTYPE(void *) pvInstanceData;
|
---|
703 | /** Driver instance data. The size of this area is defined
|
---|
704 | * in the PDMDRVREG::cbInstanceData field. */
|
---|
705 | char achInstanceData[4];
|
---|
706 | } PDMDRVINS;
|
---|
707 |
|
---|
708 | /** Current DRVREG version number. */
|
---|
709 | #define PDM_DRVINS_VERSION 0xa0010000
|
---|
710 |
|
---|
711 | /** Converts a pointer to the PDMDRVINS::IBase to a pointer to PDMDRVINS. */
|
---|
712 | #define PDMIBASE_2_PDMDRV(pInterface) ( (PPDMDRVINS)((char *)(pInterface) - RT_OFFSETOF(PDMDRVINS, IBase)) )
|
---|
713 |
|
---|
714 | /**
|
---|
715 | * @copydoc PDMDRVHLP::pfnVMSetError
|
---|
716 | */
|
---|
717 | DECLINLINE(int) PDMDrvHlpVMSetError(PPDMDRVINS pDrvIns, const int rc, RT_SRC_POS_DECL, const char *pszFormat, ...)
|
---|
718 | {
|
---|
719 | va_list va;
|
---|
720 | va_start(va, pszFormat);
|
---|
721 | pDrvIns->pDrvHlp->pfnVMSetErrorV(pDrvIns, rc, RT_SRC_POS_ARGS, pszFormat, va);
|
---|
722 | va_end(va);
|
---|
723 | return rc;
|
---|
724 | }
|
---|
725 |
|
---|
726 | /** @def PDMDRV_SET_ERROR
|
---|
727 | * Set the VM error. See PDMDrvHlpVMSetError() for printf like message formatting.
|
---|
728 | */
|
---|
729 | #define PDMDRV_SET_ERROR(pDrvIns, rc, pszError) \
|
---|
730 | PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, "%s", pszError)
|
---|
731 |
|
---|
732 | /**
|
---|
733 | * @copydoc PDMDRVHLP::pfnVMSetRuntimeError
|
---|
734 | */
|
---|
735 | DECLINLINE(int) PDMDrvHlpVMSetRuntimeError(PPDMDRVINS pDrvIns, bool fFatal, const char *pszErrorID, const char *pszFormat, ...)
|
---|
736 | {
|
---|
737 | va_list va;
|
---|
738 | int rc;
|
---|
739 | va_start(va, pszFormat);
|
---|
740 | rc = pDrvIns->pDrvHlp->pfnVMSetRuntimeErrorV(pDrvIns, fFatal, pszErrorID, pszFormat, va);
|
---|
741 | va_end(va);
|
---|
742 | return rc;
|
---|
743 | }
|
---|
744 |
|
---|
745 | /** @def PDMDRV_SET_RUNTIME_ERROR
|
---|
746 | * Set the VM runtime error. See PDMDrvHlpVMSetRuntimeError() for printf like message formatting.
|
---|
747 | */
|
---|
748 | #define PDMDRV_SET_RUNTIME_ERROR(pDrvIns, fFatal, pszErrorID, pszError) \
|
---|
749 | PDMDrvHlpVMSetRuntimeError(pDrvIns, fFatal, pszErrorID, "%s", pszError)
|
---|
750 |
|
---|
751 | #endif /* IN_RING3 */
|
---|
752 |
|
---|
753 |
|
---|
754 | /** @def PDMDRV_ASSERT_EMT
|
---|
755 | * Assert that the current thread is the emulation thread.
|
---|
756 | */
|
---|
757 | #ifdef VBOX_STRICT
|
---|
758 | # define PDMDRV_ASSERT_EMT(pDrvIns) pDrvIns->pDrvHlp->pfnAssertEMT(pDrvIns, __FILE__, __LINE__, __FUNCTION__)
|
---|
759 | #else
|
---|
760 | # define PDMDRV_ASSERT_EMT(pDrvIns) do { } while (0)
|
---|
761 | #endif
|
---|
762 |
|
---|
763 | /** @def PDMDRV_ASSERT_OTHER
|
---|
764 | * Assert that the current thread is NOT the emulation thread.
|
---|
765 | */
|
---|
766 | #ifdef VBOX_STRICT
|
---|
767 | # define PDMDRV_ASSERT_OTHER(pDrvIns) pDrvIns->pDrvHlp->pfnAssertOther(pDrvIns, __FILE__, __LINE__, __FUNCTION__)
|
---|
768 | #else
|
---|
769 | # define PDMDRV_ASSERT_OTHER(pDrvIns) do { } while (0)
|
---|
770 | #endif
|
---|
771 |
|
---|
772 |
|
---|
773 | #ifdef IN_RING3
|
---|
774 | /**
|
---|
775 | * @copydoc PDMDRVHLP::pfnSTAMRegister
|
---|
776 | */
|
---|
777 | DECLINLINE(void) PDMDrvHlpSTAMRegister(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, const char *pszName, STAMUNIT enmUnit, const char *pszDesc)
|
---|
778 | {
|
---|
779 | pDrvIns->pDrvHlp->pfnSTAMRegister(pDrvIns, pvSample, enmType, pszName, enmUnit, pszDesc);
|
---|
780 | }
|
---|
781 |
|
---|
782 | /**
|
---|
783 | * @copydoc PDMDRVHLP::pfnSTAMRegisterF
|
---|
784 | */
|
---|
785 | DECLINLINE(void) PDMDrvHlpSTAMRegisterF(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, STAMUNIT enmUnit,
|
---|
786 | const char *pszDesc, const char *pszName, ...)
|
---|
787 | {
|
---|
788 | va_list va;
|
---|
789 | va_start(va, pszName);
|
---|
790 | pDrvIns->pDrvHlp->pfnSTAMRegisterV(pDrvIns, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, va);
|
---|
791 | va_end(va);
|
---|
792 | }
|
---|
793 |
|
---|
794 | /**
|
---|
795 | * @copydoc PDMDRVHLP::pfnUSBRegisterHub
|
---|
796 | */
|
---|
797 | DECLINLINE(int) PDMDrvHlpUSBRegisterHub(PPDMDRVINS pDrvIns, uint32_t fVersions, uint32_t cPorts, PCPDMUSBHUBREG pUsbHubReg, PPCPDMUSBHUBHLP ppUsbHubHlp)
|
---|
798 | {
|
---|
799 | return pDrvIns->pDrvHlp->pfnUSBRegisterHub(pDrvIns, fVersions, cPorts, pUsbHubReg, ppUsbHubHlp);
|
---|
800 | }
|
---|
801 |
|
---|
802 | /**
|
---|
803 | * @copydoc PDMDRVHLP::pfnPDMThreadCreate
|
---|
804 | */
|
---|
805 | DECLINLINE(int) PDMDrvHlpPDMThreadCreate(PPDMDRVINS pDrvIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDRV pfnThread,
|
---|
806 | PFNPDMTHREADWAKEUPDRV pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName)
|
---|
807 | {
|
---|
808 | return pDrvIns->pDrvHlp->pfnPDMThreadCreate(pDrvIns, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName);
|
---|
809 | }
|
---|
810 | #endif /* IN_RING3 */
|
---|
811 |
|
---|
812 |
|
---|
813 |
|
---|
814 | /** Pointer to callbacks provided to the VBoxDriverRegister() call. */
|
---|
815 | typedef struct PDMDRVREGCB *PPDMDRVREGCB;
|
---|
816 | /** Pointer to const callbacks provided to the VBoxDriverRegister() call. */
|
---|
817 | typedef const struct PDMDRVREGCB *PCPDMDRVREGCB;
|
---|
818 |
|
---|
819 | /**
|
---|
820 | * Callbacks for VBoxDriverRegister().
|
---|
821 | */
|
---|
822 | typedef struct PDMDRVREGCB
|
---|
823 | {
|
---|
824 | /** Interface version.
|
---|
825 | * This is set to PDM_DRVREG_CB_VERSION. */
|
---|
826 | uint32_t u32Version;
|
---|
827 |
|
---|
828 | /**
|
---|
829 | * Registers a driver with the current VM instance.
|
---|
830 | *
|
---|
831 | * @returns VBox status code.
|
---|
832 | * @param pCallbacks Pointer to the callback table.
|
---|
833 | * @param pDrvReg Pointer to the driver registration record.
|
---|
834 | * This data must be permanent and readonly.
|
---|
835 | */
|
---|
836 | DECLR3CALLBACKMEMBER(int, pfnRegister,(PCPDMDRVREGCB pCallbacks, PCPDMDRVREG pDrvReg));
|
---|
837 | } PDMDRVREGCB;
|
---|
838 |
|
---|
839 | /** Current version of the PDMDRVREGCB structure. */
|
---|
840 | #define PDM_DRVREG_CB_VERSION 0xb0010000
|
---|
841 |
|
---|
842 |
|
---|
843 | /**
|
---|
844 | * The VBoxDriverRegister callback function.
|
---|
845 | *
|
---|
846 | * PDM will invoke this function after loading a driver module and letting
|
---|
847 | * the module decide which drivers to register and how to handle conflicts.
|
---|
848 | *
|
---|
849 | * @returns VBox status code.
|
---|
850 | * @param pCallbacks Pointer to the callback table.
|
---|
851 | * @param u32Version VBox version number.
|
---|
852 | */
|
---|
853 | typedef DECLCALLBACK(int) FNPDMVBOXDRIVERSREGISTER(PCPDMDRVREGCB pCallbacks, uint32_t u32Version);
|
---|
854 |
|
---|
855 | /**
|
---|
856 | * Register external drivers
|
---|
857 | *
|
---|
858 | * @returns VBox status code.
|
---|
859 | * @param pVM The VM to operate on.
|
---|
860 | * @param pfnCallback Driver registration callback
|
---|
861 | */
|
---|
862 | PDMR3DECL(int) PDMR3RegisterDrivers(PVM pVM, FNPDMVBOXDRIVERSREGISTER pfnCallback);
|
---|
863 |
|
---|
864 | /** @} */
|
---|
865 |
|
---|
866 | __END_DECLS
|
---|
867 |
|
---|
868 | #endif
|
---|