Browse Source

[usb] Add the concept of a USB bus maximum transfer size

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
7b6765ff1b
4 changed files with 12 additions and 3 deletions
  1. 3
    1
      src/drivers/bus/usb.c
  2. 1
    1
      src/drivers/usb/xhci.c
  3. 3
    0
      src/drivers/usb/xhci.h
  4. 5
    1
      src/include/ipxe/usb.h

+ 3
- 1
src/drivers/bus/usb.c View File

@@ -1736,11 +1736,12 @@ void free_usb_hub ( struct usb_hub *hub ) {
1736 1736
  *
1737 1737
  * @v dev		Underlying hardware device
1738 1738
  * @v ports		Number of root hub ports
1739
+ * @v mtu		Largest transfer allowed on the bus
1739 1740
  * @v op		Host controller operations
1740 1741
  * @ret bus		USB bus, or NULL on allocation failure
1741 1742
  */
1742 1743
 struct usb_bus * alloc_usb_bus ( struct device *dev, unsigned int ports,
1743
-				 struct usb_host_operations *op ) {
1744
+				 size_t mtu, struct usb_host_operations *op ) {
1744 1745
 	struct usb_bus *bus;
1745 1746
 
1746 1747
 	/* Allocate and initialise structure */
@@ -1749,6 +1750,7 @@ struct usb_bus * alloc_usb_bus ( struct device *dev, unsigned int ports,
1749 1750
 		goto err_alloc_bus;
1750 1751
 	bus->name = dev->name;
1751 1752
 	bus->dev = dev;
1753
+	bus->mtu = mtu;
1752 1754
 	bus->op = op;
1753 1755
 	INIT_LIST_HEAD ( &bus->devices );
1754 1756
 	INIT_LIST_HEAD ( &bus->hubs );

+ 1
- 1
src/drivers/usb/xhci.c View File

@@ -3117,7 +3117,7 @@ static int xhci_probe ( struct pci_device *pci ) {
3117 3117
 		goto err_reset;
3118 3118
 
3119 3119
 	/* Allocate USB bus */
3120
-	xhci->bus = alloc_usb_bus ( &pci->dev, xhci->ports,
3120
+	xhci->bus = alloc_usb_bus ( &pci->dev, xhci->ports, XHCI_MTU,
3121 3121
 				    &xhci_operations );
3122 3122
 	if ( ! xhci->bus ) {
3123 3123
 		rc = -ENOMEM;

+ 3
- 0
src/drivers/usb/xhci.h View File

@@ -24,6 +24,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
24 24
  */
25 25
 #define XHCI_MIN_ALIGN 64
26 26
 
27
+/** Maximum transfer size */
28
+#define XHCI_MTU 65536
29
+
27 30
 /** xHCI PCI BAR */
28 31
 #define XHCI_BAR PCI_BASE_ADDRESS_0
29 32
 

+ 5
- 1
src/include/ipxe/usb.h View File

@@ -865,6 +865,9 @@ struct usb_bus {
865 865
 	/** Host controller operations set */
866 866
 	struct usb_host_operations *op;
867 867
 
868
+	/** Largest transfer allowed on the bus */
869
+	size_t mtu;
870
+
868 871
 	/** Root hub */
869 872
 	struct usb_hub *hub;
870 873
 
@@ -1138,7 +1141,8 @@ extern void free_usb_hub ( struct usb_hub *hub );
1138 1141
 
1139 1142
 extern void usb_port_changed ( struct usb_port *port );
1140 1143
 
1141
-extern struct usb_bus * alloc_usb_bus ( struct device *dev, unsigned int ports,
1144
+extern struct usb_bus * alloc_usb_bus ( struct device *dev,
1145
+					unsigned int ports, size_t mtu,
1142 1146
 					struct usb_host_operations *op );
1143 1147
 extern int register_usb_bus ( struct usb_bus *bus );
1144 1148
 extern void unregister_usb_bus ( struct usb_bus *bus );

Loading…
Cancel
Save