Author: tfaber Date: Sat Jul 5 15:30:22 2014 New Revision: 63686
URL: http://svn.reactos.org/svn/reactos?rev=63686&view=rev Log: [USBEHCI] - Initialize the new queue head before inserting it into the asynchronous schedule list, and add a memory barrier to ensure this order. The list can be read by the host controller at any time, so the new item must be valid when inserted. See EHCI spec section 4.8.1.
Modified: trunk/reactos/drivers/usb/usbehci/usb_queue.cpp
Modified: trunk/reactos/drivers/usb/usbehci/usb_queue.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/usb_que... ============================================================================== --- trunk/reactos/drivers/usb/usbehci/usb_queue.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbehci/usb_queue.cpp [iso-8859-1] Sat Jul 5 15:30:22 2014 @@ -479,20 +479,22 @@ InsertTailList(&HeadQueueHead->LinkedQueueHeads, &NewQueueHead->LinkedQueueHeads);
// + // Update HLP for NewQueueHead to point to next, which should be the HeadQueueHead + // + Entry = NewQueueHead->LinkedQueueHeads.Flink; + NextQueueHead = CONTAINING_RECORD(Entry, QUEUE_HEAD, LinkedQueueHeads); + //ASSERT(NextQueueHead == HeadQueueHead); + NewQueueHead->HorizontalLinkPointer = (NextQueueHead->PhysicalAddr | QH_TYPE_QH); + + _ReadWriteBarrier(); + + // // Update HLP for Previous QueueHead, which should be the last in list. // Entry = NewQueueHead->LinkedQueueHeads.Blink; LastQueueHead = CONTAINING_RECORD(Entry, QUEUE_HEAD, LinkedQueueHeads); //ASSERT(LastQueueHead == HeadQueueHead); LastQueueHead->HorizontalLinkPointer = (NewQueueHead->PhysicalAddr | QH_TYPE_QH); - - // - // Update HLP for NewQueueHead to point to next, which should be the HeadQueueHead - // - Entry = NewQueueHead->LinkedQueueHeads.Flink; - NextQueueHead = CONTAINING_RECORD(Entry, QUEUE_HEAD, LinkedQueueHeads); - //ASSERT(NextQueueHead == HeadQueueHead); - NewQueueHead->HorizontalLinkPointer = (NextQueueHead->PhysicalAddr | QH_TYPE_QH);
// // head queue head must be halted