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

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

3117
 		goto err_reset;
3117
 		goto err_reset;
3118
 
3118
 
3119
 	/* Allocate USB bus */
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
 				    &xhci_operations );
3121
 				    &xhci_operations );
3122
 	if ( ! xhci->bus ) {
3122
 	if ( ! xhci->bus ) {
3123
 		rc = -ENOMEM;
3123
 		rc = -ENOMEM;

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

24
  */
24
  */
25
 #define XHCI_MIN_ALIGN 64
25
 #define XHCI_MIN_ALIGN 64
26
 
26
 
27
+/** Maximum transfer size */
28
+#define XHCI_MTU 65536
29
+
27
 /** xHCI PCI BAR */
30
 /** xHCI PCI BAR */
28
 #define XHCI_BAR PCI_BASE_ADDRESS_0
31
 #define XHCI_BAR PCI_BASE_ADDRESS_0
29
 
32
 

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

865
 	/** Host controller operations set */
865
 	/** Host controller operations set */
866
 	struct usb_host_operations *op;
866
 	struct usb_host_operations *op;
867
 
867
 
868
+	/** Largest transfer allowed on the bus */
869
+	size_t mtu;
870
+
868
 	/** Root hub */
871
 	/** Root hub */
869
 	struct usb_hub *hub;
872
 	struct usb_hub *hub;
870
 
873
 
1138
 
1141
 
1139
 extern void usb_port_changed ( struct usb_port *port );
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
 					struct usb_host_operations *op );
1146
 					struct usb_host_operations *op );
1143
 extern int register_usb_bus ( struct usb_bus *bus );
1147
 extern int register_usb_bus ( struct usb_bus *bus );
1144
 extern void unregister_usb_bus ( struct usb_bus *bus );
1148
 extern void unregister_usb_bus ( struct usb_bus *bus );

Loading…
Cancel
Save