Hi,
+static void wait_fixed(u32 timeout) +{
- u64 end = calc_future_tsc(timeout);
- while (!check_tsc(end))
yield();
+}
How does this differ from msleep()?
I'll check, probably not at all, just havn't noticed (or forgotten) that there is a msleep() I can use.
+#if 1
- /* dirty hack time: try to dig our pipe out of the freelist */
- struct usb_pipe **pfree = &xhci->usb.freelist;
- for (;;) {
struct usb_pipe *upipe = *pfree;
Can you explain this further. What's needed to reuse a previously opened pipe on xhci?
xhci interface is very different from ehci / ohci / uhci. For now I've found my way to handle things locally in the xhci driver (well, almost, see attached patch). Long term we probably want improve the seabios usb core interfaces though.
xhci has a "device context", containing a "slot context" with device informations (such as port, speed, ...) and 31 "endpoint contexts" (one ctl, 15 in, 15 out). The endpoint contexts contain pointers to the transfer rings (td queue aequivalent).
If I want release a transfer ring I have to send a command to the xhci controller first saying I want disable the endpoint. Likewise when reusing the ring for another device. Luckily seabios doesn't actually release the usb_pipe but sticks it into a freelist only, so this doesn't disturb the xhci controller and my driver can find them in the freelist.
So, what I think would make sense interface-wise is this:
(1) replace the free_pipe() + alloc_pipe() cycle when changing the maxpacketsize for the control endpoint with an explicit reconfigure_ctl_pipe request. (2) link pipes to devices not controllers. (3) notify host controller when disabling a device, free all pipes linked to that device afterwards.
cheers, Gerd