summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/usb_parse.c
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2010-10-04 23:18:05 +0000
committerhselasky <hselasky@FreeBSD.org>2010-10-04 23:18:05 +0000
commitf58df490d49462ae839658025d0adc79cf5848ad (patch)
treec082c15f2b4af936b99eda2cd4c67777fdf391ee /sys/dev/usb/usb_parse.c
parentcacc63611c920df4de9b0e17b85172a00c979e75 (diff)
downloadFreeBSD-src-f58df490d49462ae839658025d0adc79cf5848ad.zip
FreeBSD-src-f58df490d49462ae839658025d0adc79cf5848ad.tar.gz
This commit adds full support for USB 3.0 devices in host and device
mode in the USB core. The patch mostly consists of updating the USB HUB code to support USB 3.0 HUBs. This patch also add some more USB controller methods to support more active-alike USB controllers like the XHCI which needs to be informed about various device state events. USB 3.0 HUBs are not tested yet, due to lack of hardware, but are believed to work. After this update the initial device descriptor is only read twice when we know that the bMaxPacketSize is too small for a single packet transfer of this descriptor. Approved by: thompsa (mentor)
Diffstat (limited to 'sys/dev/usb/usb_parse.c')
-rw-r--r--sys/dev/usb/usb_parse.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/sys/dev/usb/usb_parse.c b/sys/dev/usb/usb_parse.c
index deb52ea..8663c1e 100644
--- a/sys/dev/usb/usb_parse.c
+++ b/sys/dev/usb/usb_parse.c
@@ -180,7 +180,7 @@ usb_edesc_foreach(struct usb_config_descriptor *cd,
}
if (desc->bDescriptorType == UDESC_ENDPOINT) {
if (desc->bLength < sizeof(*ped)) {
- /* endpoint index is invalid */
+ /* endpoint descriptor is invalid */
break;
}
return ((struct usb_endpoint_descriptor *)desc);
@@ -190,6 +190,42 @@ usb_edesc_foreach(struct usb_config_descriptor *cd,
}
/*------------------------------------------------------------------------*
+ * usb_ed_comp_foreach
+ *
+ * This function will iterate all the endpoint companion descriptors
+ * within an endpoint descriptor in an interface descriptor. Starting
+ * value for the "ped" argument should be a valid endpoint companion
+ * descriptor.
+ *
+ * Return values:
+ * NULL: End of descriptors
+ * Else: A valid endpoint companion descriptor
+ *------------------------------------------------------------------------*/
+struct usb_endpoint_ss_comp_descriptor *
+usb_ed_comp_foreach(struct usb_config_descriptor *cd,
+ struct usb_endpoint_ss_comp_descriptor *ped)
+{
+ struct usb_descriptor *desc;
+
+ desc = ((struct usb_descriptor *)ped);
+
+ while ((desc = usb_desc_foreach(cd, desc))) {
+ if (desc->bDescriptorType == UDESC_INTERFACE)
+ break;
+ if (desc->bDescriptorType == UDESC_ENDPOINT)
+ break;
+ if (desc->bDescriptorType == UDESC_ENDPOINT_SS_COMP) {
+ if (desc->bLength < sizeof(*ped)) {
+ /* endpoint companion descriptor is invalid */
+ break;
+ }
+ return ((struct usb_endpoint_ss_comp_descriptor *)desc);
+ }
+ }
+ return (NULL);
+}
+
+/*------------------------------------------------------------------------*
* usbd_get_no_descriptors
*
* This function will count the total number of descriptors in the
OpenPOWER on IntegriCloud