I have a USB 2.0 disk (MSD) connected to XHCI. I am able to detect the device connected and complete all standard USB device initialization steps up-to the point of ConfigureEndpoint + SetConfiguration + Reset USB MSD + Send 31 byte CBW with INQUIRY command
After sending 31 byte CBW SCSI INQUIRY command I get an IRQ indicating the completion of TD corresponding to CBW on bulk-out-endpoint
After this, I place an in/read TD for 36 bytes on bulk-in-endpoint but there is no IRQ !
Apart from going through XHCI intel documentation I also went through Benjamin David Lunt's book
. I can't see anything being done incorrectly in my code/approach
1. The code to form SCSI commands is common irrespective of whether the underlying USB controller is XHCI or EHCI. It works fine with EHCI
2. The code works on QEMU with XHCI
I am not sure why there is no IRQ for 36 byte read TD while I do receive an IRQ for 32 byte CBW INQUIRY command
Appreciate some guidance...
I am sure you meant 31 byte CBW in that last line.
Anyway, at the moment, I can't think of anything you may be doing wrong, especially since it works when plugged into a EHCI port.
However, this tells you that it most likely will be with your xHCI code.
A few notes to check:
1) make sure the command part of the CBW is big-endian.
2) are you receiving the data? Even though the IRQ didn't fire, does the memory contain 36-bytes of data?
3) I can't imagine a device checking for it, but make sure the TAG parameter is different than the last one.
4) try requesting only the first 8 bytes and see if you get a IRQ to fire (same for a larger value, say 128).
5) (obvious, but still worth mentioning) you acknowledged the last IRQ so that this one will fire, yes?
Without more details, I can't help much further. This is were a USB Protocol Analyzer
comes in really handy. This lets you know what actually gets sent down the wire.
Anyway, do a few more checks. I know you will find it. I had a problem with something like this one time and couldn't ever figure it out. Finally I found it, it being something mostly unrelated to what I was working on. It happens. Check all code even remotely associated with it.