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

2024-03-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 12 12:34:50 UTC 2024

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1807):

sys/dev/usb/usbdi.c: revision 1.248

usbdi(9): Avoid calling ubm_softint with lock held and polling on.

PR kern/57783


To generate a diff of this commit:
cvs rdiff -u -r1.182.4.5 -r1.182.4.6 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.182.4.5 src/sys/dev/usb/usbdi.c:1.182.4.6
--- src/sys/dev/usb/usbdi.c:1.182.4.5	Sat Jul 18 15:09:28 2020
+++ src/sys/dev/usb/usbdi.c	Tue Mar 12 12:34:50 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.182.4.5 2020/07/18 15:09:28 martin Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.182.4.6 2024/03/12 12:34:50 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.182.4.5 2020/07/18 15:09:28 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.182.4.6 2024/03/12 12:34:50 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1229,14 +1229,34 @@ usbd_dopoll(struct usbd_interface *iface
 void
 usbd_set_polling(struct usbd_device *dev, int on)
 {
-	if (on)
-		dev->ud_bus->ub_usepolling++;
-	else
-		dev->ud_bus->ub_usepolling--;
 
-	/* Kick the host controller when switching modes */
 	mutex_enter(dev->ud_bus->ub_lock);
-	dev->ud_bus->ub_methods->ubm_softint(dev->ud_bus);
+	if (on) {
+		/*
+		 * Enabling polling.  If we're enabling for the first
+		 * time, call the softint routine on transition while
+		 * we hold the lock and polling is still disabled, and
+		 * then enable polling -- once polling is enabled, we
+		 * must not hold the lock when we call the softint
+		 * routine.
+		 */
+		KASSERT(dev->ud_bus->ub_usepolling < __type_max(char));
+		if (dev->ud_bus->ub_usepolling == 0)
+			dev->ud_bus->ub_methods->ubm_softint(dev->ud_bus);
+		dev->ud_bus->ub_usepolling++;
+	} else {
+		/*
+		 * Disabling polling.  If we're disabling polling for
+		 * the last time, disable polling first and then call
+		 * the softint routine while we hold the lock -- until
+		 * polling is disabled, we must not hold the lock when
+		 * we call the softint routine.
+		 */
+		KASSERT(dev->ud_bus->ub_usepolling > 0);
+		dev->ud_bus->ub_usepolling--;
+		if (dev->ud_bus->ub_usepolling == 0)
+			dev->ud_bus->ub_methods->ubm_softint(dev->ud_bus);
+	}
 	mutex_exit(dev->ud_bus->ub_lock);
 }
 



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

2024-03-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 12 12:34:50 UTC 2024

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1807):

sys/dev/usb/usbdi.c: revision 1.248

usbdi(9): Avoid calling ubm_softint with lock held and polling on.

PR kern/57783


To generate a diff of this commit:
cvs rdiff -u -r1.182.4.5 -r1.182.4.6 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.



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

2024-03-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 10 18:59:19 UTC 2024

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1810):

sys/dev/usb/if_urtwn.c: revision 1.109 (patch)

urtwn(4): Ditch old queued commands on overflow.
Don't increment ring->queued past what the task will decrement.

This is a stop-gap measure; really, we should just have one task for
each operation that is deferred to the task thread.

PR kern/57965


To generate a diff of this commit:
cvs rdiff -u -r1.71.2.6 -r1.71.2.7 src/sys/dev/usb/if_urtwn.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_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.71.2.6 src/sys/dev/usb/if_urtwn.c:1.71.2.7
--- src/sys/dev/usb/if_urtwn.c:1.71.2.6	Sat Oct 23 11:21:54 2021
+++ src/sys/dev/usb/if_urtwn.c	Sun Mar 10 18:59:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.71.2.6 2021/10/23 11:21:54 martin Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.71.2.7 2024/03/10 18:59:19 martin Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.71.2.6 2021/10/23 11:21:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.71.2.7 2024/03/10 18:59:19 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -833,6 +833,24 @@ urtwn_tx_beacon(struct urtwn_softc *sc, 
 }
 
 static void
+urtwn_cmdq_invariants(struct urtwn_softc *sc)
+{
+	struct urtwn_host_cmd_ring *const ring __diagused = >cmdq;
+
+	KASSERT(mutex_owned(>sc_task_mtx));
+	KASSERTMSG((ring->cur >= 0 && ring->cur < URTWN_HOST_CMD_RING_COUNT),
+	"%s: cur=%d next=%d queued=%d",
+	device_xname(sc->sc_dev), ring->cur, ring->next, ring->queued);
+	KASSERTMSG((ring->next >= 0 && ring->next < URTWN_HOST_CMD_RING_COUNT),
+	"%s: cur=%d next=%d queued=%d",
+	device_xname(sc->sc_dev), ring->cur, ring->next, ring->queued);
+	KASSERTMSG((ring->queued >= 0 &&
+		ring->queued <= URTWN_HOST_CMD_RING_COUNT),
+	"%s: %d commands queued",
+	device_xname(sc->sc_dev), ring->queued);
+}
+
+static void
 urtwn_task(void *arg)
 {
 	struct urtwn_softc *sc = arg;
@@ -865,7 +883,11 @@ urtwn_task(void *arg)
 	/* Process host commands. */
 	s = splusb();
 	mutex_spin_enter(>sc_task_mtx);
+	urtwn_cmdq_invariants(sc);
 	while (ring->next != ring->cur) {
+		KASSERTMSG(ring->queued > 0, "%s: cur=%d next=%d queued=%d",
+		device_xname(sc->sc_dev),
+		ring->cur, ring->next, ring->queued);
 		cmd = >cmd[ring->next];
 		mutex_spin_exit(>sc_task_mtx);
 		splx(s);
@@ -873,6 +895,10 @@ urtwn_task(void *arg)
 		cmd->cb(sc, cmd->data);
 		s = splusb();
 		mutex_spin_enter(>sc_task_mtx);
+		urtwn_cmdq_invariants(sc);
+		KASSERTMSG(ring->queued > 0, "%s: cur=%d next=%d queued=%d",
+		device_xname(sc->sc_dev),
+		ring->cur, ring->next, ring->queued);
 		ring->queued--;
 		ring->next = (ring->next + 1) % URTWN_HOST_CMD_RING_COUNT;
 	}
@@ -887,6 +913,7 @@ urtwn_do_async(struct urtwn_softc *sc, v
 {
 	struct urtwn_host_cmd_ring *ring = >cmdq;
 	struct urtwn_host_cmd *cmd;
+	bool schedtask = false;
 	int s;
 
 	DPRINTFN(DBG_FN, ("%s: %s: cb=%p, arg=%p, len=%d\n",
@@ -894,19 +921,27 @@ urtwn_do_async(struct urtwn_softc *sc, v
 
 	s = splusb();
 	mutex_spin_enter(>sc_task_mtx);
+	urtwn_cmdq_invariants(sc);
 	cmd = >cmd[ring->cur];
 	cmd->cb = cb;
 	KASSERT(len <= sizeof(cmd->data));
 	memcpy(cmd->data, arg, len);
 	ring->cur = (ring->cur + 1) % URTWN_HOST_CMD_RING_COUNT;
 
-	/* If there is no pending command already, schedule a task. */
-	if (!sc->sc_dying && ++ring->queued == 1) {
-		mutex_spin_exit(>sc_task_mtx);
-		usb_add_task(sc->sc_udev, >sc_task, USB_TASKQ_DRIVER);
-	} else
-		mutex_spin_exit(>sc_task_mtx);
+	/*
+	 * Schedule a task to process the command if need be.
+	 */
+	if (!sc->sc_dying) {
+		if (ring->queued == URTWN_HOST_CMD_RING_COUNT)
+			device_printf(sc->sc_dev, "command queue overflow\n");
+		else if (ring->queued++ == 0)
+			schedtask = true;
+	}
+	mutex_spin_exit(>sc_task_mtx);
 	splx(s);
+
+	if (schedtask)
+		usb_add_task(sc->sc_udev, >sc_task, USB_TASKQ_DRIVER);
 }
 
 static void



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

2024-03-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 10 18:59:19 UTC 2024

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1810):

sys/dev/usb/if_urtwn.c: revision 1.109 (patch)

urtwn(4): Ditch old queued commands on overflow.
Don't increment ring->queued past what the task will decrement.

This is a stop-gap measure; really, we should just have one task for
each operation that is deferred to the task thread.

PR kern/57965


To generate a diff of this commit:
cvs rdiff -u -r1.71.2.6 -r1.71.2.7 src/sys/dev/usb/if_urtwn.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

2023-08-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug  4 19:51:03 UTC 2023

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

Log Message:
Pull up following revision(s) (requested by manu in ticket #1709):

sys/dev/usb/umodeswitch.c: revision 1.6

Add support for D-Link DWM-222 4G LTS USB adapter

Oddly, the fake umass device does not detach after umodeswitch does
its duty, but functionality is there, thanks to five u3g devices that
attach. u3g devices 0, 3 and 4 does not seem to accept AT commands.
u3g devices 1 and 2 are fine to be used as modems.


To generate a diff of this commit:
cvs rdiff -u -r1.4.6.1 -r1.4.6.2 src/sys/dev/usb/umodeswitch.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/umodeswitch.c
diff -u src/sys/dev/usb/umodeswitch.c:1.4.6.1 src/sys/dev/usb/umodeswitch.c:1.4.6.2
--- src/sys/dev/usb/umodeswitch.c:1.4.6.1	Thu Feb 27 17:22:56 2020
+++ src/sys/dev/usb/umodeswitch.c	Fri Aug  4 19:51:03 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: umodeswitch.c,v 1.4.6.1 2020/02/27 17:22:56 martin Exp $	*/
+/*	$NetBSD: umodeswitch.c,v 1.4.6.2 2023/08/04 19:51:03 martin Exp $	*/
 
 /*-
  * Copyright (c) 2009, 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umodeswitch.c,v 1.4.6.1 2020/02/27 17:22:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umodeswitch.c,v 1.4.6.2 2023/08/04 19:51:03 martin Exp $");
 
 #include 
 #include 
@@ -440,6 +440,7 @@ umodeswitch_match(device_t parent, cfdat
 		switch (uaa->uaa_product) {
 		case USB_PRODUCT_DLINK_DWM157E_CD:
 		case USB_PRODUCT_DLINK_DWM157_CD:
+		case USB_PRODUCT_DLINK_DWM222_CD:
 			(void)u3g_bulk_ata_eject(uaa->uaa_device);
 			(void)u3g_bulk_scsi_eject(uaa->uaa_device);
 			return UMATCH_HIGHEST;



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

2023-08-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug  4 19:51:03 UTC 2023

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

Log Message:
Pull up following revision(s) (requested by manu in ticket #1709):

sys/dev/usb/umodeswitch.c: revision 1.6

Add support for D-Link DWM-222 4G LTS USB adapter

Oddly, the fake umass device does not detach after umodeswitch does
its duty, but functionality is there, thanks to five u3g devices that
attach. u3g devices 0, 3 and 4 does not seem to accept AT commands.
u3g devices 1 and 2 are fine to be used as modems.


To generate a diff of this commit:
cvs rdiff -u -r1.4.6.1 -r1.4.6.2 src/sys/dev/usb/umodeswitch.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

2023-08-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  2 10:22:13 UTC 2023

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

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

sys/dev/usb/ehci.c: revision 1.317

PR 57518: usb keyboard causes host controller to miss microframe

As per the USB 2.0 specification section 11.18.4; paragraph 3.b
For interrupt IN/OUT full-/low-speed transactions, the host must  schedule a
complete-split transaction in each of the two microframes following the
first microframe in which the full-/low-speed transaction is budgeted. An
additional complete-split must also be scheduled in the third following
microframe unless the full-/low-speed transaction was budgeted to start
in microframe Y6.


To generate a diff of this commit:
cvs rdiff -u -r1.267.2.6 -r1.267.2.7 src/sys/dev/usb/ehci.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.267.2.6 src/sys/dev/usb/ehci.c:1.267.2.7
--- src/sys/dev/usb/ehci.c:1.267.2.6	Mon Dec  6 19:28:57 2021
+++ src/sys/dev/usb/ehci.c	Wed Aug  2 10:22:13 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.267.2.6 2021/12/06 19:28:57 martin Exp $ */
+/*	$NetBSD: ehci.c,v 1.267.2.7 2023/08/02 10:22:13 martin Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.267.2.6 2021/12/06 19:28:57 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.267.2.7 2023/08/02 10:22:13 martin Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -1974,14 +1974,17 @@ ehci_open(struct usbd_pipe *pipe)
 		);
 		sqh->qh.qh_endphub = htole32(
 		EHCI_QH_SET_MULT(1) |
-		EHCI_QH_SET_SMASK(xfertype == UE_INTERRUPT ? 0x02 : 0)
+		(xfertype == UE_INTERRUPT ?
+			EHCI_QH_SET_SMASK(__BIT(1))	   /* Start Split Y1 */
+			: 0)
 		);
 		if (speed != EHCI_QH_SPEED_HIGH)
 			sqh->qh.qh_endphub |= htole32(
 			EHCI_QH_SET_PORT(hshubport) |
 			EHCI_QH_SET_HUBA(hshubaddr) |
 			(xfertype == UE_INTERRUPT ?
- EHCI_QH_SET_CMASK(0x08) : 0)
+ EHCI_QH_SET_CMASK(__BITS(3,5)) /* CS Y[345] */
+ : 0)
 			);
 		sqh->qh.qh_curqtd = EHCI_NULL;
 		/* Fill the overlay qTD */



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

2023-08-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  2 10:22:13 UTC 2023

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

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

sys/dev/usb/ehci.c: revision 1.317

PR 57518: usb keyboard causes host controller to miss microframe

As per the USB 2.0 specification section 11.18.4; paragraph 3.b
For interrupt IN/OUT full-/low-speed transactions, the host must  schedule a
complete-split transaction in each of the two microframes following the
first microframe in which the full-/low-speed transaction is budgeted. An
additional complete-split must also be scheduled in the third following
microframe unless the full-/low-speed transaction was budgeted to start
in microframe Y6.


To generate a diff of this commit:
cvs rdiff -u -r1.267.2.6 -r1.267.2.7 src/sys/dev/usb/ehci.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

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 13:46:18 UTC 2023

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1687):

sys/dev/usb/xhci.c: revision 1.176
sys/dev/usb/xhcivar.h: revision 1.23

xhci(4): Defer root intr xfers while polling.

Root intr xfers require taking adaptive locks, which is forbidden
while polling.

This is not great -- any USB transfer completion callbacks might try
to take adaptive locks, not just uhub_intr, and that will always
causes trouble.  We get lucky with ukbd_intr because it's not
MP-safe, so it relies only on the kernel lock (a spin lock) anyway.
But this change brings xhci in line with ehci.

PR kern/57326


To generate a diff of this commit:
cvs rdiff -u -r1.107.2.11 -r1.107.2.12 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.11.4.3 -r1.11.4.4 src/sys/dev/usb/xhcivar.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/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.107.2.11 src/sys/dev/usb/xhci.c:1.107.2.12
--- src/sys/dev/usb/xhci.c:1.107.2.11	Mon Jan 23 12:05:36 2023
+++ src/sys/dev/usb/xhci.c	Tue Aug  1 13:46:18 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.107.2.11 2023/01/23 12:05:36 martin Exp $	*/
+/*	$NetBSD: xhci.c,v 1.107.2.12 2023/08/01 13:46:18 martin Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.107.2.11 2023/01/23 12:05:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.107.2.12 2023/08/01 13:46:18 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -2295,11 +2295,15 @@ xhci_rhpsc(struct xhci_softc * const sc,
 	KASSERT(xfer->ux_status == USBD_IN_PROGRESS);
 
 	uint8_t *p = xfer->ux_buf;
-	memset(p, 0, xfer->ux_length);
+	if (!xhci_polling_p(sc) || !sc->sc_intrxfer_deferred[bn])
+		memset(p, 0, xfer->ux_length);
 	p[rhp / NBBY] |= 1 << (rhp % NBBY);
 	xfer->ux_actlen = xfer->ux_length;
 	xfer->ux_status = USBD_NORMAL_COMPLETION;
-	usb_transfer_complete(xfer);
+	if (xhci_polling_p(sc))
+		sc->sc_intrxfer_deferred[bn] = true;
+	else
+		usb_transfer_complete(xfer);
 }
 
 /* Process Transfer Events */
@@ -2576,7 +2580,7 @@ xhci_softintr(void *v)
 	struct xhci_softc * const sc = XHCI_BUS2SC(bus);
 	struct xhci_ring * const er = >sc_er;
 	struct xhci_trb *trb;
-	int i, j, k;
+	int i, j, k, bn;
 
 	XHCIHIST_FUNC();
 
@@ -2587,6 +2591,20 @@ xhci_softintr(void *v)
 
 	XHCIHIST_CALLARGS("er: xr_ep %jd xr_cs %jd", i, j, 0, 0);
 
+	/*
+	 * Handle deferred root intr xfer, in case we just switched off
+	 * polling.  It's not safe to complete root intr xfers while
+	 * polling -- too much kernel machinery gets involved.
+	 */
+	if (!xhci_polling_p(sc)) {
+		for (bn = 0; bn < 2; bn++) {
+			if (__predict_false(sc->sc_intrxfer_deferred[bn])) {
+sc->sc_intrxfer_deferred[bn] = false;
+usb_transfer_complete(sc->sc_intrxfer[bn]);
+			}
+		}
+	}
+
 	while (1) {
 		usb_syncmem(>xr_dma, XHCI_TRB_SIZE * i, XHCI_TRB_SIZE,
 		BUS_DMASYNC_POSTREAD);

Index: src/sys/dev/usb/xhcivar.h
diff -u src/sys/dev/usb/xhcivar.h:1.11.4.3 src/sys/dev/usb/xhcivar.h:1.11.4.4
--- src/sys/dev/usb/xhcivar.h:1.11.4.3	Mon Jan 23 12:05:36 2023
+++ src/sys/dev/usb/xhcivar.h	Tue Aug  1 13:46:18 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhcivar.h,v 1.11.4.3 2023/01/23 12:05:36 martin Exp $	*/
+/*	$NetBSD: xhcivar.h,v 1.11.4.4 2023/08/01 13:46:18 martin Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -112,7 +112,7 @@ struct xhci_softc {
 	int *sc_rhportmap[2];
 	int sc_rhportcount[2];
 	struct usbd_xfer *sc_intrxfer[2];
-
+	bool sc_intrxfer_deferred[2];
 
 	struct xhci_slot * sc_slots;
 



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

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 13:46:18 UTC 2023

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1687):

sys/dev/usb/xhci.c: revision 1.176
sys/dev/usb/xhcivar.h: revision 1.23

xhci(4): Defer root intr xfers while polling.

Root intr xfers require taking adaptive locks, which is forbidden
while polling.

This is not great -- any USB transfer completion callbacks might try
to take adaptive locks, not just uhub_intr, and that will always
causes trouble.  We get lucky with ukbd_intr because it's not
MP-safe, so it relies only on the kernel lock (a spin lock) anyway.
But this change brings xhci in line with ehci.

PR kern/57326


To generate a diff of this commit:
cvs rdiff -u -r1.107.2.11 -r1.107.2.12 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.11.4.3 -r1.11.4.4 src/sys/dev/usb/xhcivar.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

2023-02-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 17 17:40:28 UTC 2023

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

Log Message:
Pull up following revision(s) (requested by nia in ticket #1599):

sys/dev/usb/usbdevs: revision 1.807

Add OnePlus 5T


To generate a diff of this commit:
cvs rdiff -u -r1.770.4.12 -r1.770.4.13 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.4.12 src/sys/dev/usb/usbdevs:1.770.4.13
--- src/sys/dev/usb/usbdevs:1.770.4.12	Tue Jan 18 19:58:54 2022
+++ src/sys/dev/usb/usbdevs	Fri Feb 17 17:40:28 2023
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.770.4.12 2022/01/18 19:58:54 snj Exp $
+$NetBSD: usbdevs,v 1.770.4.13 2023/02/17 17:40:28 martin Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -580,6 +580,7 @@ vendor WMR		0x2405	West Mountain Radio
 vendor TRIPPLITE	0x2478	Tripp-Lite
 vendor HAILUCK		0x258a	HAILUCK Co., Ltd
 vendor HIROSE		0x2631	Hirose Electric
+vendor ONEPLUS		0x2717	ONEPLUS
 vendor NHJ		0x2770	NHJ
 vendor PLANEX		0x2c02	Planex Communications
 vendor VIDZMEDIA	0x3275	VidzMedia Pte Ltd
@@ -2556,6 +2557,9 @@ product OMNIVISION OV511	0x0511	OV511 Ca
 product OMNIVISION OV511PLUS	0xa511	OV511+ Camera
 product OMNIVISION2 PSEYE	0x2000	Sony PLAYSTATION(R) Eye
 
+/* OnePlus products */
+product ONEPLUS A5010		0xff80	OnePlus 5T
+
 /* OnSpec Electronic, Inc. */
 product ONSPEC MD2		0x0103	disk
 product ONSPEC MDCFEB		0xa000	MDCFE-B USB CF Reader



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

2023-02-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 17 17:41:12 UTC 2023

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

Log Message:
Regen for ticket #1599


To generate a diff of this commit:
cvs rdiff -u -r1.760.4.12 -r1.760.4.13 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

2023-02-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 17 17:40:28 UTC 2023

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

Log Message:
Pull up following revision(s) (requested by nia in ticket #1599):

sys/dev/usb/usbdevs: revision 1.807

Add OnePlus 5T


To generate a diff of this commit:
cvs rdiff -u -r1.770.4.12 -r1.770.4.13 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

2023-02-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb 14 16:10:00 UTC 2023

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

Log Message:
Pull up following revision(s) (requested by manu in ticket #1594):

sys/dev/usb/u3g.c: revision 1.44

Add support for ZTE MF112 and D-Link DWM222 3G USB modems


To generate a diff of this commit:
cvs rdiff -u -r1.37.2.2 -r1.37.2.3 src/sys/dev/usb/u3g.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/u3g.c
diff -u src/sys/dev/usb/u3g.c:1.37.2.2 src/sys/dev/usb/u3g.c:1.37.2.3
--- src/sys/dev/usb/u3g.c:1.37.2.2	Sun Jun  7 17:03:11 2020
+++ src/sys/dev/usb/u3g.c	Tue Feb 14 16:10:00 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: u3g.c,v 1.37.2.2 2020/06/07 17:03:11 martin Exp $	*/
+/*	$NetBSD: u3g.c,v 1.37.2.3 2023/02/14 16:10:00 martin Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: u3g.c,v 1.37.2.2 2020/06/07 17:03:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: u3g.c,v 1.37.2.3 2023/02/14 16:10:00 martin Exp $");
 
 #include 
 #include 
@@ -252,6 +252,7 @@ static const struct usb_devno u3g_devs[]
 	{ USB_VENDOR_ZTE, USB_PRODUCT_ZTE_MF626 },
 	{ USB_VENDOR_ZTE, USB_PRODUCT_ZTE_MF628 },
 	{ USB_VENDOR_ZTE, USB_PRODUCT_ZTE_MF820D },
+	{ USB_VENDOR_ZTE, USB_PRODUCT_ZTE_MF112 },
 
 	/* 4G Systems */
 	{ USB_VENDOR_LONGCHEER, USB_PRODUCT_LONGCHEER_XSSTICK_P14 },
@@ -260,6 +261,7 @@ static const struct usb_devno u3g_devs[]
 	/* DLink */
 	{ USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWM157 },
 	{ USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWM157E },
+	{ USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWM222 },
 };
 
 /*



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

2023-02-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb 14 16:10:00 UTC 2023

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

Log Message:
Pull up following revision(s) (requested by manu in ticket #1594):

sys/dev/usb/u3g.c: revision 1.44

Add support for ZTE MF112 and D-Link DWM222 3G USB modems


To generate a diff of this commit:
cvs rdiff -u -r1.37.2.2 -r1.37.2.3 src/sys/dev/usb/u3g.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

2022-11-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov  5 11:19:50 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #1550):

sys/dev/usb/uhidev.c: revision 1.94

Back out r1.82 ("Do not explicitly set the HID Report Protocol upon attach")
due to the regression reported in PR 57031


To generate a diff of this commit:
cvs rdiff -u -r1.75.2.2 -r1.75.2.3 src/sys/dev/usb/uhidev.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/uhidev.c
diff -u src/sys/dev/usb/uhidev.c:1.75.2.2 src/sys/dev/usb/uhidev.c:1.75.2.3
--- src/sys/dev/usb/uhidev.c:1.75.2.2	Wed Feb 16 14:36:12 2022
+++ src/sys/dev/usb/uhidev.c	Sat Nov  5 11:19:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhidev.c,v 1.75.2.2 2022/02/16 14:36:12 martin Exp $	*/
+/*	$NetBSD: uhidev.c,v 1.75.2.3 2022/11/05 11:19:49 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2012 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.75.2.2 2022/02/16 14:36:12 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.75.2.3 2022/11/05 11:19:49 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -169,16 +169,8 @@ uhidev_attach(device_t parent, device_t 
 	}
 	(void)usbd_set_idle(iface, 0, 0);
 
-#if 0
-	/*
-	 * HID 1.11 says we should do this, but the device firmware is
-	 * supposed to come up in Report Protocol after reset anyway, and
-	 * apparently explicitly requesting it confuses some devices.
-	 */
-	if ((usbd_get_quirks(sc->sc_udev)->uq_flags & UQ_NO_SET_PROTO) == 0 &&
-	id->bInterfaceSubClass == UISUBCLASS_BOOT)
+	if ((usbd_get_quirks(sc->sc_udev)->uq_flags & UQ_NO_SET_PROTO) == 0)
 		(void)usbd_set_protocol(iface, 1);
-#endif
 
 	maxinpktsize = 0;
 	sc->sc_iep_addr = sc->sc_oep_addr = -1;



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

2022-11-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov  5 11:19:50 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #1550):

sys/dev/usb/uhidev.c: revision 1.94

Back out r1.82 ("Do not explicitly set the HID Report Protocol upon attach")
due to the regression reported in PR 57031


To generate a diff of this commit:
cvs rdiff -u -r1.75.2.2 -r1.75.2.3 src/sys/dev/usb/uhidev.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

2022-09-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 18 13:34:07 UTC 2022

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

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

sys/dev/usb/usb.h: revision 1.121

Cast to uint32_t to avoid undefined behavior in UGETDW(). Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.116.6.1 -r1.116.6.2 src/sys/dev/usb/usb.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/usb.h
diff -u src/sys/dev/usb/usb.h:1.116.6.1 src/sys/dev/usb/usb.h:1.116.6.2
--- src/sys/dev/usb/usb.h:1.116.6.1	Sun Sep  1 13:00:37 2019
+++ src/sys/dev/usb/usb.h	Sun Sep 18 13:34:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb.h,v 1.116.6.1 2019/09/01 13:00:37 martin Exp $	*/
+/*	$NetBSD: usb.h,v 1.116.6.2 2022/09/18 13:34:06 martin Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -78,7 +78,8 @@ typedef uint8_t uDWord[4];
 #define UGETW(w) ((w)[0] | ((w)[1] << 8))
 #define USETW(w,v) ((w)[0] = (uint8_t)(v), (w)[1] = (uint8_t)((v) >> 8))
 #define USETWD(val) { (uint8_t)(val), (uint8_t)((val) >> 8) }
-#define UGETDW(w) ((w)[0] | ((w)[1] << 8) | ((w)[2] << 16) | ((w)[3] << 24))
+#define UGETDW(w) ((w)[0] | ((w)[1] << 8) | ((w)[2] << 16) |	\
+	((uint32_t)(w)[3] << 24))
 #define USETDW(w,v) ((w)[0] = (uint8_t)(v), \
 		 (w)[1] = (uint8_t)((v) >> 8), \
 		 (w)[2] = (uint8_t)((v) >> 16), \



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

2022-09-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 18 13:34:07 UTC 2022

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

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

sys/dev/usb/usb.h: revision 1.121

Cast to uint32_t to avoid undefined behavior in UGETDW(). Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.116.6.1 -r1.116.6.2 src/sys/dev/usb/usb.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

2022-09-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 18 13:32:27 UTC 2022

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

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

sys/dev/usb/if_ure.c: revision 1.58 (via patch)

Use unsigned to avoid undefined behavior in ure_uno_mcast(). Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.14.2.2 -r1.14.2.3 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.2 src/sys/dev/usb/if_ure.c:1.14.2.3
--- src/sys/dev/usb/if_ure.c:1.14.2.2	Thu Oct 17 18:53:25 2019
+++ src/sys/dev/usb/if_ure.c	Sun Sep 18 13:32:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ure.c,v 1.14.2.2 2019/10/17 18:53:25 martin Exp $	*/
+/*	$NetBSD: if_ure.c,v 1.14.2.3 2022/09/18 13:32:27 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.2 2019/10/17 18:53:25 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.14.2.3 2022/09/18 13:32:27 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -381,7 +381,7 @@ allmulti:	
 			hash = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN)
 			>> 26;
 			if (hash < 32)
-hashes[0] |= (1 << hash);
+hashes[0] |= (1U << hash);
 			else
 hashes[1] |= (1 << (hash - 32));
 



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

2022-09-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 18 13:32:27 UTC 2022

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

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

sys/dev/usb/if_ure.c: revision 1.58 (via patch)

Use unsigned to avoid undefined behavior in ure_uno_mcast(). Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.14.2.2 -r1.14.2.3 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

2022-09-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 16 18:32:49 UTC 2022

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

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

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

Accept USB 3.2 in xhci_id_protocols().


To generate a diff of this commit:
cvs rdiff -u -r1.107.2.9 -r1.107.2.10 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.9 src/sys/dev/usb/xhci.c:1.107.2.10
--- src/sys/dev/usb/xhci.c:1.107.2.9	Tue Jun 22 05:10:50 2021
+++ src/sys/dev/usb/xhci.c	Fri Sep 16 18:32:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.107.2.9 2021/06/22 05:10:50 martin Exp $	*/
+/*	$NetBSD: xhci.c,v 1.107.2.10 2022/09/16 18:32:49 martin Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.107.2.9 2021/06/22 05:10:50 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.107.2.10 2022/09/16 18:32:49 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1175,6 +1175,7 @@ xhci_id_protocols(struct xhci_softc *sc,
 	case 0x0300:
 	case 0x0301:
 	case 0x0310:
+	case 0x0320:
 		aprint_debug_dev(sc->sc_dev, " %s ports %d - %d\n",
 		major == 3 ? "ss" : "hs", cpo, cpo + cpc -1);
 		break;



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

2022-09-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 16 18:32:49 UTC 2022

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

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

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

Accept USB 3.2 in xhci_id_protocols().


To generate a diff of this commit:
cvs rdiff -u -r1.107.2.9 -r1.107.2.10 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

2022-08-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  3 16:21:55 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1493):

sys/dev/usb/ucom.c: revision 1.129

ucom(4): Fix earlier mistake causing pipes not to be closed.

In revision 1.123, mrg@ changed what he thought was a double-close,
but was actually abort (as is appropriate) to just abort (which
is not enough -- leaks the pipe).  This restores the abort

The original `bug' was found by code inspection, whereas this bug was
found by asserting in usb_subr.c that no pipes are open on device
disconnection after detach; the asserts actually triggered with
several ucom(4) devices, and no longer trigger with this change.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.125.2.1 -r1.125.2.2 src/sys/dev/usb/ucom.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

2022-08-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  3 16:21:55 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1493):

sys/dev/usb/ucom.c: revision 1.129

ucom(4): Fix earlier mistake causing pipes not to be closed.

In revision 1.123, mrg@ changed what he thought was a double-close,
but was actually abort (as is appropriate) to just abort (which
is not enough -- leaks the pipe).  This restores the abort

The original `bug' was found by code inspection, whereas this bug was
found by asserting in usb_subr.c that no pipes are open on device
disconnection after detach; the asserts actually triggered with
several ucom(4) devices, and no longer trigger with this change.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.125.2.1 -r1.125.2.2 src/sys/dev/usb/ucom.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/ucom.c
diff -u src/sys/dev/usb/ucom.c:1.125.2.1 src/sys/dev/usb/ucom.c:1.125.2.2
--- src/sys/dev/usb/ucom.c:1.125.2.1	Sat Dec 12 12:56:40 2020
+++ src/sys/dev/usb/ucom.c	Wed Aug  3 16:21:55 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucom.c,v 1.125.2.1 2020/12/12 12:56:40 martin Exp $	*/
+/*	$NetBSD: ucom.c,v 1.125.2.2 2022/08/03 16:21:55 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.125.2.1 2020/12/12 12:56:40 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.125.2.2 2022/08/03 16:21:55 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -414,11 +414,9 @@ ucom_detach(device_t self, int flags)
 
 	if (sc->sc_bulkin_pipe != NULL) {
 		usbd_abort_pipe(sc->sc_bulkin_pipe);
-		sc->sc_bulkin_pipe = NULL;
 	}
 	if (sc->sc_bulkout_pipe != NULL) {
 		usbd_abort_pipe(sc->sc_bulkout_pipe);
-		sc->sc_bulkout_pipe = NULL;
 	}
 
 	mutex_enter(>sc_lock);



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

2022-08-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  3 15:50:03 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1492):

sys/dev/usb/ukbd.c: revision 1.154

ukbd(4): Wait for callouts and blinking to complete in detach.

This detach routine (and whole driver) has got a lotta other
problems, but let's fix 'em one at a time...


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.142.2.1 src/sys/dev/usb/ukbd.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

2022-08-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  3 15:50:03 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1492):

sys/dev/usb/ukbd.c: revision 1.154

ukbd(4): Wait for callouts and blinking to complete in detach.

This detach routine (and whole driver) has got a lotta other
problems, but let's fix 'em one at a time...


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.142.2.1 src/sys/dev/usb/ukbd.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/ukbd.c
diff -u src/sys/dev/usb/ukbd.c:1.142 src/sys/dev/usb/ukbd.c:1.142.2.1
--- src/sys/dev/usb/ukbd.c:1.142	Sun May  5 03:17:54 2019
+++ src/sys/dev/usb/ukbd.c	Wed Aug  3 15:50:03 2022
@@ -1,4 +1,4 @@
-/*  $NetBSD: ukbd.c,v 1.142 2019/05/05 03:17:54 mrg Exp $*/
+/*  $NetBSD: ukbd.c,v 1.142.2.1 2022/08/03 15:50:03 martin Exp $*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.142 2019/05/05 03:17:54 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.142.2.1 2022/08/03 15:50:03 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -578,6 +578,10 @@ ukbd_detach(device_t self, int flags)
 	if (sc->sc_wskbddev != NULL)
 		rv = config_detach(sc->sc_wskbddev, flags);
 
+	callout_halt(>sc_delay, NULL);
+	usb_rem_task_wait(sc->sc_hdev.sc_parent->sc_udev, >sc_ledtask,
+	USB_TASKQ_DRIVER, NULL);
+
 	/* The console keyboard does not get a disable call, so check pipe. */
 	if (sc->sc_hdev.sc_state & UHIDEV_OPEN)
 		uhidev_close(>sc_hdev);



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

2022-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Aug  1 09:36:06 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by rin in ticket #1483):

sys/dev/usb/uslsa.c: revision 1.32

PR kern/56946
Baud rate must be in little endian for SLSA_R_SET_BAUDRATE request.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.28.2.1 src/sys/dev/usb/uslsa.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

2022-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Aug  1 09:36:06 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by rin in ticket #1483):

sys/dev/usb/uslsa.c: revision 1.32

PR kern/56946
Baud rate must be in little endian for SLSA_R_SET_BAUDRATE request.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.28.2.1 src/sys/dev/usb/uslsa.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/uslsa.c
diff -u src/sys/dev/usb/uslsa.c:1.28 src/sys/dev/usb/uslsa.c:1.28.2.1
--- src/sys/dev/usb/uslsa.c:1.28	Thu May  9 02:43:35 2019
+++ src/sys/dev/usb/uslsa.c	Mon Aug  1 09:36:06 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: uslsa.c,v 1.28 2019/05/09 02:43:35 mrg Exp $ */
+/* $NetBSD: uslsa.c,v 1.28.2.1 2022/08/01 09:36:06 martin Exp $ */
 
 /* from ugensa.c */
 
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uslsa.c,v 1.28 2019/05/09 02:43:35 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uslsa.c,v 1.28.2.1 2022/08/01 09:36:06 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -388,7 +388,7 @@ uslsa_param(void *vsc, int portno, struc
 	USETW(req.wIndex, sc->sc_ifnum);
 	USETW(req.wLength, 4);
 
-	baud = t->c_ospeed;
+	baud = htole32(t->c_ospeed);
 	status = usbd_do_request(sc->sc_udev, , );
 	if (status != USBD_NORMAL_COMPLETION) {
 		/* fallback method for devices that don't know SET_BAUDRATE */



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

2022-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb 16 14:36:12 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #1428):

sys/dev/usb/uhidev.c: revision 1.82

Do not explicitly set the HID Report Protocol upon attach, some devices
don't like it and should be in Report Protocol after enumeration/reset
anyway.

May address PR kern/55019.


To generate a diff of this commit:
cvs rdiff -u -r1.75.2.1 -r1.75.2.2 src/sys/dev/usb/uhidev.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/uhidev.c
diff -u src/sys/dev/usb/uhidev.c:1.75.2.1 src/sys/dev/usb/uhidev.c:1.75.2.2
--- src/sys/dev/usb/uhidev.c:1.75.2.1	Thu Feb  4 19:16:01 2021
+++ src/sys/dev/usb/uhidev.c	Wed Feb 16 14:36:12 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhidev.c,v 1.75.2.1 2021/02/04 19:16:01 martin Exp $	*/
+/*	$NetBSD: uhidev.c,v 1.75.2.2 2022/02/16 14:36:12 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2012 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.75.2.1 2021/02/04 19:16:01 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.75.2.2 2022/02/16 14:36:12 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -169,8 +169,16 @@ uhidev_attach(device_t parent, device_t 
 	}
 	(void)usbd_set_idle(iface, 0, 0);
 
-	if ((usbd_get_quirks(sc->sc_udev)->uq_flags & UQ_NO_SET_PROTO) == 0)
+#if 0
+	/*
+	 * HID 1.11 says we should do this, but the device firmware is
+	 * supposed to come up in Report Protocol after reset anyway, and
+	 * apparently explicitly requesting it confuses some devices.
+	 */
+	if ((usbd_get_quirks(sc->sc_udev)->uq_flags & UQ_NO_SET_PROTO) == 0 &&
+	id->bInterfaceSubClass == UISUBCLASS_BOOT)
 		(void)usbd_set_protocol(iface, 1);
+#endif
 
 	maxinpktsize = 0;
 	sc->sc_iep_addr = sc->sc_oep_addr = -1;



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

2022-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb 16 14:36:12 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #1428):

sys/dev/usb/uhidev.c: revision 1.82

Do not explicitly set the HID Report Protocol upon attach, some devices
don't like it and should be in Report Protocol after enumeration/reset
anyway.

May address PR kern/55019.


To generate a diff of this commit:
cvs rdiff -u -r1.75.2.1 -r1.75.2.2 src/sys/dev/usb/uhidev.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

2022-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 31 17:30:22 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1415):

sys/dev/usb/usbnet.c: revision 1.44 (via patch)

usbnet: Defer hardware multicast filter updates to USB task.

Breaks deadlock:
- usbnet_detach holds usbnet lock, awaits kpause in ure_reset
- callout holds softclock `lock' (sequential softints, blocks kpause
  wakeup), awaits softnet_lock in tcp_timer_keep, frag6_fasttimo, 
- soclose holds softnet_lock, awaits usbnet lock in SIOCDELMULTI

This change breaks the deadlock by not passing the SIOCADDMULTI or
SIOCDELMULTI ioctl synchronously to the driver, which typically takes
the usbnet lock.

With this change, the ethernet layer still maintains the list of
multicast addresses synchronously, but we defer the driver logic that
updates the hardware multicast filter to an asynchronous USB task
without softnet_lock held.

This doesn't cause exactly the same ioctl to be sent to the driver --
usbnet just sends SIOCDELMULTI with an all-zero struct ifreq, and
might drop some ioctls if issued in quick succession.  This is OK
because none of the drivers actually distinguish between SIOCADDMULTI
and SIOCDELMULTI, or examine the argument; the drivers just commit
whatever multicast addresses are listed in the ethercom.

Other than the different ioctl submitted, there is no change to the
ABI or locking scheme of usbnet, so this is safe to pull up to
netbsd-9.  This means we unfortunately can't guarantee that if a
process issues SIOCADDMULTI and then sendto, the multicast filter
update will be done by the time of the sendto -- and, more
importantly, the packets received in reply to it.  But failing to
guarantee that is better than deadlocking!  Later changes on HEAD
will restore the synchronous multicast filter updates with much more
extensive ABI changes and API simplifications in usbnet(9).
Proposed on tech-net:

https://mail-index.netbsd.org/tech-net/2021/12/30/msg008164.html

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.25.2.5 -r1.25.2.6 src/sys/dev/usb/usbnet.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/usbnet.c
diff -u src/sys/dev/usb/usbnet.c:1.25.2.5 src/sys/dev/usb/usbnet.c:1.25.2.6
--- src/sys/dev/usb/usbnet.c:1.25.2.5	Fri Aug 28 19:36:34 2020
+++ src/sys/dev/usb/usbnet.c	Mon Jan 31 17:30:21 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbnet.c,v 1.25.2.5 2020/08/28 19:36:34 martin Exp $	*/
+/*	$NetBSD: usbnet.c,v 1.25.2.6 2022/01/31 17:30:21 martin Exp $	*/
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.25.2.5 2020/08/28 19:36:34 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.25.2.6 2022/01/31 17:30:21 martin Exp $");
 
 #include 
 #include 
@@ -75,6 +75,7 @@ struct usbnet_private {
 
 	struct ethercom		unp_ec;
 	struct mii_data		unp_mii;
+	struct usb_task		unp_mcasttask;
 	struct usb_task		unp_ticktask;
 	struct callout		unp_stat_ch;
 	struct usbd_pipe	*unp_ep[USBNET_ENDPT_MAX];
@@ -1048,12 +1049,64 @@ usbnet_ioctl(struct ifnet *ifp, u_long c
 		return uno_override_ioctl(un, ifp, cmd, data);
 
 	error = ether_ioctl(ifp, cmd, data);
-	if (error == ENETRESET)
-		error = uno_ioctl(un, ifp, cmd, data);
+	if (error == ENETRESET) {
+		switch (cmd) {
+		case SIOCADDMULTI:
+		case SIOCDELMULTI:
+			usb_add_task(un->un_udev, >unp_mcasttask,
+			USB_TASKQ_DRIVER);
+			error = 0;
+			break;
+		default:
+			error = uno_ioctl(un, ifp, cmd, data);
+		}
+	}
 
 	return error;
 }
 
+static void
+usbnet_mcast_task(void *arg)
+{
+	USBNETHIST_FUNC();
+	struct usbnet * const un = arg;
+	struct usbnet_private * const unp = un->un_pri;
+	struct ifnet * const ifp = usbnet_ifp(un);
+	bool dying;
+	struct ifreq ifr;
+
+	USBNETHIST_CALLARGSN(10, "%d: enter", unp->unp_number, 0, 0, 0);
+
+	/*
+	 * If we're detaching, we must check unp_dying _before_
+	 * touching IFNET_LOCK -- the ifnet may have been detached by
+	 * the time this task runs.  This is racy -- unp_dying may be
+	 * set immediately after we test it -- but nevertheless safe,
+	 * because usbnet_detach waits for the task to complete before
+	 * issuing if_detach, and necessary, so that we don't touch
+	 * IFNET_LOCK after if_detach.  See usbnet_detach for details.
+	 */
+	mutex_enter(>unp_lock);
+	dying = unp->unp_dying;
+	mutex_exit(>unp_lock);
+	if (dying)
+		return;
+
+	/*
+	 * Pass a bogus ifr with SIOCDELMULTI -- the goal is to just
+	 * notify the driver to reprogram any hardware multicast
+	 * filter, according to what's already stored in the ethercom.
+	 * None of the drivers actually examine this argument, so it
+	 * doesn't change the ABI as far as they can tell.
+	 */
+	IFNET_LOCK(ifp);
+	if (ifp->if_flags & IFF_RUNNING) {
+		memset(, 0, sizeof(ifr));
+		

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

2022-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 31 17:30:22 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1415):

sys/dev/usb/usbnet.c: revision 1.44 (via patch)

usbnet: Defer hardware multicast filter updates to USB task.

Breaks deadlock:
- usbnet_detach holds usbnet lock, awaits kpause in ure_reset
- callout holds softclock `lock' (sequential softints, blocks kpause
  wakeup), awaits softnet_lock in tcp_timer_keep, frag6_fasttimo, 
- soclose holds softnet_lock, awaits usbnet lock in SIOCDELMULTI

This change breaks the deadlock by not passing the SIOCADDMULTI or
SIOCDELMULTI ioctl synchronously to the driver, which typically takes
the usbnet lock.

With this change, the ethernet layer still maintains the list of
multicast addresses synchronously, but we defer the driver logic that
updates the hardware multicast filter to an asynchronous USB task
without softnet_lock held.

This doesn't cause exactly the same ioctl to be sent to the driver --
usbnet just sends SIOCDELMULTI with an all-zero struct ifreq, and
might drop some ioctls if issued in quick succession.  This is OK
because none of the drivers actually distinguish between SIOCADDMULTI
and SIOCDELMULTI, or examine the argument; the drivers just commit
whatever multicast addresses are listed in the ethercom.

Other than the different ioctl submitted, there is no change to the
ABI or locking scheme of usbnet, so this is safe to pull up to
netbsd-9.  This means we unfortunately can't guarantee that if a
process issues SIOCADDMULTI and then sendto, the multicast filter
update will be done by the time of the sendto -- and, more
importantly, the packets received in reply to it.  But failing to
guarantee that is better than deadlocking!  Later changes on HEAD
will restore the synchronous multicast filter updates with much more
extensive ABI changes and API simplifications in usbnet(9).
Proposed on tech-net:

https://mail-index.netbsd.org/tech-net/2021/12/30/msg008164.html

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.25.2.5 -r1.25.2.6 src/sys/dev/usb/usbnet.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

2022-01-18 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Jan 18 20:02:23 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by martin in ticket #1405):

sys/dev/usb/usb_quirks.c: revision 1.102

Ignore new APC UPS devices when matching uhid devices.


To generate a diff of this commit:
cvs rdiff -u -r1.92.2.2 -r1.92.2.3 src/sys/dev/usb/usb_quirks.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

2022-01-18 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Jan 18 20:02:23 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by martin in ticket #1405):

sys/dev/usb/usb_quirks.c: revision 1.102

Ignore new APC UPS devices when matching uhid devices.


To generate a diff of this commit:
cvs rdiff -u -r1.92.2.2 -r1.92.2.3 src/sys/dev/usb/usb_quirks.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/usb_quirks.c
diff -u src/sys/dev/usb/usb_quirks.c:1.92.2.2 src/sys/dev/usb/usb_quirks.c:1.92.2.3
--- src/sys/dev/usb/usb_quirks.c:1.92.2.2	Tue Jan 18 18:48:00 2022
+++ src/sys/dev/usb/usb_quirks.c	Tue Jan 18 20:02:23 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_quirks.c,v 1.92.2.2 2022/01/18 18:48:00 martin Exp $	*/
+/*	$NetBSD: usb_quirks.c,v 1.92.2.3 2022/01/18 20:02:23 snj Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_quirks.c,v 1.30 2003/01/02 04:15:55 imp Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_quirks.c,v 1.92.2.2 2022/01/18 18:48:00 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_quirks.c,v 1.92.2.3 2022/01/18 20:02:23 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -184,6 +184,8 @@ Static const struct usbd_quirk_entry {
  /* Devices which should be ignored by uhid */
  { USB_VENDOR_APC,		USB_PRODUCT_APC_UPS,			ANY,
 	{ UQ_HID_IGNORE, NULL }},
+ { USB_VENDOR_APC,		USB_PRODUCT_APC_UPS3,			ANY,
+	{ UQ_HID_IGNORE, NULL }},
  { USB_VENDOR_CYBERPOWER,	USB_PRODUCT_CYBERPOWER_UPS0,		ANY,
 	{ UQ_HID_IGNORE, NULL }},
  { USB_VENDOR_CYBERPOWER,	USB_PRODUCT_CYBERPOWER_UPS,		ANY,



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

2022-01-18 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Jan 18 20:00:00 UTC 2022

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

Log Message:
regen for ticket 1404


To generate a diff of this commit:
cvs rdiff -u -r1.760.4.11 -r1.760.4.12 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

2022-01-18 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Jan 18 20:00:00 UTC 2022

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

Log Message:
regen for ticket 1404


To generate a diff of this commit:
cvs rdiff -u -r1.760.4.11 -r1.760.4.12 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.

Modified files:

Index: src/sys/dev/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.760.4.11 src/sys/dev/usb/usbdevs.h:1.760.4.12
--- src/sys/dev/usb/usbdevs.h:1.760.4.11	Tue Jan 18 18:46:19 2022
+++ src/sys/dev/usb/usbdevs.h	Tue Jan 18 19:59:58 2022
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.760.4.11 2022/01/18 18:46:19 martin Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.760.4.12 2022/01/18 19:59:58 snj Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.770.4.11 2022/01/18 18:45:23 martin Exp
+ *	NetBSD: usbdevs,v 1.770.4.12 2022/01/18 19:58:54 snj Exp
  */
 
 /*-
@@ -829,6 +829,7 @@
 
 /* American Power Conversion products */
 #define	USB_PRODUCT_APC_UPS	0x0002		/* Uninterruptible Power Supply */
+#define	USB_PRODUCT_APC_UPS3	0x0003		/* Uninterruptible Power Supply */
 
 /* Ambit Microsystems products */
 #define	USB_PRODUCT_AMBIT_NTL_250	0x6098		/* NTL 250 cable modem */
Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.760.4.11 src/sys/dev/usb/usbdevs_data.h:1.760.4.12
--- src/sys/dev/usb/usbdevs_data.h:1.760.4.11	Tue Jan 18 18:46:19 2022
+++ src/sys/dev/usb/usbdevs_data.h	Tue Jan 18 19:59:58 2022
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.760.4.11 2022/01/18 18:46:19 martin Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.760.4.12 2022/01/18 19:59:58 snj Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.770.4.11 2022/01/18 18:45:23 martin Exp
+ *	NetBSD: usbdevs,v 1.770.4.12 2022/01/18 19:58:54 snj Exp
  */
 
 /*-
@@ -878,6 +878,8 @@ static const uint16_t usb_products[] = {
 	5925, 5916, 0,
 	USB_VENDOR_APC, USB_PRODUCT_APC_UPS, 
 	5932, 1229, 1982, 0,
+	USB_VENDOR_APC, USB_PRODUCT_APC_UPS3, 
+	5932, 1229, 1982, 0,
 	USB_VENDOR_AMBIT, USB_PRODUCT_AMBIT_NTL_250, 
 	5948, 5952, 5956, 5962, 0,
 	USB_VENDOR_AMD, USB_PRODUCT_AMD_TV_WONDER_600_USB, 
@@ -5169,7 +5171,7 @@ static const char usb_words[] = { "." 
 	"Components\0" /* 3 refs @ 1200 */
 	"Kawatsu\0" /* 1 refs @ 1211 */
 	"Composite\0" /* 1 refs @ 1219 */
-	"Power\0" /* 6 refs @ 1229 */
+	"Power\0" /* 7 refs @ 1229 */
 	"Conversion\0" /* 1 refs @ 1235 */
 	"Connectek\0" /* 1 refs @ 1246 */
 	"USA\0" /* 1 refs @ 1256 */
@@ -5269,7 +5271,7 @@ static const char usb_words[] = { "." 
 	"TEAC\0" /* 1 refs @ 1962 */
 	"Graphics\0" /* 2 refs @ 1967 */
 	"Sanwa\0" /* 1 refs @ 1976 */
-	"Supply\0" /* 5 refs @ 1982 */
+	"Supply\0" /* 6 refs @ 1982 */
 	"Linksys\0" /* 4 refs @ 1989 */
 	"Sigmatel\0" /* 1 refs @ 1997 */
 	"DrayTek\0" /* 1 refs @ 2006 */
@@ -5798,7 +5800,7 @@ static const char usb_words[] = { "." 
 	"ADA70\0" /* 1 refs @ 5910 */
 	"Speakers\0" /* 3 refs @ 5916 */
 	"ASC495\0" /* 1 refs @ 5925 */
-	"Uninterruptible\0" /* 4 refs @ 5932 */
+	"Uninterruptible\0" /* 5 refs @ 5932 */
 	"NTL\0" /* 1 refs @ 5948 */
 	"250\0" /* 3 refs @ 5952 */
 	"cable\0" /* 2 refs @ 5956 */



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

2022-01-18 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Jan 18 19:58:54 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by martin in ticket #1404):

sys/dev/usb/usbdevs: revision 1.800

Add a new APC UPS device id.


To generate a diff of this commit:
cvs rdiff -u -r1.770.4.11 -r1.770.4.12 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.4.11 src/sys/dev/usb/usbdevs:1.770.4.12
--- src/sys/dev/usb/usbdevs:1.770.4.11	Tue Jan 18 18:45:23 2022
+++ src/sys/dev/usb/usbdevs	Tue Jan 18 19:58:54 2022
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.770.4.11 2022/01/18 18:45:23 martin Exp $
+$NetBSD: usbdevs,v 1.770.4.12 2022/01/18 19:58:54 snj Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -822,6 +822,7 @@ product ALTEC ASC495		0xff05	ASC495 Spea
 
 /* American Power Conversion products */
 product APC UPS			0x0002	Uninterruptible Power Supply
+product APC UPS3		0x0003	Uninterruptible Power Supply
 
 /* Ambit Microsystems products */
 product AMBIT NTL_250		0x6098	NTL 250 cable modem



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

2022-01-18 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Jan 18 19:58:54 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by martin in ticket #1404):

sys/dev/usb/usbdevs: revision 1.800

Add a new APC UPS device id.


To generate a diff of this commit:
cvs rdiff -u -r1.770.4.11 -r1.770.4.12 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

2022-01-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 18 18:48:00 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1403):

sys/dev/usb/usb_quirks.c: revision 1.103

Add UQ_HID_IGNORE for the Microchip PICkit2 and 3 programmers.


To generate a diff of this commit:
cvs rdiff -u -r1.92.2.1 -r1.92.2.2 src/sys/dev/usb/usb_quirks.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

2022-01-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 18 18:48:00 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1403):

sys/dev/usb/usb_quirks.c: revision 1.103

Add UQ_HID_IGNORE for the Microchip PICkit2 and 3 programmers.


To generate a diff of this commit:
cvs rdiff -u -r1.92.2.1 -r1.92.2.2 src/sys/dev/usb/usb_quirks.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/usb_quirks.c
diff -u src/sys/dev/usb/usb_quirks.c:1.92.2.1 src/sys/dev/usb/usb_quirks.c:1.92.2.2
--- src/sys/dev/usb/usb_quirks.c:1.92.2.1	Sun Dec 19 16:38:24 2021
+++ src/sys/dev/usb/usb_quirks.c	Tue Jan 18 18:48:00 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_quirks.c,v 1.92.2.1 2021/12/19 16:38:24 martin Exp $	*/
+/*	$NetBSD: usb_quirks.c,v 1.92.2.2 2022/01/18 18:48:00 martin Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_quirks.c,v 1.30 2003/01/02 04:15:55 imp Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_quirks.c,v 1.92.2.1 2021/12/19 16:38:24 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_quirks.c,v 1.92.2.2 2022/01/18 18:48:00 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -198,6 +198,10 @@ Static const struct usbd_quirk_entry {
 	{ UQ_HID_IGNORE, NULL }},
  { USB_VENDOR_MICROCHIP,	USB_PRODUCT_MICROCHIP_PICKIT1,		ANY,
 	{ UQ_HID_IGNORE, NULL }},
+ { USB_VENDOR_MICROCHIP,	USB_PRODUCT_MICROCHIP_PICKIT2,		ANY,
+	{ UQ_HID_IGNORE, NULL }},
+ { USB_VENDOR_MICROCHIP,	USB_PRODUCT_MICROCHIP_PICKIT3,		ANY,
+	{ UQ_HID_IGNORE, NULL }},
  { USB_VENDOR_TRIPPLITE2,	ANY,	ANY,
 	{ UQ_HID_IGNORE, NULL }},
  { USB_VENDOR_MISC,		USB_PRODUCT_MISC_WISPY_24X,		ANY,



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

2022-01-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 18 18:46:21 UTC 2022

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

Log Message:
Regen for ticket #1402 (add Microchip PICkit3 programmer)


To generate a diff of this commit:
cvs rdiff -u -r1.760.4.10 -r1.760.4.11 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.

Modified files:

Index: src/sys/dev/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.760.4.10 src/sys/dev/usb/usbdevs.h:1.760.4.11
--- src/sys/dev/usb/usbdevs.h:1.760.4.10	Sun Dec 19 16:37:21 2021
+++ src/sys/dev/usb/usbdevs.h	Tue Jan 18 18:46:19 2022
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.760.4.10 2021/12/19 16:37:21 martin Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.760.4.11 2022/01/18 18:46:19 martin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.770.4.10 2021/12/19 16:34:39 martin Exp
+ *	NetBSD: usbdevs,v 1.770.4.11 2022/01/18 18:45:23 martin Exp
  */
 
 /*-
@@ -2316,6 +2316,7 @@
 /* Microchip Technology products */
 #define	USB_PRODUCT_MICROCHIP_PICKIT1	0x0032		/* PICkit(TM) 1 FLASH Starter Kit */
 #define	USB_PRODUCT_MICROCHIP_PICKIT2	0x0033		/* PICkit 2 Microcontroller Programmer */
+#define	USB_PRODUCT_MICROCHIP_PICKIT3	0x900a		/* PICkit 3 Microcontroller Programmer */
 
 /* Microdia / Sonix Techonology Co., Ltd. products */
 #define	USB_PRODUCT_MICRODIA_YUREX	0x1010		/* YUREX */
Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.760.4.10 src/sys/dev/usb/usbdevs_data.h:1.760.4.11
--- src/sys/dev/usb/usbdevs_data.h:1.760.4.10	Sun Dec 19 16:37:21 2021
+++ src/sys/dev/usb/usbdevs_data.h	Tue Jan 18 18:46:19 2022
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.760.4.10 2021/12/19 16:37:21 martin Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.760.4.11 2022/01/18 18:46:19 martin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.770.4.10 2021/12/19 16:34:39 martin Exp
+ *	NetBSD: usbdevs,v 1.770.4.11 2022/01/18 18:45:23 martin Exp
  */
 
 /*-
@@ -3084,6 +3084,8 @@ static const uint16_t usb_products[] = {
 	14137, 5592, 14148, 14154, 14162, 0,
 	USB_VENDOR_MICROCHIP, USB_PRODUCT_MICROCHIP_PICKIT2, 
 	14166, 6509, 14173, 14189, 0,
+	USB_VENDOR_MICROCHIP, USB_PRODUCT_MICROCHIP_PICKIT3, 
+	14166, 6511, 14173, 14189, 0,
 	USB_VENDOR_MICRODIA, USB_PRODUCT_MICRODIA_YUREX, 
 	14200, 0,
 	USB_VENDOR_MICRONET, USB_PRODUCT_MICRONET_SP128AR, 
@@ -5859,7 +5861,7 @@ static const char usb_words[] = { "." 
 	"5\0" /* 1 refs @ 6502 */
 	"iPad\0" /* 4 refs @ 6504 */
 	"2\0" /* 10 refs @ 6509 */
-	"3\0" /* 4 refs @ 6511 */
+	"3\0" /* 5 refs @ 6511 */
 	"Mini\0" /* 5 refs @ 6513 */
 	"Host\0" /* 11 refs @ 6518 */
 	"Controller\0" /* 20 refs @ 6523 */
@@ -6873,9 +6875,9 @@ static const char usb_words[] = { "." 
 	"FLASH\0" /* 1 refs @ 14148 */
 	"Starter\0" /* 1 refs @ 14154 */
 	"Kit\0" /* 2 refs @ 14162 */
-	"PICkit\0" /* 1 refs @ 14166 */
-	"Microcontroller\0" /* 1 refs @ 14173 */
-	"Programmer\0" /* 1 refs @ 14189 */
+	"PICkit\0" /* 2 refs @ 14166 */
+	"Microcontroller\0" /* 2 refs @ 14173 */
+	"Programmer\0" /* 2 refs @ 14189 */
 	"YUREX\0" /* 1 refs @ 14200 */
 	"SP128AR\0" /* 1 refs @ 14206 */
 	"EtherFast\0" /* 1 refs @ 14214 */



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

2022-01-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 18 18:46:21 UTC 2022

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

Log Message:
Regen for ticket #1402 (add Microchip PICkit3 programmer)


To generate a diff of this commit:
cvs rdiff -u -r1.760.4.10 -r1.760.4.11 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

2022-01-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 18 18:45:24 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1402):

sys/dev/usb/usbdevs: revision 1.801

Add the Microchip PICkit3 programmer


To generate a diff of this commit:
cvs rdiff -u -r1.770.4.10 -r1.770.4.11 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.4.10 src/sys/dev/usb/usbdevs:1.770.4.11
--- src/sys/dev/usb/usbdevs:1.770.4.10	Sun Dec 19 16:34:39 2021
+++ src/sys/dev/usb/usbdevs	Tue Jan 18 18:45:23 2022
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.770.4.10 2021/12/19 16:34:39 martin Exp $
+$NetBSD: usbdevs,v 1.770.4.11 2022/01/18 18:45:23 martin Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -2309,6 +2309,7 @@ product MSI BLUETOOTH_3		0xa97a	Bluetoot
 /* Microchip Technology products */
 product MICROCHIP PICKIT1	0x0032	PICkit(TM) 1 FLASH Starter Kit
 product MICROCHIP PICKIT2	0x0033	PICkit 2 Microcontroller Programmer
+product MICROCHIP PICKIT3	0x900a	PICkit 3 Microcontroller Programmer
 
 /* Microdia / Sonix Techonology Co., Ltd. products */
 product MICRODIA YUREX		0x1010	YUREX



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

2022-01-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 18 18:45:24 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1402):

sys/dev/usb/usbdevs: revision 1.801

Add the Microchip PICkit3 programmer


To generate a diff of this commit:
cvs rdiff -u -r1.770.4.10 -r1.770.4.11 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

2021-12-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 19 16:38:24 UTC 2021

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

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

sys/dev/usb/usb_quirks.c: revision 1.101

add two additional cyperpower ups ids for ignore hid.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.92.2.1 src/sys/dev/usb/usb_quirks.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/usb_quirks.c
diff -u src/sys/dev/usb/usb_quirks.c:1.92 src/sys/dev/usb/usb_quirks.c:1.92.2.1
--- src/sys/dev/usb/usb_quirks.c:1.92	Thu May 23 04:44:49 2019
+++ src/sys/dev/usb/usb_quirks.c	Sun Dec 19 16:38:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_quirks.c,v 1.92 2019/05/23 04:44:49 msaitoh Exp $	*/
+/*	$NetBSD: usb_quirks.c,v 1.92.2.1 2021/12/19 16:38:24 martin Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_quirks.c,v 1.30 2003/01/02 04:15:55 imp Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_quirks.c,v 1.92 2019/05/23 04:44:49 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_quirks.c,v 1.92.2.1 2021/12/19 16:38:24 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -184,8 +184,12 @@ Static const struct usbd_quirk_entry {
  /* Devices which should be ignored by uhid */
  { USB_VENDOR_APC,		USB_PRODUCT_APC_UPS,			ANY,
 	{ UQ_HID_IGNORE, NULL }},
+ { USB_VENDOR_CYBERPOWER,	USB_PRODUCT_CYBERPOWER_UPS0,		ANY,
+	{ UQ_HID_IGNORE, NULL }},
  { USB_VENDOR_CYBERPOWER,	USB_PRODUCT_CYBERPOWER_UPS,		ANY,
 	{ UQ_HID_IGNORE, NULL }},
+ { USB_VENDOR_CYBERPOWER,	USB_PRODUCT_CYBERPOWER_UPS2,		ANY,
+	{ UQ_HID_IGNORE, NULL }},
  { USB_VENDOR_GRETAGMACBETH,	ANY,	ANY,
 	{ UQ_HID_IGNORE, NULL }},
  { USB_VENDOR_MGE,		USB_PRODUCT_MGE_UPS1,			ANY,



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

2021-12-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 19 16:38:24 UTC 2021

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

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

sys/dev/usb/usb_quirks.c: revision 1.101

add two additional cyperpower ups ids for ignore hid.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.92.2.1 src/sys/dev/usb/usb_quirks.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

2021-12-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 19 16:37:23 UTC 2021

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

Log Message:
regen for ticket #1395 (add two more models of cyperpower UPS)


To generate a diff of this commit:
cvs rdiff -u -r1.760.4.9 -r1.760.4.10 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.

Modified files:

Index: src/sys/dev/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.760.4.9 src/sys/dev/usb/usbdevs.h:1.760.4.10
--- src/sys/dev/usb/usbdevs.h:1.760.4.9	Sat Oct 23 11:21:27 2021
+++ src/sys/dev/usb/usbdevs.h	Sun Dec 19 16:37:21 2021
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.760.4.9 2021/10/23 11:21:27 martin Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.760.4.10 2021/12/19 16:37:21 martin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.770.4.9 2021/10/23 11:17:43 martin Exp
+ *	NetBSD: usbdevs,v 1.770.4.10 2021/12/19 16:34:39 martin Exp
  */
 
 /*-
@@ -1294,7 +1294,9 @@
 #define	USB_PRODUCT_CTX_EX1300	0x		/* Ex1300 hub */
 
 /* CyberPower Systems, Inc. products */
+#define	USB_PRODUCT_CYBERPOWER_UPS0	0x0005		/* Uninterruptible Power Supply */
 #define	USB_PRODUCT_CYBERPOWER_UPS	0x0501		/* Uninterruptible Power Supply */
+#define	USB_PRODUCT_CYBERPOWER_UPS2	0x0601		/* Uninterruptible Power Supply */
 
 /* CyberTAN Technology products */
 #define	USB_PRODUCT_CYBERTAN_TG54USB	0x1666		/* TG54USB */
Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.760.4.9 src/sys/dev/usb/usbdevs_data.h:1.760.4.10
--- src/sys/dev/usb/usbdevs_data.h:1.760.4.9	Sat Oct 23 11:21:28 2021
+++ src/sys/dev/usb/usbdevs_data.h	Sun Dec 19 16:37:21 2021
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.760.4.9 2021/10/23 11:21:28 martin Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.760.4.10 2021/12/19 16:37:21 martin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.770.4.9 2021/10/23 11:17:43 martin Exp
+ *	NetBSD: usbdevs,v 1.770.4.10 2021/12/19 16:34:39 martin Exp
  */
 
 /*-
@@ -1574,8 +1574,12 @@ static const uint16_t usb_products[] = {
 	4893, 8446, 8450, 0,
 	USB_VENDOR_CTX, USB_PRODUCT_CTX_EX1300, 
 	8456, 7013, 0,
+	USB_VENDOR_CYBERPOWER, USB_PRODUCT_CYBERPOWER_UPS0, 
+	5932, 1229, 1982, 0,
 	USB_VENDOR_CYBERPOWER, USB_PRODUCT_CYBERPOWER_UPS, 
 	5932, 1229, 1982, 0,
+	USB_VENDOR_CYBERPOWER, USB_PRODUCT_CYBERPOWER_UPS2, 
+	5932, 1229, 1982, 0,
 	USB_VENDOR_CYBERTAN, USB_PRODUCT_CYBERTAN_TG54USB, 
 	8463, 0,
 	USB_VENDOR_CYBERTAN, USB_PRODUCT_CYBERTAN_ZD1211B, 
@@ -5163,7 +5167,7 @@ static const char usb_words[] = { "." 
 	"Components\0" /* 3 refs @ 1200 */
 	"Kawatsu\0" /* 1 refs @ 1211 */
 	"Composite\0" /* 1 refs @ 1219 */
-	"Power\0" /* 4 refs @ 1229 */
+	"Power\0" /* 6 refs @ 1229 */
 	"Conversion\0" /* 1 refs @ 1235 */
 	"Connectek\0" /* 1 refs @ 1246 */
 	"USA\0" /* 1 refs @ 1256 */
@@ -5263,7 +5267,7 @@ static const char usb_words[] = { "." 
 	"TEAC\0" /* 1 refs @ 1962 */
 	"Graphics\0" /* 2 refs @ 1967 */
 	"Sanwa\0" /* 1 refs @ 1976 */
-	"Supply\0" /* 3 refs @ 1982 */
+	"Supply\0" /* 5 refs @ 1982 */
 	"Linksys\0" /* 4 refs @ 1989 */
 	"Sigmatel\0" /* 1 refs @ 1997 */
 	"DrayTek\0" /* 1 refs @ 2006 */
@@ -5792,7 +5796,7 @@ static const char usb_words[] = { "." 
 	"ADA70\0" /* 1 refs @ 5910 */
 	"Speakers\0" /* 3 refs @ 5916 */
 	"ASC495\0" /* 1 refs @ 5925 */
-	"Uninterruptible\0" /* 2 refs @ 5932 */
+	"Uninterruptible\0" /* 4 refs @ 5932 */
 	"NTL\0" /* 1 refs @ 5948 */
 	"250\0" /* 3 refs @ 5952 */
 	"cable\0" /* 2 refs @ 5956 */



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

2021-12-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 19 16:37:23 UTC 2021

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

Log Message:
regen for ticket #1395 (add two more models of cyperpower UPS)


To generate a diff of this commit:
cvs rdiff -u -r1.760.4.9 -r1.760.4.10 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

2021-12-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 19 16:34:40 UTC 2021

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

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

sys/dev/usb/usbdevs: revision 1.799

add two more models of cyperpower UPS.


To generate a diff of this commit:
cvs rdiff -u -r1.770.4.9 -r1.770.4.10 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

2021-12-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 19 16:34:40 UTC 2021

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

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

sys/dev/usb/usbdevs: revision 1.799

add two more models of cyperpower UPS.


To generate a diff of this commit:
cvs rdiff -u -r1.770.4.9 -r1.770.4.10 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.4.9 src/sys/dev/usb/usbdevs:1.770.4.10
--- src/sys/dev/usb/usbdevs:1.770.4.9	Sat Oct 23 11:17:43 2021
+++ src/sys/dev/usb/usbdevs	Sun Dec 19 16:34:39 2021
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.770.4.9 2021/10/23 11:17:43 martin Exp $
+$NetBSD: usbdevs,v 1.770.4.10 2021/12/19 16:34:39 martin Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -1287,7 +1287,9 @@ product CMEDIA USBAUDIO		0x013c	USB Pnp 
 product CTX EX1300		0x	Ex1300 hub
 
 /* CyberPower Systems, Inc. products */
+product CYBERPOWER UPS0		0x0005	Uninterruptible Power Supply
 product CYBERPOWER UPS		0x0501	Uninterruptible Power Supply
+product CYBERPOWER UPS2		0x0601	Uninterruptible Power Supply
 
 /* CyberTAN Technology products */
 product CYBERTAN TG54USB	0x1666	TG54USB



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

2021-12-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec  6 19:28:58 UTC 2021

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1386):

sys/dev/usb/ehci.c: revision 1.287

ehci: Replace bogus polling during suspend by taking bus lock.

The system is not at high IPL or limited to a single CPU at this
point; it is running essentially normally, just with some devices
suspended.  Other threads might be trying to touch EHCI registers,
which might have bad outcomes while we're suspending stuff.  Enabling
polling only makes sense if there is a single thread and single CPU
running, such as when we enter ddb on crash.


To generate a diff of this commit:
cvs rdiff -u -r1.267.2.5 -r1.267.2.6 src/sys/dev/usb/ehci.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.267.2.5 src/sys/dev/usb/ehci.c:1.267.2.6
--- src/sys/dev/usb/ehci.c:1.267.2.5	Fri Sep  3 10:25:36 2021
+++ src/sys/dev/usb/ehci.c	Mon Dec  6 19:28:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.267.2.5 2021/09/03 10:25:36 martin Exp $ */
+/*	$NetBSD: ehci.c,v 1.267.2.6 2021/12/06 19:28:57 martin Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.267.2.5 2021/09/03 10:25:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.267.2.6 2021/12/06 19:28:57 martin Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -1384,10 +1384,6 @@ ehci_activate(device_t self, enum devact
 /*
  * Handle suspend/resume.
  *
- * We need to switch to polling mode here, because this routine is
- * called from an interrupt context.  This is all right since we
- * are almost suspended anyway.
- *
  * Note that this power handler isn't to be registered directly; the
  * bus glue needs to call out to it.
  */
@@ -1400,9 +1396,7 @@ ehci_suspend(device_t dv, const pmf_qual
 
 	EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
-	mutex_spin_enter(>sc_intr_lock);
-	sc->sc_bus.ub_usepolling++;
-	mutex_spin_exit(>sc_intr_lock);
+	mutex_enter(>sc_lock);
 
 	for (i = 1; i <= sc->sc_noport; i++) {
 		cmd = EOREAD4(sc, EHCI_PORTSC(i)) & ~EHCI_PS_CLEAR;
@@ -1438,9 +1432,7 @@ ehci_suspend(device_t dv, const pmf_qual
 	if (hcr != EHCI_STS_HCH)
 		printf("%s: config timeout\n", device_xname(dv));
 
-	mutex_spin_enter(>sc_intr_lock);
-	sc->sc_bus.ub_usepolling--;
-	mutex_spin_exit(>sc_intr_lock);
+	mutex_exit(>sc_lock);
 
 	return true;
 }
@@ -1454,6 +1446,8 @@ ehci_resume(device_t dv, const pmf_qual_
 
 	EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
+	mutex_enter(>sc_lock);
+
 	/* restore things in case the bios sucks */
 	EOWRITE4(sc, EHCI_CTRLDSSEGMENT, 0);
 	EOWRITE4(sc, EHCI_PERIODICLISTBASE, DMAADDR(>sc_fldma, 0));
@@ -1499,6 +1493,8 @@ ehci_resume(device_t dv, const pmf_qual_
 	if (hcr == EHCI_STS_HCH)
 		printf("%s: config timeout\n", device_xname(dv));
 
+	mutex_exit(>sc_lock);
+
 	return true;
 }
 



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

2021-12-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec  6 19:28:58 UTC 2021

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1386):

sys/dev/usb/ehci.c: revision 1.287

ehci: Replace bogus polling during suspend by taking bus lock.

The system is not at high IPL or limited to a single CPU at this
point; it is running essentially normally, just with some devices
suspended.  Other threads might be trying to touch EHCI registers,
which might have bad outcomes while we're suspending stuff.  Enabling
polling only makes sense if there is a single thread and single CPU
running, such as when we enter ddb on crash.


To generate a diff of this commit:
cvs rdiff -u -r1.267.2.5 -r1.267.2.6 src/sys/dev/usb/ehci.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

2021-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct 23 11:21:55 UTC 2021

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

Log Message:
Pull up following revision(s) (requested by jnemeth in ticket #1364):

sys/dev/usb/if_urtwn.c: revision 1.101

add Edimax N150 adapter; tested on my PBP


To generate a diff of this commit:
cvs rdiff -u -r1.71.2.5 -r1.71.2.6 src/sys/dev/usb/if_urtwn.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_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.71.2.5 src/sys/dev/usb/if_urtwn.c:1.71.2.6
--- src/sys/dev/usb/if_urtwn.c:1.71.2.5	Mon Mar 22 18:20:38 2021
+++ src/sys/dev/usb/if_urtwn.c	Sat Oct 23 11:21:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.71.2.5 2021/03/22 18:20:38 martin Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.71.2.6 2021/10/23 11:21:54 martin Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.71.2.5 2021/03/22 18:20:38 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.71.2.6 2021/10/23 11:21:54 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -195,6 +195,7 @@ static const struct urtwn_dev {
 	URTWN_RTL8188E_DEV(ABOCOM, RTL8188EU),
 	URTWN_RTL8188E_DEV(TPLINK, RTL8188EU),
 	URTWN_RTL8188E_DEV(DLINK, DWA121B1),
+	URTWN_RTL8188E_DEV(EDIMAX, EW7811UNV2),
 
 	/* URTWN_RTL8192EU */
 	URTWN_RTL8192EU_DEV(DLINK,	DWA131E),



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

2021-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct 23 11:21:55 UTC 2021

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

Log Message:
Pull up following revision(s) (requested by jnemeth in ticket #1364):

sys/dev/usb/if_urtwn.c: revision 1.101

add Edimax N150 adapter; tested on my PBP


To generate a diff of this commit:
cvs rdiff -u -r1.71.2.5 -r1.71.2.6 src/sys/dev/usb/if_urtwn.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

2021-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct 23 11:21:30 UTC 2021

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

Log Message:
Regen (ticket #1364, urtwn Edimax N150 addition)


To generate a diff of this commit:
cvs rdiff -u -r1.760.4.8 -r1.760.4.9 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

2021-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct 23 11:17:44 UTC 2021

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

Log Message:
Pull up following revision(s) (requested by jnemeth in ticket #1364):

sys/dev/usb/usbdevs: revision 1.798

add Edimax N150 adapter; tested on my PBP


To generate a diff of this commit:
cvs rdiff -u -r1.770.4.8 -r1.770.4.9 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.4.8 src/sys/dev/usb/usbdevs:1.770.4.9
--- src/sys/dev/usb/usbdevs:1.770.4.8	Sat Mar 27 13:00:45 2021
+++ src/sys/dev/usb/usbdevs	Sat Oct 23 11:17:43 2021
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.770.4.8 2021/03/27 13:00:45 martin Exp $
+$NetBSD: usbdevs,v 1.770.4.9 2021/10/23 11:17:43 martin Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -1492,6 +1492,7 @@ product EDIMAX EW7722UTN	0x7722	EW-7722U
 product EDIMAX RTL8188CU	0x7811	RTL8188CU
 product EDIMAX RTL8192CU	0x7822	RTL8192CU
 product EDIMAX ELECOM_WDC433SU2M 0xb711	ELECOM WDC-433SU2M
+product EDIMAX EW7811UNV2	0xb811	EW-7811Un V2
 
 /* eGalax Products */
 product EGALAX TPANEL		0x0001	Touch Panel



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

2021-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct 23 11:17:44 UTC 2021

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

Log Message:
Pull up following revision(s) (requested by jnemeth in ticket #1364):

sys/dev/usb/usbdevs: revision 1.798

add Edimax N150 adapter; tested on my PBP


To generate a diff of this commit:
cvs rdiff -u -r1.770.4.8 -r1.770.4.9 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

2021-09-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep  3 10:25:36 UTC 2021

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

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

sys/dev/usb/ehci.c: revision 1.286

add missing newline and fix conditional for askroot/single user
hand over delay message.  PR#56366.


To generate a diff of this commit:
cvs rdiff -u -r1.267.2.4 -r1.267.2.5 src/sys/dev/usb/ehci.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.267.2.4 src/sys/dev/usb/ehci.c:1.267.2.5
--- src/sys/dev/usb/ehci.c:1.267.2.4	Wed Dec 23 12:34:38 2020
+++ src/sys/dev/usb/ehci.c	Fri Sep  3 10:25:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.267.2.4 2020/12/23 12:34:38 martin Exp $ */
+/*	$NetBSD: ehci.c,v 1.267.2.5 2021/09/03 10:25:36 martin Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.267.2.4 2020/12/23 12:34:38 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.267.2.5 2021/09/03 10:25:36 martin Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -2654,8 +2654,8 @@ ehci_disown_sched_callback(ehci_softc_t 
 	mutex_exit(>sc_complock);
 
 	config_pending_incr(sc->sc_dev);
-	aprint_normal("delaying %s by %u seconds due to USB owner change.",
-	(boothowto & RB_ASKNAME) == 0 ? "ask root" : "single user",
+	aprint_normal("delaying %s by %u seconds due to USB owner change.\n",
+	(boothowto & RB_ASKNAME) != 0 ? "ask root" : "single user",
 	ehci_disown_delay_seconds);
 }
 



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

2021-09-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep  3 10:25:36 UTC 2021

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

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

sys/dev/usb/ehci.c: revision 1.286

add missing newline and fix conditional for askroot/single user
hand over delay message.  PR#56366.


To generate a diff of this commit:
cvs rdiff -u -r1.267.2.4 -r1.267.2.5 src/sys/dev/usb/ehci.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.



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.