diff options
| author | Michael Brown | 2015-02-10 00:50:35 +0100 |
|---|---|---|
| committer | Michael Brown | 2015-02-10 02:14:22 +0100 |
| commit | 17aceb34da3bad166cab8579a3616806fff8e05b (patch) | |
| tree | b5a155eb8dcd66bb06955601bd76b86e27730b23 /src/drivers/usb | |
| parent | [usb] Handle CDC union functional descriptors (diff) | |
| download | ipxe-17aceb34da3bad166cab8579a3616806fff8e05b.tar.gz ipxe-17aceb34da3bad166cab8579a3616806fff8e05b.tar.xz ipxe-17aceb34da3bad166cab8579a3616806fff8e05b.zip | |
[usb] Parse endpoint descriptor bInterval field
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/usb')
| -rw-r--r-- | src/drivers/usb/xhci.c | 10 | ||||
| -rw-r--r-- | src/drivers/usb/xhci.h | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/drivers/usb/xhci.c b/src/drivers/usb/xhci.c index cdebc47da..49901275d 100644 --- a/src/drivers/usb/xhci.c +++ b/src/drivers/usb/xhci.c @@ -1986,6 +1986,7 @@ static void xhci_configure_endpoint_input ( struct xhci_device *xhci, /* Populate endpoint context */ ep_ctx = ( input + xhci_input_context_offset ( xhci, endpoint->ctx ) ); + ep_ctx->interval = endpoint->interval; ep_ctx->type = endpoint->type; ep_ctx->burst = endpoint->ep->burst; ep_ctx->mtu = cpu_to_le16 ( endpoint->ep->mtu ); @@ -2252,6 +2253,7 @@ static int xhci_endpoint_open ( struct usb_endpoint *ep ) { struct xhci_endpoint *endpoint; unsigned int ctx; unsigned int type; + unsigned int interval; int rc; /* Calculate context index */ @@ -2265,6 +2267,13 @@ static int xhci_endpoint_open ( struct usb_endpoint *ep ) { if ( ep->address & USB_DIR_IN ) type |= XHCI_EP_TYPE_IN; + /* Calculate interval */ + if ( type & XHCI_EP_TYPE_PERIODIC ) { + interval = ( fls ( ep->interval ) - 1 ); + } else { + interval = ep->interval; + } + /* Allocate and initialise structure */ endpoint = zalloc ( sizeof ( *endpoint ) ); if ( ! endpoint ) { @@ -2278,6 +2287,7 @@ static int xhci_endpoint_open ( struct usb_endpoint *ep ) { endpoint->ep = ep; endpoint->ctx = ctx; endpoint->type = type; + endpoint->interval = interval; endpoint->context = ( ( ( void * ) slot->context ) + xhci_device_context_offset ( xhci, ctx ) ); diff --git a/src/drivers/usb/xhci.h b/src/drivers/usb/xhci.h index 7f768aa0a..186ff27d0 100644 --- a/src/drivers/usb/xhci.h +++ b/src/drivers/usb/xhci.h @@ -806,6 +806,9 @@ enum xhci_endpoint_state { /** Input endpoint type */ #define XHCI_EP_TYPE_IN XHCI_EP_TYPE ( 4 ) +/** Periodic endpoint type */ +#define XHCI_EP_TYPE_PERIODIC XHCI_EP_TYPE ( 1 ) + /** Endpoint dequeue cycle state */ #define XHCI_EP_DCS 0x00000001UL @@ -1078,6 +1081,8 @@ struct xhci_endpoint { unsigned int ctx; /** Endpoint type */ unsigned int type; + /** Endpoint interval */ + unsigned int interval; /** Endpoint context */ struct xhci_endpoint_context *context; /** Transfer ring */ |
