1 | /** @file
|
---|
2 | * PDM - Pluggable Device Manager, Drivers.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2020 Oracle Corporation
|
---|
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_INCLUDED_vmm_pdmdrv_h
|
---|
27 | #define VBOX_INCLUDED_vmm_pdmdrv_h
|
---|
28 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
29 | # pragma once
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #include <VBox/vmm/pdmqueue.h>
|
---|
33 | #include <VBox/vmm/pdmcritsect.h>
|
---|
34 | #include <VBox/vmm/pdmifs.h>
|
---|
35 | #include <VBox/vmm/pdmins.h>
|
---|
36 | #include <VBox/vmm/pdmcommon.h>
|
---|
37 | #ifdef IN_RING3
|
---|
38 | # include <VBox/vmm/pdmthread.h>
|
---|
39 | # include <VBox/vmm/pdmasynccompletion.h>
|
---|
40 | # include <VBox/vmm/pdmblkcache.h>
|
---|
41 | #endif
|
---|
42 | #include <VBox/vmm/tm.h>
|
---|
43 | #include <VBox/vmm/ssm.h>
|
---|
44 | #include <VBox/vmm/cfgm.h>
|
---|
45 | #include <VBox/vmm/dbgf.h>
|
---|
46 | #include <VBox/vmm/mm.h>
|
---|
47 | #include <iprt/stdarg.h>
|
---|
48 |
|
---|
49 |
|
---|
50 | RT_C_DECLS_BEGIN
|
---|
51 |
|
---|
52 | /** @defgroup grp_pdm_driver The PDM Drivers API
|
---|
53 | * @ingroup grp_pdm
|
---|
54 | * @{
|
---|
55 | */
|
---|
56 |
|
---|
57 | /** Pointer const PDM Driver API, ring-3. */
|
---|
58 | typedef R3PTRTYPE(struct PDMDRVHLPR3 const *) PCPDMDRVHLPR3;
|
---|
59 | /** Pointer const PDM Driver API, ring-0. */
|
---|
60 | typedef R0PTRTYPE(struct PDMDRVHLPR0 const *) PCPDMDRVHLPR0;
|
---|
61 | /** Pointer const PDM Driver API, raw-mode context. */
|
---|
62 | typedef RCPTRTYPE(struct PDMDRVHLPRC const *) PCPDMDRVHLPRC;
|
---|
63 |
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * Construct a driver instance for a VM.
|
---|
67 | *
|
---|
68 | * @returns VBox status.
|
---|
69 | * @param pDrvIns The driver instance data. If the registration structure
|
---|
70 | * is needed, it can be accessed thru pDrvIns->pReg.
|
---|
71 | * @param pCfg Configuration node handle for the driver. This is
|
---|
72 | * expected to be in high demand in the constructor and is
|
---|
73 | * therefore passed as an argument. When using it at other
|
---|
74 | * times, it can be accessed via pDrvIns->pCfg.
|
---|
75 | * @param fFlags Flags, combination of the PDM_TACH_FLAGS_* \#defines.
|
---|
76 | */
|
---|
77 | typedef DECLCALLBACKTYPE(int, FNPDMDRVCONSTRUCT,(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags));
|
---|
78 | /** Pointer to a FNPDMDRVCONSTRUCT() function. */
|
---|
79 | typedef FNPDMDRVCONSTRUCT *PFNPDMDRVCONSTRUCT;
|
---|
80 |
|
---|
81 | /**
|
---|
82 | * Destruct a driver instance.
|
---|
83 | *
|
---|
84 | * Most VM resources are freed by the VM. This callback is provided so that
|
---|
85 | * any non-VM resources can be freed correctly.
|
---|
86 | *
|
---|
87 | * @param pDrvIns The driver instance data.
|
---|
88 | */
|
---|
89 | typedef DECLCALLBACKTYPE(void, FNPDMDRVDESTRUCT,(PPDMDRVINS pDrvIns));
|
---|
90 | /** Pointer to a FNPDMDRVDESTRUCT() function. */
|
---|
91 | typedef FNPDMDRVDESTRUCT *PFNPDMDRVDESTRUCT;
|
---|
92 |
|
---|
93 | /**
|
---|
94 | * Driver relocation callback.
|
---|
95 | *
|
---|
96 | * This is called when the instance data has been relocated in raw-mode context
|
---|
97 | * (RC). It is also called when the RC hypervisor selects changes. The driver
|
---|
98 | * must fixup all necessary pointers and re-query all interfaces to other RC
|
---|
99 | * devices and drivers.
|
---|
100 | *
|
---|
101 | * Before the RC code is executed the first time, this function will be called
|
---|
102 | * with a 0 delta so RC pointer calculations can be one in one place.
|
---|
103 | *
|
---|
104 | * @param pDrvIns Pointer to the driver instance.
|
---|
105 | * @param offDelta The relocation delta relative to the old location.
|
---|
106 | *
|
---|
107 | * @remark A relocation CANNOT fail.
|
---|
108 | */
|
---|
109 | typedef DECLCALLBACKTYPE(void, FNPDMDRVRELOCATE,(PPDMDRVINS pDrvIns, RTGCINTPTR offDelta));
|
---|
110 | /** Pointer to a FNPDMDRVRELOCATE() function. */
|
---|
111 | typedef FNPDMDRVRELOCATE *PFNPDMDRVRELOCATE;
|
---|
112 |
|
---|
113 | /**
|
---|
114 | * Driver I/O Control interface.
|
---|
115 | *
|
---|
116 | * This is used by external components, such as the COM interface, to
|
---|
117 | * communicate with a driver using a driver specific interface. Generally,
|
---|
118 | * the driver interfaces are used for this task.
|
---|
119 | *
|
---|
120 | * @returns VBox status code.
|
---|
121 | * @param pDrvIns Pointer to the driver instance.
|
---|
122 | * @param uFunction Function to perform.
|
---|
123 | * @param pvIn Pointer to input data.
|
---|
124 | * @param cbIn Size of input data.
|
---|
125 | * @param pvOut Pointer to output data.
|
---|
126 | * @param cbOut Size of output data.
|
---|
127 | * @param pcbOut Where to store the actual size of the output data.
|
---|
128 | */
|
---|
129 | typedef DECLCALLBACKTYPE(int, FNPDMDRVIOCTL,(PPDMDRVINS pDrvIns, uint32_t uFunction,
|
---|
130 | void *pvIn, uint32_t cbIn,
|
---|
131 | void *pvOut, uint32_t cbOut, uint32_t *pcbOut));
|
---|
132 | /** Pointer to a FNPDMDRVIOCTL() function. */
|
---|
133 | typedef FNPDMDRVIOCTL *PFNPDMDRVIOCTL;
|
---|
134 |
|
---|
135 | /**
|
---|
136 | * Power On notification.
|
---|
137 | *
|
---|
138 | * @param pDrvIns The driver instance data.
|
---|
139 | */
|
---|
140 | typedef DECLCALLBACKTYPE(void, FNPDMDRVPOWERON,(PPDMDRVINS pDrvIns));
|
---|
141 | /** Pointer to a FNPDMDRVPOWERON() function. */
|
---|
142 | typedef FNPDMDRVPOWERON *PFNPDMDRVPOWERON;
|
---|
143 |
|
---|
144 | /**
|
---|
145 | * Reset notification.
|
---|
146 | *
|
---|
147 | * @returns VBox status.
|
---|
148 | * @param pDrvIns The driver instance data.
|
---|
149 | */
|
---|
150 | typedef DECLCALLBACKTYPE(void, FNPDMDRVRESET,(PPDMDRVINS pDrvIns));
|
---|
151 | /** Pointer to a FNPDMDRVRESET() function. */
|
---|
152 | typedef FNPDMDRVRESET *PFNPDMDRVRESET;
|
---|
153 |
|
---|
154 | /**
|
---|
155 | * Suspend notification.
|
---|
156 | *
|
---|
157 | * @returns VBox status.
|
---|
158 | * @param pDrvIns The driver instance data.
|
---|
159 | */
|
---|
160 | typedef DECLCALLBACKTYPE(void, FNPDMDRVSUSPEND,(PPDMDRVINS pDrvIns));
|
---|
161 | /** Pointer to a FNPDMDRVSUSPEND() function. */
|
---|
162 | typedef FNPDMDRVSUSPEND *PFNPDMDRVSUSPEND;
|
---|
163 |
|
---|
164 | /**
|
---|
165 | * Resume notification.
|
---|
166 | *
|
---|
167 | * @returns VBox status.
|
---|
168 | * @param pDrvIns The driver instance data.
|
---|
169 | */
|
---|
170 | typedef DECLCALLBACKTYPE(void, FNPDMDRVRESUME,(PPDMDRVINS pDrvIns));
|
---|
171 | /** Pointer to a FNPDMDRVRESUME() function. */
|
---|
172 | typedef FNPDMDRVRESUME *PFNPDMDRVRESUME;
|
---|
173 |
|
---|
174 | /**
|
---|
175 | * Power Off notification.
|
---|
176 | *
|
---|
177 | * This is always called when VMR3PowerOff is called.
|
---|
178 | * There will be no callback when hot plugging devices or when replumbing the driver
|
---|
179 | * stack.
|
---|
180 | *
|
---|
181 | * @param pDrvIns The driver instance data.
|
---|
182 | */
|
---|
183 | typedef DECLCALLBACKTYPE(void, FNPDMDRVPOWEROFF,(PPDMDRVINS pDrvIns));
|
---|
184 | /** Pointer to a FNPDMDRVPOWEROFF() function. */
|
---|
185 | typedef FNPDMDRVPOWEROFF *PFNPDMDRVPOWEROFF;
|
---|
186 |
|
---|
187 | /**
|
---|
188 | * Attach command.
|
---|
189 | *
|
---|
190 | * This is called to let the driver attach to a driver at runtime. This is not
|
---|
191 | * called during VM construction, the driver constructor have to do this by
|
---|
192 | * calling PDMDrvHlpAttach.
|
---|
193 | *
|
---|
194 | * This is like plugging in the keyboard or mouse after turning on the PC.
|
---|
195 | *
|
---|
196 | * @returns VBox status code.
|
---|
197 | * @param pDrvIns The driver instance.
|
---|
198 | * @param fFlags Flags, combination of the PDM_TACH_FLAGS_* \#defines.
|
---|
199 | */
|
---|
200 | typedef DECLCALLBACKTYPE(int, FNPDMDRVATTACH,(PPDMDRVINS pDrvIns, uint32_t fFlags));
|
---|
201 | /** Pointer to a FNPDMDRVATTACH() function. */
|
---|
202 | typedef FNPDMDRVATTACH *PFNPDMDRVATTACH;
|
---|
203 |
|
---|
204 | /**
|
---|
205 | * Detach notification.
|
---|
206 | *
|
---|
207 | * This is called when a driver below it in the chain is detaching itself
|
---|
208 | * from it. The driver should adjust it's state to reflect this.
|
---|
209 | *
|
---|
210 | * This is like ejecting a cdrom or floppy.
|
---|
211 | *
|
---|
212 | * @param pDrvIns The driver instance.
|
---|
213 | * @param fFlags PDM_TACH_FLAGS_NOT_HOT_PLUG or 0.
|
---|
214 | */
|
---|
215 | typedef DECLCALLBACKTYPE(void, FNPDMDRVDETACH,(PPDMDRVINS pDrvIns, uint32_t fFlags));
|
---|
216 | /** Pointer to a FNPDMDRVDETACH() function. */
|
---|
217 | typedef FNPDMDRVDETACH *PFNPDMDRVDETACH;
|
---|
218 |
|
---|
219 |
|
---|
220 |
|
---|
221 | /**
|
---|
222 | * PDM Driver Registration Structure.
|
---|
223 | *
|
---|
224 | * This structure is used when registering a driver from VBoxInitDrivers() (in
|
---|
225 | * host ring-3 context). PDM will continue use till the VM is terminated.
|
---|
226 | */
|
---|
227 | typedef struct PDMDRVREG
|
---|
228 | {
|
---|
229 | /** Structure version. PDM_DRVREG_VERSION defines the current version. */
|
---|
230 | uint32_t u32Version;
|
---|
231 | /** Driver name. */
|
---|
232 | char szName[32];
|
---|
233 | /** Name of the raw-mode context module (no path).
|
---|
234 | * Only evalutated if PDM_DRVREG_FLAGS_RC is set. */
|
---|
235 | char szRCMod[32];
|
---|
236 | /** Name of the ring-0 module (no path).
|
---|
237 | * Only evalutated if PDM_DRVREG_FLAGS_R0 is set. */
|
---|
238 | char szR0Mod[32];
|
---|
239 | /** The description of the driver. The UTF-8 string pointed to shall, like this structure,
|
---|
240 | * remain unchanged from registration till VM destruction. */
|
---|
241 | const char *pszDescription;
|
---|
242 |
|
---|
243 | /** Flags, combination of the PDM_DRVREG_FLAGS_* \#defines. */
|
---|
244 | uint32_t fFlags;
|
---|
245 | /** Driver class(es), combination of the PDM_DRVREG_CLASS_* \#defines. */
|
---|
246 | uint32_t fClass;
|
---|
247 | /** Maximum number of instances (per VM). */
|
---|
248 | uint32_t cMaxInstances;
|
---|
249 | /** Size of the instance data. */
|
---|
250 | uint32_t cbInstance;
|
---|
251 |
|
---|
252 | /** Construct instance - required. */
|
---|
253 | PFNPDMDRVCONSTRUCT pfnConstruct;
|
---|
254 | /** Destruct instance - optional. */
|
---|
255 | PFNPDMDRVDESTRUCT pfnDestruct;
|
---|
256 | /** Relocation command - optional. */
|
---|
257 | PFNPDMDRVRELOCATE pfnRelocate;
|
---|
258 | /** I/O control - optional. */
|
---|
259 | PFNPDMDRVIOCTL pfnIOCtl;
|
---|
260 | /** Power on notification - optional. */
|
---|
261 | PFNPDMDRVPOWERON pfnPowerOn;
|
---|
262 | /** Reset notification - optional. */
|
---|
263 | PFNPDMDRVRESET pfnReset;
|
---|
264 | /** Suspend notification - optional. */
|
---|
265 | PFNPDMDRVSUSPEND pfnSuspend;
|
---|
266 | /** Resume notification - optional. */
|
---|
267 | PFNPDMDRVRESUME pfnResume;
|
---|
268 | /** Attach command - optional. */
|
---|
269 | PFNPDMDRVATTACH pfnAttach;
|
---|
270 | /** Detach notification - optional. */
|
---|
271 | PFNPDMDRVDETACH pfnDetach;
|
---|
272 | /** Power off notification - optional. */
|
---|
273 | PFNPDMDRVPOWEROFF pfnPowerOff;
|
---|
274 | /** @todo */
|
---|
275 | PFNRT pfnSoftReset;
|
---|
276 | /** Initialization safty marker. */
|
---|
277 | uint32_t u32VersionEnd;
|
---|
278 | } PDMDRVREG;
|
---|
279 | /** Pointer to a PDM Driver Structure. */
|
---|
280 | typedef PDMDRVREG *PPDMDRVREG;
|
---|
281 | /** Const pointer to a PDM Driver Structure. */
|
---|
282 | typedef PDMDRVREG const *PCPDMDRVREG;
|
---|
283 |
|
---|
284 | /** Current DRVREG version number. */
|
---|
285 | #define PDM_DRVREG_VERSION PDM_VERSION_MAKE(0xf0ff, 1, 0)
|
---|
286 |
|
---|
287 | /** PDM Driver Flags.
|
---|
288 | * @{ */
|
---|
289 | /** @def PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT
|
---|
290 | * The bit count for the current host. */
|
---|
291 | #if HC_ARCH_BITS == 32
|
---|
292 | # define PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT UINT32_C(0x00000001)
|
---|
293 | #elif HC_ARCH_BITS == 64
|
---|
294 | # define PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT UINT32_C(0x00000002)
|
---|
295 | #else
|
---|
296 | # error Unsupported HC_ARCH_BITS value.
|
---|
297 | #endif
|
---|
298 | /** The host bit count mask. */
|
---|
299 | #define PDM_DRVREG_FLAGS_HOST_BITS_MASK UINT32_C(0x00000003)
|
---|
300 | /** This flag is used to indicate that the driver has a RC component. */
|
---|
301 | #define PDM_DRVREG_FLAGS_RC UINT32_C(0x00000010)
|
---|
302 | /** This flag is used to indicate that the driver has a R0 component. */
|
---|
303 | #define PDM_DRVREG_FLAGS_R0 UINT32_C(0x00000020)
|
---|
304 |
|
---|
305 | /** @} */
|
---|
306 |
|
---|
307 |
|
---|
308 | /** PDM Driver Classes.
|
---|
309 | * @{ */
|
---|
310 | /** Mouse input driver. */
|
---|
311 | #define PDM_DRVREG_CLASS_MOUSE RT_BIT(0)
|
---|
312 | /** Keyboard input driver. */
|
---|
313 | #define PDM_DRVREG_CLASS_KEYBOARD RT_BIT(1)
|
---|
314 | /** Display driver. */
|
---|
315 | #define PDM_DRVREG_CLASS_DISPLAY RT_BIT(2)
|
---|
316 | /** Network transport driver. */
|
---|
317 | #define PDM_DRVREG_CLASS_NETWORK RT_BIT(3)
|
---|
318 | /** Block driver. */
|
---|
319 | #define PDM_DRVREG_CLASS_BLOCK RT_BIT(4)
|
---|
320 | /** Media driver. */
|
---|
321 | #define PDM_DRVREG_CLASS_MEDIA RT_BIT(5)
|
---|
322 | /** Mountable driver. */
|
---|
323 | #define PDM_DRVREG_CLASS_MOUNTABLE RT_BIT(6)
|
---|
324 | /** Audio driver. */
|
---|
325 | #define PDM_DRVREG_CLASS_AUDIO RT_BIT(7)
|
---|
326 | /** VMMDev driver. */
|
---|
327 | #define PDM_DRVREG_CLASS_VMMDEV RT_BIT(8)
|
---|
328 | /** Status driver. */
|
---|
329 | #define PDM_DRVREG_CLASS_STATUS RT_BIT(9)
|
---|
330 | /** ACPI driver. */
|
---|
331 | #define PDM_DRVREG_CLASS_ACPI RT_BIT(10)
|
---|
332 | /** USB related driver. */
|
---|
333 | #define PDM_DRVREG_CLASS_USB RT_BIT(11)
|
---|
334 | /** ISCSI Transport related driver. */
|
---|
335 | #define PDM_DRVREG_CLASS_ISCSITRANSPORT RT_BIT(12)
|
---|
336 | /** Char driver. */
|
---|
337 | #define PDM_DRVREG_CLASS_CHAR RT_BIT(13)
|
---|
338 | /** Stream driver. */
|
---|
339 | #define PDM_DRVREG_CLASS_STREAM RT_BIT(14)
|
---|
340 | /** SCSI driver. */
|
---|
341 | #define PDM_DRVREG_CLASS_SCSI RT_BIT(15)
|
---|
342 | /** Generic raw PCI device driver. */
|
---|
343 | #define PDM_DRVREG_CLASS_PCIRAW RT_BIT(16)
|
---|
344 | /** @} */
|
---|
345 |
|
---|
346 |
|
---|
347 | /**
|
---|
348 | * PDM Driver Instance.
|
---|
349 | *
|
---|
350 | * @implements PDMIBASE
|
---|
351 | */
|
---|
352 | typedef struct PDMDRVINS
|
---|
353 | {
|
---|
354 | /** Structure version. PDM_DRVINS_VERSION defines the current version. */
|
---|
355 | uint32_t u32Version;
|
---|
356 | /** Driver instance number. */
|
---|
357 | uint32_t iInstance;
|
---|
358 |
|
---|
359 | /** Pointer the PDM Driver API. */
|
---|
360 | RCPTRTYPE(PCPDMDRVHLPRC) pHlpRC;
|
---|
361 | /** Pointer to driver instance data. */
|
---|
362 | RCPTRTYPE(void *) pvInstanceDataRC;
|
---|
363 |
|
---|
364 | /** Pointer the PDM Driver API. */
|
---|
365 | R0PTRTYPE(PCPDMDRVHLPR0) pHlpR0;
|
---|
366 | /** Pointer to driver instance data. */
|
---|
367 | R0PTRTYPE(void *) pvInstanceDataR0;
|
---|
368 |
|
---|
369 | /** Pointer the PDM Driver API. */
|
---|
370 | R3PTRTYPE(PCPDMDRVHLPR3) pHlpR3;
|
---|
371 | /** Pointer to driver instance data. */
|
---|
372 | R3PTRTYPE(void *) pvInstanceDataR3;
|
---|
373 |
|
---|
374 | /** Pointer to driver registration structure. */
|
---|
375 | R3PTRTYPE(PCPDMDRVREG) pReg;
|
---|
376 | /** Configuration handle. */
|
---|
377 | R3PTRTYPE(PCFGMNODE) pCfg;
|
---|
378 |
|
---|
379 | /** Pointer to the base interface of the device/driver instance above. */
|
---|
380 | R3PTRTYPE(PPDMIBASE) pUpBase;
|
---|
381 | /** Pointer to the base interface of the driver instance below. */
|
---|
382 | R3PTRTYPE(PPDMIBASE) pDownBase;
|
---|
383 |
|
---|
384 | /** The base interface of the driver.
|
---|
385 | * The driver constructor initializes this. */
|
---|
386 | PDMIBASE IBase;
|
---|
387 |
|
---|
388 | /** Tracing indicator. */
|
---|
389 | uint32_t fTracing;
|
---|
390 | /** The tracing ID of this device. */
|
---|
391 | uint32_t idTracing;
|
---|
392 | #if HC_ARCH_BITS == 32
|
---|
393 | /** Align the internal data more naturally. */
|
---|
394 | uint32_t au32Padding[HC_ARCH_BITS == 32 ? 7 : 0];
|
---|
395 | #endif
|
---|
396 |
|
---|
397 | /** Internal data. */
|
---|
398 | union
|
---|
399 | {
|
---|
400 | #ifdef PDMDRVINSINT_DECLARED
|
---|
401 | PDMDRVINSINT s;
|
---|
402 | #endif
|
---|
403 | uint8_t padding[HC_ARCH_BITS == 32 ? 40 + 32 : 72 + 24];
|
---|
404 | } Internal;
|
---|
405 |
|
---|
406 | /** Driver instance data. The size of this area is defined
|
---|
407 | * in the PDMDRVREG::cbInstanceData field. */
|
---|
408 | char achInstanceData[4];
|
---|
409 | } PDMDRVINS;
|
---|
410 |
|
---|
411 | /** Current DRVREG version number. */
|
---|
412 | #define PDM_DRVINS_VERSION PDM_VERSION_MAKE(0xf0fe, 2, 0)
|
---|
413 |
|
---|
414 | /** Converts a pointer to the PDMDRVINS::IBase to a pointer to PDMDRVINS. */
|
---|
415 | #define PDMIBASE_2_PDMDRV(pInterface) ( (PPDMDRVINS)((char *)(pInterface) - RT_UOFFSETOF(PDMDRVINS, IBase)) )
|
---|
416 |
|
---|
417 | /** @def PDMDRVINS_2_RCPTR
|
---|
418 | * Converts a PDM Driver instance pointer a RC PDM Driver instance pointer.
|
---|
419 | */
|
---|
420 | #define PDMDRVINS_2_RCPTR(pDrvIns) ( (RCPTRTYPE(PPDMDRVINS))((RTRCUINTPTR)(pDrvIns)->pvInstanceDataRC - (RTRCUINTPTR)RT_UOFFSETOF(PDMDRVINS, achInstanceData)) )
|
---|
421 |
|
---|
422 | /** @def PDMDRVINS_2_R3PTR
|
---|
423 | * Converts a PDM Driver instance pointer a R3 PDM Driver instance pointer.
|
---|
424 | */
|
---|
425 | #define PDMDRVINS_2_R3PTR(pDrvIns) ( (R3PTRTYPE(PPDMDRVINS))((RTHCUINTPTR)(pDrvIns)->pvInstanceDataR3 - RT_UOFFSETOF(PDMDRVINS, achInstanceData)) )
|
---|
426 |
|
---|
427 | /** @def PDMDRVINS_2_R0PTR
|
---|
428 | * Converts a PDM Driver instance pointer a R0 PDM Driver instance pointer.
|
---|
429 | */
|
---|
430 | #define PDMDRVINS_2_R0PTR(pDrvIns) ( (R0PTRTYPE(PPDMDRVINS))((RTR0UINTPTR)(pDrvIns)->pvInstanceDataR0 - RT_UOFFSETOF(PDMDRVINS, achInstanceData)) )
|
---|
431 |
|
---|
432 |
|
---|
433 |
|
---|
434 | /**
|
---|
435 | * Checks the structure versions of the drive instance and driver helpers,
|
---|
436 | * returning if they are incompatible.
|
---|
437 | *
|
---|
438 | * Intended for the constructor.
|
---|
439 | *
|
---|
440 | * @param pDrvIns Pointer to the PDM driver instance.
|
---|
441 | */
|
---|
442 | #define PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns) \
|
---|
443 | do \
|
---|
444 | { \
|
---|
445 | PPDMDRVINS pDrvInsTypeCheck = (pDrvIns); NOREF(pDrvInsTypeCheck); \
|
---|
446 | AssertLogRelMsgReturn(PDM_VERSION_ARE_COMPATIBLE((pDrvIns)->u32Version, PDM_DRVINS_VERSION), \
|
---|
447 | ("DrvIns=%#x mine=%#x\n", (pDrvIns)->u32Version, PDM_DRVINS_VERSION), \
|
---|
448 | VERR_PDM_DRVINS_VERSION_MISMATCH); \
|
---|
449 | AssertLogRelMsgReturn(PDM_VERSION_ARE_COMPATIBLE((pDrvIns)->pHlpR3->u32Version, PDM_DRVHLPR3_VERSION), \
|
---|
450 | ("DrvHlp=%#x mine=%#x\n", (pDrvIns)->pHlpR3->u32Version, PDM_DRVHLPR3_VERSION), \
|
---|
451 | VERR_PDM_DRVHLPR3_VERSION_MISMATCH); \
|
---|
452 | } while (0)
|
---|
453 |
|
---|
454 | /**
|
---|
455 | * Quietly checks the structure versions of the drive instance and driver
|
---|
456 | * helpers, returning if they are incompatible.
|
---|
457 | *
|
---|
458 | * Intended for the destructor.
|
---|
459 | *
|
---|
460 | * @param pDrvIns Pointer to the PDM driver instance.
|
---|
461 | */
|
---|
462 | #define PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns) \
|
---|
463 | do \
|
---|
464 | { \
|
---|
465 | PPDMDRVINS pDrvInsTypeCheck = (pDrvIns); NOREF(pDrvInsTypeCheck); \
|
---|
466 | if (RT_LIKELY( PDM_VERSION_ARE_COMPATIBLE((pDrvIns)->u32Version, PDM_DRVINS_VERSION) \
|
---|
467 | && PDM_VERSION_ARE_COMPATIBLE((pDrvIns)->pHlpR3->u32Version, PDM_DRVHLPR3_VERSION)) ) \
|
---|
468 | { /* likely */ } else return; \
|
---|
469 | } while (0)
|
---|
470 |
|
---|
471 | /**
|
---|
472 | * Wrapper around CFGMR3ValidateConfig for the root config for use in the
|
---|
473 | * constructor - returns on failure.
|
---|
474 | *
|
---|
475 | * This should be invoked after having initialized the instance data
|
---|
476 | * sufficiently for the correct operation of the destructor. The destructor is
|
---|
477 | * always called!
|
---|
478 | *
|
---|
479 | * @param pDrvIns Pointer to the PDM driver instance.
|
---|
480 | * @param pszValidValues Patterns describing the valid value names. See
|
---|
481 | * RTStrSimplePatternMultiMatch for details on the
|
---|
482 | * pattern syntax.
|
---|
483 | * @param pszValidNodes Patterns describing the valid node (key) names.
|
---|
484 | * Pass empty string if no valid nodess.
|
---|
485 | */
|
---|
486 | #define PDMDRV_VALIDATE_CONFIG_RETURN(pDrvIns, pszValidValues, pszValidNodes) \
|
---|
487 | do \
|
---|
488 | { \
|
---|
489 | int rcValCfg = CFGMR3ValidateConfig((pDrvIns)->pCfg, "/", pszValidValues, pszValidNodes, \
|
---|
490 | (pDrvIns)->pReg->szName, (pDrvIns)->iInstance); \
|
---|
491 | if (RT_SUCCESS(rcValCfg)) \
|
---|
492 | { /* likely */ } else return rcValCfg; \
|
---|
493 | } while (0)
|
---|
494 |
|
---|
495 |
|
---|
496 |
|
---|
497 | /**
|
---|
498 | * USB hub registration structure.
|
---|
499 | */
|
---|
500 | typedef struct PDMUSBHUBREG
|
---|
501 | {
|
---|
502 | /** Structure version number. PDM_USBHUBREG_VERSION defines the current version. */
|
---|
503 | uint32_t u32Version;
|
---|
504 |
|
---|
505 | /**
|
---|
506 | * Request the hub to attach of the specified device.
|
---|
507 | *
|
---|
508 | * @returns VBox status code.
|
---|
509 | * @param pDrvIns The hub instance.
|
---|
510 | * @param pUsbIns The device to attach.
|
---|
511 | * @param pszCaptureFilename Path to the file for USB traffic capturing, optional.
|
---|
512 | * @param piPort Where to store the port number the device was attached to.
|
---|
513 | * @thread EMT.
|
---|
514 | */
|
---|
515 | DECLR3CALLBACKMEMBER(int, pfnAttachDevice,(PPDMDRVINS pDrvIns, PPDMUSBINS pUsbIns, const char *pszCaptureFilename, uint32_t *piPort));
|
---|
516 |
|
---|
517 | /**
|
---|
518 | * Request the hub to detach of the specified device.
|
---|
519 | *
|
---|
520 | * The device has previously been attached to the hub with the
|
---|
521 | * pfnAttachDevice call. This call is not currently expected to
|
---|
522 | * fail.
|
---|
523 | *
|
---|
524 | * @returns VBox status code.
|
---|
525 | * @param pDrvIns The hub instance.
|
---|
526 | * @param pUsbIns The device to detach.
|
---|
527 | * @param iPort The port number returned by the attach call.
|
---|
528 | * @thread EMT.
|
---|
529 | */
|
---|
530 | DECLR3CALLBACKMEMBER(int, pfnDetachDevice,(PPDMDRVINS pDrvIns, PPDMUSBINS pUsbIns, uint32_t iPort));
|
---|
531 |
|
---|
532 | /** Counterpart to u32Version, same value. */
|
---|
533 | uint32_t u32TheEnd;
|
---|
534 | } PDMUSBHUBREG;
|
---|
535 | /** Pointer to a const USB hub registration structure. */
|
---|
536 | typedef const PDMUSBHUBREG *PCPDMUSBHUBREG;
|
---|
537 |
|
---|
538 | /** Current PDMUSBHUBREG version number. */
|
---|
539 | #define PDM_USBHUBREG_VERSION PDM_VERSION_MAKE(0xf0fd, 2, 0)
|
---|
540 |
|
---|
541 |
|
---|
542 | /**
|
---|
543 | * USB hub helpers.
|
---|
544 | * This is currently just a place holder.
|
---|
545 | */
|
---|
546 | typedef struct PDMUSBHUBHLP
|
---|
547 | {
|
---|
548 | /** Structure version. PDM_USBHUBHLP_VERSION defines the current version. */
|
---|
549 | uint32_t u32Version;
|
---|
550 |
|
---|
551 | /** Just a safety precaution. */
|
---|
552 | uint32_t u32TheEnd;
|
---|
553 | } PDMUSBHUBHLP;
|
---|
554 | /** Pointer to PCI helpers. */
|
---|
555 | typedef PDMUSBHUBHLP *PPDMUSBHUBHLP;
|
---|
556 | /** Pointer to const PCI helpers. */
|
---|
557 | typedef const PDMUSBHUBHLP *PCPDMUSBHUBHLP;
|
---|
558 | /** Pointer to const PCI helpers pointer. */
|
---|
559 | typedef PCPDMUSBHUBHLP *PPCPDMUSBHUBHLP;
|
---|
560 |
|
---|
561 | /** Current PDMUSBHUBHLP version number. */
|
---|
562 | #define PDM_USBHUBHLP_VERSION PDM_VERSION_MAKE(0xf0fc, 1, 0)
|
---|
563 |
|
---|
564 |
|
---|
565 | /**
|
---|
566 | * PDM Driver API - raw-mode context variant.
|
---|
567 | */
|
---|
568 | typedef struct PDMDRVHLPRC
|
---|
569 | {
|
---|
570 | /** Structure version. PDM_DRVHLPRC_VERSION defines the current version. */
|
---|
571 | uint32_t u32Version;
|
---|
572 |
|
---|
573 | /**
|
---|
574 | * Set the VM error message
|
---|
575 | *
|
---|
576 | * @returns rc.
|
---|
577 | * @param pDrvIns Driver instance.
|
---|
578 | * @param rc VBox status code.
|
---|
579 | * @param SRC_POS Use RT_SRC_POS.
|
---|
580 | * @param pszFormat Error message format string.
|
---|
581 | * @param ... Error message arguments.
|
---|
582 | */
|
---|
583 | DECLRCCALLBACKMEMBER(int, pfnVMSetError,(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL,
|
---|
584 | const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(6, 7));
|
---|
585 |
|
---|
586 | /**
|
---|
587 | * Set the VM error message
|
---|
588 | *
|
---|
589 | * @returns rc.
|
---|
590 | * @param pDrvIns Driver instance.
|
---|
591 | * @param rc VBox status code.
|
---|
592 | * @param SRC_POS Use RT_SRC_POS.
|
---|
593 | * @param pszFormat Error message format string.
|
---|
594 | * @param va Error message arguments.
|
---|
595 | */
|
---|
596 | DECLRCCALLBACKMEMBER(int, pfnVMSetErrorV,(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL,
|
---|
597 | const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(6, 0));
|
---|
598 |
|
---|
599 | /**
|
---|
600 | * Set the VM runtime error message
|
---|
601 | *
|
---|
602 | * @returns VBox status code.
|
---|
603 | * @param pDrvIns Driver instance.
|
---|
604 | * @param fFlags The action flags. See VMSETRTERR_FLAGS_*.
|
---|
605 | * @param pszErrorId Error ID string.
|
---|
606 | * @param pszFormat Error message format string.
|
---|
607 | * @param ... Error message arguments.
|
---|
608 | */
|
---|
609 | DECLRCCALLBACKMEMBER(int, pfnVMSetRuntimeError,(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId,
|
---|
610 | const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(4, 5));
|
---|
611 |
|
---|
612 | /**
|
---|
613 | * Set the VM runtime error message
|
---|
614 | *
|
---|
615 | * @returns VBox status code.
|
---|
616 | * @param pDrvIns Driver instance.
|
---|
617 | * @param fFlags The action flags. See VMSETRTERR_FLAGS_*.
|
---|
618 | * @param pszErrorId Error ID string.
|
---|
619 | * @param pszFormat Error message format string.
|
---|
620 | * @param va Error message arguments.
|
---|
621 | */
|
---|
622 | DECLRCCALLBACKMEMBER(int, pfnVMSetRuntimeErrorV,(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId,
|
---|
623 | const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(4, 0));
|
---|
624 |
|
---|
625 | /**
|
---|
626 | * Assert that the current thread is the emulation thread.
|
---|
627 | *
|
---|
628 | * @returns True if correct.
|
---|
629 | * @returns False if wrong.
|
---|
630 | * @param pDrvIns Driver instance.
|
---|
631 | * @param pszFile Filename of the assertion location.
|
---|
632 | * @param iLine Linenumber of the assertion location.
|
---|
633 | * @param pszFunction Function of the assertion location.
|
---|
634 | */
|
---|
635 | DECLRCCALLBACKMEMBER(bool, pfnAssertEMT,(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction));
|
---|
636 |
|
---|
637 | /**
|
---|
638 | * Assert that the current thread is NOT the emulation thread.
|
---|
639 | *
|
---|
640 | * @returns True if correct.
|
---|
641 | * @returns False if wrong.
|
---|
642 | * @param pDrvIns Driver instance.
|
---|
643 | * @param pszFile Filename of the assertion location.
|
---|
644 | * @param iLine Linenumber of the assertion location.
|
---|
645 | * @param pszFunction Function of the assertion location.
|
---|
646 | */
|
---|
647 | DECLRCCALLBACKMEMBER(bool, pfnAssertOther,(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction));
|
---|
648 |
|
---|
649 | /** @name Exported PDM Critical Section Functions
|
---|
650 | * @{ */
|
---|
651 | DECLRCCALLBACKMEMBER(int, pfnCritSectEnter,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect, int rcBusy));
|
---|
652 | DECLRCCALLBACKMEMBER(int, pfnCritSectEnterDebug,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL));
|
---|
653 | DECLRCCALLBACKMEMBER(int, pfnCritSectTryEnter,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect));
|
---|
654 | DECLRCCALLBACKMEMBER(int, pfnCritSectTryEnterDebug,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect, RTHCUINTPTR uId, RT_SRC_POS_DECL));
|
---|
655 | DECLRCCALLBACKMEMBER(int, pfnCritSectLeave,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect));
|
---|
656 | DECLRCCALLBACKMEMBER(bool, pfnCritSectIsOwner,(PPDMDRVINS pDrvIns, PCPDMCRITSECT pCritSect));
|
---|
657 | DECLRCCALLBACKMEMBER(bool, pfnCritSectIsInitialized,(PPDMDRVINS pDrvIns, PCPDMCRITSECT pCritSect));
|
---|
658 | DECLRCCALLBACKMEMBER(bool, pfnCritSectHasWaiters,(PPDMDRVINS pDrvIns, PCPDMCRITSECT pCritSect));
|
---|
659 | DECLRCCALLBACKMEMBER(uint32_t, pfnCritSectGetRecursion,(PPDMDRVINS pDrvIns, PCPDMCRITSECT pCritSect));
|
---|
660 | /** @} */
|
---|
661 |
|
---|
662 | /**
|
---|
663 | * Obtains bandwidth in a bandwidth group.
|
---|
664 | *
|
---|
665 | * @returns True if bandwidth was allocated, false if not.
|
---|
666 | * @param pDrvIns The driver instance.
|
---|
667 | * @param pFilter Pointer to the filter that allocates bandwidth.
|
---|
668 | * @param cbTransfer Number of bytes to allocate.
|
---|
669 | */
|
---|
670 | DECLRCCALLBACKMEMBER(bool, pfnNetShaperAllocateBandwidth,(PPDMDRVINS pDrvIns, PPDMNSFILTER pFilter, size_t cbTransfer));
|
---|
671 |
|
---|
672 | /** Just a safety precaution. */
|
---|
673 | uint32_t u32TheEnd;
|
---|
674 | } PDMDRVHLPRC;
|
---|
675 | /** Current PDMDRVHLPRC version number. */
|
---|
676 | #define PDM_DRVHLPRC_VERSION PDM_VERSION_MAKE(0xf0f9, 5, 0)
|
---|
677 |
|
---|
678 |
|
---|
679 | /**
|
---|
680 | * PDM Driver API, ring-0 context.
|
---|
681 | */
|
---|
682 | typedef struct PDMDRVHLPR0
|
---|
683 | {
|
---|
684 | /** Structure version. PDM_DRVHLPR0_VERSION defines the current version. */
|
---|
685 | uint32_t u32Version;
|
---|
686 |
|
---|
687 | /**
|
---|
688 | * Set the VM error message
|
---|
689 | *
|
---|
690 | * @returns rc.
|
---|
691 | * @param pDrvIns Driver instance.
|
---|
692 | * @param rc VBox status code.
|
---|
693 | * @param SRC_POS Use RT_SRC_POS.
|
---|
694 | * @param pszFormat Error message format string.
|
---|
695 | * @param ... Error message arguments.
|
---|
696 | */
|
---|
697 | DECLR0CALLBACKMEMBER(int, pfnVMSetError,(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL,
|
---|
698 | const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(6, 7));
|
---|
699 |
|
---|
700 | /**
|
---|
701 | * Set the VM error message
|
---|
702 | *
|
---|
703 | * @returns rc.
|
---|
704 | * @param pDrvIns Driver instance.
|
---|
705 | * @param rc VBox status code.
|
---|
706 | * @param SRC_POS Use RT_SRC_POS.
|
---|
707 | * @param pszFormat Error message format string.
|
---|
708 | * @param va Error message arguments.
|
---|
709 | */
|
---|
710 | DECLR0CALLBACKMEMBER(int, pfnVMSetErrorV,(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL,
|
---|
711 | const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(6, 0));
|
---|
712 |
|
---|
713 | /**
|
---|
714 | * Set the VM runtime error message
|
---|
715 | *
|
---|
716 | * @returns VBox status code.
|
---|
717 | * @param pDrvIns Driver instance.
|
---|
718 | * @param fFlags The action flags. See VMSETRTERR_FLAGS_*.
|
---|
719 | * @param pszErrorId Error ID string.
|
---|
720 | * @param pszFormat Error message format string.
|
---|
721 | * @param ... Error message arguments.
|
---|
722 | */
|
---|
723 | DECLR0CALLBACKMEMBER(int, pfnVMSetRuntimeError,(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId,
|
---|
724 | const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(4, 5));
|
---|
725 |
|
---|
726 | /**
|
---|
727 | * Set the VM runtime error message
|
---|
728 | *
|
---|
729 | * @returns VBox status code.
|
---|
730 | * @param pDrvIns Driver instance.
|
---|
731 | * @param fFlags The action flags. See VMSETRTERR_FLAGS_*.
|
---|
732 | * @param pszErrorId Error ID string.
|
---|
733 | * @param pszFormat Error message format string.
|
---|
734 | * @param va Error message arguments.
|
---|
735 | */
|
---|
736 | DECLR0CALLBACKMEMBER(int, pfnVMSetRuntimeErrorV,(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId,
|
---|
737 | const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(4, 0));
|
---|
738 |
|
---|
739 | /**
|
---|
740 | * Assert that the current thread is the emulation thread.
|
---|
741 | *
|
---|
742 | * @returns True if correct.
|
---|
743 | * @returns False if wrong.
|
---|
744 | * @param pDrvIns Driver instance.
|
---|
745 | * @param pszFile Filename of the assertion location.
|
---|
746 | * @param iLine Linenumber of the assertion location.
|
---|
747 | * @param pszFunction Function of the assertion location.
|
---|
748 | */
|
---|
749 | DECLR0CALLBACKMEMBER(bool, pfnAssertEMT,(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction));
|
---|
750 |
|
---|
751 | /**
|
---|
752 | * Assert that the current thread is NOT the emulation thread.
|
---|
753 | *
|
---|
754 | * @returns True if correct.
|
---|
755 | * @returns False if wrong.
|
---|
756 | * @param pDrvIns Driver instance.
|
---|
757 | * @param pszFile Filename of the assertion location.
|
---|
758 | * @param iLine Linenumber of the assertion location.
|
---|
759 | * @param pszFunction Function of the assertion location.
|
---|
760 | */
|
---|
761 | DECLR0CALLBACKMEMBER(bool, pfnAssertOther,(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction));
|
---|
762 |
|
---|
763 | /** @name Exported PDM Critical Section Functions
|
---|
764 | * @{ */
|
---|
765 | DECLR0CALLBACKMEMBER(int, pfnCritSectEnter,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect, int rcBusy));
|
---|
766 | DECLR0CALLBACKMEMBER(int, pfnCritSectEnterDebug,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL));
|
---|
767 | DECLR0CALLBACKMEMBER(int, pfnCritSectTryEnter,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect));
|
---|
768 | DECLR0CALLBACKMEMBER(int, pfnCritSectTryEnterDebug,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect, RTHCUINTPTR uId, RT_SRC_POS_DECL));
|
---|
769 | DECLR0CALLBACKMEMBER(int, pfnCritSectLeave,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect));
|
---|
770 | DECLR0CALLBACKMEMBER(bool, pfnCritSectIsOwner,(PPDMDRVINS pDrvIns, PCPDMCRITSECT pCritSect));
|
---|
771 | DECLR0CALLBACKMEMBER(bool, pfnCritSectIsInitialized,(PPDMDRVINS pDrvIns, PCPDMCRITSECT pCritSect));
|
---|
772 | DECLR0CALLBACKMEMBER(bool, pfnCritSectHasWaiters,(PPDMDRVINS pDrvIns, PCPDMCRITSECT pCritSect));
|
---|
773 | DECLR0CALLBACKMEMBER(uint32_t, pfnCritSectGetRecursion,(PPDMDRVINS pDrvIns, PCPDMCRITSECT pCritSect));
|
---|
774 | DECLR0CALLBACKMEMBER(int, pfnCritSectScheduleExitEvent,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect, SUPSEMEVENT hEventToSignal));
|
---|
775 | /** @} */
|
---|
776 |
|
---|
777 | /**
|
---|
778 | * Obtains bandwidth in a bandwidth group.
|
---|
779 | *
|
---|
780 | * @returns True if bandwidth was allocated, false if not.
|
---|
781 | * @param pDrvIns The driver instance.
|
---|
782 | * @param pFilter Pointer to the filter that allocates bandwidth.
|
---|
783 | * @param cbTransfer Number of bytes to allocate.
|
---|
784 | */
|
---|
785 | DECLR0CALLBACKMEMBER(bool, pfnNetShaperAllocateBandwidth,(PPDMDRVINS pDrvIns, PPDMNSFILTER pFilter, size_t cbTransfer));
|
---|
786 |
|
---|
787 | /** Just a safety precaution. */
|
---|
788 | uint32_t u32TheEnd;
|
---|
789 | } PDMDRVHLPR0;
|
---|
790 | /** Current DRVHLP version number. */
|
---|
791 | #define PDM_DRVHLPR0_VERSION PDM_VERSION_MAKE(0xf0f8, 5, 0)
|
---|
792 |
|
---|
793 |
|
---|
794 | #ifdef IN_RING3
|
---|
795 |
|
---|
796 | /**
|
---|
797 | * PDM Driver API.
|
---|
798 | */
|
---|
799 | typedef struct PDMDRVHLPR3
|
---|
800 | {
|
---|
801 | /** Structure version. PDM_DRVHLPR3_VERSION defines the current version. */
|
---|
802 | uint32_t u32Version;
|
---|
803 |
|
---|
804 | /**
|
---|
805 | * Attaches a driver (chain) to the driver.
|
---|
806 | *
|
---|
807 | * @returns VBox status code.
|
---|
808 | * @param pDrvIns Driver instance.
|
---|
809 | * @param fFlags PDM_TACH_FLAGS_NOT_HOT_PLUG or 0.
|
---|
810 | * @param ppBaseInterface Where to store the pointer to the base interface.
|
---|
811 | */
|
---|
812 | DECLR3CALLBACKMEMBER(int, pfnAttach,(PPDMDRVINS pDrvIns, uint32_t fFlags, PPDMIBASE *ppBaseInterface));
|
---|
813 |
|
---|
814 | /**
|
---|
815 | * Detach the driver the drivers below us.
|
---|
816 | *
|
---|
817 | * @returns VBox status code.
|
---|
818 | * @param pDrvIns Driver instance.
|
---|
819 | * @param fFlags PDM_TACH_FLAGS_NOT_HOT_PLUG or 0.
|
---|
820 | */
|
---|
821 | DECLR3CALLBACKMEMBER(int, pfnDetach,(PPDMDRVINS pDrvIns, uint32_t fFlags));
|
---|
822 |
|
---|
823 | /**
|
---|
824 | * Detach the driver from the driver above it and destroy this
|
---|
825 | * driver and all drivers below it.
|
---|
826 | *
|
---|
827 | * @returns VBox status code.
|
---|
828 | * @param pDrvIns Driver instance.
|
---|
829 | * @param fFlags PDM_TACH_FLAGS_NOT_HOT_PLUG or 0.
|
---|
830 | */
|
---|
831 | DECLR3CALLBACKMEMBER(int, pfnDetachSelf,(PPDMDRVINS pDrvIns, uint32_t fFlags));
|
---|
832 |
|
---|
833 | /**
|
---|
834 | * Prepare a media mount.
|
---|
835 | *
|
---|
836 | * The driver must not have anything attached to itself
|
---|
837 | * when calling this function as the purpose is to set up the configuration
|
---|
838 | * of an future attachment.
|
---|
839 | *
|
---|
840 | * @returns VBox status code
|
---|
841 | * @param pDrvIns Driver instance.
|
---|
842 | * @param pszFilename Pointer to filename. If this is NULL it assumed that the caller have
|
---|
843 | * constructed a configuration which can be attached to the bottom driver.
|
---|
844 | * @param pszCoreDriver Core driver name. NULL will cause autodetection. Ignored if pszFilanem is NULL.
|
---|
845 | */
|
---|
846 | DECLR3CALLBACKMEMBER(int, pfnMountPrepare,(PPDMDRVINS pDrvIns, const char *pszFilename, const char *pszCoreDriver));
|
---|
847 |
|
---|
848 | /**
|
---|
849 | * Assert that the current thread is the emulation thread.
|
---|
850 | *
|
---|
851 | * @returns True if correct.
|
---|
852 | * @returns False if wrong.
|
---|
853 | * @param pDrvIns Driver instance.
|
---|
854 | * @param pszFile Filename of the assertion location.
|
---|
855 | * @param iLine Linenumber of the assertion location.
|
---|
856 | * @param pszFunction Function of the assertion location.
|
---|
857 | */
|
---|
858 | DECLR3CALLBACKMEMBER(bool, pfnAssertEMT,(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction));
|
---|
859 |
|
---|
860 | /**
|
---|
861 | * Assert that the current thread is NOT the emulation thread.
|
---|
862 | *
|
---|
863 | * @returns True if correct.
|
---|
864 | * @returns False if wrong.
|
---|
865 | * @param pDrvIns Driver instance.
|
---|
866 | * @param pszFile Filename of the assertion location.
|
---|
867 | * @param iLine Linenumber of the assertion location.
|
---|
868 | * @param pszFunction Function of the assertion location.
|
---|
869 | */
|
---|
870 | DECLR3CALLBACKMEMBER(bool, pfnAssertOther,(PPDMDRVINS pDrvIns, const char *pszFile, unsigned iLine, const char *pszFunction));
|
---|
871 |
|
---|
872 | /**
|
---|
873 | * Set the VM error message
|
---|
874 | *
|
---|
875 | * @returns rc.
|
---|
876 | * @param pDrvIns Driver instance.
|
---|
877 | * @param rc VBox status code.
|
---|
878 | * @param SRC_POS Use RT_SRC_POS.
|
---|
879 | * @param pszFormat Error message format string.
|
---|
880 | * @param ... Error message arguments.
|
---|
881 | */
|
---|
882 | DECLR3CALLBACKMEMBER(int, pfnVMSetError,(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL,
|
---|
883 | const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(6, 7));
|
---|
884 |
|
---|
885 | /**
|
---|
886 | * Set the VM error message
|
---|
887 | *
|
---|
888 | * @returns rc.
|
---|
889 | * @param pDrvIns Driver instance.
|
---|
890 | * @param rc VBox status code.
|
---|
891 | * @param SRC_POS Use RT_SRC_POS.
|
---|
892 | * @param pszFormat Error message format string.
|
---|
893 | * @param va Error message arguments.
|
---|
894 | */
|
---|
895 | DECLR3CALLBACKMEMBER(int, pfnVMSetErrorV,(PPDMDRVINS pDrvIns, int rc, RT_SRC_POS_DECL,
|
---|
896 | const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(6, 0));
|
---|
897 |
|
---|
898 | /**
|
---|
899 | * Set the VM runtime error message
|
---|
900 | *
|
---|
901 | * @returns VBox status code.
|
---|
902 | * @param pDrvIns Driver instance.
|
---|
903 | * @param fFlags The action flags. See VMSETRTERR_FLAGS_*.
|
---|
904 | * @param pszErrorId Error ID string.
|
---|
905 | * @param pszFormat Error message format string.
|
---|
906 | * @param ... Error message arguments.
|
---|
907 | */
|
---|
908 | DECLR3CALLBACKMEMBER(int, pfnVMSetRuntimeError,(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId,
|
---|
909 | const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(4, 5));
|
---|
910 |
|
---|
911 | /**
|
---|
912 | * Set the VM runtime error message
|
---|
913 | *
|
---|
914 | * @returns VBox status code.
|
---|
915 | * @param pDrvIns Driver instance.
|
---|
916 | * @param fFlags The action flags. See VMSETRTERR_FLAGS_*.
|
---|
917 | * @param pszErrorId Error ID string.
|
---|
918 | * @param pszFormat Error message format string.
|
---|
919 | * @param va Error message arguments.
|
---|
920 | */
|
---|
921 | DECLR3CALLBACKMEMBER(int, pfnVMSetRuntimeErrorV,(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId,
|
---|
922 | const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(4, 0));
|
---|
923 |
|
---|
924 | /**
|
---|
925 | * Gets the VM state.
|
---|
926 | *
|
---|
927 | * @returns VM state.
|
---|
928 | * @param pDrvIns The driver instance.
|
---|
929 | * @thread Any thread (just keep in mind that it's volatile info).
|
---|
930 | */
|
---|
931 | DECLR3CALLBACKMEMBER(VMSTATE, pfnVMState, (PPDMDRVINS pDrvIns));
|
---|
932 |
|
---|
933 | /**
|
---|
934 | * Checks if the VM was teleported and hasn't been fully resumed yet.
|
---|
935 | *
|
---|
936 | * @returns true / false.
|
---|
937 | * @param pDrvIns The driver instance.
|
---|
938 | * @thread Any thread.
|
---|
939 | */
|
---|
940 | DECLR3CALLBACKMEMBER(bool, pfnVMTeleportedAndNotFullyResumedYet,(PPDMDRVINS pDrvIns));
|
---|
941 |
|
---|
942 | /**
|
---|
943 | * Gets the support driver session.
|
---|
944 | *
|
---|
945 | * This is intended for working using the semaphore API.
|
---|
946 | *
|
---|
947 | * @returns Support driver session handle.
|
---|
948 | * @param pDrvIns The driver instance.
|
---|
949 | */
|
---|
950 | DECLR3CALLBACKMEMBER(PSUPDRVSESSION, pfnGetSupDrvSession,(PPDMDRVINS pDrvIns));
|
---|
951 |
|
---|
952 | /**
|
---|
953 | * Create a queue.
|
---|
954 | *
|
---|
955 | * @returns VBox status code.
|
---|
956 | * @param pDrvIns Driver instance.
|
---|
957 | * @param cbItem Size a queue item.
|
---|
958 | * @param cItems Number of items in the queue.
|
---|
959 | * @param cMilliesInterval Number of milliseconds between polling the queue.
|
---|
960 | * If 0 then the emulation thread will be notified whenever an item arrives.
|
---|
961 | * @param pfnCallback The consumer function.
|
---|
962 | * @param pszName The queue base name. The instance number will be
|
---|
963 | * appended automatically.
|
---|
964 | * @param ppQueue Where to store the queue handle on success.
|
---|
965 | * @thread The emulation thread.
|
---|
966 | */
|
---|
967 | DECLR3CALLBACKMEMBER(int, pfnQueueCreate,(PPDMDRVINS pDrvIns, uint32_t cbItem, uint32_t cItems, uint32_t cMilliesInterval,
|
---|
968 | PFNPDMQUEUEDRV pfnCallback, const char *pszName, PPDMQUEUE *ppQueue));
|
---|
969 |
|
---|
970 | /**
|
---|
971 | * Query the virtual timer frequency.
|
---|
972 | *
|
---|
973 | * @returns Frequency in Hz.
|
---|
974 | * @param pDrvIns Driver instance.
|
---|
975 | * @thread Any thread.
|
---|
976 | */
|
---|
977 | DECLR3CALLBACKMEMBER(uint64_t, pfnTMGetVirtualFreq,(PPDMDRVINS pDrvIns));
|
---|
978 |
|
---|
979 | /**
|
---|
980 | * Query the virtual time.
|
---|
981 | *
|
---|
982 | * @returns The current virtual time.
|
---|
983 | * @param pDrvIns Driver instance.
|
---|
984 | * @thread Any thread.
|
---|
985 | */
|
---|
986 | DECLR3CALLBACKMEMBER(uint64_t, pfnTMGetVirtualTime,(PPDMDRVINS pDrvIns));
|
---|
987 |
|
---|
988 | /**
|
---|
989 | * Creates a timer.
|
---|
990 | *
|
---|
991 | * @returns VBox status.
|
---|
992 | * @param pDrvIns Driver instance.
|
---|
993 | * @param enmClock The clock to use on this timer.
|
---|
994 | * @param pfnCallback Callback function.
|
---|
995 | * @param pvUser The user argument to the callback.
|
---|
996 | * @param fFlags Timer creation flags, see grp_tm_timer_flags.
|
---|
997 | * @param pszDesc Pointer to description string which must stay around
|
---|
998 | * until the timer is fully destroyed (i.e. a bit after TMTimerDestroy()).
|
---|
999 | * @param phTimer Where to store the timer handle on success.
|
---|
1000 | * @thread EMT
|
---|
1001 | *
|
---|
1002 | * @todo Need to add a bunch of timer helpers for this to be useful again.
|
---|
1003 | * Will do when required.
|
---|
1004 | */
|
---|
1005 | DECLR3CALLBACKMEMBER(int, pfnTimerCreate,(PPDMDRVINS pDrvIns, TMCLOCK enmClock, PFNTMTIMERDRV pfnCallback, void *pvUser,
|
---|
1006 | uint32_t fFlags, const char *pszDesc, PTMTIMERHANDLE phTimer));
|
---|
1007 |
|
---|
1008 | /**
|
---|
1009 | * Register a save state data unit.
|
---|
1010 | *
|
---|
1011 | * @returns VBox status.
|
---|
1012 | * @param pDrvIns Driver instance.
|
---|
1013 | * @param uVersion Data layout version number.
|
---|
1014 | * @param cbGuess The approximate amount of data in the unit.
|
---|
1015 | * Only for progress indicators.
|
---|
1016 | *
|
---|
1017 | * @param pfnLivePrep Prepare live save callback, optional.
|
---|
1018 | * @param pfnLiveExec Execute live save callback, optional.
|
---|
1019 | * @param pfnLiveVote Vote live save callback, optional.
|
---|
1020 | *
|
---|
1021 | * @param pfnSavePrep Prepare save callback, optional.
|
---|
1022 | * @param pfnSaveExec Execute save callback, optional.
|
---|
1023 | * @param pfnSaveDone Done save callback, optional.
|
---|
1024 | *
|
---|
1025 | * @param pfnLoadPrep Prepare load callback, optional.
|
---|
1026 | * @param pfnLoadExec Execute load callback, optional.
|
---|
1027 | * @param pfnLoadDone Done load callback, optional.
|
---|
1028 | */
|
---|
1029 | DECLR3CALLBACKMEMBER(int, pfnSSMRegister,(PPDMDRVINS pDrvIns, uint32_t uVersion, size_t cbGuess,
|
---|
1030 | PFNSSMDRVLIVEPREP pfnLivePrep, PFNSSMDRVLIVEEXEC pfnLiveExec, PFNSSMDRVLIVEVOTE pfnLiveVote,
|
---|
1031 | PFNSSMDRVSAVEPREP pfnSavePrep, PFNSSMDRVSAVEEXEC pfnSaveExec, PFNSSMDRVSAVEDONE pfnSaveDone,
|
---|
1032 | PFNSSMDRVLOADPREP pfnLoadPrep, PFNSSMDRVLOADEXEC pfnLoadExec, PFNSSMDRVLOADDONE pfnLoadDone));
|
---|
1033 |
|
---|
1034 | /**
|
---|
1035 | * Deregister a save state data unit.
|
---|
1036 | *
|
---|
1037 | * @returns VBox status.
|
---|
1038 | * @param pDrvIns Driver instance.
|
---|
1039 | * @param pszName Data unit name.
|
---|
1040 | * @param uInstance The instance identifier of the data unit.
|
---|
1041 | * This must together with the name be unique.
|
---|
1042 | */
|
---|
1043 | DECLR3CALLBACKMEMBER(int, pfnSSMDeregister,(PPDMDRVINS pDrvIns, const char *pszName, uint32_t uInstance));
|
---|
1044 |
|
---|
1045 | /**
|
---|
1046 | * Register an info handler with DBGF.
|
---|
1047 | *
|
---|
1048 | * @returns VBox status code.
|
---|
1049 | * @param pDrvIns Driver instance.
|
---|
1050 | * @param pszName Data unit name.
|
---|
1051 | * @param pszDesc The description of the info and any arguments
|
---|
1052 | * the handler may take.
|
---|
1053 | * @param pfnHandler The handler function to be called to display the
|
---|
1054 | * info.
|
---|
1055 | */
|
---|
1056 | DECLR3CALLBACKMEMBER(int, pfnDBGFInfoRegister,(PPDMDRVINS pDrvIns, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDRV pfnHandler));
|
---|
1057 |
|
---|
1058 | /**
|
---|
1059 | * Register an info handler with DBGF, argv style.
|
---|
1060 | *
|
---|
1061 | * @returns VBox status code.
|
---|
1062 | * @param pDrvIns Driver instance.
|
---|
1063 | * @param pszName Data unit name.
|
---|
1064 | * @param pszDesc The description of the info and any arguments
|
---|
1065 | * the handler may take.
|
---|
1066 | * @param pfnHandler The handler function to be called to display the
|
---|
1067 | * info.
|
---|
1068 | */
|
---|
1069 | DECLR3CALLBACKMEMBER(int, pfnDBGFInfoRegisterArgv,(PPDMDRVINS pDrvIns, const char *pszName, const char *pszDesc, PFNDBGFINFOARGVDRV pfnHandler));
|
---|
1070 |
|
---|
1071 | /**
|
---|
1072 | * Deregister an info handler from DBGF.
|
---|
1073 | *
|
---|
1074 | * @returns VBox status code.
|
---|
1075 | * @param pDrvIns Driver instance.
|
---|
1076 | * @param pszName Data unit name.
|
---|
1077 | */
|
---|
1078 | DECLR3CALLBACKMEMBER(int, pfnDBGFInfoDeregister,(PPDMDRVINS pDrvIns, const char *pszName));
|
---|
1079 |
|
---|
1080 | /**
|
---|
1081 | * Registers a statistics sample if statistics are enabled.
|
---|
1082 | *
|
---|
1083 | * @param pDrvIns Driver instance.
|
---|
1084 | * @param pvSample Pointer to the sample.
|
---|
1085 | * @param enmType Sample type. This indicates what pvSample is pointing at.
|
---|
1086 | * @param pszName Sample name. The name is on this form "/<component>/<sample>".
|
---|
1087 | * Further nesting is possible. If this does not start
|
---|
1088 | * with a '/', the default prefix will be prepended,
|
---|
1089 | * otherwise it will be used as-is.
|
---|
1090 | * @param enmUnit Sample unit.
|
---|
1091 | * @param pszDesc Sample description.
|
---|
1092 | */
|
---|
1093 | DECLR3CALLBACKMEMBER(void, pfnSTAMRegister,(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, const char *pszName,
|
---|
1094 | STAMUNIT enmUnit, const char *pszDesc));
|
---|
1095 |
|
---|
1096 | /**
|
---|
1097 | * Same as pfnSTAMRegister except that the name is specified in a
|
---|
1098 | * RTStrPrintf like fashion.
|
---|
1099 | *
|
---|
1100 | * @param pDrvIns Driver instance.
|
---|
1101 | * @param pvSample Pointer to the sample.
|
---|
1102 | * @param enmType Sample type. This indicates what pvSample is pointing at.
|
---|
1103 | * @param enmVisibility Visibility type specifying whether unused statistics should be visible or not.
|
---|
1104 | * @param enmUnit Sample unit.
|
---|
1105 | * @param pszDesc Sample description.
|
---|
1106 | * @param pszName The sample name format string. If this does not start
|
---|
1107 | * with a '/', the default prefix will be prepended,
|
---|
1108 | * otherwise it will be used as-is.
|
---|
1109 | * @param ... Arguments to the format string.
|
---|
1110 | */
|
---|
1111 | DECLR3CALLBACKMEMBER(void, pfnSTAMRegisterF,(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
|
---|
1112 | STAMUNIT enmUnit, const char *pszDesc,
|
---|
1113 | const char *pszName, ...) RT_IPRT_FORMAT_ATTR(7, 8));
|
---|
1114 |
|
---|
1115 | /**
|
---|
1116 | * Same as pfnSTAMRegister except that the name is specified in a
|
---|
1117 | * RTStrPrintfV like fashion.
|
---|
1118 | *
|
---|
1119 | * @param pDrvIns Driver instance.
|
---|
1120 | * @param pvSample Pointer to the sample.
|
---|
1121 | * @param enmType Sample type. This indicates what pvSample is pointing at.
|
---|
1122 | * @param enmVisibility Visibility type specifying whether unused statistics should be visible or not.
|
---|
1123 | * @param enmUnit Sample unit.
|
---|
1124 | * @param pszDesc Sample description.
|
---|
1125 | * @param pszName The sample name format string. If this does not
|
---|
1126 | * start with a '/', the default prefix will be prepended,
|
---|
1127 | * otherwise it will be used as-is.
|
---|
1128 | * @param args Arguments to the format string.
|
---|
1129 | */
|
---|
1130 | DECLR3CALLBACKMEMBER(void, pfnSTAMRegisterV,(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
|
---|
1131 | STAMUNIT enmUnit, const char *pszDesc,
|
---|
1132 | const char *pszName, va_list args) RT_IPRT_FORMAT_ATTR(7, 0));
|
---|
1133 |
|
---|
1134 | /**
|
---|
1135 | * Deregister a statistic item previously registered with pfnSTAMRegister,
|
---|
1136 | * pfnSTAMRegisterF or pfnSTAMRegisterV
|
---|
1137 | *
|
---|
1138 | * @returns VBox status.
|
---|
1139 | * @param pDrvIns Driver instance.
|
---|
1140 | * @param pvSample Pointer to the sample.
|
---|
1141 | */
|
---|
1142 | DECLR3CALLBACKMEMBER(int, pfnSTAMDeregister,(PPDMDRVINS pDrvIns, void *pvSample));
|
---|
1143 |
|
---|
1144 | /**
|
---|
1145 | * Calls the HC R0 VMM entry point, in a safer but slower manner than
|
---|
1146 | * SUPR3CallVMMR0.
|
---|
1147 | *
|
---|
1148 | * When entering using this call the R0 components can call into the host kernel
|
---|
1149 | * (i.e. use the SUPR0 and RT APIs).
|
---|
1150 | *
|
---|
1151 | * See VMMR0Entry() for more details.
|
---|
1152 | *
|
---|
1153 | * @returns error code specific to uFunction.
|
---|
1154 | * @param pDrvIns The driver instance.
|
---|
1155 | * @param uOperation Operation to execute.
|
---|
1156 | * This is limited to services.
|
---|
1157 | * @param pvArg Pointer to argument structure or if cbArg is 0 just an value.
|
---|
1158 | * @param cbArg The size of the argument. This is used to copy whatever the argument
|
---|
1159 | * points at into a kernel buffer to avoid problems like the user page
|
---|
1160 | * being invalidated while we're executing the call.
|
---|
1161 | */
|
---|
1162 | DECLR3CALLBACKMEMBER(int, pfnSUPCallVMMR0Ex,(PPDMDRVINS pDrvIns, unsigned uOperation, void *pvArg, unsigned cbArg));
|
---|
1163 |
|
---|
1164 | /**
|
---|
1165 | * Registers a USB HUB.
|
---|
1166 | *
|
---|
1167 | * @returns VBox status code.
|
---|
1168 | * @param pDrvIns The driver instance.
|
---|
1169 | * @param fVersions Indicates the kinds of USB devices that can be attached to this HUB.
|
---|
1170 | * @param cPorts The number of ports.
|
---|
1171 | * @param pUsbHubReg The hub callback structure that PDMUsb uses to interact with it.
|
---|
1172 | * @param ppUsbHubHlp The helper callback structure that the hub uses to talk to PDMUsb.
|
---|
1173 | *
|
---|
1174 | * @thread EMT.
|
---|
1175 | */
|
---|
1176 | DECLR3CALLBACKMEMBER(int, pfnUSBRegisterHub,(PPDMDRVINS pDrvIns, uint32_t fVersions, uint32_t cPorts, PCPDMUSBHUBREG pUsbHubReg, PPCPDMUSBHUBHLP ppUsbHubHlp));
|
---|
1177 |
|
---|
1178 | /**
|
---|
1179 | * Set up asynchronous handling of a suspend, reset or power off notification.
|
---|
1180 | *
|
---|
1181 | * This shall only be called when getting the notification. It must be called
|
---|
1182 | * for each one.
|
---|
1183 | *
|
---|
1184 | * @returns VBox status code.
|
---|
1185 | * @param pDrvIns The driver instance.
|
---|
1186 | * @param pfnAsyncNotify The callback.
|
---|
1187 | * @thread EMT(0)
|
---|
1188 | */
|
---|
1189 | DECLR3CALLBACKMEMBER(int, pfnSetAsyncNotification, (PPDMDRVINS pDrvIns, PFNPDMDRVASYNCNOTIFY pfnAsyncNotify));
|
---|
1190 |
|
---|
1191 | /**
|
---|
1192 | * Notify EMT(0) that the driver has completed the asynchronous notification
|
---|
1193 | * handling.
|
---|
1194 | *
|
---|
1195 | * This can be called at any time, spurious calls will simply be ignored.
|
---|
1196 | *
|
---|
1197 | * @param pDrvIns The driver instance.
|
---|
1198 | * @thread Any
|
---|
1199 | */
|
---|
1200 | DECLR3CALLBACKMEMBER(void, pfnAsyncNotificationCompleted, (PPDMDRVINS pDrvIns));
|
---|
1201 |
|
---|
1202 | /**
|
---|
1203 | * Creates a PDM thread.
|
---|
1204 | *
|
---|
1205 | * This differs from the RTThreadCreate() API in that PDM takes care of suspending,
|
---|
1206 | * resuming, and destroying the thread as the VM state changes.
|
---|
1207 | *
|
---|
1208 | * @returns VBox status code.
|
---|
1209 | * @param pDrvIns The driver instance.
|
---|
1210 | * @param ppThread Where to store the thread 'handle'.
|
---|
1211 | * @param pvUser The user argument to the thread function.
|
---|
1212 | * @param pfnThread The thread function.
|
---|
1213 | * @param pfnWakeup The wakup callback. This is called on the EMT thread when
|
---|
1214 | * a state change is pending.
|
---|
1215 | * @param cbStack See RTThreadCreate.
|
---|
1216 | * @param enmType See RTThreadCreate.
|
---|
1217 | * @param pszName See RTThreadCreate.
|
---|
1218 | */
|
---|
1219 | DECLR3CALLBACKMEMBER(int, pfnThreadCreate,(PPDMDRVINS pDrvIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDRV pfnThread,
|
---|
1220 | PFNPDMTHREADWAKEUPDRV pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName));
|
---|
1221 |
|
---|
1222 | /**
|
---|
1223 | * Creates an async completion template for a driver instance.
|
---|
1224 | *
|
---|
1225 | * The template is used when creating new completion tasks.
|
---|
1226 | *
|
---|
1227 | * @returns VBox status code.
|
---|
1228 | * @param pDrvIns The driver instance.
|
---|
1229 | * @param ppTemplate Where to store the template pointer on success.
|
---|
1230 | * @param pfnCompleted The completion callback routine.
|
---|
1231 | * @param pvTemplateUser Template user argument.
|
---|
1232 | * @param pszDesc Description.
|
---|
1233 | */
|
---|
1234 | DECLR3CALLBACKMEMBER(int, pfnAsyncCompletionTemplateCreate,(PPDMDRVINS pDrvIns, PPPDMASYNCCOMPLETIONTEMPLATE ppTemplate,
|
---|
1235 | PFNPDMASYNCCOMPLETEDRV pfnCompleted, void *pvTemplateUser,
|
---|
1236 | const char *pszDesc));
|
---|
1237 |
|
---|
1238 | /**
|
---|
1239 | * Attaches network filter driver to a bandwidth group.
|
---|
1240 | *
|
---|
1241 | * @returns VBox status code.
|
---|
1242 | * @param pDrvIns The driver instance.
|
---|
1243 | * @param pszBwGroup Name of the bandwidth group to attach to.
|
---|
1244 | * @param pFilter Pointer to the filter we attach.
|
---|
1245 | */
|
---|
1246 | DECLR3CALLBACKMEMBER(int, pfnNetShaperAttach,(PPDMDRVINS pDrvIns, const char *pszBwGroup, PPDMNSFILTER pFilter));
|
---|
1247 |
|
---|
1248 | /**
|
---|
1249 | * Detaches network filter driver to a bandwidth group.
|
---|
1250 | *
|
---|
1251 | * @returns VBox status code.
|
---|
1252 | * @param pDrvIns The driver instance.
|
---|
1253 | * @param pFilter Pointer to the filter we attach.
|
---|
1254 | */
|
---|
1255 | DECLR3CALLBACKMEMBER(int, pfnNetShaperDetach,(PPDMDRVINS pDrvIns, PPDMNSFILTER pFilter));
|
---|
1256 |
|
---|
1257 | /**
|
---|
1258 | * Obtains bandwidth in a bandwidth group.
|
---|
1259 | *
|
---|
1260 | * @returns True if bandwidth was allocated, false if not.
|
---|
1261 | * @param pDrvIns The driver instance.
|
---|
1262 | * @param pFilter Pointer to the filter that allocates bandwidth.
|
---|
1263 | * @param cbTransfer Number of bytes to allocate.
|
---|
1264 | */
|
---|
1265 | DECLR3CALLBACKMEMBER(bool, pfnNetShaperAllocateBandwidth,(PPDMDRVINS pDrvIns, PPDMNSFILTER pFilter, size_t cbTransfer));
|
---|
1266 |
|
---|
1267 | /**
|
---|
1268 | * Resolves the symbol for a raw-mode context interface.
|
---|
1269 | *
|
---|
1270 | * @returns VBox status code.
|
---|
1271 | * @param pDrvIns The driver instance.
|
---|
1272 | * @param pvInterface The interface structure.
|
---|
1273 | * @param cbInterface The size of the interface structure.
|
---|
1274 | * @param pszSymPrefix What to prefix the symbols in the list with before
|
---|
1275 | * resolving them. This must start with 'drv' and
|
---|
1276 | * contain the driver name.
|
---|
1277 | * @param pszSymList List of symbols corresponding to the interface.
|
---|
1278 | * There is generally a there is generally a define
|
---|
1279 | * holding this list associated with the interface
|
---|
1280 | * definition (INTERFACE_SYM_LIST). For more details
|
---|
1281 | * see PDMR3LdrGetInterfaceSymbols.
|
---|
1282 | * @thread EMT
|
---|
1283 | */
|
---|
1284 | DECLR3CALLBACKMEMBER(int, pfnLdrGetRCInterfaceSymbols,(PPDMDRVINS pDrvIns, void *pvInterface, size_t cbInterface,
|
---|
1285 | const char *pszSymPrefix, const char *pszSymList));
|
---|
1286 |
|
---|
1287 | /**
|
---|
1288 | * Resolves the symbol for a ring-0 context interface.
|
---|
1289 | *
|
---|
1290 | * @returns VBox status code.
|
---|
1291 | * @param pDrvIns The driver instance.
|
---|
1292 | * @param pvInterface The interface structure.
|
---|
1293 | * @param cbInterface The size of the interface structure.
|
---|
1294 | * @param pszSymPrefix What to prefix the symbols in the list with before
|
---|
1295 | * resolving them. This must start with 'drv' and
|
---|
1296 | * contain the driver name.
|
---|
1297 | * @param pszSymList List of symbols corresponding to the interface.
|
---|
1298 | * There is generally a there is generally a define
|
---|
1299 | * holding this list associated with the interface
|
---|
1300 | * definition (INTERFACE_SYM_LIST). For more details
|
---|
1301 | * see PDMR3LdrGetInterfaceSymbols.
|
---|
1302 | * @thread EMT
|
---|
1303 | */
|
---|
1304 | DECLR3CALLBACKMEMBER(int, pfnLdrGetR0InterfaceSymbols,(PPDMDRVINS pDrvIns, void *pvInterface, size_t cbInterface,
|
---|
1305 | const char *pszSymPrefix, const char *pszSymList));
|
---|
1306 | /**
|
---|
1307 | * Initializes a PDM critical section.
|
---|
1308 | *
|
---|
1309 | * The PDM critical sections are derived from the IPRT critical sections, but
|
---|
1310 | * works in both RC and R0 as well as R3.
|
---|
1311 | *
|
---|
1312 | * @returns VBox status code.
|
---|
1313 | * @param pDrvIns The driver instance.
|
---|
1314 | * @param pCritSect Pointer to the critical section.
|
---|
1315 | * @param SRC_POS Use RT_SRC_POS.
|
---|
1316 | * @param pszName The base name of the critical section. Will be
|
---|
1317 | * mangeled with the instance number. For
|
---|
1318 | * statistics and lock validation.
|
---|
1319 | * @thread EMT
|
---|
1320 | */
|
---|
1321 | DECLR3CALLBACKMEMBER(int, pfnCritSectInit,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect, RT_SRC_POS_DECL, const char *pszName));
|
---|
1322 |
|
---|
1323 | /** @name Exported PDM Critical Section Functions
|
---|
1324 | * @{ */
|
---|
1325 | DECLR3CALLBACKMEMBER(bool, pfnCritSectYield,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect));
|
---|
1326 | DECLR3CALLBACKMEMBER(int, pfnCritSectEnter,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect, int rcBusy));
|
---|
1327 | DECLR3CALLBACKMEMBER(int, pfnCritSectEnterDebug,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL));
|
---|
1328 | DECLR3CALLBACKMEMBER(int, pfnCritSectTryEnter,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect));
|
---|
1329 | DECLR3CALLBACKMEMBER(int, pfnCritSectTryEnterDebug,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect, RTHCUINTPTR uId, RT_SRC_POS_DECL));
|
---|
1330 | DECLR3CALLBACKMEMBER(int, pfnCritSectLeave,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect));
|
---|
1331 | DECLR3CALLBACKMEMBER(bool, pfnCritSectIsOwner,(PPDMDRVINS pDrvIns, PCPDMCRITSECT pCritSect));
|
---|
1332 | DECLR3CALLBACKMEMBER(bool, pfnCritSectIsInitialized,(PPDMDRVINS pDrvIns, PCPDMCRITSECT pCritSect));
|
---|
1333 | DECLR3CALLBACKMEMBER(bool, pfnCritSectHasWaiters,(PPDMDRVINS pDrvIns, PCPDMCRITSECT pCritSect));
|
---|
1334 | DECLR3CALLBACKMEMBER(uint32_t, pfnCritSectGetRecursion,(PPDMDRVINS pDrvIns, PCPDMCRITSECT pCritSect));
|
---|
1335 | DECLR3CALLBACKMEMBER(int, pfnCritSectScheduleExitEvent,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect, SUPSEMEVENT hEventToSignal));
|
---|
1336 | DECLR3CALLBACKMEMBER(int, pfnCritSectDelete,(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect));
|
---|
1337 | /** @} */
|
---|
1338 |
|
---|
1339 | /**
|
---|
1340 | * Call the ring-0 request handler routine of the driver.
|
---|
1341 | *
|
---|
1342 | * For this to work, the driver must be ring-0 enabled and export a request
|
---|
1343 | * handler function. The name of the function must be the driver name in the
|
---|
1344 | * PDMDRVREG struct prefixed with 'drvR0' and suffixed with 'ReqHandler'.
|
---|
1345 | * The driver name will be capitalized. It shall take the exact same
|
---|
1346 | * arguments as this function and be declared using PDMBOTHCBDECL. See
|
---|
1347 | * FNPDMDRVREQHANDLERR0.
|
---|
1348 | *
|
---|
1349 | * @returns VBox status code.
|
---|
1350 | * @retval VERR_SYMBOL_NOT_FOUND if the driver doesn't export the required
|
---|
1351 | * handler function.
|
---|
1352 | * @retval VERR_ACCESS_DENIED if the driver isn't ring-0 capable.
|
---|
1353 | *
|
---|
1354 | * @param pDrvIns The driver instance.
|
---|
1355 | * @param uOperation The operation to perform.
|
---|
1356 | * @param u64Arg 64-bit integer argument.
|
---|
1357 | * @thread Any
|
---|
1358 | */
|
---|
1359 | DECLR3CALLBACKMEMBER(int, pfnCallR0,(PPDMDRVINS pDrvIns, uint32_t uOperation, uint64_t u64Arg));
|
---|
1360 |
|
---|
1361 | /**
|
---|
1362 | * Creates a block cache for a driver driver instance.
|
---|
1363 | *
|
---|
1364 | * @returns VBox status code.
|
---|
1365 | * @param pDrvIns The driver instance.
|
---|
1366 | * @param ppBlkCache Where to store the handle to the block cache.
|
---|
1367 | * @param pfnXferComplete The I/O transfer complete callback.
|
---|
1368 | * @param pfnXferEnqueue The I/O request enqueue callback.
|
---|
1369 | * @param pfnXferEnqueueDiscard The discard request enqueue callback.
|
---|
1370 | * @param pcszId Unique ID used to identify the user.
|
---|
1371 | */
|
---|
1372 | DECLR3CALLBACKMEMBER(int, pfnBlkCacheRetain, (PPDMDRVINS pDrvIns, PPPDMBLKCACHE ppBlkCache,
|
---|
1373 | PFNPDMBLKCACHEXFERCOMPLETEDRV pfnXferComplete,
|
---|
1374 | PFNPDMBLKCACHEXFERENQUEUEDRV pfnXferEnqueue,
|
---|
1375 | PFNPDMBLKCACHEXFERENQUEUEDISCARDDRV pfnXferEnqueueDiscard,
|
---|
1376 | const char *pcszId));
|
---|
1377 | /**
|
---|
1378 | * Gets the reason for the most recent VM suspend.
|
---|
1379 | *
|
---|
1380 | * @returns The suspend reason. VMSUSPENDREASON_INVALID is returned if no
|
---|
1381 | * suspend has been made or if the pDrvIns is invalid.
|
---|
1382 | * @param pDrvIns The driver instance.
|
---|
1383 | */
|
---|
1384 | DECLR3CALLBACKMEMBER(VMSUSPENDREASON, pfnVMGetSuspendReason,(PPDMDRVINS pDrvIns));
|
---|
1385 |
|
---|
1386 | /**
|
---|
1387 | * Gets the reason for the most recent VM resume.
|
---|
1388 | *
|
---|
1389 | * @returns The resume reason. VMRESUMEREASON_INVALID is returned if no
|
---|
1390 | * resume has been made or if the pDrvIns is invalid.
|
---|
1391 | * @param pDrvIns The driver instance.
|
---|
1392 | */
|
---|
1393 | DECLR3CALLBACKMEMBER(VMRESUMEREASON, pfnVMGetResumeReason,(PPDMDRVINS pDrvIns));
|
---|
1394 |
|
---|
1395 | /** @name Space reserved for minor interface changes.
|
---|
1396 | * @{ */
|
---|
1397 | DECLR3CALLBACKMEMBER(int, pfnTimerSetMillies,(PPDMDRVINS pDrvIns, TMTIMERHANDLE hTimer, uint64_t cMilliesToNext));
|
---|
1398 |
|
---|
1399 | /**
|
---|
1400 | * Deregister zero or more samples given their name prefix.
|
---|
1401 | *
|
---|
1402 | * @returns VBox status code.
|
---|
1403 | * @param pDrvIns The driver instance.
|
---|
1404 | * @param pszPrefix The name prefix of the samples to remove. If this does
|
---|
1405 | * not start with a '/', the default prefix will be
|
---|
1406 | * prepended, otherwise it will be used as-is.
|
---|
1407 | */
|
---|
1408 | DECLR3CALLBACKMEMBER(int, pfnSTAMDeregisterByPrefix,(PPDMDRVINS pDrvIns, const char *pszPrefix));
|
---|
1409 |
|
---|
1410 | /**
|
---|
1411 | * Queries a generic object from the VMM user.
|
---|
1412 | *
|
---|
1413 | * @returns Pointer to the object if found, NULL if not.
|
---|
1414 | * @param pDrvIns The driver instance.
|
---|
1415 | * @param pUuid The UUID of what's being queried. The UUIDs and
|
---|
1416 | * the usage conventions are defined by the user.
|
---|
1417 | */
|
---|
1418 | DECLR3CALLBACKMEMBER(void *, pfnQueryGenericUserObject,(PPDMDRVINS pDrvIns, PCRTUUID pUuid));
|
---|
1419 |
|
---|
1420 | DECLR3CALLBACKMEMBER(void, pfnReserved2,(PPDMDRVINS pDrvIns));
|
---|
1421 | DECLR3CALLBACKMEMBER(void, pfnReserved3,(PPDMDRVINS pDrvIns));
|
---|
1422 | DECLR3CALLBACKMEMBER(void, pfnReserved4,(PPDMDRVINS pDrvIns));
|
---|
1423 | DECLR3CALLBACKMEMBER(void, pfnReserved5,(PPDMDRVINS pDrvIns));
|
---|
1424 | DECLR3CALLBACKMEMBER(void, pfnReserved6,(PPDMDRVINS pDrvIns));
|
---|
1425 | DECLR3CALLBACKMEMBER(void, pfnReserved7,(PPDMDRVINS pDrvIns));
|
---|
1426 | DECLR3CALLBACKMEMBER(void, pfnReserved8,(PPDMDRVINS pDrvIns));
|
---|
1427 | /** @} */
|
---|
1428 |
|
---|
1429 | /** Just a safety precaution. */
|
---|
1430 | uint32_t u32TheEnd;
|
---|
1431 | } PDMDRVHLPR3;
|
---|
1432 | /** Current DRVHLP version number. */
|
---|
1433 | #define PDM_DRVHLPR3_VERSION PDM_VERSION_MAKE(0xf0fb, 7, 0)
|
---|
1434 |
|
---|
1435 | #endif /* IN_RING3 */
|
---|
1436 |
|
---|
1437 |
|
---|
1438 | /**
|
---|
1439 | * @copydoc PDMDRVHLPR3::pfnVMSetError
|
---|
1440 | */
|
---|
1441 | DECLINLINE(int) RT_IPRT_FORMAT_ATTR(6, 7) PDMDrvHlpVMSetError(PPDMDRVINS pDrvIns, const int rc, RT_SRC_POS_DECL,
|
---|
1442 | const char *pszFormat, ...)
|
---|
1443 | {
|
---|
1444 | va_list va;
|
---|
1445 | va_start(va, pszFormat);
|
---|
1446 | pDrvIns->CTX_SUFF(pHlp)->pfnVMSetErrorV(pDrvIns, rc, RT_SRC_POS_ARGS, pszFormat, va);
|
---|
1447 | va_end(va);
|
---|
1448 | return rc;
|
---|
1449 | }
|
---|
1450 |
|
---|
1451 | /** @def PDMDRV_SET_ERROR
|
---|
1452 | * Set the VM error. See PDMDrvHlpVMSetError() for printf like message formatting.
|
---|
1453 | */
|
---|
1454 | #define PDMDRV_SET_ERROR(pDrvIns, rc, pszError) \
|
---|
1455 | PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, "%s", pszError)
|
---|
1456 |
|
---|
1457 | /**
|
---|
1458 | * @copydoc PDMDRVHLPR3::pfnVMSetErrorV
|
---|
1459 | */
|
---|
1460 | DECLINLINE(int) RT_IPRT_FORMAT_ATTR(6, 0) PDMDrvHlpVMSetErrorV(PPDMDRVINS pDrvIns, const int rc, RT_SRC_POS_DECL,
|
---|
1461 | const char *pszFormat, va_list va)
|
---|
1462 | {
|
---|
1463 | return pDrvIns->CTX_SUFF(pHlp)->pfnVMSetErrorV(pDrvIns, rc, RT_SRC_POS_ARGS, pszFormat, va);
|
---|
1464 | }
|
---|
1465 |
|
---|
1466 |
|
---|
1467 | /**
|
---|
1468 | * @copydoc PDMDRVHLPR3::pfnVMSetRuntimeError
|
---|
1469 | */
|
---|
1470 | DECLINLINE(int) RT_IPRT_FORMAT_ATTR(4, 5) PDMDrvHlpVMSetRuntimeError(PPDMDRVINS pDrvIns, uint32_t fFlags, const char *pszErrorId,
|
---|
1471 | const char *pszFormat, ...)
|
---|
1472 | {
|
---|
1473 | va_list va;
|
---|
1474 | int rc;
|
---|
1475 | va_start(va, pszFormat);
|
---|
1476 | rc = pDrvIns->CTX_SUFF(pHlp)->pfnVMSetRuntimeErrorV(pDrvIns, fFlags, pszErrorId, pszFormat, va);
|
---|
1477 | va_end(va);
|
---|
1478 | return rc;
|
---|
1479 | }
|
---|
1480 |
|
---|
1481 | /** @def PDMDRV_SET_RUNTIME_ERROR
|
---|
1482 | * Set the VM runtime error. See PDMDrvHlpVMSetRuntimeError() for printf like message formatting.
|
---|
1483 | */
|
---|
1484 | #define PDMDRV_SET_RUNTIME_ERROR(pDrvIns, fFlags, pszErrorId, pszError) \
|
---|
1485 | PDMDrvHlpVMSetRuntimeError(pDrvIns, fFlags, pszErrorId, "%s", pszError)
|
---|
1486 |
|
---|
1487 | /**
|
---|
1488 | * @copydoc PDMDRVHLPR3::pfnVMSetRuntimeErrorV
|
---|
1489 | */
|
---|
1490 | DECLINLINE(int) RT_IPRT_FORMAT_ATTR(4, 0) PDMDrvHlpVMSetRuntimeErrorV(PPDMDRVINS pDrvIns, uint32_t fFlags,
|
---|
1491 | const char *pszErrorId, const char *pszFormat, va_list va)
|
---|
1492 | {
|
---|
1493 | return pDrvIns->CTX_SUFF(pHlp)->pfnVMSetRuntimeErrorV(pDrvIns, fFlags, pszErrorId, pszFormat, va);
|
---|
1494 | }
|
---|
1495 |
|
---|
1496 |
|
---|
1497 |
|
---|
1498 | /** @def PDMDRV_ASSERT_EMT
|
---|
1499 | * Assert that the current thread is the emulation thread.
|
---|
1500 | */
|
---|
1501 | #ifdef VBOX_STRICT
|
---|
1502 | # define PDMDRV_ASSERT_EMT(pDrvIns) pDrvIns->CTX_SUFF(pHlp)->pfnAssertEMT(pDrvIns, __FILE__, __LINE__, __FUNCTION__)
|
---|
1503 | #else
|
---|
1504 | # define PDMDRV_ASSERT_EMT(pDrvIns) do { } while (0)
|
---|
1505 | #endif
|
---|
1506 |
|
---|
1507 | /** @def PDMDRV_ASSERT_OTHER
|
---|
1508 | * Assert that the current thread is NOT the emulation thread.
|
---|
1509 | */
|
---|
1510 | #ifdef VBOX_STRICT
|
---|
1511 | # define PDMDRV_ASSERT_OTHER(pDrvIns) pDrvIns->CTX_SUFF(pHlp)->pfnAssertOther(pDrvIns, __FILE__, __LINE__, __FUNCTION__)
|
---|
1512 | #else
|
---|
1513 | # define PDMDRV_ASSERT_OTHER(pDrvIns) do { } while (0)
|
---|
1514 | #endif
|
---|
1515 |
|
---|
1516 |
|
---|
1517 | #ifdef IN_RING3
|
---|
1518 |
|
---|
1519 | /**
|
---|
1520 | * @copydoc PDMDRVHLPR3::pfnAttach
|
---|
1521 | */
|
---|
1522 | DECLINLINE(int) PDMDrvHlpAttach(PPDMDRVINS pDrvIns, uint32_t fFlags, PPDMIBASE *ppBaseInterface)
|
---|
1523 | {
|
---|
1524 | return pDrvIns->pHlpR3->pfnAttach(pDrvIns, fFlags, ppBaseInterface);
|
---|
1525 | }
|
---|
1526 |
|
---|
1527 | /**
|
---|
1528 | * Check that there is no driver below the us that we should attach to.
|
---|
1529 | *
|
---|
1530 | * @returns VERR_PDM_NO_ATTACHED_DRIVER if there is no driver.
|
---|
1531 | * @param pDrvIns The driver instance.
|
---|
1532 | */
|
---|
1533 | DECLINLINE(int) PDMDrvHlpNoAttach(PPDMDRVINS pDrvIns)
|
---|
1534 | {
|
---|
1535 | return pDrvIns->pHlpR3->pfnAttach(pDrvIns, 0, NULL);
|
---|
1536 | }
|
---|
1537 |
|
---|
1538 | /**
|
---|
1539 | * @copydoc PDMDRVHLPR3::pfnDetach
|
---|
1540 | */
|
---|
1541 | DECLINLINE(int) PDMDrvHlpDetach(PPDMDRVINS pDrvIns, uint32_t fFlags)
|
---|
1542 | {
|
---|
1543 | return pDrvIns->pHlpR3->pfnDetach(pDrvIns, fFlags);
|
---|
1544 | }
|
---|
1545 |
|
---|
1546 | /**
|
---|
1547 | * @copydoc PDMDRVHLPR3::pfnDetachSelf
|
---|
1548 | */
|
---|
1549 | DECLINLINE(int) PDMDrvHlpDetachSelf(PPDMDRVINS pDrvIns, uint32_t fFlags)
|
---|
1550 | {
|
---|
1551 | return pDrvIns->pHlpR3->pfnDetachSelf(pDrvIns, fFlags);
|
---|
1552 | }
|
---|
1553 |
|
---|
1554 | /**
|
---|
1555 | * @copydoc PDMDRVHLPR3::pfnMountPrepare
|
---|
1556 | */
|
---|
1557 | DECLINLINE(int) PDMDrvHlpMountPrepare(PPDMDRVINS pDrvIns, const char *pszFilename, const char *pszCoreDriver)
|
---|
1558 | {
|
---|
1559 | return pDrvIns->pHlpR3->pfnMountPrepare(pDrvIns, pszFilename, pszCoreDriver);
|
---|
1560 | }
|
---|
1561 |
|
---|
1562 | /**
|
---|
1563 | * @copydoc PDMDRVHLPR3::pfnVMState
|
---|
1564 | */
|
---|
1565 | DECLINLINE(VMSTATE) PDMDrvHlpVMState(PPDMDRVINS pDrvIns)
|
---|
1566 | {
|
---|
1567 | return pDrvIns->CTX_SUFF(pHlp)->pfnVMState(pDrvIns);
|
---|
1568 | }
|
---|
1569 |
|
---|
1570 | /**
|
---|
1571 | * @copydoc PDMDRVHLPR3::pfnVMTeleportedAndNotFullyResumedYet
|
---|
1572 | */
|
---|
1573 | DECLINLINE(bool) PDMDrvHlpVMTeleportedAndNotFullyResumedYet(PPDMDRVINS pDrvIns)
|
---|
1574 | {
|
---|
1575 | return pDrvIns->pHlpR3->pfnVMTeleportedAndNotFullyResumedYet(pDrvIns);
|
---|
1576 | }
|
---|
1577 |
|
---|
1578 | /**
|
---|
1579 | * @copydoc PDMDRVHLPR3::pfnGetSupDrvSession
|
---|
1580 | */
|
---|
1581 | DECLINLINE(PSUPDRVSESSION) PDMDrvHlpGetSupDrvSession(PPDMDRVINS pDrvIns)
|
---|
1582 | {
|
---|
1583 | return pDrvIns->pHlpR3->pfnGetSupDrvSession(pDrvIns);
|
---|
1584 | }
|
---|
1585 |
|
---|
1586 | /**
|
---|
1587 | * @copydoc PDMDRVHLPR3::pfnQueueCreate
|
---|
1588 | */
|
---|
1589 | DECLINLINE(int) PDMDrvHlpQueueCreate(PPDMDRVINS pDrvIns, uint32_t cbItem, uint32_t cItems, uint32_t cMilliesInterval,
|
---|
1590 | PFNPDMQUEUEDRV pfnCallback, const char *pszName, PPDMQUEUE *ppQueue)
|
---|
1591 | {
|
---|
1592 | return pDrvIns->pHlpR3->pfnQueueCreate(pDrvIns, cbItem, cItems, cMilliesInterval, pfnCallback, pszName, ppQueue);
|
---|
1593 | }
|
---|
1594 |
|
---|
1595 | /**
|
---|
1596 | * @copydoc PDMDRVHLPR3::pfnTMGetVirtualFreq
|
---|
1597 | */
|
---|
1598 | DECLINLINE(uint64_t) PDMDrvHlpTMGetVirtualFreq(PPDMDRVINS pDrvIns)
|
---|
1599 | {
|
---|
1600 | return pDrvIns->pHlpR3->pfnTMGetVirtualFreq(pDrvIns);
|
---|
1601 | }
|
---|
1602 |
|
---|
1603 | /**
|
---|
1604 | * @copydoc PDMDRVHLPR3::pfnTMGetVirtualTime
|
---|
1605 | */
|
---|
1606 | DECLINLINE(uint64_t) PDMDrvHlpTMGetVirtualTime(PPDMDRVINS pDrvIns)
|
---|
1607 | {
|
---|
1608 | return pDrvIns->pHlpR3->pfnTMGetVirtualTime(pDrvIns);
|
---|
1609 | }
|
---|
1610 |
|
---|
1611 | /**
|
---|
1612 | * @copydoc PDMDRVHLPR3::pfnTimerCreate
|
---|
1613 | */
|
---|
1614 | DECLINLINE(int) PDMDrvHlpTMTimerCreate(PPDMDRVINS pDrvIns, TMCLOCK enmClock, PFNTMTIMERDRV pfnCallback, void *pvUser,
|
---|
1615 | uint32_t fFlags, const char *pszDesc, PTMTIMERHANDLE phTimer)
|
---|
1616 |
|
---|
1617 | {
|
---|
1618 | return pDrvIns->pHlpR3->pfnTimerCreate(pDrvIns, enmClock, pfnCallback, pvUser, fFlags, pszDesc, phTimer);
|
---|
1619 | }
|
---|
1620 |
|
---|
1621 | /**
|
---|
1622 | * @copydoc PDMDRVHLPR3::pfnTimerSetMillies
|
---|
1623 | */
|
---|
1624 | DECLINLINE(int) PDMDrvHlpTimerSetMillies(PPDMDRVINS pDrvIns, TMTIMERHANDLE hTimer, uint64_t cMilliesToNext)
|
---|
1625 |
|
---|
1626 | {
|
---|
1627 | return pDrvIns->pHlpR3->pfnTimerSetMillies(pDrvIns, hTimer, cMilliesToNext);
|
---|
1628 | }
|
---|
1629 |
|
---|
1630 | /**
|
---|
1631 | * Register a save state data unit.
|
---|
1632 | *
|
---|
1633 | * @returns VBox status.
|
---|
1634 | * @param pDrvIns Driver instance.
|
---|
1635 | * @param uVersion Data layout version number.
|
---|
1636 | * @param cbGuess The approximate amount of data in the unit.
|
---|
1637 | * Only for progress indicators.
|
---|
1638 | * @param pfnSaveExec Execute save callback, optional.
|
---|
1639 | * @param pfnLoadExec Execute load callback, optional.
|
---|
1640 | */
|
---|
1641 | DECLINLINE(int) PDMDrvHlpSSMRegister(PPDMDRVINS pDrvIns, uint32_t uVersion, size_t cbGuess,
|
---|
1642 | PFNSSMDRVSAVEEXEC pfnSaveExec, PFNSSMDRVLOADEXEC pfnLoadExec)
|
---|
1643 | {
|
---|
1644 | return pDrvIns->pHlpR3->pfnSSMRegister(pDrvIns, uVersion, cbGuess,
|
---|
1645 | NULL /*pfnLivePrep*/, NULL /*pfnLiveExec*/, NULL /*pfnLiveVote*/,
|
---|
1646 | NULL /*pfnSavePrep*/, pfnSaveExec, NULL /*pfnSaveDone*/,
|
---|
1647 | NULL /*pfnLoadPrep*/, pfnLoadExec, NULL /*pfnLoadDone*/);
|
---|
1648 | }
|
---|
1649 |
|
---|
1650 | /**
|
---|
1651 | * @copydoc PDMDRVHLPR3::pfnSSMRegister
|
---|
1652 | */
|
---|
1653 | DECLINLINE(int) PDMDrvHlpSSMRegisterEx(PPDMDRVINS pDrvIns, uint32_t uVersion, size_t cbGuess,
|
---|
1654 | PFNSSMDRVLIVEPREP pfnLivePrep, PFNSSMDRVLIVEEXEC pfnLiveExec, PFNSSMDRVLIVEVOTE pfnLiveVote,
|
---|
1655 | PFNSSMDRVSAVEPREP pfnSavePrep, PFNSSMDRVSAVEEXEC pfnSaveExec, PFNSSMDRVSAVEDONE pfnSaveDone,
|
---|
1656 | PFNSSMDRVLOADPREP pfnLoadPrep, PFNSSMDRVLOADEXEC pfnLoadExec, PFNSSMDRVLOADDONE pfnLoadDone)
|
---|
1657 | {
|
---|
1658 | return pDrvIns->pHlpR3->pfnSSMRegister(pDrvIns, uVersion, cbGuess,
|
---|
1659 | pfnLivePrep, pfnLiveExec, pfnLiveVote,
|
---|
1660 | pfnSavePrep, pfnSaveExec, pfnSaveDone,
|
---|
1661 | pfnLoadPrep, pfnLoadExec, pfnLoadDone);
|
---|
1662 | }
|
---|
1663 |
|
---|
1664 | /**
|
---|
1665 | * Register a load done callback.
|
---|
1666 | *
|
---|
1667 | * @returns VBox status.
|
---|
1668 | * @param pDrvIns Driver instance.
|
---|
1669 | * @param pfnLoadDone Done load callback, optional.
|
---|
1670 | */
|
---|
1671 | DECLINLINE(int) PDMDrvHlpSSMRegisterLoadDone(PPDMDRVINS pDrvIns, PFNSSMDRVLOADDONE pfnLoadDone)
|
---|
1672 | {
|
---|
1673 | return pDrvIns->pHlpR3->pfnSSMRegister(pDrvIns, 0 /*uVersion*/, 0 /*cbGuess*/,
|
---|
1674 | NULL /*pfnLivePrep*/, NULL /*pfnLiveExec*/, NULL /*pfnLiveVote*/,
|
---|
1675 | NULL /*pfnSavePrep*/, NULL /*pfnSaveExec*/, NULL /*pfnSaveDone*/,
|
---|
1676 | NULL /*pfnLoadPrep*/, NULL /*pfnLoadExec*/, pfnLoadDone);
|
---|
1677 | }
|
---|
1678 |
|
---|
1679 | /**
|
---|
1680 | * @copydoc PDMDRVHLPR3::pfnDBGFInfoRegister
|
---|
1681 | */
|
---|
1682 | DECLINLINE(int) PDMDrvHlpDBGFInfoRegister(PPDMDRVINS pDrvIns, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDRV pfnHandler)
|
---|
1683 | {
|
---|
1684 | return pDrvIns->pHlpR3->pfnDBGFInfoRegister(pDrvIns, pszName, pszDesc, pfnHandler);
|
---|
1685 | }
|
---|
1686 |
|
---|
1687 | /**
|
---|
1688 | * @copydoc PDMDRVHLPR3::pfnDBGFInfoRegisterArgv
|
---|
1689 | */
|
---|
1690 | DECLINLINE(int) PDMDrvHlpDBGFInfoRegisterArgv(PPDMDRVINS pDrvIns, const char *pszName, const char *pszDesc, PFNDBGFINFOARGVDRV pfnHandler)
|
---|
1691 | {
|
---|
1692 | return pDrvIns->pHlpR3->pfnDBGFInfoRegisterArgv(pDrvIns, pszName, pszDesc, pfnHandler);
|
---|
1693 | }
|
---|
1694 |
|
---|
1695 | /**
|
---|
1696 | * @copydoc PDMDRVHLPR3::pfnDBGFInfoRegister
|
---|
1697 | */
|
---|
1698 | DECLINLINE(int) PDMDrvHlpDBGFInfoDeregister(PPDMDRVINS pDrvIns, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDRV pfnHandler)
|
---|
1699 | {
|
---|
1700 | return pDrvIns->pHlpR3->pfnDBGFInfoRegister(pDrvIns, pszName, pszDesc, pfnHandler);
|
---|
1701 | }
|
---|
1702 |
|
---|
1703 | /**
|
---|
1704 | * @copydoc PDMDRVHLPR3::pfnSTAMRegister
|
---|
1705 | */
|
---|
1706 | DECLINLINE(void) PDMDrvHlpSTAMRegister(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, const char *pszName, STAMUNIT enmUnit, const char *pszDesc)
|
---|
1707 | {
|
---|
1708 | pDrvIns->pHlpR3->pfnSTAMRegister(pDrvIns, pvSample, enmType, pszName, enmUnit, pszDesc);
|
---|
1709 | }
|
---|
1710 |
|
---|
1711 | /**
|
---|
1712 | * @copydoc PDMDRVHLPR3::pfnSTAMRegisterF
|
---|
1713 | */
|
---|
1714 | DECLINLINE(void) RT_IPRT_FORMAT_ATTR(7, 8) PDMDrvHlpSTAMRegisterF(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType,
|
---|
1715 | STAMVISIBILITY enmVisibility, STAMUNIT enmUnit,
|
---|
1716 | const char *pszDesc, const char *pszName, ...)
|
---|
1717 | {
|
---|
1718 | va_list va;
|
---|
1719 | va_start(va, pszName);
|
---|
1720 | pDrvIns->pHlpR3->pfnSTAMRegisterV(pDrvIns, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, va);
|
---|
1721 | va_end(va);
|
---|
1722 | }
|
---|
1723 |
|
---|
1724 | /**
|
---|
1725 | * Convenience wrapper that registers counter which is always visible.
|
---|
1726 | *
|
---|
1727 | * @param pDrvIns The driver instance.
|
---|
1728 | * @param pCounter Pointer to the counter variable.
|
---|
1729 | * @param pszName The name of the sample. This is prefixed with
|
---|
1730 | * "/Drivers/<drivername>-<instance no>/".
|
---|
1731 | * @param enmUnit The unit.
|
---|
1732 | * @param pszDesc The description.
|
---|
1733 | */
|
---|
1734 | DECLINLINE(void) PDMDrvHlpSTAMRegCounterEx(PPDMDRVINS pDrvIns, PSTAMCOUNTER pCounter, const char *pszName, STAMUNIT enmUnit, const char *pszDesc)
|
---|
1735 | {
|
---|
1736 | pDrvIns->pHlpR3->pfnSTAMRegisterF(pDrvIns, pCounter, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, enmUnit, pszDesc,
|
---|
1737 | "/Drivers/%s-%u/%s", pDrvIns->pReg->szName, pDrvIns->iInstance, pszName);
|
---|
1738 | }
|
---|
1739 |
|
---|
1740 | /**
|
---|
1741 | * Convenience wrapper that registers counter which is always visible and has
|
---|
1742 | * the STAMUNIT_COUNT unit.
|
---|
1743 | *
|
---|
1744 | * @param pDrvIns The driver instance.
|
---|
1745 | * @param pCounter Pointer to the counter variable.
|
---|
1746 | * @param pszName The name of the sample. This is prefixed with
|
---|
1747 | * "/Drivers/<drivername>-<instance no>/".
|
---|
1748 | * @param pszDesc The description.
|
---|
1749 | */
|
---|
1750 | DECLINLINE(void) PDMDrvHlpSTAMRegCounter(PPDMDRVINS pDrvIns, PSTAMCOUNTER pCounter, const char *pszName, const char *pszDesc)
|
---|
1751 | {
|
---|
1752 | PDMDrvHlpSTAMRegCounterEx(pDrvIns, pCounter, pszName, STAMUNIT_COUNT, pszDesc);
|
---|
1753 | }
|
---|
1754 |
|
---|
1755 | /**
|
---|
1756 | * Convenience wrapper that registers profiling sample which is always visible.
|
---|
1757 | *
|
---|
1758 | * @param pDrvIns The driver instance.
|
---|
1759 | * @param pProfile Pointer to the profiling variable.
|
---|
1760 | * @param pszName The name of the sample. This is prefixed with
|
---|
1761 | * "/Drivers/<drivername>-<instance no>/".
|
---|
1762 | * @param enmUnit The unit.
|
---|
1763 | * @param pszDesc The description.
|
---|
1764 | */
|
---|
1765 | DECLINLINE(void) PDMDrvHlpSTAMRegProfileEx(PPDMDRVINS pDrvIns, PSTAMPROFILE pProfile, const char *pszName, STAMUNIT enmUnit, const char *pszDesc)
|
---|
1766 | {
|
---|
1767 | pDrvIns->pHlpR3->pfnSTAMRegisterF(pDrvIns, pProfile, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, enmUnit, pszDesc,
|
---|
1768 | "/Drivers/%s-%u/%s", pDrvIns->pReg->szName, pDrvIns->iInstance, pszName);
|
---|
1769 | }
|
---|
1770 |
|
---|
1771 | /**
|
---|
1772 | * Convenience wrapper that registers profiling sample which is always visible
|
---|
1773 | * hand counts ticks per call (STAMUNIT_TICKS_PER_CALL).
|
---|
1774 | *
|
---|
1775 | * @param pDrvIns The driver instance.
|
---|
1776 | * @param pProfile Pointer to the profiling variable.
|
---|
1777 | * @param pszName The name of the sample. This is prefixed with
|
---|
1778 | * "/Drivers/<drivername>-<instance no>/".
|
---|
1779 | * @param pszDesc The description.
|
---|
1780 | */
|
---|
1781 | DECLINLINE(void) PDMDrvHlpSTAMRegProfile(PPDMDRVINS pDrvIns, PSTAMPROFILE pProfile, const char *pszName, const char *pszDesc)
|
---|
1782 | {
|
---|
1783 | PDMDrvHlpSTAMRegProfileEx(pDrvIns, pProfile, pszName, STAMUNIT_TICKS_PER_CALL, pszDesc);
|
---|
1784 | }
|
---|
1785 |
|
---|
1786 | /**
|
---|
1787 | * Convenience wrapper that registers an advanced profiling sample which is
|
---|
1788 | * always visible.
|
---|
1789 | *
|
---|
1790 | * @param pDrvIns The driver instance.
|
---|
1791 | * @param pProfile Pointer to the profiling variable.
|
---|
1792 | * @param enmUnit The unit.
|
---|
1793 | * @param pszName The name of the sample. This is prefixed with
|
---|
1794 | * "/Drivers/<drivername>-<instance no>/".
|
---|
1795 | * @param pszDesc The description.
|
---|
1796 | */
|
---|
1797 | DECLINLINE(void) PDMDrvHlpSTAMRegProfileAdvEx(PPDMDRVINS pDrvIns, PSTAMPROFILEADV pProfile, const char *pszName, STAMUNIT enmUnit, const char *pszDesc)
|
---|
1798 | {
|
---|
1799 | pDrvIns->pHlpR3->pfnSTAMRegisterF(pDrvIns, pProfile, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, enmUnit, pszDesc,
|
---|
1800 | "/Drivers/%s-%u/%s", pDrvIns->pReg->szName, pDrvIns->iInstance, pszName);
|
---|
1801 | }
|
---|
1802 |
|
---|
1803 | /**
|
---|
1804 | * Convenience wrapper that registers an advanced profiling sample which is
|
---|
1805 | * always visible.
|
---|
1806 | *
|
---|
1807 | * @param pDrvIns The driver instance.
|
---|
1808 | * @param pProfile Pointer to the profiling variable.
|
---|
1809 | * @param pszName The name of the sample. This is prefixed with
|
---|
1810 | * "/Drivers/<drivername>-<instance no>/".
|
---|
1811 | * @param pszDesc The description.
|
---|
1812 | */
|
---|
1813 | DECLINLINE(void) PDMDrvHlpSTAMRegProfileAdv(PPDMDRVINS pDrvIns, PSTAMPROFILEADV pProfile, const char *pszName, const char *pszDesc)
|
---|
1814 | {
|
---|
1815 | PDMDrvHlpSTAMRegProfileAdvEx(pDrvIns, pProfile, pszName, STAMUNIT_TICKS_PER_CALL, pszDesc);
|
---|
1816 | }
|
---|
1817 |
|
---|
1818 | /**
|
---|
1819 | * @copydoc PDMDRVHLPR3::pfnSTAMDeregister
|
---|
1820 | */
|
---|
1821 | DECLINLINE(int) PDMDrvHlpSTAMDeregister(PPDMDRVINS pDrvIns, void *pvSample)
|
---|
1822 | {
|
---|
1823 | return pDrvIns->pHlpR3->pfnSTAMDeregister(pDrvIns, pvSample);
|
---|
1824 | }
|
---|
1825 |
|
---|
1826 | /**
|
---|
1827 | * @copydoc PDMDRVHLPR3::pfnSTAMDeregisterByPrefix
|
---|
1828 | */
|
---|
1829 | DECLINLINE(int) PDMDrvHlpSTAMDeregisterByPrefix(PPDMDRVINS pDrvIns, const char *pszPrefix)
|
---|
1830 | {
|
---|
1831 | return pDrvIns->pHlpR3->pfnSTAMDeregisterByPrefix(pDrvIns, pszPrefix);
|
---|
1832 | }
|
---|
1833 |
|
---|
1834 | /**
|
---|
1835 | * @copydoc PDMDRVHLPR3::pfnSUPCallVMMR0Ex
|
---|
1836 | */
|
---|
1837 | DECLINLINE(int) PDMDrvHlpSUPCallVMMR0Ex(PPDMDRVINS pDrvIns, unsigned uOperation, void *pvArg, unsigned cbArg)
|
---|
1838 | {
|
---|
1839 | return pDrvIns->pHlpR3->pfnSUPCallVMMR0Ex(pDrvIns, uOperation, pvArg, cbArg);
|
---|
1840 | }
|
---|
1841 |
|
---|
1842 | /**
|
---|
1843 | * @copydoc PDMDRVHLPR3::pfnUSBRegisterHub
|
---|
1844 | */
|
---|
1845 | DECLINLINE(int) PDMDrvHlpUSBRegisterHub(PPDMDRVINS pDrvIns, uint32_t fVersions, uint32_t cPorts, PCPDMUSBHUBREG pUsbHubReg, PPCPDMUSBHUBHLP ppUsbHubHlp)
|
---|
1846 | {
|
---|
1847 | return pDrvIns->pHlpR3->pfnUSBRegisterHub(pDrvIns, fVersions, cPorts, pUsbHubReg, ppUsbHubHlp);
|
---|
1848 | }
|
---|
1849 |
|
---|
1850 | /**
|
---|
1851 | * @copydoc PDMDRVHLPR3::pfnSetAsyncNotification
|
---|
1852 | */
|
---|
1853 | DECLINLINE(int) PDMDrvHlpSetAsyncNotification(PPDMDRVINS pDrvIns, PFNPDMDRVASYNCNOTIFY pfnAsyncNotify)
|
---|
1854 | {
|
---|
1855 | return pDrvIns->pHlpR3->pfnSetAsyncNotification(pDrvIns, pfnAsyncNotify);
|
---|
1856 | }
|
---|
1857 |
|
---|
1858 | /**
|
---|
1859 | * @copydoc PDMDRVHLPR3::pfnAsyncNotificationCompleted
|
---|
1860 | */
|
---|
1861 | DECLINLINE(void) PDMDrvHlpAsyncNotificationCompleted(PPDMDRVINS pDrvIns)
|
---|
1862 | {
|
---|
1863 | pDrvIns->pHlpR3->pfnAsyncNotificationCompleted(pDrvIns);
|
---|
1864 | }
|
---|
1865 |
|
---|
1866 | /**
|
---|
1867 | * @copydoc PDMDRVHLPR3::pfnThreadCreate
|
---|
1868 | */
|
---|
1869 | DECLINLINE(int) PDMDrvHlpThreadCreate(PPDMDRVINS pDrvIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDRV pfnThread,
|
---|
1870 | PFNPDMTHREADWAKEUPDRV pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName)
|
---|
1871 | {
|
---|
1872 | return pDrvIns->pHlpR3->pfnThreadCreate(pDrvIns, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName);
|
---|
1873 | }
|
---|
1874 |
|
---|
1875 | # ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
|
---|
1876 | /**
|
---|
1877 | * @copydoc PDMDRVHLPR3::pfnAsyncCompletionTemplateCreate
|
---|
1878 | */
|
---|
1879 | DECLINLINE(int) PDMDrvHlpAsyncCompletionTemplateCreate(PPDMDRVINS pDrvIns, PPPDMASYNCCOMPLETIONTEMPLATE ppTemplate,
|
---|
1880 | PFNPDMASYNCCOMPLETEDRV pfnCompleted, void *pvTemplateUser, const char *pszDesc)
|
---|
1881 | {
|
---|
1882 | return pDrvIns->pHlpR3->pfnAsyncCompletionTemplateCreate(pDrvIns, ppTemplate, pfnCompleted, pvTemplateUser, pszDesc);
|
---|
1883 | }
|
---|
1884 | # endif
|
---|
1885 |
|
---|
1886 | #endif /* IN_RING3 */
|
---|
1887 |
|
---|
1888 | #ifdef VBOX_WITH_NETSHAPER
|
---|
1889 | # ifdef IN_RING3
|
---|
1890 |
|
---|
1891 | /**
|
---|
1892 | * @copydoc PDMDRVHLPR3::pfnNetShaperAttach
|
---|
1893 | */
|
---|
1894 | DECLINLINE(int) PDMDrvHlpNetShaperAttach(PPDMDRVINS pDrvIns, const char *pcszBwGroup, PPDMNSFILTER pFilter)
|
---|
1895 | {
|
---|
1896 | return pDrvIns->pHlpR3->pfnNetShaperAttach(pDrvIns, pcszBwGroup, pFilter);
|
---|
1897 | }
|
---|
1898 |
|
---|
1899 | /**
|
---|
1900 | * @copydoc PDMDRVHLPR3::pfnNetShaperDetach
|
---|
1901 | */
|
---|
1902 | DECLINLINE(int) PDMDrvHlpNetShaperDetach(PPDMDRVINS pDrvIns, PPDMNSFILTER pFilter)
|
---|
1903 | {
|
---|
1904 | return pDrvIns->pHlpR3->pfnNetShaperDetach(pDrvIns, pFilter);
|
---|
1905 | }
|
---|
1906 |
|
---|
1907 | # endif /* IN_RING3 */
|
---|
1908 |
|
---|
1909 | /**
|
---|
1910 | * @copydoc PDMDRVHLPR3::pfnNetShaperAllocateBandwidth
|
---|
1911 | */
|
---|
1912 | DECLINLINE(bool) PDMDrvHlpNetShaperAllocateBandwidth(PPDMDRVINS pDrvIns, PPDMNSFILTER pFilter, size_t cbTransfer)
|
---|
1913 | {
|
---|
1914 | return pDrvIns->CTX_SUFF(pHlp)->pfnNetShaperAllocateBandwidth(pDrvIns, pFilter, cbTransfer);
|
---|
1915 | }
|
---|
1916 |
|
---|
1917 | #endif /* VBOX_WITH_NETSHAPER*/
|
---|
1918 |
|
---|
1919 | #ifdef IN_RING3
|
---|
1920 | /**
|
---|
1921 | * @copydoc PDMDRVHLPR3::pfnCritSectInit
|
---|
1922 | */
|
---|
1923 | DECLINLINE(int) PDMDrvHlpCritSectInit(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect, RT_SRC_POS_DECL, const char *pszName)
|
---|
1924 | {
|
---|
1925 | return pDrvIns->pHlpR3->pfnCritSectInit(pDrvIns, pCritSect, RT_SRC_POS_ARGS, pszName);
|
---|
1926 | }
|
---|
1927 | #endif /* IN_RING3 */
|
---|
1928 |
|
---|
1929 | /**
|
---|
1930 | * @copydoc PDMCritSectEnter
|
---|
1931 | * @param pDrvIns The device instance.
|
---|
1932 | */
|
---|
1933 | DECLINLINE(int) PDMDrvHlpCritSectEnter(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect, int rcBusy)
|
---|
1934 | {
|
---|
1935 | return pDrvIns->CTX_SUFF(pHlp)->pfnCritSectEnter(pDrvIns, pCritSect, rcBusy);
|
---|
1936 | }
|
---|
1937 |
|
---|
1938 | /**
|
---|
1939 | * @copydoc PDMCritSectEnterDebug
|
---|
1940 | * @param pDrvIns The device instance.
|
---|
1941 | */
|
---|
1942 | DECLINLINE(int) PDMDrvHlpCritSectEnterDebug(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL)
|
---|
1943 | {
|
---|
1944 | return pDrvIns->CTX_SUFF(pHlp)->pfnCritSectEnterDebug(pDrvIns, pCritSect, rcBusy, uId, RT_SRC_POS_ARGS);
|
---|
1945 | }
|
---|
1946 |
|
---|
1947 | /**
|
---|
1948 | * @copydoc PDMCritSectTryEnter
|
---|
1949 | * @param pDrvIns The device instance.
|
---|
1950 | */
|
---|
1951 | DECLINLINE(int) PDMDrvHlpCritSectTryEnter(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect)
|
---|
1952 | {
|
---|
1953 | return pDrvIns->CTX_SUFF(pHlp)->pfnCritSectTryEnter(pDrvIns, pCritSect);
|
---|
1954 | }
|
---|
1955 |
|
---|
1956 | /**
|
---|
1957 | * @copydoc PDMCritSectTryEnterDebug
|
---|
1958 | * @param pDrvIns The device instance.
|
---|
1959 | */
|
---|
1960 | DECLINLINE(int) PDMDrvHlpCritSectTryEnterDebug(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect, RTHCUINTPTR uId, RT_SRC_POS_DECL)
|
---|
1961 | {
|
---|
1962 | return pDrvIns->CTX_SUFF(pHlp)->pfnCritSectTryEnterDebug(pDrvIns, pCritSect, uId, RT_SRC_POS_ARGS);
|
---|
1963 | }
|
---|
1964 |
|
---|
1965 | /**
|
---|
1966 | * @copydoc PDMCritSectLeave
|
---|
1967 | * @param pDrvIns The device instance.
|
---|
1968 | */
|
---|
1969 | DECLINLINE(int) PDMDrvHlpCritSectLeave(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect)
|
---|
1970 | {
|
---|
1971 | return pDrvIns->CTX_SUFF(pHlp)->pfnCritSectLeave(pDrvIns, pCritSect);
|
---|
1972 | }
|
---|
1973 |
|
---|
1974 | /**
|
---|
1975 | * @copydoc PDMCritSectIsOwner
|
---|
1976 | * @param pDrvIns The device instance.
|
---|
1977 | */
|
---|
1978 | DECLINLINE(bool) PDMDrvHlpCritSectIsOwner(PPDMDRVINS pDrvIns, PCPDMCRITSECT pCritSect)
|
---|
1979 | {
|
---|
1980 | return pDrvIns->CTX_SUFF(pHlp)->pfnCritSectIsOwner(pDrvIns, pCritSect);
|
---|
1981 | }
|
---|
1982 |
|
---|
1983 | /**
|
---|
1984 | * @copydoc PDMCritSectIsInitialized
|
---|
1985 | * @param pDrvIns The device instance.
|
---|
1986 | */
|
---|
1987 | DECLINLINE(bool) PDMDrvHlpCritSectIsInitialized(PPDMDRVINS pDrvIns, PCPDMCRITSECT pCritSect)
|
---|
1988 | {
|
---|
1989 | return pDrvIns->CTX_SUFF(pHlp)->pfnCritSectIsInitialized(pDrvIns, pCritSect);
|
---|
1990 | }
|
---|
1991 |
|
---|
1992 | /**
|
---|
1993 | * @copydoc PDMCritSectHasWaiters
|
---|
1994 | * @param pDrvIns The device instance.
|
---|
1995 | */
|
---|
1996 | DECLINLINE(bool) PDMDrvHlpCritSectHasWaiters(PPDMDRVINS pDrvIns, PCPDMCRITSECT pCritSect)
|
---|
1997 | {
|
---|
1998 | return pDrvIns->CTX_SUFF(pHlp)->pfnCritSectHasWaiters(pDrvIns, pCritSect);
|
---|
1999 | }
|
---|
2000 |
|
---|
2001 | /**
|
---|
2002 | * @copydoc PDMCritSectGetRecursion
|
---|
2003 | * @param pDrvIns The device instance.
|
---|
2004 | */
|
---|
2005 | DECLINLINE(uint32_t) PDMDrvHlpCritSectGetRecursion(PPDMDRVINS pDrvIns, PCPDMCRITSECT pCritSect)
|
---|
2006 | {
|
---|
2007 | return pDrvIns->CTX_SUFF(pHlp)->pfnCritSectGetRecursion(pDrvIns, pCritSect);
|
---|
2008 | }
|
---|
2009 |
|
---|
2010 | #if defined(IN_RING3) || defined(IN_RING0)
|
---|
2011 | /**
|
---|
2012 | * @copydoc PDMHCCritSectScheduleExitEvent
|
---|
2013 | * @param pDrvIns The device instance.
|
---|
2014 | */
|
---|
2015 | DECLINLINE(int) PDMDrvHlpCritSectScheduleExitEvent(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect, SUPSEMEVENT hEventToSignal)
|
---|
2016 | {
|
---|
2017 | return pDrvIns->CTX_SUFF(pHlp)->pfnCritSectScheduleExitEvent(pDrvIns, pCritSect, hEventToSignal);
|
---|
2018 | }
|
---|
2019 | #endif
|
---|
2020 |
|
---|
2021 | /* Strict build: Remap the two enter calls to the debug versions. */
|
---|
2022 | #ifdef VBOX_STRICT
|
---|
2023 | # ifdef IPRT_INCLUDED_asm_h
|
---|
2024 | # define PDMDrvHlpCritSectEnter(pDrvIns, pCritSect, rcBusy) PDMDrvHlpCritSectEnterDebug((pDrvIns), (pCritSect), (rcBusy), (uintptr_t)ASMReturnAddress(), RT_SRC_POS)
|
---|
2025 | # define PDMDrvHlpCritSectTryEnter(pDrvIns, pCritSect) PDMDrvHlpCritSectTryEnterDebug((pDrvIns), (pCritSect), (uintptr_t)ASMReturnAddress(), RT_SRC_POS)
|
---|
2026 | # else
|
---|
2027 | # define PDMDrvHlpCritSectEnter(pDrvIns, pCritSect, rcBusy) PDMDrvHlpCritSectEnterDebug((pDrvIns), (pCritSect), (rcBusy), 0, RT_SRC_POS)
|
---|
2028 | # define PDMDrvHlpCritSectTryEnter(pDrvIns, pCritSect) PDMDrvHlpCritSectTryEnterDebug((pDrvIns), (pCritSect), 0, RT_SRC_POS)
|
---|
2029 | # endif
|
---|
2030 | #endif
|
---|
2031 |
|
---|
2032 | #if defined(IN_RING3) || defined(DOXYGEN_RUNNING)
|
---|
2033 |
|
---|
2034 | /**
|
---|
2035 | * @copydoc PDMR3CritSectDelete
|
---|
2036 | * @param pDrvIns The device instance.
|
---|
2037 | */
|
---|
2038 | DECLINLINE(int) PDMDrvHlpCritSectDelete(PPDMDRVINS pDrvIns, PPDMCRITSECT pCritSect)
|
---|
2039 | {
|
---|
2040 | return pDrvIns->pHlpR3->pfnCritSectDelete(pDrvIns, pCritSect);
|
---|
2041 | }
|
---|
2042 |
|
---|
2043 | /**
|
---|
2044 | * @copydoc PDMDRVHLPR3::pfnCallR0
|
---|
2045 | */
|
---|
2046 | DECLINLINE(int) PDMDrvHlpCallR0(PPDMDRVINS pDrvIns, uint32_t uOperation, uint64_t u64Arg)
|
---|
2047 | {
|
---|
2048 | return pDrvIns->pHlpR3->pfnCallR0(pDrvIns, uOperation, u64Arg);
|
---|
2049 | }
|
---|
2050 |
|
---|
2051 | /**
|
---|
2052 | * @copydoc PDMDRVHLPR3::pfnBlkCacheRetain
|
---|
2053 | */
|
---|
2054 | DECLINLINE(int) PDMDrvHlpBlkCacheRetain(PPDMDRVINS pDrvIns, PPPDMBLKCACHE ppBlkCache,
|
---|
2055 | PFNPDMBLKCACHEXFERCOMPLETEDRV pfnXferComplete,
|
---|
2056 | PFNPDMBLKCACHEXFERENQUEUEDRV pfnXferEnqueue,
|
---|
2057 | PFNPDMBLKCACHEXFERENQUEUEDISCARDDRV pfnXferEnqueueDiscard,
|
---|
2058 | const char *pcszId)
|
---|
2059 | {
|
---|
2060 | return pDrvIns->pHlpR3->pfnBlkCacheRetain(pDrvIns, ppBlkCache, pfnXferComplete, pfnXferEnqueue, pfnXferEnqueueDiscard, pcszId);
|
---|
2061 | }
|
---|
2062 |
|
---|
2063 | /**
|
---|
2064 | * @copydoc PDMDRVHLPR3::pfnVMGetSuspendReason
|
---|
2065 | */
|
---|
2066 | DECLINLINE(VMSUSPENDREASON) PDMDrvHlpVMGetSuspendReason(PPDMDRVINS pDrvIns)
|
---|
2067 | {
|
---|
2068 | return pDrvIns->pHlpR3->pfnVMGetSuspendReason(pDrvIns);
|
---|
2069 | }
|
---|
2070 |
|
---|
2071 | /**
|
---|
2072 | * @copydoc PDMDRVHLPR3::pfnVMGetResumeReason
|
---|
2073 | */
|
---|
2074 | DECLINLINE(VMRESUMEREASON) PDMDrvHlpVMGetResumeReason(PPDMDRVINS pDrvIns)
|
---|
2075 | {
|
---|
2076 | return pDrvIns->pHlpR3->pfnVMGetResumeReason(pDrvIns);
|
---|
2077 | }
|
---|
2078 |
|
---|
2079 | /**
|
---|
2080 | * @copydoc PDMDRVHLPR3::pfnQueryGenericUserObject
|
---|
2081 | */
|
---|
2082 | DECLINLINE(void *) PDMDrvHlpQueryGenericUserObject(PPDMDRVINS pDrvIns, PCRTUUID pUuid)
|
---|
2083 | {
|
---|
2084 | return pDrvIns->pHlpR3->pfnQueryGenericUserObject(pDrvIns, pUuid);
|
---|
2085 | }
|
---|
2086 |
|
---|
2087 |
|
---|
2088 | /** Pointer to callbacks provided to the VBoxDriverRegister() call. */
|
---|
2089 | typedef struct PDMDRVREGCB *PPDMDRVREGCB;
|
---|
2090 | /** Pointer to const callbacks provided to the VBoxDriverRegister() call. */
|
---|
2091 | typedef const struct PDMDRVREGCB *PCPDMDRVREGCB;
|
---|
2092 |
|
---|
2093 | /**
|
---|
2094 | * Callbacks for VBoxDriverRegister().
|
---|
2095 | */
|
---|
2096 | typedef struct PDMDRVREGCB
|
---|
2097 | {
|
---|
2098 | /** Interface version.
|
---|
2099 | * This is set to PDM_DRVREG_CB_VERSION. */
|
---|
2100 | uint32_t u32Version;
|
---|
2101 |
|
---|
2102 | /**
|
---|
2103 | * Registers a driver with the current VM instance.
|
---|
2104 | *
|
---|
2105 | * @returns VBox status code.
|
---|
2106 | * @param pCallbacks Pointer to the callback table.
|
---|
2107 | * @param pReg Pointer to the driver registration record.
|
---|
2108 | * This data must be permanent and readonly.
|
---|
2109 | */
|
---|
2110 | DECLR3CALLBACKMEMBER(int, pfnRegister,(PCPDMDRVREGCB pCallbacks, PCPDMDRVREG pReg));
|
---|
2111 | } PDMDRVREGCB;
|
---|
2112 |
|
---|
2113 | /** Current version of the PDMDRVREGCB structure. */
|
---|
2114 | #define PDM_DRVREG_CB_VERSION PDM_VERSION_MAKE(0xf0fa, 1, 0)
|
---|
2115 |
|
---|
2116 |
|
---|
2117 | /**
|
---|
2118 | * The VBoxDriverRegister callback function.
|
---|
2119 | *
|
---|
2120 | * PDM will invoke this function after loading a driver module and letting
|
---|
2121 | * the module decide which drivers to register and how to handle conflicts.
|
---|
2122 | *
|
---|
2123 | * @returns VBox status code.
|
---|
2124 | * @param pCallbacks Pointer to the callback table.
|
---|
2125 | * @param u32Version VBox version number.
|
---|
2126 | */
|
---|
2127 | typedef DECLCALLBACKTYPE(int, FNPDMVBOXDRIVERSREGISTER,(PCPDMDRVREGCB pCallbacks, uint32_t u32Version));
|
---|
2128 |
|
---|
2129 | VMMR3DECL(int) PDMR3DrvStaticRegistration(PVM pVM, FNPDMVBOXDRIVERSREGISTER pfnCallback);
|
---|
2130 |
|
---|
2131 | #endif /* IN_RING3 */
|
---|
2132 |
|
---|
2133 | /** @} */
|
---|
2134 |
|
---|
2135 | RT_C_DECLS_END
|
---|
2136 |
|
---|
2137 | #endif /* !VBOX_INCLUDED_vmm_pdmdrv_h */
|
---|