VirtualBox

source: vbox/trunk/src/VBox/Devices/USB/DrvVUSBRootHub.cpp@ 28345

Last change on this file since 28345 was 27901, checked in by vboxsync, 15 years ago

OSE header fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 57.4 KB
Line 
1/* $Id: DrvVUSBRootHub.cpp 27901 2010-03-31 14:07:26Z vboxsync $ */
2/** @file
3 * Virtual USB - Root Hub Driver.
4 */
5
6/*
7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22
23/** @page pg_dev_vusb VUSB - Virtual USB
24 *
25 * @todo read thru this and correct typos. Merge with old docs.
26 *
27 *
28 * The Virtual USB component glues USB devices and host controllers together.
29 * The VUSB takes the form of a PDM driver which is attached to the HCI. USB
30 * devices are created by, attached to, and managed by the VUSB roothub. The
31 * VUSB also exposes an interface which is used by Main to attach and detach
32 * proxied USB devices.
33 *
34 *
35 * @section sec_dev_vusb_urb The Life of an URB
36 *
37 * The URB is created when the HCI calls the roothub (VUSB) method pfnNewUrb.
38 * VUSB has a pool of URBs, if no free URBs are availabe a new one is
39 * allocated. The returned URB starts life in the ALLOCATED state and all
40 * fields are initalized with sensible defaults.
41 *
42 * The HCI then copies any request data into the URB if it's an host2dev
43 * transfer. It then submits the URB by calling the pfnSubmitUrb roothub
44 * method.
45 *
46 * pfnSubmitUrb will start by checking if it knows the device address, and if
47 * it doesn't the URB is completed with a device-not-ready error. When the
48 * device address is known to it, action is taken based on the kind of
49 * transfer it is. There are four kinds of transfers: 1. control, 2. bulk,
50 * 3. interrupt, and 4. isochronous. In either case something eventually ends
51 * up being submitted to the device.
52 *
53 *
54 * If an URB fails submitting, may or may not be completed. This depends on
55 * heuristics in some cases and on the kind of failure in others. If
56 * pfnSubmitUrb returns a failure, the HCI should retry submitting it at a
57 * later time. If pfnSubmitUrb returns success the URB is submitted, and it
58 * can even been completed.
59 *
60 * The URB is in the IN_FLIGHT state from the time it's successfully submitted
61 * and till it's reaped or cancelled.
62 *
63 * When an URB transfer or in some case submit failure occurs, the pfnXferError
64 * callback of the HCI is consulted about what to do. If pfnXferError indicates
65 * that the URB should be retried, pfnSubmitUrb will fail. If it indicates that
66 * it should fail, the URB will be completed.
67 *
68 * Completing an URB means that the URB status is set and the HCI
69 * pfnXferCompletion callback is invoked with the URB. The HCI is the supposed
70 * to report the transfer status to the guest OS. After completion the URB
71 * is freed and returned to the pool, unless it was cancelled. If it was
72 * cancelled it will have to await reaping before it's actually freed.
73 *
74 *
75 * @subsection subsec_dev_vusb_urb_ctrl Control
76 *
77 * The control transfer is the most complex one, from VUSB's point of view,
78 * with its three stages and being bi-directional. A control transfer starts
79 * with a SETUP packet containing the request description and two basic
80 * parameters. It is followed by zero or more DATA packets which either picks
81 * up incoming data (dev2host) or supplies the request data (host2dev). This
82 * can then be followed by a STATUS packet which gets the status of the whole
83 * transfer.
84 *
85 * What makes the control transfer complicated is that for a host2dev request
86 * the URB is assembled from the SETUP and DATA stage, and for a dev2host
87 * request the returned data must be kept around for the DATA stage. For both
88 * transfer directions the status of the transfer has to be kept around for
89 * the STATUS stage.
90 *
91 * To complicate matters futher, VUSB must intercept and in some cases emulate
92 * some of the standard requests in order to keep the virtual device state
93 * correct and provide the correct virtualization of a device.
94 *
95 * @subsection subsec_dev_vusb_urb_bulk Bulk and Interrupt
96 *
97 * The bulk and interrupt transfer types are relativly simple compared to the
98 * control transfer. VUSB is not inspecting the request content or anything,
99 * but passes it down the device.
100 *
101 * @subsection subsec_dev_vusb_urb_bulk Isochronous
102 *
103 * This kind of transfers hasn't yet been implemented.
104 *
105 */
106
107
108/** @page pg_dev_vusb_old VUSB - Virtual USB Core
109 *
110 * The virtual USB core is controlled by the roothub and the underlying HCI
111 * emulator, it is responsible for device addressing, managing configurations,
112 * interfaces and endpoints, assembling and splitting multi-part control
113 * messages and in general acts as a middle layer between the USB device
114 * emulation code and USB HCI emulation code.
115 *
116 * All USB devices are represented by a struct vusb_dev. This structure
117 * contains things like the device state, device address, all the configuration
118 * descriptors, the currently selected configuration and a mapping between
119 * endpoint addresses and endpoint descriptors.
120 *
121 * Each vusb_dev also has a pointer to a vusb_dev_ops structure which serves as
122 * the virtual method table and includes a virtual constructor and destructor.
123 * After a vusb_dev is created it may be attached to a hub device such as a
124 * roothub (using vusbHubAttach). Although each hub structure has cPorts
125 * and cDevices fields, it is the responsibility of the hub device to allocate
126 * a free port for the new device.
127 *
128 * Devices can chose one of two interfaces for dealing with requests, the
129 * synchronous interface or the asynchronous interface. The synchronous
130 * interface is much simpler and ought to be used for devices which are
131 * unlikely to sleep for long periods in order to serve requests. The
132 * asynchronous interface on the other hand is more difficult to use but is
133 * useful for the USB proxy or if one were to write a mass storage device
134 * emulator. Currently the synchronous interface only supports control and bulk
135 * endpoints and is no longer used by anything.
136 *
137 * In order to use the asynchronous interface, the queue_urb, cancel_urb and
138 * pfnUrbReap fields must be set in the devices vusb_dev_ops structure. The
139 * queue_urb method is used to submit a request to a device without blocking,
140 * it returns 1 if successful and 0 on any kind of failure. A successfully
141 * queued URB is completed when the pfnUrbReap method returns it. Each function
142 * address is reference counted so that pfnUrbReap will only be called if there
143 * are URBs outstanding. For a roothub to reap an URB from any one of it's
144 * devices, the vusbRhReapAsyncUrbs() function is used.
145 *
146 * There are four types of messages an URB may contain:
147 * -# Control - represents a single packet of a multi-packet control
148 * transfer, these are only really used by the host controller to
149 * submit the parts to the usb core.
150 * -# Message - the usb core assembles multiple control transfers in
151 * to single message transfers. In this case the data buffer
152 * contains the setup packet in little endian followed by the full
153 * buffer. In the case of an host-to-device control message, the
154 * message packet is created when the STATUS transfer is seen. In
155 * the case of device-to-host messages, the message packet is
156 * created after the SETUP transfer is seen. Also, certain control
157 * requests never go the real device and get handled synchronously.
158 * -# Bulk - Currently the only endpoint type that does error checking
159 * and endpoint halting.
160 * -# Interrupt - The only non-periodic type supported.
161 *
162 * Hubs are special cases of devices, they have a number of downstream ports
163 * that other devices can be attached to and removed from.
164 *
165 * After a device has been attached (vusbHubAttach):
166 * -# The hub attach method is called, which sends a hub status
167 * change message to the OS.
168 * -# The OS resets the device, and it appears on the default
169 * address with it's config 0 selected (a pseudo-config that
170 * contains only 1 interface with 1 endpoint - the default
171 * message pipe).
172 * -# The OS assigns the device a new address and selects an
173 * appropriate config.
174 * -# The device is ready.
175 *
176 * After a device has been detached (vusbDevDetach):
177 * -# All pending URBs are cancelled.
178 * -# The devices address is unassigned.
179 * -# The hub detach method is called which signals the OS
180 * of the status change.
181 * -# The OS unlinks the ED's for that device.
182 *
183 * A device can also request detachment from within its own methods by
184 * calling vusbDevUnplugged().
185 *
186 * Roothubs are responsible for driving the whole system, they are special
187 * cases of hubs and as such implement attach and detach methods, each one
188 * is described by a struct vusb_roothub. Once a roothub has submitted an
189 * URB to the USB core, a number of callbacks to the roothub are required
190 * for when the URB completes, since the roothub typically wants to inform
191 * the OS when transfers are completed.
192 *
193 * There are four callbacks to be concerned with:
194 * -# prepare - This is called after the URB is successfully queued.
195 * -# completion - This is called after the URB completed.
196 * -# error - This is called if the URB errored, some systems have
197 * automatic resubmission of failed requests, so this callback
198 * should keep track of the error count and return 1 if the count
199 * is above the number of allowed resubmissions.
200 * -# halt_ep - This is called after errors on bulk pipes in order
201 * to halt the pipe.
202 *
203 */
204
205/*******************************************************************************
206* Header Files *
207*******************************************************************************/
208#define LOG_GROUP LOG_GROUP_DRV_VUSB
209#include <VBox/pdm.h>
210#include <VBox/vmapi.h>
211#include <VBox/err.h>
212#include <iprt/alloc.h>
213#include <VBox/log.h>
214#include <iprt/time.h>
215#include <iprt/thread.h>
216#include <iprt/semaphore.h>
217#include <iprt/string.h>
218#include <iprt/assert.h>
219#include <iprt/asm.h>
220#include <iprt/uuid.h>
221#include "VUSBInternal.h"
222#include "Builtins.h"
223
224
225
226/**
227 * Attaches a device to a specific hub.
228 *
229 * This function is called by the vusb_add_device() and vusbRhAttachDevice().
230 *
231 * @returns VBox status code.
232 * @param pHub The hub to attach it to.
233 * @param pDev The device to attach.
234 * @thread EMT
235 */
236static int vusbHubAttach(PVUSBHUB pHub, PVUSBDEV pDev)
237{
238 LogFlow(("vusbHubAttach: pHub=%p[%s] pDev=%p[%s]\n", pHub, pHub->pszName, pDev, pDev->pUsbIns->pszName));
239 AssertMsg(pDev->enmState == VUSB_DEVICE_STATE_DETACHED, ("enmState=%d\n", pDev->enmState));
240
241 pDev->pHub = pHub;
242 pDev->enmState = VUSB_DEVICE_STATE_ATTACHED;
243
244 /* noone else ever messes with the default pipe while we are attached */
245 vusbDevMapEndpoint(pDev, &g_Endpoint0);
246 vusbDevDoSelectConfig(pDev, &g_Config0);
247
248 int rc = pHub->pOps->pfnAttach(pHub, pDev);
249 if (RT_FAILURE(rc))
250 {
251 pDev->pHub = NULL;
252 pDev->enmState = VUSB_DEVICE_STATE_DETACHED;
253 }
254 return rc;
255}
256
257
258/* -=-=-=-=-=- PDMUSBHUBREG methods -=-=-=-=-=- */
259
260/** @copydoc PDMUSBHUBREG::pfnAttachDevice */
261static DECLCALLBACK(int) vusbPDMHubAttachDevice(PPDMDRVINS pDrvIns, PPDMUSBINS pUsbIns, uint32_t *piPort)
262{
263 PVUSBROOTHUB pThis = PDMINS_2_DATA(pDrvIns, PVUSBROOTHUB);
264
265 /*
266 * Allocate a new VUSB device and initialize it.
267 */
268 PVUSBDEV pDev = (PVUSBDEV)RTMemAllocZ(sizeof(*pDev));
269 AssertReturn(pDev, VERR_NO_MEMORY);
270 int rc = vusbDevInit(pDev, pUsbIns);
271 if (RT_SUCCESS(rc))
272 {
273 pUsbIns->pvVUsbDev2 = pDev;
274 rc = vusbHubAttach(&pThis->Hub, pDev);
275 if (RT_SUCCESS(rc))
276 {
277 *piPort = UINT32_MAX; ///@todo implement piPort
278 return rc;
279 }
280
281 RTMemFree(pDev->paIfStates);
282 pUsbIns->pvVUsbDev2 = NULL;
283 }
284 RTMemFree(pDev);
285 return rc;
286}
287
288
289/** @copydoc PDMUSBHUBREG::pfnDetachDevice */
290static DECLCALLBACK(int) vusbPDMHubDetachDevice(PPDMDRVINS pDrvIns, PPDMUSBINS pUsbIns, uint32_t iPort)
291{
292 PVUSBDEV pDev = (PVUSBDEV)pUsbIns->pvVUsbDev2;
293 Assert(pDev);
294 vusbDevDestroy(pDev);
295 RTMemFree(pDev);
296 pUsbIns->pvVUsbDev2 = NULL;
297 return VINF_SUCCESS;
298}
299
300/**
301 * The hub registration structure.
302 */
303static const PDMUSBHUBREG g_vusbHubReg =
304{
305 PDM_USBHUBREG_VERSION,
306 vusbPDMHubAttachDevice,
307 vusbPDMHubDetachDevice,
308 PDM_USBHUBREG_VERSION
309};
310
311
312/* -=-=-=-=-=- VUSBIROOTHUBCONNECTOR methods -=-=-=-=-=- */
313
314
315/**
316 * Finds an device attached to a roothub by it's address.
317 *
318 * @returns Pointer to the device.
319 * @returns NULL if not found.
320 * @param pRh Pointer to the root hub.
321 * @param Address The device address.
322 */
323static PVUSBDEV vusbRhFindDevByAddress(PVUSBROOTHUB pRh, uint8_t Address)
324{
325 unsigned iHash = vusbHashAddress(Address);
326 for (PVUSBDEV pDev = pRh->apAddrHash[iHash]; pDev; pDev = pDev->pNextHash)
327 if (pDev->u8Address == Address)
328 return pDev;
329 return NULL;
330}
331
332
333/**
334 * Callback for freeing an URB.
335 * @param pUrb The URB to free.
336 */
337static DECLCALLBACK(void) vusbRhFreeUrb(PVUSBURB pUrb)
338{
339 /*
340 * Assert sanity.
341 */
342 vusbUrbAssert(pUrb);
343 PVUSBROOTHUB pRh = (PVUSBROOTHUB)pUrb->VUsb.pvFreeCtx;
344 Assert(pRh);
345#ifdef VBOX_STRICT
346 for (PVUSBURB pCur = pRh->pAsyncUrbHead; pCur; pCur = pCur->VUsb.pNext)
347 Assert(pUrb != pCur);
348#endif
349
350 /*
351 * Free the URB description (logging builds only).
352 */
353 if (pUrb->pszDesc)
354 {
355 RTStrFree(pUrb->pszDesc);
356 pUrb->pszDesc = NULL;
357 }
358
359 /*
360 * Put it into the LIFO of free URBs.
361 * (No ppPrev is needed here.)
362 */
363 RTCritSectEnter(&pRh->CritSect);
364 pUrb->enmState = VUSBURBSTATE_FREE;
365 pUrb->VUsb.ppPrev = NULL;
366 pUrb->VUsb.pNext = pRh->pFreeUrbs;
367 pRh->pFreeUrbs = pUrb;
368 Assert(pRh->pFreeUrbs->enmState == VUSBURBSTATE_FREE);
369 RTCritSectLeave(&pRh->CritSect);
370}
371
372
373/**
374 * Worker routine for vusbRhConnNewUrb() and vusbDevNewIsocUrb().
375 */
376PVUSBURB vusbRhNewUrb(PVUSBROOTHUB pRh, uint8_t DstAddress, uint32_t cbData, uint32_t cTds)
377{
378 /*
379 * Reuse or allocate a new URB.
380 */
381 /** @todo try find a best fit, MSD which submits rather big URBs intermixed with small control
382 * messages ends up with a 2+ of these big URBs when a single one is sufficient. */
383 /** @todo The allocations should be done by the device, at least as an option, since the devices
384 * frequently wish to associate their own stuff with the in-flight URB or need special buffering
385 * (isochronous on Darwin for instance). */
386 RTCritSectEnter(&pRh->CritSect);
387 PVUSBURB pUrbPrev = NULL;
388 PVUSBURB pUrb = pRh->pFreeUrbs;
389 while (pUrb)
390 {
391 if ( pUrb->VUsb.cbDataAllocated >= cbData
392 && pUrb->VUsb.cTdsAllocated >= cTds)
393 break;
394 pUrbPrev = pUrb;
395 pUrb = pUrb->VUsb.pNext;
396 }
397 if (pUrb)
398 {
399 if (pUrbPrev)
400 pUrbPrev->VUsb.pNext = pUrb->VUsb.pNext;
401 else
402 pRh->pFreeUrbs = pUrb->VUsb.pNext;
403 Assert(pUrb->u32Magic == VUSBURB_MAGIC);
404 Assert(pUrb->VUsb.pvFreeCtx == pRh);
405 Assert(pUrb->VUsb.pfnFree == vusbRhFreeUrb);
406 Assert(pUrb->enmState == VUSBURBSTATE_FREE);
407 Assert(!pUrb->VUsb.pNext || pUrb->VUsb.pNext->enmState == VUSBURBSTATE_FREE);
408 }
409 else
410 {
411 /* allocate a new one. */
412 uint32_t cbDataAllocated = cbData <= _4K ? RT_ALIGN_32(cbData, _1K)
413 : cbData <= _32K ? RT_ALIGN_32(cbData, _4K)
414 : RT_ALIGN_32(cbData, 16*_1K);
415 uint32_t cTdsAllocated = RT_ALIGN_32(cTds, 16);
416
417 pUrb = (PVUSBURB)RTMemAlloc( RT_OFFSETOF(VUSBURB, abData[cbDataAllocated + 16])
418 + sizeof(pUrb->Hci.paTds[0]) * cTdsAllocated);
419 if (RT_UNLIKELY(!pUrb))
420 {
421 RTCritSectLeave(&pRh->CritSect);
422 AssertLogRelFailedReturn(NULL);
423 }
424
425 pRh->cUrbsInPool++;
426 pUrb->u32Magic = VUSBURB_MAGIC;
427 pUrb->VUsb.pvFreeCtx = pRh;
428 pUrb->VUsb.pfnFree = vusbRhFreeUrb;
429 pUrb->VUsb.cbDataAllocated = cbDataAllocated;
430 pUrb->VUsb.cTdsAllocated = cTdsAllocated;
431 pUrb->Hci.paTds = (VUSBURB::VUSBURBHCI::VUSBURBHCITD *)(&pUrb->abData[cbDataAllocated + 16]);
432 }
433 RTCritSectLeave(&pRh->CritSect);
434
435 /*
436 * (Re)init the URB
437 */
438 pUrb->enmState = VUSBURBSTATE_ALLOCATED;
439 pUrb->pszDesc = NULL;
440 pUrb->VUsb.pNext = NULL;
441 pUrb->VUsb.ppPrev = NULL;
442 pUrb->VUsb.pCtrlUrb = NULL;
443 pUrb->VUsb.u64SubmitTS = 0;
444 pUrb->VUsb.pDev = vusbRhFindDevByAddress(pRh, DstAddress);
445 pUrb->Hci.EdAddr = ~0;
446 pUrb->Hci.cTds = cTds;
447 pUrb->Hci.pNext = NULL;
448 pUrb->Hci.u32FrameNo = 0;
449 pUrb->Hci.fUnlinked = false;
450 pUrb->Dev.pvPrivate = NULL;
451 pUrb->Dev.pNext = NULL;
452 pUrb->pUsbIns = pUrb->VUsb.pDev ? pUrb->VUsb.pDev->pUsbIns : NULL;
453 pUrb->DstAddress = DstAddress;
454 pUrb->EndPt = ~0;
455 pUrb->enmType = VUSBXFERTYPE_INVALID;
456 pUrb->enmDir = VUSBDIRECTION_INVALID;
457 pUrb->fShortNotOk = false;
458 pUrb->enmStatus = VUSBSTATUS_INVALID;
459 pUrb->cbData = cbData;
460 return pUrb;
461}
462
463
464/** @copydoc VUSBIROOTHUBCONNECTOR::pfnNewUrb */
465static DECLCALLBACK(PVUSBURB) vusbRhConnNewUrb(PVUSBIROOTHUBCONNECTOR pInterface, uint8_t DstAddress, uint32_t cbData, uint32_t cTds)
466{
467 PVUSBROOTHUB pRh = VUSBIROOTHUBCONNECTOR_2_VUSBROOTHUB(pInterface);
468 return vusbRhNewUrb(pRh, DstAddress, cbData, cTds);
469}
470
471
472/** @copydoc VUSBIROOTHUBCONNECTOR::pfnSubmitUrb */
473static DECLCALLBACK(int) vusbRhSubmitUrb(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBURB pUrb, PPDMLED pLed)
474{
475 PVUSBROOTHUB pRh = VUSBIROOTHUBCONNECTOR_2_VUSBROOTHUB(pInterface);
476 STAM_PROFILE_START(&pRh->StatSubmitUrb, a);
477
478#ifdef VBOX_WITH_STATISTICS
479 /*
480 * Total and per-type submit statistics.
481 */
482 Assert(pUrb->enmType >= 0 && pUrb->enmType < (int)RT_ELEMENTS(pRh->aTypes));
483 STAM_COUNTER_INC(&pRh->Total.StatUrbsSubmitted);
484 STAM_COUNTER_INC(&pRh->aTypes[pUrb->enmType].StatUrbsSubmitted);
485
486 STAM_COUNTER_ADD(&pRh->Total.StatReqBytes, pUrb->cbData);
487 STAM_COUNTER_ADD(&pRh->aTypes[pUrb->enmType].StatReqBytes, pUrb->cbData);
488 if (pUrb->enmDir == VUSBDIRECTION_IN)
489 {
490 STAM_COUNTER_ADD(&pRh->Total.StatReqReadBytes, pUrb->cbData);
491 STAM_COUNTER_ADD(&pRh->aTypes[pUrb->enmType].StatReqReadBytes, pUrb->cbData);
492 }
493 else
494 {
495 STAM_COUNTER_ADD(&pRh->Total.StatReqWriteBytes, pUrb->cbData);
496 STAM_COUNTER_ADD(&pRh->aTypes[pUrb->enmType].StatReqWriteBytes, pUrb->cbData);
497 }
498
499 if (pUrb->enmType == VUSBXFERTYPE_ISOC)
500 {
501 STAM_COUNTER_ADD(&pRh->StatIsocReqPkts, pUrb->cIsocPkts);
502 if (pUrb->enmDir == VUSBDIRECTION_IN)
503 STAM_COUNTER_ADD(&pRh->StatIsocReqReadPkts, pUrb->cIsocPkts);
504 else
505 STAM_COUNTER_ADD(&pRh->StatIsocReqWritePkts, pUrb->cIsocPkts);
506 }
507#endif
508
509 /*
510 * The device was resolved when we allocated the URB.
511 * Submit it to the device if we found it, if not fail with device-not-ready.
512 */
513 int rc;
514 if ( pUrb->VUsb.pDev
515 && pUrb->pUsbIns)
516 {
517 switch (pUrb->enmDir)
518 {
519 case VUSBDIRECTION_IN:
520 pLed->Asserted.s.fReading = pLed->Actual.s.fReading = 1;
521 rc = vusbUrbSubmit(pUrb);
522 pLed->Actual.s.fReading = 0;
523 break;
524 case VUSBDIRECTION_OUT:
525 pLed->Asserted.s.fWriting = pLed->Actual.s.fWriting = 1;
526 rc = vusbUrbSubmit(pUrb);
527 pLed->Actual.s.fWriting = 0;
528 break;
529 default:
530 rc = vusbUrbSubmit(pUrb);
531 break;
532 }
533
534 if (RT_FAILURE(rc))
535 {
536 LogFlow(("vusbRhSubmitUrb: freeing pUrb=%p\n", pUrb));
537 pUrb->VUsb.pfnFree(pUrb);
538 }
539 }
540 else
541 {
542 pUrb->VUsb.pDev = &pRh->Hub.Dev;
543 Log(("vusb: pRh=%p: SUBMIT: Address %i not found!!!\n", pRh, pUrb->DstAddress));
544
545 pUrb->enmState = VUSBURBSTATE_REAPED;
546 pUrb->enmStatus = VUSBSTATUS_DNR;
547 vusbUrbCompletionRh(pUrb);
548 rc = VINF_SUCCESS;
549 }
550
551 STAM_PROFILE_STOP(&pRh->StatSubmitUrb, a);
552 return rc;
553}
554
555
556/** @copydoc VUSBIROOTHUBCONNECTOR::pfnReapAsyncUrbs */
557static DECLCALLBACK(void) vusbRhReapAsyncUrbs(PVUSBIROOTHUBCONNECTOR pInterface, RTMSINTERVAL cMillies)
558{
559 PVUSBROOTHUB pRh = VUSBIROOTHUBCONNECTOR_2_VUSBROOTHUB(pInterface);
560 if (!pRh->pAsyncUrbHead)
561 return;
562
563 STAM_PROFILE_START(&pRh->StatReapAsyncUrbs, a);
564 if (!cMillies)
565 vusbUrbDoReapAsync(pRh->pAsyncUrbHead, 0);
566 else
567 {
568 uint64_t u64Start = RTTimeMilliTS();
569 do
570 {
571 vusbUrbDoReapAsync(pRh->pAsyncUrbHead, RT_MIN(cMillies >> 8, 10));
572 } while ( pRh->pAsyncUrbHead
573 && RTTimeMilliTS() - u64Start < cMillies);
574 }
575 STAM_PROFILE_STOP(&pRh->StatReapAsyncUrbs, a);
576}
577
578
579/** @copydoc VUSBIROOTHUBCONNECTOR::pfnCancelAllUrbs */
580static DECLCALLBACK(void) vusbRhCancelAllUrbs(PVUSBIROOTHUBCONNECTOR pInterface)
581{
582 PVUSBROOTHUB pRh = VUSBIROOTHUBCONNECTOR_2_VUSBROOTHUB(pInterface);
583
584 /*
585 * Cancel the URBS.
586 */
587 PVUSBURB pUrb = pRh->pAsyncUrbHead;
588 LogFlow(("vusbRhCancelAllUrbs: pRh=%p\n", pRh));
589 while (pUrb)
590 {
591 PVUSBURB pNext = pUrb->VUsb.pNext;
592 vusbUrbCancel(pUrb);
593 pUrb = pNext;
594 }
595
596 /*
597 * Reap any URBs which now are ripe.
598 */
599 pUrb = pRh->pAsyncUrbHead;
600 while (pUrb)
601 {
602 PVUSBURB pRipe;
603 if (pUrb->enmState == VUSBURBSTATE_REAPED)
604 pRipe = pUrb;
605 else
606 pRipe = pUrb->pUsbIns->pReg->pfnUrbReap(pUrb->pUsbIns, 0);
607 if (!pRipe || pUrb == pRipe)
608 pUrb = pUrb->VUsb.pNext;
609 if (pRipe)
610 {
611 pRipe->enmStatus = VUSBSTATUS_CRC;
612 vusbUrbRipe(pRipe);
613 }
614 }
615}
616
617
618/** @copydoc VUSBIROOTHUBCONNECTOR::pfnAttachDevice */
619static DECLCALLBACK(int) vusbRhAttachDevice(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBIDEVICE pDevice)
620{
621 PVUSBROOTHUB pRh = VUSBIROOTHUBCONNECTOR_2_VUSBROOTHUB(pInterface);
622 return vusbHubAttach(&pRh->Hub, (PVUSBDEV)pDevice);
623}
624
625
626/** @copydoc VUSBIROOTHUBCONNECTOR::pfnDetachDevice */
627static DECLCALLBACK(int) vusbRhDetachDevice(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBIDEVICE pDevice)
628{
629 PVUSBROOTHUB pRh = VUSBIROOTHUBCONNECTOR_2_VUSBROOTHUB(pInterface);
630 if (&pRh->Hub != ((PVUSBDEV)pDevice)->pHub)
631 AssertFailedReturn(VERR_INVALID_PARAMETER);
632 return vusbDevDetach((PVUSBDEV)pDevice);
633}
634
635
636/* -=-=-=-=-=- VUSB Device methods (for the root hub) -=-=-=-=-=- */
637
638
639/**
640 * @copydoc VUSBIDEVICE::pfnReset
641 */
642static DECLCALLBACK(int) vusbRhDevReset(PVUSBIDEVICE pInterface, bool fResetOnLinux, PFNVUSBRESETDONE pfnDone, void *pvUser, PVM pVM)
643{
644 PVUSBROOTHUB pRh = RT_FROM_MEMBER(pInterface, VUSBROOTHUB, Hub.Dev.IDevice);
645 Assert(!pfnDone);
646 return pRh->pIRhPort->pfnReset(pRh->pIRhPort, fResetOnLinux); /** @todo change rc from bool to vbox status everywhere! */
647}
648
649
650/**
651 * @copydoc VUSBIDEVICE::pfnPowerOn
652 */
653static DECLCALLBACK(int) vusbRhDevPowerOn(PVUSBIDEVICE pInterface)
654{
655 PVUSBROOTHUB pRh = RT_FROM_MEMBER(pInterface, VUSBROOTHUB, Hub.Dev.IDevice);
656 LogFlow(("vusbRhDevPowerOn: pRh=%p\n", pRh));
657
658 Assert( pRh->Hub.Dev.enmState != VUSB_DEVICE_STATE_DETACHED
659 && pRh->Hub.Dev.enmState != VUSB_DEVICE_STATE_RESET);
660
661 if (pRh->Hub.Dev.enmState == VUSB_DEVICE_STATE_ATTACHED)
662 pRh->Hub.Dev.enmState = VUSB_DEVICE_STATE_POWERED;
663
664 return VINF_SUCCESS;
665}
666
667
668/**
669 * @copydoc VUSBIDEVICE::pfnPowerOff
670 */
671static DECLCALLBACK(int) vusbRhDevPowerOff(PVUSBIDEVICE pInterface)
672{
673 PVUSBROOTHUB pRh = RT_FROM_MEMBER(pInterface, VUSBROOTHUB, Hub.Dev.IDevice);
674 LogFlow(("vusbRhDevPowerOff: pRh=%p\n", pRh));
675
676 Assert( pRh->Hub.Dev.enmState != VUSB_DEVICE_STATE_DETACHED
677 && pRh->Hub.Dev.enmState != VUSB_DEVICE_STATE_RESET);
678
679 /*
680 * Cancel all URBs and reap them.
681 */
682 VUSBIRhCancelAllUrbs(&pRh->IRhConnector);
683 VUSBIRhReapAsyncUrbs(&pRh->IRhConnector, 0);
684
685 pRh->Hub.Dev.enmState = VUSB_DEVICE_STATE_ATTACHED;
686 return VINF_SUCCESS;
687}
688
689/**
690 * @copydoc VUSBIDEVICE::pfnGetState
691 */
692DECLCALLBACK(VUSBDEVICESTATE) vusbRhDevGetState(PVUSBIDEVICE pInterface)
693{
694 PVUSBROOTHUB pRh = RT_FROM_MEMBER(pInterface, VUSBROOTHUB, Hub.Dev.IDevice);
695 return pRh->Hub.Dev.enmState;
696}
697
698
699
700
701/* -=-=-=-=-=- VUSB Hub methods -=-=-=-=-=- */
702
703
704/**
705 * Attach the device to the hub.
706 * Port assignments and all such stuff is up to this routine.
707 *
708 * @returns VBox status code.
709 * @param pHub Pointer to the hub.
710 * @param pDev Pointer to the device.
711 */
712static int vusbRhHubOpAttach(PVUSBHUB pHub, PVUSBDEV pDev)
713{
714 PVUSBROOTHUB pRh = (PVUSBROOTHUB)pHub;
715
716 /*
717 * Assign a port.
718 */
719 int iPort = ASMBitFirstSet(&pRh->Bitmap, sizeof(pRh->Bitmap) * 8);
720 if (iPort < 0)
721 {
722 LogRel(("VUSB: No ports available!\n"));
723 return VERR_VUSB_NO_PORTS;
724 }
725 ASMBitClear(&pRh->Bitmap, iPort);
726 pHub->cDevices++;
727 pDev->i16Port = iPort;
728
729 /*
730 * Call the HCI attach routine and let it have its say before the device is
731 * linked into the device list of this hub.
732 */
733 int rc = pRh->pIRhPort->pfnAttach(pRh->pIRhPort, &pDev->IDevice, iPort);
734 if (RT_SUCCESS(rc))
735 {
736 pDev->pNext = pRh->pDevices;
737 pRh->pDevices = pDev;
738 LogRel(("VUSB: attached '%s' to port %d\n", pDev->pUsbIns->pszName, iPort));
739 }
740 else
741 {
742 ASMBitSet(&pRh->Bitmap, iPort);
743 pHub->cDevices--;
744 pDev->i16Port = -1;
745 LogRel(("VUSB: failed to attach '%s' to port %d, rc=%Rrc\n", pDev->pUsbIns->pszName, iPort, rc));
746 }
747 return rc;
748}
749
750
751/**
752 * Detach the device from the hub.
753 *
754 * @returns VBox status code.
755 * @param pHub Pointer to the hub.
756 * @param pDev Pointer to the device.
757 */
758static void vusbRhHubOpDetach(PVUSBHUB pHub, PVUSBDEV pDev)
759{
760 PVUSBROOTHUB pRh = (PVUSBROOTHUB)pHub;
761 Assert(pDev->i16Port != -1);
762
763 /*
764 * Check that it's attached and unlink it from the linked list.
765 */
766 if (pRh->pDevices != pDev)
767 {
768 PVUSBDEV pPrev = pRh->pDevices;
769 while (pPrev && pPrev->pNext != pDev)
770 pPrev = pPrev->pNext;
771 Assert(pPrev);
772 pPrev->pNext = pDev->pNext;
773 }
774 else
775 pRh->pDevices = pDev->pNext;
776 pDev->pNext = NULL;
777
778 /*
779 * Detach the device and mark the port as available.
780 */
781 unsigned uPort = pDev->i16Port;
782 pRh->pIRhPort->pfnDetach(pRh->pIRhPort, &pDev->IDevice, uPort);
783 ASMBitSet(&pRh->Bitmap, uPort);
784 pHub->cDevices--;
785}
786
787
788/**
789 * The Hub methods implemented by the root hub.
790 */
791static const VUSBHUBOPS s_VUsbRhHubOps =
792{
793 vusbRhHubOpAttach,
794 vusbRhHubOpDetach
795};
796
797
798
799/* -=-=-=-=-=- PDM Base interface methods -=-=-=-=-=- */
800
801
802/**
803 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
804 */
805static DECLCALLBACK(void *) vusbRhQueryInterface(PPDMIBASE pInterface, const char *pszIID)
806{
807 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
808 PVUSBROOTHUB pRh = PDMINS_2_DATA(pDrvIns, PVUSBROOTHUB);
809
810 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
811 PDMIBASE_RETURN_INTERFACE(pszIID, VUSBIROOTHUBCONNECTOR, &pRh->IRhConnector);
812 PDMIBASE_RETURN_INTERFACE(pszIID, VUSBIDEVICE, &pRh->Hub.Dev.IDevice);
813 return NULL;
814}
815
816
817/* -=-=-=-=-=- PDM Driver methods -=-=-=-=-=- */
818
819
820/**
821 * Destruct a driver instance.
822 *
823 * Most VM resources are freed by the VM. This callback is provided so that any non-VM
824 * resources can be freed correctly.
825 *
826 * @param pDrvIns The driver instance data.
827 */
828static DECLCALLBACK(void) vusbRhDestruct(PPDMDRVINS pDrvIns)
829{
830 PVUSBROOTHUB pRh = PDMINS_2_DATA(pDrvIns, PVUSBROOTHUB);
831 PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
832
833 /*
834 * Free all URBs.
835 */
836 while (pRh->pFreeUrbs)
837 {
838 PVUSBURB pUrb = pRh->pFreeUrbs;
839 pRh->pFreeUrbs = pUrb->VUsb.pNext;
840
841 pUrb->u32Magic = 0;
842 pUrb->enmState = VUSBURBSTATE_INVALID;
843 pUrb->VUsb.pNext = NULL;
844 RTMemFree(pUrb);
845 }
846 RTCritSectDelete(&pRh->CritSect);
847}
848
849
850/**
851 * Construct a root hub driver instance.
852 *
853 * @copydoc FNPDMDRVCONSTRUCT
854 */
855static DECLCALLBACK(int) vusbRhConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
856{
857 LogFlow(("vusbRhConstruct:\n"));
858 PVUSBROOTHUB pThis = PDMINS_2_DATA(pDrvIns, PVUSBROOTHUB);
859 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
860
861 /*
862 * Validate configuration.
863 */
864 if (!CFGMR3AreValuesValid(pCfg, "\0"))
865 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
866
867 /*
868 * Check that there are no drivers below us.
869 */
870 AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
871 ("Configuration error: Not possible to attach anything to this driver!\n"),
872 VERR_PDM_DRVINS_NO_ATTACH);
873
874 /*
875 * Initialize the critical section.
876 */
877 int rc = RTCritSectInit(&pThis->CritSect);
878 if (RT_FAILURE(rc))
879 return rc;
880
881 /*
882 * Initialize the data members.
883 */
884 pDrvIns->IBase.pfnQueryInterface = vusbRhQueryInterface;
885 /* the usb device */
886 pThis->Hub.Dev.enmState = VUSB_DEVICE_STATE_ATTACHED;
887 pThis->Hub.Dev.u8Address = VUSB_INVALID_ADDRESS;
888 pThis->Hub.Dev.u8NewAddress = VUSB_INVALID_ADDRESS;
889 pThis->Hub.Dev.i16Port = -1;
890 pThis->Hub.Dev.IDevice.pfnReset = vusbRhDevReset;
891 pThis->Hub.Dev.IDevice.pfnPowerOn = vusbRhDevPowerOn;
892 pThis->Hub.Dev.IDevice.pfnPowerOff = vusbRhDevPowerOff;
893 pThis->Hub.Dev.IDevice.pfnGetState = vusbRhDevGetState;
894 /* the hub */
895 pThis->Hub.pOps = &s_VUsbRhHubOps;
896 pThis->Hub.pRootHub = pThis;
897 //pThis->hub.cPorts - later
898 pThis->Hub.cDevices = 0;
899 pThis->Hub.Dev.pHub = &pThis->Hub;
900 /* misc */
901 pThis->pDrvIns = pDrvIns;
902 /* the connector */
903 pThis->IRhConnector.pfnNewUrb = vusbRhConnNewUrb;
904 pThis->IRhConnector.pfnSubmitUrb = vusbRhSubmitUrb;
905 pThis->IRhConnector.pfnReapAsyncUrbs= vusbRhReapAsyncUrbs;
906 pThis->IRhConnector.pfnCancelAllUrbs= vusbRhCancelAllUrbs;
907 pThis->IRhConnector.pfnAttachDevice = vusbRhAttachDevice;
908 pThis->IRhConnector.pfnDetachDevice = vusbRhDetachDevice;
909 /*
910 * Resolve interface(s).
911 */
912 pThis->pIRhPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, VUSBIROOTHUBPORT);
913 AssertMsgReturn(pThis->pIRhPort, ("Configuration error: the device/driver above us doesn't expose any VUSBIROOTHUBPORT interface!\n"), VERR_PDM_MISSING_INTERFACE_ABOVE);
914
915 /*
916 * Get number of ports and the availability bitmap.
917 * ASSUME that the number of ports reported now at creation time is the max number.
918 */
919 pThis->Hub.cPorts = pThis->pIRhPort->pfnGetAvailablePorts(pThis->pIRhPort, &pThis->Bitmap);
920 Log(("vusbRhConstruct: cPorts=%d\n", pThis->Hub.cPorts));
921
922 /*
923 * Get the USB version of the attached HC.
924 * ASSUME that version 2.0 implies high-speed.
925 */
926 pThis->fHcVersions = pThis->pIRhPort->pfnGetUSBVersions(pThis->pIRhPort);
927 Log(("vusbRhConstruct: fHcVersions=%u\n", pThis->fHcVersions));
928
929 /*
930 * Register ourselves as a USB hub.
931 * The current implementation uses the VUSBIRHCONFIG interface for communication.
932 */
933 PCPDMUSBHUBHLP pHlp; /* not used currently */
934 rc = PDMDrvHlpUSBRegisterHub(pDrvIns, pThis->fHcVersions, pThis->Hub.cPorts, &g_vusbHubReg, &pHlp);
935 if (RT_FAILURE(rc))
936 return rc;
937
938 /*
939 * Statistics. (It requires a 30" monitor or extremely tiny fonts to edit this "table".)
940 */
941#ifdef VBOX_WITH_STATISTICS
942 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->Total.StatUrbsSubmitted, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "The number of URBs submitted.", "/VUSB/%d/UrbsSubmitted", pDrvIns->iInstance);
943 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatUrbsSubmitted, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Bulk transfer.", "/VUSB/%d/UrbsSubmitted/Bulk", pDrvIns->iInstance);
944 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatUrbsSubmitted, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Control transfer.", "/VUSB/%d/UrbsSubmitted/Ctrl", pDrvIns->iInstance);
945 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatUrbsSubmitted, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Interrupt transfer.", "/VUSB/%d/UrbsSubmitted/Intr", pDrvIns->iInstance);
946 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatUrbsSubmitted, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Isochronous transfer.", "/VUSB/%d/UrbsSubmitted/Isoc", pDrvIns->iInstance);
947
948 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->Total.StatUrbsCancelled, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "The number of URBs cancelled. (included in failed)", "/VUSB/%d/UrbsCancelled", pDrvIns->iInstance);
949 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatUrbsCancelled, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Bulk transfer.", "/VUSB/%d/UrbsCancelled/Bulk", pDrvIns->iInstance);
950 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatUrbsCancelled, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Control transfer.", "/VUSB/%d/UrbsCancelled/Ctrl", pDrvIns->iInstance);
951 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatUrbsCancelled, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Interrupt transfer.", "/VUSB/%d/UrbsCancelled/Intr", pDrvIns->iInstance);
952 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatUrbsCancelled, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Isochronous transfer.", "/VUSB/%d/UrbsCancelled/Isoc", pDrvIns->iInstance);
953
954 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->Total.StatUrbsFailed, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "The number of URBs failing.", "/VUSB/%d/UrbsFailed", pDrvIns->iInstance);
955 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatUrbsFailed, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Bulk transfer.", "/VUSB/%d/UrbsFailed/Bulk", pDrvIns->iInstance);
956 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatUrbsFailed, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Control transfer.", "/VUSB/%d/UrbsFailed/Ctrl", pDrvIns->iInstance);
957 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatUrbsFailed, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Interrupt transfer.", "/VUSB/%d/UrbsFailed/Intr", pDrvIns->iInstance);
958 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatUrbsFailed, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Isochronous transfer.", "/VUSB/%d/UrbsFailed/Isoc", pDrvIns->iInstance);
959
960 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->Total.StatReqBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Total requested transfer.", "/VUSB/%d/ReqBytes", pDrvIns->iInstance);
961 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatReqBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Bulk transfer.", "/VUSB/%d/ReqBytes/Bulk", pDrvIns->iInstance);
962 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatReqBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Control transfer.", "/VUSB/%d/ReqBytes/Ctrl", pDrvIns->iInstance);
963 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatReqBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Interrupt transfer.", "/VUSB/%d/ReqBytes/Intr", pDrvIns->iInstance);
964 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatReqBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Isochronous transfer.", "/VUSB/%d/ReqBytes/Isoc", pDrvIns->iInstance);
965
966 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->Total.StatReqReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Total requested read transfer.", "/VUSB/%d/ReqReadBytes", pDrvIns->iInstance);
967 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatReqReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Bulk transfer.", "/VUSB/%d/ReqReadBytes/Bulk", pDrvIns->iInstance);
968 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatReqReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Control transfer.", "/VUSB/%d/ReqReadBytes/Ctrl", pDrvIns->iInstance);
969 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatReqReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Interrupt transfer.", "/VUSB/%d/ReqReadBytes/Intr", pDrvIns->iInstance);
970 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatReqReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Isochronous transfer.", "/VUSB/%d/ReqReadBytes/Isoc", pDrvIns->iInstance);
971
972 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->Total.StatReqWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Total requested write transfer.", "/VUSB/%d/ReqWriteBytes", pDrvIns->iInstance);
973 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatReqWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Bulk transfer.", "/VUSB/%d/ReqWriteBytes/Bulk", pDrvIns->iInstance);
974 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatReqWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Control transfer.", "/VUSB/%d/ReqWriteBytes/Ctrl", pDrvIns->iInstance);
975 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatReqWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Interrupt transfer.", "/VUSB/%d/ReqWriteBytes/Intr", pDrvIns->iInstance);
976 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatReqWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Isochronous transfer.", "/VUSB/%d/ReqWriteBytes/Isoc", pDrvIns->iInstance);
977
978 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->Total.StatActBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Actual total transfer.", "/VUSB/%d/ActBytes", pDrvIns->iInstance);
979 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatActBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Bulk transfer.", "/VUSB/%d/ActBytes/Bulk", pDrvIns->iInstance);
980 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatActBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Control transfer.", "/VUSB/%d/ActBytes/Ctrl", pDrvIns->iInstance);
981 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatActBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Interrupt transfer.", "/VUSB/%d/ActBytes/Intr", pDrvIns->iInstance);
982 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatActBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Isochronous transfer.", "/VUSB/%d/ActBytes/Isoc", pDrvIns->iInstance);
983
984 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->Total.StatActReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Actual total read transfer.", "/VUSB/%d/ActReadBytes", pDrvIns->iInstance);
985 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatActReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Bulk transfer.", "/VUSB/%d/ActReadBytes/Bulk", pDrvIns->iInstance);
986 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatActReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Control transfer.", "/VUSB/%d/ActReadBytes/Ctrl", pDrvIns->iInstance);
987 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatActReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Interrupt transfer.", "/VUSB/%d/ActReadBytes/Intr", pDrvIns->iInstance);
988 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatActReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Isochronous transfer.", "/VUSB/%d/ActReadBytes/Isoc", pDrvIns->iInstance);
989
990 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->Total.StatActWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Actual total write transfer.", "/VUSB/%d/ActWriteBytes", pDrvIns->iInstance);
991 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatActWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Bulk transfer.", "/VUSB/%d/ActWriteBytes/Bulk", pDrvIns->iInstance);
992 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatActWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Control transfer.", "/VUSB/%d/ActWriteBytes/Ctrl", pDrvIns->iInstance);
993 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatActWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Interrupt transfer.", "/VUSB/%d/ActWriteBytes/Intr", pDrvIns->iInstance);
994 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatActWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Isochronous transfer.", "/VUSB/%d/ActWriteBytes/Isoc", pDrvIns->iInstance);
995
996 /* bulk */
997 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatUrbsSubmitted, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of submitted URBs.", "/VUSB/%d/Bulk/Urbs", pDrvIns->iInstance);
998 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatUrbsFailed, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of failed URBs.", "/VUSB/%d/Bulk/UrbsFailed", pDrvIns->iInstance);
999 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatUrbsCancelled, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of cancelled URBs.", "/VUSB/%d/Bulk/UrbsFailed/Cancelled", pDrvIns->iInstance);
1000 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatActBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Number of bytes transfered.", "/VUSB/%d/Bulk/ActBytes", pDrvIns->iInstance);
1001 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatActReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Read.", "/VUSB/%d/Bulk/ActBytes/Read", pDrvIns->iInstance);
1002 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatActWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Write.", "/VUSB/%d/Bulk/ActBytes/Write", pDrvIns->iInstance);
1003 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatReqBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Requested number of bytes.", "/VUSB/%d/Bulk/ReqBytes", pDrvIns->iInstance);
1004 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatReqReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Read.", "/VUSB/%d/Bulk/ReqBytes/Read", pDrvIns->iInstance);
1005 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatReqWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Write.", "/VUSB/%d/Bulk/ReqBytes/Write", pDrvIns->iInstance);
1006
1007 /* control */
1008 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatUrbsSubmitted, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of submitted URBs.", "/VUSB/%d/Ctrl/Urbs", pDrvIns->iInstance);
1009 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatUrbsFailed, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of failed URBs.", "/VUSB/%d/Ctrl/UrbsFailed", pDrvIns->iInstance);
1010 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatUrbsCancelled, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of cancelled URBs.", "/VUSB/%d/Ctrl/UrbsFailed/Cancelled", pDrvIns->iInstance);
1011 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatActBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Number of bytes transfered.", "/VUSB/%d/Ctrl/ActBytes", pDrvIns->iInstance);
1012 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatActReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Read.", "/VUSB/%d/Ctrl/ActBytes/Read", pDrvIns->iInstance);
1013 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatActWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Write.", "/VUSB/%d/Ctrl/ActBytes/Write", pDrvIns->iInstance);
1014 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatReqBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Requested number of bytes.", "/VUSB/%d/Ctrl/ReqBytes", pDrvIns->iInstance);
1015 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatReqReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Read.", "/VUSB/%d/Ctrl/ReqBytes/Read", pDrvIns->iInstance);
1016 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatReqWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Write.", "/VUSB/%d/Ctrl/ReqBytes/Write", pDrvIns->iInstance);
1017
1018 /* interrupt */
1019 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatUrbsSubmitted, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of submitted URBs.", "/VUSB/%d/Intr/Urbs", pDrvIns->iInstance);
1020 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatUrbsFailed, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of failed URBs.", "/VUSB/%d/Intr/UrbsFailed", pDrvIns->iInstance);
1021 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatUrbsCancelled, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of cancelled URBs.", "/VUSB/%d/Intr/UrbsFailed/Cancelled", pDrvIns->iInstance);
1022 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatActBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Number of bytes transfered.", "/VUSB/%d/Intr/ActBytes", pDrvIns->iInstance);
1023 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatActReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Read.", "/VUSB/%d/Intr/ActBytes/Read", pDrvIns->iInstance);
1024 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatActWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Write.", "/VUSB/%d/Intr/ActBytes/Write", pDrvIns->iInstance);
1025 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatReqBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Requested number of bytes.", "/VUSB/%d/Intr/ReqBytes", pDrvIns->iInstance);
1026 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatReqReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Read.", "/VUSB/%d/Intr/ReqBytes/Read", pDrvIns->iInstance);
1027 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatReqWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Write.", "/VUSB/%d/Intr/ReqBytes/Write", pDrvIns->iInstance);
1028
1029 /* isochronous */
1030 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatUrbsSubmitted, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of submitted URBs.", "/VUSB/%d/Isoc/Urbs", pDrvIns->iInstance);
1031 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatUrbsFailed, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of failed URBs.", "/VUSB/%d/Isoc/UrbsFailed", pDrvIns->iInstance);
1032 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatUrbsCancelled, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of cancelled URBs.", "/VUSB/%d/Isoc/UrbsFailed/Cancelled", pDrvIns->iInstance);
1033 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatActBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Number of bytes transfered.", "/VUSB/%d/Isoc/ActBytes", pDrvIns->iInstance);
1034 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatActReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Read.", "/VUSB/%d/Isoc/ActBytes/Read", pDrvIns->iInstance);
1035 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatActWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Write.", "/VUSB/%d/Isoc/ActBytes/Write", pDrvIns->iInstance);
1036 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatReqBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Requested number of bytes.", "/VUSB/%d/Isoc/ReqBytes", pDrvIns->iInstance);
1037 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatReqReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Read.", "/VUSB/%d/Isoc/ReqBytes/Read", pDrvIns->iInstance);
1038 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatReqWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Write.", "/VUSB/%d/Isoc/ReqBytes/Write", pDrvIns->iInstance);
1039 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatIsocActPkts, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of isochronous packets returning data.", "/VUSB/%d/Isoc/ActPkts", pDrvIns->iInstance);
1040 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatIsocActReadPkts, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Read.", "/VUSB/%d/Isoc/ActPkts/Read", pDrvIns->iInstance);
1041 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatIsocActWritePkts, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Write.", "/VUSB/%d/Isoc/ActPkts/Write", pDrvIns->iInstance);
1042 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatIsocReqPkts, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Requested number of isochronous packets.", "/VUSB/%d/Isoc/ReqPkts", pDrvIns->iInstance);
1043 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatIsocReqReadPkts, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Read.", "/VUSB/%d/Isoc/ReqPkts/Read", pDrvIns->iInstance);
1044 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatIsocReqWritePkts, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Write.", "/VUSB/%d/Isoc/ReqPkts/Write", pDrvIns->iInstance);
1045
1046 for (unsigned i = 0; i < RT_ELEMENTS(pThis->aStatIsocDetails); i++)
1047 {
1048 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aStatIsocDetails[i].Pkts, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, ".", "/VUSB/%d/Isoc/%d", pDrvIns->iInstance, i);
1049 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aStatIsocDetails[i].Ok, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, ".", "/VUSB/%d/Isoc/%d/Ok", pDrvIns->iInstance, i);
1050 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aStatIsocDetails[i].Ok0, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, ".", "/VUSB/%d/Isoc/%d/Ok0", pDrvIns->iInstance, i);
1051 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aStatIsocDetails[i].DataUnderrun, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, ".", "/VUSB/%d/Isoc/%d/DataUnderrun", pDrvIns->iInstance, i);
1052 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aStatIsocDetails[i].DataUnderrun0, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, ".", "/VUSB/%d/Isoc/%d/DataUnderrun0", pDrvIns->iInstance, i);
1053 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aStatIsocDetails[i].DataOverrun, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, ".", "/VUSB/%d/Isoc/%d/DataOverrun", pDrvIns->iInstance, i);
1054 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aStatIsocDetails[i].NotAccessed, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, ".", "/VUSB/%d/Isoc/%d/NotAccessed", pDrvIns->iInstance, i);
1055 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aStatIsocDetails[i].Misc, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, ".", "/VUSB/%d/Isoc/%d/Misc", pDrvIns->iInstance, i);
1056 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aStatIsocDetails[i].Bytes, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_BYTES, ".", "/VUSB/%d/Isoc/%d/Bytes", pDrvIns->iInstance, i);
1057 }
1058
1059 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReapAsyncUrbs, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Profiling the vusbRhReapAsyncUrbs body (omitting calls when nothing is in-flight).", "/VUSB/%d/ReapAsyncUrbs", pDrvIns->iInstance);
1060 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatSubmitUrb, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Profiling the vusbRhSubmitUrb body.", "/VUSB/%d/SubmitUrb", pDrvIns->iInstance);
1061#endif
1062 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->cUrbsInPool, STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "The number of URBs in the pool.", "/VUSB/%d/cUrbsInPool", pDrvIns->iInstance);
1063
1064 return VINF_SUCCESS;
1065}
1066
1067
1068/**
1069 * VUSB Root Hub driver registration record.
1070 */
1071const PDMDRVREG g_DrvVUSBRootHub =
1072{
1073 /* u32Version */
1074 PDM_DRVREG_VERSION,
1075 /* szName */
1076 "VUSBRootHub",
1077 /* szRCMod */
1078 "",
1079 /* szR0Mod */
1080 "",
1081 /* pszDescription */
1082 "VUSB Root Hub Driver.",
1083 /* fFlags */
1084 PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
1085 /* fClass. */
1086 PDM_DRVREG_CLASS_USB,
1087 /* cMaxInstances */
1088 ~0,
1089 /* cbInstance */
1090 sizeof(VUSBROOTHUB),
1091 /* pfnConstruct */
1092 vusbRhConstruct,
1093 /* pfnDestruct */
1094 vusbRhDestruct,
1095 /* pfnRelocate */
1096 NULL,
1097 /* pfnIOCtl */
1098 NULL,
1099 /* pfnPowerOn */
1100 NULL,
1101 /* pfnReset */
1102 NULL,
1103 /* pfnSuspend */
1104 NULL,
1105 /* pfnResume */
1106 NULL,
1107 /* pfnAttach */
1108 NULL,
1109 /* pfnDetach */
1110 NULL,
1111 /* pfnPowerOff */
1112 NULL,
1113 /* pfnSoftReset */
1114 NULL,
1115 /* u32EndVersion */
1116 PDM_DRVREG_VERSION
1117};
1118
1119/*
1120 * Local Variables:
1121 * mode: c
1122 * c-file-style: "bsd"
1123 * c-basic-offset: 4
1124 * tab-width: 4
1125 * indent-tabs-mode: s
1126 * End:
1127 */
1128
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette