| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ehci.c,v 1.193 2012/11/04 12:01:55 matt Exp $ */ | | 1 | /* $NetBSD: ehci.c,v 1.194 2013/01/02 09:49:14 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.193 2012/11/04 12:01:55 matt Exp $"); | | 56 | __KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.194 2013/01/02 09:49:14 skrll Exp $"); |
57 | | | 57 | |
58 | #include "ohci.h" | | 58 | #include "ohci.h" |
59 | #include "uhci.h" | | 59 | #include "uhci.h" |
60 | #include "opt_usb.h" | | 60 | #include "opt_usb.h" |
61 | | | 61 | |
62 | #include <sys/param.h> | | 62 | #include <sys/param.h> |
63 | #include <sys/systm.h> | | 63 | #include <sys/systm.h> |
64 | #include <sys/kernel.h> | | 64 | #include <sys/kernel.h> |
65 | #include <sys/kmem.h> | | 65 | #include <sys/kmem.h> |
66 | #include <sys/device.h> | | 66 | #include <sys/device.h> |
67 | #include <sys/select.h> | | 67 | #include <sys/select.h> |
68 | #include <sys/proc.h> | | 68 | #include <sys/proc.h> |
69 | #include <sys/queue.h> | | 69 | #include <sys/queue.h> |
| @@ -3383,28 +3383,30 @@ ehci_device_request(usbd_xfer_handle xfe | | | @@ -3383,28 +3383,30 @@ ehci_device_request(usbd_xfer_handle xfe |
3383 | goto bad1; | | 3383 | goto bad1; |
3384 | } | | 3384 | } |
3385 | stat = ehci_alloc_sqtd(sc); | | 3385 | stat = ehci_alloc_sqtd(sc); |
3386 | if (stat == NULL) { | | 3386 | if (stat == NULL) { |
3387 | err = USBD_NOMEM; | | 3387 | err = USBD_NOMEM; |
3388 | goto bad2; | | 3388 | goto bad2; |
3389 | } | | 3389 | } |
3390 | | | 3390 | |
3391 | mutex_enter(&sc->sc_lock); | | 3391 | mutex_enter(&sc->sc_lock); |
3392 | | | 3392 | |
3393 | sqh = epipe->sqh; | | 3393 | sqh = epipe->sqh; |
3394 | epipe->u.ctl.length = len; | | 3394 | epipe->u.ctl.length = len; |
3395 | | | 3395 | |
3396 | /* Update device address and length since they may have changed | | 3396 | /* |
3397 | during the setup of the control pipe in usbd_new_device(). */ | | 3397 | * Update device address and length since they may have changed |
| | | 3398 | * during the setup of the control pipe in usbd_new_device(). |
| | | 3399 | */ |
3398 | /* XXX This only needs to be done once, but it's too early in open. */ | | 3400 | /* XXX This only needs to be done once, but it's too early in open. */ |
3399 | /* XXXX Should not touch ED here! */ | | 3401 | /* XXXX Should not touch ED here! */ |
3400 | sqh->qh.qh_endp = | | 3402 | sqh->qh.qh_endp = |
3401 | (sqh->qh.qh_endp & htole32(~(EHCI_QH_ADDRMASK | EHCI_QH_MPLMASK))) | | | 3403 | (sqh->qh.qh_endp & htole32(~(EHCI_QH_ADDRMASK | EHCI_QH_MPLMASK))) | |
3402 | htole32( | | 3404 | htole32( |
3403 | EHCI_QH_SET_ADDR(addr) | | | 3405 | EHCI_QH_SET_ADDR(addr) | |
3404 | EHCI_QH_SET_MPL(UGETW(epipe->pipe.endpoint->edesc->wMaxPacketSize)) | | 3406 | EHCI_QH_SET_MPL(UGETW(epipe->pipe.endpoint->edesc->wMaxPacketSize)) |
3405 | ); | | 3407 | ); |
3406 | | | 3408 | |
3407 | /* Set up data transaction */ | | 3409 | /* Set up data transaction */ |
3408 | if (len != 0) { | | 3410 | if (len != 0) { |
3409 | ehci_soft_qtd_t *end; | | 3411 | ehci_soft_qtd_t *end; |
3410 | | | 3412 | |