Module Name:    src
Committed By:   skrll
Date:           Tue Jan 31 07:25:34 UTC 2017

Modified Files:
        src/sys/dev/usb [nick-nhusb]: ohci.c

Log Message:
Sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.254.2.84 -r1.254.2.85 src/sys/dev/usb/ohci.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/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.254.2.84 src/sys/dev/usb/ohci.c:1.254.2.85
--- src/sys/dev/usb/ohci.c:1.254.2.84	Wed Dec 28 10:44:27 2016
+++ src/sys/dev/usb/ohci.c	Tue Jan 31 07:25:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.254.2.84 2016/12/28 10:44:27 skrll Exp $	*/
+/*	$NetBSD: ohci.c,v 1.254.2.85 2017/01/31 07:25:34 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.84 2016/12/28 10:44:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.85 2017/01/31 07:25:34 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -626,22 +626,24 @@ ohci_reset_std_chain(ohci_softc_t *sc, s
 		KASSERT(next != cur);
 
 		curlen = 0;
-		ohci_physaddr_t sdataphys = DMAADDR(dma, curoffs);
+		const ohci_physaddr_t sdataphys = DMAADDR(dma, curoffs);
 		ohci_physaddr_t edataphys = DMAADDR(dma, curoffs + len - 1);
 
-		ohci_physaddr_t sphyspg = OHCI_PAGE(sdataphys);
+		const ohci_physaddr_t sphyspg = OHCI_PAGE(sdataphys);
 		ohci_physaddr_t ephyspg = OHCI_PAGE(edataphys);
 		/*
 		 * The OHCI hardware can handle at most one page
 		 * crossing per TD
 		 */
 		curlen = len;
-		if (!(sphyspg == ephyspg || sphyspg + 1 == ephyspg)) {
+		if (sphyspg != ephyspg &&
+		    sphyspg + OHCI_PAGE_SIZE != ephyspg) {
 			/* must use multiple TDs, fill as much as possible. */
 			curlen = 2 * OHCI_PAGE_SIZE -
-			    (sdataphys & (OHCI_PAGE_SIZE - 1));
+			    OHCI_PAGE_OFFSET(sdataphys);
 			/* the length must be a multiple of the max size */
 			curlen -= curlen % mps;
+			edataphys = DMAADDR(dma, curoffs + curlen - 1);
 		}
 		KASSERT(curlen != 0);
 		DPRINTFN(4, "sdataphys=0x%08x edataphys=0x%08x "

Reply via email to