Module Name: src Committed By: riastradh Date: Thu Mar 3 06:04:31 UTC 2022
Modified Files: src/sys/arch/mips/adm5120/dev: ahci.c src/sys/dev/ic: sl811hs.c src/sys/dev/usb: ehci.c motg.c ohci.c uhci.c usbdi.c usbdivar.h usbroothub.c vhci.c xhci.c src/sys/external/bsd/dwc2: dwc2.c src/sys/rump/dev/lib/libugenhc: ugenhc.c Log Message: usb: Factor usb_insert_transfer out of upm_transfer and make private. Almost every upm_transfer function starts with: mutex_enter(&sc->sc_lock); err = usb_insert_transfer(xfer); mutex_exit(&sc->sc_lock); if (err) return err; Some of them have debug messages sprinkled in here too, or assert that err == USBD_NORMAL_COMPLETION (alternative is USBD_IN_PROGRESS, only for pipes with up_running or up_serialise, presumably not applicable for these types of pipes). Some of them also assert xfer->ux_status == USBD_NOT_STARTED, which is guaranteed on entry and preserved by usb_insert_transer. Exceptions: - arch/mips/adm5120/dev/ahci.c ahci_device_isoc_transfer just returns USBD_NORMAL_COMPLETION, but I'm pretty sure this is and always has been broken anyway, so won't make anything worse (if anything, might make it better...) - external/bsd/dwc2/dwc2.c dwc2_device_bulk_transfer and dwc2_device_isoc_transfer _also_ issue dwc2_device_start(xfer) under the lock. This is probably a better way to do it, but let's do it uniformly across all HCIs at once. - rump/dev/lib/libugenhc/ugenhc.c rumpusb_device_bulk_transfer sometimes returns USBD_IN_PROGRESS _without_ queueing the transfer, in the !rump_threads case. Not really sure how this is supposed to work... If it actually breaks anything, we can figure it out. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/arch/mips/adm5120/dev/ahci.c cvs rdiff -u -r1.108 -r1.109 src/sys/dev/ic/sl811hs.c cvs rdiff -u -r1.302 -r1.303 src/sys/dev/usb/ehci.c cvs rdiff -u -r1.37 -r1.38 src/sys/dev/usb/motg.c cvs rdiff -u -r1.318 -r1.319 src/sys/dev/usb/ohci.c cvs rdiff -u -r1.308 -r1.309 src/sys/dev/usb/uhci.c cvs rdiff -u -r1.222 -r1.223 src/sys/dev/usb/usbdi.c cvs rdiff -u -r1.131 -r1.132 src/sys/dev/usb/usbdivar.h cvs rdiff -u -r1.11 -r1.12 src/sys/dev/usb/usbroothub.c cvs rdiff -u -r1.23 -r1.24 src/sys/dev/usb/vhci.c cvs rdiff -u -r1.155 -r1.156 src/sys/dev/usb/xhci.c cvs rdiff -u -r1.77 -r1.78 src/sys/external/bsd/dwc2/dwc2.c cvs rdiff -u -r1.29 -r1.30 src/sys/rump/dev/lib/libugenhc/ugenhc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.