1 | /** @file
|
---|
2 | * PDM - Pluggable Device Manager, USB Devices.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox base platform packages, as
|
---|
9 | * available from https://www.virtualbox.org.
|
---|
10 | *
|
---|
11 | * This program is free software; you can redistribute it and/or
|
---|
12 | * modify it under the terms of the GNU General Public License
|
---|
13 | * as published by the Free Software Foundation, in version 3 of the
|
---|
14 | * License.
|
---|
15 | *
|
---|
16 | * This program is distributed in the hope that it will be useful, but
|
---|
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | * General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU General Public License
|
---|
22 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
23 | *
|
---|
24 | * The contents of this file may alternatively be used under the terms
|
---|
25 | * of the Common Development and Distribution License Version 1.0
|
---|
26 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
27 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
28 | * CDDL are applicable instead of those of the GPL.
|
---|
29 | *
|
---|
30 | * You may elect to license modified versions of this file under the
|
---|
31 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
32 | *
|
---|
33 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
34 | */
|
---|
35 |
|
---|
36 | #ifndef VBOX_INCLUDED_vmm_pdmusb_h
|
---|
37 | #define VBOX_INCLUDED_vmm_pdmusb_h
|
---|
38 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
39 | # pragma once
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #include <VBox/vmm/pdmqueue.h>
|
---|
43 | #include <VBox/vmm/pdmcritsect.h>
|
---|
44 | #include <VBox/vmm/pdmthread.h>
|
---|
45 | #include <VBox/vmm/pdmifs.h>
|
---|
46 | #include <VBox/vmm/pdmins.h>
|
---|
47 | #include <VBox/vmm/pdmcommon.h>
|
---|
48 | #include <VBox/vmm/tm.h>
|
---|
49 | #include <VBox/vmm/ssm.h>
|
---|
50 | #include <VBox/vmm/cfgm.h>
|
---|
51 | #include <VBox/vmm/dbgf.h>
|
---|
52 | #include <VBox/vmm/mm.h>
|
---|
53 | #include <VBox/vusb.h>
|
---|
54 | #include <iprt/errcore.h>
|
---|
55 | #include <iprt/stdarg.h>
|
---|
56 |
|
---|
57 | RT_C_DECLS_BEGIN
|
---|
58 |
|
---|
59 | /** @defgroup grp_pdm_usbdev The USB Devices API
|
---|
60 | * @ingroup grp_pdm
|
---|
61 | * @{
|
---|
62 | */
|
---|
63 |
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * A string entry for the USB descriptor cache.
|
---|
67 | */
|
---|
68 | typedef struct PDMUSBDESCCACHESTRING
|
---|
69 | {
|
---|
70 | /** The string index. */
|
---|
71 | uint8_t idx;
|
---|
72 | /** The UTF-8 representation of the string. */
|
---|
73 | const char *psz;
|
---|
74 | } PDMUSBDESCCACHESTRING;
|
---|
75 | /** Pointer to a const string entry. */
|
---|
76 | typedef PDMUSBDESCCACHESTRING const *PCPDMUSBDESCCACHESTRING;
|
---|
77 |
|
---|
78 |
|
---|
79 | /**
|
---|
80 | * A language entry for the USB descriptor cache.
|
---|
81 | */
|
---|
82 | typedef struct PDMUSBDESCCACHELANG
|
---|
83 | {
|
---|
84 | /** The language ID for the strings in this block. */
|
---|
85 | uint16_t idLang;
|
---|
86 | /** The number of strings in the array. */
|
---|
87 | uint16_t cStrings;
|
---|
88 | /** Pointer to an array of associated strings.
|
---|
89 | * This must be sorted in ascending order by string index as a binary lookup
|
---|
90 | * will be performed. */
|
---|
91 | PCPDMUSBDESCCACHESTRING paStrings;
|
---|
92 | } PDMUSBDESCCACHELANG;
|
---|
93 | /** Pointer to a const language entry. */
|
---|
94 | typedef PDMUSBDESCCACHELANG const *PCPDMUSBDESCCACHELANG;
|
---|
95 |
|
---|
96 |
|
---|
97 | /**
|
---|
98 | * USB descriptor cache.
|
---|
99 | *
|
---|
100 | * This structure is owned by the USB device but provided to the PDM/VUSB layer
|
---|
101 | * thru the PDMUSBREG::pfnGetDescriptorCache method. PDM/VUSB will use the
|
---|
102 | * information here to map addresses to endpoints, perform SET_CONFIGURATION
|
---|
103 | * requests, and optionally perform GET_DESCRIPTOR requests (see flag).
|
---|
104 | *
|
---|
105 | * Currently, only device and configuration descriptors are cached.
|
---|
106 | */
|
---|
107 | typedef struct PDMUSBDESCCACHE
|
---|
108 | {
|
---|
109 | /** USB device descriptor */
|
---|
110 | PCVUSBDESCDEVICE pDevice;
|
---|
111 | /** USB Descriptor arrays (pDev->bNumConfigurations) */
|
---|
112 | PCVUSBDESCCONFIGEX paConfigs;
|
---|
113 | /** Language IDs and their associated strings.
|
---|
114 | * This must be sorted in ascending order by language ID as a binary lookup
|
---|
115 | * will be used. */
|
---|
116 | PCPDMUSBDESCCACHELANG paLanguages;
|
---|
117 | /** The number of entries in the array pointed to by paLanguages. */
|
---|
118 | uint16_t cLanguages;
|
---|
119 | /** Use the cached descriptors for GET_DESCRIPTOR requests. */
|
---|
120 | bool fUseCachedDescriptors;
|
---|
121 | /** Use the cached string descriptors. */
|
---|
122 | bool fUseCachedStringsDescriptors;
|
---|
123 | } PDMUSBDESCCACHE;
|
---|
124 | /** Pointer to an USB descriptor cache. */
|
---|
125 | typedef PDMUSBDESCCACHE *PPDMUSBDESCCACHE;
|
---|
126 | /** Pointer to a const USB descriptor cache. */
|
---|
127 | typedef const PDMUSBDESCCACHE *PCPDMUSBDESCCACHE;
|
---|
128 |
|
---|
129 |
|
---|
130 | /** PDM Device Flags.
|
---|
131 | * @{ */
|
---|
132 | /** A high-speed capable USB 2.0 device (also required to support full-speed). */
|
---|
133 | #define PDM_USBREG_HIGHSPEED_CAPABLE RT_BIT(0)
|
---|
134 | /** Indicates that the device implements the saved state handlers. */
|
---|
135 | #define PDM_USBREG_SAVED_STATE_SUPPORTED RT_BIT(1)
|
---|
136 | /** A SuperSpeed USB 3.0 device. */
|
---|
137 | #define PDM_USBREG_SUPERSPEED_CAPABLE RT_BIT(2)
|
---|
138 | /** @} */
|
---|
139 |
|
---|
140 | /** PDM USB Device Registration Structure,
|
---|
141 | *
|
---|
142 | * This structure is used when registering a device from VBoxUsbRegister() in HC Ring-3.
|
---|
143 | * The PDM will make use of this structure until the VM is destroyed.
|
---|
144 | */
|
---|
145 | typedef struct PDMUSBREG
|
---|
146 | {
|
---|
147 | /** Structure version. PDM_DEVREG_VERSION defines the current version. */
|
---|
148 | uint32_t u32Version;
|
---|
149 | /** Device name. */
|
---|
150 | char szName[32];
|
---|
151 | /** The description of the device. The UTF-8 string pointed to shall, like this structure,
|
---|
152 | * remain unchanged from registration till VM destruction. */
|
---|
153 | const char *pszDescription;
|
---|
154 |
|
---|
155 | /** Flags, combination of the PDM_USBREG_FLAGS_* \#defines. */
|
---|
156 | RTUINT fFlags;
|
---|
157 | /** Maximum number of instances (per VM). */
|
---|
158 | RTUINT cMaxInstances;
|
---|
159 | /** Size of the instance data. */
|
---|
160 | RTUINT cbInstance;
|
---|
161 |
|
---|
162 |
|
---|
163 | /**
|
---|
164 | * Construct an USB device instance for a VM.
|
---|
165 | *
|
---|
166 | * @returns VBox status.
|
---|
167 | * @param pUsbIns The USB device instance data.
|
---|
168 | * If the registration structure is needed, it will be
|
---|
169 | * accessible thru pUsbDev->pReg.
|
---|
170 | * @param iInstance Instance number. Use this to figure out which registers
|
---|
171 | * and such to use. The instance number is also found in
|
---|
172 | * pUsbDev->iInstance, but since it's likely to be
|
---|
173 | * frequently used PDM passes it as parameter.
|
---|
174 | * @param pCfg Configuration node handle for the device. Use this to
|
---|
175 | * obtain the configuration of the device instance. It is
|
---|
176 | * also found in pUsbDev->pCfg, but since it is primary
|
---|
177 | * usage will in this function it is passed as a parameter.
|
---|
178 | * @param pCfgGlobal Handle to the global device configuration. Also found
|
---|
179 | * in pUsbDev->pCfgGlobal.
|
---|
180 | * @remarks This callback is required.
|
---|
181 | */
|
---|
182 | DECLR3CALLBACKMEMBER(int, pfnConstruct,(PPDMUSBINS pUsbIns, int iInstance, PCFGMNODE pCfg, PCFGMNODE pCfgGlobal));
|
---|
183 |
|
---|
184 | /**
|
---|
185 | * Destruct an USB device instance.
|
---|
186 | *
|
---|
187 | * Most VM resources are freed by the VM. This callback is provided so that any non-VM
|
---|
188 | * resources can be freed correctly.
|
---|
189 | *
|
---|
190 | * This method will be called regardless of the pfnConstruct result to avoid
|
---|
191 | * complicated failure paths.
|
---|
192 | *
|
---|
193 | * @param pUsbIns The USB device instance data.
|
---|
194 | * @remarks Optional.
|
---|
195 | */
|
---|
196 | DECLR3CALLBACKMEMBER(void, pfnDestruct,(PPDMUSBINS pUsbIns));
|
---|
197 |
|
---|
198 |
|
---|
199 | /**
|
---|
200 | * Init complete notification.
|
---|
201 | *
|
---|
202 | * This can be done to do communication with other devices and other
|
---|
203 | * initialization which requires everything to be in place.
|
---|
204 | *
|
---|
205 | * @returns VBox status code.
|
---|
206 | * @param pUsbIns The USB device instance data.
|
---|
207 | * @remarks Optional.
|
---|
208 | * @remarks Not called when hotplugged.
|
---|
209 | */
|
---|
210 | DECLR3CALLBACKMEMBER(int, pfnVMInitComplete,(PPDMUSBINS pUsbIns));
|
---|
211 |
|
---|
212 | /**
|
---|
213 | * VM Power On notification.
|
---|
214 | *
|
---|
215 | * @param pUsbIns The USB device instance data.
|
---|
216 | * @remarks Optional.
|
---|
217 | */
|
---|
218 | DECLR3CALLBACKMEMBER(void, pfnVMPowerOn,(PPDMUSBINS pUsbIns));
|
---|
219 |
|
---|
220 | /**
|
---|
221 | * VM Reset notification.
|
---|
222 | *
|
---|
223 | * @param pUsbIns The USB device instance data.
|
---|
224 | * @remarks Optional.
|
---|
225 | */
|
---|
226 | DECLR3CALLBACKMEMBER(void, pfnVMReset,(PPDMUSBINS pUsbIns));
|
---|
227 |
|
---|
228 | /**
|
---|
229 | * VM Suspend notification.
|
---|
230 | *
|
---|
231 | * @param pUsbIns The USB device instance data.
|
---|
232 | * @remarks Optional.
|
---|
233 | */
|
---|
234 | DECLR3CALLBACKMEMBER(void, pfnVMSuspend,(PPDMUSBINS pUsbIns));
|
---|
235 |
|
---|
236 | /**
|
---|
237 | * VM Resume notification.
|
---|
238 | *
|
---|
239 | * This is not called when the device is hotplugged device, instead
|
---|
240 | * pfnHotPlugged will be called.
|
---|
241 | *
|
---|
242 | * @param pUsbIns The USB device instance data.
|
---|
243 | * @remarks Optional.
|
---|
244 | */
|
---|
245 | DECLR3CALLBACKMEMBER(void, pfnVMResume,(PPDMUSBINS pUsbIns));
|
---|
246 |
|
---|
247 | /**
|
---|
248 | * VM Power Off notification.
|
---|
249 | *
|
---|
250 | * This is only called when the VMR3PowerOff call is made on a running VM. This
|
---|
251 | * means that there is no notification if the VM was suspended before being
|
---|
252 | * powered of. There will also be no callback when hot plugging devices.
|
---|
253 | *
|
---|
254 | * @param pUsbIns The USB device instance data.
|
---|
255 | */
|
---|
256 | DECLR3CALLBACKMEMBER(void, pfnVMPowerOff,(PPDMUSBINS pUsbIns));
|
---|
257 |
|
---|
258 | /**
|
---|
259 | * Called after the constructor when attaching a device at run time.
|
---|
260 | *
|
---|
261 | * This can be used to do tasks normally assigned to pfnInitComplete and/or
|
---|
262 | * pfnVMPowerOn. There will not be a call to pfnVMResume following this.
|
---|
263 | *
|
---|
264 | * @param pUsbIns The USB device instance data.
|
---|
265 | * @remarks Optional.
|
---|
266 | */
|
---|
267 | DECLR3CALLBACKMEMBER(void, pfnHotPlugged,(PPDMUSBINS pUsbIns));
|
---|
268 |
|
---|
269 | /**
|
---|
270 | * Called before the destructor when a device is unplugged at run time.
|
---|
271 | *
|
---|
272 | * This can be used to do tasks normally assigned to pfnVMSuspend and/or pfnVMPowerOff.
|
---|
273 | *
|
---|
274 | * @param pUsbIns The USB device instance data.
|
---|
275 | * @remarks Optional.
|
---|
276 | */
|
---|
277 | DECLR3CALLBACKMEMBER(void, pfnHotUnplugged,(PPDMUSBINS pUsbIns));
|
---|
278 | /**
|
---|
279 | * Driver Attach command.
|
---|
280 | *
|
---|
281 | * This is called to let the USB device attach to a driver for a specified LUN
|
---|
282 | * at runtime. This is not called during VM construction, the device constructor
|
---|
283 | * have to attach to all the available drivers.
|
---|
284 | *
|
---|
285 | * @returns VBox status code.
|
---|
286 | * @param pUsbIns The USB device instance data.
|
---|
287 | * @param iLUN The logical unit which is being detached.
|
---|
288 | * @param fFlags Flags, combination of the PDM_TACH_FLAGS_* \#defines.
|
---|
289 | * @remarks Optional.
|
---|
290 | */
|
---|
291 | DECLR3CALLBACKMEMBER(int, pfnDriverAttach,(PPDMUSBINS pUsbIns, unsigned iLUN, uint32_t fFlags));
|
---|
292 |
|
---|
293 | /**
|
---|
294 | * Driver Detach notification.
|
---|
295 | *
|
---|
296 | * This is called when a driver is detaching itself from a LUN of the device.
|
---|
297 | * The device should adjust it's state to reflect this.
|
---|
298 | *
|
---|
299 | * @param pUsbIns The USB device instance data.
|
---|
300 | * @param iLUN The logical unit which is being detached.
|
---|
301 | * @param fFlags Flags, combination of the PDM_TACH_FLAGS_* \#defines.
|
---|
302 | * @remarks Optional.
|
---|
303 | */
|
---|
304 | DECLR3CALLBACKMEMBER(void, pfnDriverDetach,(PPDMUSBINS pUsbIns, unsigned iLUN, uint32_t fFlags));
|
---|
305 |
|
---|
306 | /**
|
---|
307 | * Query the base interface of a logical unit.
|
---|
308 | *
|
---|
309 | * @returns VBox status code.
|
---|
310 | * @param pUsbIns The USB device instance data.
|
---|
311 | * @param iLUN The logicial unit to query.
|
---|
312 | * @param ppBase Where to store the pointer to the base interface of the LUN.
|
---|
313 | * @remarks Optional.
|
---|
314 | */
|
---|
315 | DECLR3CALLBACKMEMBER(int, pfnQueryInterface,(PPDMUSBINS pUsbIns, unsigned iLUN, PPDMIBASE *ppBase));
|
---|
316 |
|
---|
317 | /**
|
---|
318 | * Requests the USB device to reset.
|
---|
319 | *
|
---|
320 | * @returns VBox status code.
|
---|
321 | * @param pUsbIns The USB device instance.
|
---|
322 | * @param fResetOnLinux A hint to the usb proxy.
|
---|
323 | * Don't use this unless you're the linux proxy device.
|
---|
324 | * @thread Any thread.
|
---|
325 | * @remarks Optional.
|
---|
326 | */
|
---|
327 | DECLR3CALLBACKMEMBER(int, pfnUsbReset,(PPDMUSBINS pUsbIns, bool fResetOnLinux));
|
---|
328 |
|
---|
329 | /**
|
---|
330 | * Query device and configuration descriptors for the caching and servicing
|
---|
331 | * relevant GET_DESCRIPTOR requests.
|
---|
332 | *
|
---|
333 | * @returns Pointer to the descriptor cache (read-only).
|
---|
334 | * @param pUsbIns The USB device instance.
|
---|
335 | * @remarks Mandatory.
|
---|
336 | */
|
---|
337 | DECLR3CALLBACKMEMBER(PCPDMUSBDESCCACHE, pfnUsbGetDescriptorCache,(PPDMUSBINS pUsbIns));
|
---|
338 |
|
---|
339 | /**
|
---|
340 | * SET_CONFIGURATION request.
|
---|
341 | *
|
---|
342 | * @returns VBox status code.
|
---|
343 | * @param pUsbIns The USB device instance.
|
---|
344 | * @param bConfigurationValue The bConfigurationValue of the new configuration.
|
---|
345 | * @param pvOldCfgDesc Internal - for the device proxy.
|
---|
346 | * @param pvOldIfState Internal - for the device proxy.
|
---|
347 | * @param pvNewCfgDesc Internal - for the device proxy.
|
---|
348 | * @remarks Optional.
|
---|
349 | */
|
---|
350 | DECLR3CALLBACKMEMBER(int, pfnUsbSetConfiguration,(PPDMUSBINS pUsbIns, uint8_t bConfigurationValue,
|
---|
351 | const void *pvOldCfgDesc, const void *pvOldIfState, const void *pvNewCfgDesc));
|
---|
352 |
|
---|
353 | /**
|
---|
354 | * SET_INTERFACE request.
|
---|
355 | *
|
---|
356 | * @returns VBox status code.
|
---|
357 | * @param pUsbIns The USB device instance.
|
---|
358 | * @param bInterfaceNumber The interface number.
|
---|
359 | * @param bAlternateSetting The alternate setting.
|
---|
360 | * @remarks Optional.
|
---|
361 | */
|
---|
362 | DECLR3CALLBACKMEMBER(int, pfnUsbSetInterface,(PPDMUSBINS pUsbIns, uint8_t bInterfaceNumber, uint8_t bAlternateSetting));
|
---|
363 |
|
---|
364 | /**
|
---|
365 | * Clears the halted state of an endpoint. (Optional)
|
---|
366 | *
|
---|
367 | * This called when VUSB sees a CLEAR_FEATURE(ENDPOINT_HALT) on request
|
---|
368 | * on the zero pipe.
|
---|
369 | *
|
---|
370 | * @returns VBox status code.
|
---|
371 | * @param pUsbIns The USB device instance.
|
---|
372 | * @param uEndpoint The endpoint to clear.
|
---|
373 | * @remarks Optional.
|
---|
374 | */
|
---|
375 | DECLR3CALLBACKMEMBER(int, pfnUsbClearHaltedEndpoint,(PPDMUSBINS pUsbIns, unsigned uEndpoint));
|
---|
376 |
|
---|
377 | /**
|
---|
378 | * Allocates an URB.
|
---|
379 | *
|
---|
380 | * This can be used to make use of shared user/kernel mode buffers.
|
---|
381 | *
|
---|
382 | * @returns VBox status code.
|
---|
383 | * @param pUsbIns The USB device instance.
|
---|
384 | * @param cbData The size of the data buffer.
|
---|
385 | * @param cTds The number of TDs.
|
---|
386 | * @param enmType The type of URB.
|
---|
387 | * @param ppUrb Where to store the allocated URB.
|
---|
388 | * @remarks Optional.
|
---|
389 | * @remarks Not implemented yet.
|
---|
390 | */
|
---|
391 | DECLR3CALLBACKMEMBER(int, pfnUrbNew,(PPDMUSBINS pUsbIns, size_t cbData, size_t cTds, VUSBXFERTYPE enmType, PVUSBURB *ppUrb));
|
---|
392 |
|
---|
393 | /**
|
---|
394 | * Queues an URB for processing.
|
---|
395 | *
|
---|
396 | * @returns VBox status code.
|
---|
397 | * @retval VINF_SUCCESS on success.
|
---|
398 | * @retval VERR_VUSB_DEVICE_NOT_ATTACHED if the device has been disconnected.
|
---|
399 | * @retval VERR_VUSB_FAILED_TO_QUEUE_URB as a general failure kind of thing.
|
---|
400 | * @retval TBD - document new stuff!
|
---|
401 | *
|
---|
402 | * @param pUsbIns The USB device instance.
|
---|
403 | * @param pUrb The URB to process.
|
---|
404 | * @remarks Mandatory.
|
---|
405 | */
|
---|
406 | DECLR3CALLBACKMEMBER(int, pfnUrbQueue,(PPDMUSBINS pUsbIns, PVUSBURB pUrb));
|
---|
407 |
|
---|
408 | /**
|
---|
409 | * Cancels an URB.
|
---|
410 | *
|
---|
411 | * @returns VBox status code.
|
---|
412 | * @param pUsbIns The USB device instance.
|
---|
413 | * @param pUrb The URB to cancel.
|
---|
414 | * @remarks Mandatory.
|
---|
415 | */
|
---|
416 | DECLR3CALLBACKMEMBER(int, pfnUrbCancel,(PPDMUSBINS pUsbIns, PVUSBURB pUrb));
|
---|
417 |
|
---|
418 | /**
|
---|
419 | * Reaps an URB.
|
---|
420 | *
|
---|
421 | * @returns A ripe URB, NULL if none.
|
---|
422 | * @param pUsbIns The USB device instance.
|
---|
423 | * @param cMillies How log to wait for an URB to become ripe.
|
---|
424 | * @remarks Mandatory.
|
---|
425 | */
|
---|
426 | DECLR3CALLBACKMEMBER(PVUSBURB, pfnUrbReap,(PPDMUSBINS pUsbIns, RTMSINTERVAL cMillies));
|
---|
427 |
|
---|
428 | /**
|
---|
429 | * Wakes a thread waiting in pfnUrbReap.
|
---|
430 | *
|
---|
431 | * @returns VBox status code.
|
---|
432 | * @param pUsbIns The USB device instance.
|
---|
433 | */
|
---|
434 | DECLR3CALLBACKMEMBER(int, pfnWakeup,(PPDMUSBINS pUsbIns));
|
---|
435 |
|
---|
436 | /** Just some init precaution. Must be set to PDM_USBREG_VERSION. */
|
---|
437 | uint32_t u32TheEnd;
|
---|
438 | } PDMUSBREG;
|
---|
439 | /** Pointer to a PDM USB Device Structure. */
|
---|
440 | typedef PDMUSBREG *PPDMUSBREG;
|
---|
441 | /** Const pointer to a PDM USB Device Structure. */
|
---|
442 | typedef PDMUSBREG const *PCPDMUSBREG;
|
---|
443 |
|
---|
444 | /** Current USBREG version number. */
|
---|
445 | #define PDM_USBREG_VERSION PDM_VERSION_MAKE(0xeeff, 2, 0)
|
---|
446 |
|
---|
447 | /** PDM USB Device Flags.
|
---|
448 | * @{ */
|
---|
449 | /* none yet */
|
---|
450 | /** @} */
|
---|
451 |
|
---|
452 |
|
---|
453 | #ifdef IN_RING3
|
---|
454 |
|
---|
455 | /**
|
---|
456 | * PDM USB Device API.
|
---|
457 | */
|
---|
458 | typedef struct PDMUSBHLP
|
---|
459 | {
|
---|
460 | /** Structure version. PDM_USBHLP_VERSION defines the current version. */
|
---|
461 | uint32_t u32Version;
|
---|
462 |
|
---|
463 | /**
|
---|
464 | * Attaches a driver (chain) to the USB device.
|
---|
465 | *
|
---|
466 | * The first call for a LUN this will serve as a registration of the LUN. The pBaseInterface and
|
---|
467 | * the pszDesc string will be registered with that LUN and kept around for PDMR3QueryUSBDeviceLun().
|
---|
468 | *
|
---|
469 | * @returns VBox status code.
|
---|
470 | * @param pUsbIns The USB device instance.
|
---|
471 | * @param iLun The logical unit to attach.
|
---|
472 | * @param pBaseInterface Pointer to the base interface for that LUN. (device side / down)
|
---|
473 | * @param ppBaseInterface Where to store the pointer to the base interface. (driver side / up)
|
---|
474 | * @param pszDesc Pointer to a string describing the LUN. This string must remain valid
|
---|
475 | * for the live of the device instance.
|
---|
476 | */
|
---|
477 | DECLR3CALLBACKMEMBER(int, pfnDriverAttach,(PPDMUSBINS pUsbIns, RTUINT iLun, PPDMIBASE pBaseInterface, PPDMIBASE *ppBaseInterface, const char *pszDesc));
|
---|
478 |
|
---|
479 | /**
|
---|
480 | * Assert that the current thread is the emulation thread.
|
---|
481 | *
|
---|
482 | * @returns True if correct.
|
---|
483 | * @returns False if wrong.
|
---|
484 | * @param pUsbIns The USB device instance.
|
---|
485 | * @param pszFile Filename of the assertion location.
|
---|
486 | * @param iLine Linenumber of the assertion location.
|
---|
487 | * @param pszFunction Function of the assertion location.
|
---|
488 | */
|
---|
489 | DECLR3CALLBACKMEMBER(bool, pfnAssertEMT,(PPDMUSBINS pUsbIns, const char *pszFile, unsigned iLine, const char *pszFunction));
|
---|
490 |
|
---|
491 | /**
|
---|
492 | * Assert that the current thread is NOT the emulation thread.
|
---|
493 | *
|
---|
494 | * @returns True if correct.
|
---|
495 | * @returns False if wrong.
|
---|
496 | * @param pUsbIns The USB device instance.
|
---|
497 | * @param pszFile Filename of the assertion location.
|
---|
498 | * @param iLine Linenumber of the assertion location.
|
---|
499 | * @param pszFunction Function of the assertion location.
|
---|
500 | */
|
---|
501 | DECLR3CALLBACKMEMBER(bool, pfnAssertOther,(PPDMUSBINS pUsbIns, const char *pszFile, unsigned iLine, const char *pszFunction));
|
---|
502 |
|
---|
503 | /**
|
---|
504 | * Stops the VM and enters the debugger to look at the guest state.
|
---|
505 | *
|
---|
506 | * Use the PDMUsbDBGFStop() inline function with the RT_SRC_POS macro instead of
|
---|
507 | * invoking this function directly.
|
---|
508 | *
|
---|
509 | * @returns VBox status code which must be passed up to the VMM.
|
---|
510 | * @param pUsbIns The USB device instance.
|
---|
511 | * @param pszFile Filename of the assertion location.
|
---|
512 | * @param iLine The linenumber of the assertion location.
|
---|
513 | * @param pszFunction Function of the assertion location.
|
---|
514 | * @param pszFormat Message. (optional)
|
---|
515 | * @param va Message parameters.
|
---|
516 | */
|
---|
517 | DECLR3CALLBACKMEMBER(int, pfnDBGFStopV,(PPDMUSBINS pUsbIns, const char *pszFile, unsigned iLine, const char *pszFunction,
|
---|
518 | const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(5, 0));
|
---|
519 |
|
---|
520 | /**
|
---|
521 | * Register a info handler with DBGF, argv style.
|
---|
522 | *
|
---|
523 | * @returns VBox status code.
|
---|
524 | * @param pUsbIns The USB device instance.
|
---|
525 | * @param pszName The identifier of the info.
|
---|
526 | * @param pszDesc The description of the info and any arguments the handler may take.
|
---|
527 | * @param pfnHandler The handler function to be called to display the info.
|
---|
528 | */
|
---|
529 | DECLR3CALLBACKMEMBER(int, pfnDBGFInfoRegisterArgv,(PPDMUSBINS pUsbIns, const char *pszName, const char *pszDesc, PFNDBGFINFOARGVUSB pfnHandler));
|
---|
530 |
|
---|
531 | /**
|
---|
532 | * Allocate memory which is associated with current VM instance
|
---|
533 | * and automatically freed on it's destruction.
|
---|
534 | *
|
---|
535 | * @returns Pointer to allocated memory. The memory is *NOT* zero-ed.
|
---|
536 | * @param pUsbIns The USB device instance.
|
---|
537 | * @param cb Number of bytes to allocate.
|
---|
538 | */
|
---|
539 | DECLR3CALLBACKMEMBER(void *, pfnMMHeapAlloc,(PPDMUSBINS pUsbIns, size_t cb));
|
---|
540 |
|
---|
541 | /**
|
---|
542 | * Allocate memory which is associated with current VM instance
|
---|
543 | * and automatically freed on it's destruction. The memory is ZEROed.
|
---|
544 | *
|
---|
545 | * @returns Pointer to allocated memory. The memory is *NOT* zero-ed.
|
---|
546 | * @param pUsbIns The USB device instance.
|
---|
547 | * @param cb Number of bytes to allocate.
|
---|
548 | */
|
---|
549 | DECLR3CALLBACKMEMBER(void *, pfnMMHeapAllocZ,(PPDMUSBINS pUsbIns, size_t cb));
|
---|
550 |
|
---|
551 | /**
|
---|
552 | * Free memory allocated with pfnMMHeapAlloc() and pfnMMHeapAllocZ().
|
---|
553 | *
|
---|
554 | * @param pUsbIns The USB device instance.
|
---|
555 | * @param pv Pointer to the memory to free.
|
---|
556 | */
|
---|
557 | DECLR3CALLBACKMEMBER(void, pfnMMHeapFree,(PPDMUSBINS pUsbIns, void *pv));
|
---|
558 |
|
---|
559 | /**
|
---|
560 | * Create a queue.
|
---|
561 | *
|
---|
562 | * @returns VBox status code.
|
---|
563 | * @param pUsbIns The USB device instance.
|
---|
564 | * @param cbItem Size a queue item.
|
---|
565 | * @param cItems Number of items in the queue.
|
---|
566 | * @param cMilliesInterval Number of milliseconds between polling the queue.
|
---|
567 | * If 0 then the emulation thread will be notified whenever an item arrives.
|
---|
568 | * @param pfnCallback The consumer function.
|
---|
569 | * @param pszName The queue base name. The instance number will be
|
---|
570 | * appended automatically.
|
---|
571 | * @param ppQueue Where to store the queue handle on success.
|
---|
572 | * @thread The emulation thread.
|
---|
573 | */
|
---|
574 | DECLR3CALLBACKMEMBER(int, pfnPDMQueueCreate,(PPDMUSBINS pUsbIns, RTUINT cbItem, RTUINT cItems, uint32_t cMilliesInterval,
|
---|
575 | PFNPDMQUEUEUSB pfnCallback, const char *pszName, PPDMQUEUE *ppQueue));
|
---|
576 |
|
---|
577 | /**
|
---|
578 | * Register a save state data unit.
|
---|
579 | *
|
---|
580 | * @returns VBox status.
|
---|
581 | * @param pUsbIns The USB device instance.
|
---|
582 | * @param uVersion Data layout version number.
|
---|
583 | * @param cbGuess The approximate amount of data in the unit.
|
---|
584 | * Only for progress indicators.
|
---|
585 | *
|
---|
586 | * @param pfnLivePrep Prepare live save callback, optional.
|
---|
587 | * @param pfnLiveExec Execute live save callback, optional.
|
---|
588 | * @param pfnLiveVote Vote live save callback, optional.
|
---|
589 | *
|
---|
590 | * @param pfnSavePrep Prepare save callback, optional.
|
---|
591 | * @param pfnSaveExec Execute save callback, optional.
|
---|
592 | * @param pfnSaveDone Done save callback, optional.
|
---|
593 | *
|
---|
594 | * @param pfnLoadPrep Prepare load callback, optional.
|
---|
595 | * @param pfnLoadExec Execute load callback, optional.
|
---|
596 | * @param pfnLoadDone Done load callback, optional.
|
---|
597 | */
|
---|
598 | DECLR3CALLBACKMEMBER(int, pfnSSMRegister,(PPDMUSBINS pUsbIns, uint32_t uVersion, size_t cbGuess,
|
---|
599 | PFNSSMUSBLIVEPREP pfnLivePrep, PFNSSMUSBLIVEEXEC pfnLiveExec, PFNSSMUSBLIVEVOTE pfnLiveVote,
|
---|
600 | PFNSSMUSBSAVEPREP pfnSavePrep, PFNSSMUSBSAVEEXEC pfnSaveExec, PFNSSMUSBSAVEDONE pfnSaveDone,
|
---|
601 | PFNSSMUSBLOADPREP pfnLoadPrep, PFNSSMUSBLOADEXEC pfnLoadExec, PFNSSMUSBLOADDONE pfnLoadDone));
|
---|
602 |
|
---|
603 | /** @name Exported SSM Functions
|
---|
604 | * @{ */
|
---|
605 | DECLR3CALLBACKMEMBER(int, pfnSSMPutStruct,(PSSMHANDLE pSSM, const void *pvStruct, PCSSMFIELD paFields));
|
---|
606 | DECLR3CALLBACKMEMBER(int, pfnSSMPutStructEx,(PSSMHANDLE pSSM, const void *pvStruct, size_t cbStruct, uint32_t fFlags, PCSSMFIELD paFields, void *pvUser));
|
---|
607 | DECLR3CALLBACKMEMBER(int, pfnSSMPutBool,(PSSMHANDLE pSSM, bool fBool));
|
---|
608 | DECLR3CALLBACKMEMBER(int, pfnSSMPutU8,(PSSMHANDLE pSSM, uint8_t u8));
|
---|
609 | DECLR3CALLBACKMEMBER(int, pfnSSMPutS8,(PSSMHANDLE pSSM, int8_t i8));
|
---|
610 | DECLR3CALLBACKMEMBER(int, pfnSSMPutU16,(PSSMHANDLE pSSM, uint16_t u16));
|
---|
611 | DECLR3CALLBACKMEMBER(int, pfnSSMPutS16,(PSSMHANDLE pSSM, int16_t i16));
|
---|
612 | DECLR3CALLBACKMEMBER(int, pfnSSMPutU32,(PSSMHANDLE pSSM, uint32_t u32));
|
---|
613 | DECLR3CALLBACKMEMBER(int, pfnSSMPutS32,(PSSMHANDLE pSSM, int32_t i32));
|
---|
614 | DECLR3CALLBACKMEMBER(int, pfnSSMPutU64,(PSSMHANDLE pSSM, uint64_t u64));
|
---|
615 | DECLR3CALLBACKMEMBER(int, pfnSSMPutS64,(PSSMHANDLE pSSM, int64_t i64));
|
---|
616 | DECLR3CALLBACKMEMBER(int, pfnSSMPutU128,(PSSMHANDLE pSSM, uint128_t u128));
|
---|
617 | DECLR3CALLBACKMEMBER(int, pfnSSMPutS128,(PSSMHANDLE pSSM, int128_t i128));
|
---|
618 | DECLR3CALLBACKMEMBER(int, pfnSSMPutUInt,(PSSMHANDLE pSSM, RTUINT u));
|
---|
619 | DECLR3CALLBACKMEMBER(int, pfnSSMPutSInt,(PSSMHANDLE pSSM, RTINT i));
|
---|
620 | DECLR3CALLBACKMEMBER(int, pfnSSMPutGCUInt,(PSSMHANDLE pSSM, RTGCUINT u));
|
---|
621 | DECLR3CALLBACKMEMBER(int, pfnSSMPutGCUIntReg,(PSSMHANDLE pSSM, RTGCUINTREG u));
|
---|
622 | DECLR3CALLBACKMEMBER(int, pfnSSMPutGCPhys32,(PSSMHANDLE pSSM, RTGCPHYS32 GCPhys));
|
---|
623 | DECLR3CALLBACKMEMBER(int, pfnSSMPutGCPhys64,(PSSMHANDLE pSSM, RTGCPHYS64 GCPhys));
|
---|
624 | DECLR3CALLBACKMEMBER(int, pfnSSMPutGCPhys,(PSSMHANDLE pSSM, RTGCPHYS GCPhys));
|
---|
625 | DECLR3CALLBACKMEMBER(int, pfnSSMPutGCPtr,(PSSMHANDLE pSSM, RTGCPTR GCPtr));
|
---|
626 | DECLR3CALLBACKMEMBER(int, pfnSSMPutGCUIntPtr,(PSSMHANDLE pSSM, RTGCUINTPTR GCPtr));
|
---|
627 | DECLR3CALLBACKMEMBER(int, pfnSSMPutRCPtr,(PSSMHANDLE pSSM, RTRCPTR RCPtr));
|
---|
628 | DECLR3CALLBACKMEMBER(int, pfnSSMPutIOPort,(PSSMHANDLE pSSM, RTIOPORT IOPort));
|
---|
629 | DECLR3CALLBACKMEMBER(int, pfnSSMPutSel,(PSSMHANDLE pSSM, RTSEL Sel));
|
---|
630 | DECLR3CALLBACKMEMBER(int, pfnSSMPutMem,(PSSMHANDLE pSSM, const void *pv, size_t cb));
|
---|
631 | DECLR3CALLBACKMEMBER(int, pfnSSMPutStrZ,(PSSMHANDLE pSSM, const char *psz));
|
---|
632 | DECLR3CALLBACKMEMBER(int, pfnSSMGetStruct,(PSSMHANDLE pSSM, void *pvStruct, PCSSMFIELD paFields));
|
---|
633 | DECLR3CALLBACKMEMBER(int, pfnSSMGetStructEx,(PSSMHANDLE pSSM, void *pvStruct, size_t cbStruct, uint32_t fFlags, PCSSMFIELD paFields, void *pvUser));
|
---|
634 | DECLR3CALLBACKMEMBER(int, pfnSSMGetBool,(PSSMHANDLE pSSM, bool *pfBool));
|
---|
635 | DECLR3CALLBACKMEMBER(int, pfnSSMGetBoolV,(PSSMHANDLE pSSM, bool volatile *pfBool));
|
---|
636 | DECLR3CALLBACKMEMBER(int, pfnSSMGetU8,(PSSMHANDLE pSSM, uint8_t *pu8));
|
---|
637 | DECLR3CALLBACKMEMBER(int, pfnSSMGetU8V,(PSSMHANDLE pSSM, uint8_t volatile *pu8));
|
---|
638 | DECLR3CALLBACKMEMBER(int, pfnSSMGetS8,(PSSMHANDLE pSSM, int8_t *pi8));
|
---|
639 | DECLR3CALLBACKMEMBER(int, pfnSSMGetS8V,(PSSMHANDLE pSSM, int8_t volatile *pi8));
|
---|
640 | DECLR3CALLBACKMEMBER(int, pfnSSMGetU16,(PSSMHANDLE pSSM, uint16_t *pu16));
|
---|
641 | DECLR3CALLBACKMEMBER(int, pfnSSMGetU16V,(PSSMHANDLE pSSM, uint16_t volatile *pu16));
|
---|
642 | DECLR3CALLBACKMEMBER(int, pfnSSMGetS16,(PSSMHANDLE pSSM, int16_t *pi16));
|
---|
643 | DECLR3CALLBACKMEMBER(int, pfnSSMGetS16V,(PSSMHANDLE pSSM, int16_t volatile *pi16));
|
---|
644 | DECLR3CALLBACKMEMBER(int, pfnSSMGetU32,(PSSMHANDLE pSSM, uint32_t *pu32));
|
---|
645 | DECLR3CALLBACKMEMBER(int, pfnSSMGetU32V,(PSSMHANDLE pSSM, uint32_t volatile *pu32));
|
---|
646 | DECLR3CALLBACKMEMBER(int, pfnSSMGetS32,(PSSMHANDLE pSSM, int32_t *pi32));
|
---|
647 | DECLR3CALLBACKMEMBER(int, pfnSSMGetS32V,(PSSMHANDLE pSSM, int32_t volatile *pi32));
|
---|
648 | DECLR3CALLBACKMEMBER(int, pfnSSMGetU64,(PSSMHANDLE pSSM, uint64_t *pu64));
|
---|
649 | DECLR3CALLBACKMEMBER(int, pfnSSMGetU64V,(PSSMHANDLE pSSM, uint64_t volatile *pu64));
|
---|
650 | DECLR3CALLBACKMEMBER(int, pfnSSMGetS64,(PSSMHANDLE pSSM, int64_t *pi64));
|
---|
651 | DECLR3CALLBACKMEMBER(int, pfnSSMGetS64V,(PSSMHANDLE pSSM, int64_t volatile *pi64));
|
---|
652 | DECLR3CALLBACKMEMBER(int, pfnSSMGetU128,(PSSMHANDLE pSSM, uint128_t *pu128));
|
---|
653 | DECLR3CALLBACKMEMBER(int, pfnSSMGetU128V,(PSSMHANDLE pSSM, uint128_t volatile *pu128));
|
---|
654 | DECLR3CALLBACKMEMBER(int, pfnSSMGetS128,(PSSMHANDLE pSSM, int128_t *pi128));
|
---|
655 | DECLR3CALLBACKMEMBER(int, pfnSSMGetS128V,(PSSMHANDLE pSSM, int128_t volatile *pi128));
|
---|
656 | DECLR3CALLBACKMEMBER(int, pfnSSMGetGCPhys32,(PSSMHANDLE pSSM, PRTGCPHYS32 pGCPhys));
|
---|
657 | DECLR3CALLBACKMEMBER(int, pfnSSMGetGCPhys32V,(PSSMHANDLE pSSM, RTGCPHYS32 volatile *pGCPhys));
|
---|
658 | DECLR3CALLBACKMEMBER(int, pfnSSMGetGCPhys64,(PSSMHANDLE pSSM, PRTGCPHYS64 pGCPhys));
|
---|
659 | DECLR3CALLBACKMEMBER(int, pfnSSMGetGCPhys64V,(PSSMHANDLE pSSM, RTGCPHYS64 volatile *pGCPhys));
|
---|
660 | DECLR3CALLBACKMEMBER(int, pfnSSMGetGCPhys,(PSSMHANDLE pSSM, PRTGCPHYS pGCPhys));
|
---|
661 | DECLR3CALLBACKMEMBER(int, pfnSSMGetGCPhysV,(PSSMHANDLE pSSM, RTGCPHYS volatile *pGCPhys));
|
---|
662 | DECLR3CALLBACKMEMBER(int, pfnSSMGetUInt,(PSSMHANDLE pSSM, PRTUINT pu));
|
---|
663 | DECLR3CALLBACKMEMBER(int, pfnSSMGetSInt,(PSSMHANDLE pSSM, PRTINT pi));
|
---|
664 | DECLR3CALLBACKMEMBER(int, pfnSSMGetGCUInt,(PSSMHANDLE pSSM, PRTGCUINT pu));
|
---|
665 | DECLR3CALLBACKMEMBER(int, pfnSSMGetGCUIntReg,(PSSMHANDLE pSSM, PRTGCUINTREG pu));
|
---|
666 | DECLR3CALLBACKMEMBER(int, pfnSSMGetGCPtr,(PSSMHANDLE pSSM, PRTGCPTR pGCPtr));
|
---|
667 | DECLR3CALLBACKMEMBER(int, pfnSSMGetGCUIntPtr,(PSSMHANDLE pSSM, PRTGCUINTPTR pGCPtr));
|
---|
668 | DECLR3CALLBACKMEMBER(int, pfnSSMGetRCPtr,(PSSMHANDLE pSSM, PRTRCPTR pRCPtr));
|
---|
669 | DECLR3CALLBACKMEMBER(int, pfnSSMGetIOPort,(PSSMHANDLE pSSM, PRTIOPORT pIOPort));
|
---|
670 | DECLR3CALLBACKMEMBER(int, pfnSSMGetSel,(PSSMHANDLE pSSM, PRTSEL pSel));
|
---|
671 | DECLR3CALLBACKMEMBER(int, pfnSSMGetMem,(PSSMHANDLE pSSM, void *pv, size_t cb));
|
---|
672 | DECLR3CALLBACKMEMBER(int, pfnSSMGetStrZ,(PSSMHANDLE pSSM, char *psz, size_t cbMax));
|
---|
673 | DECLR3CALLBACKMEMBER(int, pfnSSMGetStrZEx,(PSSMHANDLE pSSM, char *psz, size_t cbMax, size_t *pcbStr));
|
---|
674 | DECLR3CALLBACKMEMBER(int, pfnSSMSkip,(PSSMHANDLE pSSM, size_t cb));
|
---|
675 | DECLR3CALLBACKMEMBER(int, pfnSSMSkipToEndOfUnit,(PSSMHANDLE pSSM));
|
---|
676 | DECLR3CALLBACKMEMBER(int, pfnSSMSetLoadError,(PSSMHANDLE pSSM, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(6, 7));
|
---|
677 | DECLR3CALLBACKMEMBER(int, pfnSSMSetLoadErrorV,(PSSMHANDLE pSSM, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(6, 0));
|
---|
678 | DECLR3CALLBACKMEMBER(int, pfnSSMSetCfgError,(PSSMHANDLE pSSM, RT_SRC_POS_DECL, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(5, 6));
|
---|
679 | DECLR3CALLBACKMEMBER(int, pfnSSMSetCfgErrorV,(PSSMHANDLE pSSM, RT_SRC_POS_DECL, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(5, 0));
|
---|
680 | DECLR3CALLBACKMEMBER(int, pfnSSMHandleGetStatus,(PSSMHANDLE pSSM));
|
---|
681 | DECLR3CALLBACKMEMBER(SSMAFTER, pfnSSMHandleGetAfter,(PSSMHANDLE pSSM));
|
---|
682 | DECLR3CALLBACKMEMBER(bool, pfnSSMHandleIsLiveSave,(PSSMHANDLE pSSM));
|
---|
683 | DECLR3CALLBACKMEMBER(uint32_t, pfnSSMHandleMaxDowntime,(PSSMHANDLE pSSM));
|
---|
684 | DECLR3CALLBACKMEMBER(uint32_t, pfnSSMHandleHostBits,(PSSMHANDLE pSSM));
|
---|
685 | DECLR3CALLBACKMEMBER(uint32_t, pfnSSMHandleRevision,(PSSMHANDLE pSSM));
|
---|
686 | DECLR3CALLBACKMEMBER(uint32_t, pfnSSMHandleVersion,(PSSMHANDLE pSSM));
|
---|
687 | DECLR3CALLBACKMEMBER(const char *, pfnSSMHandleHostOSAndArch,(PSSMHANDLE pSSM));
|
---|
688 | /** @} */
|
---|
689 |
|
---|
690 | /** @name Exported CFGM Functions.
|
---|
691 | * @{ */
|
---|
692 | DECLR3CALLBACKMEMBER(bool, pfnCFGMExists,( PCFGMNODE pNode, const char *pszName));
|
---|
693 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryType,( PCFGMNODE pNode, const char *pszName, PCFGMVALUETYPE penmType));
|
---|
694 | DECLR3CALLBACKMEMBER(int, pfnCFGMQuerySize,( PCFGMNODE pNode, const char *pszName, size_t *pcb));
|
---|
695 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryInteger,( PCFGMNODE pNode, const char *pszName, uint64_t *pu64));
|
---|
696 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryIntegerDef,( PCFGMNODE pNode, const char *pszName, uint64_t *pu64, uint64_t u64Def));
|
---|
697 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryString,( PCFGMNODE pNode, const char *pszName, char *pszString, size_t cchString));
|
---|
698 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryStringDef,( PCFGMNODE pNode, const char *pszName, char *pszString, size_t cchString, const char *pszDef));
|
---|
699 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryBytes,( PCFGMNODE pNode, const char *pszName, void *pvData, size_t cbData));
|
---|
700 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryU64,( PCFGMNODE pNode, const char *pszName, uint64_t *pu64));
|
---|
701 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryU64Def,( PCFGMNODE pNode, const char *pszName, uint64_t *pu64, uint64_t u64Def));
|
---|
702 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryS64,( PCFGMNODE pNode, const char *pszName, int64_t *pi64));
|
---|
703 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryS64Def,( PCFGMNODE pNode, const char *pszName, int64_t *pi64, int64_t i64Def));
|
---|
704 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryU32,( PCFGMNODE pNode, const char *pszName, uint32_t *pu32));
|
---|
705 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryU32Def,( PCFGMNODE pNode, const char *pszName, uint32_t *pu32, uint32_t u32Def));
|
---|
706 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryS32,( PCFGMNODE pNode, const char *pszName, int32_t *pi32));
|
---|
707 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryS32Def,( PCFGMNODE pNode, const char *pszName, int32_t *pi32, int32_t i32Def));
|
---|
708 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryU16,( PCFGMNODE pNode, const char *pszName, uint16_t *pu16));
|
---|
709 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryU16Def,( PCFGMNODE pNode, const char *pszName, uint16_t *pu16, uint16_t u16Def));
|
---|
710 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryS16,( PCFGMNODE pNode, const char *pszName, int16_t *pi16));
|
---|
711 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryS16Def,( PCFGMNODE pNode, const char *pszName, int16_t *pi16, int16_t i16Def));
|
---|
712 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryU8,( PCFGMNODE pNode, const char *pszName, uint8_t *pu8));
|
---|
713 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryU8Def,( PCFGMNODE pNode, const char *pszName, uint8_t *pu8, uint8_t u8Def));
|
---|
714 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryS8,( PCFGMNODE pNode, const char *pszName, int8_t *pi8));
|
---|
715 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryS8Def,( PCFGMNODE pNode, const char *pszName, int8_t *pi8, int8_t i8Def));
|
---|
716 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryBool,( PCFGMNODE pNode, const char *pszName, bool *pf));
|
---|
717 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryBoolDef,( PCFGMNODE pNode, const char *pszName, bool *pf, bool fDef));
|
---|
718 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryPort,( PCFGMNODE pNode, const char *pszName, PRTIOPORT pPort));
|
---|
719 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryPortDef,( PCFGMNODE pNode, const char *pszName, PRTIOPORT pPort, RTIOPORT PortDef));
|
---|
720 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryUInt,( PCFGMNODE pNode, const char *pszName, unsigned int *pu));
|
---|
721 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryUIntDef,( PCFGMNODE pNode, const char *pszName, unsigned int *pu, unsigned int uDef));
|
---|
722 | DECLR3CALLBACKMEMBER(int, pfnCFGMQuerySInt,( PCFGMNODE pNode, const char *pszName, signed int *pi));
|
---|
723 | DECLR3CALLBACKMEMBER(int, pfnCFGMQuerySIntDef,( PCFGMNODE pNode, const char *pszName, signed int *pi, signed int iDef));
|
---|
724 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryGCPtr,( PCFGMNODE pNode, const char *pszName, PRTGCPTR pGCPtr));
|
---|
725 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryGCPtrDef,( PCFGMNODE pNode, const char *pszName, PRTGCPTR pGCPtr, RTGCPTR GCPtrDef));
|
---|
726 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryGCPtrU,( PCFGMNODE pNode, const char *pszName, PRTGCUINTPTR pGCPtr));
|
---|
727 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryGCPtrUDef,( PCFGMNODE pNode, const char *pszName, PRTGCUINTPTR pGCPtr, RTGCUINTPTR GCPtrDef));
|
---|
728 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryGCPtrS,( PCFGMNODE pNode, const char *pszName, PRTGCINTPTR pGCPtr));
|
---|
729 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryGCPtrSDef,( PCFGMNODE pNode, const char *pszName, PRTGCINTPTR pGCPtr, RTGCINTPTR GCPtrDef));
|
---|
730 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryStringAlloc,( PCFGMNODE pNode, const char *pszName, char **ppszString));
|
---|
731 | DECLR3CALLBACKMEMBER(int, pfnCFGMQueryStringAllocDef,(PCFGMNODE pNode, const char *pszName, char **ppszString, const char *pszDef));
|
---|
732 | DECLR3CALLBACKMEMBER(PCFGMNODE, pfnCFGMGetParent,(PCFGMNODE pNode));
|
---|
733 | DECLR3CALLBACKMEMBER(PCFGMNODE, pfnCFGMGetChild,(PCFGMNODE pNode, const char *pszPath));
|
---|
734 | DECLR3CALLBACKMEMBER(PCFGMNODE, pfnCFGMGetChildF,(PCFGMNODE pNode, const char *pszPathFormat, ...) RT_IPRT_FORMAT_ATTR(2, 3));
|
---|
735 | DECLR3CALLBACKMEMBER(PCFGMNODE, pfnCFGMGetChildFV,(PCFGMNODE pNode, const char *pszPathFormat, va_list Args) RT_IPRT_FORMAT_ATTR(3, 0));
|
---|
736 | DECLR3CALLBACKMEMBER(PCFGMNODE, pfnCFGMGetFirstChild,(PCFGMNODE pNode));
|
---|
737 | DECLR3CALLBACKMEMBER(PCFGMNODE, pfnCFGMGetNextChild,(PCFGMNODE pCur));
|
---|
738 | DECLR3CALLBACKMEMBER(int, pfnCFGMGetName,(PCFGMNODE pCur, char *pszName, size_t cchName));
|
---|
739 | DECLR3CALLBACKMEMBER(size_t, pfnCFGMGetNameLen,(PCFGMNODE pCur));
|
---|
740 | DECLR3CALLBACKMEMBER(bool, pfnCFGMAreChildrenValid,(PCFGMNODE pNode, const char *pszzValid));
|
---|
741 | DECLR3CALLBACKMEMBER(PCFGMLEAF, pfnCFGMGetFirstValue,(PCFGMNODE pCur));
|
---|
742 | DECLR3CALLBACKMEMBER(PCFGMLEAF, pfnCFGMGetNextValue,(PCFGMLEAF pCur));
|
---|
743 | DECLR3CALLBACKMEMBER(int, pfnCFGMGetValueName,(PCFGMLEAF pCur, char *pszName, size_t cchName));
|
---|
744 | DECLR3CALLBACKMEMBER(size_t, pfnCFGMGetValueNameLen,(PCFGMLEAF pCur));
|
---|
745 | DECLR3CALLBACKMEMBER(CFGMVALUETYPE, pfnCFGMGetValueType,(PCFGMLEAF pCur));
|
---|
746 | DECLR3CALLBACKMEMBER(bool, pfnCFGMAreValuesValid,(PCFGMNODE pNode, const char *pszzValid));
|
---|
747 | DECLR3CALLBACKMEMBER(int, pfnCFGMValidateConfig,(PCFGMNODE pNode, const char *pszNode,
|
---|
748 | const char *pszValidValues, const char *pszValidNodes,
|
---|
749 | const char *pszWho, uint32_t uInstance));
|
---|
750 | /** @} */
|
---|
751 |
|
---|
752 | /**
|
---|
753 | * Register a STAM sample.
|
---|
754 | *
|
---|
755 | * Use the PDMUsbHlpSTAMRegister wrapper.
|
---|
756 | *
|
---|
757 | * @param pUsbIns The USB device instance.
|
---|
758 | * @param pvSample Pointer to the sample.
|
---|
759 | * @param enmType Sample type. This indicates what pvSample is pointing at.
|
---|
760 | * @param enmVisibility Visibility type specifying whether unused statistics should be visible or not.
|
---|
761 | * @param enmUnit Sample unit.
|
---|
762 | * @param pszDesc Sample description.
|
---|
763 | * @param pszName The sample name format string.
|
---|
764 | * @param va Arguments to the format string.
|
---|
765 | */
|
---|
766 | DECLR3CALLBACKMEMBER(void, pfnSTAMRegisterV,(PPDMUSBINS pUsbIns, void *pvSample, STAMTYPE enmType,
|
---|
767 | STAMVISIBILITY enmVisibility, STAMUNIT enmUnit, const char *pszDesc,
|
---|
768 | const char *pszName, va_list va) RT_IPRT_FORMAT_ATTR(7, 0));
|
---|
769 |
|
---|
770 | /**
|
---|
771 | * Creates a timer.
|
---|
772 | *
|
---|
773 | * @returns VBox status.
|
---|
774 | * @param pUsbIns The USB device instance.
|
---|
775 | * @param enmClock The clock to use on this timer.
|
---|
776 | * @param pfnCallback Callback function.
|
---|
777 | * @param pvUser User argument for the callback.
|
---|
778 | * @param fFlags Flags, see TMTIMER_FLAGS_*.
|
---|
779 | * @param pszDesc Pointer to description string which must stay around
|
---|
780 | * until the timer is fully destroyed (i.e. a bit after TMTimerDestroy()).
|
---|
781 | * @param phTimer Where to store the timer handle on success.
|
---|
782 | */
|
---|
783 | DECLR3CALLBACKMEMBER(int, pfnTimerCreate,(PPDMUSBINS pUsbIns, TMCLOCK enmClock, PFNTMTIMERUSB pfnCallback, void *pvUser,
|
---|
784 | uint32_t fFlags, const char *pszDesc, PTMTIMERHANDLE phTimer));
|
---|
785 |
|
---|
786 | /** @name Timer handle method wrappers
|
---|
787 | * @{ */
|
---|
788 | DECLR3CALLBACKMEMBER(uint64_t, pfnTimerFromMicro,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cMicroSecs));
|
---|
789 | DECLR3CALLBACKMEMBER(uint64_t, pfnTimerFromMilli,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cMilliSecs));
|
---|
790 | DECLR3CALLBACKMEMBER(uint64_t, pfnTimerFromNano,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cNanoSecs));
|
---|
791 | DECLR3CALLBACKMEMBER(uint64_t, pfnTimerGet,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer));
|
---|
792 | DECLR3CALLBACKMEMBER(uint64_t, pfnTimerGetFreq,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer));
|
---|
793 | DECLR3CALLBACKMEMBER(uint64_t, pfnTimerGetNano,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer));
|
---|
794 | DECLR3CALLBACKMEMBER(bool, pfnTimerIsActive,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer));
|
---|
795 | DECLR3CALLBACKMEMBER(bool, pfnTimerIsLockOwner,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer));
|
---|
796 | DECLR3CALLBACKMEMBER(int, pfnTimerLockClock,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer));
|
---|
797 | /** Takes the clock lock then enters the specified critical section. */
|
---|
798 | DECLR3CALLBACKMEMBER(int, pfnTimerLockClock2,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect));
|
---|
799 | DECLR3CALLBACKMEMBER(int, pfnTimerSet,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t uExpire));
|
---|
800 | DECLR3CALLBACKMEMBER(int, pfnTimerSetFrequencyHint,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint32_t uHz));
|
---|
801 | DECLR3CALLBACKMEMBER(int, pfnTimerSetMicro,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cMicrosToNext));
|
---|
802 | DECLR3CALLBACKMEMBER(int, pfnTimerSetMillies,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cMilliesToNext));
|
---|
803 | DECLR3CALLBACKMEMBER(int, pfnTimerSetNano,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cNanosToNext));
|
---|
804 | DECLR3CALLBACKMEMBER(int, pfnTimerSetRelative,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cTicksToNext, uint64_t *pu64Now));
|
---|
805 | DECLR3CALLBACKMEMBER(int, pfnTimerStop,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer));
|
---|
806 | DECLR3CALLBACKMEMBER(void, pfnTimerUnlockClock,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer));
|
---|
807 | DECLR3CALLBACKMEMBER(void, pfnTimerUnlockClock2,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect));
|
---|
808 | DECLR3CALLBACKMEMBER(int, pfnTimerSetCritSect,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect));
|
---|
809 | DECLR3CALLBACKMEMBER(int, pfnTimerSave,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, PSSMHANDLE pSSM));
|
---|
810 | DECLR3CALLBACKMEMBER(int, pfnTimerLoad,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, PSSMHANDLE pSSM));
|
---|
811 | DECLR3CALLBACKMEMBER(int, pfnTimerDestroy,(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer));
|
---|
812 | /** @sa TMR3TimerSkip */
|
---|
813 | DECLR3CALLBACKMEMBER(int, pfnTimerSkipLoad,(PSSMHANDLE pSSM, bool *pfActive));
|
---|
814 | /** @} */
|
---|
815 |
|
---|
816 | /**
|
---|
817 | * Set the VM error message
|
---|
818 | *
|
---|
819 | * @returns rc.
|
---|
820 | * @param pUsbIns The USB device instance.
|
---|
821 | * @param rc VBox status code.
|
---|
822 | * @param SRC_POS Use RT_SRC_POS.
|
---|
823 | * @param pszFormat Error message format string.
|
---|
824 | * @param va Error message arguments.
|
---|
825 | */
|
---|
826 | DECLR3CALLBACKMEMBER(int, pfnVMSetErrorV,(PPDMUSBINS pUsbIns, int rc, RT_SRC_POS_DECL,
|
---|
827 | const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(6, 0));
|
---|
828 |
|
---|
829 | /**
|
---|
830 | * Set the VM runtime error message
|
---|
831 | *
|
---|
832 | * @returns VBox status code.
|
---|
833 | * @param pUsbIns The USB device instance.
|
---|
834 | * @param fFlags The action flags. See VMSETRTERR_FLAGS_*.
|
---|
835 | * @param pszErrorId Error ID string.
|
---|
836 | * @param pszFormat Error message format string.
|
---|
837 | * @param va Error message arguments.
|
---|
838 | */
|
---|
839 | DECLR3CALLBACKMEMBER(int, pfnVMSetRuntimeErrorV,(PPDMUSBINS pUsbIns, uint32_t fFlags, const char *pszErrorId,
|
---|
840 | const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(4, 0));
|
---|
841 |
|
---|
842 | /**
|
---|
843 | * Gets the VM state.
|
---|
844 | *
|
---|
845 | * @returns VM state.
|
---|
846 | * @param pUsbIns The USB device instance.
|
---|
847 | * @thread Any thread (just keep in mind that it's volatile info).
|
---|
848 | */
|
---|
849 | DECLR3CALLBACKMEMBER(VMSTATE, pfnVMState, (PPDMUSBINS pUsbIns));
|
---|
850 |
|
---|
851 | /**
|
---|
852 | * Creates a PDM thread.
|
---|
853 | *
|
---|
854 | * This differs from the RTThreadCreate() API in that PDM takes care of suspending,
|
---|
855 | * resuming, and destroying the thread as the VM state changes.
|
---|
856 | *
|
---|
857 | * @returns VBox status code.
|
---|
858 | * @param pUsbIns The USB device instance.
|
---|
859 | * @param ppThread Where to store the thread 'handle'.
|
---|
860 | * @param pvUser The user argument to the thread function.
|
---|
861 | * @param pfnThread The thread function.
|
---|
862 | * @param pfnWakeup The wakup callback. This is called on the EMT
|
---|
863 | * thread when a state change is pending.
|
---|
864 | * @param cbStack See RTThreadCreate.
|
---|
865 | * @param enmType See RTThreadCreate.
|
---|
866 | * @param pszName See RTThreadCreate.
|
---|
867 | */
|
---|
868 | DECLR3CALLBACKMEMBER(int, pfnThreadCreate,(PPDMUSBINS pUsbIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADUSB pfnThread,
|
---|
869 | PFNPDMTHREADWAKEUPUSB pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName));
|
---|
870 |
|
---|
871 | /** @name Exported PDM Thread Functions
|
---|
872 | * @{ */
|
---|
873 | DECLR3CALLBACKMEMBER(int, pfnThreadDestroy,(PPDMTHREAD pThread, int *pRcThread));
|
---|
874 | DECLR3CALLBACKMEMBER(int, pfnThreadIAmSuspending,(PPDMTHREAD pThread));
|
---|
875 | DECLR3CALLBACKMEMBER(int, pfnThreadIAmRunning,(PPDMTHREAD pThread));
|
---|
876 | DECLR3CALLBACKMEMBER(int, pfnThreadSleep,(PPDMTHREAD pThread, RTMSINTERVAL cMillies));
|
---|
877 | DECLR3CALLBACKMEMBER(int, pfnThreadSuspend,(PPDMTHREAD pThread));
|
---|
878 | DECLR3CALLBACKMEMBER(int, pfnThreadResume,(PPDMTHREAD pThread));
|
---|
879 | /** @} */
|
---|
880 |
|
---|
881 | /**
|
---|
882 | * Set up asynchronous handling of a suspend, reset or power off notification.
|
---|
883 | *
|
---|
884 | * This shall only be called when getting the notification. It must be called
|
---|
885 | * for each one.
|
---|
886 | *
|
---|
887 | * @returns VBox status code.
|
---|
888 | * @param pUsbIns The USB device instance.
|
---|
889 | * @param pfnAsyncNotify The callback.
|
---|
890 | * @thread EMT(0)
|
---|
891 | */
|
---|
892 | DECLR3CALLBACKMEMBER(int, pfnSetAsyncNotification, (PPDMUSBINS pUSbIns, PFNPDMUSBASYNCNOTIFY pfnAsyncNotify));
|
---|
893 |
|
---|
894 | /**
|
---|
895 | * Notify EMT(0) that the device has completed the asynchronous notification
|
---|
896 | * handling.
|
---|
897 | *
|
---|
898 | * This can be called at any time, spurious calls will simply be ignored.
|
---|
899 | *
|
---|
900 | * @param pUsbIns The USB device instance.
|
---|
901 | * @thread Any
|
---|
902 | */
|
---|
903 | DECLR3CALLBACKMEMBER(void, pfnAsyncNotificationCompleted, (PPDMUSBINS pUsbIns));
|
---|
904 |
|
---|
905 | /**
|
---|
906 | * Gets the reason for the most recent VM suspend.
|
---|
907 | *
|
---|
908 | * @returns The suspend reason. VMSUSPENDREASON_INVALID is returned if no
|
---|
909 | * suspend has been made or if the pUsbIns is invalid.
|
---|
910 | * @param pUsbIns The driver instance.
|
---|
911 | */
|
---|
912 | DECLR3CALLBACKMEMBER(VMSUSPENDREASON, pfnVMGetSuspendReason,(PPDMUSBINS pUsbIns));
|
---|
913 |
|
---|
914 | /**
|
---|
915 | * Gets the reason for the most recent VM resume.
|
---|
916 | *
|
---|
917 | * @returns The resume reason. VMRESUMEREASON_INVALID is returned if no
|
---|
918 | * resume has been made or if the pUsbIns is invalid.
|
---|
919 | * @param pUsbIns The driver instance.
|
---|
920 | */
|
---|
921 | DECLR3CALLBACKMEMBER(VMRESUMEREASON, pfnVMGetResumeReason,(PPDMUSBINS pUsbIns));
|
---|
922 |
|
---|
923 | /**
|
---|
924 | * Queries a generic object from the VMM user.
|
---|
925 | *
|
---|
926 | * @returns Pointer to the object if found, NULL if not.
|
---|
927 | * @param pUsbIns The USB device instance.
|
---|
928 | * @param pUuid The UUID of what's being queried. The UUIDs and
|
---|
929 | * the usage conventions are defined by the user.
|
---|
930 | */
|
---|
931 | DECLR3CALLBACKMEMBER(void *, pfnQueryGenericUserObject,(PPDMUSBINS pUsbIns, PCRTUUID pUuid));
|
---|
932 |
|
---|
933 | /** @name Space reserved for minor interface changes.
|
---|
934 | * @{ */
|
---|
935 | DECLR3CALLBACKMEMBER(void, pfnReserved0,(PPDMUSBINS pUsbIns));
|
---|
936 | DECLR3CALLBACKMEMBER(void, pfnReserved1,(PPDMUSBINS pUsbIns));
|
---|
937 | DECLR3CALLBACKMEMBER(void, pfnReserved2,(PPDMUSBINS pUsbIns));
|
---|
938 | DECLR3CALLBACKMEMBER(void, pfnReserved3,(PPDMUSBINS pUsbIns));
|
---|
939 | DECLR3CALLBACKMEMBER(void, pfnReserved4,(PPDMUSBINS pUsbIns));
|
---|
940 | DECLR3CALLBACKMEMBER(void, pfnReserved5,(PPDMUSBINS pUsbIns));
|
---|
941 | DECLR3CALLBACKMEMBER(void, pfnReserved6,(PPDMUSBINS pUsbIns));
|
---|
942 | DECLR3CALLBACKMEMBER(void, pfnReserved7,(PPDMUSBINS pUsbIns));
|
---|
943 | DECLR3CALLBACKMEMBER(void, pfnReserved8,(PPDMUSBINS pUsbIns));
|
---|
944 | /** @} */
|
---|
945 |
|
---|
946 | /** Just a safety precaution. */
|
---|
947 | uint32_t u32TheEnd;
|
---|
948 | } PDMUSBHLP;
|
---|
949 | /** Pointer PDM USB Device API. */
|
---|
950 | typedef PDMUSBHLP *PPDMUSBHLP;
|
---|
951 | /** Pointer const PDM USB Device API. */
|
---|
952 | typedef const PDMUSBHLP *PCPDMUSBHLP;
|
---|
953 |
|
---|
954 | /** Current USBHLP version number. */
|
---|
955 | #define PDM_USBHLP_VERSION PDM_VERSION_MAKE(0xeefe, 7, 0)
|
---|
956 |
|
---|
957 | #endif /* IN_RING3 */
|
---|
958 |
|
---|
959 | /**
|
---|
960 | * PDM USB Device Instance.
|
---|
961 | */
|
---|
962 | typedef struct PDMUSBINS
|
---|
963 | {
|
---|
964 | /** Structure version. PDM_USBINS_VERSION defines the current version. */
|
---|
965 | uint32_t u32Version;
|
---|
966 | /** USB device instance number. */
|
---|
967 | uint32_t iInstance;
|
---|
968 | /** The base interface of the device.
|
---|
969 | * The device constructor initializes this if it has any device level
|
---|
970 | * interfaces to export. To obtain this interface call PDMR3QueryUSBDevice(). */
|
---|
971 | PDMIBASE IBase;
|
---|
972 | #if HC_ARCH_BITS == 32
|
---|
973 | uint32_t u32Alignment; /**< Alignment padding. */
|
---|
974 | #endif
|
---|
975 |
|
---|
976 | /** Internal data. */
|
---|
977 | union
|
---|
978 | {
|
---|
979 | #ifdef PDMUSBINSINT_DECLARED
|
---|
980 | PDMUSBINSINT s;
|
---|
981 | #endif
|
---|
982 | uint8_t padding[HC_ARCH_BITS == 32 ? 96 : 128];
|
---|
983 | } Internal;
|
---|
984 |
|
---|
985 | /** Pointer the PDM USB Device API. */
|
---|
986 | R3PTRTYPE(PCPDMUSBHLP) pHlpR3;
|
---|
987 | /** Pointer to the USB device registration structure. */
|
---|
988 | R3PTRTYPE(PCPDMUSBREG) pReg;
|
---|
989 | /** Configuration handle. */
|
---|
990 | R3PTRTYPE(PCFGMNODE) pCfg;
|
---|
991 | /** The (device) global configuration handle. */
|
---|
992 | R3PTRTYPE(PCFGMNODE) pCfgGlobal;
|
---|
993 | /** Pointer to device instance data. */
|
---|
994 | R3PTRTYPE(void *) pvInstanceDataR3;
|
---|
995 | /** Pointer to the VUSB Device structure.
|
---|
996 | * Internal to VUSB, don't touch.
|
---|
997 | * @todo Moved this to PDMUSBINSINT. */
|
---|
998 | R3PTRTYPE(void *) pvVUsbDev2;
|
---|
999 | /** Device name for using when logging.
|
---|
1000 | * The constructor sets this and the destructor frees it. */
|
---|
1001 | R3PTRTYPE(char *) pszName;
|
---|
1002 | /** Tracing indicator. */
|
---|
1003 | uint32_t fTracing;
|
---|
1004 | /** The tracing ID of this device. */
|
---|
1005 | uint32_t idTracing;
|
---|
1006 | /** The port/device speed. HCs and emulated devices need to know. */
|
---|
1007 | VUSBSPEED enmSpeed;
|
---|
1008 |
|
---|
1009 | /** Padding to make achInstanceData aligned at 32 byte boundary. */
|
---|
1010 | uint32_t au32Padding[HC_ARCH_BITS == 32 ? 2 : 3];
|
---|
1011 |
|
---|
1012 | /** Device instance data. The size of this area is defined
|
---|
1013 | * in the PDMUSBREG::cbInstanceData field. */
|
---|
1014 | char achInstanceData[8];
|
---|
1015 | } PDMUSBINS;
|
---|
1016 |
|
---|
1017 | /** Current USBINS version number. */
|
---|
1018 | #define PDM_USBINS_VERSION PDM_VERSION_MAKE(0xeefd, 3, 0)
|
---|
1019 |
|
---|
1020 | /**
|
---|
1021 | * Checks the structure versions of the USB device instance and USB device
|
---|
1022 | * helpers, returning if they are incompatible.
|
---|
1023 | *
|
---|
1024 | * This shall be the first statement of the constructor!
|
---|
1025 | *
|
---|
1026 | * @param pUsbIns The USB device instance pointer.
|
---|
1027 | */
|
---|
1028 | #define PDMUSB_CHECK_VERSIONS_RETURN(pUsbIns) \
|
---|
1029 | do \
|
---|
1030 | { \
|
---|
1031 | PPDMUSBINS pUsbInsTypeCheck = (pUsbIns); NOREF(pUsbInsTypeCheck); \
|
---|
1032 | AssertLogRelMsgReturn(PDM_VERSION_ARE_COMPATIBLE((pUsbIns)->u32Version, PDM_USBINS_VERSION), \
|
---|
1033 | ("DevIns=%#x mine=%#x\n", (pUsbIns)->u32Version, PDM_USBINS_VERSION), \
|
---|
1034 | VERR_PDM_USBINS_VERSION_MISMATCH); \
|
---|
1035 | AssertLogRelMsgReturn(PDM_VERSION_ARE_COMPATIBLE((pUsbIns)->pHlpR3->u32Version, PDM_USBHLP_VERSION), \
|
---|
1036 | ("DevHlp=%#x mine=%#x\n", (pUsbIns)->pHlpR3->u32Version, PDM_USBHLP_VERSION), \
|
---|
1037 | VERR_PDM_USBHLPR3_VERSION_MISMATCH); \
|
---|
1038 | } while (0)
|
---|
1039 |
|
---|
1040 | /**
|
---|
1041 | * Quietly checks the structure versions of the USB device instance and
|
---|
1042 | * USB device helpers, returning if they are incompatible.
|
---|
1043 | *
|
---|
1044 | * This shall be invoked as the first statement in the destructor!
|
---|
1045 | *
|
---|
1046 | * @param pUsbIns The USB device instance pointer.
|
---|
1047 | */
|
---|
1048 | #define PDMUSB_CHECK_VERSIONS_RETURN_VOID(pUsbIns) \
|
---|
1049 | do \
|
---|
1050 | { \
|
---|
1051 | PPDMUSBINS pUsbInsTypeCheck = (pUsbIns); NOREF(pUsbInsTypeCheck); \
|
---|
1052 | if (RT_LIKELY(PDM_VERSION_ARE_COMPATIBLE((pUsbIns)->u32Version, PDM_USBINS_VERSION) )) \
|
---|
1053 | { /* likely */ } else return; \
|
---|
1054 | if (RT_LIKELY(PDM_VERSION_ARE_COMPATIBLE((pUsbIns)->pHlpR3->u32Version, PDM_USBHLP_VERSION) )) \
|
---|
1055 | { /* likely */ } else return; \
|
---|
1056 | } while (0)
|
---|
1057 |
|
---|
1058 |
|
---|
1059 | /** Converts a pointer to the PDMUSBINS::IBase to a pointer to PDMUSBINS. */
|
---|
1060 | #define PDMIBASE_2_PDMUSB(pInterface) ( (PPDMUSBINS)((char *)(pInterface) - RT_UOFFSETOF(PDMUSBINS, IBase)) )
|
---|
1061 |
|
---|
1062 |
|
---|
1063 | /** @def PDMUSB_ASSERT_EMT
|
---|
1064 | * Assert that the current thread is the emulation thread.
|
---|
1065 | */
|
---|
1066 | #ifdef VBOX_STRICT
|
---|
1067 | # define PDMUSB_ASSERT_EMT(pUsbIns) pUsbIns->pHlpR3->pfnAssertEMT(pUsbIns, __FILE__, __LINE__, __FUNCTION__)
|
---|
1068 | #else
|
---|
1069 | # define PDMUSB_ASSERT_EMT(pUsbIns) do { } while (0)
|
---|
1070 | #endif
|
---|
1071 |
|
---|
1072 | /** @def PDMUSB_ASSERT_OTHER
|
---|
1073 | * Assert that the current thread is NOT the emulation thread.
|
---|
1074 | */
|
---|
1075 | #ifdef VBOX_STRICT
|
---|
1076 | # define PDMUSB_ASSERT_OTHER(pUsbIns) pUsbIns->pHlpR3->pfnAssertOther(pUsbIns, __FILE__, __LINE__, __FUNCTION__)
|
---|
1077 | #else
|
---|
1078 | # define PDMUSB_ASSERT_OTHER(pUsbIns) do { } while (0)
|
---|
1079 | #endif
|
---|
1080 |
|
---|
1081 | /** @def PDMUSB_SET_ERROR
|
---|
1082 | * Set the VM error. See PDMUsbHlpVMSetError() for printf like message
|
---|
1083 | * formatting.
|
---|
1084 | */
|
---|
1085 | #define PDMUSB_SET_ERROR(pUsbIns, rc, pszError) \
|
---|
1086 | PDMUsbHlpVMSetError(pUsbIns, rc, RT_SRC_POS, "%s", pszError)
|
---|
1087 |
|
---|
1088 | /** @def PDMUSB_SET_RUNTIME_ERROR
|
---|
1089 | * Set the VM runtime error. See PDMUsbHlpVMSetRuntimeError() for printf like
|
---|
1090 | * message formatting.
|
---|
1091 | */
|
---|
1092 | #define PDMUSB_SET_RUNTIME_ERROR(pUsbIns, fFlags, pszErrorId, pszError) \
|
---|
1093 | PDMUsbHlpVMSetRuntimeError(pUsbIns, fFlags, pszErrorId, "%s", pszError)
|
---|
1094 |
|
---|
1095 |
|
---|
1096 | #ifdef IN_RING3
|
---|
1097 |
|
---|
1098 | /**
|
---|
1099 | * @copydoc PDMUSBHLP::pfnDriverAttach
|
---|
1100 | */
|
---|
1101 | DECLINLINE(int) PDMUsbHlpDriverAttach(PPDMUSBINS pUsbIns, RTUINT iLun, PPDMIBASE pBaseInterface, PPDMIBASE *ppBaseInterface, const char *pszDesc)
|
---|
1102 | {
|
---|
1103 | return pUsbIns->pHlpR3->pfnDriverAttach(pUsbIns, iLun, pBaseInterface, ppBaseInterface, pszDesc);
|
---|
1104 | }
|
---|
1105 |
|
---|
1106 | /**
|
---|
1107 | * VBOX_STRICT wrapper for pHlpR3->pfnDBGFStopV.
|
---|
1108 | *
|
---|
1109 | * @returns VBox status code which must be passed up to the VMM.
|
---|
1110 | * @param pUsbIns Device instance.
|
---|
1111 | * @param SRC_POS Use RT_SRC_POS.
|
---|
1112 | * @param pszFormat Message. (optional)
|
---|
1113 | * @param ... Message parameters.
|
---|
1114 | */
|
---|
1115 | DECLINLINE(int) RT_IPRT_FORMAT_ATTR(5, 6) PDMUsbDBGFStop(PPDMUSBINS pUsbIns, RT_SRC_POS_DECL, const char *pszFormat, ...)
|
---|
1116 | {
|
---|
1117 | #ifdef VBOX_STRICT
|
---|
1118 | int rc;
|
---|
1119 | va_list va;
|
---|
1120 | va_start(va, pszFormat);
|
---|
1121 | rc = pUsbIns->pHlpR3->pfnDBGFStopV(pUsbIns, RT_SRC_POS_ARGS, pszFormat, va);
|
---|
1122 | va_end(va);
|
---|
1123 | return rc;
|
---|
1124 | #else
|
---|
1125 | NOREF(pUsbIns);
|
---|
1126 | NOREF(pszFile);
|
---|
1127 | NOREF(iLine);
|
---|
1128 | NOREF(pszFunction);
|
---|
1129 | NOREF(pszFormat);
|
---|
1130 | return VINF_SUCCESS;
|
---|
1131 | #endif
|
---|
1132 | }
|
---|
1133 |
|
---|
1134 | /**
|
---|
1135 | * @copydoc PDMUSBHLP::pfnVMState
|
---|
1136 | */
|
---|
1137 | DECLINLINE(VMSTATE) PDMUsbHlpVMState(PPDMUSBINS pUsbIns)
|
---|
1138 | {
|
---|
1139 | return pUsbIns->pHlpR3->pfnVMState(pUsbIns);
|
---|
1140 | }
|
---|
1141 |
|
---|
1142 | /**
|
---|
1143 | * @copydoc PDMUSBHLP::pfnThreadCreate
|
---|
1144 | */
|
---|
1145 | DECLINLINE(int) PDMUsbHlpThreadCreate(PPDMUSBINS pUsbIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADUSB pfnThread,
|
---|
1146 | PFNPDMTHREADWAKEUPUSB pfnWakeup, size_t cbStack, RTTHREADTYPE enmType, const char *pszName)
|
---|
1147 | {
|
---|
1148 | return pUsbIns->pHlpR3->pfnThreadCreate(pUsbIns, ppThread, pvUser, pfnThread, pfnWakeup, cbStack, enmType, pszName);
|
---|
1149 | }
|
---|
1150 |
|
---|
1151 |
|
---|
1152 | /**
|
---|
1153 | * @copydoc PDMUSBHLP::pfnSetAsyncNotification
|
---|
1154 | */
|
---|
1155 | DECLINLINE(int) PDMUsbHlpSetAsyncNotification(PPDMUSBINS pUsbIns, PFNPDMUSBASYNCNOTIFY pfnAsyncNotify)
|
---|
1156 | {
|
---|
1157 | return pUsbIns->pHlpR3->pfnSetAsyncNotification(pUsbIns, pfnAsyncNotify);
|
---|
1158 | }
|
---|
1159 |
|
---|
1160 | /**
|
---|
1161 | * @copydoc PDMUSBHLP::pfnAsyncNotificationCompleted
|
---|
1162 | */
|
---|
1163 | DECLINLINE(void) PDMUsbHlpAsyncNotificationCompleted(PPDMUSBINS pUsbIns)
|
---|
1164 | {
|
---|
1165 | pUsbIns->pHlpR3->pfnAsyncNotificationCompleted(pUsbIns);
|
---|
1166 | }
|
---|
1167 |
|
---|
1168 | /**
|
---|
1169 | * Set the VM error message
|
---|
1170 | *
|
---|
1171 | * @returns rc.
|
---|
1172 | * @param pUsbIns The USB device instance.
|
---|
1173 | * @param rc VBox status code.
|
---|
1174 | * @param SRC_POS Use RT_SRC_POS.
|
---|
1175 | * @param pszFormat Error message format string.
|
---|
1176 | * @param ... Error message arguments.
|
---|
1177 | */
|
---|
1178 | DECLINLINE(int) RT_IPRT_FORMAT_ATTR(6, 7) PDMUsbHlpVMSetError(PPDMUSBINS pUsbIns, int rc, RT_SRC_POS_DECL,
|
---|
1179 | const char *pszFormat, ...)
|
---|
1180 | {
|
---|
1181 | va_list va;
|
---|
1182 | va_start(va, pszFormat);
|
---|
1183 | rc = pUsbIns->pHlpR3->pfnVMSetErrorV(pUsbIns, rc, RT_SRC_POS_ARGS, pszFormat, va);
|
---|
1184 | va_end(va);
|
---|
1185 | return rc;
|
---|
1186 | }
|
---|
1187 |
|
---|
1188 | /**
|
---|
1189 | * @copydoc PDMUSBHLP::pfnMMHeapAlloc
|
---|
1190 | */
|
---|
1191 | DECLINLINE(void *) PDMUsbHlpMMHeapAlloc(PPDMUSBINS pUsbIns, size_t cb)
|
---|
1192 | {
|
---|
1193 | return pUsbIns->pHlpR3->pfnMMHeapAlloc(pUsbIns, cb);
|
---|
1194 | }
|
---|
1195 |
|
---|
1196 | /**
|
---|
1197 | * @copydoc PDMUSBHLP::pfnMMHeapAllocZ
|
---|
1198 | */
|
---|
1199 | DECLINLINE(void *) PDMUsbHlpMMHeapAllocZ(PPDMUSBINS pUsbIns, size_t cb)
|
---|
1200 | {
|
---|
1201 | return pUsbIns->pHlpR3->pfnMMHeapAllocZ(pUsbIns, cb);
|
---|
1202 | }
|
---|
1203 |
|
---|
1204 | /**
|
---|
1205 | * Frees memory allocated by PDMUsbHlpMMHeapAlloc or PDMUsbHlpMMHeapAllocZ.
|
---|
1206 | *
|
---|
1207 | * @param pUsbIns The USB device instance.
|
---|
1208 | * @param pv The memory to free. NULL is fine.
|
---|
1209 | */
|
---|
1210 | DECLINLINE(void) PDMUsbHlpMMHeapFree(PPDMUSBINS pUsbIns, void *pv)
|
---|
1211 | {
|
---|
1212 | pUsbIns->pHlpR3->pfnMMHeapFree(pUsbIns, pv);
|
---|
1213 | }
|
---|
1214 |
|
---|
1215 | /**
|
---|
1216 | * @copydoc PDMUSBHLP::pfnDBGFInfoRegisterArgv
|
---|
1217 | */
|
---|
1218 | DECLINLINE(int) PDMUsbHlpDBGFInfoRegisterArgv(PPDMUSBINS pUsbIns, const char *pszName, const char *pszDesc, PFNDBGFINFOARGVUSB pfnHandler)
|
---|
1219 | {
|
---|
1220 | return pUsbIns->pHlpR3->pfnDBGFInfoRegisterArgv(pUsbIns, pszName, pszDesc, pfnHandler);
|
---|
1221 | }
|
---|
1222 |
|
---|
1223 | /**
|
---|
1224 | * @copydoc PDMUSBHLP::pfnTimerCreate
|
---|
1225 | */
|
---|
1226 | DECLINLINE(int) PDMUsbHlpTimerCreate(PPDMUSBINS pUsbIns, TMCLOCK enmClock, PFNTMTIMERUSB pfnCallback, void *pvUser,
|
---|
1227 | uint32_t fFlags, const char *pszDesc, PTMTIMERHANDLE phTimer)
|
---|
1228 | {
|
---|
1229 | return pUsbIns->pHlpR3->pfnTimerCreate(pUsbIns, enmClock, pfnCallback, pvUser, fFlags, pszDesc, phTimer);
|
---|
1230 | }
|
---|
1231 |
|
---|
1232 | /**
|
---|
1233 | * @copydoc PDMUSBHLP::pfnTimerFromMicro
|
---|
1234 | */
|
---|
1235 | DECLINLINE(uint64_t) PDMUsbHlpTimerFromMicro(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cMicroSecs)
|
---|
1236 | {
|
---|
1237 | return pUsbIns->pHlpR3->pfnTimerFromMicro(pUsbIns, hTimer, cMicroSecs);
|
---|
1238 | }
|
---|
1239 |
|
---|
1240 | /**
|
---|
1241 | * @copydoc PDMUSBHLP::pfnTimerFromMilli
|
---|
1242 | */
|
---|
1243 | DECLINLINE(uint64_t) PDMUsbHlpTimerFromMilli(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cMilliSecs)
|
---|
1244 | {
|
---|
1245 | return pUsbIns->pHlpR3->pfnTimerFromMilli(pUsbIns, hTimer, cMilliSecs);
|
---|
1246 | }
|
---|
1247 |
|
---|
1248 | /**
|
---|
1249 | * @copydoc PDMUSBHLP::pfnTimerFromNano
|
---|
1250 | */
|
---|
1251 | DECLINLINE(uint64_t) PDMUsbHlpTimerFromNano(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cNanoSecs)
|
---|
1252 | {
|
---|
1253 | return pUsbIns->pHlpR3->pfnTimerFromNano(pUsbIns, hTimer, cNanoSecs);
|
---|
1254 | }
|
---|
1255 |
|
---|
1256 | /**
|
---|
1257 | * @copydoc PDMUSBHLP::pfnTimerGet
|
---|
1258 | */
|
---|
1259 | DECLINLINE(uint64_t) PDMUsbHlpTimerGet(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer)
|
---|
1260 | {
|
---|
1261 | return pUsbIns->pHlpR3->pfnTimerGet(pUsbIns, hTimer);
|
---|
1262 | }
|
---|
1263 |
|
---|
1264 | /**
|
---|
1265 | * @copydoc PDMUSBHLP::pfnTimerGetFreq
|
---|
1266 | */
|
---|
1267 | DECLINLINE(uint64_t) PDMUsbHlpTimerGetFreq(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer)
|
---|
1268 | {
|
---|
1269 | return pUsbIns->pHlpR3->pfnTimerGetFreq(pUsbIns, hTimer);
|
---|
1270 | }
|
---|
1271 |
|
---|
1272 | /**
|
---|
1273 | * @copydoc PDMUSBHLP::pfnTimerGetNano
|
---|
1274 | */
|
---|
1275 | DECLINLINE(uint64_t) PDMUsbHlpTimerGetNano(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer)
|
---|
1276 | {
|
---|
1277 | return pUsbIns->pHlpR3->pfnTimerGetNano(pUsbIns, hTimer);
|
---|
1278 | }
|
---|
1279 |
|
---|
1280 | /**
|
---|
1281 | * @copydoc PDMUSBHLP::pfnTimerIsActive
|
---|
1282 | */
|
---|
1283 | DECLINLINE(bool) PDMUsbHlpTimerIsActive(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer)
|
---|
1284 | {
|
---|
1285 | return pUsbIns->pHlpR3->pfnTimerIsActive(pUsbIns, hTimer);
|
---|
1286 | }
|
---|
1287 |
|
---|
1288 | /**
|
---|
1289 | * @copydoc PDMUSBHLP::pfnTimerIsLockOwner
|
---|
1290 | */
|
---|
1291 | DECLINLINE(bool) PDMUsbHlpTimerIsLockOwner(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer)
|
---|
1292 | {
|
---|
1293 | return pUsbIns->pHlpR3->pfnTimerIsLockOwner(pUsbIns, hTimer);
|
---|
1294 | }
|
---|
1295 |
|
---|
1296 | /**
|
---|
1297 | * @copydoc PDMUSBHLP::pfnTimerLockClock
|
---|
1298 | */
|
---|
1299 | DECLINLINE(int) PDMUsbHlpTimerLockClock(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer)
|
---|
1300 | {
|
---|
1301 | return pUsbIns->pHlpR3->pfnTimerLockClock(pUsbIns, hTimer);
|
---|
1302 | }
|
---|
1303 |
|
---|
1304 | /**
|
---|
1305 | * @copydoc PDMUSBHLP::pfnTimerLockClock2
|
---|
1306 | */
|
---|
1307 | DECLINLINE(int) PDMUsbHlpTimerLockClock2(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect)
|
---|
1308 | {
|
---|
1309 | return pUsbIns->pHlpR3->pfnTimerLockClock2(pUsbIns, hTimer, pCritSect);
|
---|
1310 | }
|
---|
1311 |
|
---|
1312 | /**
|
---|
1313 | * @copydoc PDMUSBHLP::pfnTimerSet
|
---|
1314 | */
|
---|
1315 | DECLINLINE(int) PDMUsbHlpTimerSet(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t uExpire)
|
---|
1316 | {
|
---|
1317 | return pUsbIns->pHlpR3->pfnTimerSet(pUsbIns, hTimer, uExpire);
|
---|
1318 | }
|
---|
1319 |
|
---|
1320 | /**
|
---|
1321 | * @copydoc PDMUSBHLP::pfnTimerSetFrequencyHint
|
---|
1322 | */
|
---|
1323 | DECLINLINE(int) PDMUsbHlpTimerSetFrequencyHint(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint32_t uHz)
|
---|
1324 | {
|
---|
1325 | return pUsbIns->pHlpR3->pfnTimerSetFrequencyHint(pUsbIns, hTimer, uHz);
|
---|
1326 | }
|
---|
1327 |
|
---|
1328 | /**
|
---|
1329 | * @copydoc PDMUSBHLP::pfnTimerSetMicro
|
---|
1330 | */
|
---|
1331 | DECLINLINE(int) PDMUsbHlpTimerSetMicro(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cMicrosToNext)
|
---|
1332 | {
|
---|
1333 | return pUsbIns->pHlpR3->pfnTimerSetMicro(pUsbIns, hTimer, cMicrosToNext);
|
---|
1334 | }
|
---|
1335 |
|
---|
1336 | /**
|
---|
1337 | * @copydoc PDMUSBHLP::pfnTimerSetMillies
|
---|
1338 | */
|
---|
1339 | DECLINLINE(int) PDMUsbHlpTimerSetMillies(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cMilliesToNext)
|
---|
1340 | {
|
---|
1341 | return pUsbIns->pHlpR3->pfnTimerSetMillies(pUsbIns, hTimer, cMilliesToNext);
|
---|
1342 | }
|
---|
1343 |
|
---|
1344 | /**
|
---|
1345 | * @copydoc PDMUSBHLP::pfnTimerSetNano
|
---|
1346 | */
|
---|
1347 | DECLINLINE(int) PDMUsbHlpTimerSetNano(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cNanosToNext)
|
---|
1348 | {
|
---|
1349 | return pUsbIns->pHlpR3->pfnTimerSetNano(pUsbIns, hTimer, cNanosToNext);
|
---|
1350 | }
|
---|
1351 |
|
---|
1352 | /**
|
---|
1353 | * @copydoc PDMUSBHLP::pfnTimerSetRelative
|
---|
1354 | */
|
---|
1355 | DECLINLINE(int) PDMUsbHlpTimerSetRelative(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, uint64_t cTicksToNext, uint64_t *pu64Now)
|
---|
1356 | {
|
---|
1357 | return pUsbIns->pHlpR3->pfnTimerSetRelative(pUsbIns, hTimer, cTicksToNext, pu64Now);
|
---|
1358 | }
|
---|
1359 |
|
---|
1360 | /**
|
---|
1361 | * @copydoc PDMUSBHLP::pfnTimerStop
|
---|
1362 | */
|
---|
1363 | DECLINLINE(int) PDMUsbHlpTimerStop(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer)
|
---|
1364 | {
|
---|
1365 | return pUsbIns->pHlpR3->pfnTimerStop(pUsbIns, hTimer);
|
---|
1366 | }
|
---|
1367 |
|
---|
1368 | /**
|
---|
1369 | * @copydoc PDMUSBHLP::pfnTimerUnlockClock
|
---|
1370 | */
|
---|
1371 | DECLINLINE(void) PDMUsbHlpTimerUnlockClock(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer)
|
---|
1372 | {
|
---|
1373 | pUsbIns->pHlpR3->pfnTimerUnlockClock(pUsbIns, hTimer);
|
---|
1374 | }
|
---|
1375 |
|
---|
1376 | /**
|
---|
1377 | * @copydoc PDMUSBHLP::pfnTimerUnlockClock2
|
---|
1378 | */
|
---|
1379 | DECLINLINE(void) PDMUsbHlpTimerUnlockClock2(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect)
|
---|
1380 | {
|
---|
1381 | pUsbIns->pHlpR3->pfnTimerUnlockClock2(pUsbIns, hTimer, pCritSect);
|
---|
1382 | }
|
---|
1383 |
|
---|
1384 | /**
|
---|
1385 | * @copydoc PDMUSBHLP::pfnTimerSetCritSect
|
---|
1386 | */
|
---|
1387 | DECLINLINE(int) PDMUsbHlpTimerSetCritSect(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, PPDMCRITSECT pCritSect)
|
---|
1388 | {
|
---|
1389 | return pUsbIns->pHlpR3->pfnTimerSetCritSect(pUsbIns, hTimer, pCritSect);
|
---|
1390 | }
|
---|
1391 |
|
---|
1392 | /**
|
---|
1393 | * @copydoc PDMUSBHLP::pfnTimerSave
|
---|
1394 | */
|
---|
1395 | DECLINLINE(int) PDMUsbHlpTimerSave(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, PSSMHANDLE pSSM)
|
---|
1396 | {
|
---|
1397 | return pUsbIns->pHlpR3->pfnTimerSave(pUsbIns, hTimer, pSSM);
|
---|
1398 | }
|
---|
1399 |
|
---|
1400 | /**
|
---|
1401 | * @copydoc PDMUSBHLP::pfnTimerLoad
|
---|
1402 | */
|
---|
1403 | DECLINLINE(int) PDMUsbHlpTimerLoad(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer, PSSMHANDLE pSSM)
|
---|
1404 | {
|
---|
1405 | return pUsbIns->pHlpR3->pfnTimerLoad(pUsbIns, hTimer, pSSM);
|
---|
1406 | }
|
---|
1407 |
|
---|
1408 | /**
|
---|
1409 | * @copydoc PDMUSBHLP::pfnTimerDestroy
|
---|
1410 | */
|
---|
1411 | DECLINLINE(int) PDMUsbHlpTimerDestroy(PPDMUSBINS pUsbIns, TMTIMERHANDLE hTimer)
|
---|
1412 | {
|
---|
1413 | return pUsbIns->pHlpR3->pfnTimerDestroy(pUsbIns, hTimer);
|
---|
1414 | }
|
---|
1415 |
|
---|
1416 | /**
|
---|
1417 | * @copydoc PDMUSBHLP::pfnSSMRegister
|
---|
1418 | */
|
---|
1419 | DECLINLINE(int) PDMUsbHlpSSMRegister(PPDMUSBINS pUsbIns, uint32_t uVersion, size_t cbGuess,
|
---|
1420 | PFNSSMUSBLIVEPREP pfnLivePrep, PFNSSMUSBLIVEEXEC pfnLiveExec, PFNSSMUSBLIVEVOTE pfnLiveVote,
|
---|
1421 | PFNSSMUSBSAVEPREP pfnSavePrep, PFNSSMUSBSAVEEXEC pfnSaveExec, PFNSSMUSBSAVEDONE pfnSaveDone,
|
---|
1422 | PFNSSMUSBLOADPREP pfnLoadPrep, PFNSSMUSBLOADEXEC pfnLoadExec, PFNSSMUSBLOADDONE pfnLoadDone)
|
---|
1423 | {
|
---|
1424 | return pUsbIns->pHlpR3->pfnSSMRegister(pUsbIns, uVersion, cbGuess,
|
---|
1425 | pfnLivePrep, pfnLiveExec, pfnLiveVote,
|
---|
1426 | pfnSavePrep, pfnSaveExec, pfnSaveDone,
|
---|
1427 | pfnLoadPrep, pfnLoadExec, pfnLoadDone);
|
---|
1428 | }
|
---|
1429 |
|
---|
1430 | /**
|
---|
1431 | * @copydoc PDMUSBHLP::pfnQueryGenericUserObject
|
---|
1432 | */
|
---|
1433 | DECLINLINE(void *) PDMUsbHlpQueryGenericUserObject(PPDMUSBINS pUsbIns, PCRTUUID pUuid)
|
---|
1434 | {
|
---|
1435 | return pUsbIns->pHlpR3->pfnQueryGenericUserObject(pUsbIns, pUuid);
|
---|
1436 | }
|
---|
1437 |
|
---|
1438 | #endif /* IN_RING3 */
|
---|
1439 |
|
---|
1440 |
|
---|
1441 |
|
---|
1442 | /** Pointer to callbacks provided to the VBoxUsbRegister() call. */
|
---|
1443 | typedef const struct PDMUSBREGCB *PCPDMUSBREGCB;
|
---|
1444 |
|
---|
1445 | /**
|
---|
1446 | * Callbacks for VBoxUSBDeviceRegister().
|
---|
1447 | */
|
---|
1448 | typedef struct PDMUSBREGCB
|
---|
1449 | {
|
---|
1450 | /** Interface version.
|
---|
1451 | * This is set to PDM_USBREG_CB_VERSION. */
|
---|
1452 | uint32_t u32Version;
|
---|
1453 |
|
---|
1454 | /**
|
---|
1455 | * Registers a device with the current VM instance.
|
---|
1456 | *
|
---|
1457 | * @returns VBox status code.
|
---|
1458 | * @param pCallbacks Pointer to the callback table.
|
---|
1459 | * @param pReg Pointer to the USB device registration record.
|
---|
1460 | * This data must be permanent and readonly.
|
---|
1461 | */
|
---|
1462 | DECLR3CALLBACKMEMBER(int, pfnRegister,(PCPDMUSBREGCB pCallbacks, PCPDMUSBREG pReg));
|
---|
1463 | } PDMUSBREGCB;
|
---|
1464 |
|
---|
1465 | /** Current version of the PDMUSBREGCB structure. */
|
---|
1466 | #define PDM_USBREG_CB_VERSION PDM_VERSION_MAKE(0xeefc, 1, 0)
|
---|
1467 |
|
---|
1468 |
|
---|
1469 | /**
|
---|
1470 | * The VBoxUsbRegister callback function.
|
---|
1471 | *
|
---|
1472 | * PDM will invoke this function after loading a USB device module and letting
|
---|
1473 | * the module decide which devices to register and how to handle conflicts.
|
---|
1474 | *
|
---|
1475 | * @returns VBox status code.
|
---|
1476 | * @param pCallbacks Pointer to the callback table.
|
---|
1477 | * @param u32Version VBox version number.
|
---|
1478 | */
|
---|
1479 | typedef DECLCALLBACKTYPE(int, FNPDMVBOXUSBREGISTER,(PCPDMUSBREGCB pCallbacks, uint32_t u32Version));
|
---|
1480 |
|
---|
1481 | VMMR3DECL(int) PDMR3UsbCreateEmulatedDevice(PUVM pUVM, const char *pszDeviceName, PCFGMNODE pDeviceNode, PCRTUUID pUuid,
|
---|
1482 | const char *pszCaptureFilename);
|
---|
1483 | VMMR3DECL(int) PDMR3UsbCreateProxyDevice(PUVM pUVM, PCRTUUID pUuid, const char *pszBackend, const char *pszAddress, PCFGMNODE pSubTree,
|
---|
1484 | VUSBSPEED enmSpeed, uint32_t fMaskedIfs, const char *pszCaptureFilename);
|
---|
1485 | VMMR3DECL(int) PDMR3UsbDetachDevice(PUVM pUVM, PCRTUUID pUuid);
|
---|
1486 | VMMR3DECL(bool) PDMR3UsbHasHub(PUVM pUVM);
|
---|
1487 | VMMR3DECL(int) PDMR3UsbDriverAttach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun, uint32_t fFlags,
|
---|
1488 | PPPDMIBASE ppBase);
|
---|
1489 | VMMR3DECL(int) PDMR3UsbDriverDetach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun,
|
---|
1490 | const char *pszDriver, unsigned iOccurrence, uint32_t fFlags);
|
---|
1491 | VMMR3DECL(int) PDMR3UsbQueryLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPDMIBASE *ppBase);
|
---|
1492 | VMMR3DECL(int) PDMR3UsbQueryDriverOnLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun,
|
---|
1493 | const char *pszDriver, PPPDMIBASE ppBase);
|
---|
1494 |
|
---|
1495 | /** @} */
|
---|
1496 |
|
---|
1497 | RT_C_DECLS_END
|
---|
1498 |
|
---|
1499 | #endif /* !VBOX_INCLUDED_vmm_pdmusb_h */
|
---|