[SeaBIOS] [PATCH] [wip] add xhci support
Kevin O'Connor
kevin at koconnor.net
Tue Jun 25 14:44:35 CEST 2013
On Mon, Jun 24, 2013 at 11:49:22AM +0200, Gerd Hoffmann wrote:
> Very first revision doing something useful. Initializes xhci host
> controller, detects devices, can handle control and bulk transfers.
> Good enougth to boot from usb storage devices and handle keyboard.
>
> Tested on qemu.
>
> To be done:
> * Test on real hardware.
> * Add support for streams (needed for uas devices on usb3 ports).
This is great!
I haven't had a chance to fully review, but I did have a couple of
questions.
[...]
> +static void wait_fixed(u32 timeout)
> +{
> + u64 end = calc_future_tsc(timeout);
> +
> + while (!check_tsc(end))
> + yield();
> +}
How does this differ from msleep()?
[...]
> +struct usb_pipe *
> +xhci_alloc_pipe(struct usbdevice_s *usbdev
> + , struct usb_endpoint_descriptor *epdesc)
> +{
> + ASSERT32FLAT();
> + if (!CONFIG_USB_XHCI)
> + return NULL;
> + u8 eptype = epdesc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
> + struct usb_xhci_s *xhci = container_of(
> + usbdev->hub->cntl, struct usb_xhci_s, usb);
> + struct xhci_pipe *pipe;
> + u32 epid;
> +
> + if (epdesc->bEndpointAddress == 0) {
> + epid = 1;
> + } else {
> + epid = (epdesc->bEndpointAddress & 0x0f) * 2;
> + epid += (epdesc->bEndpointAddress & USB_DIR_IN) ? 1 : 0;
> + }
> +
> +#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?
-Kevin
More information about the SeaBIOS
mailing list