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

2019-11-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 25 16:37:06 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: if_upl.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #474):

sys/dev/usb/if_upl.c: revision 1.68

Make it compilable with UPL_DEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.64.2.2 -r1.64.2.3 src/sys/dev/usb/if_upl.c

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



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

2019-11-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 25 16:37:06 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: if_upl.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #474):

sys/dev/usb/if_upl.c: revision 1.68

Make it compilable with UPL_DEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.64.2.2 -r1.64.2.3 src/sys/dev/usb/if_upl.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_upl.c
diff -u src/sys/dev/usb/if_upl.c:1.64.2.2 src/sys/dev/usb/if_upl.c:1.64.2.3
--- src/sys/dev/usb/if_upl.c:1.64.2.2	Fri Sep 13 06:51:58 2019
+++ src/sys/dev/usb/if_upl.c	Mon Nov 25 16:37:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_upl.c,v 1.64.2.2 2019/09/13 06:51:58 martin Exp $	*/
+/*	$NetBSD: if_upl.c,v 1.64.2.3 2019/11/25 16:37:06 martin Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.64.2.2 2019/09/13 06:51:58 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.64.2.3 2019/11/25 16:37:06 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -229,8 +229,8 @@ upl_rx_loop(struct usbnet * un, struct u
 {
 	usbnet_isowned_rx(un);
 
-	DPRINTFN(9,("%s: %s: enter status=%d length=%d\n",
-		device_xname(un->un_dev), __func__, status, total_len));
+	DPRINTFN(9,("%s: %s: enter length=%d\n",
+		device_xname(un->un_dev), __func__, total_len));
 
 	usbnet_input(un, c->unc_buf, total_len);
 }



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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 12:56:48 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: uaudio.c

Log Message:
Pull up following revision(s) (requested by isaki in ticket #447):

sys/dev/usb/uaudio.c: revision 1.162

Use kmem_zalloc() instead of kmem_alloc() to initialize structure.
struct audio_format added a member since isaki-audio2.

Fix PR kern/54662 "uaudio sometimes not recognized".


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.161.2.1 src/sys/dev/usb/uaudio.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/uaudio.c
diff -u src/sys/dev/usb/uaudio.c:1.161 src/sys/dev/usb/uaudio.c:1.161.2.1
--- src/sys/dev/usb/uaudio.c:1.161	Thu Jun  6 12:59:33 2019
+++ src/sys/dev/usb/uaudio.c	Tue Nov 19 12:56:48 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uaudio.c,v 1.161 2019/06/06 12:59:33 isaki Exp $	*/
+/*	$NetBSD: uaudio.c,v 1.161.2.1 2019/11/19 12:56:48 martin Exp $	*/
 
 /*
  * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.161 2019/06/06 12:59:33 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.161.2.1 2019/11/19 12:56:48 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1795,13 +1795,12 @@ uaudio_identify_as(struct uaudio_softc *
 	}
 
 	/* build audio_format array */
-	sc->sc_formats = kmem_alloc(sizeof(struct audio_format) * sc->sc_nalts,
+	sc->sc_formats = kmem_zalloc(sizeof(struct audio_format) * sc->sc_nalts,
 	KM_SLEEP);
 	sc->sc_nformats = sc->sc_nalts;
 	for (i = 0; i < sc->sc_nalts; i++) {
 		auf = >sc_formats[i];
 		t1desc = sc->sc_alts[i].asf1desc;
-		auf->driver_data = NULL;
 		if (UE_GET_DIR(sc->sc_alts[i].edesc->bEndpointAddress) == UE_DIR_OUT)
 			auf->mode = AUMODE_PLAY;
 		else



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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 12:56:48 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: uaudio.c

Log Message:
Pull up following revision(s) (requested by isaki in ticket #447):

sys/dev/usb/uaudio.c: revision 1.162

Use kmem_zalloc() instead of kmem_alloc() to initialize structure.
struct audio_format added a member since isaki-audio2.

Fix PR kern/54662 "uaudio sometimes not recognized".


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.161.2.1 src/sys/dev/usb/uaudio.c

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



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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 18:53:26 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: if_ure.c

Log Message:
Pull up following revision(s) (requested by bad in ticket #343):

sys/dev/usb/if_ure.c: revision 1.32
sys/dev/usb/if_ure.c: revision 1.33

read mac address of ure version 4c10 from URE_PLA_IDR, save as 4c00.
from ganbold@freebsd r346052.
XXX pullup-9

 -

allocate a random mac address if on-chip mac is all zeroes.
helps ure(4) on NanoPi R1.
partly from ganbold@freebsd r346052.
XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.14.2.1 -r1.14.2.2 src/sys/dev/usb/if_ure.c

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



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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 18:53:26 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: if_ure.c

Log Message:
Pull up following revision(s) (requested by bad in ticket #343):

sys/dev/usb/if_ure.c: revision 1.32
sys/dev/usb/if_ure.c: revision 1.33

read mac address of ure version 4c10 from URE_PLA_IDR, save as 4c00.
from ganbold@freebsd r346052.
XXX pullup-9

 -

allocate a random mac address if on-chip mac is all zeroes.
helps ure(4) on NanoPi R1.
partly from ganbold@freebsd r346052.
XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.14.2.1 -r1.14.2.2 src/sys/dev/usb/if_ure.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_ure.c
diff -u src/sys/dev/usb/if_ure.c:1.14.2.1 src/sys/dev/usb/if_ure.c:1.14.2.2
--- src/sys/dev/usb/if_ure.c:1.14.2.1	Sun Sep  1 13:00:36 2019
+++ src/sys/dev/usb/if_ure.c	Thu Oct 17 18:53:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ure.c,v 1.14.2.1 2019/09/01 13:00:36 martin Exp $	*/
+/*	$NetBSD: if_ure.c,v 1.14.2.2 2019/10/17 18:53:25 martin Exp $	*/
 /*	$OpenBSD: if_ure.c,v 1.10 2018/11/02 21:32:30 jcs Exp $	*/
 
 /*-
@@ -30,7 +30,7 @@
 /* RealTek RTL8152/RTL8153 10/100/Gigabit USB Ethernet device */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.14.2.1 2019/09/01 13:00:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.14.2.2 2019/10/17 18:53:25 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -38,6 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1
 #endif
 
 #include 
+#include 
 
 #include 
 
@@ -66,6 +67,9 @@ int	uredebug = 0;
 #define DPRINTFN(n, x)
 #endif
 
+#define ETHER_IS_ZERO(addr) \
+	(!(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]))
+
 static const struct usb_devno ure_devs[] = {
 	{ USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8152 },
 	{ USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8153 }
@@ -848,6 +852,7 @@ ure_attach(device_t parent, device_t sel
 	uint16_t ver;
 	uint8_t eaddr[8]; /* 2byte padded */
 	char *devinfop;
+	uint32_t maclo, machi;
 
 	aprint_naive("\n");
 	aprint_normal("\n");
@@ -941,13 +946,24 @@ ure_attach(device_t parent, device_t sel
 	else
 		ure_rtl8153_init(un);
 
-	if (un->un_flags & URE_FLAG_VER_4C00)
+	if ((un->un_flags & URE_FLAG_VER_4C00) ||
+	(un->un_flags & URE_FLAG_VER_4C10))
 		ure_read_mem(un, URE_PLA_IDR, URE_MCU_TYPE_PLA, eaddr,
 		sizeof(eaddr));
 	else
 		ure_read_mem(un, URE_PLA_BACKUP, URE_MCU_TYPE_PLA, eaddr,
 		sizeof(eaddr));
 	usbnet_unlock(un);
+	if (ETHER_IS_ZERO(eaddr)) {
+		maclo = 0x00f2 | (cprng_strong32() & 0x);
+		machi = cprng_strong32() & 0x;
+		eaddr[0] = maclo & 0xff;
+		eaddr[1] = (maclo >> 8) & 0xff;
+		eaddr[2] = (maclo >> 16) & 0xff;
+		eaddr[3] = (maclo >> 24) & 0xff;
+		eaddr[4] = machi & 0xff;
+		eaddr[5] = (machi >> 8) & 0xff;
+	}
 	memcpy(un->un_eaddr, eaddr, sizeof un->un_eaddr);
 
 	struct ifnet *ifp = usbnet_ifp(un);



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

2019-09-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 13 06:51:59 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: if_upl.c if_url.c if_urndis.c usb_mem.c
usbnet.c usbnet.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #197):

sys/dev/usb/if_url.c: revision 1.71
sys/dev/usb/usbnet.h: revision 1.15
sys/dev/usb/usb_mem.c: revision 1.72
sys/dev/usb/if_urndis.c: revision 1.24
sys/dev/usb/if_upl.c: revision 1.67
sys/dev/usb/usbnet.c: revision 1.25
sys/dev/usb/usbnet.c: revision 1.26
sys/dev/usb/usbnet.c: revision 1.27
sys/dev/usb/usbnet.c: revision 1.28

Teach urndis to handle some REMOTE_NDIS_INDICATE_STATUS_MSG. If the status
is reasonable, don't tell userland we got an error. Stops spurious EIO.
>From openbsd.

Fix bug, remove {0,0} because we switched to usb_lookup().

s/no free/no freelist entry/ in a debug message.

fix a lock hang reported by sc.dying in PR#54495.

remove locking in usbnet_tick().  assume that all locking
needs are handled inside usbnet_tick_task(), which runs in
the usbtask thread.  ensure that usbnet private is valid
before using it.

also check NULL private pointer in usbnet_isdying().
all the other cases should never happen.

don't try to set dying when we haven't usbnet_attach()d yet.
reported by maxv.

- use CALLARGS vs CALLED for better usbhist
- turn off usbnetdebug default
- log for all entry/exit points of usbnet_pipe_intr()
- in usbnet_start_locked() track whether any packet has been
  transmitted for setting the timer.  avoids spurious
  "watchdog timeouts"
- in usbnet_stop() use callout_halt() vs callout_halt, and
  also stop the usb task.  fixes crash of usbtask after the
  phy has detached.
- add a little more defensive checking in the tick task, and
  add some high-log-level logs.
- in usbnet_detach() move the call to usbnet_stop_ifp() above
  the calls to callout/usbtask stopping.
- set ec_mii and unp_pri to NULL when freeing their data

normalise an error message.

document usbnet_private locking.  minor knf.


To generate a diff of this commit:
cvs rdiff -u -r1.64.2.1 -r1.64.2.2 src/sys/dev/usb/if_upl.c
cvs rdiff -u -r1.66.2.1 -r1.66.2.2 src/sys/dev/usb/if_url.c
cvs rdiff -u -r1.21.4.1 -r1.21.4.2 src/sys/dev/usb/if_urndis.c
cvs rdiff -u -r1.70.10.1 -r1.70.10.2 src/sys/dev/usb/usb_mem.c
cvs rdiff -u -r1.25.2.2 -r1.25.2.3 src/sys/dev/usb/usbnet.c
cvs rdiff -u -r1.14.2.2 -r1.14.2.3 src/sys/dev/usb/usbnet.h

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_upl.c
diff -u src/sys/dev/usb/if_upl.c:1.64.2.1 src/sys/dev/usb/if_upl.c:1.64.2.2
--- src/sys/dev/usb/if_upl.c:1.64.2.1	Sun Sep  1 13:00:36 2019
+++ src/sys/dev/usb/if_upl.c	Fri Sep 13 06:51:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_upl.c,v 1.64.2.1 2019/09/01 13:00:36 martin Exp $	*/
+/*	$NetBSD: if_upl.c,v 1.64.2.2 2019/09/13 06:51:58 martin Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.64.2.1 2019/09/01 13:00:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.64.2.2 2019/09/13 06:51:58 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -95,8 +95,7 @@ static struct usb_devno sc_devs[] = {
 	{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2302 },
 	{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL25A1 },
 	{ USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5U258 },
-	{ USB_VENDOR_NI, USB_PRODUCT_NI_HTOH_7825 },
-	{ 0, 0 }
+	{ USB_VENDOR_NI, USB_PRODUCT_NI_HTOH_7825 }
 };
 
 int	upl_match(device_t, cfdata_t, void *);

Index: src/sys/dev/usb/if_url.c
diff -u src/sys/dev/usb/if_url.c:1.66.2.1 src/sys/dev/usb/if_url.c:1.66.2.2
--- src/sys/dev/usb/if_url.c:1.66.2.1	Sun Sep  1 13:00:36 2019
+++ src/sys/dev/usb/if_url.c	Fri Sep 13 06:51:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_url.c,v 1.66.2.1 2019/09/01 13:00:36 martin Exp $	*/
+/*	$NetBSD: if_url.c,v 1.66.2.2 2019/09/13 06:51:58 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.66.2.1 2019/09/01 13:00:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.66.2.2 2019/09/13 06:51:58 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -190,7 +190,7 @@ url_attach(device_t parent, device_t sel
 	if (err) {
 		aprint_error_dev(self, "failed to set configuration"
 		", err=%s\n", usbd_errstr(err));
-		goto bad;
+		return;
 	}
 
 	/* get control interface */
@@ -198,7 +198,7 @@ url_attach(device_t parent, device_t sel
 	if (err) {
 		aprint_error_dev(self, "failed to get interface, err=%s\n",
 		   usbd_errstr(err));
-		goto bad;
+		return;
 	}
 
 	un->un_iface = iface;
@@ -221,7 +221,7 @@ url_attach(device_t parent, device_t sel
 		if (ed == NULL) {
 			aprint_error_dev(self,
 			"couldn't get endpoint %d\n", i);
-			goto bad;
+			

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

2019-09-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 13 06:51:59 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: if_upl.c if_url.c if_urndis.c usb_mem.c
usbnet.c usbnet.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #197):

sys/dev/usb/if_url.c: revision 1.71
sys/dev/usb/usbnet.h: revision 1.15
sys/dev/usb/usb_mem.c: revision 1.72
sys/dev/usb/if_urndis.c: revision 1.24
sys/dev/usb/if_upl.c: revision 1.67
sys/dev/usb/usbnet.c: revision 1.25
sys/dev/usb/usbnet.c: revision 1.26
sys/dev/usb/usbnet.c: revision 1.27
sys/dev/usb/usbnet.c: revision 1.28

Teach urndis to handle some REMOTE_NDIS_INDICATE_STATUS_MSG. If the status
is reasonable, don't tell userland we got an error. Stops spurious EIO.
>From openbsd.

Fix bug, remove {0,0} because we switched to usb_lookup().

s/no free/no freelist entry/ in a debug message.

fix a lock hang reported by sc.dying in PR#54495.

remove locking in usbnet_tick().  assume that all locking
needs are handled inside usbnet_tick_task(), which runs in
the usbtask thread.  ensure that usbnet private is valid
before using it.

also check NULL private pointer in usbnet_isdying().
all the other cases should never happen.

don't try to set dying when we haven't usbnet_attach()d yet.
reported by maxv.

- use CALLARGS vs CALLED for better usbhist
- turn off usbnetdebug default
- log for all entry/exit points of usbnet_pipe_intr()
- in usbnet_start_locked() track whether any packet has been
  transmitted for setting the timer.  avoids spurious
  "watchdog timeouts"
- in usbnet_stop() use callout_halt() vs callout_halt, and
  also stop the usb task.  fixes crash of usbtask after the
  phy has detached.
- add a little more defensive checking in the tick task, and
  add some high-log-level logs.
- in usbnet_detach() move the call to usbnet_stop_ifp() above
  the calls to callout/usbtask stopping.
- set ec_mii and unp_pri to NULL when freeing their data

normalise an error message.

document usbnet_private locking.  minor knf.


To generate a diff of this commit:
cvs rdiff -u -r1.64.2.1 -r1.64.2.2 src/sys/dev/usb/if_upl.c
cvs rdiff -u -r1.66.2.1 -r1.66.2.2 src/sys/dev/usb/if_url.c
cvs rdiff -u -r1.21.4.1 -r1.21.4.2 src/sys/dev/usb/if_urndis.c
cvs rdiff -u -r1.70.10.1 -r1.70.10.2 src/sys/dev/usb/usb_mem.c
cvs rdiff -u -r1.25.2.2 -r1.25.2.3 src/sys/dev/usb/usbnet.c
cvs rdiff -u -r1.14.2.2 -r1.14.2.3 src/sys/dev/usb/usbnet.h

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



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

2019-09-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 13 06:32:11 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: xhci.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #196):

sys/dev/usb/xhci.c: revision 1.111
sys/dev/usb/xhci.c: revision 1.112
sys/dev/usb/xhci.c: revision 1.113
sys/dev/usb/xhci.c: revision 1.114

introduce and use XHCIHIST_CALLARGS().  reduces lots of double logs,
and includes useful info in all cases instead of just "called".
add a couple of more logs that i've wanted while debugging ryzen3
vs USB issues.

fix 32-bit debug build, and also vmstat -y.  reported by sc.dying.

fix ryzen usb issue: we set TD size to '1', where has xhci spec 4.11.2.4
says final TRB for a TD should have this set to '0'.  since we currently
only generate sinel TRB TDs, set this to 0.
from sc.dying

avoid non-debug kernel build issues.


To generate a diff of this commit:
cvs rdiff -u -r1.107.2.2 -r1.107.2.3 src/sys/dev/usb/xhci.c

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



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

2019-09-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 13 06:32:11 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: xhci.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #196):

sys/dev/usb/xhci.c: revision 1.111
sys/dev/usb/xhci.c: revision 1.112
sys/dev/usb/xhci.c: revision 1.113
sys/dev/usb/xhci.c: revision 1.114

introduce and use XHCIHIST_CALLARGS().  reduces lots of double logs,
and includes useful info in all cases instead of just "called".
add a couple of more logs that i've wanted while debugging ryzen3
vs USB issues.

fix 32-bit debug build, and also vmstat -y.  reported by sc.dying.

fix ryzen usb issue: we set TD size to '1', where has xhci spec 4.11.2.4
says final TRB for a TD should have this set to '0'.  since we currently
only generate sinel TRB TDs, set this to 0.
from sc.dying

avoid non-debug kernel build issues.


To generate a diff of this commit:
cvs rdiff -u -r1.107.2.2 -r1.107.2.3 src/sys/dev/usb/xhci.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/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.107.2.2 src/sys/dev/usb/xhci.c:1.107.2.3
--- src/sys/dev/usb/xhci.c:1.107.2.2	Sun Sep  1 13:00:37 2019
+++ src/sys/dev/usb/xhci.c	Fri Sep 13 06:32:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.107.2.2 2019/09/01 13:00:37 martin Exp $	*/
+/*	$NetBSD: xhci.c,v 1.107.2.3 2019/09/13 06:32:11 martin Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.107.2.2 2019/09/01 13:00:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.107.2.3 2019/09/13 06:32:11 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -114,9 +114,12 @@ fail:
 #define HEXDUMP(a, b, c)
 #endif
 
-#define DPRINTFN(N,FMT,A,B,C,D) USBHIST_LOGN(xhcidebug,N,FMT,A,B,C,D)
-#define XHCIHIST_FUNC() USBHIST_FUNC()
-#define XHCIHIST_CALLED(name) USBHIST_CALLED(xhcidebug)
+#define DPRINTF(FMT,A,B,C,D)	USBHIST_LOG(xhcidebug,FMT,A,B,C,D)
+#define DPRINTFN(N,FMT,A,B,C,D)	USBHIST_LOGN(xhcidebug,N,FMT,A,B,C,D)
+#define XHCIHIST_FUNC()		USBHIST_FUNC()
+#define XHCIHIST_CALLED(name)	USBHIST_CALLED(xhcidebug)
+#define XHCIHIST_CALLARGS(FMT,A,B,C,D) \
+USBHIST_CALLARGS(xhcidebug,FMT,A,B,C,D)
 
 #define XHCI_DCI_SLOT 0
 #define XHCI_DCI_EP_CONTROL 1
@@ -1297,10 +1300,10 @@ xhci_intr1(struct xhci_softc * const sc)
 	uint32_t usbsts;
 	uint32_t iman;
 
-	XHCIHIST_FUNC(); XHCIHIST_CALLED();
+	XHCIHIST_FUNC();
 
 	usbsts = xhci_op_read_4(sc, XHCI_USBSTS);
-	DPRINTFN(16, "USBSTS %08jx", usbsts, 0, 0, 0);
+	XHCIHIST_CALLARGS("USBSTS %08jx", usbsts, 0, 0, 0);
 	if ((usbsts & (XHCI_STS_HSE | XHCI_STS_EINT | XHCI_STS_PCD |
 	XHCI_STS_HCE)) == 0) {
 		DPRINTFN(16, "ignored intr not for %s",
@@ -1411,8 +1414,8 @@ xhci_configure_endpoint(struct usbd_pipe
 	struct xhci_soft_trb trb;
 	usbd_status err;
 
-	XHCIHIST_FUNC(); XHCIHIST_CALLED();
-	DPRINTFN(4, "slot %ju dci %ju epaddr 0x%02jx attr 0x%02jx",
+	XHCIHIST_FUNC();
+	XHCIHIST_CALLARGS("slot %ju dci %ju epaddr 0x%02jx attr 0x%02jx",
 	xs->xs_idx, dci, pipe->up_endpoint->ue_edesc->bEndpointAddress,
 	pipe->up_endpoint->ue_edesc->bmAttributes);
 
@@ -1450,8 +1453,8 @@ xhci_unconfigure_endpoint(struct usbd_pi
 	struct xhci_slot * const xs = pipe->up_dev->ud_hcpriv;
 #endif
 
-	XHCIHIST_FUNC(); XHCIHIST_CALLED();
-	DPRINTFN(4, "slot %ju", xs->xs_idx, 0, 0, 0);
+	XHCIHIST_FUNC();
+	XHCIHIST_CALLARGS("slot %ju", xs->xs_idx, 0, 0, 0);
 
 	return USBD_NORMAL_COMPLETION;
 }
@@ -1467,8 +1470,8 @@ xhci_reset_endpoint_locked(struct usbd_p
 	struct xhci_soft_trb trb;
 	usbd_status err;
 
-	XHCIHIST_FUNC(); XHCIHIST_CALLED();
-	DPRINTFN(4, "slot %ju dci %ju", xs->xs_idx, dci, 0, 0);
+	XHCIHIST_FUNC();
+	XHCIHIST_CALLARGS("slot %ju dci %ju", xs->xs_idx, dci, 0, 0);
 
 	KASSERT(mutex_owned(>sc_lock));
 
@@ -1509,8 +1512,8 @@ xhci_stop_endpoint(struct usbd_pipe *pip
 	usbd_status err;
 	const u_int dci = xhci_ep_get_dci(pipe->up_endpoint->ue_edesc);
 
-	XHCIHIST_FUNC(); XHCIHIST_CALLED();
-	DPRINTFN(4, "slot %ju dci %ju", xs->xs_idx, dci, 0, 0);
+	XHCIHIST_FUNC();
+	XHCIHIST_CALLARGS("slot %ju dci %ju", xs->xs_idx, dci, 0, 0);
 
 	KASSERT(mutex_owned(>sc_lock));
 
@@ -1543,8 +1546,8 @@ xhci_set_dequeue_locked(struct usbd_pipe
 	struct xhci_soft_trb trb;
 	usbd_status err;
 
-	XHCIHIST_FUNC(); XHCIHIST_CALLED();
-	DPRINTFN(4, "slot %ju dci %ju", xs->xs_idx, dci, 0, 0);
+	XHCIHIST_FUNC();
+	XHCIHIST_CALLARGS("slot %ju dci %ju", xs->xs_idx, dci, 0, 0);
 
 	KASSERT(mutex_owned(>sc_lock));
 
@@ -1587,8 +1590,8 @@ xhci_open(struct usbd_pipe *pipe)
 	usb_endpoint_descriptor_t * const ed = pipe->up_endpoint->ue_edesc;
 	const uint8_t xfertype = UE_GET_XFERTYPE(ed->bmAttributes);
 
-	XHCIHIST_FUNC(); XHCIHIST_CALLED();
-	DPRINTFN(1, "addr %jd depth %jd port %jd speed %jd", dev->ud_addr,
+	XHCIHIST_FUNC();
+	XHCIHIST_CALLARGS("addr %jd 

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

2019-09-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Sep  2 07:02:34 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: if_aue.c

Log Message:
Ticket #135: something went wrong in the pullup process for this file
(likely overlooked conflict with previously applied rev. 156).
So now actually sync this up to rev 1.161, as the last pullup claimed


To generate a diff of this commit:
cvs rdiff -u -r1.154.2.1 -r1.154.2.2 src/sys/dev/usb/if_aue.c

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



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

2019-09-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Sep  2 07:02:34 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: if_aue.c

Log Message:
Ticket #135: something went wrong in the pullup process for this file
(likely overlooked conflict with previously applied rev. 156).
So now actually sync this up to rev 1.161, as the last pullup claimed


To generate a diff of this commit:
cvs rdiff -u -r1.154.2.1 -r1.154.2.2 src/sys/dev/usb/if_aue.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_aue.c
diff -u src/sys/dev/usb/if_aue.c:1.154.2.1 src/sys/dev/usb/if_aue.c:1.154.2.2
--- src/sys/dev/usb/if_aue.c:1.154.2.1	Fri Aug  9 16:15:06 2019
+++ src/sys/dev/usb/if_aue.c	Mon Sep  2 07:02:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aue.c,v 1.154.2.1 2019/08/09 16:15:06 martin Exp $	*/
+/*	$NetBSD: if_aue.c,v 1.154.2.2 2019/09/02 07:02:34 martin Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
@@ -70,14 +70,13 @@
 /*
  * TODO:
  * better error messages from rxstat
- * split out if_auevar.h
  * more error checks
  * investigate short rx problem
  * proper cleanup on errors
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.154.2.1 2019/08/09 16:15:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.154.2.2 2019/09/02 07:02:34 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -85,51 +84,75 @@ __KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1
 #endif
 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
 
-#include 
+#include 
+#include 
+#include 
 
-#include 
 #ifdef INET
 #include 
 #include 
 #endif
 
+#ifdef USB_DEBUG
+#ifndef AUE_DEBUG
+#define auedebug 0
+#else
+static int auedebug = 10;
 
+SYSCTL_SETUP(sysctl_hw_aue_setup, "sysctl hw.aue setup")
+{
+	int err;
+	const struct sysctlnode *rnode;
+	const struct sysctlnode *cnode;
+
+	err = sysctl_createv(clog, 0, NULL, ,
+	CTLFLAG_PERMANENT, CTLTYPE_NODE, "aue",
+	SYSCTL_DESCR("aue global controls"),
+	NULL, 0, NULL, 0, CTL_HW, CTL_CREATE, CTL_EOL);
+
+	if (err)
+		goto fail;
+
+	/* control debugging printfs */
+	err = sysctl_createv(clog, 0, , ,
+	CTLFLAG_PERMANENT | CTLFLAG_READWRITE, CTLTYPE_INT,
+	"debug", SYSCTL_DESCR("Enable debugging output"),
+	NULL, 0, , sizeof(auedebug), CTL_CREATE, CTL_EOL);
+	if (err)
+		goto fail;
 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
+	return;
+fail:
+	aprint_error("%s: sysctl_createv failed (err = %d)\n", __func__, err);
+}
 
-#include 
-#include 
+#endif /* AXE_DEBUG */
+#endif /* USB_DEBUG */
 
-#include 
+#define DPRINTF(FMT,A,B,C,D)	USBHIST_LOGN(auedebug,1,FMT,A,B,C,D)
+#define DPRINTFN(N,FMT,A,B,C,D)	USBHIST_LOGN(auedebug,N,FMT,A,B,C,D)
+#define AUEHIST_FUNC()		USBHIST_FUNC()
+#define AUEHIST_CALLED(name)	USBHIST_CALLED(auedebug)
+#define AUEHIST_CALLARGS(FMT,A,B,C,D) \
+USBHIST_CALLARGS(auedebug,FMT,A,B,C,D)
+#define AUEHIST_CALLARGSN(N,FMT,A,B,C,D) \
+USBHIST_CALLARGSN(auedebug,N,FMT,A,B,C,D)
+
+#define AUE_TX_LIST_CNT		1
+#define AUE_RX_LIST_CNT		1
+
+struct aue_softc {
+	struct usbnet		aue_un;
+	struct usbnet_intr	aue_intr;
+	struct aue_intrpkt	aue_ibuf;
+};
 
-#ifdef AUE_DEBUG
-#define DPRINTF(x)	if (auedebug) printf x
-#define DPRINTFN(n, x)	if (auedebug >= (n)) printf x
-int	auedebug = 0;
-#else
-#define DPRINTF(x)
-#define DPRINTFN(n, x)
-#endif
+#define AUE_TIMEOUT		1000
+#define AUE_BUFSZ		1536
+#define AUE_MIN_FRAMELEN	60
+#define AUE_TX_TIMEOUT		1 /* ms */
+#define AUE_INTR_INTERVAL	100 /* ms */
 
 /*
  * Various supported device vendors/products.
@@ -142,7 +165,7 @@ struct aue_type {
 #define PII	0x0004		/* Pegasus II chip */
 };
 
-Static const struct aue_type aue_devs[] = {
+static const struct aue_type aue_devs[] = {
  {{ USB_VENDOR_3COM,		USB_PRODUCT_3COM_3C460B},	  PII },
  {{ USB_VENDOR_ABOCOM,		USB_PRODUCT_ABOCOM_XX1},	  PNA | PII },
  {{ USB_VENDOR_ABOCOM,		USB_PRODUCT_ABOCOM_XX2},	  PII },
@@ -210,49 +233,42 @@ Static const struct aue_type aue_devs[] 
 
 int aue_match(device_t, cfdata_t, void *);
 void aue_attach(device_t, device_t, void *);
-int aue_detach(device_t, int);
-int aue_activate(device_t, enum devact);
 
 CFATTACH_DECL_NEW(aue, sizeof(struct aue_softc), aue_match, aue_attach,
-aue_detach, aue_activate);
+usbnet_detach, usbnet_activate);
+
+static void aue_reset_pegasus_II(struct aue_softc *);
 
-Static void aue_multithread(void *);
+static void aue_stop_cb(struct ifnet *, int);
+static int aue_ioctl_cb(struct ifnet *, u_long, void *);
+static int aue_mii_read_reg(struct usbnet *, int, int, uint16_t *);
+static int aue_mii_write_reg(struct usbnet *, int, int, uint16_t);
+static void aue_mii_statchg(struct ifnet *);
+static unsigned aue_tx_prepare(struct usbnet *, struct mbuf *,
+			   struct usbnet_chain *);
+static void aue_rx_loop(struct usbnet *, struct usbnet_chain *, 

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

2019-08-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Aug 26 13:55:36 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: usbdevs.h usbdevs_data.h

Log Message:
regen for ticket #111


To generate a diff of this commit:
cvs rdiff -u -r1.760 -r1.760.4.1 src/sys/dev/usb/usbdevs.h \
src/sys/dev/usb/usbdevs_data.h

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



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

2019-08-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Aug 26 13:54:42 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: usbdevs

Log Message:
Pull up following revision(s) (requested by mrg in ticket #111):

sys/dev/usb/usbdevs: revision 1.771
sys/dev/usb/usbdevs: revision 1.772
sys/dev/usb/usbdevs: revision 1.773

add 3 devices for upl(4) host-to-host networking:
- belkin F5U258
- national instruments USB host to host adapter
- prolific id 25a1

 -

add two kue(4) adapters:
ACTIONTEC KL5KUSB101 USB Ethernet adapter
ALLIEDTELESYN AT-USB10 USB Ethernet Adapter

 -

add MosChip MCS7730 and Sitecom Europe LN030 ethernet adapters.


To generate a diff of this commit:
cvs rdiff -u -r1.770 -r1.770.4.1 src/sys/dev/usb/usbdevs

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/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.770 src/sys/dev/usb/usbdevs:1.770.4.1
--- src/sys/dev/usb/usbdevs:1.770	Wed Jan 30 19:51:28 2019
+++ src/sys/dev/usb/usbdevs	Mon Aug 26 13:54:41 2019
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.770 2019/01/30 19:51:28 jakllsch Exp $
+$NetBSD: usbdevs,v 1.770.4.1 2019/08/26 13:54:41 martin Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -724,6 +724,7 @@ product ACERW WARPLINK		0x0204	Warplink
 product ACTIONTEC PRISM_25	0x0408	Prism2.5 WLAN
 product ACTIONTEC PRISM_25A	0x0421	Prism2.5 WLAN A
 product ACTIONTEC AR9287	0x1200	AR9287+AR7010
+product ACTIONTEC KL5KUSB101	0x1200	KL5KUSB101 USB Ethernet adapter
 product ACTIONTEC FREELAN	0x6106	ROPEX FreeLan 802.11b
 product ACTIONTEC UAT1		0x7605	UAT1 Wireless Ethernet adapter
 
@@ -1066,6 +1067,7 @@ product BELKIN RTL8192CU_2	0x1004	RTL819
 product BELKIN RTL8188CU	0x1102	RTL8188CU
 product BELKIN RTL8188CUS	0x11f2	RTL8188CUS
 product BELKIN F5U120		0x1203	F5U120-PC Hub
+product BELKIN F5U258		0x258a	F5U258/F5U279 Host to host adapter
 product BELKIN RTL8192CU	0x2102	RTL8192CU
 product BELKIN F7D2102		0x2103	F7D2102
 product BELKIN RTL8192CU_1	0x21f2	RTL8192CU
@@ -2367,6 +2369,7 @@ product MOBILITY EASIDOCK	0x0304	EasiDoc
 /* MosChip Semiconductor */
 product MOSCHIP MCS7703		0x7703	MCS7703 USB Serial Adapter
 product MOSCHIP MCS7720		0x7720	MCS7720 USB Serial Adapter
+product MOSCHIP MCS7730		0x7730	MCS7730 Ethernet Adapter
 product MOSCHIP MCS7780		0x7780	MCS7780 Fast IrDA Adapter
 product MOSCHIP MCS7781		0x7781	MCS7781 Fast IrDA Adapter
 product MOSCHIP MCS7784		0x7784	MCS7784 Slow IrDA Adapter
@@ -2409,6 +2412,7 @@ product MUSTEK DV2000		0xc441	DV2000 dig
 
 /* National Instruments */
 product NI GPIB_USB_A		0xc920	GPIB-USB-A
+product NI HTOH_7825		0x7825	Host to Host Adapter
 
 /* National Semiconductor */
 product NATIONAL BEARPAW1200	0x1000	BearPaw 1200
@@ -2752,6 +2756,7 @@ product PROLIFIC PL2303		0x2303	PL2303 S
 product PROLIFIC PL2305		0x2305	Parallel printer adapter
 product PROLIFIC ATAPI4		0x2307	ATAPI-4 Bridge Controller
 product PROLIFIC PL2501		0x2501	PL2501 Host-Host interface
+product PROLIFIC PL25A1		0x25a1	PL25A1 Host-Host interface
 product PROLIFIC PL2303X	0xaaa0	PL2303 Serial adapter (Pharos GPS)
 product PROLIFIC RSAQ3		0xaaa2	PL2303 Serial adapter (IODATA USB-RSAQ3)
 product PROLIFIC2 PL2303	0x2303	PL2303 Serial adapter (SMART Technologies)
@@ -3064,6 +3069,9 @@ product SIGMATEL I_BEAD150	0x8009	i-Bead
 product SIGMATEL DNSSF7X	0x8020	Datum Networks SSF-7X Multi Players
 product SIGMATEL MUSICSTICK	0x8134	TrekStor Musicstick
 
+/* Allied Telesyn products */
+product ALLIEDTELESYN AT_USB10	0x07c9	AT-USB10 USB Ethernet Adapter
+
 /* SIIG products */
 product SIIG DIGIFILMREADER	0x0004	DigiFilm-Combo Reader
 product SIIG UISDMC2S		0x0200	MULTICARDREADER
@@ -3109,6 +3117,7 @@ product SITECOM CN104		0x2068	CN104 seri
 /* Sitecom Europe products */
 product SITECOMEU WL168V1	0x000d	WL-168 v1
 product SITECOMEU RT2870_1	0x0017	RT2870
+product SITECOMEU LN030		0x0021	LN-030
 product SITECOMEU WL168V4	0x0028	WL-168 v4
 product SITECOMEU RT2870_2	0x002b	RT2870
 product SITECOMEU RT2870_3	0x002c	RT2870



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

2019-08-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Aug 26 13:54:42 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: usbdevs

Log Message:
Pull up following revision(s) (requested by mrg in ticket #111):

sys/dev/usb/usbdevs: revision 1.771
sys/dev/usb/usbdevs: revision 1.772
sys/dev/usb/usbdevs: revision 1.773

add 3 devices for upl(4) host-to-host networking:
- belkin F5U258
- national instruments USB host to host adapter
- prolific id 25a1

 -

add two kue(4) adapters:
ACTIONTEC KL5KUSB101 USB Ethernet adapter
ALLIEDTELESYN AT-USB10 USB Ethernet Adapter

 -

add MosChip MCS7730 and Sitecom Europe LN030 ethernet adapters.


To generate a diff of this commit:
cvs rdiff -u -r1.770 -r1.770.4.1 src/sys/dev/usb/usbdevs

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



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

2019-08-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug 21 14:34:56 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: xhci.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #104):

sys/dev/usb/xhci.c: revision 1.108

typo in error message


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.107.2.1 src/sys/dev/usb/xhci.c

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



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

2019-08-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug 21 14:34:56 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: xhci.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #104):

sys/dev/usb/xhci.c: revision 1.108

typo in error message


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.107.2.1 src/sys/dev/usb/xhci.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/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.107 src/sys/dev/usb/xhci.c:1.107.2.1
--- src/sys/dev/usb/xhci.c:1.107	Wed May  8 06:31:02 2019
+++ src/sys/dev/usb/xhci.c	Wed Aug 21 14:34:56 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.107 2019/05/08 06:31:02 mrg Exp $	*/
+/*	$NetBSD: xhci.c,v 1.107.2.1 2019/08/21 14:34:56 martin Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.107 2019/05/08 06:31:02 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.107.2.1 2019/08/21 14:34:56 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -790,7 +790,7 @@ xhci_id_protocols(struct xhci_softc *sc,
 	/* Index arrays with 0..n-1 where ports are numbered 1..n */
 	for (size_t cp = cpo - 1; cp < cpo + cpc - 1; cp++) {
 		if (sc->sc_ctlrportmap[cp] != 0) {
-			aprint_error_dev(sc->sc_dev, "contoller port %zu "
+			aprint_error_dev(sc->sc_dev, "controller port %zu "
 			"already assigned", cp);
 			continue;
 		}



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

2019-08-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug  9 16:15:06 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: if_aue.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #39):

sys/dev/usb/if_aue.c: revision 1.156

Fix panic when setting multicast addresses. Write the hash table outside of
ETHER_LOC()/ETHER_UNLOCK().


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.154.2.1 src/sys/dev/usb/if_aue.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_aue.c
diff -u src/sys/dev/usb/if_aue.c:1.154 src/sys/dev/usb/if_aue.c:1.154.2.1
--- src/sys/dev/usb/if_aue.c:1.154	Tue May 28 07:41:50 2019
+++ src/sys/dev/usb/if_aue.c	Fri Aug  9 16:15:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aue.c,v 1.154 2019/05/28 07:41:50 msaitoh Exp $	*/
+/*	$NetBSD: if_aue.c,v 1.154.2.1 2019/08/09 16:15:06 martin Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.154 2019/05/28 07:41:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.154.2.1 2019/08/09 16:15:06 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -587,6 +587,7 @@ aue_setmulti(struct aue_softc *sc)
 	struct ether_multi	*enm;
 	struct ether_multistep	step;
 	uint32_t		h = 0, i;
+	uint8_t hashtbl[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
 
 	DPRINTFN(5,("%s: %s: enter\n", device_xname(sc->aue_dev), __func__));
 
@@ -601,10 +602,6 @@ allmulti:
 
 	AUE_CLRBIT(sc, AUE_CTL0, AUE_CTL0_ALLMULTI);
 
-	/* first, zot all the existing hash bits */
-	for (i = 0; i < 8; i++)
-		aue_csr_write_1(sc, AUE_MAR0 + i, 0);
-
 	/* now program new ones */
 	ETHER_LOCK(ec);
 	ETHER_FIRST_MULTI(step, ec, enm);
@@ -616,11 +613,15 @@ allmulti:
 		}
 
 		h = aue_crc(enm->enm_addrlo);
-		AUE_SETBIT(sc, AUE_MAR + (h >> 3), 1 << (h & 0x7));
+		hashtbl[h >> 3] |= 1 << (h & 0x7);
 		ETHER_NEXT_MULTI(step, enm);
 	}
 	ETHER_UNLOCK(ec);
 
+	/* write the hashtable */
+	for (i = 0; i < 8; i++)
+		aue_csr_write_1(sc, AUE_MAR0 + i, hashtbl[i]);
+
 	ifp->if_flags &= ~IFF_ALLMULTI;
 }
 



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

2019-08-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug  9 16:15:06 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: if_aue.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #39):

sys/dev/usb/if_aue.c: revision 1.156

Fix panic when setting multicast addresses. Write the hash table outside of
ETHER_LOC()/ETHER_UNLOCK().


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.154.2.1 src/sys/dev/usb/if_aue.c

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