summaryrefslogtreecommitdiff
path: root/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Transfer.c
diff options
context:
space:
mode:
Diffstat (limited to 'SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Transfer.c')
-rw-r--r--SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Transfer.c55
1 files changed, 14 insertions, 41 deletions
diff --git a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Transfer.c b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Transfer.c
index deb802e4ad..773a7bd9c5 100644
--- a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Transfer.c
+++ b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Transfer.c
@@ -356,58 +356,31 @@ XhcExecTransfer (
)
{
TRANSFER_RING *Ring;
- UINT64 Begin;
- UINT64 TimeoutTicker;
- UINT64 TimerRound;
TRB_TEMPLATE *Trb;
+ UINTN Loop;
+ UINTN Index;
- Begin = 0;
- TimeoutTicker = 0;
- TimerRound = 0;
-
- XhcRingDoorBell (Handle, Urb);
-
- if (Timeout != 0) {
- Begin = GetPerformanceCounter ();
- TimeoutTicker = DivU64x32 (
- MultU64x64 (
- Handle->TimerFrequency,
- Timeout
- ),
- 1000000u
- );
- TimerRound = DivU64x64Remainder (
- TimeoutTicker,
- DivU64x32 (Handle->TimerCycle, 2),
- &TimeoutTicker
- );
+ Loop = Timeout / XHC_DEBUG_PORT_1_MILLISECOND;
+ if (Timeout == 0) {
+ Loop = 0xFFFFFFFF;
}
-
+ XhcRingDoorBell (Handle, Urb);
//
// Event Ring Not Empty bit can only be set to 1 by XHC after ringing door bell with some delay.
//
- while (TRUE) {
- if (Timeout != 0) {
- if (TimerRound == 0) {
- if (IsTimerTimeout (Handle, Begin, TimeoutTicker)) {
- //
- // If time out occurs.
- //
- Urb->Result |= EFI_USB_ERR_TIMEOUT;
- break;
- }
- } else {
- if (IsTimerTimeout (Handle, Begin, DivU64x32 (Handle->TimerCycle, 2))) {
- TimerRound --;
- }
- }
- }
+ for (Index = 0; Index < Loop; Index++) {
XhcCheckUrbResult (Handle, Urb);
if (Urb->Finished) {
break;
}
+ MicroSecondDelay (XHC_DEBUG_PORT_1_MILLISECOND);
}
-
+ if (Index == Loop) {
+ //
+ // If time out occurs.
+ //
+ Urb->Result |= EFI_USB_ERR_TIMEOUT;
+ }
//
// If URB transfer is error, restore transfer ring to original value before URB transfer
// This will make the current transfer TRB is always at the latest unused one in transfer ring.