On Jul 20, 2021, at 8:32 AM, Ethin Probst <harlydavidsen@gmail.com> wrote:

Hello all,

A few days ago Leif determined that the USB DXE does not implement
isochronous transfers. This will make USB Audio quite impossible as
the audio data endpoint requires isochronous transfers.

I was looking at the EHCI driver but I can't determine a couple things:

- Isochronous transfers have a different structure compared to other
URB types. (Each URB type may have its own structure -- I haven't
checked.)
- I can't seem to figure out how this is handled in, say, EhciDxe.
- If we were to try and implement this -- though I'm not quite sure
how -- would we need to modify the PEIs too?


I don’t think we would need to change PEI. 


1s you need to figure out which UsbIo service you would need to code the USB Audio driver against. 
MdePkg/Include/Protocol/UsbIo.h:485:  EFI_USB_IO_ISOCHRONOUS_TRANSFER       UsbIsochronousTransfer;
MdePkg/Include/Protocol/UsbIo.h:486:  EFI_USB_IO_ASYNC_ISOCHRONOUS_TRANSFER UsbAsyncIsochronousTransfer;

That service would likely be implemented on top of the matching USB Host Controller service. 

MdePkg/Include/Protocol/Usb2HostController.h:635:  EFI_USB2_HC_PROTOCOL_ISOCHRONOUS_TRANSFER        IsochronousTransfer;
MdePkg/Include/Protocol/Usb2HostController.h:636:  EFI_USB2_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER  AsyncIsochronousTransfer;

MdePkg/Include/Protocol/UsbHostController.h:480:  EFI_USB_HC_PROTOCOL_ISOCHRONOUS_TRANSFER        IsochronousTransfer;
MdePkg/Include/Protocol/UsbHostController.h:481:  EFI_USB_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER  AsyncIsochronousTransfer;

So for each USB HC (EHCI, XHCI, OHCI, etc) that is needed you would need to implement the required isochronous transfer. This likely involves managing the DMA queue of the hardware. 

You would also need a generic change to the USB Bus Driver to implement the UsbIo services on top of the Usb Host Controller services. That would work for every USB Host Controller. 

Sorry I don’t know of any EFI USB Stack that implements Isochronous transfers. 

Thanks,

Andrew Fish

PS FYI that post I sent about gdb should work for you too if you grab those 2 files. 


--
Signed,
Ethin D. Probst