The current USB stack is broken when you call BS.ConnectController()
with a USB device Device Path for instance like
PciRoot(0)/PCI(31,2)/USB(1,0)/USB(3,0)
The issue is not new and has probably always existed.

What the UEFI specification says about EFI_DRIVER_BINDING_PROTOCOL.Start():

  If the driver specified by This is a bus driver that is capable
  of creating one child handle at a time and RemainingDevicePath
  is not NULL and does not begin with the End of Device Path node,
  then an attempt is made to create the device handle for the child
  device specified by RemainingDevicePath. Depending on the bus type,
  all of the child devices may need to be discovered and enumerated,
  but at most only the device handle for the one child specified by
  RemainingDevicePath shall be created.

  Source: 10.1 EFI Driver Binding Protocol (UEFI spec 2.5)

With the current USB stack implementation, BS.ConnectController()
would return EFI_SUCCESS without having connecting 'USB(3,0)'.

The reason is the USB stack initialization is based on Timer Event.
The initialization and the creation of USB(3,0) device node would
happen asynchronously.

The reason why the issue has not been highlighted earlier is because
people tend to 'connect' all the drivers when they start the Intel BDS.
These initializations take time. And it is likely all the timer based
initialization are completed by the end of ConnectAllControllers().

The design choice I made for the ARM BDS is to only start the required
devices (ie: the console devices). This USB issue appears straight
away in this use case.

My workaround is to replace gBS->SignalEvent() by direct calls to
the functions that should have replied to these events.
The patch is not perfect. I was told USB Hub are not enumerated
correctly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.mar...@arm.com>

Olivier Martin (2):
  MdeModulePkg/Usb: Force the USB initialization to be synchronous
  MdeModulePkg/EhciDxe: Do not process a same URB twice

 MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c      |  6 ++++++
 MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c |  9 +++++++++
 MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.c   |  1 +
 MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.h   |  3 ++-
 MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c  | 11 +++++++++--
 5 files changed, 27 insertions(+), 3 deletions(-)
 mode change 100644 => 100755 MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c
 mode change 100644 => 100755 MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c

-- 
2.1.1


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to