]> xenbits.xensource.com Git - seabios.git/commitdiff
usb: Move default pipe max packet size code from xhci to main code.
authorKevin O'Connor <kevin@koconnor.net>
Sun, 26 Jan 2014 22:28:04 +0000 (17:28 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Wed, 29 Jan 2014 17:57:01 +0000 (12:57 -0500)
Also, the max packet size for super speed devices is 512 bytes (not
256 bytes).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
src/hw/usb-xhci.c
src/hw/usb.c

index 65d1be0cfcdbcefae09bd690746eb0c175233efb..93f39c05d8056a9592149efbee74a5ca00499c62 100644 (file)
@@ -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);
index ff20b6cffc3fd1cc9eb5a9ebf0c04bf1b6ff4ecf..7b8a9f5ff93888289d69cb7c03fdb2d443d8aa82 100644 (file)
@@ -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);