aboutsummaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ipxe/errfile.h1
-rw-r--r--src/include/ipxe/usb.h25
2 files changed, 26 insertions, 0 deletions
diff --git a/src/include/ipxe/errfile.h b/src/include/ipxe/errfile.h
index 42bc17789..01a2be654 100644
--- a/src/include/ipxe/errfile.h
+++ b/src/include/ipxe/errfile.h
@@ -423,6 +423,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define ERRFILE_editstring ( ERRFILE_OTHER | 0x00610000 )
#define ERRFILE_widget_ui ( ERRFILE_OTHER | 0x00620000 )
#define ERRFILE_form_ui ( ERRFILE_OTHER | 0x00630000 )
+#define ERRFILE_usb_cmd ( ERRFILE_OTHER | 0x00640000 )
/** @} */
diff --git a/src/include/ipxe/usb.h b/src/include/ipxe/usb.h
index 911247ede..d9891b757 100644
--- a/src/include/ipxe/usb.h
+++ b/src/include/ipxe/usb.h
@@ -54,6 +54,20 @@ enum usb_speed {
USB_SPEED_SUPER = USB_SPEED ( 5, 3 ),
};
+/** Define a USB bus:device address
+ *
+ * @v bus Bus address
+ * @v dev Device address
+ * @ret busdev Bus:device address
+ */
+#define USB_BUSDEV( bus, dev ) ( ( (bus) << 8 ) | (dev) )
+
+/** Extract USB bus address */
+#define USB_BUS( busdev ) ( (busdev) >> 8 )
+
+/** Extract USB device address */
+#define USB_DEV( busdev ) ( (busdev) & 0xff )
+
/** USB packet IDs */
enum usb_pid {
/** IN PID */
@@ -956,6 +970,12 @@ struct usb_bus {
/** Host controller operations set */
struct usb_host_operations *op;
+ /** Bus address
+ *
+ * This is an internal index used only to allow a USB device
+ * to be identified via a nominal bus:device address.
+ */
+ unsigned int address;
/** Largest transfer allowed on the bus */
size_t mtu;
/** Address in-use mask
@@ -1269,6 +1289,9 @@ extern struct usb_endpoint_companion_descriptor *
usb_endpoint_companion_descriptor ( struct usb_configuration_descriptor *config,
struct usb_endpoint_descriptor *desc );
+extern struct usb_device * find_usb ( struct usb_bus *bus,
+ unsigned int address );
+
extern struct usb_hub * alloc_usb_hub ( struct usb_bus *bus,
struct usb_device *usb,
unsigned int ports,
@@ -1285,11 +1308,13 @@ extern struct usb_bus * alloc_usb_bus ( struct device *dev,
extern int register_usb_bus ( struct usb_bus *bus );
extern void unregister_usb_bus ( struct usb_bus *bus );
extern void free_usb_bus ( struct usb_bus *bus );
+extern struct usb_bus * find_usb_bus ( unsigned int address );
extern struct usb_bus * find_usb_bus_by_location ( unsigned int bus_type,
unsigned int location );
extern int usb_alloc_address ( struct usb_bus *bus );
extern void usb_free_address ( struct usb_bus *bus, unsigned int address );
+extern int usb_find_next ( struct usb_device **usb, uint16_t *busdev );
extern unsigned int usb_route_string ( struct usb_device *usb );
extern struct usb_port * usb_root_hub_port ( struct usb_device *usb );
extern struct usb_port * usb_transaction_translator ( struct usb_device *usb );