DrvVUSBRootHub.cpp revision dcc837f3a6f10996beb8aa7965f67f7f6c273fb4
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Virtual USB - Root Hub Driver.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Copyright (C) 2005-2012 Oracle Corporation
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * This file is part of VirtualBox Open Source Edition (OSE), as
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * available from http://www.virtualbox.org. This file is free software;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * you can redistribute it and/or modify it under the terms of the GNU
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * General Public License (GPL) as published by the Free Software
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Foundation, in version 2 as it comes in the "COPYING" file of the
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk/** @page pg_dev_vusb VUSB - Virtual USB
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @todo read thru this and correct typos. Merge with old docs.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * The Virtual USB component glues USB devices and host controllers together.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * The VUSB takes the form of a PDM driver which is attached to the HCI. USB
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * devices are created by, attached to, and managed by the VUSB roothub. The
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * VUSB also exposes an interface which is used by Main to attach and detach
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * proxied USB devices.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @section sec_dev_vusb_urb The Life of an URB
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * The URB is created when the HCI calls the roothub (VUSB) method pfnNewUrb.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * VUSB has a pool of URBs, if no free URBs are available a new one is
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * allocated. The returned URB starts life in the ALLOCATED state and all
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * fields are initialized with sensible defaults.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * The HCI then copies any request data into the URB if it's an host2dev
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * transfer. It then submits the URB by calling the pfnSubmitUrb roothub
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * pfnSubmitUrb will start by checking if it knows the device address, and if
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * it doesn't the URB is completed with a device-not-ready error. When the
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * device address is known to it, action is taken based on the kind of
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * transfer it is. There are four kinds of transfers: 1. control, 2. bulk,
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * 3. interrupt, and 4. isochronous. In either case something eventually ends
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * up being submitted to the device.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * If an URB fails submitting, may or may not be completed. This depends on
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * heuristics in some cases and on the kind of failure in others. If
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * pfnSubmitUrb returns a failure, the HCI should retry submitting it at a
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * later time. If pfnSubmitUrb returns success the URB is submitted, and it
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * can even been completed.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * The URB is in the IN_FLIGHT state from the time it's successfully submitted
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * and till it's reaped or cancelled.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * When an URB transfer or in some case submit failure occurs, the pfnXferError
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * callback of the HCI is consulted about what to do. If pfnXferError indicates
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * that the URB should be retried, pfnSubmitUrb will fail. If it indicates that
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * it should fail, the URB will be completed.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Completing an URB means that the URB status is set and the HCI
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * pfnXferCompletion callback is invoked with the URB. The HCI is the supposed
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * to report the transfer status to the guest OS. After completion the URB
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * is freed and returned to the pool, unless it was cancelled. If it was
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * cancelled it will have to await reaping before it's actually freed.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @subsection subsec_dev_vusb_urb_ctrl Control
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * The control transfer is the most complex one, from VUSB's point of view,
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * with its three stages and being bi-directional. A control transfer starts
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * with a SETUP packet containing the request description and two basic
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * parameters. It is followed by zero or more DATA packets which either picks
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * up incoming data (dev2host) or supplies the request data (host2dev). This
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * can then be followed by a STATUS packet which gets the status of the whole
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * What makes the control transfer complicated is that for a host2dev request
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * the URB is assembled from the SETUP and DATA stage, and for a dev2host
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * request the returned data must be kept around for the DATA stage. For both
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * transfer directions the status of the transfer has to be kept around for
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * the STATUS stage.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * To complicate matters further, VUSB must intercept and in some cases emulate
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * some of the standard requests in order to keep the virtual device state
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * correct and provide the correct virtualization of a device.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @subsection subsec_dev_vusb_urb_bulk Bulk and Interrupt
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * The bulk and interrupt transfer types are relativly simple compared to the
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * control transfer. VUSB is not inspecting the request content or anything,
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * but passes it down the device.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @subsection subsec_dev_vusb_urb_bulk Isochronous
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * This kind of transfers hasn't yet been implemented.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk/** @page pg_dev_vusb_old VUSB - Virtual USB Core
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * The virtual USB core is controlled by the roothub and the underlying HCI
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * emulator, it is responsible for device addressing, managing configurations,
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * interfaces and endpoints, assembling and splitting multi-part control
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * messages and in general acts as a middle layer between the USB device
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * emulation code and USB HCI emulation code.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * All USB devices are represented by a struct vusb_dev. This structure
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * contains things like the device state, device address, all the configuration
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * descriptors, the currently selected configuration and a mapping between
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * endpoint addresses and endpoint descriptors.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Each vusb_dev also has a pointer to a vusb_dev_ops structure which serves as
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * the virtual method table and includes a virtual constructor and destructor.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * After a vusb_dev is created it may be attached to a hub device such as a
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * roothub (using vusbHubAttach). Although each hub structure has cPorts
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * and cDevices fields, it is the responsibility of the hub device to allocate
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * a free port for the new device.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Devices can chose one of two interfaces for dealing with requests, the
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * synchronous interface or the asynchronous interface. The synchronous
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * interface is much simpler and ought to be used for devices which are
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * unlikely to sleep for long periods in order to serve requests. The
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * asynchronous interface on the other hand is more difficult to use but is
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * useful for the USB proxy or if one were to write a mass storage device
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * emulator. Currently the synchronous interface only supports control and bulk
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * endpoints and is no longer used by anything.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * In order to use the asynchronous interface, the queue_urb, cancel_urb and
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * pfnUrbReap fields must be set in the devices vusb_dev_ops structure. The
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * queue_urb method is used to submit a request to a device without blocking,
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * it returns 1 if successful and 0 on any kind of failure. A successfully
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * queued URB is completed when the pfnUrbReap method returns it. Each function
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * address is reference counted so that pfnUrbReap will only be called if there
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * are URBs outstanding. For a roothub to reap an URB from any one of it's
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * devices, the vusbRhReapAsyncUrbs() function is used.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * There are four types of messages an URB may contain:
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * -# Control - represents a single packet of a multi-packet control
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * transfer, these are only really used by the host controller to
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * submit the parts to the usb core.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * -# Message - the usb core assembles multiple control transfers in
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * to single message transfers. In this case the data buffer
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * contains the setup packet in little endian followed by the full
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * buffer. In the case of an host-to-device control message, the
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * message packet is created when the STATUS transfer is seen. In
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * the case of device-to-host messages, the message packet is
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * created after the SETUP transfer is seen. Also, certain control
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * requests never go the real device and get handled synchronously.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * -# Bulk - Currently the only endpoint type that does error checking
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * and endpoint halting.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * -# Interrupt - The only non-periodic type supported.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Hubs are special cases of devices, they have a number of downstream ports
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * that other devices can be attached to and removed from.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * After a device has been attached (vusbHubAttach):
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * -# The hub attach method is called, which sends a hub status
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * change message to the OS.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * -# The OS resets the device, and it appears on the default
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * address with it's config 0 selected (a pseudo-config that
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * contains only 1 interface with 1 endpoint - the default
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * message pipe).
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * -# The OS assigns the device a new address and selects an
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * appropriate config.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * -# The device is ready.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * After a device has been detached (vusbDevDetach):
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * -# All pending URBs are cancelled.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * -# The devices address is unassigned.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * -# The hub detach method is called which signals the OS
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * of the status change.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * -# The OS unlinks the ED's for that device.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * A device can also request detachment from within its own methods by
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * calling vusbDevUnplugged().
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Roothubs are responsible for driving the whole system, they are special
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * cases of hubs and as such implement attach and detach methods, each one
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * is described by a struct vusb_roothub. Once a roothub has submitted an
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * URB to the USB core, a number of callbacks to the roothub are required
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * for when the URB completes, since the roothub typically wants to inform
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * the OS when transfers are completed.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * There are four callbacks to be concerned with:
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * -# prepare - This is called after the URB is successfully queued.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * -# completion - This is called after the URB completed.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * -# error - This is called if the URB errored, some systems have
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * automatic resubmission of failed requests, so this callback
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * should keep track of the error count and return 1 if the count
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * is above the number of allowed resubmissions.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * -# halt_ep - This is called after errors on bulk pipes in order
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * to halt the pipe.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk/*******************************************************************************
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk* Header Files *
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk*******************************************************************************/
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Attaches a device to a specific hub.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * This function is called by the vusb_add_device() and vusbRhAttachDevice().
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @returns VBox status code.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param pHub The hub to attach it to.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param pDev The device to attach.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @thread EMT
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic int vusbHubAttach(PVUSBHUB pHub, PVUSBDEV pDev)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk LogFlow(("vusbHubAttach: pHub=%p[%s] pDev=%p[%s]\n", pHub, pHub->pszName, pDev, pDev->pUsbIns->pszName));
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk AssertMsg(pDev->enmState == VUSB_DEVICE_STATE_DETACHED, ("enmState=%d\n", pDev->enmState));
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk /* noone else ever messes with the default pipe while we are attached */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk/* -=-=-=-=-=- PDMUSBHUBREG methods -=-=-=-=-=- */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk/** @copydoc PDMUSBHUBREG::pfnAttachDevice */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic DECLCALLBACK(int) vusbPDMHubAttachDevice(PPDMDRVINS pDrvIns, PPDMUSBINS pUsbIns, const char *pszCaptureFilename, uint32_t *piPort)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PVUSBROOTHUB pThis = PDMINS_2_DATA(pDrvIns, PVUSBROOTHUB);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Allocate a new VUSB device and initialize it.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PVUSBDEV pDev = (PVUSBDEV)RTMemAllocZ(sizeof(*pDev));
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk int rc = vusbDevInit(pDev, pUsbIns, pszCaptureFilename);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk/** @copydoc PDMUSBHUBREG::pfnDetachDevice */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic DECLCALLBACK(int) vusbPDMHubDetachDevice(PPDMDRVINS pDrvIns, PPDMUSBINS pUsbIns, uint32_t iPort)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * The hub registration structure.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk/* -=-=-=-=-=- VUSBIROOTHUBCONNECTOR methods -=-=-=-=-=- */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Finds an device attached to a roothub by it's address.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @returns Pointer to the device.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @returns NULL if not found.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param pRh Pointer to the root hub.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param Address The device address.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic PVUSBDEV vusbRhFindDevByAddress(PVUSBROOTHUB pRh, uint8_t Address)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk for (PVUSBDEV pDev = pRh->apAddrHash[iHash]; pDev; pDev = pDev->pNextHash)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Callback for freeing an URB.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param pUrb The URB to free.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic DECLCALLBACK(void) vusbRhFreeUrb(PVUSBURB pUrb)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Assert sanity.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PVUSBROOTHUB pRh = (PVUSBROOTHUB)pUrb->VUsb.pvFreeCtx;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Free the URB description (logging builds only).
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Put it into the LIFO of free URBs.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * (No ppPrev is needed here.)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk Assert(pRh->pFreeUrbs->enmState == VUSBURBSTATE_FREE);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Worker routine for vusbRhConnNewUrb() and vusbDevNewIsocUrb().
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkPVUSBURB vusbRhNewUrb(PVUSBROOTHUB pRh, uint8_t DstAddress, uint32_t cbData, uint32_t cTds)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Reuse or allocate a new URB.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk /** @todo try find a best fit, MSD which submits rather big URBs intermixed with small control
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * messages ends up with a 2+ of these big URBs when a single one is sufficient. */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk /** @todo The allocations should be done by the device, at least as an option, since the devices
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * frequently wish to associate their own stuff with the in-flight URB or need special buffering
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * (isochronous on Darwin for instance). */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk Assert(!pUrb->VUsb.pNext || pUrb->VUsb.pNext->enmState == VUSBURBSTATE_FREE);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk /* allocate a new one. */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk uint32_t cbDataAllocated = cbData <= _4K ? RT_ALIGN_32(cbData, _1K)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pUrb = (PVUSBURB)RTMemAlloc( RT_OFFSETOF(VUSBURB, abData[cbDataAllocated + 16])
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pUrb->Hci.paTds = (VUSBURB::VUSBURBHCI::VUSBURBHCITD *)(&pUrb->abData[cbDataAllocated + 16]);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * (Re)init the URB
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pUrb->VUsb.pDev = vusbRhFindDevByAddress(pRh, DstAddress);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pUrb->pUsbIns = pUrb->VUsb.pDev ? pUrb->VUsb.pDev->pUsbIns : NULL;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk/** @copydoc VUSBIROOTHUBCONNECTOR::pfnNewUrb */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic DECLCALLBACK(PVUSBURB) vusbRhConnNewUrb(PVUSBIROOTHUBCONNECTOR pInterface, uint8_t DstAddress, uint32_t cbData, uint32_t cTds)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PVUSBROOTHUB pRh = VUSBIROOTHUBCONNECTOR_2_VUSBROOTHUB(pInterface);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk return vusbRhNewUrb(pRh, DstAddress, cbData, cTds);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk/** @copydoc VUSBIROOTHUBCONNECTOR::pfnSubmitUrb */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic DECLCALLBACK(int) vusbRhSubmitUrb(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBURB pUrb, PPDMLED pLed)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PVUSBROOTHUB pRh = VUSBIROOTHUBCONNECTOR_2_VUSBROOTHUB(pInterface);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Total and per-type submit statistics.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk Assert(pUrb->enmType >= 0 && pUrb->enmType < (int)RT_ELEMENTS(pRh->aTypes));
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk STAM_COUNTER_INC(&pRh->Total.StatUrbsSubmitted);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk STAM_COUNTER_INC(&pRh->aTypes[pUrb->enmType].StatUrbsSubmitted);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk STAM_COUNTER_ADD(&pRh->Total.StatReqBytes, pUrb->cbData);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk STAM_COUNTER_ADD(&pRh->aTypes[pUrb->enmType].StatReqBytes, pUrb->cbData);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk STAM_COUNTER_ADD(&pRh->Total.StatReqReadBytes, pUrb->cbData);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk STAM_COUNTER_ADD(&pRh->aTypes[pUrb->enmType].StatReqReadBytes, pUrb->cbData);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk STAM_COUNTER_ADD(&pRh->Total.StatReqWriteBytes, pUrb->cbData);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk STAM_COUNTER_ADD(&pRh->aTypes[pUrb->enmType].StatReqWriteBytes, pUrb->cbData);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk STAM_COUNTER_ADD(&pRh->StatIsocReqPkts, pUrb->cIsocPkts);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk STAM_COUNTER_ADD(&pRh->StatIsocReqReadPkts, pUrb->cIsocPkts);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk STAM_COUNTER_ADD(&pRh->StatIsocReqWritePkts, pUrb->cIsocPkts);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * The device was resolved when we allocated the URB.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Submit it to the device if we found it, if not fail with device-not-ready.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pLed->Asserted.s.fReading = pLed->Actual.s.fReading = 1;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pLed->Asserted.s.fWriting = pLed->Actual.s.fWriting = 1;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk LogFlow(("vusbRhSubmitUrb: freeing pUrb=%p\n", pUrb));
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk Log(("vusb: pRh=%p: SUBMIT: Address %i not found!!!\n", pRh, pUrb->DstAddress));
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic DECLCALLBACK(int) vusbRhReapAsyncUrbsWorker(PVUSBDEV pDev, RTMSINTERVAL cMillies)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk vusbUrbDoReapAsync(pDev->pAsyncUrbHead, RT_MIN(cMillies >> 8, 10));
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk/** @copydoc VUSBIROOTHUBCONNECTOR::pfnReapAsyncUrbs */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic DECLCALLBACK(void) vusbRhReapAsyncUrbs(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBIDEVICE pDevice, RTMSINTERVAL cMillies)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PVUSBROOTHUB pRh = VUSBIROOTHUBCONNECTOR_2_VUSBROOTHUB(pInterface);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk int rc = vusbDevIoThreadExecSync(pDev, (PFNRT)vusbRhReapAsyncUrbsWorker, 2, pDev, cMillies);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk/** @copydoc VUSBIROOTHUBCONNECTOR::pfnCancelUrbsEp */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic DECLCALLBACK(int) vusbRhCancelUrbsEp(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBURB pUrb)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PVUSBROOTHUB pRh = VUSBIROOTHUBCONNECTOR_2_VUSBROOTHUB(pInterface);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk //@todo: This method of URB canceling may not work on non-Linux hosts.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Cancel and reap the URB(s) on an endpoint.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk LogFlow(("vusbRhCancelUrbsEp: pRh=%p pUrb=%p\n", pRh));
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk /* The reaper thread will take care of completing the URB. */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Worker doing the actual cancelling of all outstanding URBs on the device I/O thread.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @returns VBox status code.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param pDev USB device instance data.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic DECLCALLBACK(int) vusbRhCancelAllUrbsWorker(PVUSBDEV pDev)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Cancel the URBS.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Not using th CritAsyncUrbs critical section here is safe
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * as the I/O thread is the only thread accessing this struture at the
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk /* Call the worker directly. */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk/** @copydoc VUSBIROOTHUBCONNECTOR::pfnCancelAllUrbs */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic DECLCALLBACK(void) vusbRhCancelAllUrbs(PVUSBIROOTHUBCONNECTOR pInterface)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PVUSBROOTHUB pRh = VUSBIROOTHUBCONNECTOR_2_VUSBROOTHUB(pInterface);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk vusbDevIoThreadExecSync(pDev, (PFNRT)vusbRhCancelAllUrbsWorker, 1, pDev);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk/** @copydoc VUSBIROOTHUBCONNECTOR::pfnAttachDevice */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic DECLCALLBACK(int) vusbRhAttachDevice(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBIDEVICE pDevice)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PVUSBROOTHUB pRh = VUSBIROOTHUBCONNECTOR_2_VUSBROOTHUB(pInterface);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk return vusbHubAttach(&pRh->Hub, (PVUSBDEV)pDevice);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk/** @copydoc VUSBIROOTHUBCONNECTOR::pfnDetachDevice */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic DECLCALLBACK(int) vusbRhDetachDevice(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBIDEVICE pDevice)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PVUSBROOTHUB pRh = VUSBIROOTHUBCONNECTOR_2_VUSBROOTHUB(pInterface);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk/* -=-=-=-=-=- VUSB Device methods (for the root hub) -=-=-=-=-=- */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @copydoc VUSBIDEVICE::pfnReset
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic DECLCALLBACK(int) vusbRhDevReset(PVUSBIDEVICE pInterface, bool fResetOnLinux, PFNVUSBRESETDONE pfnDone, void *pvUser, PVM pVM)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PVUSBROOTHUB pRh = RT_FROM_MEMBER(pInterface, VUSBROOTHUB, Hub.Dev.IDevice);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk return pRh->pIRhPort->pfnReset(pRh->pIRhPort, fResetOnLinux); /** @todo change rc from bool to vbox status everywhere! */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @copydoc VUSBIDEVICE::pfnPowerOn
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic DECLCALLBACK(int) vusbRhDevPowerOn(PVUSBIDEVICE pInterface)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PVUSBROOTHUB pRh = RT_FROM_MEMBER(pInterface, VUSBROOTHUB, Hub.Dev.IDevice);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk Assert( pRh->Hub.Dev.enmState != VUSB_DEVICE_STATE_DETACHED
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk && pRh->Hub.Dev.enmState != VUSB_DEVICE_STATE_RESET);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk if (pRh->Hub.Dev.enmState == VUSB_DEVICE_STATE_ATTACHED)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pRh->Hub.Dev.enmState = VUSB_DEVICE_STATE_POWERED;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @copydoc VUSBIDEVICE::pfnPowerOff
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic DECLCALLBACK(int) vusbRhDevPowerOff(PVUSBIDEVICE pInterface)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PVUSBROOTHUB pRh = RT_FROM_MEMBER(pInterface, VUSBROOTHUB, Hub.Dev.IDevice);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk Assert( pRh->Hub.Dev.enmState != VUSB_DEVICE_STATE_DETACHED
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk && pRh->Hub.Dev.enmState != VUSB_DEVICE_STATE_RESET);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Cancel all URBs and reap them.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk VUSBIRhReapAsyncUrbs(&pRh->IRhConnector, (PVUSBIDEVICE)pDev, 0);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pRh->Hub.Dev.enmState = VUSB_DEVICE_STATE_ATTACHED;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @copydoc VUSBIDEVICE::pfnGetState
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkDECLCALLBACK(VUSBDEVICESTATE) vusbRhDevGetState(PVUSBIDEVICE pInterface)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PVUSBROOTHUB pRh = RT_FROM_MEMBER(pInterface, VUSBROOTHUB, Hub.Dev.IDevice);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk/* -=-=-=-=-=- VUSB Hub methods -=-=-=-=-=- */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Attach the device to the hub.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Port assignments and all such stuff is up to this routine.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @returns VBox status code.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param pHub Pointer to the hub.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param pDev Pointer to the device.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic int vusbRhHubOpAttach(PVUSBHUB pHub, PVUSBDEV pDev)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Assign a port.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk int iPort = ASMBitFirstSet(&pRh->Bitmap, sizeof(pRh->Bitmap) * 8);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Call the HCI attach routine and let it have its say before the device is
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * linked into the device list of this hub.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk int rc = pRh->pIRhPort->pfnAttach(pRh->pIRhPort, &pDev->IDevice, iPort);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk LogRel(("VUSB: Attached '%s' to port %d\n", pDev->pUsbIns->pszName, iPort));
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk LogRel(("VUSB: Failed to attach '%s' to port %d, rc=%Rrc\n", pDev->pUsbIns->pszName, iPort, rc));
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Detach the device from the hub.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @returns VBox status code.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param pHub Pointer to the hub.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param pDev Pointer to the device.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic void vusbRhHubOpDetach(PVUSBHUB pHub, PVUSBDEV pDev)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Check that it's attached and unlink it from the linked list.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Detach the device and mark the port as available.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pRh->pIRhPort->pfnDetach(pRh->pIRhPort, &pDev->IDevice, uPort);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk LogRel(("VUSB: Detached '%s' from port %u\n", pDev->pUsbIns->pszName, uPort));
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * The Hub methods implemented by the root hub.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk/* -=-=-=-=-=- PDM Base interface methods -=-=-=-=-=- */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @interface_method_impl{PDMIBASE,pfnQueryInterface}
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic DECLCALLBACK(void *) vusbRhQueryInterface(PPDMIBASE pInterface, const char *pszIID)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PVUSBROOTHUB pRh = PDMINS_2_DATA(pDrvIns, PVUSBROOTHUB);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMIBASE_RETURN_INTERFACE(pszIID, VUSBIROOTHUBCONNECTOR, &pRh->IRhConnector);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMIBASE_RETURN_INTERFACE(pszIID, VUSBIDEVICE, &pRh->Hub.Dev.IDevice);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk/* -=-=-=-=-=- PDM Driver methods -=-=-=-=-=- */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Destruct a driver instance.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Most VM resources are freed by the VM. This callback is provided so that any non-VM
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * resources can be freed correctly.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @param pDrvIns The driver instance data.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic DECLCALLBACK(void) vusbRhDestruct(PPDMDRVINS pDrvIns)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PVUSBROOTHUB pRh = PDMINS_2_DATA(pDrvIns, PVUSBROOTHUB);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Free all URBs.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Construct a root hub driver instance.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * @copydoc FNPDMDRVCONSTRUCT
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenkstatic DECLCALLBACK(int) vusbRhConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk LogFlow(("vusbRhConstruct: Instance %d\n", pDrvIns->iInstance));
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PVUSBROOTHUB pThis = PDMINS_2_DATA(pDrvIns, PVUSBROOTHUB);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Validate configuration.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Check that there are no drivers below us.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk ("Configuration error: Not possible to attach anything to this driver!\n"),
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Initialize the critical sections.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk int rc = RTCritSectInit(&pThis->CritSectDevices);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Initialize the data members.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pDrvIns->IBase.pfnQueryInterface = vusbRhQueryInterface;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk /* the usb device */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pThis->Hub.Dev.enmState = VUSB_DEVICE_STATE_ATTACHED;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pThis->Hub.Dev.u8Address = VUSB_INVALID_ADDRESS;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pThis->Hub.Dev.u8NewAddress = VUSB_INVALID_ADDRESS;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pThis->Hub.Dev.IDevice.pfnReset = vusbRhDevReset;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pThis->Hub.Dev.IDevice.pfnPowerOn = vusbRhDevPowerOn;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pThis->Hub.Dev.IDevice.pfnPowerOff = vusbRhDevPowerOff;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pThis->Hub.Dev.IDevice.pfnGetState = vusbRhDevGetState;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk /* the hub */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk //pThis->hub.cPorts - later
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk RTStrAPrintf(&pThis->Hub.pszName, "RootHub#%d", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk /* the connector */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pThis->IRhConnector.pfnNewUrb = vusbRhConnNewUrb;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pThis->IRhConnector.pfnSubmitUrb = vusbRhSubmitUrb;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pThis->IRhConnector.pfnReapAsyncUrbs= vusbRhReapAsyncUrbs;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pThis->IRhConnector.pfnCancelUrbsEp = vusbRhCancelUrbsEp;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pThis->IRhConnector.pfnCancelAllUrbs= vusbRhCancelAllUrbs;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pThis->IRhConnector.pfnAttachDevice = vusbRhAttachDevice;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pThis->IRhConnector.pfnDetachDevice = vusbRhDetachDevice;
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Resolve interface(s).
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pThis->pIRhPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, VUSBIROOTHUBPORT);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk AssertMsgReturn(pThis->pIRhPort, ("Configuration error: the device/driver above us doesn't expose any VUSBIROOTHUBPORT interface!\n"), VERR_PDM_MISSING_INTERFACE_ABOVE);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Get number of ports and the availability bitmap.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * ASSUME that the number of ports reported now at creation time is the max number.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pThis->Hub.cPorts = pThis->pIRhPort->pfnGetAvailablePorts(pThis->pIRhPort, &pThis->Bitmap);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk Log(("vusbRhConstruct: cPorts=%d\n", pThis->Hub.cPorts));
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Get the USB version of the attached HC.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * ASSUME that version 2.0 implies high-speed.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk pThis->fHcVersions = pThis->pIRhPort->pfnGetUSBVersions(pThis->pIRhPort);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk Log(("vusbRhConstruct: fHcVersions=%u\n", pThis->fHcVersions));
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Register ourselves as a USB hub.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * The current implementation uses the VUSBIRHCONFIG interface for communication.
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk rc = PDMDrvHlpUSBRegisterHub(pDrvIns, pThis->fHcVersions, pThis->Hub.cPorts, &g_vusbHubReg, &pHlp);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk * Statistics. (It requires a 30" monitor or extremely tiny fonts to edit this "table".)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->Total.StatUrbsSubmitted, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "The number of URBs submitted.", "/VUSB/%d/UrbsSubmitted", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatUrbsSubmitted, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Bulk transfer.", "/VUSB/%d/UrbsSubmitted/Bulk", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatUrbsSubmitted, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Control transfer.", "/VUSB/%d/UrbsSubmitted/Ctrl", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatUrbsSubmitted, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Interrupt transfer.", "/VUSB/%d/UrbsSubmitted/Intr", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatUrbsSubmitted, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Isochronous transfer.", "/VUSB/%d/UrbsSubmitted/Isoc", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->Total.StatUrbsCancelled, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "The number of URBs cancelled. (included in failed)", "/VUSB/%d/UrbsCancelled", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatUrbsCancelled, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Bulk transfer.", "/VUSB/%d/UrbsCancelled/Bulk", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatUrbsCancelled, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Control transfer.", "/VUSB/%d/UrbsCancelled/Ctrl", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatUrbsCancelled, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Interrupt transfer.", "/VUSB/%d/UrbsCancelled/Intr", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatUrbsCancelled, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Isochronous transfer.", "/VUSB/%d/UrbsCancelled/Isoc", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->Total.StatUrbsFailed, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "The number of URBs failing.", "/VUSB/%d/UrbsFailed", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatUrbsFailed, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Bulk transfer.", "/VUSB/%d/UrbsFailed/Bulk", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatUrbsFailed, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Control transfer.", "/VUSB/%d/UrbsFailed/Ctrl", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatUrbsFailed, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Interrupt transfer.", "/VUSB/%d/UrbsFailed/Intr", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatUrbsFailed, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Isochronous transfer.", "/VUSB/%d/UrbsFailed/Isoc", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->Total.StatReqBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Total requested transfer.", "/VUSB/%d/ReqBytes", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatReqBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Bulk transfer.", "/VUSB/%d/ReqBytes/Bulk", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatReqBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Control transfer.", "/VUSB/%d/ReqBytes/Ctrl", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatReqBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Interrupt transfer.", "/VUSB/%d/ReqBytes/Intr", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatReqBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Isochronous transfer.", "/VUSB/%d/ReqBytes/Isoc", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->Total.StatReqReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Total requested read transfer.", "/VUSB/%d/ReqReadBytes", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatReqReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Bulk transfer.", "/VUSB/%d/ReqReadBytes/Bulk", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatReqReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Control transfer.", "/VUSB/%d/ReqReadBytes/Ctrl", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatReqReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Interrupt transfer.", "/VUSB/%d/ReqReadBytes/Intr", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatReqReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Isochronous transfer.", "/VUSB/%d/ReqReadBytes/Isoc", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->Total.StatReqWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Total requested write transfer.", "/VUSB/%d/ReqWriteBytes", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatReqWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Bulk transfer.", "/VUSB/%d/ReqWriteBytes/Bulk", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatReqWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Control transfer.", "/VUSB/%d/ReqWriteBytes/Ctrl", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatReqWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Interrupt transfer.", "/VUSB/%d/ReqWriteBytes/Intr", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatReqWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Isochronous transfer.", "/VUSB/%d/ReqWriteBytes/Isoc", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->Total.StatActBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Actual total transfer.", "/VUSB/%d/ActBytes", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatActBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Bulk transfer.", "/VUSB/%d/ActBytes/Bulk", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatActBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Control transfer.", "/VUSB/%d/ActBytes/Ctrl", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatActBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Interrupt transfer.", "/VUSB/%d/ActBytes/Intr", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatActBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Isochronous transfer.", "/VUSB/%d/ActBytes/Isoc", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->Total.StatActReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Actual total read transfer.", "/VUSB/%d/ActReadBytes", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatActReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Bulk transfer.", "/VUSB/%d/ActReadBytes/Bulk", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatActReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Control transfer.", "/VUSB/%d/ActReadBytes/Ctrl", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatActReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Interrupt transfer.", "/VUSB/%d/ActReadBytes/Intr", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatActReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Isochronous transfer.", "/VUSB/%d/ActReadBytes/Isoc", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->Total.StatActWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Actual total write transfer.", "/VUSB/%d/ActWriteBytes", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatActWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Bulk transfer.", "/VUSB/%d/ActWriteBytes/Bulk", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatActWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Control transfer.", "/VUSB/%d/ActWriteBytes/Ctrl", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatActWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Interrupt transfer.", "/VUSB/%d/ActWriteBytes/Intr", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatActWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Isochronous transfer.", "/VUSB/%d/ActWriteBytes/Isoc", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatUrbsSubmitted, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of submitted URBs.", "/VUSB/%d/Bulk/Urbs", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatUrbsFailed, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of failed URBs.", "/VUSB/%d/Bulk/UrbsFailed", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatUrbsCancelled, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of cancelled URBs.", "/VUSB/%d/Bulk/UrbsFailed/Cancelled", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatActBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Number of bytes transferred.", "/VUSB/%d/Bulk/ActBytes", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatActReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Read.", "/VUSB/%d/Bulk/ActBytes/Read", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatActWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Write.", "/VUSB/%d/Bulk/ActBytes/Write", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatReqBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Requested number of bytes.", "/VUSB/%d/Bulk/ReqBytes", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatReqReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Read.", "/VUSB/%d/Bulk/ReqBytes/Read", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_BULK].StatReqWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Write.", "/VUSB/%d/Bulk/ReqBytes/Write", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk /* control */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatUrbsSubmitted, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of submitted URBs.", "/VUSB/%d/Ctrl/Urbs", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatUrbsFailed, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of failed URBs.", "/VUSB/%d/Ctrl/UrbsFailed", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatUrbsCancelled, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of cancelled URBs.", "/VUSB/%d/Ctrl/UrbsFailed/Cancelled", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatActBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Number of bytes transferred.", "/VUSB/%d/Ctrl/ActBytes", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatActReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Read.", "/VUSB/%d/Ctrl/ActBytes/Read", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatActWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Write.", "/VUSB/%d/Ctrl/ActBytes/Write", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatReqBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Requested number of bytes.", "/VUSB/%d/Ctrl/ReqBytes", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatReqReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Read.", "/VUSB/%d/Ctrl/ReqBytes/Read", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_CTRL].StatReqWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Write.", "/VUSB/%d/Ctrl/ReqBytes/Write", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk /* interrupt */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatUrbsSubmitted, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of submitted URBs.", "/VUSB/%d/Intr/Urbs", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatUrbsFailed, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of failed URBs.", "/VUSB/%d/Intr/UrbsFailed", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatUrbsCancelled, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of cancelled URBs.", "/VUSB/%d/Intr/UrbsFailed/Cancelled", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatActBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Number of bytes transferred.", "/VUSB/%d/Intr/ActBytes", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatActReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Read.", "/VUSB/%d/Intr/ActBytes/Read", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatActWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Write.", "/VUSB/%d/Intr/ActBytes/Write", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatReqBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Requested number of bytes.", "/VUSB/%d/Intr/ReqBytes", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatReqReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Read.", "/VUSB/%d/Intr/ReqBytes/Read", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_INTR].StatReqWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Write.", "/VUSB/%d/Intr/ReqBytes/Write", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk /* isochronous */
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatUrbsSubmitted, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of submitted URBs.", "/VUSB/%d/Isoc/Urbs", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatUrbsFailed, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of failed URBs.", "/VUSB/%d/Isoc/UrbsFailed", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatUrbsCancelled, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of cancelled URBs.", "/VUSB/%d/Isoc/UrbsFailed/Cancelled", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatActBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Number of bytes transferred.", "/VUSB/%d/Isoc/ActBytes", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatActReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Read.", "/VUSB/%d/Isoc/ActBytes/Read", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatActWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Write.", "/VUSB/%d/Isoc/ActBytes/Write", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatReqBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Requested number of bytes.", "/VUSB/%d/Isoc/ReqBytes", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatReqReadBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Read.", "/VUSB/%d/Isoc/ReqBytes/Read", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aTypes[VUSBXFERTYPE_ISOC].StatReqWriteBytes, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES, "Write.", "/VUSB/%d/Isoc/ReqBytes/Write", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatIsocActPkts, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Number of isochronous packets returning data.", "/VUSB/%d/Isoc/ActPkts", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatIsocActReadPkts, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Read.", "/VUSB/%d/Isoc/ActPkts/Read", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatIsocActWritePkts, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Write.", "/VUSB/%d/Isoc/ActPkts/Write", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatIsocReqPkts, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Requested number of isochronous packets.", "/VUSB/%d/Isoc/ReqPkts", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatIsocReqReadPkts, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Read.", "/VUSB/%d/Isoc/ReqPkts/Read", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatIsocReqWritePkts, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "Write.", "/VUSB/%d/Isoc/ReqPkts/Write", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk for (unsigned i = 0; i < RT_ELEMENTS(pThis->aStatIsocDetails); i++)
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aStatIsocDetails[i].Pkts, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, ".", "/VUSB/%d/Isoc/%d", pDrvIns->iInstance, i);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aStatIsocDetails[i].Ok, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, ".", "/VUSB/%d/Isoc/%d/Ok", pDrvIns->iInstance, i);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aStatIsocDetails[i].Ok0, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, ".", "/VUSB/%d/Isoc/%d/Ok0", pDrvIns->iInstance, i);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aStatIsocDetails[i].DataUnderrun, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, ".", "/VUSB/%d/Isoc/%d/DataUnderrun", pDrvIns->iInstance, i);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aStatIsocDetails[i].DataUnderrun0, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, ".", "/VUSB/%d/Isoc/%d/DataUnderrun0", pDrvIns->iInstance, i);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aStatIsocDetails[i].DataOverrun, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, ".", "/VUSB/%d/Isoc/%d/DataOverrun", pDrvIns->iInstance, i);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aStatIsocDetails[i].NotAccessed, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, ".", "/VUSB/%d/Isoc/%d/NotAccessed", pDrvIns->iInstance, i);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aStatIsocDetails[i].Misc, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, ".", "/VUSB/%d/Isoc/%d/Misc", pDrvIns->iInstance, i);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->aStatIsocDetails[i].Bytes, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_BYTES, ".", "/VUSB/%d/Isoc/%d/Bytes", pDrvIns->iInstance, i);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk 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);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatSubmitUrb, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, "Profiling the vusbRhSubmitUrb body.", "/VUSB/%d/SubmitUrb", pDrvIns->iInstance);
4b8d88eb610aa1e0bb6ec632f792744b3d6b5f22jeff.schenk PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->cUrbsInPool, STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT, "The number of URBs in the pool.", "/VUSB/%d/cUrbsInPool", pDrvIns->iInstance);
sizeof(VUSBROOTHUB),
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,