Recently I got interrupts to work correctly and I've made a lot of progress since then.
I'm at the point where I'm trying to read (the first 8 bytes of) a Device Descriptor.
First I initialized the slot and control endpoint for the device. I then allocated a memory buffer to store the Event TRB Status and the descriptor.
I then created a Setup TRB (Direction=3,ImmediateData,CorrectCycle) with the following setup packet:
Code: Select all
Setup Packet
Type = 0x80
Request = 0x06
Value = 0x0100
Index = 0x0000
Length = 0x0008
Then I created an Event Data TRB (IOC,CorrectCycle) pointing to the physical address of the status DWORD.
All of these were put into the Slot 1 (the correct slot) Control Endpoint ring.
Then I write a 1 to DoorbellOffset+sizeof(uint32_t) (slot 1 doorbell).
The problem is that it doesn't fire an interrupt.
I used GDB and QEMU to try to figure out what was happening, but it seems to be looking for a TR_STATUS TRB to actually evaluate the ring...
(this might be an inaccurate interpretation of the code at hcd-xhci.c:758)
--------------------------------------------
Relevant code and Logs are below. Lines starting with "[xHCI]" are my driver's logs and lines starting with "xhci" is the QEMU virtual xHCI controller logs.
QEMU/TritiumOS xHCI Log
Relevant Code
More xHCI code (less relevant)
Thanks ahead of time.