| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: sl811hs.c,v 1.59 2016/05/10 21:13:48 skrll Exp $ */ | | 1 | /* $NetBSD: sl811hs.c,v 1.60 2016/05/10 21:15:54 skrll Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Not (c) 2007 Matthew Orgass | | 4 | * Not (c) 2007 Matthew Orgass |
5 | * This file is public domain, meaning anyone can make any use of part or all | | 5 | * This file is public domain, meaning anyone can make any use of part or all |
6 | * of this file including copying into other works without credit. Any use, | | 6 | * of this file including copying into other works without credit. Any use, |
7 | * modified or not, is solely the responsibility of the user. If this file is | | 7 | * modified or not, is solely the responsibility of the user. If this file is |
8 | * part of a collection then use in the collection is governed by the terms of | | 8 | * part of a collection then use in the collection is governed by the terms of |
9 | * the collection. | | 9 | * the collection. |
10 | */ | | 10 | */ |
11 | | | 11 | |
12 | /* | | 12 | /* |
13 | * Cypress/ScanLogic SL811HS/T USB Host Controller | | 13 | * Cypress/ScanLogic SL811HS/T USB Host Controller |
14 | * Datasheet, Errata, and App Note available at www.cypress.com | | 14 | * Datasheet, Errata, and App Note available at www.cypress.com |
| @@ -58,27 +58,27 @@ | | | @@ -58,27 +58,27 @@ |
58 | */ | | 58 | */ |
59 | | | 59 | |
60 | /* | | 60 | /* |
61 | * XXX TODO: | | 61 | * XXX TODO: |
62 | * copy next output packet while transfering | | 62 | * copy next output packet while transfering |
63 | * usb suspend | | 63 | * usb suspend |
64 | * could keep track of known values of all buffer space? | | 64 | * could keep track of known values of all buffer space? |
65 | * combined print/log function for errors | | 65 | * combined print/log function for errors |
66 | * | | 66 | * |
67 | * ub_usepolling support is untested and may not work | | 67 | * ub_usepolling support is untested and may not work |
68 | */ | | 68 | */ |
69 | | | 69 | |
70 | #include <sys/cdefs.h> | | 70 | #include <sys/cdefs.h> |
71 | __KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.59 2016/05/10 21:13:48 skrll Exp $"); | | 71 | __KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.60 2016/05/10 21:15:54 skrll Exp $"); |
72 | | | 72 | |
73 | #include "opt_slhci.h" | | 73 | #include "opt_slhci.h" |
74 | | | 74 | |
75 | #ifdef _KERNEL_OPT | | 75 | #ifdef _KERNEL_OPT |
76 | #include "opt_usb.h" | | 76 | #include "opt_usb.h" |
77 | #endif | | 77 | #endif |
78 | | | 78 | |
79 | #include <sys/param.h> | | 79 | #include <sys/param.h> |
80 | | | 80 | |
81 | #include <sys/bus.h> | | 81 | #include <sys/bus.h> |
82 | #include <sys/cpu.h> | | 82 | #include <sys/cpu.h> |
83 | #include <sys/device.h> | | 83 | #include <sys/device.h> |
84 | #include <sys/gcq.h> | | 84 | #include <sys/gcq.h> |
| @@ -1286,43 +1286,44 @@ slhci_activate(device_t self, enum devac | | | @@ -1286,43 +1286,44 @@ slhci_activate(device_t self, enum devac |
1286 | return 0; | | 1286 | return 0; |
1287 | default: | | 1287 | default: |
1288 | return EOPNOTSUPP; | | 1288 | return EOPNOTSUPP; |
1289 | } | | 1289 | } |
1290 | } | | 1290 | } |
1291 | | | 1291 | |
1292 | void | | 1292 | void |
1293 | slhci_abort(struct usbd_xfer *xfer) | | 1293 | slhci_abort(struct usbd_xfer *xfer) |
1294 | { | | 1294 | { |
1295 | SLHCIHIST_FUNC(); SLHCIHIST_CALLED(); | | 1295 | SLHCIHIST_FUNC(); SLHCIHIST_CALLED(); |
1296 | struct slhci_softc *sc; | | 1296 | struct slhci_softc *sc; |
1297 | struct slhci_pipe *spipe; | | 1297 | struct slhci_pipe *spipe; |
1298 | | | 1298 | |
| | | 1299 | KASSERT(mutex_owned(&sc->sc_lock)); |
| | | 1300 | |
1299 | spipe = SLHCI_PIPE2SPIPE(xfer->ux_pipe); | | 1301 | spipe = SLHCI_PIPE2SPIPE(xfer->ux_pipe); |
1300 | | | 1302 | |
1301 | if (spipe == NULL) | | 1303 | if (spipe == NULL) |
1302 | goto callback; | | 1304 | goto callback; |
1303 | | | 1305 | |
1304 | sc = SLHCI_XFER2SC(xfer); | | 1306 | sc = SLHCI_XFER2SC(xfer); |
1305 | | | 1307 | |
1306 | KASSERT(mutex_owned(&sc->sc_lock)); | | 1308 | KASSERT(mutex_owned(&sc->sc_lock)); |
1307 | | | 1309 | |
1308 | DLOG(D_TRACE, "%s abort xfer %p spipe %p spipe->xfer %p", | | 1310 | DLOG(D_TRACE, "%s abort xfer %p spipe %p spipe->xfer %p", |
1309 | pnames(spipe->ptype), xfer, spipe, spipe->xfer); | | 1311 | pnames(spipe->ptype), xfer, spipe, spipe->xfer); |
1310 | | | 1312 | |
1311 | slhci_lock_call(sc, &slhci_do_abort, spipe, xfer); | | 1313 | slhci_lock_call(sc, &slhci_do_abort, spipe, xfer); |
1312 | | | 1314 | |
1313 | callback: | | 1315 | callback: |
1314 | xfer->ux_status = USBD_CANCELLED; | | 1316 | xfer->ux_status = USBD_CANCELLED; |
1315 | /* Abort happens at IPL_USB. */ | | | |
1316 | usb_transfer_complete(xfer); | | 1317 | usb_transfer_complete(xfer); |
1317 | } | | 1318 | } |
1318 | | | 1319 | |
1319 | void | | 1320 | void |
1320 | slhci_close(struct usbd_pipe *pipe) | | 1321 | slhci_close(struct usbd_pipe *pipe) |
1321 | { | | 1322 | { |
1322 | SLHCIHIST_FUNC(); SLHCIHIST_CALLED(); | | 1323 | SLHCIHIST_FUNC(); SLHCIHIST_CALLED(); |
1323 | struct slhci_softc *sc; | | 1324 | struct slhci_softc *sc; |
1324 | struct slhci_pipe *spipe; | | 1325 | struct slhci_pipe *spipe; |
1325 | | | 1326 | |
1326 | sc = SLHCI_PIPE2SC(pipe); | | 1327 | sc = SLHCI_PIPE2SC(pipe); |
1327 | spipe = SLHCI_PIPE2SPIPE(pipe); | | 1328 | spipe = SLHCI_PIPE2SPIPE(pipe); |
1328 | | | 1329 | |