| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: usbdi.c,v 1.162.2.13 2015/03/05 09:06:20 skrll Exp $ */ | | 1 | /* $NetBSD: usbdi.c,v 1.162.2.14 2015/03/05 12:39:08 skrll Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1998, 2012 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 and Matthew R. Green (mrg@eterna.com.au). | | 9 | * Carlstedt Research & Technology and Matthew R. Green (mrg@eterna.com.au). |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -21,27 +21,27 @@ | | | @@ -21,27 +21,27 @@ |
21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
30 | * POSSIBILITY OF SUCH DAMAGE. | | 30 | * POSSIBILITY OF SUCH DAMAGE. |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | #include <sys/cdefs.h> | | 33 | #include <sys/cdefs.h> |
34 | __KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.162.2.13 2015/03/05 09:06:20 skrll Exp $"); | | 34 | __KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.162.2.14 2015/03/05 12:39:08 skrll Exp $"); |
35 | | | 35 | |
36 | #ifdef _KERNEL_OPT | | 36 | #ifdef _KERNEL_OPT |
37 | #include "opt_usb.h" | | 37 | #include "opt_usb.h" |
38 | #include "opt_compat_netbsd.h" | | 38 | #include "opt_compat_netbsd.h" |
39 | #endif | | 39 | #endif |
40 | | | 40 | |
41 | #include "usb_dma.h" | | 41 | #include "usb_dma.h" |
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> |
| @@ -328,27 +328,27 @@ usbd_transfer(usbd_xfer_handle xfer) | | | @@ -328,27 +328,27 @@ usbd_transfer(usbd_xfer_handle xfer) |
328 | | | 328 | |
329 | /* xfer is not valid after the transfer method unless synchronous */ | | 329 | /* xfer is not valid after the transfer method unless synchronous */ |
330 | err = pipe->up_methods->upm_transfer(xfer); | | 330 | err = pipe->up_methods->upm_transfer(xfer); |
331 | USBHIST_LOG(usbdebug, "<- done transfer %p, err = %d", xfer, err, 0, 0); | | 331 | USBHIST_LOG(usbdebug, "<- done transfer %p, err = %d", xfer, err, 0, 0); |
332 | | | 332 | |
333 | if (!(flags & USBD_SYNCHRONOUS)) { | | 333 | if (!(flags & USBD_SYNCHRONOUS)) { |
334 | USBHIST_LOG(usbdebug, "<- done xfer %p, not sync", xfer, 0, 0, | | 334 | USBHIST_LOG(usbdebug, "<- done xfer %p, not sync", xfer, 0, 0, |
335 | 0); | | 335 | 0); |
336 | return err; | | 336 | return err; |
337 | } | | 337 | } |
338 | | | 338 | |
339 | /* Sync transfer, wait for completion. */ | | 339 | /* Sync transfer, wait for completion. */ |
340 | if (err != USBD_IN_PROGRESS) { | | 340 | if (err != USBD_IN_PROGRESS) { |
341 | USBHIST_LOG(usbdebug, "<- done xfer %p, not in progress", xfer, | | 341 | USBHIST_LOG(usbdebug, "<- done xfer %p, err %d (complete/error)", xfer, |
342 | 0, 0, 0); | | 342 | 0, 0, 0); |
343 | return err; | | 343 | return err; |
344 | } | | 344 | } |
345 | usbd_lock_pipe(pipe); | | 345 | usbd_lock_pipe(pipe); |
346 | while (!xfer->ux_done) { | | 346 | while (!xfer->ux_done) { |
347 | if (pipe->up_dev->ud_bus->ub_usepolling) | | 347 | if (pipe->up_dev->ud_bus->ub_usepolling) |
348 | panic("usbd_transfer: not done"); | | 348 | panic("usbd_transfer: not done"); |
349 | USBHIST_LOG(usbdebug, "<- sleeping on xfer %p", xfer, 0, 0, 0); | | 349 | USBHIST_LOG(usbdebug, "<- sleeping on xfer %p", xfer, 0, 0, 0); |
350 | | | 350 | |
351 | err = 0; | | 351 | err = 0; |
352 | if ((flags & USBD_SYNCHRONOUS_SIG) != 0) { | | 352 | if ((flags & USBD_SYNCHRONOUS_SIG) != 0) { |
353 | err = cv_wait_sig(&xfer->ux_cv, pipe->up_dev->ud_bus->ub_lock); | | 353 | err = cv_wait_sig(&xfer->ux_cv, pipe->up_dev->ud_bus->ub_lock); |
354 | } else { | | 354 | } else { |
| @@ -1135,28 +1135,27 @@ usbd_do_request_flags_pipe(usbd_device_h | | | @@ -1135,28 +1135,27 @@ usbd_do_request_flags_pipe(usbd_device_h |
1135 | treq.bRequest = UR_CLEAR_FEATURE; | | 1135 | treq.bRequest = UR_CLEAR_FEATURE; |
1136 | USETW(treq.wValue, UF_ENDPOINT_HALT); | | 1136 | USETW(treq.wValue, UF_ENDPOINT_HALT); |
1137 | USETW(treq.wIndex, 0); | | 1137 | USETW(treq.wIndex, 0); |
1138 | USETW(treq.wLength, 0); | | 1138 | USETW(treq.wLength, 0); |
1139 | usbd_setup_default_xfer(xfer, dev, 0, USBD_DEFAULT_TIMEOUT, | | 1139 | usbd_setup_default_xfer(xfer, dev, 0, USBD_DEFAULT_TIMEOUT, |
1140 | &treq, &status, 0, 0, 0); | | 1140 | &treq, &status, 0, 0, 0); |
1141 | nerr = usbd_sync_transfer(xfer); | | 1141 | nerr = usbd_sync_transfer(xfer); |
1142 | if (nerr) | | 1142 | if (nerr) |
1143 | goto bad; | | 1143 | goto bad; |
1144 | } | | 1144 | } |
1145 | | | 1145 | |
1146 | bad: | | 1146 | bad: |
1147 | if (err) { | | 1147 | if (err) { |
1148 | USBHIST_LOG(usbdebug, "returning err = %s", | | 1148 | USBHIST_LOG(usbdebug, "returning err = %d", err, 0, 0, 0); |
1149 | usbd_errstr(err), 0, 0, 0); | | | |
1150 | } | | 1149 | } |
1151 | usbd_free_xfer(xfer); | | 1150 | usbd_free_xfer(xfer); |
1152 | return err; | | 1151 | return err; |
1153 | } | | 1152 | } |
1154 | | | 1153 | |
1155 | const struct usbd_quirks * | | 1154 | const struct usbd_quirks * |
1156 | usbd_get_quirks(usbd_device_handle dev) | | 1155 | usbd_get_quirks(usbd_device_handle dev) |
1157 | { | | 1156 | { |
1158 | #ifdef DIAGNOSTIC | | 1157 | #ifdef DIAGNOSTIC |
1159 | if (dev == NULL) { | | 1158 | if (dev == NULL) { |
1160 | printf("usbd_get_quirks: dev == NULL\n"); | | 1159 | printf("usbd_get_quirks: dev == NULL\n"); |
1161 | return 0; | | 1160 | return 0; |
1162 | } | | 1161 | } |