| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ehci.c,v 1.234.2.54 2015/10/11 09:17:51 skrll Exp $ */ | | 1 | /* $NetBSD: ehci.c,v 1.234.2.55 2015/10/16 17:00:15 skrll Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2004-2012 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2004-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), Charles M. Hannum, | | 8 | * by Lennart Augustsson (lennart@augustsson.net), Charles M. Hannum, |
9 | * Jeremy Morse (jeremy.morse@gmail.com), Jared D. McNeill | | 9 | * Jeremy Morse (jeremy.morse@gmail.com), Jared D. McNeill |
10 | * (jmcneill@invisible.ca) and Matthew R. Green (mrg@eterna.com.au). | | 10 | * (jmcneill@invisible.ca) and Matthew R. Green (mrg@eterna.com.au). |
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: |
| @@ -43,27 +43,27 @@ | | | @@ -43,27 +43,27 @@ |
43 | | | 43 | |
44 | /* | | 44 | /* |
45 | * TODO: | | 45 | * TODO: |
46 | * 1) hold off explorations by companion controllers until ehci has started. | | 46 | * 1) hold off explorations by companion controllers until ehci has started. |
47 | * | | 47 | * |
48 | * 2) The hub driver needs to handle and schedule the transaction translator, | | 48 | * 2) The hub driver needs to handle and schedule the transaction translator, |
49 | * to assign place in frame where different devices get to go. See chapter | | 49 | * to assign place in frame where different devices get to go. See chapter |
50 | * on hubs in USB 2.0 for details. | | 50 | * on hubs in USB 2.0 for details. |
51 | * | | 51 | * |
52 | * 3) Command failures are not recovered correctly. | | 52 | * 3) Command failures are not recovered correctly. |
53 | */ | | 53 | */ |
54 | | | 54 | |
55 | #include <sys/cdefs.h> | | 55 | #include <sys/cdefs.h> |
56 | __KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.54 2015/10/11 09:17:51 skrll Exp $"); | | 56 | __KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.55 2015/10/16 17:00:15 skrll Exp $"); |
57 | | | 57 | |
58 | #include "ohci.h" | | 58 | #include "ohci.h" |
59 | #include "uhci.h" | | 59 | #include "uhci.h" |
60 | | | 60 | |
61 | #ifdef _KERNEL_OPT | | 61 | #ifdef _KERNEL_OPT |
62 | #include "opt_usb.h" | | 62 | #include "opt_usb.h" |
63 | #endif | | 63 | #endif |
64 | | | 64 | |
65 | #include <sys/param.h> | | 65 | #include <sys/param.h> |
66 | | | 66 | |
67 | #include <sys/bus.h> | | 67 | #include <sys/bus.h> |
68 | #include <sys/cpu.h> | | 68 | #include <sys/cpu.h> |
69 | #include <sys/device.h> | | 69 | #include <sys/device.h> |
| @@ -159,27 +159,27 @@ Static void ehci_check_itd_intr(ehci_so | | | @@ -159,27 +159,27 @@ Static void ehci_check_itd_intr(ehci_so |
159 | Static void ehci_check_sitd_intr(ehci_softc_t *, struct ehci_xfer *); | | 159 | Static void ehci_check_sitd_intr(ehci_softc_t *, struct ehci_xfer *); |
160 | Static void ehci_idone(struct ehci_xfer *); | | 160 | Static void ehci_idone(struct ehci_xfer *); |
161 | Static void ehci_timeout(void *); | | 161 | Static void ehci_timeout(void *); |
162 | Static void ehci_timeout_task(void *); | | 162 | Static void ehci_timeout_task(void *); |
163 | Static void ehci_intrlist_timeout(void *); | | 163 | Static void ehci_intrlist_timeout(void *); |
164 | Static void ehci_doorbell(void *); | | 164 | Static void ehci_doorbell(void *); |
165 | Static void ehci_pcd(void *); | | 165 | Static void ehci_pcd(void *); |
166 | | | 166 | |
167 | Static struct usbd_xfer * | | 167 | Static struct usbd_xfer * |
168 | ehci_allocx(struct usbd_bus *, unsigned int); | | 168 | ehci_allocx(struct usbd_bus *, unsigned int); |
169 | Static void ehci_freex(struct usbd_bus *, struct usbd_xfer *); | | 169 | Static void ehci_freex(struct usbd_bus *, struct usbd_xfer *); |
170 | Static void ehci_get_lock(struct usbd_bus *, kmutex_t **); | | 170 | Static void ehci_get_lock(struct usbd_bus *, kmutex_t **); |
171 | Static int ehci_roothub_ctrl(struct usbd_bus *, | | 171 | Static int ehci_roothub_ctrl(struct usbd_bus *, |
172 | usb_device_request_t *, void *, int); | | 172 | usb_device_request_t *, void *, int); |
173 | | | 173 | |
174 | Static usbd_status ehci_root_intr_transfer(struct usbd_xfer *); | | 174 | Static usbd_status ehci_root_intr_transfer(struct usbd_xfer *); |
175 | Static usbd_status ehci_root_intr_start(struct usbd_xfer *); | | 175 | Static usbd_status ehci_root_intr_start(struct usbd_xfer *); |
176 | Static void ehci_root_intr_abort(struct usbd_xfer *); | | 176 | Static void ehci_root_intr_abort(struct usbd_xfer *); |
177 | Static void ehci_root_intr_close(struct usbd_pipe *); | | 177 | Static void ehci_root_intr_close(struct usbd_pipe *); |
178 | Static void ehci_root_intr_done(struct usbd_xfer *); | | 178 | Static void ehci_root_intr_done(struct usbd_xfer *); |
179 | | | 179 | |
180 | Static usbd_status ehci_device_ctrl_transfer(struct usbd_xfer *); | | 180 | Static usbd_status ehci_device_ctrl_transfer(struct usbd_xfer *); |
181 | Static usbd_status ehci_device_ctrl_start(struct usbd_xfer *); | | 181 | Static usbd_status ehci_device_ctrl_start(struct usbd_xfer *); |
182 | Static void ehci_device_ctrl_abort(struct usbd_xfer *); | | 182 | Static void ehci_device_ctrl_abort(struct usbd_xfer *); |
183 | Static void ehci_device_ctrl_close(struct usbd_pipe *); | | 183 | Static void ehci_device_ctrl_close(struct usbd_pipe *); |
184 | Static void ehci_device_ctrl_done(struct usbd_xfer *); | | 184 | Static void ehci_device_ctrl_done(struct usbd_xfer *); |
185 | | | 185 | |
| @@ -202,39 +202,40 @@ Static void ehci_device_isoc_close(stru | | | @@ -202,39 +202,40 @@ Static void ehci_device_isoc_close(stru |
202 | Static void ehci_device_isoc_done(struct usbd_xfer *); | | 202 | Static void ehci_device_isoc_done(struct usbd_xfer *); |
203 | | | 203 | |
204 | Static usbd_status ehci_device_fs_isoc_transfer(struct usbd_xfer *); | | 204 | Static usbd_status ehci_device_fs_isoc_transfer(struct usbd_xfer *); |
205 | Static usbd_status ehci_device_fs_isoc_start(struct usbd_xfer *); | | 205 | Static usbd_status ehci_device_fs_isoc_start(struct usbd_xfer *); |
206 | Static void ehci_device_fs_isoc_abort(struct usbd_xfer *); | | 206 | Static void ehci_device_fs_isoc_abort(struct usbd_xfer *); |
207 | Static void ehci_device_fs_isoc_close(struct usbd_pipe *); | | 207 | Static void ehci_device_fs_isoc_close(struct usbd_pipe *); |
208 | Static void ehci_device_fs_isoc_done(struct usbd_xfer *); | | 208 | Static void ehci_device_fs_isoc_done(struct usbd_xfer *); |
209 | | | 209 | |
210 | Static void ehci_device_clear_toggle(struct usbd_pipe *); | | 210 | Static void ehci_device_clear_toggle(struct usbd_pipe *); |
211 | Static void ehci_noop(struct usbd_pipe *); | | 211 | Static void ehci_noop(struct usbd_pipe *); |
212 | | | 212 | |
213 | Static void ehci_disown(ehci_softc_t *, int, int); | | 213 | Static void ehci_disown(ehci_softc_t *, int, int); |
214 | | | 214 | |
215 | Static ehci_soft_qh_t *ehci_alloc_sqh(ehci_softc_t *); | | 215 | Static ehci_soft_qh_t * ehci_alloc_sqh(ehci_softc_t *); |
216 | Static void ehci_free_sqh(ehci_softc_t *, ehci_soft_qh_t *); | | 216 | Static void ehci_free_sqh(ehci_softc_t *, ehci_soft_qh_t *); |
217 | | | 217 | |
218 | Static ehci_soft_qtd_t *ehci_alloc_sqtd(ehci_softc_t *); | | 218 | Static ehci_soft_qtd_t *ehci_alloc_sqtd(ehci_softc_t *); |
219 | Static void ehci_free_sqtd(ehci_softc_t *, ehci_soft_qtd_t *); | | 219 | Static void ehci_free_sqtd(ehci_softc_t *, ehci_soft_qtd_t *); |
220 | Static usbd_status ehci_alloc_sqtd_chain(struct ehci_pipe *, | | 220 | Static usbd_status ehci_alloc_sqtd_chain(struct ehci_pipe *, |
221 | ehci_softc_t *, int, int, struct usbd_xfer *, | | 221 | ehci_softc_t *, int, int, struct usbd_xfer *, |
222 | ehci_soft_qtd_t **, ehci_soft_qtd_t **); | | 222 | ehci_soft_qtd_t **, ehci_soft_qtd_t **); |
223 | Static void ehci_free_sqtd_chain(ehci_softc_t *, ehci_soft_qtd_t *, | | 223 | Static void ehci_free_sqtd_chain(ehci_softc_t *, ehci_soft_qtd_t *, |
224 | ehci_soft_qtd_t *); | | 224 | ehci_soft_qtd_t *); |
225 | | | 225 | |
226 | Static ehci_soft_itd_t *ehci_alloc_itd(ehci_softc_t *); | | 226 | Static ehci_soft_itd_t *ehci_alloc_itd(ehci_softc_t *); |
227 | Static ehci_soft_sitd_t *ehci_alloc_sitd(ehci_softc_t *); | | 227 | Static ehci_soft_sitd_t * |
| | | 228 | ehci_alloc_sitd(ehci_softc_t *); |
228 | Static void ehci_free_itd(ehci_softc_t *, ehci_soft_itd_t *); | | 229 | Static void ehci_free_itd(ehci_softc_t *, ehci_soft_itd_t *); |
229 | Static void ehci_free_sitd(ehci_softc_t *, ehci_soft_sitd_t *); | | 230 | Static void ehci_free_sitd(ehci_softc_t *, ehci_soft_sitd_t *); |
230 | Static void ehci_rem_free_itd_chain(ehci_softc_t *, | | 231 | Static void ehci_rem_free_itd_chain(ehci_softc_t *, |
231 | struct ehci_xfer *); | | 232 | struct ehci_xfer *); |
232 | Static void ehci_rem_free_sitd_chain(ehci_softc_t *, | | 233 | Static void ehci_rem_free_sitd_chain(ehci_softc_t *, |
233 | struct ehci_xfer *); | | 234 | struct ehci_xfer *); |
234 | Static void ehci_abort_isoc_xfer(struct usbd_xfer *, | | 235 | Static void ehci_abort_isoc_xfer(struct usbd_xfer *, |
235 | usbd_status); | | 236 | usbd_status); |
236 | | | 237 | |
237 | Static usbd_status ehci_device_request(struct usbd_xfer *); | | 238 | Static usbd_status ehci_device_request(struct usbd_xfer *); |
238 | | | 239 | |
239 | Static usbd_status ehci_device_setintr(ehci_softc_t *, ehci_soft_qh_t *, | | 240 | Static usbd_status ehci_device_setintr(ehci_softc_t *, ehci_soft_qh_t *, |
240 | int); | | 241 | int); |