ehci: Crash on `Assertion '_state == State::null' failed!`
This seems to be caused by a disconnect/re-connect cycle that EHCI does not handle correctly.
I compiled with all EHCI logging enabled, and the issue doesn't appear to happen in the same way. It also makes serial logging stop working so I took a video and transcribed the following ehci statements:
ehci: Starting driver (compiler on Oct 3 2021 01:44:58) ehci: Detected controller ehci: 8 ports ehci: Controller uses 64-bit pointers ehci: Extended capability: 1 ehci: OS access to the EHCI is already requested ehci: Acquired OS <-> BIOS semaphore ehci: Controller reset. ehci: Awaiting IRQ event ehci: IRQ event fired (sequence: 2), bits: 4 ehci: Checking ports ehci: Device on port 1 is low-speed ehci: Connect on port 7 ehci: Awaiting IRQ event ehci: IRQ event fired (sequence: 3), bits: 4 ehci: Checking ports ehci: Disconnect on port 1 ehci: Awaiting IRQ event ehci: Port 7 was enabled ehci: Setting device address ehci: Linking in _linkTransaction ehci: IRQ event fired (sequence: 4), bits: 1 ehci: Processing transfers ehci: Transfer complete! /var/lib/managarm-buildenv/build/system-root/usr/include/frg/expected.hpp:199: Assertion 'indicates _ error(e)' failed! thor: Panic in server /sbin/ehci
Also in case it is useful, here is lsusb -v from today on the same machine running Manjaro:
https://gist.github.com/borrrden/fe32bec312b2b791883e730799777082
Is it an issue that the UHCI controller is showing a connection (as opposed to the EHCI controller), but the EHCI server is trying to handle it?
I have figured out quite a bit more about this and the more I look at it, the more I am convinced that this state machine with its assertions is flawed and destined to fail. These connections and such happen for multiple ports on the same controller and asynchronously so I don't think you are going to get a nice defined path of states. If two ports connect at around the same time they are both going to be competing here. I simply removed the assertions and the state variable all together and let it do its thing and this problem goes away.