| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: usbdi.c,v 1.190 2020/02/12 15:59:59 riastradh Exp $ */ | | 1 | /* $NetBSD: usbdi.c,v 1.191 2020/02/12 16:00:17 riastradh Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Lennart Augustsson (lennart@augustsson.net) at | | 8 | * by Lennart Augustsson (lennart@augustsson.net) at |
9 | * Carlstedt Research & Technology, Matthew R. Green (mrg@eterna.com.au), | | 9 | * Carlstedt Research & Technology, Matthew R. Green (mrg@eterna.com.au), |
10 | * and Nick Hudson. | | 10 | * and Nick Hudson. |
11 | * | | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | | 12 | * Redistribution and use in source and binary forms, with or without |
13 | * modification, are permitted provided that the following conditions | | 13 | * modification, are permitted provided that the following conditions |
14 | * are met: | | 14 | * are met: |
| @@ -22,27 +22,27 @@ | | | @@ -22,27 +22,27 @@ |
22 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 22 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
23 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 23 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
24 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 24 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
31 | * POSSIBILITY OF SUCH DAMAGE. | | 31 | * POSSIBILITY OF SUCH DAMAGE. |
32 | */ | | 32 | */ |
33 | | | 33 | |
34 | #include <sys/cdefs.h> | | 34 | #include <sys/cdefs.h> |
35 | __KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.190 2020/02/12 15:59:59 riastradh Exp $"); | | 35 | __KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.191 2020/02/12 16:00:17 riastradh Exp $"); |
36 | | | 36 | |
37 | #ifdef _KERNEL_OPT | | 37 | #ifdef _KERNEL_OPT |
38 | #include "opt_usb.h" | | 38 | #include "opt_usb.h" |
39 | #include "opt_compat_netbsd.h" | | 39 | #include "opt_compat_netbsd.h" |
40 | #include "usb_dma.h" | | 40 | #include "usb_dma.h" |
41 | #endif | | 41 | #endif |
42 | | | 42 | |
43 | #include <sys/param.h> | | 43 | #include <sys/param.h> |
44 | #include <sys/systm.h> | | 44 | #include <sys/systm.h> |
45 | #include <sys/kernel.h> | | 45 | #include <sys/kernel.h> |
46 | #include <sys/device.h> | | 46 | #include <sys/device.h> |
47 | #include <sys/kmem.h> | | 47 | #include <sys/kmem.h> |
48 | #include <sys/proc.h> | | 48 | #include <sys/proc.h> |
| @@ -484,26 +484,27 @@ out: | | | @@ -484,26 +484,27 @@ out: |
484 | | | 484 | |
485 | static usbd_status | | 485 | static usbd_status |
486 | usbd_free_xfer(struct usbd_xfer *xfer) | | 486 | usbd_free_xfer(struct usbd_xfer *xfer) |
487 | { | | 487 | { |
488 | USBHIST_FUNC(); | | 488 | USBHIST_FUNC(); |
489 | USBHIST_CALLARGS(usbdebug, "%#jx", (uintptr_t)xfer, 0, 0, 0); | | 489 | USBHIST_CALLARGS(usbdebug, "%#jx", (uintptr_t)xfer, 0, 0, 0); |
490 | | | 490 | |
491 | if (xfer->ux_buf) { | | 491 | if (xfer->ux_buf) { |
492 | usbd_free_buffer(xfer); | | 492 | usbd_free_buffer(xfer); |
493 | } | | 493 | } |
494 | | | 494 | |
495 | /* Wait for any straggling timeout to complete. */ | | 495 | /* Wait for any straggling timeout to complete. */ |
496 | mutex_enter(xfer->ux_bus->ub_lock); | | 496 | mutex_enter(xfer->ux_bus->ub_lock); |
| | | 497 | xfer->ux_timeout_reset = false; /* do not resuscitate */ |
497 | callout_halt(&xfer->ux_callout, xfer->ux_bus->ub_lock); | | 498 | callout_halt(&xfer->ux_callout, xfer->ux_bus->ub_lock); |
498 | usb_rem_task_wait(xfer->ux_pipe->up_dev, &xfer->ux_aborttask, | | 499 | usb_rem_task_wait(xfer->ux_pipe->up_dev, &xfer->ux_aborttask, |
499 | USB_TASKQ_HC, xfer->ux_bus->ub_lock); | | 500 | USB_TASKQ_HC, xfer->ux_bus->ub_lock); |
500 | mutex_exit(xfer->ux_bus->ub_lock); | | 501 | mutex_exit(xfer->ux_bus->ub_lock); |
501 | | | 502 | |
502 | cv_destroy(&xfer->ux_cv); | | 503 | cv_destroy(&xfer->ux_cv); |
503 | xfer->ux_bus->ub_methods->ubm_freex(xfer->ux_bus, xfer); | | 504 | xfer->ux_bus->ub_methods->ubm_freex(xfer->ux_bus, xfer); |
504 | return USBD_NORMAL_COMPLETION; | | 505 | return USBD_NORMAL_COMPLETION; |
505 | } | | 506 | } |
506 | | | 507 | |
507 | int | | 508 | int |
508 | usbd_create_xfer(struct usbd_pipe *pipe, size_t len, unsigned int flags, | | 509 | usbd_create_xfer(struct usbd_pipe *pipe, size_t len, unsigned int flags, |
509 | unsigned int nframes, struct usbd_xfer **xp) | | 510 | unsigned int nframes, struct usbd_xfer **xp) |