diff options
author | Olivier Martin <olivier.martin@arm.com> | 2014-09-23 17:35:33 +0100 |
---|---|---|
committer | Ryan Harkin <ryan.harkin@linaro.org> | 2014-10-22 16:22:40 +0100 |
commit | b5b92ff489d3e3891851ffa686a64528b8c433c5 (patch) | |
tree | cf6585760fa4b103c6e0f7ef90b2855a21a00ef9 | |
parent | 96398678d2cf184a18befe0c8b929a27a7f8eb03 (diff) |
MdeModulePkg/Usb: Force the USB initialization to be synchronous
The USB stack uses BS.SignalEvent and Timer event to initialize the USB stack.
It means a USB device initialization might not be completed when returning
from BS.ConnectController().
This behaviour is not compliant with the UEFI spec.
This change is only a _temporary hack_ as it forces the enumeration of the
entire USB bus when the USB Root Hub is initialized which makes this solution
non optimal.
Change-Id: I7d569f0cff9bd7780f9949a6cad93fd1eb669f5b
-rwxr-xr-x[-rw-r--r--] | MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c | 11 |
2 files changed, 15 insertions, 2 deletions
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c b/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c index 3fcb0f991..a3eb14b28 100644..100755 --- a/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c +++ b/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c @@ -1095,6 +1095,12 @@ EhcAsyncInterruptTransfer ( EhcLinkQhToPeriod (Ehc, Urb->Qh);
InsertHeadList (&Ehc->AsyncIntTransfers, &Urb->UrbList);
+ // ARM: Force an asynchonous transfer after waiting an interval
+ // Polling interval is in milliseconds while BS.Stall except
+ // Microseconds.
+ gBS->Stall (PollingInterval * 1000);
+ EhcMonitorAsyncRequests (Ehc->PollTimer, Ehc);
+
ON_EXIT:
Ehc->PciIo->Flush (Ehc->PciIo);
gBS->RestoreTPL (OldTpl);
diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c index e3752d1f8..be07a740c 100644..100755 --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c @@ -668,7 +668,10 @@ UsbOnHubInterrupt ( }
CopyMem (HubIf->ChangeMap, Data, DataLength);
- gBS->SignalEvent (HubIf->HubNotify);
+
+ //ARM: We do not use BS.SignalEvent in order to initialize the new device immediately
+ //gBS->SignalEvent (HubIf->HubNotify);
+ UsbHubEnumeration (HubIf->HubNotify, HubIf);
return EFI_SUCCESS;
}
@@ -1112,7 +1115,11 @@ UsbRootHubInit ( // It should signal the event immediately here, or device detection
// by bus enumeration might be delayed by the timer interval.
//
- gBS->SignalEvent (HubIf->HubNotify);
+
+ //ARM: We invoke the function directly to ensure the enumeration is
+ // done immediately.
+ //gBS->SignalEvent (HubIf->HubNotify);
+ UsbRootHubEnumeration (NULL, HubIf);
Status = gBS->SetTimer (
HubIf->HubNotify,
|