PERFORCE change 160708 for review

Hans Petter Selasky hselasky at FreeBSD.org
Thu Apr 16 11:43:44 PDT 2009


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

Change 160708 by hselasky at hselasky_laptop001 on 2009/04/16 18:43:15

	
	USB controller (ATMEGADCI):
	
	 - bugfix: Need to check Read/Write allowed before
	 writing any data for non-control transfers.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/controller/atmegadci.c#18 edit
.. //depot/projects/usb/src/sys/dev/usb/controller/atmegadci.h#6 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/controller/atmegadci.c#18 (text+ko) ====

@@ -458,6 +458,12 @@
 		/* cannot write any data */
 		goto not_complete;
 	}
+	if (!(temp & ATMEGA_UEINTX_RWAL)) {
+		if (!td->control_xfr) {
+			/* cannot write any data */
+			goto not_complete;
+		}
+	}
 	count = td->max_packet_size;
 	if (td->remainder < count) {
 		/* we have a short packet */
@@ -1979,6 +1985,7 @@
 	uint32_t ntd;
 	uint32_t n;
 	uint8_t ep_no;
+	uint8_t is_control;
 
 	sc = ATMEGA_BUS2SC(parm->udev->bus);
 	xfer = parm->curr_xfer;
@@ -1997,7 +2004,8 @@
 	/*
 	 * compute maximum number of TDs
 	 */
-	if ((xfer->pipe->edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL) {
+	is_control = ((xfer->pipe->edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL);
+	if (is_control) {
 
 		ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC 1 */
 		    + 1 /* SYNC 2 */ ;
@@ -2041,6 +2049,8 @@
 			td = USB_ADD_BYTES(parm->buf, parm->size[0]);
 
 			/* init TD */
+			if (is_control)
+				td->control_xfr = 1;
 			td->max_packet_size = xfer->max_packet_size;
 			td->ep_no = ep_no;
 			if (pf->support_multi_buffer) {

==== //depot/projects/usb/src/sys/dev/usb/controller/atmegadci.h#6 (text+ko) ====

@@ -189,6 +189,7 @@
 	uint8_t	short_pkt:1;
 	uint8_t	support_multi_buffer:1;
 	uint8_t	did_stall:1;
+	uint8_t	control_xfr:1;
 	uint8_t	ep_no:3;
 };
 


More information about the p4-projects mailing list