Changeset 52878 in vbox for trunk/src/VBox
- Timestamp:
- Sep 28, 2014 5:05:33 PM (10 years ago)
- Location:
- trunk/src/VBox/Devices/USB
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/USB/DevOHCI.cpp
r52301 r52878 371 371 /** Event semaphore to interact with the framer thread. */ 372 372 R3PTRTYPE(RTSEMEVENT) hSemEventFrame; 373 /** Event semaphore to release the thread waiting for the framer thread to stop. */ 374 R3PTRTYPE(RTSEMEVENTMULTI) hSemEventFrameStopped; 373 375 /** Flag whether the framer thread should processing frames. */ 374 376 volatile bool fBusStarted; … … 793 795 static void rhport_power(POHCIROOTHUB pRh, unsigned iPort, bool fPowerUp); 794 796 static void ohciBusResume(POHCI ohci, bool fHardware); 797 static void ohciBusStop(POHCI pThis); 795 798 796 799 static DECLCALLBACK(void) ohciRhXferCompletion(PVUSBIROOTHUBPORT pInterface, PVUSBURB pUrb); … … 1111 1114 fResetOnLinux ? " (reset on linux)" : "")); 1112 1115 1116 /* Stop the bus in any case, disabling walking the lists. */ 1117 ohciBusStop(pThis); 1118 1113 1119 /* 1114 1120 * Cancel all outstanding URBs. … … 1127 1133 else 1128 1134 pThis->ctl &= OHCI_CTL_IR | OHCI_CTL_RWC; /* IR and RWC are preserved on software reset. */ 1135 1136 /* Clear the HCFS bits first to make setting the new state work. */ 1137 pThis->ctl &= ~OHCI_CTL_HCFS; 1129 1138 pThis->ctl |= fNewMode; 1130 1139 pThis->status = 0; … … 3836 3845 && pThread->enmState == PDMTHREADSTATE_RUNNING 3837 3846 && RT_SUCCESS(rc)) 3847 { 3848 /* Signal the waiter that we are stopped now. */ 3849 rc = RTSemEventMultiSignal(pThis->hSemEventFrameStopped); 3850 AssertRC(rc); 3838 3851 rc = RTSemEventWait(pThis->hSemEventFrame, RT_INDEFINITE_WAIT); 3852 } 3839 3853 3840 3854 AssertLogRelMsgReturn(RT_SUCCESS(rc) || rc == VERR_TIMEOUT, ("%Rrc\n", rc), rc); … … 3905 3919 3906 3920 pThis->SofTime = PDMDevHlpTMTimeVirtGet(pThis->CTX_SUFF(pDevIns)); 3907 ASMAtomicXchgBool(&pThis->fBusStarted, true); 3908 RTSemEventSignal(pThis->hSemEventFrame); 3921 bool fBusActive = ASMAtomicXchgBool(&pThis->fBusStarted, true); 3922 if (!fBusActive) 3923 RTSemEventSignal(pThis->hSemEventFrame); 3909 3924 } 3910 3925 … … 3914 3929 static void ohciBusStop(POHCI pThis) 3915 3930 { 3916 ASMAtomicXchgBool(&pThis->fBusStarted, false); 3917 RTSemEventSignal(pThis->hSemEventFrame); 3931 bool fBusActive = ASMAtomicXchgBool(&pThis->fBusStarted, false); 3932 if (fBusActive) 3933 { 3934 int rc = RTSemEventMultiReset(pThis->hSemEventFrameStopped); 3935 AssertRC(rc); 3936 3937 /* Signal the frame thread to stop. */ 3938 RTSemEventSignal(pThis->hSemEventFrame); 3939 3940 /* Wait for signal from the thrad that it stopped. */ 3941 rc = RTSemEventMultiWait(pThis->hSemEventFrameStopped, RT_INDEFINITE_WAIT); 3942 AssertRC(rc); 3943 } 3918 3944 VUSBIDevPowerOff(pThis->RootHub.pIDev); 3919 3945 } … … 5516 5542 * just one way of getting into the UsbReset state. 5517 5543 */ 5518 ohciBusStop(pThis);5519 5544 ohciDoReset(pThis, OHCI_USB_RESET, true /* reset devices */); 5520 5545 } … … 5633 5658 * Destroy event sempahores. 5634 5659 */ 5635 RTSemEventDestroy(pThis->hSemEventFrame); 5660 if (pThis->hSemEventFrame) 5661 RTSemEventDestroy(pThis->hSemEventFrame); 5662 if (pThis->hSemEventFrameStopped) 5663 RTSemEventMultiDestroy(pThis->hSemEventFrameStopped); 5636 5664 if (RTCritSectIsInitialized(&pThis->CritSect)) 5637 5665 RTCritSectDelete(&pThis->CritSect); … … 5789 5817 5790 5818 rc = RTSemEventCreate(&pThis->hSemEventFrame); 5819 AssertRCReturn(rc, rc); 5820 5821 rc = RTSemEventMultiCreate(&pThis->hSemEventFrameStopped); 5791 5822 AssertRCReturn(rc, rc); 5792 5823 -
trunk/src/VBox/Devices/USB/DrvVUSBRootHub.cpp
r52301 r52878 609 609 /* 610 610 * Cancel the URBS. 611 */ 612 RTCritSectEnter(&pDev->CritSectAsyncUrbs); 611 * 612 * Not using th CritAsyncUrbs critical section here is safe 613 * as the I/O thread is the only thread accessing this struture at the 614 * moment. 615 */ 613 616 PVUSBURB pUrb = pDev->pAsyncUrbHead; 614 617 … … 620 623 pUrb = pNext; 621 624 } 622 RTCritSectLeave(&pDev->CritSectAsyncUrbs);623 625 624 626 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.