From: Kevin O'Connor Date: Sun, 26 Jan 2014 22:28:04 +0000 (-0500) Subject: usb: Move default pipe max packet size code from xhci to main code. X-Git-Tag: rel-1.7.5-rc1~48 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=3de7382fc02dbe321772347fb289991db5962494;p=seabios.git usb: Move default pipe max packet size code from xhci to main code. Also, the max packet size for super speed devices is 512 bytes (not 256 bytes). Signed-off-by: Kevin O'Connor --- diff --git a/src/hw/usb-xhci.c b/src/hw/usb-xhci.c index 65d1be0..93f39c0 100644 --- a/src/hw/usb-xhci.c +++ b/src/hw/usb-xhci.c @@ -282,13 +282,6 @@ static const int speed_to_xhci[] = { [ USB_SUPERSPEED ] = 4, }; -static const int speed_to_ctlsize[] = { - [ USB_FULLSPEED ] = 8, - [ USB_LOWSPEED ] = 8, - [ USB_HIGHSPEED ] = 64, - [ USB_SUPERSPEED ] = 256, -}; - static const int eptype_to_xhci_in[] = { [ USB_ENDPOINT_XFER_CONTROL] = 4, [ USB_ENDPOINT_XFER_ISOC ] = 5, @@ -955,12 +948,12 @@ xhci_alloc_pipe(struct usbdevice_s *usbdev struct xhci_epctx *ep = (void*)&in[2 << xhci->context64]; ep->ctx[0] |= (3 << 16); // interval: 1ms ep->ctx[1] |= (4 << 3); // control pipe - ep->ctx[1] |= (speed_to_ctlsize[usbdev->speed] << 16); + ep->ctx[1] |= (pipe->pipe.maxpacket << 16); ep->deq_low = (u32)&pipe->reqs.ring[0]; ep->deq_low |= 1; // dcs ep->deq_high = 0; - ep->length = 8; + ep->length = pipe->pipe.maxpacket; int cc = xhci_cmd_address_device(xhci, slotid, in); free(in); diff --git a/src/hw/usb.c b/src/hw/usb.c index ff20b6c..7b8a9f5 100644 --- a/src/hw/usb.c +++ b/src/hw/usb.c @@ -261,6 +261,13 @@ set_configuration(struct usb_pipe *pipe, u16 val) * Initialization and enumeration ****************************************************************/ +static const int speed_to_ctlsize[] = { + [ USB_FULLSPEED ] = 8, + [ USB_LOWSPEED ] = 8, + [ USB_HIGHSPEED ] = 64, + [ USB_SUPERSPEED ] = 512, +}; + // Assign an address to a device in the default state on the given // controller. static int @@ -276,7 +283,7 @@ usb_set_address(struct usbdevice_s *usbdev) // Create a pipe for the default address. struct usb_endpoint_descriptor epdesc = { - .wMaxPacketSize = 8, + .wMaxPacketSize = speed_to_ctlsize[usbdev->speed], .bmAttributes = USB_ENDPOINT_XFER_CONTROL, }; usbdev->defpipe = usb_alloc_pipe(usbdev, &epdesc);