diff options
author | Olivier Martin <olivier.martin@arm.com> | 2014-10-07 10:35:37 +0100 |
---|---|---|
committer | Ryan Harkin <ryan.harkin@linaro.org> | 2014-10-22 16:22:40 +0100 |
commit | c71b2dcbfbbfbec037f6274b4652a1a663c3b969 (patch) | |
tree | 0fe1d5afb37b1f026ff1d30f0cabc116788047cd | |
parent | adf60a548ad968db01443d4bc245d95e9db2af02 (diff) |
MdeModulePkg/EhciDxe: Do not process a same URB twice
After changing the USB stack to make it synchronous at initialization,
we were checking if there was a pending interrupt when the USB interrupt
was initialized for a specific device.
At the first enumeration, all the connected USB devices are initialized.
USB device drivers initialize their USB interrupt and process the completed
URBs. There was no way to check if a URB was in process because before
there was a single periodic task to process these URBs.
Note: this change is only required when using the temporary hack to make
the USB stack synchronous.
Change-Id: I4c56bec2079c3ad5280e4cf4b0094337c6a7a41d
-rw-r--r-- | MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c | 9 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.c | 1 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.h | 3 |
3 files changed, 12 insertions, 1 deletions
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c b/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c index 5594e6699..cc6e77e38 100644 --- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c +++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c @@ -573,6 +573,12 @@ EhcCheckUrbResult ( ASSERT ((Ehc != NULL) && (Urb != NULL) && (Urb->Qh != NULL));
+ // The URB is already being processed, we do not want the callback to be
+ // called twice for the same URB
+ if (Urb->InProgress) {
+ return FALSE;
+ }
+
Finished = TRUE;
Urb->Completed = 0;
@@ -992,6 +998,9 @@ EhcMonitorAsyncRequests ( continue;
}
+ // Mark the URB as 'in-progress' to prevent the URB to be processed twice.
+ Urb->InProgress = TRUE;
+
//
// Flush any PCI posted write transactions from a PCI host
// bridge to system memory.
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.c b/MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.c index 6afb327df..1ad37d5bd 100644 --- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.c +++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.c @@ -600,6 +600,7 @@ EhcCreateUrb ( Urb->DataLen = DataLen;
Urb->Callback = Callback;
Urb->Context = Context;
+ Urb->InProgress = FALSE;
PciIo = Ehc->PciIo;
Urb->Qh = EhcCreateQh (Ehc, &Urb->Ep);
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.h b/MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.h index 02e9af81b..0c80e7624 100644 --- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.h +++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.h @@ -232,7 +232,8 @@ struct _URB { // Transaction result
//
UINT32 Result;
- UINTN Completed; // completed data length
+ BOOLEAN InProgress; // defined when the URB is being processed
+ UINTN Completed; // Length of the data being processed
UINT8 DataToggle;
};
|