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