Module Name:    src
Committed By:   skrll
Date:           Sun Aug 23 11:15:08 UTC 2015

Modified Files:
        src/sys/external/bsd/dwc2: dwc2.c

Log Message:
Do BUS_DMASYNC_POST{READ,WRITE} on transfer buffers appropriately


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/external/bsd/dwc2/dwc2.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.33 src/sys/external/bsd/dwc2/dwc2.c:1.34
--- src/sys/external/bsd/dwc2/dwc2.c:1.33	Tue Aug 18 12:01:16 2015
+++ src/sys/external/bsd/dwc2/dwc2.c	Sun Aug 23 11:15:08 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.33 2015/08/18 12:01:16 skrll Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.34 2015/08/23 11:15:08 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.33 2015/08/18 12:01:16 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.34 2015/08/23 11:15:08 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -1754,6 +1754,20 @@ void dwc2_host_complete(struct dwc2_hsot
 		printf("%s: unknown error status %d\n", __func__, status);
 	}
 
+	if (xfer->status == USBD_NORMAL_COMPLETION) {
+		int rd = usbd_xfer_isread(xfer);
+
+		/*
+		 * control transfers with no data phase don't touch dmabuf, but
+		 * everything else does.
+		 */
+		if (!(xfertype == UE_CONTROL &&
+		    UGETW(xfer->request.wLength) == 0)) {
+			usb_syncmem(&xfer->dmabuf, 0, xfer->actlen,
+			    rd ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
+		}
+	}
+
 	if (xfertype == UE_ISOCHRONOUS ||
 	    xfertype == UE_INTERRUPT) {
 		struct dwc2_pipe *dpipe = DWC2_XFER2DPIPE(xfer);

Reply via email to