CVS commit: src/sys/dev/usb
Module Name:src Committed By: skrll Date: Sun Apr 28 08:55:03 UTC 2024 Modified Files: src/sys/dev/usb: ohci.c Log Message: Fix some usb_syncmem calls and add some missing ones. To generate a diff of this commit: cvs rdiff -u -r1.327 -r1.328 src/sys/dev/usb/ohci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/ohci.c diff -u src/sys/dev/usb/ohci.c:1.327 src/sys/dev/usb/ohci.c:1.328 --- src/sys/dev/usb/ohci.c:1.327 Sun Apr 28 07:52:52 2024 +++ src/sys/dev/usb/ohci.c Sun Apr 28 08:55:03 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ohci.c,v 1.327 2024/04/28 07:52:52 skrll Exp $ */ +/* $NetBSD: ohci.c,v 1.328 2024/04/28 08:55:03 skrll Exp $ */ /* * Copyright (c) 1998, 2004, 2005, 2012, 2016, 2020 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.327 2024/04/28 07:52:52 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.328 2024/04/28 08:55:03 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -844,6 +844,9 @@ ohci_init(ohci_softc_t *sc) goto bad1; } sc->sc_ctrl_head->ed.ed_flags |= HTOO32(OHCI_ED_SKIP); + usb_syncmem(>sc_ctrl_head->dma, sc->sc_ctrl_head->offs, + sizeof(sc->sc_ctrl_head->ed), + BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); /* Allocate dummy ED that starts the bulk list. */ sc->sc_bulk_head = ohci_alloc_sed(sc); @@ -1609,6 +1612,10 @@ ohci_softintr(void *v) for (i = 0, sitd = xfer->ux_hcpriv;; sitd = next) { next = sitd->nextitd; + +usb_syncmem(>dma, sitd->offs, sizeof(sitd->itd), +BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD); + if (OHCI_ITD_GET_CC(O32TOH(sitd-> itd.itd_flags)) != OHCI_CC_NO_ERROR) xfer->ux_status = USBD_IOERROR; @@ -2259,8 +2266,7 @@ ohci_abortx(struct usbd_xfer *xfer) * waiting for the next start of frame (OHCI_SF) */ DPRINTFN(1, "stop ed=%#jx", (uintptr_t)sed, 0, 0, 0); - usb_syncmem(>dma, sed->offs + offsetof(ohci_ed_t, ed_flags), - sizeof(sed->ed.ed_flags), + usb_syncmem(>dma, sed->offs, sizeof(sed->ed), BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD); if (!(sed->ed.ed_flags & OHCI_HALTED)) { /* force hardware skip */ @@ -2337,6 +2343,9 @@ ohci_abortx(struct usbd_xfer *xfer) hit |= headp == p->physaddr; n = p->nexttd; + usb_syncmem(>dma, p->offs + offsetof(ohci_td_t, td_flags), + sizeof(p->td.td_flags), + BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD); int cc = OHCI_TD_GET_CC(O32TOH(p->td.td_flags)); if (!OHCI_CC_ACCESSED_P(cc)) { ohci_hash_rem_td(sc, p); @@ -2951,8 +2960,17 @@ ohci_device_clear_toggle(struct usbd_pip { struct ohci_pipe *opipe = OHCI_PIPE2OPIPE(pipe); ohci_softc_t *sc = OHCI_PIPE2SC(pipe); + ohci_soft_ed_t *sed = opipe->sed; + + usb_syncmem(>dma, sed->offs + offsetof(ohci_ed_t, ed_headp), + sizeof(sed->ed.ed_headp), + BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD); opipe->sed->ed.ed_headp &= HTOO32(~OHCI_TOGGLECARRY); + + usb_syncmem(>dma, sed->offs + offsetof(ohci_ed_t, ed_headp), + sizeof(sed->ed.ed_headp), + BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); } Static void @@ -3403,17 +3421,21 @@ ohci_device_setintr(ohci_softc_t *sc, st mutex_enter(>sc_lock); hsed = sc->sc_eds[best]; sed->next = hsed->next; - usb_syncmem(>dma, hsed->offs + offsetof(ohci_ed_t, ed_flags), - sizeof(hsed->ed.ed_flags), + usb_syncmem(>dma, sed->offs + offsetof(ohci_ed_t, ed_nexted), + sizeof(sed->ed.ed_nexted), BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD); sed->ed.ed_nexted = hsed->ed.ed_nexted; - usb_syncmem(>dma, sed->offs + offsetof(ohci_ed_t, ed_flags), - sizeof(sed->ed.ed_flags), + usb_syncmem(>dma, sed->offs + offsetof(ohci_ed_t, ed_nexted), + sizeof(sed->ed.ed_nexted), BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); + hsed->next = sed; + usb_syncmem(>dma, hsed->offs + offsetof(ohci_ed_t, ed_nexted), + sizeof(hsed->ed.ed_nexted), + BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD); hsed->ed.ed_nexted = HTOO32(sed->physaddr); - usb_syncmem(>dma, hsed->offs + offsetof(ohci_ed_t, ed_flags), - sizeof(hsed->ed.ed_flags), + usb_syncmem(>dma, hsed->offs + offsetof(ohci_ed_t, ed_nexted), + sizeof(hsed->ed.ed_nexted), BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); mutex_exit(>sc_lock); @@ -3685,8 +3707,7 @@ ohci_device_isoc_enter(struct usbd_xfer BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD); sed->ed.ed_tailp = HTOO32(tail->physaddr); sed->ed.ed_flags &= HTOO32(~OHCI_ED_SKIP); - usb_syncmem(>dma, sed->offs + offsetof(ohci_ed_t, ed_flags), - sizeof(sed->ed.ed_flags), + usb_syncmem(>dma, sed->offs, sizeof(sed->ed), BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); }
CVS commit: src/sys/dev/usb
Module Name:src Committed By: skrll Date: Sun Apr 28 08:55:03 UTC 2024 Modified Files: src/sys/dev/usb: ohci.c Log Message: Fix some usb_syncmem calls and add some missing ones. To generate a diff of this commit: cvs rdiff -u -r1.327 -r1.328 src/sys/dev/usb/ohci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: skrll Date: Sun Apr 28 07:52:52 UTC 2024 Modified Files: src/sys/dev/usb: ohci.c Log Message: Whitespace. To generate a diff of this commit: cvs rdiff -u -r1.326 -r1.327 src/sys/dev/usb/ohci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/ohci.c diff -u src/sys/dev/usb/ohci.c:1.326 src/sys/dev/usb/ohci.c:1.327 --- src/sys/dev/usb/ohci.c:1.326 Fri Apr 5 18:57:10 2024 +++ src/sys/dev/usb/ohci.c Sun Apr 28 07:52:52 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ohci.c,v 1.326 2024/04/05 18:57:10 riastradh Exp $ */ +/* $NetBSD: ohci.c,v 1.327 2024/04/28 07:52:52 skrll Exp $ */ /* * Copyright (c) 1998, 2004, 2005, 2012, 2016, 2020 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.326 2024/04/05 18:57:10 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.327 2024/04/28 07:52:52 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -826,8 +826,8 @@ ohci_init(ohci_softc_t *sc) /* XXX determine alignment by R/W */ /* Allocate the HCCA area. */ - err = usb_allocmem(sc->sc_bus.ub_dmatag, OHCI_HCCA_SIZE, OHCI_HCCA_ALIGN, - USBMALLOC_COHERENT, >sc_hccadma); + err = usb_allocmem(sc->sc_bus.ub_dmatag, OHCI_HCCA_SIZE, + OHCI_HCCA_ALIGN, USBMALLOC_COHERENT, >sc_hccadma); if (err) { sc->sc_hcca = NULL; return err;
CVS commit: src/sys/dev/usb
Module Name:src Committed By: skrll Date: Sun Apr 28 07:52:52 UTC 2024 Modified Files: src/sys/dev/usb: ohci.c Log Message: Whitespace. To generate a diff of this commit: cvs rdiff -u -r1.326 -r1.327 src/sys/dev/usb/ohci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: thorpej Date: Thu Apr 25 01:33:04 UTC 2024 Modified Files: src/sys/dev/usb: uftdi.c Log Message: Add a match quirk to prevent matching any interface on SiPEED FPGA development boards (e.g. Tang Nano 9K). The FT2232s on these boards are wired up only for JTAG. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/sys/dev/usb/uftdi.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/uftdi.c diff -u src/sys/dev/usb/uftdi.c:1.78 src/sys/dev/usb/uftdi.c:1.79 --- src/sys/dev/usb/uftdi.c:1.78 Wed Apr 17 02:34:45 2024 +++ src/sys/dev/usb/uftdi.c Thu Apr 25 01:33:03 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: uftdi.c,v 1.78 2024/04/17 02:34:45 maya Exp $ */ +/* $NetBSD: uftdi.c,v 1.79 2024/04/25 01:33:03 thorpej Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.78 2024/04/17 02:34:45 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.79 2024/04/25 01:33:03 thorpej Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -229,7 +229,19 @@ static const struct uftdi_match_quirk_en .vendor_str = "SecuringHardware.com", .product_str = "Tigard V1.1", .match_ret = UMATCH_NONE, - } + }, + /* + * The SiPEED Tang Nano 9K (and other SiPEED Tang FPGA development + * boards) have an FT2232 on-board, wired up only for JTAG. + */ + { + .vendor_id = USB_VENDOR_FTDI, + .product_id = USB_PRODUCT_FTDI_SERIAL_2232C, + .iface_no = -1, + .vendor_str = "SIPEED", + .product_str = "JTAG Debugger", + .match_ret = UMATCH_NONE, + }, }; static int @@ -243,7 +255,7 @@ uftdi_quirk_match(struct usbif_attach_ar q = _match_quirks[i]; if (uiaa->uiaa_vendor != q->vendor_id || uiaa->uiaa_product != q->product_id || - uiaa->uiaa_ifaceno != q->iface_no) { + (q->iface_no != -1 && uiaa->uiaa_ifaceno != q->iface_no)) { continue; } if (q->vendor_str != NULL &&
CVS commit: src/sys/dev/usb
Module Name:src Committed By: thorpej Date: Thu Apr 25 01:33:04 UTC 2024 Modified Files: src/sys/dev/usb: uftdi.c Log Message: Add a match quirk to prevent matching any interface on SiPEED FPGA development boards (e.g. Tang Nano 9K). The FT2232s on these boards are wired up only for JTAG. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/sys/dev/usb/uftdi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: maya Date: Wed Apr 17 02:34:45 UTC 2024 Modified Files: src/sys/dev/usb: uftdi.c Log Message: Add support for a range of USB serial adapters >From Cameron Williams in PR kern/58127 To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/sys/dev/usb/uftdi.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/uftdi.c diff -u src/sys/dev/usb/uftdi.c:1.77 src/sys/dev/usb/uftdi.c:1.78 --- src/sys/dev/usb/uftdi.c:1.77 Tue Mar 26 03:38:02 2024 +++ src/sys/dev/usb/uftdi.c Wed Apr 17 02:34:45 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: uftdi.c,v 1.77 2024/03/26 03:38:02 thorpej Exp $ */ +/* $NetBSD: uftdi.c,v 1.78 2024/04/17 02:34:45 maya Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.77 2024/03/26 03:38:02 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.78 2024/04/17 02:34:45 maya Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -126,6 +126,25 @@ static const struct ucom_methods uftdi_m */ static const struct usb_devno uftdi_devs[] = { { USB_VENDOR_BBELECTRONICS, USB_PRODUCT_BBELECTRONICS_USOTL4 }, + { USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US101 }, + { USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US159 }, + { USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US235 }, + { USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US257 }, + { USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US279_12 }, + { USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US279_34 }, + { USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US279_56 }, + { USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US279_78 }, + { USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US313 }, + { USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US320 }, + { USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US324 }, + { USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US346_12 }, + { USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US346_34 }, + { USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US701_12 }, + { USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US701_34 }, + { USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US842_12 }, + { USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US842_34 }, + { USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US842_56 }, + { USB_VENDOR_BRAINBOXES, USB_PRODUCT_BRAINBOXES_US842_78 }, { USB_VENDOR_FALCOM, USB_PRODUCT_FALCOM_TWIST }, { USB_VENDOR_FALCOM, USB_PRODUCT_FALCOM_SAMBA }, { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_230X },
CVS commit: src/sys/dev/usb
Module Name:src Committed By: maya Date: Wed Apr 17 02:34:45 UTC 2024 Modified Files: src/sys/dev/usb: uftdi.c Log Message: Add support for a range of USB serial adapters >From Cameron Williams in PR kern/58127 To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/sys/dev/usb/uftdi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: maya Date: Wed Apr 17 02:33:04 UTC 2024 Modified Files: src/sys/dev/usb: usbdevs.h usbdevs_data.h Log Message: Regen after usbdevs change To generate a diff of this commit: cvs rdiff -u -r1.806 -r1.807 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: src/sys/dev/usb
Module Name:src Committed By: maya Date: Wed Apr 17 02:32:09 UTC 2024 Modified Files: src/sys/dev/usb: usbdevs Log Message: Add some USB serial adapters >From Cameron Williams in PR kern/58127 To generate a diff of this commit: cvs rdiff -u -r1.814 -r1.815 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.814 src/sys/dev/usb/usbdevs:1.815 --- src/sys/dev/usb/usbdevs:1.814 Wed Feb 28 21:50:51 2024 +++ src/sys/dev/usb/usbdevs Wed Apr 17 02:32:08 2024 @@ -1,4 +1,4 @@ -$NetBSD: usbdevs,v 1.814 2024/02/28 21:50:51 dholland Exp $ +$NetBSD: usbdevs,v 1.815 2024/04/17 02:32:08 maya Exp $ /*- * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. @@ -1118,6 +1118,27 @@ product BILLIONTON USBEL100 0x0988 USB10 product BILLIONTON USBE100 0x8511 USBE100 product BILLIONTON USB2AR 0x90ff USB2AR Ethernet +/* Brainboxes Limited products */ +product BRAINBOXES US101 0x1011 US-101 USB2Serial 1xRS232 +product BRAINBOXES US159 0x1021 US-159 USB2Serial 1xRS232 +product BRAINBOXES US235 0x1017 US-235 USB2Serial 1xRS232 +product BRAINBOXES US257 0x5001 US-257 USB2Serial 2xRS232 +product BRAINBOXES US279_12 0x2021 US-279 USB2Serial 8xRS232 (Port 1 and 2) +product BRAINBOXES US279_34 0x2022 US-279 USB2Serial 8xRS232 (Port 3 and 4) +product BRAINBOXES US279_56 0x2023 US-279 USB2Serial 8xRS232 (Port 5 and 6) +product BRAINBOXES US279_78 0x2024 US-279 USB2Serial 8xRS232 (Port 7 and 8) +product BRAINBOXES US313 0x6001 US-313 USB2Serial 2xRS422/485 +product BRAINBOXES US320 0x1019 US-320 USB2Serial 1xRS422/485 +product BRAINBOXES US324 0x1013 US-324 USB2Serial 1xRS422/485 +product BRAINBOXES US346_12 0x3011 US-346 USB2Serial 4xRS422/485 (Port 1 and 2) +product BRAINBOXES US346_34 0x3012 US-346 USB2Serial 4xRS422/485 (Port 3 and 4) +product BRAINBOXES US701_12 0x2011 US-701 USB2Serial 4xRS232 (Port 1 and 2) +product BRAINBOXES US701_34 0x2012 US-701 USB2Serial 4xRS232 (Port 3 and 4) +product BRAINBOXES US842_12 0x8001 US-842 USB2Serial 8xRS422/485 (Port 1 and 2) +product BRAINBOXES US842_34 0x8002 US-842 USB2Serial 8xRS422/485 (Port 3 and 4) +product BRAINBOXES US842_56 0x8003 US-842 USB2Serial 8xRS422/485 (Port 5 and 6) +product BRAINBOXES US842_78 0x8004 US-842 USB2Serial 8xRS422/485 (Port 7 and 8) + /* Broadcom products */ product BROADCOM BCMFW 0x0bdc BCMFW product BROADCOM BCM2033 0x2000 BCM2033
CVS commit: src/sys/dev/usb
Module Name:src Committed By: maya Date: Wed Apr 17 02:32:09 UTC 2024 Modified Files: src/sys/dev/usb: usbdevs Log Message: Add some USB serial adapters >From Cameron Williams in PR kern/58127 To generate a diff of this commit: cvs rdiff -u -r1.814 -r1.815 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: src/sys/dev/usb
Module Name:src Committed By: jakllsch Date: Fri Apr 12 16:54:37 UTC 2024 Modified Files: src/sys/dev/usb: ucom.c Log Message: include opt_ntp.h for PPS_SYNC To generate a diff of this commit: cvs rdiff -u -r1.138 -r1.139 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.138 src/sys/dev/usb/ucom.c:1.139 --- src/sys/dev/usb/ucom.c:1.138 Sun Mar 5 23:28:54 2023 +++ src/sys/dev/usb/ucom.c Fri Apr 12 16:54:37 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ucom.c,v 1.138 2023/03/05 23:28:54 riastradh Exp $ */ +/* $NetBSD: ucom.c,v 1.139 2024/04/12 16:54:37 jakllsch Exp $ */ /* * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -34,9 +34,10 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.138 2023/03/05 23:28:54 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.139 2024/04/12 16:54:37 jakllsch Exp $"); #ifdef _KERNEL_OPT +#include "opt_ntp.h" #include "opt_usb.h" #endif
CVS commit: src/sys/dev/usb
Module Name:src Committed By: jakllsch Date: Fri Apr 12 16:54:37 UTC 2024 Modified Files: src/sys/dev/usb: ucom.c Log Message: include opt_ntp.h for PPS_SYNC To generate a diff of this commit: cvs rdiff -u -r1.138 -r1.139 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: src/sys/dev/usb
Module Name:src Committed By: thorpej Date: Fri Mar 29 19:30:09 UTC 2024 Modified Files: src/sys/dev/usb: ugen.c Log Message: ugen and ugenif share the same /dev/ugenN.xx namespace in such a way that the device unit number does not necessarily match the /dev/ugenN.xx unit number (N). If you ONLY have ugen devices, it happens to work out and devpubd scripts can be extremely naive. If you ONLY have ugenif devices, it also happens to work out, but your devpubd scripts have to slightly more informed. If you have a mix of ugen AND ugenif devices, though, you're pretty much out of luck. So, this change adds a "ugen-unit" device property which devpubd scripts can query to determine which /dev/ugenN.xx nodes a given ugen or ugenif device is using. To generate a diff of this commit: cvs rdiff -u -r1.176 -r1.177 src/sys/dev/usb/ugen.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/ugen.c diff -u src/sys/dev/usb/ugen.c:1.176 src/sys/dev/usb/ugen.c:1.177 --- src/sys/dev/usb/ugen.c:1.176 Tue Mar 26 03:24:14 2024 +++ src/sys/dev/usb/ugen.c Fri Mar 29 19:30:09 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ugen.c,v 1.176 2024/03/26 03:24:14 thorpej Exp $ */ +/* $NetBSD: ugen.c,v 1.177 2024/03/29 19:30:09 thorpej Exp $ */ /* * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.176 2024/03/26 03:24:14 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.177 2024/03/29 19:30:09 thorpej Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -238,12 +238,18 @@ ugenif_get_unit(struct ugen_softc *sc) KASSERT(sc0 == sc); KASSERT(rb_tree_find_node(, ) == sc); mutex_exit(); + + prop_dictionary_set_uint(device_properties(sc->sc_dev), + "ugen-unit", sc->sc_unit); } static void ugenif_put_unit(struct ugen_softc *sc) { + prop_dictionary_remove(device_properties(sc->sc_dev), + "ugen-unit"); + mutex_enter(); KASSERT(rb_tree_find_node(, >sc_unit) == sc); rb_tree_remove_node(, sc);
CVS commit: src/sys/dev/usb
Module Name:src Committed By: thorpej Date: Fri Mar 29 19:30:09 UTC 2024 Modified Files: src/sys/dev/usb: ugen.c Log Message: ugen and ugenif share the same /dev/ugenN.xx namespace in such a way that the device unit number does not necessarily match the /dev/ugenN.xx unit number (N). If you ONLY have ugen devices, it happens to work out and devpubd scripts can be extremely naive. If you ONLY have ugenif devices, it also happens to work out, but your devpubd scripts have to slightly more informed. If you have a mix of ugen AND ugenif devices, though, you're pretty much out of luck. So, this change adds a "ugen-unit" device property which devpubd scripts can query to determine which /dev/ugenN.xx nodes a given ugen or ugenif device is using. To generate a diff of this commit: cvs rdiff -u -r1.176 -r1.177 src/sys/dev/usb/ugen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: thorpej Date: Tue Mar 26 03:38:02 UTC 2024 Modified Files: src/sys/dev/usb: uftdi.c usbdevices.config Log Message: Add a "match quirk" mechanism to the uftdi driver that allows it to selectively reject individual interfaces based on the combination of - Vendor ID - Product ID - Interface number - Vendor string - Product string This is necessary[*] to allow some devices that would otherwise match uftdi (and thus instantiate a ucom) to be matched by ugenif instead, which is required to make the device available to libusb1. [*] ...due to a deficiency in the USB stack that does not provide a mechanism for a user-space driver to claim a device from a kernel driver and then return it back at a later time. Use this new match quirk mechanism to reject "interface 1" of the FTDI 2232C-based Tigard debug board; On this board, "interface 0" is brought out to regular TTL-level UART pins, but "interface 1" is brought out to SWD and JTAG headers, and is really only useful when used with something like openocd. Because the FTDI 2232C on this board just uses the standard FTDI vendor and product IDs, it can only be distinguished by the strings, which cannot be specified usbdevices.config, thus necessitating the match quirk entry (that works in combination with the ugenif entry added in usbdevices.config). To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/dev/usb/uftdi.c cvs rdiff -u -r1.42 -r1.43 src/sys/dev/usb/usbdevices.config 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/uftdi.c diff -u src/sys/dev/usb/uftdi.c:1.76 src/sys/dev/usb/uftdi.c:1.77 --- src/sys/dev/usb/uftdi.c:1.76 Sat Aug 7 16:19:17 2021 +++ src/sys/dev/usb/uftdi.c Tue Mar 26 03:38:02 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: uftdi.c,v 1.76 2021/08/07 16:19:17 thorpej Exp $ */ +/* $NetBSD: uftdi.c,v 1.77 2024/03/26 03:38:02 thorpej Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.76 2021/08/07 16:19:17 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.77 2024/03/26 03:38:02 thorpej Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1. #include #include +#include #include #include @@ -184,10 +185,72 @@ static int uftdi_detach(device_t, int); CFATTACH_DECL2_NEW(uftdi, sizeof(struct uftdi_softc), uftdi_match, uftdi_attach, uftdi_detach, NULL, NULL, uftdi_childdet); +struct uftdi_match_quirk_entry { + uint16_t vendor_id; + uint16_t product_id; + int iface_no; + const char * vendor_str; + const char * product_str; + int match_ret; +}; + +static const struct uftdi_match_quirk_entry uftdi_match_quirks[] = { + /* + * The Tigard board (https://github.com/tigard-tools/tigard) + * has two interfaces, one of which is meant to act as a + * regular USB serial port (interface 0), the other of which + * is meant for other protocols (SWD, JTAG, etc.). We must + * reject interface 1 so that ugenif matches, thus allowing + * full user-space control of that port. + */ + { + .vendor_id = USB_VENDOR_FTDI, + .product_id = USB_PRODUCT_FTDI_SERIAL_2232C, + .iface_no = 1, + .vendor_str = "SecuringHardware.com", + .product_str = "Tigard V1.1", + .match_ret = UMATCH_NONE, + } +}; + +static int +uftdi_quirk_match(struct usbif_attach_arg *uiaa, int rv) +{ + struct usbd_device *dev = uiaa->uiaa_device; + const struct uftdi_match_quirk_entry *q; + int i; + + for (i = 0; i < __arraycount(uftdi_match_quirks); i++) { + q = _match_quirks[i]; + if (uiaa->uiaa_vendor != q->vendor_id || + uiaa->uiaa_product != q->product_id || + uiaa->uiaa_ifaceno != q->iface_no) { + continue; + } + if (q->vendor_str != NULL && + (dev->ud_vendor == NULL || + strcmp(dev->ud_vendor, q->vendor_str) != 0)) { + continue; + } + if (q->product_str != NULL && + (dev->ud_product == NULL || + strcmp(dev->ud_product, q->product_str) != 0)) { + continue; + } + /* + * Got a match! + */ + rv = q->match_ret; + break; + } + return rv; +} + static int uftdi_match(device_t parent, cfdata_t match, void *aux) { struct usbif_attach_arg *uiaa = aux; + int rv; DPRINTFN(20,("uftdi: vendor=%#x, product=%#x\n", uiaa->uiaa_vendor, uiaa->uiaa_product)); @@ -195,8 +258,12 @@ uftdi_match(device_t parent, cfdata_t ma if (uiaa->uiaa_configno != UFTDI_CONFIG_NO) return UMATCH_NONE; - return uftdi_lookup(uiaa->uiaa_vendor, uiaa->uiaa_product) != NULL ? + rv = uftdi_lookup(uiaa->uiaa_vendor, uiaa->uiaa_product) != NULL ? UMATCH_VENDOR_PRODUCT_CONF_IFACE : UMATCH_NONE; + if (rv != UMATCH_NONE) { + rv = uftdi_quirk_match(uiaa, rv); + } + return rv; } static void Index: src/sys/dev/usb/usbdevices.config diff -u src/sys/dev/usb/usbdevices.config:1.42 src/sys/dev/usb/usbdevices.config:1.43
CVS commit: src/sys/dev/usb
Module Name:src Committed By: thorpej Date: Tue Mar 26 03:38:02 UTC 2024 Modified Files: src/sys/dev/usb: uftdi.c usbdevices.config Log Message: Add a "match quirk" mechanism to the uftdi driver that allows it to selectively reject individual interfaces based on the combination of - Vendor ID - Product ID - Interface number - Vendor string - Product string This is necessary[*] to allow some devices that would otherwise match uftdi (and thus instantiate a ucom) to be matched by ugenif instead, which is required to make the device available to libusb1. [*] ...due to a deficiency in the USB stack that does not provide a mechanism for a user-space driver to claim a device from a kernel driver and then return it back at a later time. Use this new match quirk mechanism to reject "interface 1" of the FTDI 2232C-based Tigard debug board; On this board, "interface 0" is brought out to regular TTL-level UART pins, but "interface 1" is brought out to SWD and JTAG headers, and is really only useful when used with something like openocd. Because the FTDI 2232C on this board just uses the standard FTDI vendor and product IDs, it can only be distinguished by the strings, which cannot be specified usbdevices.config, thus necessitating the match quirk entry (that works in combination with the ugenif entry added in usbdevices.config). To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/dev/usb/uftdi.c cvs rdiff -u -r1.42 -r1.43 src/sys/dev/usb/usbdevices.config Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: jakllsch Date: Mon Mar 18 15:15:27 UTC 2024 Modified Files: src/sys/dev/usb: ums.c Log Message: Use HUD_PEN instead of 0x0002 as appropriate To generate a diff of this commit: cvs rdiff -u -r1.105 -r1.106 src/sys/dev/usb/ums.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: jakllsch Date: Mon Mar 18 15:15:27 UTC 2024 Modified Files: src/sys/dev/usb: ums.c Log Message: Use HUD_PEN instead of 0x0002 as appropriate To generate a diff of this commit: cvs rdiff -u -r1.105 -r1.106 src/sys/dev/usb/ums.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/ums.c diff -u src/sys/dev/usb/ums.c:1.105 src/sys/dev/usb/ums.c:1.106 --- src/sys/dev/usb/ums.c:1.105 Sat Jan 13 15:26:36 2024 +++ src/sys/dev/usb/ums.c Mon Mar 18 15:15:27 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ums.c,v 1.105 2024/01/13 15:26:36 hgutch Exp $ */ +/* $NetBSD: ums.c,v 1.106 2024/03/18 15:15:27 jakllsch Exp $ */ /* * Copyright (c) 1998, 2017 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ums.c,v 1.105 2024/01/13 15:26:36 hgutch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ums.c,v 1.106 2024/03/18 15:15:27 jakllsch Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -170,7 +170,7 @@ ums_match(device_t parent, cfdata_t matc !hid_is_collection(desc, size, uha->reportid, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_POINTER)) && !hid_is_collection(desc, size, uha->reportid, - HID_USAGE2(HUP_DIGITIZERS, 0x0002))) + HID_USAGE2(HUP_DIGITIZERS, HUD_PEN))) return UMATCH_NONE; return UMATCH_IFACECLASS;
CVS commit: src/sys/dev/usb
Module Name:src Committed By: jakllsch Date: Sun Mar 17 20:10:52 UTC 2024 Modified Files: src/sys/dev/usb: ucycom.c Log Message: Prevent errant ucycom-presenting device from causing up to 225 bytes of kernel memory following input buffer to leak to tty application. Probably not practically expolitable, but you never know. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/dev/usb/ucycom.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/ucycom.c diff -u src/sys/dev/usb/ucycom.c:1.56 src/sys/dev/usb/ucycom.c:1.57 --- src/sys/dev/usb/ucycom.c:1.56 Wed Oct 26 23:50:28 2022 +++ src/sys/dev/usb/ucycom.c Sun Mar 17 20:10:52 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ucycom.c,v 1.56 2022/10/26 23:50:28 riastradh Exp $ */ +/* $NetBSD: ucycom.c,v 1.57 2024/03/17 20:10:52 jakllsch Exp $ */ /* * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ucycom.c,v 1.56 2022/10/26 23:50:28 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ucycom.c,v 1.57 2024/03/17 20:10:52 jakllsch Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -978,6 +978,7 @@ ucycom_intr(void *cookie, void *ibuf, u_ st = cp[0]; n = cp[1]; cp += 2; + n = uimin(n, 30); break; default:
CVS commit: src/sys/dev/usb
Module Name:src Committed By: jakllsch Date: Sun Mar 17 20:10:52 UTC 2024 Modified Files: src/sys/dev/usb: ucycom.c Log Message: Prevent errant ucycom-presenting device from causing up to 225 bytes of kernel memory following input buffer to leak to tty application. Probably not practically expolitable, but you never know. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/dev/usb/ucycom.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mrg Date: Fri Mar 8 07:05:02 UTC 2024 Modified Files: src/sys/dev/usb: ehcireg.h Log Message: give some anonymous structures names To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/dev/usb/ehcireg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mrg Date: Fri Mar 8 07:05:02 UTC 2024 Modified Files: src/sys/dev/usb: ehcireg.h Log Message: give some anonymous structures names To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/dev/usb/ehcireg.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/ehcireg.h diff -u src/sys/dev/usb/ehcireg.h:1.39 src/sys/dev/usb/ehcireg.h:1.40 --- src/sys/dev/usb/ehcireg.h:1.39 Tue Feb 6 23:57:41 2024 +++ src/sys/dev/usb/ehcireg.h Fri Mar 8 07:05:02 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ehcireg.h,v 1.39 2024/02/06 23:57:41 mrg Exp $ */ +/* $NetBSD: ehcireg.h,v 1.40 2024/03/08 07:05:02 mrg Exp $ */ /* * Copyright (c) 2001, 2004 The NetBSD Foundation, Inc. @@ -206,7 +206,7 @@ typedef uint32_t ehci_isoc_bufr_ptr_t; #define EHCI_ITD_ALIGN 32 #define EHCI_ITD_NUFRAMES USB_UFRAMES_PER_FRAME #define EHCI_ITD_NBUFFERS 7 -typedef struct { +typedef struct ehci_itd_t { volatile ehci_link_t itd_next; volatile ehci_isoc_trans_t itd_ctl[EHCI_ITD_NUFRAMES]; #define EHCI_ITD_STATUS_MASK __BITS(31,28) @@ -252,7 +252,7 @@ typedef struct { /* Split Transaction Isochronous Transfer Descriptor */ #define EHCI_SITD_ALIGN 32 -typedef struct { +typedef struct ehci_sitd_t { volatile ehci_link_t sitd_next; volatile uint32_t sitd_endp; #define EHCI_SITD_DIR_MASK __BIT(31) @@ -301,7 +301,7 @@ typedef struct { #define EHCI_QTD_NBUFFERS 5 #define EHCI_QTD_MAXTRANSFER (EHCI_QTD_NBUFFERS * EHCI_PAGE_SIZE) #define EHCI_QTD_ALIGN 32 -typedef struct { +typedef struct ehci_qtd_t { volatile ehci_link_t qtd_next; volatile ehci_link_t qtd_altnext; volatile uint32_t qtd_status; @@ -343,7 +343,7 @@ typedef struct { /* Queue Head */ #define EHCI_QH_ALIGN 32 -typedef struct { +typedef struct ehci_qh_t { volatile ehci_link_t qh_link; volatile uint32_t qh_endp; #define EHCI_QH_ADDR_MASK __BITS(6,0) /* endpoint addr */ @@ -405,7 +405,7 @@ typedef struct { /* Periodic Frame Span Traversal Node */ #define EHCI_FSTN_ALIGN 32 -typedef struct { +typedef struct ehci_fstn_t { volatile ehci_link_t fstn_link; volatile ehci_link_t fstn_back; } __aligned(EHCI_FSTN_ALIGN) ehci_fstn_t;
CVS commit: src/sys/dev/usb
Module Name:src Committed By: dholland Date: Wed Feb 28 21:52:40 UTC 2024 Modified Files: src/sys/dev/usb: usb_quirks.c usbdevs.h usbdevs_data.h Log Message: usbdevs: regen; usb_quirks.c: update to match Regen for additional Logitech B100, and update the UQ_ALWAYS_ON entry to refer to both device ids. To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.108 src/sys/dev/usb/usb_quirks.c cvs rdiff -u -r1.805 -r1.806 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/usb_quirks.c diff -u src/sys/dev/usb/usb_quirks.c:1.107 src/sys/dev/usb/usb_quirks.c:1.108 --- src/sys/dev/usb/usb_quirks.c:1.107 Sun May 14 23:58:35 2023 +++ src/sys/dev/usb/usb_quirks.c Wed Feb 28 21:52:40 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: usb_quirks.c,v 1.107 2023/05/14 23:58:35 pgoyette Exp $ */ +/* $NetBSD: usb_quirks.c,v 1.108 2024/02/28 21:52:40 dholland 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.107 2023/05/14 23:58:35 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb_quirks.c,v 1.108 2024/02/28 21:52:40 dholland Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -399,7 +399,9 @@ Static const struct usbd_quirk_entry { { UQ_ALWAYS_ON, NULL }}, { USB_VENDOR_PIXART, USB_PRODUCT_PIXART_RPIMOUSE, ANY, { UQ_ALWAYS_ON, NULL }}, - { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_B100, ANY, + { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_B100_1, ANY, + { UQ_ALWAYS_ON, NULL }}, + { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_B100_2, ANY, { UQ_ALWAYS_ON, NULL }}, { USB_VENDOR_LENOVO, USB_PRODUCT_LENOVO_OPTUSBMOUSE, ANY, { UQ_ALWAYS_ON, NULL }}, /* Index: src/sys/dev/usb/usbdevs.h diff -u src/sys/dev/usb/usbdevs.h:1.805 src/sys/dev/usb/usbdevs.h:1.806 --- src/sys/dev/usb/usbdevs.h:1.805 Sat Jan 13 15:22:40 2024 +++ src/sys/dev/usb/usbdevs.h Wed Feb 28 21:52:40 2024 @@ -1,10 +1,10 @@ -/* $NetBSD: usbdevs.h,v 1.805 2024/01/13 15:22:40 hgutch Exp $ */ +/* $NetBSD: usbdevs.h,v 1.806 2024/02/28 21:52:40 dholland Exp $ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: usbdevs,v 1.813 2024/01/13 14:42:14 hgutch Exp + * NetBSD: usbdevs,v 1.814 2024/02/28 21:50:51 dholland Exp */ /*- @@ -2204,7 +2204,8 @@ #define USB_PRODUCT_LOGITECH_USBPS2MOUSE 0xc00e /* USB-PS/2 Optical Mouse */ #define USB_PRODUCT_LOGITECH_MUV55A 0xc016 /* M-UV55a */ #define USB_PRODUCT_LOGITECH_UN58A 0xc030 /* iFeel Mouse */ -#define USB_PRODUCT_LOGITECH_B100 0xc077 /* B100 Optical Mouse */ +#define USB_PRODUCT_LOGITECH_B100_1 0xc05a /* B100 Optical Mouse */ +#define USB_PRODUCT_LOGITECH_B100_2 0xc077 /* B100 Optical Mouse */ #define USB_PRODUCT_LOGITECH_WMPAD 0xc208 /* WingMan GamePad Extreme */ #define USB_PRODUCT_LOGITECH_WMRPAD 0xc20a /* WingMan RumblePad */ #define USB_PRODUCT_LOGITECH_WMJOY 0xc281 /* WingMan Force joystick */ Index: src/sys/dev/usb/usbdevs_data.h diff -u src/sys/dev/usb/usbdevs_data.h:1.805 src/sys/dev/usb/usbdevs_data.h:1.806 --- src/sys/dev/usb/usbdevs_data.h:1.805 Sat Jan 13 15:22:40 2024 +++ src/sys/dev/usb/usbdevs_data.h Wed Feb 28 21:52:40 2024 @@ -1,10 +1,10 @@ -/* $NetBSD: usbdevs_data.h,v 1.805 2024/01/13 15:22:40 hgutch Exp $ */ +/* $NetBSD: usbdevs_data.h,v 1.806 2024/02/28 21:52:40 dholland Exp $ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: usbdevs,v 1.813 2024/01/13 14:42:14 hgutch Exp + * NetBSD: usbdevs,v 1.814 2024/02/28 21:50:51 dholland Exp */ /*- @@ -2903,7 +2903,9 @@ static const uint32_t usb_products[] = { 13531, 0, USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_UN58A, 13539, 6494, 0, - USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_B100, + USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_B100_1, + 13545, 3370, 6494, 0, + USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_B100_2, 13545, 3370, 6494, 0, USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_WMPAD, 13502, 10939, 13550, 0, @@ -5519,7 +5521,7 @@ static const char usb_words[] = { "." "Cambridge\0" /* 1 refs @ 3349 */ "Radio\0" /* 8 refs @ 3359 */ "Trek\0" /* 1 refs @ 3365 */ - "Optical\0" /* 9 refs @ 3370 */ + "Optical\0" /* 10 refs @ 3370 */ "ShanTou\0" /* 1 refs @ 3378 */ "MediaGear\0" /* 1 refs @ 3386 */ "Broadcom\0" /* 2 refs @ 3396 */ @@ -5926,7 +5928,7 @@ static const char usb_words[] = { "." "(Wellspring2/JIS)\0" /* 1 refs @ 6463 */ "mouse\0" /* 16 refs @ 6481 */ "Mighty\0" /* 2 refs @ 6487 */ - "Mouse\0" /* 18 refs @ 6494 */ + "Mouse\0" /* 19 refs @ 6494 */ "Trackpad\0" /* 3 refs @ 6500 */ "(Fountain)\0" /* 1 refs @ 6509 */ "(Geyser)\0" /* 1 refs @ 6520 */ @@ -6877,7 +6879,7 @@ static
CVS commit: src/sys/dev/usb
Module Name:src Committed By: dholland Date: Wed Feb 28 21:52:40 UTC 2024 Modified Files: src/sys/dev/usb: usb_quirks.c usbdevs.h usbdevs_data.h Log Message: usbdevs: regen; usb_quirks.c: update to match Regen for additional Logitech B100, and update the UQ_ALWAYS_ON entry to refer to both device ids. To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.108 src/sys/dev/usb/usb_quirks.c cvs rdiff -u -r1.805 -r1.806 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: src/sys/dev/usb
Module Name:src Committed By: dholland Date: Wed Feb 28 21:50:51 UTC 2024 Modified Files: src/sys/dev/usb: usbdevs Log Message: usbdevs: add another device id for LOGITECH B100. The mouse I'm looking at says "Logitech B100" on the back but has a different device id from the one already here. To generate a diff of this commit: cvs rdiff -u -r1.813 -r1.814 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.813 src/sys/dev/usb/usbdevs:1.814 --- src/sys/dev/usb/usbdevs:1.813 Sat Jan 13 14:42:14 2024 +++ src/sys/dev/usb/usbdevs Wed Feb 28 21:50:51 2024 @@ -1,4 +1,4 @@ -$NetBSD: usbdevs,v 1.813 2024/01/13 14:42:14 hgutch Exp $ +$NetBSD: usbdevs,v 1.814 2024/02/28 21:50:51 dholland Exp $ /*- * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. @@ -2197,7 +2197,8 @@ product LOGITECH BD58 0xc00c BD58 mouse product LOGITECH USBPS2MOUSE 0xc00e USB-PS/2 Optical Mouse product LOGITECH MUV55A 0xc016 M-UV55a product LOGITECH UN58A 0xc030 iFeel Mouse -product LOGITECH B100 0xc077 B100 Optical Mouse +product LOGITECH B100_1 0xc05a B100 Optical Mouse +product LOGITECH B100_2 0xc077 B100 Optical Mouse product LOGITECH WMPAD 0xc208 WingMan GamePad Extreme product LOGITECH WMRPAD 0xc20a WingMan RumblePad product LOGITECH WMJOY 0xc281 WingMan Force joystick
CVS commit: src/sys/dev/usb
Module Name:src Committed By: dholland Date: Wed Feb 28 21:50:51 UTC 2024 Modified Files: src/sys/dev/usb: usbdevs Log Message: usbdevs: add another device id for LOGITECH B100. The mouse I'm looking at says "Logitech B100" on the back but has a different device id from the one already here. To generate a diff of this commit: cvs rdiff -u -r1.813 -r1.814 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: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Wed Feb 28 20:18:13 UTC 2024 Modified Files: src/sys/dev/usb: if_urtwn.c Log Message: 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.108 -r1.109 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.108 src/sys/dev/usb/if_urtwn.c:1.109 --- src/sys/dev/usb/if_urtwn.c:1.108 Sat Jan 6 00:26:26 2024 +++ src/sys/dev/usb/if_urtwn.c Wed Feb 28 20:18:13 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: if_urtwn.c,v 1.108 2024/01/06 00:26:26 maya Exp $ */ +/* $NetBSD: if_urtwn.c,v 1.109 2024/02/28 20:18:13 riastradh 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.108 2024/01/06 00:26:26 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.109 2024/02/28 20:18:13 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -872,6 +872,24 @@ urtwn_tx_beacon(struct urtwn_softc *sc, } static void +urtwn_cmdq_invariants(struct urtwn_softc *sc) +{ + struct urtwn_host_cmd_ring *const ring = >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; @@ -903,7 +921,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); @@ -911,6 +933,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; } @@ -925,6 +951,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; URTWNHIST_FUNC(); @@ -933,19 +960,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: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Wed Feb 28 20:18:13 UTC 2024 Modified Files: src/sys/dev/usb: if_urtwn.c Log Message: 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.108 -r1.109 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: src/sys/dev/usb
Module Name:src Committed By: mrg Date: Tue Feb 6 23:57:41 UTC 2024 Modified Files: src/sys/dev/usb: ehci.c ehcireg.h Log Message: avoid different struct type problem. To generate a diff of this commit: cvs rdiff -u -r1.321 -r1.322 src/sys/dev/usb/ehci.c cvs rdiff -u -r1.38 -r1.39 src/sys/dev/usb/ehcireg.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/ehci.c diff -u src/sys/dev/usb/ehci.c:1.321 src/sys/dev/usb/ehci.c:1.322 --- src/sys/dev/usb/ehci.c:1.321 Mon Feb 5 23:04:18 2024 +++ src/sys/dev/usb/ehci.c Tue Feb 6 23:57:41 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ehci.c,v 1.321 2024/02/05 23:04:18 jmcneill Exp $ */ +/* $NetBSD: ehci.c,v 1.322 2024/02/06 23:57:41 mrg Exp $ */ /* * Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc. @@ -54,7 +54,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.321 2024/02/05 23:04:18 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.322 2024/02/06 23:57:41 mrg Exp $"); #include "ohci.h" #include "uhci.h" @@ -294,6 +294,7 @@ void ehci_dump(void); Static void ehci_dump_regs(ehci_softc_t *); Static void ehci_dump_sqtds(ehci_soft_qtd_t *); Static void ehci_dump_sqtd(ehci_soft_qtd_t *); +Static void ehci_dump_qh_qtd(struct ehci_qh_qtd_t *); Static void ehci_dump_qtd(ehci_qtd_t *); Static void ehci_dump_sqh(ehci_soft_qh_t *); Static void ehci_dump_sitd(struct ehci_soft_itd *); @@ -1755,6 +1756,24 @@ ehci_dump_sqtd(ehci_soft_qtd_t *sqtd) } Static void +ehci_dump_qh_qtd(struct ehci_qh_qtd_t *qh_qtd) +{ + ehci_qtd_t qtd = { + .qtd_next = qh_qtd->qtd_next, + .qtd_altnext = qh_qtd->qtd_altnext, + .qtd_status = qh_qtd->qtd_status, + }; + + /* Manually memcpy(), because of volatile. */ + for (unsigned i = 0; i < EHCI_QTD_NBUFFERS; i++) { + qtd.qtd_buffer[i] = qh_qtd->qtd_buffer[i]; + qtd.qtd_buffer_hi[i] = qh_qtd->qtd_buffer_hi[i]; + } + + ehci_dump_qtd(); +} + +Static void ehci_dump_qtd(ehci_qtd_t *qtd) { EHCIHIST_FUNC(); EHCIHIST_CALLED(); @@ -1830,7 +1849,7 @@ ehci_dump_sqh(ehci_soft_qh_t *sqh) link = le32toh(qh->qh_curqtd); ehci_dump_link(link, false); DPRINTFN(10, "Overlay qTD:", 0, 0, 0, 0); - ehci_dump_qtd(>qh_qtd); + ehci_dump_qh_qtd(>qh_qtd); usb_syncmem(>dma, sqh->offs, sizeof(sqh->qh), BUS_DMASYNC_PREREAD); Index: src/sys/dev/usb/ehcireg.h diff -u src/sys/dev/usb/ehcireg.h:1.38 src/sys/dev/usb/ehcireg.h:1.39 --- src/sys/dev/usb/ehcireg.h:1.38 Mon Feb 5 23:07:42 2024 +++ src/sys/dev/usb/ehcireg.h Tue Feb 6 23:57:41 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ehcireg.h,v 1.38 2024/02/05 23:07:42 jmcneill Exp $ */ +/* $NetBSD: ehcireg.h,v 1.39 2024/02/06 23:57:41 mrg Exp $ */ /* * Copyright (c) 2001, 2004 The NetBSD Foundation, Inc. @@ -394,7 +394,7 @@ typedef struct { * 32-byte aligned, so declare the fields instead of embedding * a ehci_qtd_t directly. */ - struct { + struct ehci_qh_qtd_t { volatile ehci_link_t qtd_next; volatile ehci_link_t qtd_altnext; volatile uint32_t qtd_status;
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mrg Date: Tue Feb 6 23:57:41 UTC 2024 Modified Files: src/sys/dev/usb: ehci.c ehcireg.h Log Message: avoid different struct type problem. To generate a diff of this commit: cvs rdiff -u -r1.321 -r1.322 src/sys/dev/usb/ehci.c cvs rdiff -u -r1.38 -r1.39 src/sys/dev/usb/ehcireg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: jmcneill Date: Mon Feb 5 23:07:42 UTC 2024 Modified Files: src/sys/dev/usb: ehcireg.h Log Message: Ensure proper alignment/padding of EHCI hardware descriptors. These descriptor structs are embedded in structs that contain additional context for software. With a non cache coherent device and non-padded descriptors, the device may issue a read/modify/write past the end of the descriptor, clobbering software state in the process. This was the root cause of multiple crashes on evbppc with a non cache coherent EHCI. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/dev/usb/ehcireg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: jmcneill Date: Mon Feb 5 23:07:42 UTC 2024 Modified Files: src/sys/dev/usb: ehcireg.h Log Message: Ensure proper alignment/padding of EHCI hardware descriptors. These descriptor structs are embedded in structs that contain additional context for software. With a non cache coherent device and non-padded descriptors, the device may issue a read/modify/write past the end of the descriptor, clobbering software state in the process. This was the root cause of multiple crashes on evbppc with a non cache coherent EHCI. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/dev/usb/ehcireg.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/ehcireg.h diff -u src/sys/dev/usb/ehcireg.h:1.37 src/sys/dev/usb/ehcireg.h:1.38 --- src/sys/dev/usb/ehcireg.h:1.37 Sat Apr 23 10:15:31 2016 +++ src/sys/dev/usb/ehcireg.h Mon Feb 5 23:07:42 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ehcireg.h,v 1.37 2016/04/23 10:15:31 skrll Exp $ */ +/* $NetBSD: ehcireg.h,v 1.38 2024/02/05 23:07:42 jmcneill Exp $ */ /* * Copyright (c) 2001, 2004 The NetBSD Foundation, Inc. @@ -203,6 +203,7 @@ typedef uint32_t ehci_isoc_trans_t; typedef uint32_t ehci_isoc_bufr_ptr_t; /* Isochronous Transfer Descriptor */ +#define EHCI_ITD_ALIGN 32 #define EHCI_ITD_NUFRAMES USB_UFRAMES_PER_FRAME #define EHCI_ITD_NBUFFERS 7 typedef struct { @@ -247,10 +248,10 @@ typedef struct { #define EHCI_ITD_GET_MULTI(x) __SHIFTOUT((x), EHCI_ITD_MULTI_MASK) #define EHCI_ITD_SET_MULTI(x) __SHIFTIN((x), EHCI_ITD_MULTI_MASK) volatile ehci_isoc_bufr_ptr_t itd_bufr_hi[EHCI_ITD_NBUFFERS]; -} ehci_itd_t; -#define EHCI_ITD_ALIGN 32 +} __aligned(EHCI_ITD_ALIGN) ehci_itd_t; /* Split Transaction Isochronous Transfer Descriptor */ +#define EHCI_SITD_ALIGN 32 typedef struct { volatile ehci_link_t sitd_next; volatile uint32_t sitd_endp; @@ -294,12 +295,12 @@ typedef struct { volatile ehci_link_t sitd_back; volatile uint32_t sitd_buffer_hi[EHCI_SITD_BUFFERS]; -} ehci_sitd_t; -#define EHCI_SITD_ALIGN 32 +} __aligned(EHCI_SITD_ALIGN) ehci_sitd_t; /* Queue Element Transfer Descriptor */ #define EHCI_QTD_NBUFFERS 5 #define EHCI_QTD_MAXTRANSFER (EHCI_QTD_NBUFFERS * EHCI_PAGE_SIZE) +#define EHCI_QTD_ALIGN 32 typedef struct { volatile ehci_link_t qtd_next; volatile ehci_link_t qtd_altnext; @@ -338,10 +339,10 @@ typedef struct { #define EHCI_QTD_SET_TOGGLE(x) __SHIFTIN((x), EHCI_QTD_TOGGLE_MASK) volatile ehci_physaddr_t qtd_buffer[EHCI_QTD_NBUFFERS]; volatile ehci_physaddr_t qtd_buffer_hi[EHCI_QTD_NBUFFERS]; -} ehci_qtd_t; -#define EHCI_QTD_ALIGN 32 +} __aligned(EHCI_QTD_ALIGN) ehci_qtd_t; /* Queue Head */ +#define EHCI_QH_ALIGN 32 typedef struct { volatile ehci_link_t qh_link; volatile uint32_t qh_endp; @@ -388,16 +389,26 @@ typedef struct { #define EHCI_QH_GET_MULT(x) __SHIFTOUT((x), EHCI_QH_MULTI_MASK) #define EHCI_QH_SET_MULT(x) __SHIFTIN((x), EHCI_QH_MULTI_MASK) volatile ehci_link_t qh_curqtd; - ehci_qtd_t qh_qtd; -} ehci_qh_t; -#define EHCI_QH_ALIGN 32 + /* + * The QH descriptor contains a TD overlay, but it is not + * 32-byte aligned, so declare the fields instead of embedding + * a ehci_qtd_t directly. + */ + struct { + volatile ehci_link_t qtd_next; + volatile ehci_link_t qtd_altnext; + volatile uint32_t qtd_status; + volatile ehci_physaddr_t qtd_buffer[EHCI_QTD_NBUFFERS]; + volatile ehci_physaddr_t qtd_buffer_hi[EHCI_QTD_NBUFFERS]; + } qh_qtd; +} __aligned(EHCI_QH_ALIGN) ehci_qh_t; /* Periodic Frame Span Traversal Node */ +#define EHCI_FSTN_ALIGN 32 typedef struct { volatile ehci_link_t fstn_link; volatile ehci_link_t fstn_back; -} ehci_fstn_t; -#define EHCI_FSTN_ALIGN 32 +} __aligned(EHCI_FSTN_ALIGN) ehci_fstn_t; /* Debug Port */ #define PCI_CAP_DEBUGPORT_OFFSET __BITS(28,16)
CVS commit: src/sys/dev/usb
Module Name:src Committed By: jmcneill Date: Mon Feb 5 23:04:18 UTC 2024 Modified Files: src/sys/dev/usb: ehci.c Log Message: Fix DMA sync flags in ehci_append_sqtd To generate a diff of this commit: cvs rdiff -u -r1.320 -r1.321 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: src/sys/dev/usb
Module Name:src Committed By: jmcneill Date: Mon Feb 5 23:04:18 UTC 2024 Modified Files: src/sys/dev/usb: ehci.c Log Message: Fix DMA sync flags in ehci_append_sqtd To generate a diff of this commit: cvs rdiff -u -r1.320 -r1.321 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.320 src/sys/dev/usb/ehci.c:1.321 --- src/sys/dev/usb/ehci.c:1.320 Sun Feb 4 05:43:06 2024 +++ src/sys/dev/usb/ehci.c Mon Feb 5 23:04:18 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ehci.c,v 1.320 2024/02/04 05:43:06 mrg Exp $ */ +/* $NetBSD: ehci.c,v 1.321 2024/02/05 23:04:18 jmcneill Exp $ */ /* * Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc. @@ -54,7 +54,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.320 2024/02/04 05:43:06 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.321 2024/02/05 23:04:18 jmcneill Exp $"); #include "ohci.h" #include "uhci.h" @@ -3065,7 +3065,7 @@ ehci_append_sqtd(ehci_soft_qtd_t *sqtd, prev->qtd.qtd_next = htole32(sqtd->physaddr); prev->qtd.qtd_altnext = prev->qtd.qtd_next; usb_syncmem(>dma, prev->offs, sizeof(prev->qtd), - BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD); + BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); } }
CVS commit: src/sys/dev/usb
Module Name:src Committed By: jmcneill Date: Sat Jan 20 21:09:28 UTC 2024 Modified Files: src/sys/dev/usb: usb.h Log Message: usb: increase USB_PORT_RESET_RECOVERY from 10ms to 20ms I changed this from 250ms to 10ms back in 2021 based on a similar FreeBSD change, but it seems to be a bit too aggressive for some platforms. To generate a diff of this commit: cvs rdiff -u -r1.123 -r1.124 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.123 src/sys/dev/usb/usb.h:1.124 --- src/sys/dev/usb/usb.h:1.123 Mon Jul 31 23:52:12 2023 +++ src/sys/dev/usb/usb.h Sat Jan 20 21:09:28 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: usb.h,v 1.123 2023/07/31 23:52:12 christos Exp $ */ +/* $NetBSD: usb.h,v 1.124 2024/01/20 21:09:28 jmcneill Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -778,7 +778,7 @@ typedef struct { /* Allow for marginal (i.e. non-conforming) devices. */ #define USB_PORT_RESET_DELAY 50 /* ms */ #define USB_PORT_ROOT_RESET_DELAY 250 /* ms */ -#define USB_PORT_RESET_RECOVERY 10 /* ms */ +#define USB_PORT_RESET_RECOVERY 20 /* ms */ #define USB_PORT_POWERUP_DELAY 300 /* ms */ #define USB_SET_ADDRESS_SETTLE 10 /* ms */ #define USB_RESUME_DELAY (50*5) /* ms */
CVS commit: src/sys/dev/usb
Module Name:src Committed By: jmcneill Date: Sat Jan 20 21:09:28 UTC 2024 Modified Files: src/sys/dev/usb: usb.h Log Message: usb: increase USB_PORT_RESET_RECOVERY from 10ms to 20ms I changed this from 250ms to 10ms back in 2021 based on a similar FreeBSD change, but it seems to be a bit too aggressive for some platforms. To generate a diff of this commit: cvs rdiff -u -r1.123 -r1.124 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: src/sys/dev/usb
Module Name:src Committed By: jmcneill Date: Sat Jan 20 00:51:29 UTC 2024 Modified Files: src/sys/dev/usb: ehcivar.h Log Message: ehci: add EHCIF_32BIT_ACCESS flag to force 32-bit MMIO To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/dev/usb/ehcivar.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/ehcivar.h diff -u src/sys/dev/usb/ehcivar.h:1.51 src/sys/dev/usb/ehcivar.h:1.52 --- src/sys/dev/usb/ehcivar.h:1.51 Sun Mar 13 11:29:21 2022 +++ src/sys/dev/usb/ehcivar.h Sat Jan 20 00:51:29 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ehcivar.h,v 1.51 2022/03/13 11:29:21 riastradh Exp $ */ +/* $NetBSD: ehcivar.h,v 1.52 2024/01/20 00:51:29 jmcneill Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -178,6 +178,7 @@ typedef struct ehci_softc { int sc_flags; /* misc flags */ #define EHCIF_DROPPED_INTR_WORKAROUND 0x01 #define EHCIF_ETTF 0x02 /* Emb. Transaction Translater func. */ +#define EHCIF_32BIT_ACCESS 0x04 /* 32-bit MMIO access req'd */ uint32_t sc_cmd; /* shadow of cmd reg during suspend */ @@ -235,17 +236,75 @@ typedef struct ehci_softc { int (*sc_vendor_port_status)(struct ehci_softc *, uint32_t, int); } ehci_softc_t; -#define EREAD1(sc, a) bus_space_read_1((sc)->iot, (sc)->ioh, (a)) -#define EREAD2(sc, a) bus_space_read_2((sc)->iot, (sc)->ioh, (a)) +static inline uint8_t +ehci_read_1(struct ehci_softc *sc, u_int offset) +{ + if (ISSET(sc->sc_flags, EHCIF_32BIT_ACCESS)) { + uint32_t val; + + val = bus_space_read_4(sc->iot, sc->ioh, offset & ~3); + return (val >> ((offset & 3) * NBBY)) & 0xff; + } else { + return bus_space_read_1(sc->iot, sc->ioh, offset); + } +} + +static inline uint16_t +ehci_read_2(struct ehci_softc *sc, u_int offset) +{ + if (ISSET(sc->sc_flags, EHCIF_32BIT_ACCESS)) { + uint32_t val; + + val = bus_space_read_4(sc->iot, sc->ioh, offset & ~3); + return (val >> ((offset & 3) * NBBY)) & 0x; + } else { + return bus_space_read_2(sc->iot, sc->ioh, offset); + } +} + +static inline void +ehci_write_1(struct ehci_softc *sc, u_int offset, uint8_t data) +{ + if (ISSET(sc->sc_flags, EHCIF_32BIT_ACCESS)) { + const uint32_t mask = 0xffU << ((offset & 3) * NBBY); + uint32_t val; + + val = bus_space_read_4(sc->iot, sc->ioh, offset & ~3); + val &= ~mask; + val |= __SHIFTIN(data, mask); + bus_space_write_4(sc->iot, sc->ioh, offset & ~3, val); + } else { + bus_space_write_1(sc->iot, sc->ioh, offset, data); + } +} + +static inline void +ehci_write_2(struct ehci_softc *sc, u_int offset, uint16_t data) +{ + if (ISSET(sc->sc_flags, EHCIF_32BIT_ACCESS)) { + const uint32_t mask = 0xU << ((offset & 3) * NBBY); + uint32_t val; + + val = bus_space_read_4(sc->iot, sc->ioh, offset & ~3); + val &= ~mask; + val |= __SHIFTIN(data, mask); + bus_space_write_4(sc->iot, sc->ioh, offset & ~3, val); + } else { + bus_space_write_2(sc->iot, sc->ioh, offset, data); + } +} + +#define EREAD1(sc, a) ehci_read_1((sc), (a)) +#define EREAD2(sc, a) ehci_read_2((sc), (a)) #define EREAD4(sc, a) bus_space_read_4((sc)->iot, (sc)->ioh, (a)) -#define EWRITE1(sc, a, x) bus_space_write_1((sc)->iot, (sc)->ioh, (a), (x)) -#define EWRITE2(sc, a, x) bus_space_write_2((sc)->iot, (sc)->ioh, (a), (x)) +#define EWRITE1(sc, a, x) ehci_write_1((sc), (a), (x)) +#define EWRITE2(sc, a, x) ehci_write_2((sc), (a), (x)) #define EWRITE4(sc, a, x) bus_space_write_4((sc)->iot, (sc)->ioh, (a), (x)) -#define EOREAD1(sc, a) bus_space_read_1((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a)) -#define EOREAD2(sc, a) bus_space_read_2((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a)) +#define EOREAD1(sc, a) ehci_read_1((sc), (sc)->sc_offs+(a)) +#define EOREAD2(sc, a) ehci_read_2((sc), (sc)->sc_offs+(a)) #define EOREAD4(sc, a) bus_space_read_4((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a)) -#define EOWRITE1(sc, a, x) bus_space_write_1((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a), (x)) -#define EOWRITE2(sc, a, x) bus_space_write_2((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a), (x)) +#define EOWRITE1(sc, a, x) ehci_write_1((sc), (sc)->sc_offs+(a), (x)) +#define EOWRITE2(sc, a, x) ehci_write_2((sc), (sc)->sc_offs+(a), (x)) #define EOWRITE4(sc, a, x) bus_space_write_4((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a), (x)) int ehci_init(ehci_softc_t *);
CVS commit: src/sys/dev/usb
Module Name:src Committed By: jmcneill Date: Sat Jan 20 00:51:29 UTC 2024 Modified Files: src/sys/dev/usb: ehcivar.h Log Message: ehci: add EHCIF_32BIT_ACCESS flag to force 32-bit MMIO To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/dev/usb/ehcivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: andvar Date: Sun Jan 14 12:53:41 UTC 2024 Modified Files: src/sys/dev/usb: uftdireg.h Log Message: s/asynchrounous/asynchronous/, s/assistence/assistance/ in comments. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/usb/uftdireg.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/uftdireg.h diff -u src/sys/dev/usb/uftdireg.h:1.11 src/sys/dev/usb/uftdireg.h:1.12 --- src/sys/dev/usb/uftdireg.h:1.11 Fri Sep 13 20:50:45 2019 +++ src/sys/dev/usb/uftdireg.h Sun Jan 14 12:53:41 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: uftdireg.h,v 1.11 2019/09/13 20:50:45 ryo Exp $ */ +/* $NetBSD: uftdireg.h,v 1.12 2024/01/14 12:53:41 andvar Exp $ */ /* * Definitions for the FTDI USB Single Port Serial Converter - @@ -8,7 +8,7 @@ * USB on the other. * * Thanx to FTDI (http://www.ftdichip.com) for so kindly providing details - * of the protocol required to talk to the device and ongoing assistence + * of the protocol required to talk to the device and ongoing assistance * during development. * * Bill Ryder - bry...@sgi.com of Silicon Graphics, Inc. is the original @@ -343,7 +343,7 @@ enum { */ /* FTDI_SIO_SET_BITMODE */ #define FTDI_BITMODE_RESET 0x00 /* UART mode */ -#define FTDI_BITMODE_BITBANG 0x01 /* asynchrounous bitbang mode */ +#define FTDI_BITMODE_BITBANG 0x01 /* asynchronous bitbang mode */ #define FTDI_BITMODE_MPSSE 0x02 /* MPSSE mode */ #define FTDI_BITMODE_SYNCBB 0x04 /* synchronous bitbang mode */ #define FTDI_BITMODE_MCU 0x08 /* MCU Host Bus Emulation mode */
CVS commit: src/sys/dev/usb
Module Name:src Committed By: andvar Date: Sun Jan 14 12:53:41 UTC 2024 Modified Files: src/sys/dev/usb: uftdireg.h Log Message: s/asynchrounous/asynchronous/, s/assistence/assistance/ in comments. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/usb/uftdireg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Sat Jan 13 18:22:13 UTC 2024 Modified Files: src/sys/dev/usb: usbdi.c Log Message: usbdi(9): Assert not polling in abort path. XXX Not sure if this is safe. To generate a diff of this commit: cvs rdiff -u -r1.249 -r1.250 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.249 src/sys/dev/usb/usbdi.c:1.250 --- src/sys/dev/usb/usbdi.c:1.249 Sat Jan 13 12:42:10 2024 +++ src/sys/dev/usb/usbdi.c Sat Jan 13 18:22:13 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi.c,v 1.249 2024/01/13 12:42:10 riastradh Exp $ */ +/* $NetBSD: usbdi.c,v 1.250 2024/01/13 18:22:13 riastradh Exp $ */ /* * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.249 2024/01/13 12:42:10 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.250 2024/01/13 18:22:13 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -417,11 +417,9 @@ usbd_transfer(struct usbd_xfer *xfer) * XXX For synchronous transfers this is fine. What to * do for asynchronous transfers? The callback is * never run, not even with status USBD_CANCELLED. - * - * XXX Does it make sense to abort while polling? */ - if (pipe->up_dev->ud_bus->ub_usepolling == 0) - usbd_unlock_pipe(pipe); + KASSERT(pipe->up_dev->ud_bus->ub_usepolling == 0); + usbd_unlock_pipe(pipe); USBHIST_LOG(usbdebug, "<- done xfer %#jx, aborting", (uintptr_t)xfer, 0, 0, 0); SDT_PROBE2(usb, device, xfer, done, xfer, USBD_CANCELLED); @@ -1036,6 +1034,7 @@ usbd_ar_pipe(struct usbd_pipe *pipe) ASSERT_SLEEPABLE(); KASSERT(mutex_owned(pipe->up_dev->ud_bus->ub_lock)); + KASSERT(pipe->up_dev->ud_bus->ub_usepolling == 0); /* * Allow only one thread at a time to abort the pipe, so we
CVS commit: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Sat Jan 13 18:22:13 UTC 2024 Modified Files: src/sys/dev/usb: usbdi.c Log Message: usbdi(9): Assert not polling in abort path. XXX Not sure if this is safe. To generate a diff of this commit: cvs rdiff -u -r1.249 -r1.250 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: src/sys/dev/usb
Module Name:src Committed By: hgutch Date: Sat Jan 13 15:26:36 UTC 2024 Modified Files: src/sys/dev/usb: ums.c Log Message: Add workaround for Microsoft Sculpt Wireless keyboard/mouse. >From M. Boerschig in PR 57845. To generate a diff of this commit: cvs rdiff -u -r1.104 -r1.105 src/sys/dev/usb/ums.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/ums.c diff -u src/sys/dev/usb/ums.c:1.104 src/sys/dev/usb/ums.c:1.105 --- src/sys/dev/usb/ums.c:1.104 Thu Jul 20 20:00:34 2023 +++ src/sys/dev/usb/ums.c Sat Jan 13 15:26:36 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ums.c,v 1.104 2023/07/20 20:00:34 mrg Exp $ */ +/* $NetBSD: ums.c,v 1.105 2024/01/13 15:26:36 hgutch Exp $ */ /* * Copyright (c) 1998, 2017 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ums.c,v 1.104 2023/07/20 20:00:34 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ums.c,v 1.105 2024/01/13 15:26:36 hgutch Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -224,6 +224,7 @@ ums_attach(device_t parent, device_t sel fixpos = 24; break; case USB_PRODUCT_MICROSOFT_24GHZ_XCVR80: + case USB_PRODUCT_MICROSOFT_24GHZ_XCVR90: fixpos = 40; woffset = sc->sc_ms.hidms_loc_z.size; break;
CVS commit: src/sys/dev/usb
Module Name:src Committed By: hgutch Date: Sat Jan 13 15:26:36 UTC 2024 Modified Files: src/sys/dev/usb: ums.c Log Message: Add workaround for Microsoft Sculpt Wireless keyboard/mouse. >From M. Boerschig in PR 57845. To generate a diff of this commit: cvs rdiff -u -r1.104 -r1.105 src/sys/dev/usb/ums.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: hgutch Date: Sat Jan 13 15:22:41 UTC 2024 Modified Files: src/sys/dev/usb: usbdevs.h usbdevs_data.h Log Message: Regen To generate a diff of this commit: cvs rdiff -u -r1.804 -r1.805 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: src/sys/dev/usb
Module Name:src Committed By: hgutch Date: Sat Jan 13 14:42:14 UTC 2024 Modified Files: src/sys/dev/usb: usbdevs Log Message: Add Microsoft Sculpt Wireless keyboard/mouse. >From M. Boerschig in PR 57845. To generate a diff of this commit: cvs rdiff -u -r1.812 -r1.813 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: src/sys/dev/usb
Module Name:src Committed By: hgutch Date: Sat Jan 13 14:42:14 UTC 2024 Modified Files: src/sys/dev/usb: usbdevs Log Message: Add Microsoft Sculpt Wireless keyboard/mouse. >From M. Boerschig in PR 57845. To generate a diff of this commit: cvs rdiff -u -r1.812 -r1.813 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.812 src/sys/dev/usb/usbdevs:1.813 --- src/sys/dev/usb/usbdevs:1.812 Sat Jan 6 00:24:07 2024 +++ src/sys/dev/usb/usbdevs Sat Jan 13 14:42:14 2024 @@ -1,4 +1,4 @@ -$NetBSD: usbdevs,v 1.812 2024/01/06 00:24:07 maya Exp $ +$NetBSD: usbdevs,v 1.813 2024/01/13 14:42:14 hgutch Exp $ /*- * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. @@ -2368,6 +2368,7 @@ product MICROSOFT 24GHZ_XCVR10 0x071d 2 product MICROSOFT 24GHZ_XCVR20 0x071f 2.4GHz Transceiver V2.0 product MICROSOFT 24GHZ_XCVR70 0x0745 2.4GHz Transceiver V7.0 product MICROSOFT 24GHZ_XCVR80 0x07b2 2.4GHz Transceiver V8.0 +product MICROSOFT 24GHZ_XCVR90 0x07a5 2.4GHz Transceiver V9.0 product MICROSOFT CM6000 0x077d Comfort Mouse 6000
CVS commit: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Sat Jan 13 12:42:10 UTC 2024 Modified Files: src/sys/dev/usb: usbdi.c Log Message: usbdi(9): Avoid taking locks in usbd_transfer while polling. PR kern/57783 XXX pullup-10 XXX pullup-9 XXX pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.248 -r1.249 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.248 src/sys/dev/usb/usbdi.c:1.249 --- src/sys/dev/usb/usbdi.c:1.248 Sat Jan 13 12:27:54 2024 +++ src/sys/dev/usb/usbdi.c Sat Jan 13 12:42:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi.c,v 1.248 2024/01/13 12:27:54 riastradh Exp $ */ +/* $NetBSD: usbdi.c,v 1.249 2024/01/13 12:42:10 riastradh Exp $ */ /* * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.248 2024/01/13 12:27:54 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.249 2024/01/13 12:42:10 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -410,14 +410,18 @@ usbd_transfer(struct usbd_xfer *xfer) } } - usbd_lock_pipe(pipe); + if (pipe->up_dev->ud_bus->ub_usepolling == 0) + usbd_lock_pipe(pipe); if (pipe->up_aborting) { /* * XXX For synchronous transfers this is fine. What to * do for asynchronous transfers? The callback is * never run, not even with status USBD_CANCELLED. + * + * XXX Does it make sense to abort while polling? */ - usbd_unlock_pipe(pipe); + if (pipe->up_dev->ud_bus->ub_usepolling == 0) + usbd_unlock_pipe(pipe); USBHIST_LOG(usbdebug, "<- done xfer %#jx, aborting", (uintptr_t)xfer, 0, 0, 0); SDT_PROBE2(usb, device, xfer, done, xfer, USBD_CANCELLED); @@ -443,7 +447,8 @@ usbd_transfer(struct usbd_xfer *xfer) } while (0); SDT_PROBE3(usb, device, pipe, transfer__done, pipe, xfer, err); - usbd_unlock_pipe(pipe); + if (pipe->up_dev->ud_bus->ub_usepolling == 0) + usbd_unlock_pipe(pipe); if (err != USBD_IN_PROGRESS && err) { /* @@ -453,7 +458,8 @@ usbd_transfer(struct usbd_xfer *xfer) */ USBHIST_LOG(usbdebug, "xfer failed: %jd, reinserting", err, 0, 0, 0); - usbd_lock_pipe(pipe); + if (pipe->up_dev->ud_bus->ub_usepolling == 0) + usbd_lock_pipe(pipe); SDT_PROBE1(usb, device, xfer, preabort, xfer); #ifdef DIAGNOSTIC xfer->ux_state = XFER_BUSY; @@ -461,7 +467,8 @@ usbd_transfer(struct usbd_xfer *xfer) SIMPLEQ_REMOVE_HEAD(>up_queue, ux_next); if (pipe->up_serialise) usbd_start_next(pipe); - usbd_unlock_pipe(pipe); + if (pipe->up_dev->ud_bus->ub_usepolling == 0) + usbd_unlock_pipe(pipe); } if (!(flags & USBD_SYNCHRONOUS)) { @@ -480,7 +487,8 @@ usbd_transfer(struct usbd_xfer *xfer) } /* Sync transfer, wait for completion. */ - usbd_lock_pipe(pipe); + if (pipe->up_dev->ud_bus->ub_usepolling == 0) + usbd_lock_pipe(pipe); while (!xfer->ux_done) { if (pipe->up_dev->ud_bus->ub_usepolling) panic("usbd_transfer: not done"); @@ -503,7 +511,8 @@ usbd_transfer(struct usbd_xfer *xfer) } err = xfer->ux_status; SDT_PROBE2(usb, device, xfer, done, xfer, err); - usbd_unlock_pipe(pipe); + if (pipe->up_dev->ud_bus->ub_usepolling == 0) + usbd_unlock_pipe(pipe); return err; }
CVS commit: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Sat Jan 13 12:42:10 UTC 2024 Modified Files: src/sys/dev/usb: usbdi.c Log Message: usbdi(9): Avoid taking locks in usbd_transfer while polling. PR kern/57783 XXX pullup-10 XXX pullup-9 XXX pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.248 -r1.249 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: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Sat Jan 13 12:27:54 UTC 2024 Modified Files: src/sys/dev/usb: usbdi.c Log Message: usbdi(9): Avoid calling ubm_softint with lock held and polling on. PR kern/57783 XXX pullup-10 XXX pullup-9 XXX pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.247 -r1.248 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: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Sat Jan 13 12:27:54 UTC 2024 Modified Files: src/sys/dev/usb: usbdi.c Log Message: usbdi(9): Avoid calling ubm_softint with lock held and polling on. PR kern/57783 XXX pullup-10 XXX pullup-9 XXX pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.247 -r1.248 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.247 src/sys/dev/usb/usbdi.c:1.248 --- src/sys/dev/usb/usbdi.c:1.247 Tue Sep 13 10:32:58 2022 +++ src/sys/dev/usb/usbdi.c Sat Jan 13 12:27:54 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi.c,v 1.247 2022/09/13 10:32:58 riastradh Exp $ */ +/* $NetBSD: usbdi.c,v 1.248 2024/01/13 12:27:54 riastradh Exp $ */ /* * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.247 2022/09/13 10:32:58 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.248 2024/01/13 12:27:54 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -1362,14 +1362,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: src/sys/dev/usb
Module Name:src Committed By: gutteridge Date: Thu Jan 11 00:31:02 UTC 2024 Modified Files: src/sys/dev/usb: if_athn_usb.c Log Message: if_athn_usb.c: provide the usual device information To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/sys/dev/usb/if_athn_usb.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_athn_usb.c diff -u src/sys/dev/usb/if_athn_usb.c:1.38 src/sys/dev/usb/if_athn_usb.c:1.39 --- src/sys/dev/usb/if_athn_usb.c:1.38 Sat Mar 14 02:35:33 2020 +++ src/sys/dev/usb/if_athn_usb.c Thu Jan 11 00:31:02 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: if_athn_usb.c,v 1.38 2020/03/14 02:35:33 christos Exp $ */ +/* $NetBSD: if_athn_usb.c,v 1.39 2024/01/11 00:31:02 gutteridge Exp $ */ /* $OpenBSD: if_athn_usb.c,v 1.12 2013/01/14 09:50:31 jsing Exp $ */ /*- @@ -22,7 +22,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.38 2020/03/14 02:35:33 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.39 2024/01/11 00:31:02 gutteridge Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -247,6 +247,7 @@ athn_usb_attach(device_t parent, device_ struct athn_usb_softc *usc; struct athn_softc *sc; struct usb_attach_arg *uaa; + char *devinfop; int error; usc = device_private(self); @@ -258,6 +259,10 @@ athn_usb_attach(device_t parent, device_ aprint_naive("\n"); aprint_normal("\n"); + devinfop = usbd_devinfo_alloc(usc->usc_udev, 0); + aprint_normal_dev(sc->sc_dev, "%s\n", devinfop); + usbd_devinfo_free(devinfop); + DPRINTFN(DBG_FN, sc, "\n"); usc->usc_init_state = ATHN_INIT_NONE;
CVS commit: src/sys/dev/usb
Module Name:src Committed By: gutteridge Date: Thu Jan 11 00:31:02 UTC 2024 Modified Files: src/sys/dev/usb: if_athn_usb.c Log Message: if_athn_usb.c: provide the usual device information To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/sys/dev/usb/if_athn_usb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: maya Date: Sat Jan 6 00:26:26 UTC 2024 Modified Files: src/sys/dev/usb: if_urtwn.c Log Message: Add Mercusys NW150US V2 USB support No changes needed, other than recognizing it as working. >From Daeil Lee in PR/57819 To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.108 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: src/sys/dev/usb
Module Name:src Committed By: maya Date: Sat Jan 6 00:26:26 UTC 2024 Modified Files: src/sys/dev/usb: if_urtwn.c Log Message: Add Mercusys NW150US V2 USB support No changes needed, other than recognizing it as working. >From Daeil Lee in PR/57819 To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.108 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.107 src/sys/dev/usb/if_urtwn.c:1.108 --- src/sys/dev/usb/if_urtwn.c:1.107 Tue Aug 1 07:04:16 2023 +++ src/sys/dev/usb/if_urtwn.c Sat Jan 6 00:26:26 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: if_urtwn.c,v 1.107 2023/08/01 07:04:16 mrg Exp $ */ +/* $NetBSD: if_urtwn.c,v 1.108 2024/01/06 00:26:26 maya 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.107 2023/08/01 07:04:16 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.108 2024/01/06 00:26:26 maya Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -215,6 +215,7 @@ static const struct urtwn_dev { /* URTWN_RTL8188E */ URTWN_RTL8188E_DEV(DLINK, DWA125D1), URTWN_RTL8188E_DEV(ELECOM, WDC150SU2M), + URTWN_RTL8188E_DEV(MERCUSYS, MW150USV2), URTWN_RTL8188E_DEV(REALTEK, RTL8188ETV), URTWN_RTL8188E_DEV(REALTEK, RTL8188EU), URTWN_RTL8188E_DEV(ABOCOM, RTL8188EU),
CVS commit: src/sys/dev/usb
Module Name:src Committed By: maya Date: Sat Jan 6 00:24:37 UTC 2024 Modified Files: src/sys/dev/usb: usbdevs.h usbdevs_data.h Log Message: Regen usbdevs To generate a diff of this commit: cvs rdiff -u -r1.803 -r1.804 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: src/sys/dev/usb
Module Name:src Committed By: maya Date: Sat Jan 6 00:24:07 UTC 2024 Modified Files: src/sys/dev/usb: usbdevs Log Message: Add Mercusys and Mercusys MW150USV2 >From Daeil Lee in PR/57819 To generate a diff of this commit: cvs rdiff -u -r1.811 -r1.812 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.811 src/sys/dev/usb/usbdevs:1.812 --- src/sys/dev/usb/usbdevs:1.811 Sun Dec 24 02:42:51 2023 +++ src/sys/dev/usb/usbdevs Sat Jan 6 00:24:07 2024 @@ -1,4 +1,4 @@ -$NetBSD: usbdevs,v 1.811 2023/12/24 02:42:51 gutteridge Exp $ +$NetBSD: usbdevs,v 1.812 2024/01/06 00:24:07 maya Exp $ /*- * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. @@ -586,6 +586,7 @@ vendor HIROSE 0x2631 Hirose Electric vendor ONEPLUS 0x2717 ONEPLUS vendor NHJ 0x2770 NHJ vendor PLANEX 0x2c02 Planex Communications +vendor MERCUSYS 0x2c4e Mercusys vendor VIDZMEDIA 0x3275 VidzMedia Pte Ltd vendor AEI 0x3334 AEI vendor HANK 0x3353 Hank Connection @@ -2288,6 +2289,9 @@ product MELCO WLIUCGNM 0x01a2 WLI-UC-GN product MELCO WLIUCGNM2T 0x01ee WLI-UC-GNM2T product MELCO WIU2300D 0x0241 WI-U2-300D +/* Mercusys products */ +product MERCUSYS MW150USV2 0x0102 MW150US V2 + /* Merlin products */ product MERLIN V620 0x1110 Merlin V620
CVS commit: src/sys/dev/usb
Module Name:src Committed By: maya Date: Sat Jan 6 00:24:07 UTC 2024 Modified Files: src/sys/dev/usb: usbdevs Log Message: Add Mercusys and Mercusys MW150USV2 >From Daeil Lee in PR/57819 To generate a diff of this commit: cvs rdiff -u -r1.811 -r1.812 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: src/sys/dev/usb
Module Name:src Committed By: gutteridge Date: Sun Dec 24 02:47:47 UTC 2023 Modified Files: src/sys/dev/usb: usbdevs.h usbdevs_data.h Log Message: usbdevs.h & usbdevs_data.h: regen To generate a diff of this commit: cvs rdiff -u -r1.802 -r1.803 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.802 src/sys/dev/usb/usbdevs.h:1.803 --- src/sys/dev/usb/usbdevs.h:1.802 Mon Dec 11 13:35:40 2023 +++ src/sys/dev/usb/usbdevs.h Sun Dec 24 02:47:47 2023 @@ -1,10 +1,10 @@ -/* $NetBSD: usbdevs.h,v 1.802 2023/12/11 13:35:40 mlelstv Exp $ */ +/* $NetBSD: usbdevs.h,v 1.803 2023/12/24 02:47:47 gutteridge Exp $ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: usbdevs,v 1.810 2023/12/11 13:33:35 mlelstv Exp + * NetBSD: usbdevs,v 1.811 2023/12/24 02:42:51 gutteridge Exp */ /*- @@ -2929,6 +2929,7 @@ #define USB_PRODUCT_REALTEK_RTL8713 0x8713 /* RTL8713 */ #define USB_PRODUCT_REALTEK_RTL8188CU_COMBO 0x8754 /* RTL8188CU */ #define USB_PRODUCT_REALTEK_RTL8192SU 0xc512 /* RTL8192SU */ +#define USB_PRODUCT_REALTEK_RTL8188FU 0xf179 /* RTL8188FU */ /* Research In Motion */ #define USB_PRODUCT_RIM_BLACKBERRY 0x0001 /* BlackBerry */ Index: src/sys/dev/usb/usbdevs_data.h diff -u src/sys/dev/usb/usbdevs_data.h:1.802 src/sys/dev/usb/usbdevs_data.h:1.803 --- src/sys/dev/usb/usbdevs_data.h:1.802 Mon Dec 11 13:35:40 2023 +++ src/sys/dev/usb/usbdevs_data.h Sun Dec 24 02:47:47 2023 @@ -1,10 +1,10 @@ -/* $NetBSD: usbdevs_data.h,v 1.802 2023/12/11 13:35:40 mlelstv Exp $ */ +/* $NetBSD: usbdevs_data.h,v 1.803 2023/12/24 02:47:47 gutteridge Exp $ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: usbdevs,v 1.810 2023/12/11 13:33:35 mlelstv Exp + * NetBSD: usbdevs,v 1.811 2023/12/24 02:42:51 gutteridge Exp */ /*- @@ -3968,162 +3968,164 @@ static const uint32_t usb_products[] = { 5293, 0, USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8192SU, 5431, 0, - USB_VENDOR_RIM, USB_PRODUCT_RIM_BLACKBERRY, + USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188FU, 17332, 0, + USB_VENDOR_RIM, USB_PRODUCT_RIM_BLACKBERRY, + 17342, 0, USB_VENDOR_RIM, USB_PRODUCT_RIM_BLACKBERRY_PEARL_DUAL, - 17332, 17343, 13673, 0, + 17342, 17353, 13673, 0, USB_VENDOR_RIM, USB_PRODUCT_RIM_BLACKBERRY_PEARL, - 17332, 17343, 0, + 17342, 17353, 0, USB_VENDOR_ROCKFIRE, USB_PRODUCT_ROCKFIRE_GAMEPAD, - 12974, 17349, 0, + 12974, 17359, 0, USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_UA100, - 17356, 4959, 7316, 17363, 0, + 17366, 4959, 7316, 17373, 0, USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_UM4, - 17367, 17372, 17363, 0, + 17377, 17382, 17373, 0, USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_SC8850, - 17377, 17386, 17394, 17400, 17372, 17407, 0, + 17387, 17396, 17404, 17410, 17382, 17417, 0, USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_U8, - 17414, 4959, 7316, 17363, 0, + 17424, 4959, 7316, 17373, 0, USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_UM2, - 17418, 17372, 17363, 0, + 17428, 17382, 17373, 0, USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_SC8820, - 17423, 17435, 17372, 17407, 0, + 17433, 17445, 17382, 17417, 0, USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_PC300, - 17443, 17372, 5993, 0, + 17453, 17382, 5993, 0, USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_UM1, - 17450, 17372, 17363, 0, + 17460, 17382, 17373, 0, USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_SK500, - 17423, 17455, 17372, 5993, 0, + 17433, 17465, 17382, 5993, 0, USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_SCD70, - 17462, 17372, 17407, 0, + 17472, 17382, 17417, 0, USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_UA3, - 17469, 17476, 4959, 17481, 17363, 0, + 17479, 17486, 4959, 17491, 17373, 0, USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_XV5050, - 17487, 17372, 17407, 0, + 17497, 17382, 17417, 0, USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_UM880N, - 17469, 17495, 17372, 17363, 17502, 0, + 17479, 17505, 17382, 17373, 17512, 0, USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_UM880G, - 17469, 17495, 17372, 17363, 17511, 0, + 17479, 17505, 17382, 17373, 17521, 0, USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_SD90, - 17469, 17521, 17527, 17400, 17372, 17407, 0, + 17479, 17531, 17537, 17410, 17382, 17417, 0, USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_UA1A, - 17533, 4959, 7316, 17363, 0, + 17543, 4959, 7316, 17373, 0, USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_UM550, - 17539, 17372, 17363, 0, + 17549, 17382, 17373, 0, USB_VENDOR_ROLAND, USB_PRODUCT_ROLAND_SD20, - 17546, 17372, 17407, 0, + 17556, 17382, 17417, 0, USB_VENDOR_ROLAND,
CVS commit: src/sys/dev/usb
Module Name:src Committed By: gutteridge Date: Sun Dec 24 02:47:47 UTC 2023 Modified Files: src/sys/dev/usb: usbdevs.h usbdevs_data.h Log Message: usbdevs.h & usbdevs_data.h: regen To generate a diff of this commit: cvs rdiff -u -r1.802 -r1.803 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: src/sys/dev/usb
Module Name:src Committed By: gutteridge Date: Sun Dec 24 02:42:51 UTC 2023 Modified Files: src/sys/dev/usb: usbdevs Log Message: usbdevs: add RTL8188FU To generate a diff of this commit: cvs rdiff -u -r1.810 -r1.811 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.810 src/sys/dev/usb/usbdevs:1.811 --- src/sys/dev/usb/usbdevs:1.810 Mon Dec 11 13:33:35 2023 +++ src/sys/dev/usb/usbdevs Sun Dec 24 02:42:51 2023 @@ -1,4 +1,4 @@ -$NetBSD: usbdevs,v 1.810 2023/12/11 13:33:35 mlelstv Exp $ +$NetBSD: usbdevs,v 1.811 2023/12/24 02:42:51 gutteridge Exp $ /*- * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. @@ -2922,6 +2922,7 @@ product REALTEK RTL8712 0x8712 RTL8712 product REALTEK RTL8713 0x8713 RTL8713 product REALTEK RTL8188CU_COMBO 0x8754 RTL8188CU product REALTEK RTL8192SU 0xc512 RTL8192SU +product REALTEK RTL8188FU 0xf179 RTL8188FU /* Research In Motion */ product RIM BLACKBERRY 0x0001 BlackBerry
CVS commit: src/sys/dev/usb
Module Name:src Committed By: gutteridge Date: Sun Dec 24 02:42:51 UTC 2023 Modified Files: src/sys/dev/usb: usbdevs Log Message: usbdevs: add RTL8188FU To generate a diff of this commit: cvs rdiff -u -r1.810 -r1.811 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: src/sys/dev/usb
Module Name:src Committed By: skrll Date: Tue Dec 19 08:19:42 UTC 2023 Modified Files: src/sys/dev/usb: if_axen.c Log Message: Use un_flags as pointed out by mrg@ thanks. To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/sys/dev/usb/if_axen.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_axen.c diff -u src/sys/dev/usb/if_axen.c:1.95 src/sys/dev/usb/if_axen.c:1.96 --- src/sys/dev/usb/if_axen.c:1.95 Tue Dec 19 07:05:36 2023 +++ src/sys/dev/usb/if_axen.c Tue Dec 19 08:19:42 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: if_axen.c,v 1.95 2023/12/19 07:05:36 skrll Exp $ */ +/* $NetBSD: if_axen.c,v 1.96 2023/12/19 08:19:42 skrll Exp $ */ /* $OpenBSD: if_axen.c,v 1.3 2013/10/21 10:10:22 yuo Exp $ */ /* @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.95 2023/12/19 07:05:36 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.96 2023/12/19 08:19:42 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -55,11 +55,6 @@ struct axen_type { #define AX179A 0x0004 /* AX88179A */ }; -struct axen_softc { - struct usbnet axen_un; - uint16_t axen_flags; -}; - /* * Various supported device vendors/products. */ @@ -76,7 +71,7 @@ static const struct axen_type axen_devs[ static int axen_match(device_t, cfdata_t, void *); static void axen_attach(device_t, device_t, void *); -CFATTACH_DECL_NEW(axen, sizeof(struct axen_softc), +CFATTACH_DECL_NEW(axen, sizeof(struct usbnet), axen_match, axen_attach, usbnet_detach, usbnet_activate); static int axen_cmd(struct usbnet *, int, int, int, void *); @@ -578,8 +573,7 @@ static void axen_attach(device_t parent, device_t self, void *aux) { USBNET_MII_DECL_DEFAULT(unm); - struct axen_softc * const sc = device_private(self); - struct usbnet * const un = >axen_un; + struct usbnet * const un = device_private(self); struct usb_attach_arg *uaa = aux; struct usbd_device *dev = uaa->uaa_device; usbd_status err; @@ -596,7 +590,7 @@ axen_attach(device_t parent, device_t se un->un_dev = self; un->un_udev = dev; - un->un_sc = sc; + un->un_sc = un; un->un_ops = _ops; un->un_rx_xfer_flags = USBD_SHORT_XFER_OK; un->un_tx_xfer_flags = USBD_FORCE_SHORT_XFER; @@ -610,11 +604,11 @@ axen_attach(device_t parent, device_t se return; } - sc->axen_flags = + un->un_flags = axen_lookup(uaa->uaa_vendor, uaa->uaa_product)->axen_flags; if (UGETW(usbd_get_device_descriptor(dev)->bcdDevice) == 0x0200) { - sc->axen_flags &= ~(AX178A | AX179); - sc->axen_flags |= AX179A; + un->un_flags &= ~(AX178A | AX179); + un->un_flags |= AX179A; } err = usbd_device2interface_handle(dev, AXEN_IFACE_IDX, >un_iface); @@ -678,7 +672,7 @@ axen_attach(device_t parent, device_t se #define AXEN_FW_MODE0x08 #define AXEN_FW_MODE_178A179 0x #define AXEN_FW_MODE_179A 0x0001 - if (sc->axen_flags & AX179A) { + if (un->un_flags & AX179A) { uint8_t bval = 0; /* len dir cmd */ int cmd = (1 << 12) | (1 << 8) | (AXEN_FW_MODE & 0x00FF); @@ -687,11 +681,11 @@ axen_attach(device_t parent, device_t se #endif /* An ASIX chip was detected. Inform the world. */ - if (sc->axen_flags & AX178A) + if (un->un_flags & AX178A) aprint_normal_dev(self, "AX88178a\n"); - else if (sc->axen_flags & AX179) + else if (un->un_flags & AX179) aprint_normal_dev(self, "AX88179\n"); - else if (sc->axen_flags & AX179A) + else if (un->un_flags & AX179A) aprint_normal_dev(self, "AX88179A\n"); else aprint_normal_dev(self, "(unknown)\n"); @@ -760,7 +754,6 @@ axen_csum_flags_rx(struct ifnet *ifp, ui static void axen_uno_rx_loop(struct usbnet *un, struct usbnet_chain *c, uint32_t total_len) { - struct axen_softc * const sc = usbnet_softc(un); struct ifnet *ifp = usbnet_ifp(un); uint8_t *buf = c->unc_buf; uint32_t rx_hdr, pkt_hdr; @@ -842,7 +835,7 @@ axen_uno_rx_loop(struct usbnet *un, stru goto nextpkt; } - if (sc->axen_flags & AX179A) { + if (un->un_flags & AX179A) { /* each 88179A frame doesn't contain FCS. */ usbnet_enqueue(un, buf + ETHER_ALIGN, pkt_len - 2, axen_csum_flags_rx(ifp, pkt_hdr), 0, 0);
CVS commit: src/sys/dev/usb
Module Name:src Committed By: skrll Date: Tue Dec 19 08:19:42 UTC 2023 Modified Files: src/sys/dev/usb: if_axen.c Log Message: Use un_flags as pointed out by mrg@ thanks. To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/sys/dev/usb/if_axen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
re: CVS commit: src/sys/dev/usb
"Nick Hudson" writes: > Module Name: src > Committed By: skrll > Date: Tue Dec 19 07:05:36 UTC 2023 > > Modified Files: > src/sys/dev/usb: if_axen.c > > Log Message: > Add support for AX88179A. From sc.dying on current-users. > > > To generate a diff of this commit: > cvs rdiff -u -r1.94 -r1.95 src/sys/dev/usb/if_axen.c cool. this can probably go back to not having a device softc by using un_flags: /* * This section is for driver to use, not touched by usbnet. */ unsignedun_flags; in struct usbnet, and axen_softc becomes just usbnet again. .mrg.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: skrll Date: Tue Dec 19 07:05:36 UTC 2023 Modified Files: src/sys/dev/usb: if_axen.c Log Message: Add support for AX88179A. From sc.dying on current-users. To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 src/sys/dev/usb/if_axen.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_axen.c diff -u src/sys/dev/usb/if_axen.c:1.94 src/sys/dev/usb/if_axen.c:1.95 --- src/sys/dev/usb/if_axen.c:1.94 Sat Aug 20 14:08:59 2022 +++ src/sys/dev/usb/if_axen.c Tue Dec 19 07:05:36 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: if_axen.c,v 1.94 2022/08/20 14:08:59 riastradh Exp $ */ +/* $NetBSD: if_axen.c,v 1.95 2023/12/19 07:05:36 skrll Exp $ */ /* $OpenBSD: if_axen.c,v 1.3 2013/10/21 10:10:22 yuo Exp $ */ /* @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.94 2022/08/20 14:08:59 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.95 2023/12/19 07:05:36 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -52,6 +52,12 @@ struct axen_type { uint16_t axen_flags; #define AX178A 0x0001 /* AX88178a */ #define AX179 0x0002 /* AX88179 */ +#define AX179A 0x0004 /* AX88179A */ +}; + +struct axen_softc { + struct usbnet axen_un; + uint16_t axen_flags; }; /* @@ -70,7 +76,7 @@ static const struct axen_type axen_devs[ static int axen_match(device_t, cfdata_t, void *); static void axen_attach(device_t, device_t, void *); -CFATTACH_DECL_NEW(axen, sizeof(struct usbnet), +CFATTACH_DECL_NEW(axen, sizeof(struct axen_softc), axen_match, axen_attach, usbnet_detach, usbnet_activate); static int axen_cmd(struct usbnet *, int, int, int, void *); @@ -572,14 +578,14 @@ static void axen_attach(device_t parent, device_t self, void *aux) { USBNET_MII_DECL_DEFAULT(unm); - struct usbnet * const un = device_private(self); + struct axen_softc * const sc = device_private(self); + struct usbnet * const un = >axen_un; struct usb_attach_arg *uaa = aux; struct usbd_device *dev = uaa->uaa_device; usbd_status err; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; char *devinfop; - uint16_t axen_flags; int i; aprint_naive("\n"); @@ -590,7 +596,7 @@ axen_attach(device_t parent, device_t se un->un_dev = self; un->un_udev = dev; - un->un_sc = un; + un->un_sc = sc; un->un_ops = _ops; un->un_rx_xfer_flags = USBD_SHORT_XFER_OK; un->un_tx_xfer_flags = USBD_FORCE_SHORT_XFER; @@ -604,7 +610,12 @@ axen_attach(device_t parent, device_t se return; } - axen_flags = axen_lookup(uaa->uaa_vendor, uaa->uaa_product)->axen_flags; + sc->axen_flags = + axen_lookup(uaa->uaa_vendor, uaa->uaa_product)->axen_flags; + if (UGETW(usbd_get_device_descriptor(dev)->bcdDevice) == 0x0200) { + sc->axen_flags &= ~(AX178A | AX179); + sc->axen_flags |= AX179A; + } err = usbd_device2interface_handle(dev, AXEN_IFACE_IDX, >un_iface); if (err) { @@ -663,11 +674,25 @@ axen_attach(device_t parent, device_t se axen_ax88179_init(un); +#if 0 +#define AXEN_FW_MODE0x08 +#define AXEN_FW_MODE_178A179 0x +#define AXEN_FW_MODE_179A 0x0001 + if (sc->axen_flags & AX179A) { + uint8_t bval = 0; + /* len dir cmd */ + int cmd = (1 << 12) | (1 << 8) | (AXEN_FW_MODE & 0x00FF); + axen_cmd(un, cmd, 1, AXEN_FW_MODE_178A179, ); + } +#endif + /* An ASIX chip was detected. Inform the world. */ - if (axen_flags & AX178A) + if (sc->axen_flags & AX178A) aprint_normal_dev(self, "AX88178a\n"); - else if (axen_flags & AX179) + else if (sc->axen_flags & AX179) aprint_normal_dev(self, "AX88179\n"); + else if (sc->axen_flags & AX179A) + aprint_normal_dev(self, "AX88179A\n"); else aprint_normal_dev(self, "(unknown)\n"); @@ -735,6 +760,7 @@ axen_csum_flags_rx(struct ifnet *ifp, ui static void axen_uno_rx_loop(struct usbnet *un, struct usbnet_chain *c, uint32_t total_len) { + struct axen_softc * const sc = usbnet_softc(un); struct ifnet *ifp = usbnet_ifp(un); uint8_t *buf = c->unc_buf; uint32_t rx_hdr, pkt_hdr; @@ -752,7 +778,7 @@ axen_uno_rx_loop(struct usbnet *un, stru /* * buffer map * [packet #0]...[packet #n][pkt hdr#0]..[pkt hdr#n][recv_hdr] - * each packet has 0x as psuedo header.. + * each packet has 0x as pseudo header.. */ hdr_p = (uint32_t *)(buf + total_len - sizeof(uint32_t)); rx_hdr = le32toh(*hdr_p); @@ -789,7 +815,7 @@ axen_uno_rx_loop(struct usbnet *un, stru if (pkt_count) rnd_add_uint32(usbnet_rndsrc(un), pkt_count); - do { + while (pkt_count > 0) { if ((buf[0] != 0xee) || (buf[1] != 0xee)) { aprint_error_dev(un->un_dev, "invalid buffer(pkt#%d), continue\n", pkt_count); @@ -803,6 +829,9 @@ axen_uno_rx_loop(struct usbnet *un, stru ("%s: rxeof: packet#%d, pkt_hdr 0x%08x, pkt_len %zu\n", device_xname(un->un_dev), pkt_count, pkt_hdr, pkt_len)); + if (pkt_len < sizeof(struct ether_header) + ETHER_ALIGN)
CVS commit: src/sys/dev/usb
Module Name:src Committed By: skrll Date: Tue Dec 19 07:05:36 UTC 2023 Modified Files: src/sys/dev/usb: if_axen.c Log Message: Add support for AX88179A. From sc.dying on current-users. To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 src/sys/dev/usb/if_axen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Mon Dec 11 13:35:40 UTC 2023 Modified Files: src/sys/dev/usb: usbdevs.h usbdevs_data.h Log Message: Regen To generate a diff of this commit: cvs rdiff -u -r1.801 -r1.802 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.801 src/sys/dev/usb/usbdevs.h:1.802 --- src/sys/dev/usb/usbdevs.h:1.801 Thu Sep 7 20:04:18 2023 +++ src/sys/dev/usb/usbdevs.h Mon Dec 11 13:35:40 2023 @@ -1,10 +1,10 @@ -/* $NetBSD: usbdevs.h,v 1.801 2023/09/07 20:04:18 ad Exp $ */ +/* $NetBSD: usbdevs.h,v 1.802 2023/12/11 13:35:40 mlelstv Exp $ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: usbdevs,v 1.808 2023/05/14 22:30:13 pgoyette Exp + * NetBSD: usbdevs,v 1.810 2023/12/11 13:33:35 mlelstv Exp */ /*- @@ -2902,6 +2902,7 @@ #define USB_PRODUCT_REALTEK_RTL8151 0x8151 /* RTL8151 PNA */ #define USB_PRODUCT_REALTEK_RTL8152 0x8152 /* RTL8152 */ #define USB_PRODUCT_REALTEK_RTL8153 0x8153 /* RTL8153 */ +#define USB_PRODUCT_REALTEK_RTL8156 0x8156 /* RTL8156 */ #define USB_PRODUCT_REALTEK_RTL8188CE_0 0x8170 /* RTL8188CE */ #define USB_PRODUCT_REALTEK_RTL8171 0x8171 /* RTL8171 */ #define USB_PRODUCT_REALTEK_RTL8172 0x8172 /* RTL8172 */ Index: src/sys/dev/usb/usbdevs_data.h diff -u src/sys/dev/usb/usbdevs_data.h:1.801 src/sys/dev/usb/usbdevs_data.h:1.802 --- src/sys/dev/usb/usbdevs_data.h:1.801 Thu Sep 7 20:04:18 2023 +++ src/sys/dev/usb/usbdevs_data.h Mon Dec 11 13:35:40 2023 @@ -1,10 +1,10 @@ -/* $NetBSD: usbdevs_data.h,v 1.801 2023/09/07 20:04:18 ad Exp $ */ +/* $NetBSD: usbdevs_data.h,v 1.802 2023/12/11 13:35:40 mlelstv Exp $ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: usbdevs,v 1.808 2023/05/14 22:30:13 pgoyette Exp + * NetBSD: usbdevs,v 1.810 2023/12/11 13:33:35 mlelstv Exp */ /*- @@ -3914,20 +3914,22 @@ static const uint32_t usb_products[] = { 17221, 0, USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8153, 17229, 0, + USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8156, + 17237, 0, USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CE_0, 7357, 0, USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8171, - 17237, 0, - USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8172, 17245, 0, - USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8173, + USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8172, 17253, 0, - USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8174, + USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8173, 17261, 0, + USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8174, + 17269, 0, USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CU_0, 5293, 0, USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8191CU, - 17269, 0, + 17277, 0, USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8192CU, 5273, 0, USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188EU, @@ -3937,7 +3939,7 @@ static const uint32_t usb_products[] = { USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CU_2, 5293, 0, USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8192CE, - 17279, 0, + 17287, 0, USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188RU, 17177, 0, USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CE_1, @@ -3947,181 +3949,181 @@ static const uint32_t usb_products[] = { USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8187, 8936, 0, USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8187B_0, - 17289, 0, + 17297, 0, USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CUS, 7504, 0, USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8192EU, - 17298, 0, + 17306, 0, USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CU_3, 5293, 0, USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8187B_1, - 17289, 0, + 17297, 0, USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8187B_2, - 17289, 0, + 17297, 0, USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8712, - 17308, 0, - USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8713, 17316, 0, + USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8713, + 17324, 0, USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CU_COMBO, 5293, 0, USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8192SU, 5431, 0, USB_VENDOR_RIM, USB_PRODUCT_RIM_BLACKBERRY, - 17324, 0, + 17332, 0, USB_VENDOR_RIM, USB_PRODUCT_RIM_BLACKBERRY_PEARL_DUAL, - 17324, 17335, 13673, 0, + 17332, 17343, 13673, 0, USB_VENDOR_RIM, USB_PRODUCT_RIM_BLACKBERRY_PEARL, - 17324, 17335, 0, + 17332, 17343, 0, USB_VENDOR_ROCKFIRE, USB_PRODUCT_ROCKFIRE_GAMEPAD, - 12974, 17341, 0, + 12974, 17349, 0, USB_VENDOR_ROLAND,
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Mon Dec 11 13:35:40 UTC 2023 Modified Files: src/sys/dev/usb: usbdevs.h usbdevs_data.h Log Message: Regen To generate a diff of this commit: cvs rdiff -u -r1.801 -r1.802 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: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Mon Dec 11 13:33:35 UTC 2023 Modified Files: src/sys/dev/usb: usbdevs Log Message: Add RTL8156 To generate a diff of this commit: cvs rdiff -u -r1.809 -r1.810 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.809 src/sys/dev/usb/usbdevs:1.810 --- src/sys/dev/usb/usbdevs:1.809 Thu Sep 7 20:04:18 2023 +++ src/sys/dev/usb/usbdevs Mon Dec 11 13:33:35 2023 @@ -1,4 +1,4 @@ -$NetBSD: usbdevs,v 1.809 2023/09/07 20:04:18 ad Exp $ +$NetBSD: usbdevs,v 1.810 2023/12/11 13:33:35 mlelstv Exp $ /*- * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. @@ -2895,6 +2895,7 @@ product REALTEK RTL8150L 0x8150 RTL8150L product REALTEK RTL8151 0x8151 RTL8151 PNA product REALTEK RTL8152 0x8152 RTL8152 product REALTEK RTL8153 0x8153 RTL8153 +product REALTEK RTL8156 0x8156 RTL8156 product REALTEK RTL8188CE_0 0x8170 RTL8188CE product REALTEK RTL8171 0x8171 RTL8171 product REALTEK RTL8172 0x8172 RTL8172
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Mon Dec 11 13:33:35 UTC 2023 Modified Files: src/sys/dev/usb: usbdevs Log Message: Add RTL8156 To generate a diff of this commit: cvs rdiff -u -r1.809 -r1.810 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: src/sys/dev/usb
Module Name:src Committed By: hannken Date: Mon Nov 6 12:16:52 UTC 2023 Modified Files: src/sys/dev/usb: ugen.c Log Message: Undo the DPRINTFN part of the last commit. It breaks i386 at least when KERNHIST_LOG casts the pointer to uintmax_t. Kernel ALL/i386 compiles again. To generate a diff of this commit: cvs rdiff -u -r1.174 -r1.175 src/sys/dev/usb/ugen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: hannken Date: Mon Nov 6 12:16:52 UTC 2023 Modified Files: src/sys/dev/usb: ugen.c Log Message: Undo the DPRINTFN part of the last commit. It breaks i386 at least when KERNHIST_LOG casts the pointer to uintmax_t. Kernel ALL/i386 compiles again. To generate a diff of this commit: cvs rdiff -u -r1.174 -r1.175 src/sys/dev/usb/ugen.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/ugen.c diff -u src/sys/dev/usb/ugen.c:1.174 src/sys/dev/usb/ugen.c:1.175 --- src/sys/dev/usb/ugen.c:1.174 Tue Oct 10 10:58:03 2023 +++ src/sys/dev/usb/ugen.c Mon Nov 6 12:16:52 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ugen.c,v 1.174 2023/10/10 10:58:03 simonb Exp $ */ +/* $NetBSD: ugen.c,v 1.175 2023/11/06 12:16:52 hannken Exp $ */ /* * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.174 2023/10/10 10:58:03 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.175 2023/11/06 12:16:52 hannken Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -1346,8 +1346,8 @@ ugenintr(struct usbd_xfer *xfer, void *a usbd_get_xfer_status(xfer, NULL, NULL, , NULL); ibuf = sce->ibuf; - DPRINTFN(5, "xfer=%p status=%d count=%d", - xfer, status, count, 0); + DPRINTFN(5, "xfer=%#jx status=%d count=%d", + (uintptr_t)xfer, status, count, 0); DPRINTFN(5, " data = %02x %02x %02x", ibuf[0], ibuf[1], ibuf[2], 0);
CVS commit: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Sat Oct 28 21:18:32 UTC 2023 Modified Files: src/sys/dev/usb: ehci.c Log Message: ehci(4): Fix bug causing missed wakeups since ehci.c 1.308. For reasons beyond me now, I used cv_signal on the same cv that is used to wait for the doorbell to be available _and_ to wait for the host controller to acknowledge the doorbell. Which means when the host controller acknowledges the doorbell, we might wake some thread waiting for the doorbell to be available -- and leave the thread waiting for the doorbell acknowledgment hanging indefinitely. PR port-i386/57662 XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.318 -r1.319 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.318 src/sys/dev/usb/ehci.c:1.319 --- src/sys/dev/usb/ehci.c:1.318 Sat Oct 28 21:18:15 2023 +++ src/sys/dev/usb/ehci.c Sat Oct 28 21:18:31 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ehci.c,v 1.318 2023/10/28 21:18:15 riastradh Exp $ */ +/* $NetBSD: ehci.c,v 1.319 2023/10/28 21:18:31 riastradh Exp $ */ /* * Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc. @@ -54,7 +54,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.318 2023/10/28 21:18:15 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.319 2023/10/28 21:18:31 riastradh Exp $"); #include "ohci.h" #include "uhci.h" @@ -826,7 +826,7 @@ ehci_doorbell(void *addr) if (sc->sc_doorbelllwp == NULL) DPRINTF("spurious doorbell interrupt", 0, 0, 0, 0); sc->sc_doorbelllwp = NULL; - cv_signal(>sc_doorbell); + cv_broadcast(>sc_doorbell); mutex_exit(>sc_lock); } @@ -2279,7 +2279,7 @@ ehci_sync_hc(ehci_softc_t *sc) now = getticks(); if (now - starttime >= delta) { sc->sc_doorbelllwp = NULL; - cv_signal(>sc_doorbell); + cv_broadcast(>sc_doorbell); DPRINTF("doorbell timeout", 0, 0, 0, 0); #ifdef DIAGNOSTIC /* XXX DIAGNOSTIC abuse, do this differently */ printf("ehci_sync_hc: timed out\n");
CVS commit: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Sat Oct 28 21:18:32 UTC 2023 Modified Files: src/sys/dev/usb: ehci.c Log Message: ehci(4): Fix bug causing missed wakeups since ehci.c 1.308. For reasons beyond me now, I used cv_signal on the same cv that is used to wait for the doorbell to be available _and_ to wait for the host controller to acknowledge the doorbell. Which means when the host controller acknowledges the doorbell, we might wake some thread waiting for the doorbell to be available -- and leave the thread waiting for the doorbell acknowledgment hanging indefinitely. PR port-i386/57662 XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.318 -r1.319 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: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Sat Oct 28 21:18:15 UTC 2023 Modified Files: src/sys/dev/usb: ehci.c Log Message: ehci(4): Fix cv_timedwait loop in ehci_sync_hc. Stop when now - starttime >= delta, i.e., when at least delta ticks have elapsed since the start, not when endtime - now > delta, i.e., more than delta ticks _remain_ to sleep, which is never going to happen (except on arithmetic overflow). As is, what will happen in the case that should time out is that we wake up after delta ticks, and find now = getticks() is exactly endtime, so we retry cv_timedwait with timo=(endtime - now)=0 which means sleep indefinitely with no timeout as if with cv_wait. PR port-i386/57662 XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.317 -r1.318 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.317 src/sys/dev/usb/ehci.c:1.318 --- src/sys/dev/usb/ehci.c:1.317 Sun Jul 30 12:17:02 2023 +++ src/sys/dev/usb/ehci.c Sat Oct 28 21:18:15 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ehci.c,v 1.317 2023/07/30 12:17:02 skrll Exp $ */ +/* $NetBSD: ehci.c,v 1.318 2023/10/28 21:18:15 riastradh Exp $ */ /* * Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc. @@ -54,7 +54,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.317 2023/07/30 12:17:02 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.318 2023/10/28 21:18:15 riastradh Exp $"); #include "ohci.h" #include "uhci.h" @@ -2277,7 +2277,7 @@ ehci_sync_hc(ehci_softc_t *sc) */ while (sc->sc_doorbelllwp == curlwp) { now = getticks(); - if (endtime - now > delta) { + if (now - starttime >= delta) { sc->sc_doorbelllwp = NULL; cv_signal(>sc_doorbell); DPRINTF("doorbell timeout", 0, 0, 0, 0);
CVS commit: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Sat Oct 28 21:18:15 UTC 2023 Modified Files: src/sys/dev/usb: ehci.c Log Message: ehci(4): Fix cv_timedwait loop in ehci_sync_hc. Stop when now - starttime >= delta, i.e., when at least delta ticks have elapsed since the start, not when endtime - now > delta, i.e., more than delta ticks _remain_ to sleep, which is never going to happen (except on arithmetic overflow). As is, what will happen in the case that should time out is that we wake up after delta ticks, and find now = getticks() is exactly endtime, so we retry cv_timedwait with timo=(endtime - now)=0 which means sleep indefinitely with no timeout as if with cv_wait. PR port-i386/57662 XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.317 -r1.318 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: src/sys/dev/usb
Module Name:src Committed By: simonb Date: Tue Oct 10 10:58:03 UTC 2023 Modified Files: src/sys/dev/usb: ugen.c Log Message: Debug printf tidy up, KNF comma,space nits. To generate a diff of this commit: cvs rdiff -u -r1.173 -r1.174 src/sys/dev/usb/ugen.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/ugen.c diff -u src/sys/dev/usb/ugen.c:1.173 src/sys/dev/usb/ugen.c:1.174 --- src/sys/dev/usb/ugen.c:1.173 Mon Jul 31 17:41:18 2023 +++ src/sys/dev/usb/ugen.c Tue Oct 10 10:58:03 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ugen.c,v 1.173 2023/07/31 17:41:18 christos Exp $ */ +/* $NetBSD: ugen.c,v 1.174 2023/10/10 10:58:03 simonb Exp $ */ /* * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.173 2023/07/31 17:41:18 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.174 2023/10/10 10:58:03 simonb Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -529,7 +529,7 @@ ugen_set_config(struct ugen_softc *sc, i if (err) goto out; for (endptno = 0; endptno < nendpt; endptno++) { - ed = usbd_interface2endpoint_descriptor(iface,endptno); + ed = usbd_interface2endpoint_descriptor(iface, endptno); KASSERT(ed != NULL); endpt = ed->bEndpointAddress; dir = UE_GET_DIR(endpt) == UE_DIR_IN ? IN : OUT; @@ -1346,8 +1346,8 @@ ugenintr(struct usbd_xfer *xfer, void *a usbd_get_xfer_status(xfer, NULL, NULL, , NULL); ibuf = sce->ibuf; - DPRINTFN(5, "xfer=%#jx status=%d count=%d", - (uintptr_t)xfer, status, count, 0); + DPRINTFN(5, "xfer=%p status=%d count=%d", + xfer, status, count, 0); DPRINTFN(5, " data = %02x %02x %02x", ibuf[0], ibuf[1], ibuf[2], 0); @@ -1595,7 +1595,7 @@ ugen_set_interface(struct ugen_softc *sc ugen_clear_endpoints(sc); for (endptno = 0; endptno < nendpt; endptno++) { - ed = usbd_interface2endpoint_descriptor(iface,endptno); + ed = usbd_interface2endpoint_descriptor(iface, endptno); KASSERT(ed != NULL); endpt = ed->bEndpointAddress; dir = UE_GET_DIR(endpt) == UE_DIR_IN ? IN : OUT;
CVS commit: src/sys/dev/usb
Module Name:src Committed By: simonb Date: Tue Oct 10 10:58:03 UTC 2023 Modified Files: src/sys/dev/usb: ugen.c Log Message: Debug printf tidy up, KNF comma,space nits. To generate a diff of this commit: cvs rdiff -u -r1.173 -r1.174 src/sys/dev/usb/ugen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Mon Oct 9 17:44:33 UTC 2023 Modified Files: src/sys/dev/usb: usbnet.c Log Message: usbnet(9): Fix typo in comment. No functional change intended. PR kern/57645 XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.118 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.117 src/sys/dev/usb/usbnet.c:1.118 --- src/sys/dev/usb/usbnet.c:1.117 Mon Oct 9 17:43:01 2023 +++ src/sys/dev/usb/usbnet.c Mon Oct 9 17:44:33 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: usbnet.c,v 1.117 2023/10/09 17:43:01 riastradh Exp $ */ +/* $NetBSD: usbnet.c,v 1.118 2023/10/09 17:44:33 riastradh Exp $ */ /* * Copyright (c) 2019 Matthew R. Green @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.117 2023/10/09 17:43:01 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.118 2023/10/09 17:44:33 riastradh Exp $"); #include #include @@ -1030,7 +1030,7 @@ usbnet_ifflags_cb(struct ethercom *ec) /* * Otherwise, cache the flags change so we can read the flags - * under uno_mcastlock for multicast updates in SIOCADDMULTI or + * under unp_mcastlock for multicast updates in SIOCADDMULTI or * SIOCDELMULTI without IFNET_LOCK. */ mutex_enter(>unp_mcastlock);
CVS commit: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Mon Oct 9 17:44:33 UTC 2023 Modified Files: src/sys/dev/usb: usbnet.c Log Message: usbnet(9): Fix typo in comment. No functional change intended. PR kern/57645 XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.118 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: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Mon Oct 9 17:43:01 UTC 2023 Modified Files: src/sys/dev/usb: usbnet.c Log Message: usbnet(9): On if_init, stop/init if IFF_RUNNING -- not noop. ether_ioctl(9) relies on this to reinitialize an interface when a flags change returns ENETRESET. We can't just reprogram the hardware multicast filter because some drivers have logic in if_init that's conditional on IFF_PROMISC; perhaps we can reduce the cost of this if we can change those drivers to do it in uno_mcast but that requires some analysis to determine. PR kern/57645 XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.116 -r1.117 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.116 src/sys/dev/usb/usbnet.c:1.117 --- src/sys/dev/usb/usbnet.c:1.116 Mon Oct 9 17:42:09 2023 +++ src/sys/dev/usb/usbnet.c Mon Oct 9 17:43:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: usbnet.c,v 1.116 2023/10/09 17:42:09 riastradh Exp $ */ +/* $NetBSD: usbnet.c,v 1.117 2023/10/09 17:43:01 riastradh Exp $ */ /* * Copyright (c) 2019 Matthew R. Green @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.116 2023/10/09 17:42:09 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.117 2023/10/09 17:43:01 riastradh Exp $"); #include #include @@ -1130,6 +1130,7 @@ usbnet_stop(struct usbnet *un, struct if USBNETHIST_FUNC(); USBNETHIST_CALLED(); KASSERTMSG(IFNET_LOCKED(ifp), "%s", ifp->if_xname); + KASSERTMSG(ifp->if_flags & IFF_RUNNING, "%s", ifp->if_xname); /* * For drivers with hardware multicast filter update callbacks: @@ -1320,14 +1321,17 @@ usbnet_if_init(struct ifnet *ifp) return EIO; /* - * If we're already running, nothing to do. + * If we're already running, stop the interface first -- we're + * reinitializing it. * - * XXX This should be an assertion, but it may require some - * analysis -- and possibly some tweaking -- of sys/net to - * ensure. + * XXX Grody for sys/net to call if_init to reinitialize. This + * should be an assertion, not a branch, but it will require + * some tweaking of sys/net to avoid. See also the comment in + * usbnet_ifflags_cb about if_init vs uno_mcast on reinitalize. */ if (ifp->if_flags & IFF_RUNNING) - return 0; + usbnet_stop(un, ifp, /*disable*/1/*XXX???*/); + KASSERTMSG((ifp->if_flags & IFF_RUNNING) == 0, "%s", ifp->if_xname); error = uno_init(un, ifp); if (error)
CVS commit: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Mon Oct 9 17:43:01 UTC 2023 Modified Files: src/sys/dev/usb: usbnet.c Log Message: usbnet(9): On if_init, stop/init if IFF_RUNNING -- not noop. ether_ioctl(9) relies on this to reinitialize an interface when a flags change returns ENETRESET. We can't just reprogram the hardware multicast filter because some drivers have logic in if_init that's conditional on IFF_PROMISC; perhaps we can reduce the cost of this if we can change those drivers to do it in uno_mcast but that requires some analysis to determine. PR kern/57645 XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.116 -r1.117 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: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Mon Oct 9 17:42:09 UTC 2023 Modified Files: src/sys/dev/usb: usbnet.c Log Message: usbnet(9): Fix sense of conditional in usbnet_ifflags_cb. This appears to have been mistranscribed in revision 1.1 of usbnet.c. PR kern/57645 XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.115 -r1.116 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.115 src/sys/dev/usb/usbnet.c:1.116 --- src/sys/dev/usb/usbnet.c:1.115 Mon Oct 9 17:42:00 2023 +++ src/sys/dev/usb/usbnet.c Mon Oct 9 17:42:09 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: usbnet.c,v 1.115 2023/10/09 17:42:00 riastradh Exp $ */ +/* $NetBSD: usbnet.c,v 1.116 2023/10/09 17:42:09 riastradh Exp $ */ /* * Copyright (c) 2019 Matthew R. Green @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.115 2023/10/09 17:42:00 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.116 2023/10/09 17:42:09 riastradh Exp $"); #include #include @@ -1016,34 +1016,43 @@ usbnet_ifflags_cb(struct ethercom *ec) struct ifnet *ifp = >ec_if; struct usbnet *un = ifp->if_softc; struct usbnet_private * const unp = un->un_pri; - int rv = 0; KASSERTMSG(IFNET_LOCKED(ifp), "%s", ifp->if_xname); const u_short changed = ifp->if_flags ^ unp->unp_if_flags; - if ((changed & ~(IFF_CANTCHANGE | IFF_DEBUG)) == 0) { - mutex_enter(>unp_mcastlock); - unp->unp_if_flags = ifp->if_flags; - mutex_exit(>unp_mcastlock); - /* - * XXX Can we just do uno_mcast synchronously here - * instead of resetting the whole interface? - * - * Not yet, because some usbnet drivers (e.g., aue(4)) - * initialize the hardware differently in uno_init - * depending on IFF_PROMISC. But some (again, aue(4)) - * _also_ need to know whether IFF_PROMISC is set in - * uno_mcast and do something different with it there. - * Maybe the logic can be unified, but it will require - * an audit and testing of all the usbnet drivers. - */ - if (changed & IFF_PROMISC) - rv = ENETRESET; - } else { - rv = ENETRESET; - } - return rv; + /* + * If any user-settable flags have changed other than + * IFF_DEBUG, just reset the interface. + */ + if ((changed & ~(IFF_CANTCHANGE | IFF_DEBUG)) != 0) + return ENETRESET; + + /* + * Otherwise, cache the flags change so we can read the flags + * under uno_mcastlock for multicast updates in SIOCADDMULTI or + * SIOCDELMULTI without IFNET_LOCK. + */ + mutex_enter(>unp_mcastlock); + unp->unp_if_flags = ifp->if_flags; + mutex_exit(>unp_mcastlock); + + /* + * If we're switching on or off promiscuous mode, reprogram the + * hardware multicast filter now. + * + * XXX Actually, reset the interface, because some usbnet + * drivers (e.g., aue(4)) initialize the hardware differently + * in uno_init depending on IFF_PROMISC. But some (again, + * aue(4)) _also_ need to know whether IFF_PROMISC is set in + * uno_mcast and do something different with it there. Maybe + * the logic can be unified, but it will require an audit and + * testing of all the usbnet drivers. + */ + if (changed & IFF_PROMISC) + return ENETRESET; + + return 0; } bool
CVS commit: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Mon Oct 9 17:42:09 UTC 2023 Modified Files: src/sys/dev/usb: usbnet.c Log Message: usbnet(9): Fix sense of conditional in usbnet_ifflags_cb. This appears to have been mistranscribed in revision 1.1 of usbnet.c. PR kern/57645 XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.115 -r1.116 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: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Mon Oct 9 17:42:00 UTC 2023 Modified Files: src/sys/dev/usb: usbnet.c Log Message: usbnet(9): Make sure unp->unp_if_flags is initialized on init. usbnet_ifflags_cb is only called if the flags change while up and running. (XXX Maybe it should be called in other circumstances too so there's only one path here?) Out of paranoia, clear the cache on stop. PR kern/57645 XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.114 -r1.115 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.114 src/sys/dev/usb/usbnet.c:1.115 --- src/sys/dev/usb/usbnet.c:1.114 Sat Jul 15 21:41:26 2023 +++ src/sys/dev/usb/usbnet.c Mon Oct 9 17:42:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: usbnet.c,v 1.114 2023/07/15 21:41:26 andvar Exp $ */ +/* $NetBSD: usbnet.c,v 1.115 2023/10/09 17:42:00 riastradh Exp $ */ /* * Copyright (c) 2019 Matthew R. Green @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.114 2023/07/15 21:41:26 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.115 2023/10/09 17:42:00 riastradh Exp $"); #include #include @@ -867,6 +867,8 @@ usbnet_init_rx_tx(struct usbnet * const */ if (un->un_ops->uno_mcast) { mutex_enter(>unp_mcastlock); + KASSERTMSG(!unp->unp_mcastactive, "%s", ifp->if_xname); + unp->unp_if_flags = ifp->if_flags; (*un->un_ops->uno_mcast)(ifp); unp->unp_mcastactive = true; mutex_exit(>unp_mcastlock); @@ -1000,6 +1002,13 @@ usbnet_media_upd(struct ifnet *ifp) /* ioctl */ +/* + * usbnet_ifflags_cb(ec) + * + * Called by if_ethersubr when interface flags change + * (SIOCSIFFLAGS), or ethernet capabilities change + * (SIOCSETHERCAP), on a running interface. + */ static int usbnet_ifflags_cb(struct ethercom *ec) { @@ -1120,7 +1129,9 @@ usbnet_stop(struct usbnet *un, struct if */ if (un->un_ops->uno_mcast) { mutex_enter(>unp_mcastlock); + KASSERTMSG(unp->unp_mcastactive, "%p", ifp->if_xname); unp->unp_mcastactive = false; + unp->unp_if_flags = 0; mutex_exit(>unp_mcastlock); }
CVS commit: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Mon Oct 9 17:42:00 UTC 2023 Modified Files: src/sys/dev/usb: usbnet.c Log Message: usbnet(9): Make sure unp->unp_if_flags is initialized on init. usbnet_ifflags_cb is only called if the flags change while up and running. (XXX Maybe it should be called in other circumstances too so there's only one path here?) Out of paranoia, clear the cache on stop. PR kern/57645 XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.114 -r1.115 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: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Mon Oct 9 11:28:05 UTC 2023 Modified Files: src/sys/dev/usb: if_ure.c Log Message: ure(4): Set all bits, not no bits, in multicast filter for promisc. This was lost in revision 1.40. PR kern/57648 XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 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.58 src/sys/dev/usb/if_ure.c:1.59 --- src/sys/dev/usb/if_ure.c:1.58 Fri Sep 16 07:34:36 2022 +++ src/sys/dev/usb/if_ure.c Mon Oct 9 11:28:05 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ure.c,v 1.58 2022/09/16 07:34:36 msaitoh Exp $ */ +/* $NetBSD: if_ure.c,v 1.59 2023/10/09 11:28:05 riastradh 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.58 2022/09/16 07:34:36 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.59 2023/10/09 11:28:05 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -358,6 +358,7 @@ ure_uno_mcast(struct ifnet *ifp) /* run promisc. mode */ rxmode |= URE_RCR_AM; /* ??? */ rxmode |= URE_RCR_AAP; + mchash[0] = mchash[1] = 0x; goto update; } ec->ec_flags &= ~ETHER_F_ALLMULTI;
CVS commit: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Mon Oct 9 11:28:05 UTC 2023 Modified Files: src/sys/dev/usb: if_ure.c Log Message: ure(4): Set all bits, not no bits, in multicast filter for promisc. This was lost in revision 1.40. PR kern/57648 XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 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: src/sys/dev/usb
Module Name:src Committed By: skrll Date: Sun Oct 1 06:55:27 UTC 2023 Modified Files: src/sys/dev/usb: if_urndis.c Log Message: Apply the new diff from kern/55273 urndis(4) error "could not find data bulk in/out" without CDC union descriptor Fallback to the interface association descriptor if no CDC Union Descriptor is found. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/dev/usb/if_urndis.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: skrll Date: Sun Oct 1 06:55:27 UTC 2023 Modified Files: src/sys/dev/usb: if_urndis.c Log Message: Apply the new diff from kern/55273 urndis(4) error "could not find data bulk in/out" without CDC union descriptor Fallback to the interface association descriptor if no CDC Union Descriptor is found. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/dev/usb/if_urndis.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/if_urndis.c diff -u src/sys/dev/usb/if_urndis.c:1.48 src/sys/dev/usb/if_urndis.c:1.49 --- src/sys/dev/usb/if_urndis.c:1.48 Sat Feb 11 22:42:49 2023 +++ src/sys/dev/usb/if_urndis.c Sun Oct 1 06:55:27 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: if_urndis.c,v 1.48 2023/02/11 22:42:49 nia Exp $ */ +/* $NetBSD: if_urndis.c,v 1.49 2023/10/01 06:55:27 skrll Exp $ */ /* $OpenBSD: if_urndis.c,v 1.31 2011/07/03 15:47:17 matthew Exp $ */ /* @@ -21,7 +21,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.48 2023/02/11 22:42:49 nia Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.49 2023/10/01 06:55:27 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -901,8 +901,9 @@ urndis_attach(device_t parent, device_t struct usbd_interface *iface_ctl; const usb_cdc_union_descriptor_t *ud; const usb_cdc_header_descriptor_t *desc; + const usb_interface_assoc_descriptor_t *ad; usbd_desc_iter_t iter; - int if_ctl, if_data; + int if_ctl, if_data, if_data_ia; int i, j, altcnt; void*buf; size_t bufsz; @@ -934,10 +935,23 @@ urndis_attach(device_t parent, device_t if_ctl = id->bInterfaceNumber; sc->sc_ifaceno_ctl = if_ctl; if_data = -1; + if_data_ia = -1; + /* + * Use a matching Interface Association Descriptor + * as a fallback if no CDC Union Descriptor is found. + */ usb_desc_iter_init(un->un_udev, ); while ((desc = (const void *)usb_desc_iter_next()) != NULL) { - + if (desc->bDescriptorType == UDESC_INTERFACE_ASSOC) { + if (desc->bLength < sizeof(*ad)) +continue; + ad = (const usb_interface_assoc_descriptor_t *)desc; + if (ad->bFirstInterface == if_ctl && + ad->bInterfaceCount > 1) +if_data_ia = if_ctl + 1; + continue; + } if (desc->bDescriptorType != UDESC_CS_INTERFACE) { continue; } @@ -950,6 +964,8 @@ urndis_attach(device_t parent, device_t break; } } + if (if_data == -1 && if_data_ia != -1) + if_data = if_data_ia; if (if_data == -1) { DPRINTF(("urndis_attach: no union interface\n"));
CVS commit: src/sys/dev/usb
Module Name:src Committed By: ad Date: Thu Sep 7 20:04:18 UTC 2023 Modified Files: src/sys/dev/usb: usbdevs usbdevs.h usbdevs_data.h Log Message: Add USB device TOPPING DX3 Pro. To generate a diff of this commit: cvs rdiff -u -r1.808 -r1.809 src/sys/dev/usb/usbdevs cvs rdiff -u -r1.800 -r1.801 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: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Sat Sep 2 17:43:17 UTC 2023 Modified Files: src/sys/dev/usb: ukbd.c Log Message: ukbd(4): Sort includes. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.163 -r1.164 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.163 src/sys/dev/usb/ukbd.c:1.164 --- src/sys/dev/usb/ukbd.c:1.163 Sat Sep 2 17:42:47 2023 +++ src/sys/dev/usb/ukbd.c Sat Sep 2 17:43:16 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ukbd.c,v 1.163 2023/09/02 17:42:47 riastradh Exp $*/ +/* $NetBSD: ukbd.c,v 1.164 2023/09/02 17:43:16 riastradh Exp $*/ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.163 2023/09/02 17:42:47 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.164 2023/09/02 17:43:16 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -47,28 +47,29 @@ __KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.1 #endif /* _KERNEL_OPT */ #include -#include + #include -#include #include -#include #include -#include +#include +#include +#include #include +#include +#include #include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include -#include -#include -#include -#include -#include +#include #include #include
CVS commit: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Sat Sep 2 17:43:17 UTC 2023 Modified Files: src/sys/dev/usb: ukbd.c Log Message: ukbd(4): Sort includes. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.163 -r1.164 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: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Sat Sep 2 17:42:47 UTC 2023 Modified Files: src/sys/dev/usb: ukbd.c Log Message: ukbd(4): Fix ordering in ukbd_cnpollc exit. This is probably an MP-safety issue waiting to happen, but let's at least make the wind and unwind sequences mirror images. To generate a diff of this commit: cvs rdiff -u -r1.162 -r1.163 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.162 src/sys/dev/usb/ukbd.c:1.163 --- src/sys/dev/usb/ukbd.c:1.162 Tue Jan 10 18:20:10 2023 +++ src/sys/dev/usb/ukbd.c Sat Sep 2 17:42:47 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ukbd.c,v 1.162 2023/01/10 18:20:10 mrg Exp $*/ +/* $NetBSD: ukbd.c,v 1.163 2023/09/02 17:42:47 riastradh Exp $*/ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.162 2023/01/10 18:20:10 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.163 2023/09/02 17:42:47 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1055,11 +1055,12 @@ ukbd_cnpollc(void *v, int on) if (on) { sc->sc_spl = splusb(); pollenter++; - } else { - splx(sc->sc_spl); - pollenter--; } usbd_set_polling(dev, on); + if (!on) { + pollenter--; + splx(sc->sc_spl); + } } int
CVS commit: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Sat Sep 2 17:42:47 UTC 2023 Modified Files: src/sys/dev/usb: ukbd.c Log Message: ukbd(4): Fix ordering in ukbd_cnpollc exit. This is probably an MP-safety issue waiting to happen, but let's at least make the wind and unwind sequences mirror images. To generate a diff of this commit: cvs rdiff -u -r1.162 -r1.163 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: src/sys/dev/usb
Module Name:src Committed By: andvar Date: Mon Aug 14 21:17:08 UTC 2023 Modified Files: src/sys/dev/usb: uaudio.c Log Message: s/streadming/streaming/ in debug message. To generate a diff of this commit: cvs rdiff -u -r1.181 -r1.182 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: src/sys/dev/usb
Module Name:src Committed By: andvar Date: Mon Aug 14 21:17:08 UTC 2023 Modified Files: src/sys/dev/usb: uaudio.c Log Message: s/streadming/streaming/ in debug message. To generate a diff of this commit: cvs rdiff -u -r1.181 -r1.182 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.181 src/sys/dev/usb/uaudio.c:1.182 --- src/sys/dev/usb/uaudio.c:1.181 Sun Apr 30 08:35:52 2023 +++ src/sys/dev/usb/uaudio.c Mon Aug 14 21:17:08 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uaudio.c,v 1.181 2023/04/30 08:35:52 mlelstv Exp $ */ +/* $NetBSD: uaudio.c,v 1.182 2023/08/14 21:17:08 andvar Exp $ */ /* * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.181 2023/04/30 08:35:52 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.182 2023/08/14 21:17:08 andvar Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -2197,7 +2197,7 @@ uaudio_process_as(struct uaudio_softc *s if (sed != NULL) goto ignore; sed = (const struct usb_audio_streaming_endpoint_descriptor *) desc; -DPRINTF(" streadming_endpoint: offset=%d bLength=%d\n", *offsp, sed->bLength); +DPRINTF(" streaming_endpoint: offset=%d bLength=%d\n", *offsp, sed->bLength); break; default: goto ignore;
CVS commit: src/sys/dev/usb
Module Name:src Committed By: manu Date: Fri Aug 4 13:25:18 UTC 2023 Modified Files: src/sys/dev/usb: umodeswitch.c Log Message: 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.5 -r1.6 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.5 src/sys/dev/usb/umodeswitch.c:1.6 --- src/sys/dev/usb/umodeswitch.c:1.5 Sat Feb 15 02:14:02 2020 +++ src/sys/dev/usb/umodeswitch.c Fri Aug 4 13:25:17 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: umodeswitch.c,v 1.5 2020/02/15 02:14:02 manu Exp $ */ +/* $NetBSD: umodeswitch.c,v 1.6 2023/08/04 13:25:17 manu Exp $ */ /*- * Copyright (c) 2009, 2017 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: umodeswitch.c,v 1.5 2020/02/15 02:14:02 manu Exp $"); +__KERNEL_RCSID(0, "$NetBSD: umodeswitch.c,v 1.6 2023/08/04 13:25:17 manu 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;