[SOLVED] xHCI: Command Ring does not work on my laptop

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
rdos
Member
Member
Posts: 3297
Joined: Wed Oct 01, 2008 1:55 pm

Re: xHCI: Command Ring does not work on my laptop

Post by rdos »

I don't know if this is relevant or not, but I had an buffer error in my XHCI driver, and it resulted in the event ring stopping too. The USB status register indicated halted and controller error. That's the only scenario I've seen that results in commands on the command ring not resulting in activity on the primary event ring.

I also had problems with multiple MSI vectors. One of my XHCI controllers failed to send the IRQ when the second interrupter was used. I could pin-down this problem to the IRQ itself, because if I sent an IPI to the same vector then all the chains in the event ring happened as expected. I don't know if this is a bug in XHCI or how I setup MSI interrupts. Still, I do use multiple MSI interrupts with AHCI, and it seems to work there, so I don't know.
User avatar
tokusan
Member
Member
Posts: 29
Joined: Mon Feb 24, 2020 10:18 pm
Location: Japan

Re: xHCI: Command Ring does not work on my laptop

Post by tokusan »

Progress report: I allocated the scratchpad buffers. Contexts are already proper sizes, either 32-bit or 64-bit. Now everything works on my laptop, including the initialization of xHC, ports, slots, and endpoints. Port Status Change TRB is issued after a new USB device is plugged.
Still, this OS cannot receive any TRBs on my desktop.
User avatar
tokusan
Member
Member
Posts: 29
Joined: Mon Feb 24, 2020 10:18 pm
Location: Japan

Re: xHCI: Command Ring does not work on my laptop

Post by tokusan »

I found that Haiku iterated over the xHCI capabilities to move the ownership of the xHC: https://github.com/haiku/haiku/blob/mas ... i.cpp#L293
I'll do the same and check if it is the cause.
User avatar
tokusan
Member
Member
Posts: 29
Joined: Mon Feb 24, 2020 10:18 pm
Location: Japan

Re: xHCI: Command Ring does not work on my laptop

Post by tokusan »

tokusan wrote:I found that Haiku iterated over the xHCI capabilities to move the ownership of the xHC: https://github.com/haiku/haiku/blob/mas ... i.cpp#L293
I'll do the same and check if it is the cause.
Yes, it was the cause. I just misunderstood the spec. Now this OS can find the connected ports.

Thank you for taking your time, nullplan, rdos, and iman.
Post Reply