Sun Oct 11 09:17:51 2015 UTC ()
Update ubm_allocx with the isoc frame count parameter and use it in
dwctwo(4)


(skrll)
diff -r1.12.6.12 -r1.12.6.13 src/sys/arch/mips/adm5120/dev/ahci.c
diff -r1.47.6.12 -r1.47.6.13 src/sys/dev/ic/sl811hs.c
diff -r1.234.2.53 -r1.234.2.54 src/sys/dev/usb/ehci.c
diff -r1.12.2.18 -r1.12.2.19 src/sys/dev/usb/motg.c
diff -r1.254.2.22 -r1.254.2.23 src/sys/dev/usb/ohci.c
diff -r1.264.4.35 -r1.264.4.36 src/sys/dev/usb/uhci.c
diff -r1.162.2.30 -r1.162.2.31 src/sys/dev/usb/usbdi.c
diff -r1.109.2.17 -r1.109.2.18 src/sys/dev/usb/usbdivar.h
diff -r1.28.2.40 -r1.28.2.41 src/sys/dev/usb/xhci.c
diff -r1.32.2.12 -r1.32.2.13 src/sys/external/bsd/dwc2/dwc2.c
diff -r1.3.12.5 -r1.3.12.6 src/sys/external/bsd/dwc2/dwc2var.h
diff -r1.22.4.9 -r1.22.4.10 src/sys/rump/dev/lib/libugenhc/ugenhc.c

cvs diff -r1.12.6.12 -r1.12.6.13 src/sys/arch/mips/adm5120/dev/ahci.c (expand / switch to unified diff)

--- src/sys/arch/mips/adm5120/dev/ahci.c 2015/03/19 17:26:42 1.12.6.12
+++ src/sys/arch/mips/adm5120/dev/ahci.c 2015/10/11 09:17:50 1.12.6.13
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ahci.c,v 1.12.6.12 2015/03/19 17:26:42 skrll Exp $ */ 1/* $NetBSD: ahci.c,v 1.12.6.13 2015/10/11 09:17:50 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko. 4 * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or 7 * Redistribution and use in source and binary forms, with or
8 * without modification, are permitted provided that the following 8 * without modification, are permitted provided that the following
9 * conditions are met: 9 * conditions are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above 12 * 2. Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following 13 * copyright notice, this list of conditions and the following
14 * disclaimer in the documentation and/or other materials provided 14 * disclaimer in the documentation and/or other materials provided
@@ -54,27 +54,27 @@ @@ -54,27 +54,27 @@
54 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 54 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
55 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 55 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
56 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 56 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
57 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 57 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
58 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 58 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
59 * POSSIBILITY OF SUCH DAMAGE. 59 * POSSIBILITY OF SUCH DAMAGE.
60 */ 60 */
61 61
62/* 62/*
63 * !! HIGHLY EXPERIMENTAL CODE !! 63 * !! HIGHLY EXPERIMENTAL CODE !!
64 */ 64 */
65 65
66#include <sys/cdefs.h> 66#include <sys/cdefs.h>
67__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.12.6.12 2015/03/19 17:26:42 skrll Exp $"); 67__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.12.6.13 2015/10/11 09:17:50 skrll Exp $");
68 68
69#include <sys/param.h> 69#include <sys/param.h>
70#include <sys/systm.h> 70#include <sys/systm.h>
71#include <sys/kernel.h> 71#include <sys/kernel.h>
72#include <sys/proc.h> 72#include <sys/proc.h>
73#include <sys/device.h> 73#include <sys/device.h>
74#include <sys/kmem.h> 74#include <sys/kmem.h>
75 75
76#include <sys/bus.h> 76#include <sys/bus.h>
77#include <machine/cpu.h> 77#include <machine/cpu.h>
78 78
79#include <dev/usb/usb.h> 79#include <dev/usb/usb.h>
80#include <dev/usb/usbdi.h> 80#include <dev/usb/usbdi.h>
@@ -85,27 +85,28 @@ __KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.1 @@ -85,27 +85,28 @@ __KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.1
85 85
86#include <mips/adm5120/include/adm5120reg.h> 86#include <mips/adm5120/include/adm5120reg.h>
87#include <mips/adm5120/include/adm5120var.h> 87#include <mips/adm5120/include/adm5120var.h>
88#include <mips/adm5120/include/adm5120_obiovar.h> 88#include <mips/adm5120/include/adm5120_obiovar.h>
89 89
90#include <mips/adm5120/dev/ahcireg.h> 90#include <mips/adm5120/dev/ahcireg.h>
91#include <mips/adm5120/dev/ahcivar.h> 91#include <mips/adm5120/dev/ahcivar.h>
92 92
93static usbd_status ahci_open(struct usbd_pipe *); 93static usbd_status ahci_open(struct usbd_pipe *);
94static void ahci_softintr(void *); 94static void ahci_softintr(void *);
95static void ahci_poll(struct usbd_bus *); 95static void ahci_poll(struct usbd_bus *);
96static void ahci_poll_hub(void *); 96static void ahci_poll_hub(void *);
97static void ahci_poll_device(void *arg); 97static void ahci_poll_device(void *arg);
98static struct usbd_xfer *ahci_allocx(struct usbd_bus *); 98static struct usbd_xfer *
 99 ahci_allocx(struct usbd_bus *, unsigned int);
99static void ahci_freex(struct usbd_bus *, struct usbd_xfer *); 100static void ahci_freex(struct usbd_bus *, struct usbd_xfer *);
100 101
101static void ahci_get_lock(struct usbd_bus *, kmutex_t **); 102static void ahci_get_lock(struct usbd_bus *, kmutex_t **);
102static int ahci_roothub_ctrl(struct usbd_bus *, usb_device_request_t *, 103static int ahci_roothub_ctrl(struct usbd_bus *, usb_device_request_t *,
103 void *, int); 104 void *, int);
104 105
105static usbd_status ahci_root_intr_transfer(struct usbd_xfer *); 106static usbd_status ahci_root_intr_transfer(struct usbd_xfer *);
106static usbd_status ahci_root_intr_start(struct usbd_xfer *); 107static usbd_status ahci_root_intr_start(struct usbd_xfer *);
107static void ahci_root_intr_abort(struct usbd_xfer *); 108static void ahci_root_intr_abort(struct usbd_xfer *);
108static void ahci_root_intr_close(struct usbd_pipe *); 109static void ahci_root_intr_close(struct usbd_pipe *);
109static void ahci_root_intr_done(struct usbd_xfer *); 110static void ahci_root_intr_done(struct usbd_xfer *);
110 111
111static usbd_status ahci_device_ctrl_transfer(struct usbd_xfer *); 112static usbd_status ahci_device_ctrl_transfer(struct usbd_xfer *);
@@ -440,27 +441,27 @@ ahci_poll_hub(void *arg) @@ -440,27 +441,27 @@ ahci_poll_hub(void *arg)
440 441
441 /* no change, return NAK */ 442 /* no change, return NAK */
442 if (p[0] == 0) 443 if (p[0] == 0)
443 return; 444 return;
444 445
445 xfer->ux_actlen = 1; 446 xfer->ux_actlen = 1;
446 xfer->ux_status = USBD_NORMAL_COMPLETION; 447 xfer->ux_status = USBD_NORMAL_COMPLETION;
447 mutex_enter(&sc->sc_lock); 448 mutex_enter(&sc->sc_lock);
448 usb_transfer_complete(xfer); 449 usb_transfer_complete(xfer);
449 mutex_exit(&sc->sc_lock); 450 mutex_exit(&sc->sc_lock);
450} 451}
451 452
452struct usbd_xfer * 453struct usbd_xfer *
453ahci_allocx(struct usbd_bus *bus) 454ahci_allocx(struct usbd_bus *bus, unsigned int nframes)
454{ 455{
455 struct ahci_softc *sc = (struct ahci_softc *)bus; 456 struct ahci_softc *sc = (struct ahci_softc *)bus;
456 struct usbd_xfer *xfer; 457 struct usbd_xfer *xfer;
457 458
458 DPRINTF(D_MEM, ("SLallocx")); 459 DPRINTF(D_MEM, ("SLallocx"));
459 460
460 xfer = SIMPLEQ_FIRST(&sc->sc_free_xfers); 461 xfer = SIMPLEQ_FIRST(&sc->sc_free_xfers);
461 if (xfer) { 462 if (xfer) {
462 SIMPLEQ_REMOVE_HEAD(&sc->sc_free_xfers, ux_next); 463 SIMPLEQ_REMOVE_HEAD(&sc->sc_free_xfers, ux_next);
463#ifdef DIAGNOSTIC 464#ifdef DIAGNOSTIC
464 if (xfer->ux_state != XFER_FREE) { 465 if (xfer->ux_state != XFER_FREE) {
465 printf("ahci_allocx: xfer=%p not free, 0x%08x\n", 466 printf("ahci_allocx: xfer=%p not free, 0x%08x\n",
466 xfer, xfer->ux_state); 467 xfer, xfer->ux_state);

cvs diff -r1.47.6.12 -r1.47.6.13 src/sys/dev/ic/sl811hs.c (expand / switch to unified diff)

--- src/sys/dev/ic/sl811hs.c 2015/10/11 08:35:04 1.47.6.12
+++ src/sys/dev/ic/sl811hs.c 2015/10/11 09:17:51 1.47.6.13
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sl811hs.c,v 1.47.6.12 2015/10/11 08:35:04 skrll Exp $ */ 1/* $NetBSD: sl811hs.c,v 1.47.6.13 2015/10/11 09:17:51 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.47.6.12 2015/10/11 08:35:04 skrll Exp $"); 71__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.47.6.13 2015/10/11 09:17:51 skrll Exp $");
72 72
73#include "opt_slhci.h" 73#include "opt_slhci.h"
74 74
75#include <sys/cdefs.h> 75#include <sys/cdefs.h>
76#include <sys/param.h> 76#include <sys/param.h>
77#include <sys/systm.h> 77#include <sys/systm.h>
78#include <sys/kernel.h> 78#include <sys/kernel.h>
79#include <sys/proc.h> 79#include <sys/proc.h>
80#include <sys/device.h> 80#include <sys/device.h>
81#include <sys/kmem.h> 81#include <sys/kmem.h>
82#include <sys/queue.h> 82#include <sys/queue.h>
83#include <sys/gcq.h> 83#include <sys/gcq.h>
84#include <sys/intr.h> 84#include <sys/intr.h>
@@ -410,27 +410,27 @@ slhci_dump_cc_times(int n) { @@ -410,27 +410,27 @@ slhci_dump_cc_times(int n) {
410 printf("start " CC_TYPE_FMT " stop " CC_TYPE_FMT 410 printf("start " CC_TYPE_FMT " stop " CC_TYPE_FMT
411 " difference %8i miscdata %#x\n", times->times[i].start, 411 " difference %8i miscdata %#x\n", times->times[i].start,
412 times->times[i].stop, (int)(times->times[i].stop - 412 times->times[i].stop, (int)(times->times[i].stop -
413 times->times[i].start), times->times[i].miscdata); 413 times->times[i].start), times->times[i].miscdata);
414} 414}
415#else 415#else
416#define start_cc_time(x, y) 416#define start_cc_time(x, y)
417#define stop_cc_time(x) 417#define stop_cc_time(x)
418#endif /* SLHCI_PROFILE_TRANSFER */ 418#endif /* SLHCI_PROFILE_TRANSFER */
419 419
420typedef usbd_status (*LockCallFunc)(struct slhci_softc *, struct slhci_pipe 420typedef usbd_status (*LockCallFunc)(struct slhci_softc *, struct slhci_pipe
421 *, struct usbd_xfer *); 421 *, struct usbd_xfer *);
422 422
423struct usbd_xfer * slhci_allocx(struct usbd_bus *); 423struct usbd_xfer * slhci_allocx(struct usbd_bus *, unsigned int);
424void slhci_freex(struct usbd_bus *, struct usbd_xfer *); 424void slhci_freex(struct usbd_bus *, struct usbd_xfer *);
425static void slhci_get_lock(struct usbd_bus *, kmutex_t **); 425static void slhci_get_lock(struct usbd_bus *, kmutex_t **);
426 426
427usbd_status slhci_transfer(struct usbd_xfer *); 427usbd_status slhci_transfer(struct usbd_xfer *);
428usbd_status slhci_start(struct usbd_xfer *); 428usbd_status slhci_start(struct usbd_xfer *);
429usbd_status slhci_root_start(struct usbd_xfer *); 429usbd_status slhci_root_start(struct usbd_xfer *);
430usbd_status slhci_open(struct usbd_pipe *); 430usbd_status slhci_open(struct usbd_pipe *);
431 431
432static int slhci_roothub_ctrl(struct usbd_bus *, usb_device_request_t *, 432static int slhci_roothub_ctrl(struct usbd_bus *, usb_device_request_t *,
433 void *, int); 433 void *, int);
434 434
435/* 435/*
436 * slhci_supported_rev, slhci_preinit, slhci_attach, slhci_detach, 436 * slhci_supported_rev, slhci_preinit, slhci_attach, slhci_detach,
@@ -748,27 +748,27 @@ enter_callback(struct slhci_transfers *t @@ -748,27 +748,27 @@ enter_callback(struct slhci_transfers *t
748{ 748{
749 gcq_insert_tail(&t->q[Q_CALLBACKS], &spipe->xq); 749 gcq_insert_tail(&t->q[Q_CALLBACKS], &spipe->xq);
750} 750}
751 751
752static inline void 752static inline void
753enter_all_pipes(struct slhci_transfers *t, struct slhci_pipe *spipe) 753enter_all_pipes(struct slhci_transfers *t, struct slhci_pipe *spipe)
754{ 754{
755 gcq_insert_tail(&t->ap, &spipe->ap); 755 gcq_insert_tail(&t->ap, &spipe->ap);
756} 756}
757 757
758/* Start out of lock functions. */ 758/* Start out of lock functions. */
759 759
760struct usbd_xfer * 760struct usbd_xfer *
761slhci_allocx(struct usbd_bus *bus) 761slhci_allocx(struct usbd_bus *bus, unsigned int nframes)
762{ 762{
763 struct usbd_xfer *xfer; 763 struct usbd_xfer *xfer;
764 764
765 xfer = kmem_zalloc(sizeof(*xfer), KM_SLEEP); 765 xfer = kmem_zalloc(sizeof(*xfer), KM_SLEEP);
766 766
767 DLOG(D_MEM, "allocx %p", xfer, 0,0,0); 767 DLOG(D_MEM, "allocx %p", xfer, 0,0,0);
768 768
769#ifdef SLHCI_MEM_ACCOUNTING 769#ifdef SLHCI_MEM_ACCOUNTING
770 slhci_mem_use(bus, 1); 770 slhci_mem_use(bus, 1);
771#endif 771#endif
772#ifdef DIAGNOSTIC 772#ifdef DIAGNOSTIC
773 if (xfer != NULL) 773 if (xfer != NULL)
774 xfer->ux_state = XFER_BUSY; 774 xfer->ux_state = XFER_BUSY;

cvs diff -r1.234.2.53 -r1.234.2.54 src/sys/dev/usb/ehci.c (expand / switch to unified diff)

--- src/sys/dev/usb/ehci.c 2015/10/11 08:13:11 1.234.2.53
+++ src/sys/dev/usb/ehci.c 2015/10/11 09:17:51 1.234.2.54
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ehci.c,v 1.234.2.53 2015/10/11 08:13:11 skrll Exp $ */ 1/* $NetBSD: ehci.c,v 1.234.2.54 2015/10/11 09:17:51 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.53 2015/10/11 08:13:11 skrll Exp $"); 56__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.54 2015/10/11 09:17:51 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>
@@ -155,27 +155,27 @@ Static int ehci_intr1(ehci_softc_t *); @@ -155,27 +155,27 @@ Static int ehci_intr1(ehci_softc_t *);
155Static void ehci_waitintr(ehci_softc_t *, struct usbd_xfer *); 155Static void ehci_waitintr(ehci_softc_t *, struct usbd_xfer *);
156Static void ehci_check_intr(ehci_softc_t *, struct ehci_xfer *); 156Static void ehci_check_intr(ehci_softc_t *, struct ehci_xfer *);
157Static void ehci_check_qh_intr(ehci_softc_t *, struct ehci_xfer *); 157Static void ehci_check_qh_intr(ehci_softc_t *, struct ehci_xfer *);
158Static void ehci_check_itd_intr(ehci_softc_t *, struct ehci_xfer *); 158Static void ehci_check_itd_intr(ehci_softc_t *, struct ehci_xfer *);
159Static void ehci_check_sitd_intr(ehci_softc_t *, struct ehci_xfer *); 159Static void ehci_check_sitd_intr(ehci_softc_t *, struct ehci_xfer *);
160Static void ehci_idone(struct ehci_xfer *); 160Static void ehci_idone(struct ehci_xfer *);
161Static void ehci_timeout(void *); 161Static void ehci_timeout(void *);
162Static void ehci_timeout_task(void *); 162Static void ehci_timeout_task(void *);
163Static void ehci_intrlist_timeout(void *); 163Static void ehci_intrlist_timeout(void *);
164Static void ehci_doorbell(void *); 164Static void ehci_doorbell(void *);
165Static void ehci_pcd(void *); 165Static void ehci_pcd(void *);
166 166
167Static struct usbd_xfer * 167Static struct usbd_xfer *
168 ehci_allocx(struct usbd_bus *); 168 ehci_allocx(struct usbd_bus *, unsigned int);
169Static void ehci_freex(struct usbd_bus *, struct usbd_xfer *); 169Static void ehci_freex(struct usbd_bus *, struct usbd_xfer *);
170Static void ehci_get_lock(struct usbd_bus *, kmutex_t **); 170Static void ehci_get_lock(struct usbd_bus *, kmutex_t **);
171Static int ehci_roothub_ctrl(struct usbd_bus *, 171Static int ehci_roothub_ctrl(struct usbd_bus *,
172 usb_device_request_t *, void *, int); 172 usb_device_request_t *, void *, int);
173 173
174Static usbd_status ehci_root_intr_transfer(struct usbd_xfer *); 174Static usbd_status ehci_root_intr_transfer(struct usbd_xfer *);
175Static usbd_status ehci_root_intr_start(struct usbd_xfer *); 175Static usbd_status ehci_root_intr_start(struct usbd_xfer *);
176Static void ehci_root_intr_abort(struct usbd_xfer *); 176Static void ehci_root_intr_abort(struct usbd_xfer *);
177Static void ehci_root_intr_close(struct usbd_pipe *); 177Static void ehci_root_intr_close(struct usbd_pipe *);
178Static void ehci_root_intr_done(struct usbd_xfer *); 178Static void ehci_root_intr_done(struct usbd_xfer *);
179 179
180Static usbd_status ehci_device_ctrl_transfer(struct usbd_xfer *); 180Static usbd_status ehci_device_ctrl_transfer(struct usbd_xfer *);
181Static usbd_status ehci_device_ctrl_start(struct usbd_xfer *); 181Static usbd_status ehci_device_ctrl_start(struct usbd_xfer *);
@@ -1503,27 +1503,27 @@ ehci_resume(device_t dv, const pmf_qual_ @@ -1503,27 +1503,27 @@ ehci_resume(device_t dv, const pmf_qual_
1503bool 1503bool
1504ehci_shutdown(device_t self, int flags) 1504ehci_shutdown(device_t self, int flags)
1505{ 1505{
1506 ehci_softc_t *sc = device_private(self); 1506 ehci_softc_t *sc = device_private(self);
1507 1507
1508 USBHIST_FUNC(); USBHIST_CALLED(ehcidebug); 1508 USBHIST_FUNC(); USBHIST_CALLED(ehcidebug);
1509 1509
1510 EOWRITE4(sc, EHCI_USBCMD, 0); /* Halt controller */ 1510 EOWRITE4(sc, EHCI_USBCMD, 0); /* Halt controller */
1511 EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET); 1511 EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET);
1512 return true; 1512 return true;
1513} 1513}
1514 1514
1515Static struct usbd_xfer * 1515Static struct usbd_xfer *
1516ehci_allocx(struct usbd_bus *bus) 1516ehci_allocx(struct usbd_bus *bus, unsigned int nframes)
1517{ 1517{
1518 struct ehci_softc *sc = bus->ub_hcpriv; 1518 struct ehci_softc *sc = bus->ub_hcpriv;
1519 struct usbd_xfer *xfer; 1519 struct usbd_xfer *xfer;
1520 1520
1521 xfer = pool_cache_get(sc->sc_xferpool, PR_NOWAIT); 1521 xfer = pool_cache_get(sc->sc_xferpool, PR_NOWAIT);
1522 if (xfer != NULL) { 1522 if (xfer != NULL) {
1523 memset(xfer, 0, sizeof(struct ehci_xfer)); 1523 memset(xfer, 0, sizeof(struct ehci_xfer));
1524#ifdef DIAGNOSTIC 1524#ifdef DIAGNOSTIC
1525 struct ehci_xfer *ex = EHCI_XFER2EXFER(xfer); 1525 struct ehci_xfer *ex = EHCI_XFER2EXFER(xfer);
1526 ex->ex_isdone = true; 1526 ex->ex_isdone = true;
1527 xfer->ux_state = XFER_BUSY; 1527 xfer->ux_state = XFER_BUSY;
1528#endif 1528#endif
1529 } 1529 }

cvs diff -r1.12.2.18 -r1.12.2.19 src/sys/dev/usb/motg.c (expand / switch to unified diff)

--- src/sys/dev/usb/motg.c 2015/09/22 12:06:01 1.12.2.18
+++ src/sys/dev/usb/motg.c 2015/10/11 09:17:51 1.12.2.19
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: motg.c,v 1.12.2.18 2015/09/22 12:06:01 skrll Exp $ */ 1/* $NetBSD: motg.c,v 1.12.2.19 2015/10/11 09:17:51 skrll Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2004, 2011, 2012, 2014 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 2004, 2011, 2012, 2014 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, Jared D. McNeill (jmcneill@invisible.ca), 9 * Carlstedt Research & Technology, Jared D. McNeill (jmcneill@invisible.ca),
10 * Matthew R. Green (mrg@eterna.com.au), and Manuel Bouyer (bouyer@netbsd.org). 10 * Matthew R. Green (mrg@eterna.com.au), and Manuel Bouyer (bouyer@netbsd.org).
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:
@@ -32,27 +32,27 @@ @@ -32,27 +32,27 @@
32 */ 32 */
33 33
34 34
35/* 35/*
36 * This file contains the driver for the Mentor Graphics Inventra USB 36 * This file contains the driver for the Mentor Graphics Inventra USB
37 * 2.0 High Speed Dual-Role controller. 37 * 2.0 High Speed Dual-Role controller.
38 * 38 *
39 * NOTE: The current implementation only supports Device Side Mode! 39 * NOTE: The current implementation only supports Device Side Mode!
40 */ 40 */
41 41
42#include "opt_motg.h" 42#include "opt_motg.h"
43 43
44#include <sys/cdefs.h> 44#include <sys/cdefs.h>
45__KERNEL_RCSID(0, "$NetBSD: motg.c,v 1.12.2.18 2015/09/22 12:06:01 skrll Exp $"); 45__KERNEL_RCSID(0, "$NetBSD: motg.c,v 1.12.2.19 2015/10/11 09:17:51 skrll Exp $");
46 46
47#include <sys/param.h> 47#include <sys/param.h>
48 48
49#include <sys/bus.h> 49#include <sys/bus.h>
50#include <sys/cpu.h> 50#include <sys/cpu.h>
51#include <sys/device.h> 51#include <sys/device.h>
52#include <sys/kernel.h> 52#include <sys/kernel.h>
53#include <sys/kmem.h> 53#include <sys/kmem.h>
54#include <sys/proc.h> 54#include <sys/proc.h>
55#include <sys/queue.h> 55#include <sys/queue.h>
56#include <sys/select.h> 56#include <sys/select.h>
57#include <sys/sysctl.h> 57#include <sys/sysctl.h>
58#include <sys/systm.h> 58#include <sys/systm.h>
@@ -134,27 +134,28 @@ fail: @@ -134,27 +134,28 @@ fail:
134#define NAK_TO_BULK_HIGH 0 134#define NAK_TO_BULK_HIGH 0
135 135
136static void motg_hub_change(struct motg_softc *); 136static void motg_hub_change(struct motg_softc *);
137 137
138static usbd_status motg_root_intr_transfer(struct usbd_xfer *); 138static usbd_status motg_root_intr_transfer(struct usbd_xfer *);
139static usbd_status motg_root_intr_start(struct usbd_xfer *); 139static usbd_status motg_root_intr_start(struct usbd_xfer *);
140static void motg_root_intr_abort(struct usbd_xfer *); 140static void motg_root_intr_abort(struct usbd_xfer *);
141static void motg_root_intr_close(struct usbd_pipe *); 141static void motg_root_intr_close(struct usbd_pipe *);
142static void motg_root_intr_done(struct usbd_xfer *); 142static void motg_root_intr_done(struct usbd_xfer *);
143 143
144static usbd_status motg_open(struct usbd_pipe *); 144static usbd_status motg_open(struct usbd_pipe *);
145static void motg_poll(struct usbd_bus *); 145static void motg_poll(struct usbd_bus *);
146static void motg_softintr(void *); 146static void motg_softintr(void *);
147static struct usbd_xfer * motg_allocx(struct usbd_bus *); 147static struct usbd_xfer *
 148 motg_allocx(struct usbd_bus *, unsigned int);
148static void motg_freex(struct usbd_bus *, struct usbd_xfer *); 149static void motg_freex(struct usbd_bus *, struct usbd_xfer *);
149static void motg_get_lock(struct usbd_bus *, kmutex_t **); 150static void motg_get_lock(struct usbd_bus *, kmutex_t **);
150static int motg_roothub_ctrl(struct usbd_bus *, usb_device_request_t *, 151static int motg_roothub_ctrl(struct usbd_bus *, usb_device_request_t *,
151 void *, int); 152 void *, int);
152 153
153static void motg_noop(struct usbd_pipe *pipe); 154static void motg_noop(struct usbd_pipe *pipe);
154static usbd_status motg_portreset(struct motg_softc*); 155static usbd_status motg_portreset(struct motg_softc*);
155 156
156static usbd_status motg_device_ctrl_transfer(struct usbd_xfer *); 157static usbd_status motg_device_ctrl_transfer(struct usbd_xfer *);
157static usbd_status motg_device_ctrl_start(struct usbd_xfer *); 158static usbd_status motg_device_ctrl_start(struct usbd_xfer *);
158static void motg_device_ctrl_abort(struct usbd_xfer *); 159static void motg_device_ctrl_abort(struct usbd_xfer *);
159static void motg_device_ctrl_close(struct usbd_pipe *); 160static void motg_device_ctrl_close(struct usbd_pipe *);
160static void motg_device_ctrl_done(struct usbd_xfer *); 161static void motg_device_ctrl_done(struct usbd_xfer *);
@@ -735,27 +736,27 @@ motg_intr_vbus(struct motg_softc *sc, in @@ -735,27 +736,27 @@ motg_intr_vbus(struct motg_softc *sc, in
735 MOTGHIST_FUNC(); MOTGHIST_CALLED(); 736 MOTGHIST_FUNC(); MOTGHIST_CALLED();
736 737
737 if (sc->sc_mode == MOTG_MODE_HOST && vbus == 0) { 738 if (sc->sc_mode == MOTG_MODE_HOST && vbus == 0) {
738 DPRINTF("vbus down, try to re-enable", 0, 0, 0, 0); 739 DPRINTF("vbus down, try to re-enable", 0, 0, 0, 0);
739 /* try to re-enter session for Host mode */ 740 /* try to re-enter session for Host mode */
740 val = UREAD1(sc, MUSB2_REG_DEVCTL); 741 val = UREAD1(sc, MUSB2_REG_DEVCTL);
741 val |= MUSB2_MASK_SESS; 742 val |= MUSB2_MASK_SESS;
742 UWRITE1(sc, MUSB2_REG_DEVCTL, val); 743 UWRITE1(sc, MUSB2_REG_DEVCTL, val);
743 } 744 }
744 return 1; 745 return 1;
745} 746}
746 747
747struct usbd_xfer * 748struct usbd_xfer *
748motg_allocx(struct usbd_bus *bus) 749motg_allocx(struct usbd_bus *bus, unsigned int nframes)
749{ 750{
750 struct motg_softc *sc = bus->ub_hcpriv; 751 struct motg_softc *sc = bus->ub_hcpriv;
751 struct usbd_xfer *xfer; 752 struct usbd_xfer *xfer;
752 753
753 xfer = pool_cache_get(sc->sc_xferpool, PR_NOWAIT); 754 xfer = pool_cache_get(sc->sc_xferpool, PR_NOWAIT);
754 if (xfer != NULL) { 755 if (xfer != NULL) {
755 memset(xfer, 0, sizeof(struct motg_xfer)); 756 memset(xfer, 0, sizeof(struct motg_xfer));
756 UXFER(xfer)->sc = sc; 757 UXFER(xfer)->sc = sc;
757#ifdef DIAGNOSTIC 758#ifdef DIAGNOSTIC
758 // XXX UXFER(xfer)->iinfo.isdone = 1; 759 // XXX UXFER(xfer)->iinfo.isdone = 1;
759 xfer->ux_state = XFER_BUSY; 760 xfer->ux_state = XFER_BUSY;
760#endif 761#endif
761 } 762 }

cvs diff -r1.254.2.22 -r1.254.2.23 src/sys/dev/usb/ohci.c (expand / switch to unified diff)

--- src/sys/dev/usb/ohci.c 2015/09/22 12:06:01 1.254.2.22
+++ src/sys/dev/usb/ohci.c 2015/10/11 09:17:51 1.254.2.23
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ohci.c,v 1.254.2.22 2015/09/22 12:06:01 skrll Exp $ */ 1/* $NetBSD: ohci.c,v 1.254.2.23 2015/10/11 09:17:51 skrll Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 2004, 2005, 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, Jared D. McNeill (jmcneill@invisible.ca) 9 * Carlstedt Research & Technology, Jared D. McNeill (jmcneill@invisible.ca)
10 * and Matthew R. Green (mrg@eterna.com.au). 10 * and Matthew R. Green (mrg@eterna.com.au).
11 * This code is derived from software contributed to The NetBSD Foundation 11 * This code is derived from software contributed to The NetBSD Foundation
12 * by Charles M. Hannum. 12 * by Charles M. Hannum.
13 * 13 *
14 * Redistribution and use in source and binary forms, with or without 14 * Redistribution and use in source and binary forms, with or without
@@ -31,27 +31,27 @@ @@ -31,27 +31,27 @@
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE. 33 * POSSIBILITY OF SUCH DAMAGE.
34 */ 34 */
35 35
36/* 36/*
37 * USB Open Host Controller driver. 37 * USB Open Host Controller driver.
38 * 38 *
39 * OHCI spec: http://www.compaq.com/productinfo/development/openhci.html 39 * OHCI spec: http://www.compaq.com/productinfo/development/openhci.html
40 * USB spec: http://www.usb.org/developers/docs/ 40 * USB spec: http://www.usb.org/developers/docs/
41 */ 41 */
42 42
43#include <sys/cdefs.h> 43#include <sys/cdefs.h>
44__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.22 2015/09/22 12:06:01 skrll Exp $"); 44__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.23 2015/10/11 09:17:51 skrll Exp $");
45 45
46#include "opt_usb.h" 46#include "opt_usb.h"
47 47
48#include <sys/param.h> 48#include <sys/param.h>
49 49
50#include <sys/cpu.h> 50#include <sys/cpu.h>
51#include <sys/device.h> 51#include <sys/device.h>
52#include <sys/kernel.h> 52#include <sys/kernel.h>
53#include <sys/kmem.h> 53#include <sys/kmem.h>
54#include <sys/proc.h> 54#include <sys/proc.h>
55#include <sys/queue.h> 55#include <sys/queue.h>
56#include <sys/select.h> 56#include <sys/select.h>
57#include <sys/sysctl.h> 57#include <sys/sysctl.h>
@@ -152,27 +152,28 @@ Static void ohci_add_ed(ohci_softc_t *, @@ -152,27 +152,28 @@ Static void ohci_add_ed(ohci_softc_t *,
152 152
153Static void ohci_rem_ed(ohci_softc_t *, ohci_soft_ed_t *, 153Static void ohci_rem_ed(ohci_softc_t *, ohci_soft_ed_t *,
154 ohci_soft_ed_t *); 154 ohci_soft_ed_t *);
155Static void ohci_hash_add_td(ohci_softc_t *, ohci_soft_td_t *); 155Static void ohci_hash_add_td(ohci_softc_t *, ohci_soft_td_t *);
156Static void ohci_hash_rem_td(ohci_softc_t *, ohci_soft_td_t *); 156Static void ohci_hash_rem_td(ohci_softc_t *, ohci_soft_td_t *);
157Static ohci_soft_td_t *ohci_hash_find_td(ohci_softc_t *, ohci_physaddr_t); 157Static ohci_soft_td_t *ohci_hash_find_td(ohci_softc_t *, ohci_physaddr_t);
158Static void ohci_hash_add_itd(ohci_softc_t *, ohci_soft_itd_t *); 158Static void ohci_hash_add_itd(ohci_softc_t *, ohci_soft_itd_t *);
159Static void ohci_hash_rem_itd(ohci_softc_t *, ohci_soft_itd_t *); 159Static void ohci_hash_rem_itd(ohci_softc_t *, ohci_soft_itd_t *);
160Static ohci_soft_itd_t *ohci_hash_find_itd(ohci_softc_t *, ohci_physaddr_t); 160Static ohci_soft_itd_t *ohci_hash_find_itd(ohci_softc_t *, ohci_physaddr_t);
161 161
162Static usbd_status ohci_setup_isoc(struct usbd_pipe *); 162Static usbd_status ohci_setup_isoc(struct usbd_pipe *);
163Static void ohci_device_isoc_enter(struct usbd_xfer *); 163Static void ohci_device_isoc_enter(struct usbd_xfer *);
164 164
165Static struct usbd_xfer * ohci_allocx(struct usbd_bus *); 165Static struct usbd_xfer *
 166 ohci_allocx(struct usbd_bus *, unsigned int);
166Static void ohci_freex(struct usbd_bus *, struct usbd_xfer *); 167Static void ohci_freex(struct usbd_bus *, struct usbd_xfer *);
167Static void ohci_get_lock(struct usbd_bus *, kmutex_t **); 168Static void ohci_get_lock(struct usbd_bus *, kmutex_t **);
168Static int ohci_roothub_ctrl(struct usbd_bus *, 169Static int ohci_roothub_ctrl(struct usbd_bus *,
169 usb_device_request_t *, void *, int); 170 usb_device_request_t *, void *, int);
170 171
171Static usbd_status ohci_root_intr_transfer(struct usbd_xfer *); 172Static usbd_status ohci_root_intr_transfer(struct usbd_xfer *);
172Static usbd_status ohci_root_intr_start(struct usbd_xfer *); 173Static usbd_status ohci_root_intr_start(struct usbd_xfer *);
173Static void ohci_root_intr_abort(struct usbd_xfer *); 174Static void ohci_root_intr_abort(struct usbd_xfer *);
174Static void ohci_root_intr_close(struct usbd_pipe *); 175Static void ohci_root_intr_close(struct usbd_pipe *);
175Static void ohci_root_intr_done(struct usbd_xfer *); 176Static void ohci_root_intr_done(struct usbd_xfer *);
176 177
177Static usbd_status ohci_device_ctrl_transfer(struct usbd_xfer *); 178Static usbd_status ohci_device_ctrl_transfer(struct usbd_xfer *);
178Static usbd_status ohci_device_ctrl_start(struct usbd_xfer *); 179Static usbd_status ohci_device_ctrl_start(struct usbd_xfer *);
@@ -938,27 +939,27 @@ ohci_init(ohci_softc_t *sc) @@ -938,27 +939,27 @@ ohci_init(ohci_softc_t *sc)
938 bad4: 939 bad4:
939 ohci_free_sed(sc, sc->sc_isoc_head); 940 ohci_free_sed(sc, sc->sc_isoc_head);
940 bad3: 941 bad3:
941 ohci_free_sed(sc, sc->sc_bulk_head); 942 ohci_free_sed(sc, sc->sc_bulk_head);
942 bad2: 943 bad2:
943 ohci_free_sed(sc, sc->sc_ctrl_head); 944 ohci_free_sed(sc, sc->sc_ctrl_head);
944 bad1: 945 bad1:
945 usb_freemem(&sc->sc_bus, &sc->sc_hccadma); 946 usb_freemem(&sc->sc_bus, &sc->sc_hccadma);
946 sc->sc_hcca = NULL; 947 sc->sc_hcca = NULL;
947 return err; 948 return err;
948} 949}
949 950
950struct usbd_xfer * 951struct usbd_xfer *
951ohci_allocx(struct usbd_bus *bus) 952ohci_allocx(struct usbd_bus *bus, unsigned int nframes)
952{ 953{
953 struct ohci_softc *sc = bus->ub_hcpriv; 954 struct ohci_softc *sc = bus->ub_hcpriv;
954 struct usbd_xfer *xfer; 955 struct usbd_xfer *xfer;
955 956
956 xfer = pool_cache_get(sc->sc_xferpool, PR_NOWAIT); 957 xfer = pool_cache_get(sc->sc_xferpool, PR_NOWAIT);
957 if (xfer != NULL) { 958 if (xfer != NULL) {
958 memset(xfer, 0, sizeof(struct ohci_xfer)); 959 memset(xfer, 0, sizeof(struct ohci_xfer));
959#ifdef DIAGNOSTIC 960#ifdef DIAGNOSTIC
960 xfer->ux_state = XFER_BUSY; 961 xfer->ux_state = XFER_BUSY;
961#endif 962#endif
962 } 963 }
963 return xfer; 964 return xfer;
964} 965}

cvs diff -r1.264.4.35 -r1.264.4.36 src/sys/dev/usb/uhci.c (expand / switch to unified diff)

--- src/sys/dev/usb/uhci.c 2015/09/29 11:38:29 1.264.4.35
+++ src/sys/dev/usb/uhci.c 2015/10/11 09:17:51 1.264.4.36
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: uhci.c,v 1.264.4.35 2015/09/29 11:38:29 skrll Exp $ */ 1/* $NetBSD: uhci.c,v 1.264.4.36 2015/10/11 09:17:51 skrll Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 2004, 2011, 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, Jared D. McNeill (jmcneill@invisible.ca) 9 * Carlstedt Research & Technology, Jared D. McNeill (jmcneill@invisible.ca)
10 * and Matthew R. Green (mrg@eterna.com.au). 10 * 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:
@@ -32,27 +32,27 @@ @@ -32,27 +32,27 @@
32 */ 32 */
33 33
34/* 34/*
35 * USB Universal Host Controller driver. 35 * USB Universal Host Controller driver.
36 * Handles e.g. PIIX3 and PIIX4. 36 * Handles e.g. PIIX3 and PIIX4.
37 * 37 *
38 * UHCI spec: http://www.intel.com/technology/usb/spec.htm 38 * UHCI spec: http://www.intel.com/technology/usb/spec.htm
39 * USB spec: http://www.usb.org/developers/docs/ 39 * USB spec: http://www.usb.org/developers/docs/
40 * PIIXn spec: ftp://download.intel.com/design/intarch/datashts/29055002.pdf 40 * PIIXn spec: ftp://download.intel.com/design/intarch/datashts/29055002.pdf
41 * ftp://download.intel.com/design/intarch/datashts/29056201.pdf 41 * ftp://download.intel.com/design/intarch/datashts/29056201.pdf
42 */ 42 */
43 43
44#include <sys/cdefs.h> 44#include <sys/cdefs.h>
45__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.264.4.35 2015/09/29 11:38:29 skrll Exp $"); 45__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.264.4.36 2015/10/11 09:17:51 skrll Exp $");
46 46
47#include "opt_usb.h" 47#include "opt_usb.h"
48 48
49#include <sys/param.h> 49#include <sys/param.h>
50 50
51#include <sys/bus.h> 51#include <sys/bus.h>
52#include <sys/cpu.h> 52#include <sys/cpu.h>
53#include <sys/device.h> 53#include <sys/device.h>
54#include <sys/kernel.h> 54#include <sys/kernel.h>
55#include <sys/kmem.h> 55#include <sys/kmem.h>
56#include <sys/mutex.h> 56#include <sys/mutex.h>
57#include <sys/proc.h> 57#include <sys/proc.h>
58#include <sys/queue.h> 58#include <sys/queue.h>
@@ -192,27 +192,28 @@ Static void uhci_timeout(void *); @@ -192,27 +192,28 @@ Static void uhci_timeout(void *);
192Static void uhci_timeout_task(void *); 192Static void uhci_timeout_task(void *);
193Static void uhci_add_ls_ctrl(uhci_softc_t *, uhci_soft_qh_t *); 193Static void uhci_add_ls_ctrl(uhci_softc_t *, uhci_soft_qh_t *);
194Static void uhci_add_hs_ctrl(uhci_softc_t *, uhci_soft_qh_t *); 194Static void uhci_add_hs_ctrl(uhci_softc_t *, uhci_soft_qh_t *);
195Static void uhci_add_bulk(uhci_softc_t *, uhci_soft_qh_t *); 195Static void uhci_add_bulk(uhci_softc_t *, uhci_soft_qh_t *);
196Static void uhci_remove_ls_ctrl(uhci_softc_t *,uhci_soft_qh_t *); 196Static void uhci_remove_ls_ctrl(uhci_softc_t *,uhci_soft_qh_t *);
197Static void uhci_remove_hs_ctrl(uhci_softc_t *,uhci_soft_qh_t *); 197Static void uhci_remove_hs_ctrl(uhci_softc_t *,uhci_soft_qh_t *);
198Static void uhci_remove_bulk(uhci_softc_t *,uhci_soft_qh_t *); 198Static void uhci_remove_bulk(uhci_softc_t *,uhci_soft_qh_t *);
199Static void uhci_add_loop(uhci_softc_t *); 199Static void uhci_add_loop(uhci_softc_t *);
200Static void uhci_rem_loop(uhci_softc_t *); 200Static void uhci_rem_loop(uhci_softc_t *);
201 201
202Static usbd_status uhci_setup_isoc(struct usbd_pipe *); 202Static usbd_status uhci_setup_isoc(struct usbd_pipe *);
203Static void uhci_device_isoc_enter(struct usbd_xfer *); 203Static void uhci_device_isoc_enter(struct usbd_xfer *);
204 204
205Static struct usbd_xfer * uhci_allocx(struct usbd_bus *); 205Static struct usbd_xfer *
 206 uhci_allocx(struct usbd_bus *, unsigned int);
206Static void uhci_freex(struct usbd_bus *, struct usbd_xfer *); 207Static void uhci_freex(struct usbd_bus *, struct usbd_xfer *);
207Static void uhci_get_lock(struct usbd_bus *, kmutex_t **); 208Static void uhci_get_lock(struct usbd_bus *, kmutex_t **);
208Static int uhci_roothub_ctrl(struct usbd_bus *, 209Static int uhci_roothub_ctrl(struct usbd_bus *,
209 usb_device_request_t *, void *, int); 210 usb_device_request_t *, void *, int);
210 211
211Static usbd_status uhci_device_ctrl_transfer(struct usbd_xfer *); 212Static usbd_status uhci_device_ctrl_transfer(struct usbd_xfer *);
212Static usbd_status uhci_device_ctrl_start(struct usbd_xfer *); 213Static usbd_status uhci_device_ctrl_start(struct usbd_xfer *);
213Static void uhci_device_ctrl_abort(struct usbd_xfer *); 214Static void uhci_device_ctrl_abort(struct usbd_xfer *);
214Static void uhci_device_ctrl_close(struct usbd_pipe *); 215Static void uhci_device_ctrl_close(struct usbd_pipe *);
215Static void uhci_device_ctrl_done(struct usbd_xfer *); 216Static void uhci_device_ctrl_done(struct usbd_xfer *);
216 217
217Static usbd_status uhci_device_intr_transfer(struct usbd_xfer *); 218Static usbd_status uhci_device_intr_transfer(struct usbd_xfer *);
218Static usbd_status uhci_device_intr_start(struct usbd_xfer *); 219Static usbd_status uhci_device_intr_start(struct usbd_xfer *);
@@ -603,27 +604,27 @@ uhci_detach(struct uhci_softc *sc, int f @@ -603,27 +604,27 @@ uhci_detach(struct uhci_softc *sc, int f
603 cv_destroy(&sc->sc_softwake_cv); 604 cv_destroy(&sc->sc_softwake_cv);
604 605
605 mutex_destroy(&sc->sc_lock); 606 mutex_destroy(&sc->sc_lock);
606 mutex_destroy(&sc->sc_intr_lock); 607 mutex_destroy(&sc->sc_intr_lock);
607 608
608 pool_cache_destroy(sc->sc_xferpool); 609 pool_cache_destroy(sc->sc_xferpool);
609 610
610 /* XXX free other data structures XXX */ 611 /* XXX free other data structures XXX */
611 612
612 return rv; 613 return rv;
613} 614}
614 615
615struct usbd_xfer * 616struct usbd_xfer *
616uhci_allocx(struct usbd_bus *bus) 617uhci_allocx(struct usbd_bus *bus, unsigned int nframes)
617{ 618{
618 struct uhci_softc *sc = bus->ub_hcpriv; 619 struct uhci_softc *sc = bus->ub_hcpriv;
619 struct usbd_xfer *xfer; 620 struct usbd_xfer *xfer;
620 621
621 xfer = pool_cache_get(sc->sc_xferpool, PR_NOWAIT); 622 xfer = pool_cache_get(sc->sc_xferpool, PR_NOWAIT);
622 if (xfer != NULL) { 623 if (xfer != NULL) {
623 memset(xfer, 0, sizeof(struct uhci_xfer)); 624 memset(xfer, 0, sizeof(struct uhci_xfer));
624 625
625 struct uhci_xfer *uxfer = UXFER(xfer); 626 struct uhci_xfer *uxfer = UXFER(xfer);
626 uxfer->iinfo.sc = sc; 627 uxfer->iinfo.sc = sc;
627#ifdef DIAGNOSTIC 628#ifdef DIAGNOSTIC
628 uxfer->iinfo.isdone = true; 629 uxfer->iinfo.isdone = true;
629 xfer->ux_state = XFER_BUSY; 630 xfer->ux_state = XFER_BUSY;

cvs diff -r1.162.2.30 -r1.162.2.31 src/sys/dev/usb/usbdi.c (expand / switch to unified diff)

--- src/sys/dev/usb/usbdi.c 2015/10/10 07:23:25 1.162.2.30
+++ src/sys/dev/usb/usbdi.c 2015/10/11 09:17:51 1.162.2.31
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: usbdi.c,v 1.162.2.30 2015/10/10 07:23:25 skrll Exp $ */ 1/* $NetBSD: usbdi.c,v 1.162.2.31 2015/10/11 09:17:51 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.30 2015/10/10 07:23:25 skrll Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.162.2.31 2015/10/11 09:17:51 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#include "usb_dma.h" 39#include "usb_dma.h"
40#endif 40#endif
41 41
42#include <sys/param.h> 42#include <sys/param.h>
43#include <sys/systm.h> 43#include <sys/systm.h>
44#include <sys/kernel.h> 44#include <sys/kernel.h>
45#include <sys/device.h> 45#include <sys/device.h>
46#include <sys/kmem.h> 46#include <sys/kmem.h>
47#include <sys/proc.h> 47#include <sys/proc.h>
@@ -57,27 +57,27 @@ __KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1. @@ -57,27 +57,27 @@ __KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.
57#include <dev/usb/usbhist.h> 57#include <dev/usb/usbhist.h>
58 58
59/* UTF-8 encoding stuff */ 59/* UTF-8 encoding stuff */
60#include <fs/unicode.h> 60#include <fs/unicode.h>
61 61
62extern int usbdebug; 62extern int usbdebug;
63 63
64Static usbd_status usbd_ar_pipe(struct usbd_pipe *); 64Static usbd_status usbd_ar_pipe(struct usbd_pipe *);
65Static void usbd_start_next(struct usbd_pipe *); 65Static void usbd_start_next(struct usbd_pipe *);
66Static usbd_status usbd_open_pipe_ival 66Static usbd_status usbd_open_pipe_ival
67 (struct usbd_interface *, uint8_t, uint8_t, struct usbd_pipe **, int); 67 (struct usbd_interface *, uint8_t, uint8_t, struct usbd_pipe **, int);
68static void *usbd_alloc_buffer(struct usbd_xfer *, uint32_t); 68static void *usbd_alloc_buffer(struct usbd_xfer *, uint32_t);
69static void usbd_free_buffer(struct usbd_xfer *); 69static void usbd_free_buffer(struct usbd_xfer *);
70static struct usbd_xfer *usbd_alloc_xfer(struct usbd_device *); 70static struct usbd_xfer *usbd_alloc_xfer(struct usbd_device *, unsigned int);
71static usbd_status usbd_free_xfer(struct usbd_xfer *); 71static usbd_status usbd_free_xfer(struct usbd_xfer *);
72 72
73#if defined(USB_DEBUG) 73#if defined(USB_DEBUG)
74void 74void
75usbd_dump_iface(struct usbd_interface *iface) 75usbd_dump_iface(struct usbd_interface *iface)
76{ 76{
77 USBHIST_FUNC(); USBHIST_CALLED(usbdebug); 77 USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
78 78
79 USBHIST_LOG(usbdebug, "iface %p", iface, 0, 0, 0); 79 USBHIST_LOG(usbdebug, "iface %p", iface, 0, 0, 0);
80 if (iface == NULL) 80 if (iface == NULL)
81 return; 81 return;
82 USBHIST_LOG(usbdebug, " device = %p idesc = %p index = %d", 82 USBHIST_LOG(usbdebug, " device = %p idesc = %p index = %d",
83 iface->ui_dev, iface->ui_idesc, iface->ui_index, 0); 83 iface->ui_dev, iface->ui_idesc, iface->ui_index, 0);
@@ -435,35 +435,35 @@ void * @@ -435,35 +435,35 @@ void *
435usbd_get_buffer(struct usbd_xfer *xfer) 435usbd_get_buffer(struct usbd_xfer *xfer)
436{ 436{
437 return xfer->ux_buf; 437 return xfer->ux_buf;
438} 438}
439 439
440struct usbd_pipe * 440struct usbd_pipe *
441usbd_get_pipe0(struct usbd_device *dev) 441usbd_get_pipe0(struct usbd_device *dev)
442{ 442{
443 443
444 return dev->ud_pipe0; 444 return dev->ud_pipe0;
445} 445}
446 446
447static struct usbd_xfer * 447static struct usbd_xfer *
448usbd_alloc_xfer(struct usbd_device *dev) 448usbd_alloc_xfer(struct usbd_device *dev, unsigned int nframes)
449{ 449{
450 struct usbd_xfer *xfer; 450 struct usbd_xfer *xfer;
451 451
452 USBHIST_FUNC(); USBHIST_CALLED(usbdebug); 452 USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
453 453
454 ASSERT_SLEEPABLE(); 454 ASSERT_SLEEPABLE();
455 455
456 xfer = dev->ud_bus->ub_methods->ubm_allocx(dev->ud_bus); 456 xfer = dev->ud_bus->ub_methods->ubm_allocx(dev->ud_bus, nframes);
457 if (xfer == NULL) 457 if (xfer == NULL)
458 return NULL; 458 return NULL;
459 xfer->ux_dev = dev; 459 xfer->ux_dev = dev;
460 callout_init(&xfer->ux_callout, CALLOUT_MPSAFE); 460 callout_init(&xfer->ux_callout, CALLOUT_MPSAFE);
461 cv_init(&xfer->ux_cv, "usbxfer"); 461 cv_init(&xfer->ux_cv, "usbxfer");
462 cv_init(&xfer->ux_hccv, "usbhcxfer"); 462 cv_init(&xfer->ux_hccv, "usbhcxfer");
463 463
464 USBHIST_LOG(usbdebug, "returns %p", xfer, 0, 0, 0); 464 USBHIST_LOG(usbdebug, "returns %p", xfer, 0, 0, 0);
465 465
466 return xfer; 466 return xfer;
467} 467}
468 468
469static usbd_status 469static usbd_status
@@ -483,27 +483,27 @@ usbd_free_xfer(struct usbd_xfer *xfer) @@ -483,27 +483,27 @@ usbd_free_xfer(struct usbd_xfer *xfer)
483#endif 483#endif
484 cv_destroy(&xfer->ux_cv); 484 cv_destroy(&xfer->ux_cv);
485 cv_destroy(&xfer->ux_hccv); 485 cv_destroy(&xfer->ux_hccv);
486 xfer->ux_dev->ud_bus->ub_methods->ubm_freex(xfer->ux_dev->ud_bus, xfer); 486 xfer->ux_dev->ud_bus->ub_methods->ubm_freex(xfer->ux_dev->ud_bus, xfer);
487 return USBD_NORMAL_COMPLETION; 487 return USBD_NORMAL_COMPLETION;
488} 488}
489 489
490int 490int
491usbd_create_xfer(struct usbd_pipe *pipe, size_t len, unsigned int flags, 491usbd_create_xfer(struct usbd_pipe *pipe, size_t len, unsigned int flags,
492 unsigned int nframes, struct usbd_xfer **xp) 492 unsigned int nframes, struct usbd_xfer **xp)
493{ 493{
494 KASSERT(xp != NULL); 494 KASSERT(xp != NULL);
495 495
496 struct usbd_xfer *xfer = usbd_alloc_xfer(pipe->up_dev); 496 struct usbd_xfer *xfer = usbd_alloc_xfer(pipe->up_dev, nframes);
497 if (xfer == NULL) 497 if (xfer == NULL)
498 return ENOMEM; 498 return ENOMEM;
499 499
500 if (len) { 500 if (len) {
501 void *buf = usbd_alloc_buffer(xfer, len); 501 void *buf = usbd_alloc_buffer(xfer, len);
502 if (!buf) { 502 if (!buf) {
503 usbd_free_xfer(xfer); 503 usbd_free_xfer(xfer);
504 return ENOMEM; 504 return ENOMEM;
505 } 505 }
506 } 506 }
507 xfer->ux_pipe = pipe; 507 xfer->ux_pipe = pipe;
508 xfer->ux_flags = flags; 508 xfer->ux_flags = flags;
509 xfer->ux_nframes = nframes; 509 xfer->ux_nframes = nframes;
@@ -1043,27 +1043,27 @@ usbd_do_request_flags(struct usbd_device @@ -1043,27 +1043,27 @@ usbd_do_request_flags(struct usbd_device
1043 1043
1044usbd_status 1044usbd_status
1045usbd_do_request_flags_pipe(struct usbd_device *dev, struct usbd_pipe *pipe, 1045usbd_do_request_flags_pipe(struct usbd_device *dev, struct usbd_pipe *pipe,
1046 usb_device_request_t *req, void *data, uint16_t flags, int *actlen, 1046 usb_device_request_t *req, void *data, uint16_t flags, int *actlen,
1047 uint32_t timeout) 1047 uint32_t timeout)
1048{ 1048{
1049 struct usbd_xfer *xfer; 1049 struct usbd_xfer *xfer;
1050 usbd_status err; 1050 usbd_status err;
1051 1051
1052 USBHIST_FUNC(); USBHIST_CALLED(usbdebug); 1052 USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
1053 1053
1054 ASSERT_SLEEPABLE(); 1054 ASSERT_SLEEPABLE();
1055 1055
1056 xfer = usbd_alloc_xfer(dev); 1056 xfer = usbd_alloc_xfer(dev, 0);
1057 if (xfer == NULL) 1057 if (xfer == NULL)
1058 return USBD_NOMEM; 1058 return USBD_NOMEM;
1059 1059
1060 if (UGETW(req->wLength) != 0) { 1060 if (UGETW(req->wLength) != 0) {
1061 void *buf = usbd_alloc_buffer(xfer, UGETW(req->wLength)); 1061 void *buf = usbd_alloc_buffer(xfer, UGETW(req->wLength));
1062 if (buf == NULL) { 1062 if (buf == NULL) {
1063 err = USBD_NOMEM; 1063 err = USBD_NOMEM;
1064 goto bad; 1064 goto bad;
1065 } 1065 }
1066 } 1066 }
1067 1067
1068 usbd_setup_default_xfer(xfer, dev, 0, timeout, req, 1068 usbd_setup_default_xfer(xfer, dev, 0, timeout, req,
1069 data, UGETW(req->wLength), flags, 0); 1069 data, UGETW(req->wLength), flags, 0);

cvs diff -r1.109.2.17 -r1.109.2.18 src/sys/dev/usb/usbdivar.h (expand / switch to unified diff)

--- src/sys/dev/usb/usbdivar.h 2015/06/06 15:26:15 1.109.2.17
+++ src/sys/dev/usb/usbdivar.h 2015/10/11 09:17:51 1.109.2.18
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: usbdivar.h,v 1.109.2.17 2015/06/06 15:26:15 skrll Exp $ */ 1/* $NetBSD: usbdivar.h,v 1.109.2.18 2015/10/11 09:17:51 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
@@ -84,27 +84,27 @@ struct usbd_xfer; @@ -84,27 +84,27 @@ struct usbd_xfer;
84struct usbd_pipe; 84struct usbd_pipe;
85struct usbd_port; 85struct usbd_port;
86 86
87struct usbd_endpoint { 87struct usbd_endpoint {
88 usb_endpoint_descriptor_t *ue_edesc; 88 usb_endpoint_descriptor_t *ue_edesc;
89 int ue_refcnt; 89 int ue_refcnt;
90 int ue_toggle; 90 int ue_toggle;
91}; 91};
92 92
93struct usbd_bus_methods { 93struct usbd_bus_methods {
94 usbd_status (*ubm_open)(struct usbd_pipe *); 94 usbd_status (*ubm_open)(struct usbd_pipe *);
95 void (*ubm_softint)(void *); 95 void (*ubm_softint)(void *);
96 void (*ubm_dopoll)(struct usbd_bus *); 96 void (*ubm_dopoll)(struct usbd_bus *);
97 struct usbd_xfer *(*ubm_allocx)(struct usbd_bus *); 97 struct usbd_xfer *(*ubm_allocx)(struct usbd_bus *, unsigned int);
98 void (*ubm_freex)(struct usbd_bus *, struct usbd_xfer *); 98 void (*ubm_freex)(struct usbd_bus *, struct usbd_xfer *);
99 void (*ubm_getlock)(struct usbd_bus *, kmutex_t **); 99 void (*ubm_getlock)(struct usbd_bus *, kmutex_t **);
100 usbd_status (*ubm_newdev)(device_t, struct usbd_bus *, int, 100 usbd_status (*ubm_newdev)(device_t, struct usbd_bus *, int,
101 int, int, struct usbd_port *); 101 int, int, struct usbd_port *);
102 102
103 int (*ubm_rhctrl)(struct usbd_bus *, 103 int (*ubm_rhctrl)(struct usbd_bus *,
104 usb_device_request_t *, void *, int); 104 usb_device_request_t *, void *, int);
105}; 105};
106 106
107struct usbd_pipe_methods { 107struct usbd_pipe_methods {
108 usbd_status (*upm_transfer)(struct usbd_xfer *); 108 usbd_status (*upm_transfer)(struct usbd_xfer *);
109 usbd_status (*upm_start)(struct usbd_xfer *); 109 usbd_status (*upm_start)(struct usbd_xfer *);
110 void (*upm_abort)(struct usbd_xfer *); 110 void (*upm_abort)(struct usbd_xfer *);

cvs diff -r1.28.2.40 -r1.28.2.41 src/sys/dev/usb/xhci.c (expand / switch to unified diff)

--- src/sys/dev/usb/xhci.c 2015/10/03 16:33:33 1.28.2.40
+++ src/sys/dev/usb/xhci.c 2015/10/11 09:17:51 1.28.2.41
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: xhci.c,v 1.28.2.40 2015/10/03 16:33:33 skrll Exp $ */ 1/* $NetBSD: xhci.c,v 1.28.2.41 2015/10/11 09:17:51 skrll Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2013 Jonathan A. Kollasch 4 * Copyright (c) 2013 Jonathan A. Kollasch
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -26,27 +26,27 @@ @@ -26,27 +26,27 @@
26 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29/* 29/*
30 * USB rev 3.1 specification 30 * USB rev 3.1 specification
31 * http://www.usb.org/developers/docs/usb_31_040315.zip 31 * http://www.usb.org/developers/docs/usb_31_040315.zip
32 * USB rev 2.0 specification 32 * USB rev 2.0 specification
33 * http://www.usb.org/developers/docs/usb20_docs/usb_20_031815.zip 33 * http://www.usb.org/developers/docs/usb20_docs/usb_20_031815.zip
34 * xHCI rev 1.1 specification 34 * xHCI rev 1.1 specification
35 * http://www.intel.com/content/dam/www/public/us/en/documents/technical-specifications/extensible-host-controler-interface-usb-xhci.pdf 35 * http://www.intel.com/content/dam/www/public/us/en/documents/technical-specifications/extensible-host-controler-interface-usb-xhci.pdf
36 */ 36 */
37 37
38#include <sys/cdefs.h> 38#include <sys/cdefs.h>
39__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.28.2.40 2015/10/03 16:33:33 skrll Exp $"); 39__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.28.2.41 2015/10/11 09:17:51 skrll Exp $");
40 40
41#include "opt_usb.h" 41#include "opt_usb.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/kmem.h> 46#include <sys/kmem.h>
47#include <sys/device.h> 47#include <sys/device.h>
48#include <sys/select.h> 48#include <sys/select.h>
49#include <sys/proc.h> 49#include <sys/proc.h>
50#include <sys/queue.h> 50#include <sys/queue.h>
51#include <sys/mutex.h> 51#include <sys/mutex.h>
52#include <sys/condvar.h> 52#include <sys/condvar.h>
@@ -119,27 +119,27 @@ struct xhci_pipe { @@ -119,27 +119,27 @@ struct xhci_pipe {
119 struct usb_task xp_async_task; 119 struct usb_task xp_async_task;
120}; 120};
121 121
122#define XHCI_COMMAND_RING_TRBS 256 122#define XHCI_COMMAND_RING_TRBS 256
123#define XHCI_EVENT_RING_TRBS 256 123#define XHCI_EVENT_RING_TRBS 256
124#define XHCI_EVENT_RING_SEGMENTS 1 124#define XHCI_EVENT_RING_SEGMENTS 1
125#define XHCI_TRB_3_ED_BIT XHCI_TRB_3_ISP_BIT 125#define XHCI_TRB_3_ED_BIT XHCI_TRB_3_ISP_BIT
126 126
127static usbd_status xhci_open(struct usbd_pipe *); 127static usbd_status xhci_open(struct usbd_pipe *);
128static void xhci_close_pipe(struct usbd_pipe *); 128static void xhci_close_pipe(struct usbd_pipe *);
129static int xhci_intr1(struct xhci_softc * const); 129static int xhci_intr1(struct xhci_softc * const);
130static void xhci_softintr(void *); 130static void xhci_softintr(void *);
131static void xhci_poll(struct usbd_bus *); 131static void xhci_poll(struct usbd_bus *);
132static struct usbd_xfer *xhci_allocx(struct usbd_bus *); 132static struct usbd_xfer *xhci_allocx(struct usbd_bus *, unsigned int);
133static void xhci_freex(struct usbd_bus *, struct usbd_xfer *); 133static void xhci_freex(struct usbd_bus *, struct usbd_xfer *);
134static void xhci_get_lock(struct usbd_bus *, kmutex_t **); 134static void xhci_get_lock(struct usbd_bus *, kmutex_t **);
135static usbd_status xhci_new_device(device_t, struct usbd_bus *, int, int, int, 135static usbd_status xhci_new_device(device_t, struct usbd_bus *, int, int, int,
136 struct usbd_port *); 136 struct usbd_port *);
137static int xhci_roothub_ctrl(struct usbd_bus *, usb_device_request_t *, 137static int xhci_roothub_ctrl(struct usbd_bus *, usb_device_request_t *,
138 void *, int); 138 void *, int);
139 139
140static usbd_status xhci_configure_endpoint(struct usbd_pipe *); 140static usbd_status xhci_configure_endpoint(struct usbd_pipe *);
141//static usbd_status xhci_unconfigure_endpoint(struct usbd_pipe *); 141//static usbd_status xhci_unconfigure_endpoint(struct usbd_pipe *);
142static usbd_status xhci_reset_endpoint(struct usbd_pipe *); 142static usbd_status xhci_reset_endpoint(struct usbd_pipe *);
143static usbd_status xhci_stop_endpoint(struct usbd_pipe *); 143static usbd_status xhci_stop_endpoint(struct usbd_pipe *);
144 144
145static usbd_status xhci_set_dequeue(struct usbd_pipe *); 145static usbd_status xhci_set_dequeue(struct usbd_pipe *);
@@ -2044,27 +2044,27 @@ xhci_poll(struct usbd_bus *bus) @@ -2044,27 +2044,27 @@ xhci_poll(struct usbd_bus *bus)
2044{ 2044{
2045 struct xhci_softc * const sc = bus->ub_hcpriv; 2045 struct xhci_softc * const sc = bus->ub_hcpriv;
2046 2046
2047 XHCIHIST_FUNC(); XHCIHIST_CALLED(); 2047 XHCIHIST_FUNC(); XHCIHIST_CALLED();
2048 2048
2049 mutex_spin_enter(&sc->sc_intr_lock); 2049 mutex_spin_enter(&sc->sc_intr_lock);
2050 xhci_intr1(sc); 2050 xhci_intr1(sc);
2051 mutex_spin_exit(&sc->sc_intr_lock); 2051 mutex_spin_exit(&sc->sc_intr_lock);
2052 2052
2053 return; 2053 return;
2054} 2054}
2055 2055
2056static struct usbd_xfer * 2056static struct usbd_xfer *
2057xhci_allocx(struct usbd_bus *bus) 2057xhci_allocx(struct usbd_bus *bus, unsigned int nframes)
2058{ 2058{
2059 struct xhci_softc * const sc = bus->ub_hcpriv; 2059 struct xhci_softc * const sc = bus->ub_hcpriv;
2060 struct usbd_xfer *xfer; 2060 struct usbd_xfer *xfer;
2061 2061
2062 XHCIHIST_FUNC(); XHCIHIST_CALLED(); 2062 XHCIHIST_FUNC(); XHCIHIST_CALLED();
2063 2063
2064 xfer = pool_cache_get(sc->sc_xferpool, PR_NOWAIT); 2064 xfer = pool_cache_get(sc->sc_xferpool, PR_NOWAIT);
2065 if (xfer != NULL) { 2065 if (xfer != NULL) {
2066 memset(xfer, 0, sizeof(struct xhci_xfer)); 2066 memset(xfer, 0, sizeof(struct xhci_xfer));
2067#ifdef DIAGNOSTIC 2067#ifdef DIAGNOSTIC
2068 xfer->ux_state = XFER_BUSY; 2068 xfer->ux_state = XFER_BUSY;
2069#endif 2069#endif
2070 } 2070 }

cvs diff -r1.32.2.12 -r1.32.2.13 src/sys/external/bsd/dwc2/dwc2.c (expand / switch to unified diff)

--- src/sys/external/bsd/dwc2/dwc2.c 2015/10/04 10:45:37 1.32.2.12
+++ src/sys/external/bsd/dwc2/dwc2.c 2015/10/11 09:17:51 1.32.2.13
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: dwc2.c,v 1.32.2.12 2015/10/04 10:45:37 skrll Exp $ */ 1/* $NetBSD: dwc2.c,v 1.32.2.13 2015/10/11 09:17:51 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2013 The NetBSD Foundation, Inc. 4 * Copyright (c) 2013 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 Nick Hudson 8 * by Nick Hudson
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.32.2.12 2015/10/04 10:45:37 skrll Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.32.2.13 2015/10/11 09:17:51 skrll Exp $");
34 34
35#include "opt_usb.h" 35#include "opt_usb.h"
36 36
37#include <sys/param.h> 37#include <sys/param.h>
38#include <sys/systm.h> 38#include <sys/systm.h>
39#include <sys/kmem.h> 39#include <sys/kmem.h>
40#include <sys/kernel.h> 40#include <sys/kernel.h>
41#include <sys/device.h> 41#include <sys/device.h>
42#include <sys/select.h> 42#include <sys/select.h>
43#include <sys/proc.h> 43#include <sys/proc.h>
44#include <sys/queue.h> 44#include <sys/queue.h>
45#include <sys/cpu.h> 45#include <sys/cpu.h>
46 46
@@ -74,27 +74,28 @@ __KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.3 @@ -74,27 +74,28 @@ __KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.3
74} while (0) 74} while (0)
75#define DPRINTF(...) DPRINTFN(1, __VA_ARGS__) 75#define DPRINTF(...) DPRINTFN(1, __VA_ARGS__)
76int dwc2debug = 0; 76int dwc2debug = 0;
77#else 77#else
78#define DPRINTF(...) do { } while (0) 78#define DPRINTF(...) do { } while (0)
79#define DPRINTFN(...) do { } while (0) 79#define DPRINTFN(...) do { } while (0)
80#endif 80#endif
81 81
82Static usbd_status dwc2_open(struct usbd_pipe *); 82Static usbd_status dwc2_open(struct usbd_pipe *);
83Static void dwc2_poll(struct usbd_bus *); 83Static void dwc2_poll(struct usbd_bus *);
84Static void dwc2_softintr(void *); 84Static void dwc2_softintr(void *);
85Static void dwc2_waitintr(struct dwc2_softc *, struct usbd_xfer *); 85Static void dwc2_waitintr(struct dwc2_softc *, struct usbd_xfer *);
86 86
87Static struct usbd_xfer * dwc2_allocx(struct usbd_bus *); 87Static struct usbd_xfer *
 88 dwc2_allocx(struct usbd_bus *, unsigned int);
88Static void dwc2_freex(struct usbd_bus *, struct usbd_xfer *); 89Static void dwc2_freex(struct usbd_bus *, struct usbd_xfer *);
89Static void dwc2_get_lock(struct usbd_bus *, kmutex_t **); 90Static void dwc2_get_lock(struct usbd_bus *, kmutex_t **);
90Static int dwc2_roothub_ctrl(struct usbd_bus *, usb_device_request_t *, 91Static int dwc2_roothub_ctrl(struct usbd_bus *, usb_device_request_t *,
91 void *, int); 92 void *, int);
92 93
93Static usbd_status dwc2_root_intr_transfer(struct usbd_xfer *); 94Static usbd_status dwc2_root_intr_transfer(struct usbd_xfer *);
94Static usbd_status dwc2_root_intr_start(struct usbd_xfer *); 95Static usbd_status dwc2_root_intr_start(struct usbd_xfer *);
95Static void dwc2_root_intr_abort(struct usbd_xfer *); 96Static void dwc2_root_intr_abort(struct usbd_xfer *);
96Static void dwc2_root_intr_close(struct usbd_pipe *); 97Static void dwc2_root_intr_close(struct usbd_pipe *);
97Static void dwc2_root_intr_done(struct usbd_xfer *); 98Static void dwc2_root_intr_done(struct usbd_xfer *);
98 99
99Static usbd_status dwc2_device_ctrl_transfer(struct usbd_xfer *); 100Static usbd_status dwc2_device_ctrl_transfer(struct usbd_xfer *);
100Static usbd_status dwc2_device_ctrl_start(struct usbd_xfer *); 101Static usbd_status dwc2_device_ctrl_start(struct usbd_xfer *);
@@ -194,64 +195,64 @@ Static const struct usbd_pipe_methods dw @@ -194,64 +195,64 @@ Static const struct usbd_pipe_methods dw
194 .upm_done = dwc2_device_bulk_done, 195 .upm_done = dwc2_device_bulk_done,
195}; 196};
196 197
197Static const struct usbd_pipe_methods dwc2_device_isoc_methods = { 198Static const struct usbd_pipe_methods dwc2_device_isoc_methods = {
198 .upm_transfer = dwc2_device_isoc_transfer, 199 .upm_transfer = dwc2_device_isoc_transfer,
199 .upm_start = dwc2_device_isoc_start, 200 .upm_start = dwc2_device_isoc_start,
200 .upm_abort = dwc2_device_isoc_abort, 201 .upm_abort = dwc2_device_isoc_abort,
201 .upm_close = dwc2_device_isoc_close, 202 .upm_close = dwc2_device_isoc_close,
202 .upm_cleartoggle = dwc2_noop, 203 .upm_cleartoggle = dwc2_noop,
203 .upm_done = dwc2_device_isoc_done, 204 .upm_done = dwc2_device_isoc_done,
204}; 205};
205 206
206struct usbd_xfer * 207struct usbd_xfer *
207dwc2_allocx(struct usbd_bus *bus) 208dwc2_allocx(struct usbd_bus *bus, unsigned int nframes)
208{ 209{
209 struct dwc2_softc *sc = DWC2_BUS2SC(bus); 210 struct dwc2_softc *sc = DWC2_BUS2SC(bus);
210 struct dwc2_xfer *dxfer; 211 struct dwc2_xfer *dxfer;
211 212
212 DPRINTFN(10, "\n"); 213 DPRINTFN(10, "\n");
213 214
214 DWC2_EVCNT_INCR(sc->sc_ev_xferpoolget); 215 DWC2_EVCNT_INCR(sc->sc_ev_xferpoolget);
215 dxfer = pool_cache_get(sc->sc_xferpool, PR_NOWAIT); 216 dxfer = pool_cache_get(sc->sc_xferpool, PR_NOWAIT);
216 if (dxfer != NULL) { 217 if (dxfer != NULL) {
217 memset(dxfer, 0, sizeof(*dxfer)); 218 memset(dxfer, 0, sizeof(*dxfer));
218 219
219 dxfer->urb = dwc2_hcd_urb_alloc(sc->sc_hsotg, 220 dxfer->urb = dwc2_hcd_urb_alloc(sc->sc_hsotg,
220 DWC2_MAXISOCPACKETS, GFP_KERNEL); 221 nframes, GFP_KERNEL);
221 222
222#ifdef DIAGNOSTIC 223#ifdef DIAGNOSTIC
223 dxfer->xfer.ux_state = XFER_BUSY; 224 dxfer->xfer.ux_state = XFER_BUSY;
224#endif 225#endif
225 } 226 }
226 return (struct usbd_xfer *)dxfer; 227 return (struct usbd_xfer *)dxfer;
227} 228}
228 229
229void 230void
230dwc2_freex(struct usbd_bus *bus, struct usbd_xfer *xfer) 231dwc2_freex(struct usbd_bus *bus, struct usbd_xfer *xfer)
231{ 232{
232 struct dwc2_xfer *dxfer = DWC2_XFER2DXFER(xfer); 233 struct dwc2_xfer *dxfer = DWC2_XFER2DXFER(xfer);
233 struct dwc2_softc *sc = DWC2_BUS2SC(bus); 234 struct dwc2_softc *sc = DWC2_BUS2SC(bus);
234 235
235 DPRINTFN(10, "\n"); 236 DPRINTFN(10, "\n");
236 237
237#ifdef DIAGNOSTIC 238#ifdef DIAGNOSTIC
238 if (xfer->ux_state != XFER_BUSY) { 239 if (xfer->ux_state != XFER_BUSY) {
239 DPRINTF("xfer=%p not busy, 0x%08x\n", xfer, xfer->ux_state); 240 DPRINTF("xfer=%p not busy, 0x%08x\n", xfer, xfer->ux_state);
240 } 241 }
241 xfer->ux_state = XFER_FREE; 242 xfer->ux_state = XFER_FREE;
242#endif 243#endif
243 DWC2_EVCNT_INCR(sc->sc_ev_xferpoolput); 244 DWC2_EVCNT_INCR(sc->sc_ev_xferpoolput);
244 dwc2_hcd_urb_free(sc->sc_hsotg, dxfer->urb, DWC2_MAXISOCPACKETS); 245 dwc2_hcd_urb_free(sc->sc_hsotg, dxfer->urb, dxfer->urb->packet_count);
245 pool_cache_put(sc->sc_xferpool, xfer); 246 pool_cache_put(sc->sc_xferpool, xfer);
246} 247}
247 248
248Static void 249Static void
249dwc2_get_lock(struct usbd_bus *bus, kmutex_t **lock) 250dwc2_get_lock(struct usbd_bus *bus, kmutex_t **lock)
250{ 251{
251 struct dwc2_softc *sc = DWC2_BUS2SC(bus); 252 struct dwc2_softc *sc = DWC2_BUS2SC(bus);
252 253
253 *lock = &sc->sc_lock; 254 *lock = &sc->sc_lock;
254} 255}
255 256
256Static void 257Static void
257dwc2_rhc(void *addr) 258dwc2_rhc(void *addr)
@@ -1050,27 +1051,27 @@ dwc2_device_start(struct usbd_xfer *xfer @@ -1050,27 +1051,27 @@ dwc2_device_start(struct usbd_xfer *xfer
1050 } else { 1051 } else {
1051 DPRINTFN(3, "xfer=%p len=%d flags=%d addr=%d endpt=%d," 1052 DPRINTFN(3, "xfer=%p len=%d flags=%d addr=%d endpt=%d,"
1052 " mps=%d dir %s\n", xfer, xfer->ux_length, xfer->ux_flags, addr, 1053 " mps=%d dir %s\n", xfer, xfer->ux_length, xfer->ux_flags, addr,
1053 epnum, mps, dir == UT_READ ? "in" :"out"); 1054 epnum, mps, dir == UT_READ ? "in" :"out");
1054 1055
1055 len = xfer->ux_length; 1056 len = xfer->ux_length;
1056 } 1057 }
1057 1058
1058 dwc2_urb = dxfer->urb; 1059 dwc2_urb = dxfer->urb;
1059 if (!dwc2_urb) 1060 if (!dwc2_urb)
1060 return USBD_NOMEM; 1061 return USBD_NOMEM;
1061 1062
1062 memset(dwc2_urb, 0, sizeof(*dwc2_urb) + 1063 memset(dwc2_urb, 0, sizeof(*dwc2_urb) +
1063 sizeof(dwc2_urb->iso_descs[0]) * DWC2_MAXISOCPACKETS); 1064 sizeof(dwc2_urb->iso_descs[0]) * dwc2_urb->packet_count);
1064 1065
1065 dwc2_urb->priv = xfer; 1066 dwc2_urb->priv = xfer;
1066 1067
1067 dwc2_hcd_urb_set_pipeinfo(hsotg, dwc2_urb, addr, epnum, xfertype, dir, 1068 dwc2_hcd_urb_set_pipeinfo(hsotg, dwc2_urb, addr, epnum, xfertype, dir,
1068 mps); 1069 mps);
1069 1070
1070 if (xfertype == UE_CONTROL) { 1071 if (xfertype == UE_CONTROL) {
1071 dwc2_urb->setup_usbdma = &dpipe->req_dma; 1072 dwc2_urb->setup_usbdma = &dpipe->req_dma;
1072 dwc2_urb->setup_packet = KERNADDR(&dpipe->req_dma, 0); 1073 dwc2_urb->setup_packet = KERNADDR(&dpipe->req_dma, 0);
1073 dwc2_urb->setup_dma = DMAADDR(&dpipe->req_dma, 0); 1074 dwc2_urb->setup_dma = DMAADDR(&dpipe->req_dma, 0);
1074 } else { 1075 } else {
1075 /* XXXNH - % mps required? */ 1076 /* XXXNH - % mps required? */
1076 if ((xfer->ux_flags & USBD_FORCE_SHORT_XFER) && (len % mps) == 0) 1077 if ((xfer->ux_flags & USBD_FORCE_SHORT_XFER) && (len % mps) == 0)
@@ -1080,27 +1081,26 @@ dwc2_device_start(struct usbd_xfer *xfer @@ -1080,27 +1081,26 @@ dwc2_device_start(struct usbd_xfer *xfer
1080 1081
1081 /* 1082 /*
1082 * control transfers with no data phase don't touch usbdma, but 1083 * control transfers with no data phase don't touch usbdma, but
1083 * everything else does. 1084 * everything else does.
1084 */ 1085 */
1085 if (!(xfertype == UE_CONTROL && len == 0)) { 1086 if (!(xfertype == UE_CONTROL && len == 0)) {
1086 dwc2_urb->usbdma = &xfer->ux_dmabuf; 1087 dwc2_urb->usbdma = &xfer->ux_dmabuf;
1087 dwc2_urb->buf = KERNADDR(dwc2_urb->usbdma, 0); 1088 dwc2_urb->buf = KERNADDR(dwc2_urb->usbdma, 0);
1088 dwc2_urb->dma = DMAADDR(dwc2_urb->usbdma, 0); 1089 dwc2_urb->dma = DMAADDR(dwc2_urb->usbdma, 0);
1089 } 1090 }
1090 dwc2_urb->length = len; 1091 dwc2_urb->length = len;
1091 dwc2_urb->flags = flags; 1092 dwc2_urb->flags = flags;
1092 dwc2_urb->status = -EINPROGRESS; 1093 dwc2_urb->status = -EINPROGRESS;
1093 dwc2_urb->packet_count = xfer->ux_nframes; 
1094 1094
1095 if (xfertype == UE_INTERRUPT || 1095 if (xfertype == UE_INTERRUPT ||
1096 xfertype == UE_ISOCHRONOUS) { 1096 xfertype == UE_ISOCHRONOUS) {
1097 uint16_t ival; 1097 uint16_t ival;
1098 1098
1099 if (xfertype == UE_INTERRUPT && 1099 if (xfertype == UE_INTERRUPT &&
1100 dpipe->pipe.up_interval != USBD_DEFAULT_INTERVAL) { 1100 dpipe->pipe.up_interval != USBD_DEFAULT_INTERVAL) {
1101 ival = dpipe->pipe.up_interval; 1101 ival = dpipe->pipe.up_interval;
1102 } else { 1102 } else {
1103 ival = ed->bInterval; 1103 ival = ed->bInterval;
1104 } 1104 }
1105 1105
1106 if (ival < 1) { 1106 if (ival < 1) {
@@ -1121,27 +1121,27 @@ dwc2_device_start(struct usbd_xfer *xfer @@ -1121,27 +1121,27 @@ dwc2_device_start(struct usbd_xfer *xfer
1121 } else { 1121 } else {
1122 if (xfertype == UE_INTERRUPT && ival < 10) 1122 if (xfertype == UE_INTERRUPT && ival < 10)
1123 ival = 10; 1123 ival = 10;
1124 } 1124 }
1125 dwc2_urb->interval = ival; 1125 dwc2_urb->interval = ival;
1126 } 1126 }
1127 1127
1128 /* XXXNH bring down from callers?? */ 1128 /* XXXNH bring down from callers?? */
1129// mutex_enter(&sc->sc_lock); 1129// mutex_enter(&sc->sc_lock);
1130 1130
1131 xfer->ux_actlen = 0; 1131 xfer->ux_actlen = 0;
1132 1132
1133 KASSERT(xfertype != UE_ISOCHRONOUS || 1133 KASSERT(xfertype != UE_ISOCHRONOUS ||
1134 xfer->ux_nframes < DWC2_MAXISOCPACKETS); 1134 xfer->ux_nframes < dwc2_urb->packet_count);
1135 KASSERTMSG(xfer->ux_nframes == 0 || xfertype == UE_ISOCHRONOUS, 1135 KASSERTMSG(xfer->ux_nframes == 0 || xfertype == UE_ISOCHRONOUS,
1136 "nframes %d xfertype %d\n", xfer->ux_nframes, xfertype); 1136 "nframes %d xfertype %d\n", xfer->ux_nframes, xfertype);
1137 1137
1138 for (off = i = 0; i < xfer->ux_nframes; ++i) { 1138 for (off = i = 0; i < xfer->ux_nframes; ++i) {
1139 DPRINTFN(3, "xfer=%p frame=%d offset=%d length=%d\n", xfer, i, 1139 DPRINTFN(3, "xfer=%p frame=%d offset=%d length=%d\n", xfer, i,
1140 off, xfer->ux_frlengths[i]); 1140 off, xfer->ux_frlengths[i]);
1141 1141
1142 dwc2_hcd_urb_set_iso_desc_params(dwc2_urb, i, off, 1142 dwc2_hcd_urb_set_iso_desc_params(dwc2_urb, i, off,
1143 xfer->ux_frlengths[i]); 1143 xfer->ux_frlengths[i]);
1144 off += xfer->ux_frlengths[i]; 1144 off += xfer->ux_frlengths[i];
1145 } 1145 }
1146 1146
1147 struct dwc2_qh *qh = dpipe->priv; 1147 struct dwc2_qh *qh = dpipe->priv;

cvs diff -r1.3.12.5 -r1.3.12.6 src/sys/external/bsd/dwc2/dwc2var.h (expand / switch to unified diff)

--- src/sys/external/bsd/dwc2/dwc2var.h 2015/06/06 14:40:20 1.3.12.5
+++ src/sys/external/bsd/dwc2/dwc2var.h 2015/10/11 09:17:51 1.3.12.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: dwc2var.h,v 1.3.12.5 2015/06/06 14:40:20 skrll Exp $ */ 1/* $NetBSD: dwc2var.h,v 1.3.12.6 2015/10/11 09:17:51 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2013 The NetBSD Foundation, Inc. 4 * Copyright (c) 2013 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 Nick Hudson 8 * by Nick Hudson
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -24,27 +24,26 @@ @@ -24,27 +24,26 @@
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#ifndef _DWC2VAR_H_ 32#ifndef _DWC2VAR_H_
33#define _DWC2VAR_H_ 33#define _DWC2VAR_H_
34 34
35#include <sys/pool.h> 35#include <sys/pool.h>
36 36
37#define DWC2_MAXISOCPACKETS 16 
38struct dwc2_hsotg; 37struct dwc2_hsotg;
39struct dwc2_qtd; 38struct dwc2_qtd;
40 39
41struct dwc2_xfer { 40struct dwc2_xfer {
42 struct usbd_xfer xfer; /* Needs to be first */ 41 struct usbd_xfer xfer; /* Needs to be first */
43 struct usb_task abort_task; 42 struct usb_task abort_task;
44 43
45 struct dwc2_hcd_urb *urb; 44 struct dwc2_hcd_urb *urb;
46 int packet_count; 45 int packet_count;
47 46
48 TAILQ_ENTRY(dwc2_xfer) xnext; /* list of complete xfers */ 47 TAILQ_ENTRY(dwc2_xfer) xnext; /* list of complete xfers */
49}; 48};
50 49

cvs diff -r1.22.4.9 -r1.22.4.10 src/sys/rump/dev/lib/libugenhc/ugenhc.c (expand / switch to unified diff)

--- src/sys/rump/dev/lib/libugenhc/ugenhc.c 2015/03/19 17:26:42 1.22.4.9
+++ src/sys/rump/dev/lib/libugenhc/ugenhc.c 2015/10/11 09:17:51 1.22.4.10
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ugenhc.c,v 1.22.4.9 2015/03/19 17:26:42 skrll Exp $ */ 1/* $NetBSD: ugenhc.c,v 1.22.4.10 2015/10/11 09:17:51 skrll Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved. 4 * Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -51,27 +51,27 @@ @@ -51,27 +51,27 @@
51 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 51 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
52 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 52 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
53 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 53 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
54 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 54 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
55 * POSSIBILITY OF SUCH DAMAGE. 55 * POSSIBILITY OF SUCH DAMAGE.
56 */ 56 */
57 57
58/* 58/*
59 * This rump driver attaches ugen as a kernel usb host controller. 59 * This rump driver attaches ugen as a kernel usb host controller.
60 * It's still somewhat under the hammer .... 60 * It's still somewhat under the hammer ....
61 */ 61 */
62 62
63#include <sys/cdefs.h> 63#include <sys/cdefs.h>
64__KERNEL_RCSID(0, "$NetBSD: ugenhc.c,v 1.22.4.9 2015/03/19 17:26:42 skrll Exp $"); 64__KERNEL_RCSID(0, "$NetBSD: ugenhc.c,v 1.22.4.10 2015/10/11 09:17:51 skrll Exp $");
65 65
66#include <sys/param.h> 66#include <sys/param.h>
67#include <sys/bus.h> 67#include <sys/bus.h>
68#include <sys/conf.h> 68#include <sys/conf.h>
69#include <sys/device.h> 69#include <sys/device.h>
70#include <sys/fcntl.h> 70#include <sys/fcntl.h>
71#include <sys/kmem.h> 71#include <sys/kmem.h>
72#include <sys/kernel.h> 72#include <sys/kernel.h>
73#include <sys/kthread.h> 73#include <sys/kthread.h>
74#include <sys/mutex.h> 74#include <sys/mutex.h>
75 75
76#include <dev/usb/usb.h> 76#include <dev/usb/usb.h>
77#include <dev/usb/usbdi.h> 77#include <dev/usb/usbdi.h>
@@ -872,27 +872,27 @@ ugenhc_open(struct usbd_pipe *pipe) @@ -872,27 +872,27 @@ ugenhc_open(struct usbd_pipe *pipe)
872static void 872static void
873ugenhc_softint(void *arg) 873ugenhc_softint(void *arg)
874{ 874{
875 875
876} 876}
877 877
878static void 878static void
879ugenhc_poll(struct usbd_bus *ubus) 879ugenhc_poll(struct usbd_bus *ubus)
880{ 880{
881 881
882} 882}
883 883
884static struct usbd_xfer * 884static struct usbd_xfer *
885ugenhc_allocx(struct usbd_bus *bus) 885ugenhc_allocx(struct usbd_bus *bus, unsigned int nframes)
886{ 886{
887 struct usbd_xfer *xfer; 887 struct usbd_xfer *xfer;
888 888
889 xfer = kmem_zalloc(sizeof(struct usbd_xfer), KM_SLEEP); 889 xfer = kmem_zalloc(sizeof(struct usbd_xfer), KM_SLEEP);
890 xfer->ux_state = XFER_BUSY; 890 xfer->ux_state = XFER_BUSY;
891 891
892 return xfer; 892 return xfer;
893} 893}
894 894
895static void 895static void
896ugenhc_freex(struct usbd_bus *bus, struct usbd_xfer *xfer) 896ugenhc_freex(struct usbd_bus *bus, struct usbd_xfer *xfer)
897{ 897{
898 898