|
@@ -867,6 +867,17 @@ struct usb_bus {
|
867
|
867
|
|
868
|
868
|
/** Largest transfer allowed on the bus */
|
869
|
869
|
size_t mtu;
|
|
870
|
+ /** Address in-use mask
|
|
871
|
+ *
|
|
872
|
+ * This is used only by buses which perform manual address
|
|
873
|
+ * assignment. USB allows for addresses in the range [1,127].
|
|
874
|
+ * We use a simple bitmask which restricts us to the range
|
|
875
|
+ * [1,64]; this is unlikely to be a problem in practice. For
|
|
876
|
+ * comparison: controllers which perform autonomous address
|
|
877
|
+ * assignment (such as xHCI) typically allow for only 32
|
|
878
|
+ * devices per bus anyway.
|
|
879
|
+ */
|
|
880
|
+ unsigned long long addresses;
|
870
|
881
|
|
871
|
882
|
/** Root hub */
|
872
|
883
|
struct usb_hub *hub;
|
|
@@ -1021,6 +1032,19 @@ usb_set_feature ( struct usb_device *usb, unsigned int type,
|
1021
|
1032
|
feature, index, NULL, 0 );
|
1022
|
1033
|
}
|
1023
|
1034
|
|
|
1035
|
+/**
|
|
1036
|
+ * Set address
|
|
1037
|
+ *
|
|
1038
|
+ * @v usb USB device
|
|
1039
|
+ * @v address Device address
|
|
1040
|
+ * @ret rc Return status code
|
|
1041
|
+ */
|
|
1042
|
+static inline __attribute__ (( always_inline )) int
|
|
1043
|
+usb_set_address ( struct usb_device *usb, unsigned int address ) {
|
|
1044
|
+
|
|
1045
|
+ return usb_control ( usb, USB_SET_ADDRESS, address, 0, NULL, 0 );
|
|
1046
|
+}
|
|
1047
|
+
|
1024
|
1048
|
/**
|
1025
|
1049
|
* Get USB descriptor
|
1026
|
1050
|
*
|
|
@@ -1148,6 +1172,8 @@ extern int register_usb_bus ( struct usb_bus *bus );
|
1148
|
1172
|
extern void unregister_usb_bus ( struct usb_bus *bus );
|
1149
|
1173
|
extern void free_usb_bus ( struct usb_bus *bus );
|
1150
|
1174
|
|
|
1175
|
+extern int usb_alloc_address ( struct usb_bus *bus );
|
|
1176
|
+extern void usb_free_address ( struct usb_bus *bus, unsigned int address );
|
1151
|
1177
|
extern unsigned int usb_route_string ( struct usb_device *usb );
|
1152
|
1178
|
extern unsigned int usb_depth ( struct usb_device *usb );
|
1153
|
1179
|
extern struct usb_port * usb_root_hub_port ( struct usb_device *usb );
|