Changeset 59737 in vbox for trunk/src/VBox/Devices/USB
- Timestamp:
- Feb 19, 2016 11:26:16 AM (9 years ago)
- Location:
- trunk/src/VBox/Devices/USB
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/USB/DrvVUSBRootHub.cpp
r59722 r59737 541 541 { 542 542 if (!cMillies) 543 vusbUrbDoReapAsync( pDev->pAsyncUrbHead, 0);543 vusbUrbDoReapAsync(&pDev->LstAsyncUrbs, 0); 544 544 else 545 545 { … … 547 547 do 548 548 { 549 vusbUrbDoReapAsync( pDev->pAsyncUrbHead, RT_MIN(cMillies >> 8, 10));550 } while ( pDev->pAsyncUrbHead549 vusbUrbDoReapAsync(&pDev->LstAsyncUrbs, RT_MIN(cMillies >> 8, 10)); 550 } while ( !RTListIsEmpty(&pDev->LstAsyncUrbs) 551 551 && RTTimeMilliTS() - u64Start < cMillies); 552 552 } … … 561 561 PVUSBDEV pDev = (PVUSBDEV)pDevice; 562 562 563 if ( !pDev->pAsyncUrbHead)563 if (RTListIsEmpty(&pDev->LstAsyncUrbs)) 564 564 return; 565 565 … … 606 606 * moment. 607 607 */ 608 PVUSBURB pUrb = pDev->pAsyncUrbHead;609 610 while (pUrb)611 { 612 PVUSBURB p Next = pUrb->pVUsb->pNext;608 PVUSBURBVUSB pVUsbUrb, pVUsbUrbNext; 609 610 RTListForEachSafe(&pDev->LstAsyncUrbs, pVUsbUrb, pVUsbUrbNext, VUSBURBVUSBINT, NdLst) 611 { 612 PVUSBURB pUrb = pVUsbUrb->pUrb; 613 613 /* Call the worker directly. */ 614 614 vusbUrbCancelWorker(pUrb, CANCELMODE_FAIL); 615 pUrb = pNext;616 615 } 617 616 … … 648 647 * Iterate the URBs, find ones corresponding to given EP, and cancel them. 649 648 */ 650 PVUSBURB pUrb = pDev->pAsyncUrbHead; 651 while (pUrb) 652 { 653 PVUSBURB pNext = pUrb->pVUsb->pNext; 649 PVUSBURBVUSB pVUsbUrb, pVUsbUrbNext; 650 651 RTListForEachSafe(&pDev->LstAsyncUrbs, pVUsbUrb, pVUsbUrbNext, VUSBURBVUSBINT, NdLst) 652 { 653 PVUSBURB pUrb = pVUsbUrb->pUrb; 654 654 655 655 Assert(pUrb->pVUsb->pDev == pDev); … … 661 661 AssertRC(rc); 662 662 } 663 pUrb = pNext;664 663 } 665 664 -
trunk/src/VBox/Devices/USB/VUSBDevice.cpp
r59718 r59737 1049 1049 * Iterate the URBs and cancel them. 1050 1050 */ 1051 PVUSBURB pUrb = pDev->pAsyncUrbHead;1052 while (pUrb)1053 { 1054 PVUSBURB p Next = pUrb->pVUsb->pNext;1051 PVUSBURBVUSB pVUsbUrb, pVUsbUrbNext; 1052 RTListForEachSafe(&pDev->LstAsyncUrbs, pVUsbUrb, pVUsbUrbNext, VUSBURBVUSBINT, NdLst) 1053 { 1054 PVUSBURB pUrb = pVUsbUrb->pUrb; 1055 1055 1056 1056 Assert(pUrb->pVUsb->pDev == pDev); … … 1059 1059 int rc = vusbUrbCancelWorker(pUrb, CANCELMODE_FAIL); 1060 1060 AssertRC(rc); 1061 pUrb = pNext;1062 1061 } 1063 1062 … … 1070 1069 { 1071 1070 cReaped = 0; 1072 p Urb = pDev->pAsyncUrbHead;1073 while (p Urb)1071 pVUsbUrb = RTListGetFirst(&pDev->LstAsyncUrbs, VUSBURBVUSBINT, NdLst); 1072 while (pVUsbUrb) 1074 1073 { 1075 PVUSBURB pNext = pUrb->pVUsb->pNext; 1074 PVUSBURBVUSB pNext = RTListGetNext(&pDev->LstAsyncUrbs, pVUsbUrb, VUSBURBVUSBINT, NdLst); 1075 PVUSBURB pUrb = pVUsbUrb->pUrb; 1076 1076 Assert(pUrb->pVUsb->pDev == pDev); 1077 1077 … … 1090 1090 if (pRipe) 1091 1091 { 1092 if (pRipe == pNext )1093 pNext = pNext->pVUsb->pNext;1092 if (pRipe == pNext->pUrb) 1093 pNext = RTListGetNext(&pDev->LstAsyncUrbs, pNext, VUSBURBVUSBINT, NdLst); 1094 1094 vusbUrbRipe(pRipe); 1095 1095 cReaped++; 1096 1096 } 1097 1097 1098 p Urb = pNext;1098 pVUsbUrb = pNext; 1099 1099 } 1100 1100 } while (cReaped > 0); … … 1105 1105 if (fDetaching) 1106 1106 { 1107 pUrb = pDev->pAsyncUrbHead; 1108 while (pUrb) 1107 RTListForEachSafe(&pDev->LstAsyncUrbs, pVUsbUrb, pVUsbUrbNext, VUSBURBVUSBINT, NdLst) 1109 1108 { 1110 PVUSBURB p Next = pUrb->pVUsb->pNext;1109 PVUSBURB pUrb = pVUsbUrb->pUrb; 1111 1110 Assert(pUrb->pVUsb->pDev == pDev); 1112 1111 … … 1119 1118 */ 1120 1119 pUrb->pVUsb->pfnFree(pUrb); 1121 pUrb = pNext;1122 1120 } 1123 1121 } … … 1764 1762 pDev->pCurCfgDesc = NULL; 1765 1763 pDev->paIfStates = NULL; 1764 RTListInit(&pDev->LstAsyncUrbs); 1766 1765 memset(&pDev->aPipes[0], 0, sizeof(pDev->aPipes)); 1767 1766 for (unsigned i = 0; i < RT_ELEMENTS(pDev->aPipes); i++) -
trunk/src/VBox/Devices/USB/VUSBInternal.h
r59724 r59737 75 75 typedef struct VUSBURBVUSBINT 76 76 { 77 /** URB chain pointer. */78 PVUSBURB pNext;79 /** URB chain pointer. */80 PVUSBURB *ppPrev;77 /** Node for one of the lists the URB can be in. */ 78 RTLISTNODE NdLst; 79 /** Pointer to the URB this structure is part of. */ 80 PVUSBURB pUrb; 81 81 /** Pointer to the original for control messages. */ 82 82 PVUSBURB pCtrlUrb; … … 248 248 RTCRITSECT CritSectAsyncUrbs; 249 249 /** List of active async URBs. */ 250 PVUSBURB pAsyncUrbHead; 250 RTLISTANCHOR LstAsyncUrbs; 251 #if HC_ARCH_BITS == 32 252 /** Align the size to a 8 byte boundary. */ 253 uint32_t u32Alignment0; 254 #endif 251 255 252 256 /** Dumper state. */ … … 476 480 int vusbUrbSubmit(PVUSBURB pUrb); 477 481 void vusbUrbTrace(PVUSBURB pUrb, const char *pszMsg, bool fComplete); 478 void vusbUrbDoReapAsync(P VUSBURB pHead, RTMSINTERVAL cMillies);482 void vusbUrbDoReapAsync(PRTLISTANCHOR pUrbLst, RTMSINTERVAL cMillies); 479 483 void vusbUrbDoReapAsyncDev(PVUSBDEV pDev, RTMSINTERVAL cMillies); 480 484 void vusbUrbCancel(PVUSBURB pUrb, CANCELMODE mode); … … 548 552 549 553 RTCritSectEnter(&pDev->CritSectAsyncUrbs); 550 *pUrb->pVUsb->ppPrev = pUrb->pVUsb->pNext; 551 if (pUrb->pVUsb->pNext) 552 pUrb->pVUsb->pNext->pVUsb->ppPrev = pUrb->pVUsb->ppPrev; 553 pUrb->pVUsb->pNext = NULL; 554 pUrb->pVUsb->ppPrev = NULL; 554 RTListNodeRemove(&pUrb->pVUsb->NdLst); 555 555 RTCritSectLeave(&pDev->CritSectAsyncUrbs); 556 556 } -
trunk/src/VBox/Devices/USB/VUSBUrb.cpp
r59704 r59737 1236 1236 ASMAtomicIncU32(&pDev->aPipes[pUrb->EndPt].async); 1237 1237 1238 /* Queue the pUrb on the roothub */ 1239 pUrb->pVUsb->pNext = pDev->pAsyncUrbHead; 1240 if (pDev->pAsyncUrbHead) 1241 pDev->pAsyncUrbHead->pVUsb->ppPrev = &pUrb->pVUsb->pNext; 1242 pDev->pAsyncUrbHead = pUrb; 1243 pUrb->pVUsb->ppPrev = &pDev->pAsyncUrbHead; 1238 /* Queue the Urb on the roothub */ 1239 RTListAppend(&pDev->LstAsyncUrbs, &pUrb->pVUsb->NdLst); 1244 1240 RTCritSectLeave(&pDev->CritSectAsyncUrbs); 1245 1241 … … 1994 1990 * Reap in-flight URBs. 1995 1991 * 1996 * @param p HeadPointer to the head of the URB list.1992 * @param pUrbLst Pointer to the head of the URB list. 1997 1993 * @param cMillies Number of milliseconds to block in each reap operation. 1998 1994 * Use 0 to not block at all. 1999 1995 */ 2000 void vusbUrbDoReapAsync(PVUSBURB pHead, RTMSINTERVAL cMillies) 2001 { 2002 PVUSBURB pUrb = pHead; 2003 while (pUrb) 2004 { 1996 void vusbUrbDoReapAsync(PRTLISTANCHOR pUrbLst, RTMSINTERVAL cMillies) 1997 { 1998 PVUSBURBVUSB pVUsbUrb = RTListGetFirst(pUrbLst, VUSBURBVUSBINT, NdLst); 1999 while (pVUsbUrb) 2000 { 2001 PVUSBURB pUrb = pVUsbUrb->pUrb; 2002 2005 2003 vusbUrbAssert(pUrb); 2006 PVUSBURB pUrbNext = pUrb->pVUsb->pNext;2007 PVUSBDEV pDev = p Urb->pVUsb->pDev;2004 PVUSBURBVUSB pVUsbUrbNext = RTListGetNext(pUrbLst, pVUsbUrb, VUSBURBVUSBINT, NdLst); 2005 PVUSBDEV pDev = pVUsbUrb->pDev; 2008 2006 2009 2007 /* Don't touch resetting devices - paranoid safety precaution. */ … … 2024 2022 { 2025 2023 vusbUrbAssert(pRipe); 2026 if (pRipe == p UrbNext)2027 p UrbNext = pUrbNext->pVUsb->pNext;2024 if (pRipe == pVUsbUrbNext->pUrb) 2025 pVUsbUrbNext = RTListGetNext(pUrbLst, pVUsbUrb, VUSBURBVUSBINT, NdLst); 2028 2026 vusbUrbRipe(pRipe); 2029 2027 } … … 2031 2029 2032 2030 /* next */ 2033 p Urb = pUrbNext;2031 pVUsbUrb = pVUsbUrbNext; 2034 2032 } 2035 2033 } -
trunk/src/VBox/Devices/USB/VUSBUrbPool.cpp
r59722 r59737 192 192 pUrb->pVUsb = (PVUSBURBVUSB)&pUrb->abData[offAlloc]; 193 193 offAlloc += sizeof(VUSBURBVUSBINT); 194 pUrb->pVUsb->pUrb = pUrb; 194 195 pUrb->pVUsb->pvFreeCtx = NULL; 195 196 pUrb->pVUsb->pfnFree = NULL; 196 pUrb->pVUsb->pNext = NULL;197 pUrb->pVUsb->ppPrev = NULL;198 197 pUrb->pVUsb->pCtrlUrb = NULL; 199 198 pUrb->pVUsb->u64SubmitTS = 0;
Note:
See TracChangeset
for help on using the changeset viewer.