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