Hello list.
While debugging plan 9's uhci usb stack in qemu I noticed that it
immediately issues a USBCMD command to Stop(0) the controller and then
expects hchalted bit in USBSTS to be set. Is this the proper thing to
do? No other stack I've seen seems to rely on this and it seems that
when they do it's after the uhci controller framing has been started.
Here is the beginning output from the qemu logs (port is the base I/O
register offset, 0x0000 is USBCMD, 0x0002 is USBSTS):
uhci writew port=0x0000 val=0x0000
uhci readw port=0x0002 val=0x0000
uhci readw port=0x0002 val=0x0000
uhci readw port=0x0002 val=0x0000
uhci readw port=0x0002 val=0x0000
<snipped - infinite loop ouput>
From plan 9's uhci stack source:
http://cm.bell-labs.com/sources/plan9/sys/src/9/pc/usbuhci.c
from middle of function reset(Usbhost *uh)
OUT(Cmd, 0); /* stop */
while((IN(Status) & (1<<5)) == 0) /* wait for halt */
The UHCI specification when referencing setting the hchalt bit always
mentions doing this if the "transaction" has finished/completed.
Wouldn't that imply the R/S bit had been set previously? Is this a
compliant operation or something I don't understand?