CVS commit: [netbsd-6-0] src/sys/dev/usb

2017-08-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 16:27:45 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-6-0]: if_ural.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1470):
sys/dev/usb/if_ural.c: revision 1.52
Free the RX list if ural_alloc_rx_list fails part way through.
Reported by Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.6.1 src/sys/dev/usb/if_ural.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/if_ural.c
diff -u src/sys/dev/usb/if_ural.c:1.39 src/sys/dev/usb/if_ural.c:1.39.6.1
--- src/sys/dev/usb/if_ural.c:1.39	Fri Dec 23 00:51:44 2011
+++ src/sys/dev/usb/if_ural.c	Sat Aug 12 16:27:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ural.c,v 1.39 2011/12/23 00:51:44 jakllsch Exp $ */
+/*	$NetBSD: if_ural.c,v 1.39.6.1 2017/08/12 16:27:44 snj Exp $ */
 /*	$FreeBSD: /repoman/r/ncvs/src/sys/dev/usb/if_ural.c,v 1.40 2006/06/02 23:14:40 sam Exp $	*/
 
 /*-
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.39 2011/12/23 00:51:44 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.39.6.1 2017/08/12 16:27:44 snj Exp $");
 
 
 #include 
@@ -678,7 +678,7 @@ ural_alloc_rx_list(struct ural_softc *sc
 
 	return 0;
 
-fail:	ural_free_tx_list(sc);
+fail:	ural_free_rx_list(sc);
 	return error;
 }
 



CVS commit: [netbsd-6-0] src/sys/dev/usb

2015-02-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb 11 14:38:25 UTC 2015

Modified Files:
src/sys/dev/usb [netbsd-6-0]: usbdi.c

Log Message:
Pull up following revision(s) (requested by aymeric in ticket #1250):
sys/dev/usb/usbdi.c: revision 1.163
clip xfer-actlen also in the !DIAGNOSTIC case


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.134.8.1 src/sys/dev/usb/usbdi.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/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.134 src/sys/dev/usb/usbdi.c:1.134.8.1
--- src/sys/dev/usb/usbdi.c:1.134	Sun Nov 27 03:25:00 2011
+++ src/sys/dev/usb/usbdi.c	Wed Feb 11 14:38:25 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.134 2011/11/27 03:25:00 jmcneill Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.134.8.1 2015/02/11 14:38:25 martin Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: usbdi.c,v 1.134 2011/11/27 03:25:00 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: usbdi.c,v 1.134.8.1 2015/02/11 14:38:25 martin Exp $);
 
 #include opt_compat_netbsd.h
 #include opt_usb.h
@@ -780,13 +780,13 @@ usb_transfer_complete(usbd_xfer_handle x
 
 	if (!(xfer-flags  USBD_NO_COPY)  xfer-actlen != 0 
 	usbd_xfer_isread(xfer)) {
-#ifdef DIAGNOSTIC
 		if (xfer-actlen  xfer-length) {
+#ifdef DIAGNOSTIC
 			printf(usb_transfer_complete: actlen  len %d  %d\n,
 			   xfer-actlen, xfer-length);
+#endif
 			xfer-actlen = xfer-length;
 		}
-#endif
 		memcpy(xfer-buffer, KERNADDR(dmap, 0), xfer-actlen);
 	}
 



CVS commit: [netbsd-6-0] src/sys/dev/usb

2014-08-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Aug  7 08:06:37 UTC 2014

Modified Files:
src/sys/dev/usb [netbsd-6-0]: if_urndis.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1094):
sys/dev/usb/if_urndis.c: revision 1.7
PR/48963: kmem_free size mismatch causes panic when attaching urndis(4).
Fix the size passed in kmem_free in the urndis_ctrl_{query,set} functions


To generate a diff of this commit:
cvs rdiff -u -r1.3.6.1 -r1.3.6.2 src/sys/dev/usb/if_urndis.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/if_urndis.c
diff -u src/sys/dev/usb/if_urndis.c:1.3.6.1 src/sys/dev/usb/if_urndis.c:1.3.6.2
--- src/sys/dev/usb/if_urndis.c:1.3.6.1	Sat Nov 24 04:01:30 2012
+++ src/sys/dev/usb/if_urndis.c	Thu Aug  7 08:06:37 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urndis.c,v 1.3.6.1 2012/11/24 04:01:30 riz Exp $ */
+/*	$NetBSD: if_urndis.c,v 1.3.6.2 2014/08/07 08:06:37 msaitoh Exp $ */
 /*	$OpenBSD: if_urndis.c,v 1.31 2011/07/03 15:47:17 matthew Exp $ */
 
 /*
@@ -21,7 +21,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_urndis.c,v 1.3.6.1 2012/11/24 04:01:30 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_urndis.c,v 1.3.6.2 2014/08/07 08:06:37 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -513,7 +513,7 @@ urndis_ctrl_query(struct urndis_softc *s
 	le32toh(msg-rm_devicevchdl)));
 
 	rval = urndis_ctrl_send(sc, msg, sizeof(*msg));
-	kmem_free(msg, sizeof(*msg));
+	kmem_free(msg, sizeof(*msg) + qlen);
 
 	if (rval != RNDIS_STATUS_SUCCESS) {
 		printf(%s: query failed\n, DEVNAME(sc));
@@ -566,7 +566,7 @@ urndis_ctrl_set(struct urndis_softc *sc,
 	le32toh(msg-rm_devicevchdl)));
 
 	rval = urndis_ctrl_send(sc, msg, sizeof(*msg));
-	kmem_free(msg, sizeof(*msg));
+	kmem_free(msg, sizeof(*msg) + len);
 
 	if (rval != RNDIS_STATUS_SUCCESS) {
 		printf(%s: set failed\n, DEVNAME(sc));



CVS commit: [netbsd-6-0] src/sys/dev/usb

2013-09-25 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Sep 26 01:55:49 UTC 2013

Modified Files:
src/sys/dev/usb [netbsd-6-0]: ehci.c uhci.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #950):
sys/dev/usb/uhci.c: revision 1.255
sys/dev/usb/uhci.c: revision 1.256
sys/dev/usb/ehci.c: revision 1.205
sys/dev/usb/uhci.c: revision 1.258
Add missed byteswap ops for BE machines in block added in rev 1.223.
Call usb_syncmem() against descriptors more strictly.
(not sure if the previous ones were fatal though)
Deal with control transfers better by
- removing the UHCI_PTR_VF flag for the setup and status stages
  which means they are scheduled less aggressively.  Some devices
  appear to require this (blymn@ has one).  The flag was
  introduced as a performance improvement for bulk transfers.
- Checking for short reads and making sure the status stage runs
  if they're encountered.
PR/47522 Enumeration of LUFA/Atmel devices on UHCI fails
Thanks to jak@ and blymn@ for testing and mlelstv@ for comments.


To generate a diff of this commit:
cvs rdiff -u -r1.183 -r1.183.6.1 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.242 -r1.242.6.1 src/sys/dev/usb/uhci.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/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.183 src/sys/dev/usb/ehci.c:1.183.6.1
--- src/sys/dev/usb/ehci.c:1.183	Fri Dec 23 00:51:43 2011
+++ src/sys/dev/usb/ehci.c	Thu Sep 26 01:55:49 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.183 2011/12/23 00:51:43 jakllsch Exp $ */
+/*	$NetBSD: ehci.c,v 1.183.6.1 2013/09/26 01:55:49 riz Exp $ */
 
 /*
  * Copyright (c) 2004-2008 The NetBSD Foundation, Inc.
@@ -52,7 +52,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ehci.c,v 1.183 2011/12/23 00:51:43 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: ehci.c,v 1.183.6.1 2013/09/26 01:55:49 riz Exp $);
 
 #include ohci.h
 #include uhci.h
@@ -763,7 +763,11 @@ ehci_check_qh_intr(ehci_softc_t *sc, str
 	lsqtd-offs + offsetof(ehci_qtd_t, qtd_status),
 	sizeof(lsqtd-qtd.qtd_status),
 	BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
-	if (le32toh(lsqtd-qtd.qtd_status)  EHCI_QTD_ACTIVE) {
+	status = le32toh(lsqtd-qtd.qtd_status);
+	usb_syncmem(lsqtd-dma,
+	lsqtd-offs + offsetof(ehci_qtd_t, qtd_status),
+	sizeof(lsqtd-qtd.qtd_status), BUS_DMASYNC_PREREAD);
+	if (status  EHCI_QTD_ACTIVE) {
 		DPRINTFN(12, (ehci_check_intr: active ex=%p\n, ex));
 		for (sqtd = ex-sqtdstart; sqtd != lsqtd; sqtd=sqtd-nextqtd) {
 			usb_syncmem(sqtd-dma,
@@ -786,9 +790,6 @@ ehci_check_qh_intr(ehci_softc_t *sc, str
 		}
 		DPRINTFN(12, (ehci_check_intr: ex=%p std=%p still active\n,
 			  ex, ex-sqtdstart));
-		usb_syncmem(lsqtd-dma,
-		lsqtd-offs + offsetof(ehci_qtd_t, qtd_status),
-		sizeof(lsqtd-qtd.qtd_status), BUS_DMASYNC_PREREAD);
 		return;
 	}
  done:

Index: src/sys/dev/usb/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.242 src/sys/dev/usb/uhci.c:1.242.6.1
--- src/sys/dev/usb/uhci.c:1.242	Fri Dec 23 00:51:46 2011
+++ src/sys/dev/usb/uhci.c	Thu Sep 26 01:55:49 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci.c,v 1.242 2011/12/23 00:51:46 jakllsch Exp $	*/
+/*	$NetBSD: uhci.c,v 1.242.6.1 2013/09/26 01:55:49 riz Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $	*/
 
 /*
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uhci.c,v 1.242 2011/12/23 00:51:46 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: uhci.c,v 1.242.6.1 2013/09/26 01:55:49 riz Exp $);
 
 #include opt_usb.h
 
@@ -1102,6 +1102,7 @@ void
 uhci_remove_hs_ctrl(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
 {
 	uhci_soft_qh_t *pqh;
+	uint32_t elink;
 
 	SPLUSBCHECK;
 
@@ -1125,7 +1126,10 @@ uhci_remove_hs_ctrl(uhci_softc_t *sc, uh
 	usb_syncmem(sqh-dma, sqh-offs + offsetof(uhci_qh_t, qh_elink),
 	sizeof(sqh-qh.qh_elink),
 	BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
-	if (!(sqh-qh.qh_elink  htole32(UHCI_PTR_T))) {
+	elink = le32toh(sqh-qh.qh_elink);
+	usb_syncmem(sqh-dma, sqh-offs + offsetof(uhci_qh_t, qh_elink),
+	sizeof(sqh-qh.qh_elink), BUS_DMASYNC_PREREAD);
+	if (!(elink  UHCI_PTR_T)) {
 		sqh-qh.qh_elink = htole32(UHCI_PTR_T);
 		usb_syncmem(sqh-dma,
 		sqh-offs + offsetof(uhci_qh_t, qh_elink),
@@ -1175,6 +1179,7 @@ void
 uhci_remove_ls_ctrl(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
 {
 	uhci_soft_qh_t *pqh;
+	uint32_t elink;
 
 	SPLUSBCHECK;
 
@@ -1183,7 +1188,10 @@ uhci_remove_ls_ctrl(uhci_softc_t *sc, uh
 	usb_syncmem(sqh-dma, sqh-offs + offsetof(uhci_qh_t, qh_elink),
 	sizeof(sqh-qh.qh_elink),
 	BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
-	if (!(sqh-qh.qh_elink  htole32(UHCI_PTR_T))) {
+	elink = le32toh(sqh-qh.qh_elink);
+	usb_syncmem(sqh-dma, sqh-offs + offsetof(uhci_qh_t, qh_elink),
+	sizeof(sqh-qh.qh_elink), BUS_DMASYNC_PREREAD);
+	if (!(elink  UHCI_PTR_T)) {
 		

CVS commit: [netbsd-6-0] src/sys/dev/usb

2013-01-05 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat Jan  5 23:12:09 UTC 2013

Modified Files:
src/sys/dev/usb [netbsd-6-0]: ubsa_common.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #761):
sys/dev/usb/ubsa_common.c: revision 1.9
Fix off by one read error.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.6.1 src/sys/dev/usb/ubsa_common.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/ubsa_common.c
diff -u src/sys/dev/usb/ubsa_common.c:1.7 src/sys/dev/usb/ubsa_common.c:1.7.6.1
--- src/sys/dev/usb/ubsa_common.c:1.7	Fri Dec 23 00:51:45 2011
+++ src/sys/dev/usb/ubsa_common.c	Sat Jan  5 23:12:09 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsa_common.c,v 1.7 2011/12/23 00:51:45 jakllsch Exp $	*/
+/*	$NetBSD: ubsa_common.c,v 1.7.6.1 2013/01/05 23:12:09 riz Exp $	*/
 /*-
  * Copyright (c) 2002, Alexander Kabaev kan.FreeBSD.org.
  * All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ubsa_common.c,v 1.7 2011/12/23 00:51:45 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: ubsa_common.c,v 1.7.6.1 2013/01/05 23:12:09 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -112,7 +112,7 @@ ubsa_request(struct ubsa_softc *sc, int 
 	else
 		req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
 
-	if (portno  UBSA_MAXCONN) {
+	if (portno = UBSA_MAXCONN) {
 		printf(%s: ubsa_request: invalid port(%d)#\n,
 			device_xname(sc-sc_dev), portno);
 		return USBD_INVAL; 



CVS commit: [netbsd-6-0] src/sys/dev/usb

2012-11-23 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat Nov 24 04:01:30 UTC 2012

Modified Files:
src/sys/dev/usb [netbsd-6-0]: if_urndis.c

Log Message:
Pull up following revision(s) (requested by joerg in ticket #700):
sys/dev/usb/if_urndis.c: revision 1.4
Don't match on idVendor=0x  idProduct=0x.
OpenBSD usb_lookup() might need this as a terminating entry,
but we don't at this point.
Repulsively enough, something that should be a uhidev(4),
ServerEngines SE USB Device, rev 1.10/0.01
has these ID numbers.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.6.1 src/sys/dev/usb/if_urndis.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/if_urndis.c
diff -u src/sys/dev/usb/if_urndis.c:1.3 src/sys/dev/usb/if_urndis.c:1.3.6.1
--- src/sys/dev/usb/if_urndis.c:1.3	Fri Dec 23 00:51:44 2011
+++ src/sys/dev/usb/if_urndis.c	Sat Nov 24 04:01:30 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urndis.c,v 1.3 2011/12/23 00:51:44 jakllsch Exp $ */
+/*	$NetBSD: if_urndis.c,v 1.3.6.1 2012/11/24 04:01:30 riz Exp $ */
 /*	$OpenBSD: if_urndis.c,v 1.31 2011/07/03 15:47:17 matthew Exp $ */
 
 /*
@@ -21,7 +21,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_urndis.c,v 1.3 2011/12/23 00:51:44 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_urndis.c,v 1.3.6.1 2012/11/24 04:01:30 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -124,7 +124,6 @@ CFATTACH_DECL_NEW(urndis, sizeof(struct 
 static const struct usb_devno urndis_devs[] = {
 	{ USB_VENDOR_HTC,	USB_PRODUCT_HTC_ANDROID },
 	{ USB_VENDOR_SAMSUNG,	USB_PRODUCT_SAMSUNG_ANDROID2 },
-	{ 0, 0 }
 };
 
 static usbd_status