PERFORCE change 136682 for review

Hans Petter Selasky hselasky at FreeBSD.org
Sun Mar 2 19:07:50 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=136682

Change 136682 by hselasky at hselasky_laptop001 on 2008/03/02 19:07:21

	
	This bug fix is related to USB device side support and
	should not affect USB host functionality.
	
	In USB host mode "udev->address" == "udev->device_index".
	In USB device mode "udev->address" != "udev->device_index".
	
	When initialising an USB pipe we need to compare with the 
	device index and not the device address, hence the
	device address is not constant in USB device mode and
	can have the same value like the address of the virtual
	root HUB.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/at9100_dci.c#14 edit
.. //depot/projects/usb/src/sys/dev/usb/ehci.c#73 edit
.. //depot/projects/usb/src/sys/dev/usb/ohci.c#60 edit
.. //depot/projects/usb/src/sys/dev/usb/uhci.c#61 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_subr.c#99 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_subr.h#99 edit
.. //depot/projects/usb/src/sys/dev/usb/uss820_dci.c#9 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/at9100_dci.c#14 (text+ko) ====

@@ -2507,7 +2507,7 @@
 	    edesc->bEndpointAddress, udev->flags.usb_mode,
 	    sc->sc_rt_addr);
 
-	if (udev->address == sc->sc_rt_addr) {
+	if (udev->device_index == sc->sc_rt_addr) {
 
 		if (udev->flags.usb_mode != USB_MODE_HOST) {
 			/* not supported */

==== //depot/projects/usb/src/sys/dev/usb/ehci.c#73 (text+ko) ====

@@ -3796,7 +3796,7 @@
 		/* not supported */
 		return;
 	}
-	if (udev->address == sc->sc_addr) {
+	if (udev->device_index == sc->sc_addr) {
 		switch (edesc->bEndpointAddress) {
 		case USB_CONTROL_ENDPOINT:
 			pipe->methods = &ehci_root_ctrl_methods;

==== //depot/projects/usb/src/sys/dev/usb/ohci.c#60 (text+ko) ====

@@ -2776,7 +2776,7 @@
 		/* not supported */
 		return;
 	}
-	if (udev->address == sc->sc_addr) {
+	if (udev->device_index == sc->sc_addr) {
 		switch (edesc->bEndpointAddress) {
 		case USB_CONTROL_ENDPOINT:
 			pipe->methods = &ohci_root_ctrl_methods;

==== //depot/projects/usb/src/sys/dev/usb/uhci.c#61 (text+ko) ====

@@ -3231,7 +3231,7 @@
 		/* not supported */
 		return;
 	}
-	if (udev->address == sc->sc_addr) {
+	if (udev->device_index == sc->sc_addr) {
 		switch (edesc->bEndpointAddress) {
 		case USB_CONTROL_ENDPOINT:
 			pipe->methods = &uhci_root_ctrl_methods;

==== //depot/projects/usb/src/sys/dev/usb/usb_subr.c#99 (text+ko) ====

@@ -1905,6 +1905,9 @@
 	    &udev->default_ep_desc,
 	    &udev->default_pipe);
 
+	/* set device index */
+	udev->device_index = device_index;
+
 	if (udev->flags.usb_mode == USB_MODE_HOST) {
 
 		err = usbreq_set_address(udev, &usb_global_lock, device_index);

==== //depot/projects/usb/src/sys/dev/usb/usb_subr.h#99 (text+ko) ====

@@ -570,6 +570,7 @@
 	uint16_t langid;		/* language for strings */
 
 	uint8_t	address;		/* device addess */
+	uint8_t device_index;		/* device index in "bus->devices" */
 	uint8_t	curr_config_no;		/* current configuration # */
 	uint8_t	depth;			/* distance from root HUB */
 	uint8_t	speed;			/* low/full/high speed */

==== //depot/projects/usb/src/sys/dev/usb/uss820_dci.c#9 (text+ko) ====

@@ -2629,7 +2629,7 @@
 	    edesc->bEndpointAddress, udev->flags.usb_mode,
 	    sc->sc_rt_addr);
 
-	if (udev->address == sc->sc_rt_addr) {
+	if (udev->device_index == sc->sc_rt_addr) {
 
 		if (udev->flags.usb_mode != USB_MODE_HOST) {
 			/* not supported */


More information about the p4-projects mailing list