]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[usb] Add the concept of a USB bus maximum transfer size
authorMichael Brown <mcb30@ipxe.org>
Mon, 16 Mar 2015 05:39:14 +0000 (05:39 +0000)
committerMichael Brown <mcb30@ipxe.org>
Mon, 16 Mar 2015 15:40:53 +0000 (15:40 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/bus/usb.c
src/drivers/usb/xhci.c
src/drivers/usb/xhci.h
src/include/ipxe/usb.h

index 22a57e6e5b773667598baa776fe7e2be1ddccac6..57a2533208b484737d5c6261b78ac544a7276104 100644 (file)
@@ -1736,11 +1736,12 @@ void free_usb_hub ( struct usb_hub *hub ) {
  *
  * @v dev              Underlying hardware device
  * @v ports            Number of root hub ports
+ * @v mtu              Largest transfer allowed on the bus
  * @v op               Host controller operations
  * @ret bus            USB bus, or NULL on allocation failure
  */
 struct usb_bus * alloc_usb_bus ( struct device *dev, unsigned int ports,
-                                struct usb_host_operations *op ) {
+                                size_t mtu, struct usb_host_operations *op ) {
        struct usb_bus *bus;
 
        /* Allocate and initialise structure */
@@ -1749,6 +1750,7 @@ struct usb_bus * alloc_usb_bus ( struct device *dev, unsigned int ports,
                goto err_alloc_bus;
        bus->name = dev->name;
        bus->dev = dev;
+       bus->mtu = mtu;
        bus->op = op;
        INIT_LIST_HEAD ( &bus->devices );
        INIT_LIST_HEAD ( &bus->hubs );
index 5d067bd051d01330c9945c1cfe9fff73f08eb6e8..34290774a93d83539d3e2157d7807c2e8d48e3ed 100644 (file)
@@ -3117,7 +3117,7 @@ static int xhci_probe ( struct pci_device *pci ) {
                goto err_reset;
 
        /* Allocate USB bus */
-       xhci->bus = alloc_usb_bus ( &pci->dev, xhci->ports,
+       xhci->bus = alloc_usb_bus ( &pci->dev, xhci->ports, XHCI_MTU,
                                    &xhci_operations );
        if ( ! xhci->bus ) {
                rc = -ENOMEM;
index 269f50b82f4bfa9b7f295a3637c7978d3b5b8aa1..3032080715bac680757202c1412556f44f652f95 100644 (file)
@@ -24,6 +24,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  */
 #define XHCI_MIN_ALIGN 64
 
+/** Maximum transfer size */
+#define XHCI_MTU 65536
+
 /** xHCI PCI BAR */
 #define XHCI_BAR PCI_BASE_ADDRESS_0
 
index 59661f70118780ea512231c92b290e88f7ace801..fd027d188d7306fc942acdf8a47c6075a37b926a 100644 (file)
@@ -865,6 +865,9 @@ struct usb_bus {
        /** Host controller operations set */
        struct usb_host_operations *op;
 
+       /** Largest transfer allowed on the bus */
+       size_t mtu;
+
        /** Root hub */
        struct usb_hub *hub;
 
@@ -1138,7 +1141,8 @@ extern void free_usb_hub ( struct usb_hub *hub );
 
 extern void usb_port_changed ( struct usb_port *port );
 
-extern struct usb_bus * alloc_usb_bus ( struct device *dev, unsigned int ports,
+extern struct usb_bus * alloc_usb_bus ( struct device *dev,
+                                       unsigned int ports, size_t mtu,
                                        struct usb_host_operations *op );
 extern int register_usb_bus ( struct usb_bus *bus );
 extern void unregister_usb_bus ( struct usb_bus *bus );