Tue Mar 6 02:49:03 2012 UTC ()
pull down from usbmp:

kill the !USE_USE_SOFTINTR code.


(mrg)
diff -r1.184 -r1.185 src/sys/dev/usb/ehci.c
diff -r1.38 -r1.39 src/sys/dev/usb/ehcivar.h
diff -r1.219 -r1.220 src/sys/dev/usb/ohci.c
diff -r1.51 -r1.52 src/sys/dev/usb/ohcivar.h
diff -r1.243 -r1.244 src/sys/dev/usb/uhci.c
diff -r1.49 -r1.50 src/sys/dev/usb/uhcivar.h
diff -r1.127 -r1.128 src/sys/dev/usb/usb.c
diff -r1.93 -r1.94 src/sys/dev/usb/usb.h

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

--- src/sys/dev/usb/ehci.c 2012/03/06 02:36:45 1.184
+++ src/sys/dev/usb/ehci.c 2012/03/06 02:49:02 1.185
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ehci.c,v 1.184 2012/03/06 02:36:45 mrg Exp $ */ 1/* $NetBSD: ehci.c,v 1.185 2012/03/06 02:49:02 mrg Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2004-2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2004-2008 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 and 8 * by Lennart Augustsson (lennart@augustsson.net), Charles M. Hannum and
9 * Jeremy Morse (jeremy.morse@gmail.com). 9 * Jeremy Morse (jeremy.morse@gmail.com).
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
@@ -42,27 +42,27 @@ @@ -42,27 +42,27 @@
42 42
43/* 43/*
44 * TODO: 44 * TODO:
45 * 1) hold off explorations by companion controllers until ehci has started. 45 * 1) hold off explorations by companion controllers until ehci has started.
46 * 46 *
47 * 2) The hub driver needs to handle and schedule the transaction translator, 47 * 2) The hub driver needs to handle and schedule the transaction translator,
48 * to assign place in frame where different devices get to go. See chapter 48 * to assign place in frame where different devices get to go. See chapter
49 * on hubs in USB 2.0 for details. 49 * on hubs in USB 2.0 for details.
50 * 50 *
51 * 3) Command failures are not recovered correctly. 51 * 3) Command failures are not recovered correctly.
52 */ 52 */
53 53
54#include <sys/cdefs.h> 54#include <sys/cdefs.h>
55__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.184 2012/03/06 02:36:45 mrg Exp $"); 55__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.185 2012/03/06 02:49:02 mrg Exp $");
56 56
57#include "ohci.h" 57#include "ohci.h"
58#include "uhci.h" 58#include "uhci.h"
59#include "opt_usb.h" 59#include "opt_usb.h"
60 60
61#include <sys/param.h> 61#include <sys/param.h>
62#include <sys/systm.h> 62#include <sys/systm.h>
63#include <sys/kernel.h> 63#include <sys/kernel.h>
64#include <sys/malloc.h> 64#include <sys/malloc.h>
65#include <sys/device.h> 65#include <sys/device.h>
66#include <sys/select.h> 66#include <sys/select.h>
67#include <sys/proc.h> 67#include <sys/proc.h>
68#include <sys/queue.h> 68#include <sys/queue.h>
@@ -699,32 +699,30 @@ ehci_softintr(void *v) @@ -699,32 +699,30 @@ ehci_softintr(void *v)
699 * clue what, so we need to scan through all active transfers. :-( 699 * clue what, so we need to scan through all active transfers. :-(
700 */ 700 */
701 for (ex = TAILQ_FIRST(&sc->sc_intrhead); ex; ex = nextex) { 701 for (ex = TAILQ_FIRST(&sc->sc_intrhead); ex; ex = nextex) {
702 nextex = TAILQ_NEXT(ex, inext); 702 nextex = TAILQ_NEXT(ex, inext);
703 ehci_check_intr(sc, ex); 703 ehci_check_intr(sc, ex);
704 } 704 }
705 705
706 /* Schedule a callout to catch any dropped transactions. */ 706 /* Schedule a callout to catch any dropped transactions. */
707 if ((sc->sc_flags & EHCIF_DROPPED_INTR_WORKAROUND) && 707 if ((sc->sc_flags & EHCIF_DROPPED_INTR_WORKAROUND) &&
708 !TAILQ_EMPTY(&sc->sc_intrhead)) 708 !TAILQ_EMPTY(&sc->sc_intrhead))
709 callout_reset(&(sc->sc_tmo_intrlist), 709 callout_reset(&(sc->sc_tmo_intrlist),
710 (hz), (ehci_intrlist_timeout), (sc)); 710 (hz), (ehci_intrlist_timeout), (sc));
711 711
712#ifdef USB_USE_SOFTINTR 
713 if (sc->sc_softwake) { 712 if (sc->sc_softwake) {
714 sc->sc_softwake = 0; 713 sc->sc_softwake = 0;
715 wakeup(&sc->sc_softwake); 714 wakeup(&sc->sc_softwake);
716 } 715 }
717#endif /* USB_USE_SOFTINTR */ 
718 716
719 sc->sc_bus.intr_context--; 717 sc->sc_bus.intr_context--;
720} 718}
721 719
722/* Check for an interrupt. */ 720/* Check for an interrupt. */
723Static void 721Static void
724ehci_check_intr(ehci_softc_t *sc, struct ehci_xfer *ex) 722ehci_check_intr(ehci_softc_t *sc, struct ehci_xfer *ex)
725{ 723{
726 int attr; 724 int attr;
727 725
728 DPRINTFN(/*15*/2, ("ehci_check_intr: ex=%p\n", ex)); 726 DPRINTFN(/*15*/2, ("ehci_check_intr: ex=%p\n", ex));
729 727
730 attr = ex->xfer.pipe->endpoint->edesc->bmAttributes; 728 attr = ex->xfer.pipe->endpoint->edesc->bmAttributes;
@@ -2970,33 +2968,29 @@ ehci_abort_xfer(usbd_xfer_handle xfer, u @@ -2970,33 +2968,29 @@ ehci_abort_xfer(usbd_xfer_handle xfer, u
2970 BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); 2968 BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
2971 if (sqtd == exfer->sqtdend) 2969 if (sqtd == exfer->sqtdend)
2972 break; 2970 break;
2973 } 2971 }
2974 splx(s); 2972 splx(s);
2975 2973
2976 /* 2974 /*
2977 * Step 2: Wait until we know hardware has finished any possible 2975 * Step 2: Wait until we know hardware has finished any possible
2978 * use of the xfer. Also make sure the soft interrupt routine 2976 * use of the xfer. Also make sure the soft interrupt routine
2979 * has run. 2977 * has run.
2980 */ 2978 */
2981 ehci_sync_hc(sc); 2979 ehci_sync_hc(sc);
2982 s = splusb(); 2980 s = splusb();
2983#ifdef USB_USE_SOFTINTR 
2984 sc->sc_softwake = 1; 2981 sc->sc_softwake = 1;
2985#endif /* USB_USE_SOFTINTR */ 
2986 usb_schedsoftintr(&sc->sc_bus); 2982 usb_schedsoftintr(&sc->sc_bus);
2987#ifdef USB_USE_SOFTINTR 
2988 tsleep(&sc->sc_softwake, PZERO, "ehciab", 0); 2983 tsleep(&sc->sc_softwake, PZERO, "ehciab", 0);
2989#endif /* USB_USE_SOFTINTR */ 
2990 splx(s); 2984 splx(s);
2991 2985
2992 /* 2986 /*
2993 * Step 3: Remove any vestiges of the xfer from the hardware. 2987 * Step 3: Remove any vestiges of the xfer from the hardware.
2994 * The complication here is that the hardware may have executed 2988 * The complication here is that the hardware may have executed
2995 * beyond the xfer we're trying to abort. So as we're scanning 2989 * beyond the xfer we're trying to abort. So as we're scanning
2996 * the TDs of this xfer we check if the hardware points to 2990 * the TDs of this xfer we check if the hardware points to
2997 * any of them. 2991 * any of them.
2998 */ 2992 */
2999 s = splusb(); /* XXX why? */ 2993 s = splusb(); /* XXX why? */
3000 2994
3001 usb_syncmem(&sqh->dma, 2995 usb_syncmem(&sqh->dma,
3002 sqh->offs + offsetof(ehci_qh_t, qh_curqtd), 2996 sqh->offs + offsetof(ehci_qh_t, qh_curqtd),
@@ -3099,33 +3093,29 @@ ehci_abort_isoc_xfer(usbd_xfer_handle xf @@ -3099,33 +3093,29 @@ ehci_abort_isoc_xfer(usbd_xfer_handle xf
3099 trans_status = le32toh(itd->itd.itd_ctl[i]); 3093 trans_status = le32toh(itd->itd.itd_ctl[i]);
3100 trans_status &= ~EHCI_ITD_ACTIVE; 3094 trans_status &= ~EHCI_ITD_ACTIVE;
3101 itd->itd.itd_ctl[i] = htole32(trans_status); 3095 itd->itd.itd_ctl[i] = htole32(trans_status);
3102 } 3096 }
3103 3097
3104 usb_syncmem(&itd->dma, 3098 usb_syncmem(&itd->dma,
3105 itd->offs + offsetof(ehci_itd_t, itd_ctl), 3099 itd->offs + offsetof(ehci_itd_t, itd_ctl),
3106 sizeof(itd->itd.itd_ctl), 3100 sizeof(itd->itd.itd_ctl),
3107 BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); 3101 BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
3108 } 3102 }
3109 splx(s); 3103 splx(s);
3110 3104
3111 s = splusb(); 3105 s = splusb();
3112#ifdef USB_USE_SOFTINTR 
3113 sc->sc_softwake = 1; 3106 sc->sc_softwake = 1;
3114#endif /* USB_USE_SOFTINTR */ 
3115 usb_schedsoftintr(&sc->sc_bus); 3107 usb_schedsoftintr(&sc->sc_bus);
3116#ifdef USB_USE_SOFTINTR 
3117 tsleep(&sc->sc_softwake, PZERO, "ehciab", 0); 3108 tsleep(&sc->sc_softwake, PZERO, "ehciab", 0);
3118#endif /* USB_USE_SOFTINTR */ 
3119 splx(s); 3109 splx(s);
3120 3110
3121#ifdef DIAGNOSTIC 3111#ifdef DIAGNOSTIC
3122 exfer->isdone = 1; 3112 exfer->isdone = 1;
3123#endif 3113#endif
3124 wake = xfer->hcflags & UXFER_ABORTWAIT; 3114 wake = xfer->hcflags & UXFER_ABORTWAIT;
3125 xfer->hcflags &= ~(UXFER_ABORTING | UXFER_ABORTWAIT); 3115 xfer->hcflags &= ~(UXFER_ABORTING | UXFER_ABORTWAIT);
3126 usb_transfer_complete(xfer); 3116 usb_transfer_complete(xfer);
3127 if (wake) 3117 if (wake)
3128 wakeup(&xfer->hcflags); 3118 wakeup(&xfer->hcflags);
3129 3119
3130 return; 3120 return;
3131} 3121}

cvs diff -r1.38 -r1.39 src/sys/dev/usb/ehcivar.h (expand / switch to unified diff)

--- src/sys/dev/usb/ehcivar.h 2011/01/18 08:29:24 1.38
+++ src/sys/dev/usb/ehcivar.h 2012/03/06 02:49:02 1.39
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ehcivar.h,v 1.38 2011/01/18 08:29:24 matt Exp $ */ 1/* $NetBSD: ehcivar.h,v 1.39 2012/03/06 02:49:02 mrg Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001 The NetBSD Foundation, Inc. 4 * Copyright (c) 2001 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). 8 * by Lennart Augustsson (lennart@augustsson.net).
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.
@@ -142,29 +142,27 @@ typedef struct ehci_softc { @@ -142,29 +142,27 @@ typedef struct ehci_softc {
142 TAILQ_HEAD(, ehci_xfer) sc_intrhead; 142 TAILQ_HEAD(, ehci_xfer) sc_intrhead;
143 kmutex_t sc_intrhead_lock; 143 kmutex_t sc_intrhead_lock;
144 144
145 ehci_soft_qh_t *sc_freeqhs; 145 ehci_soft_qh_t *sc_freeqhs;
146 ehci_soft_qtd_t *sc_freeqtds; 146 ehci_soft_qtd_t *sc_freeqtds;
147 LIST_HEAD(sc_freeitds, ehci_soft_itd) sc_freeitds; 147 LIST_HEAD(sc_freeitds, ehci_soft_itd) sc_freeitds;
148 148
149 int sc_noport; 149 int sc_noport;
150 u_int8_t sc_hasppc; /* has Port Power Control */ 150 u_int8_t sc_hasppc; /* has Port Power Control */
151 u_int8_t sc_addr; /* device address */ 151 u_int8_t sc_addr; /* device address */
152 u_int8_t sc_conf; /* device configuration */ 152 u_int8_t sc_conf; /* device configuration */
153 usbd_xfer_handle sc_intrxfer; 153 usbd_xfer_handle sc_intrxfer;
154 char sc_isreset[EHCI_MAX_PORTS]; 154 char sc_isreset[EHCI_MAX_PORTS];
155#ifdef USB_USE_SOFTINTR 
156 char sc_softwake; 155 char sc_softwake;
157#endif /* USB_USE_SOFTINTR */ 
158 156
159 u_int32_t sc_eintrs; 157 u_int32_t sc_eintrs;
160 ehci_soft_qh_t *sc_async_head; 158 ehci_soft_qh_t *sc_async_head;
161 159
162 SIMPLEQ_HEAD(, usbd_xfer) sc_free_xfers; /* free xfers */ 160 SIMPLEQ_HEAD(, usbd_xfer) sc_free_xfers; /* free xfers */
163 161
164 kmutex_t sc_doorbell_lock; 162 kmutex_t sc_doorbell_lock;
165 163
166 struct callout sc_tmo_intrlist; 164 struct callout sc_tmo_intrlist;
167 165
168 device_t sc_child; /* /dev/usb# device */ 166 device_t sc_child; /* /dev/usb# device */
169 char sc_dying; 167 char sc_dying;
170 struct usb_dma_reserve sc_dma_reserve; 168 struct usb_dma_reserve sc_dma_reserve;

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

--- src/sys/dev/usb/ohci.c 2012/03/06 02:36:46 1.219
+++ src/sys/dev/usb/ohci.c 2012/03/06 02:49:03 1.220
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ohci.c,v 1.219 2012/03/06 02:36:46 mrg Exp $ */ 1/* $NetBSD: ohci.c,v 1.220 2012/03/06 02:49:03 mrg Exp $ */
2/* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */ 2/* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 1998, 2004, 2005 The NetBSD Foundation, Inc. 5 * Copyright (c) 1998, 2004, 2005 The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Lennart Augustsson (lennart@augustsson.net) at 9 * by Lennart Augustsson (lennart@augustsson.net) at
10 * Carlstedt Research & Technology. 10 * Carlstedt Research & Technology.
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.219 2012/03/06 02:36:46 mrg Exp $"); 44__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.220 2012/03/06 02:49:03 mrg 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#include <sys/systm.h> 49#include <sys/systm.h>
50#include <sys/malloc.h> 50#include <sys/malloc.h>
51#include <sys/kernel.h> 51#include <sys/kernel.h>
52#include <sys/device.h> 52#include <sys/device.h>
53#include <sys/select.h> 53#include <sys/select.h>
54#include <sys/proc.h> 54#include <sys/proc.h>
55#include <sys/queue.h> 55#include <sys/queue.h>
56 56
57#include <sys/bus.h> 57#include <sys/bus.h>
@@ -1447,32 +1447,30 @@ ohci_softintr(void *v) @@ -1447,32 +1447,30 @@ ohci_softintr(void *v)
1447 } 1447 }
1448 ohci_free_sitd(sc, sitd); 1448 ohci_free_sitd(sc, sitd);
1449 if (uedir == UE_DIR_IN && 1449 if (uedir == UE_DIR_IN &&
1450 xfer->status == USBD_NORMAL_COMPLETION) 1450 xfer->status == USBD_NORMAL_COMPLETION)
1451 xfer->actlen = actlen; 1451 xfer->actlen = actlen;
1452 xfer->hcpriv = NULL; 1452 xfer->hcpriv = NULL;
1453 1453
1454 s = splusb(); 1454 s = splusb();
1455 usb_transfer_complete(xfer); 1455 usb_transfer_complete(xfer);
1456 splx(s); 1456 splx(s);
1457 } 1457 }
1458 } 1458 }
1459 1459
1460#ifdef USB_USE_SOFTINTR 
1461 if (sc->sc_softwake) { 1460 if (sc->sc_softwake) {
1462 sc->sc_softwake = 0; 1461 sc->sc_softwake = 0;
1463 wakeup(&sc->sc_softwake); 1462 wakeup(&sc->sc_softwake);
1464 } 1463 }
1465#endif /* USB_USE_SOFTINTR */ 
1466 1464
1467 sc->sc_bus.intr_context--; 1465 sc->sc_bus.intr_context--;
1468 DPRINTFN(10,("ohci_softintr: done:\n")); 1466 DPRINTFN(10,("ohci_softintr: done:\n"));
1469} 1467}
1470 1468
1471void 1469void
1472ohci_device_ctrl_done(usbd_xfer_handle xfer) 1470ohci_device_ctrl_done(usbd_xfer_handle xfer)
1473{ 1471{
1474 struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe; 1472 struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe;
1475 int len = UGETW(xfer->request.wLength); 1473 int len = UGETW(xfer->request.wLength);
1476 int isread = (xfer->request.bmRequestType & UT_READ); 1474 int isread = (xfer->request.bmRequestType & UT_READ);
1477 1475
1478 DPRINTFN(10,("ohci_device_ctrl_done: xfer=%p\n", xfer)); 1476 DPRINTFN(10,("ohci_device_ctrl_done: xfer=%p\n", xfer));
@@ -2278,33 +2276,29 @@ ohci_abort_xfer(usbd_xfer_handle xfer, u @@ -2278,33 +2276,29 @@ ohci_abort_xfer(usbd_xfer_handle xfer, u
2278 BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD); 2276 BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
2279 sed->ed.ed_flags |= HTOO32(OHCI_ED_SKIP); /* force hardware skip */ 2277 sed->ed.ed_flags |= HTOO32(OHCI_ED_SKIP); /* force hardware skip */
2280 usb_syncmem(&sed->dma, sed->offs + offsetof(ohci_ed_t, ed_flags), 2278 usb_syncmem(&sed->dma, sed->offs + offsetof(ohci_ed_t, ed_flags),
2281 sizeof(sed->ed.ed_flags), 2279 sizeof(sed->ed.ed_flags),
2282 BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); 2280 BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
2283 2281
2284 /* 2282 /*
2285 * Step 2: Wait until we know hardware has finished any possible 2283 * Step 2: Wait until we know hardware has finished any possible
2286 * use of the xfer. Also make sure the soft interrupt routine 2284 * use of the xfer. Also make sure the soft interrupt routine
2287 * has run. 2285 * has run.
2288 */ 2286 */
2289 usb_delay_ms(opipe->pipe.device->bus, 20); /* Hardware finishes in 1ms */ 2287 usb_delay_ms(opipe->pipe.device->bus, 20); /* Hardware finishes in 1ms */
2290 s = splusb(); 2288 s = splusb();
2291#ifdef USB_USE_SOFTINTR 
2292 sc->sc_softwake = 1; 2289 sc->sc_softwake = 1;
2293#endif /* USB_USE_SOFTINTR */ 
2294 usb_schedsoftintr(&sc->sc_bus); 2290 usb_schedsoftintr(&sc->sc_bus);
2295#ifdef USB_USE_SOFTINTR 
2296 tsleep(&sc->sc_softwake, PZERO, "ohciab", 0); 2291 tsleep(&sc->sc_softwake, PZERO, "ohciab", 0);
2297#endif /* USB_USE_SOFTINTR */ 
2298 splx(s); 2292 splx(s);
2299 2293
2300 /* 2294 /*
2301 * Step 3: Remove any vestiges of the xfer from the hardware. 2295 * Step 3: Remove any vestiges of the xfer from the hardware.
2302 * The complication here is that the hardware may have executed 2296 * The complication here is that the hardware may have executed
2303 * beyond the xfer we're trying to abort. So as we're scanning 2297 * beyond the xfer we're trying to abort. So as we're scanning
2304 * the TDs of this xfer we check if the hardware points to 2298 * the TDs of this xfer we check if the hardware points to
2305 * any of them. 2299 * any of them.
2306 */ 2300 */
2307 s = splusb(); /* XXX why? */ 2301 s = splusb(); /* XXX why? */
2308 p = xfer->hcpriv; 2302 p = xfer->hcpriv;
2309#ifdef DIAGNOSTIC 2303#ifdef DIAGNOSTIC
2310 if (p == NULL) { 2304 if (p == NULL) {

cvs diff -r1.51 -r1.52 src/sys/dev/usb/ohcivar.h (expand / switch to unified diff)

--- src/sys/dev/usb/ohcivar.h 2011/05/28 15:47:17 1.51
+++ src/sys/dev/usb/ohcivar.h 2012/03/06 02:49:03 1.52
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ohcivar.h,v 1.51 2011/05/28 15:47:17 tsutsui Exp $ */ 1/* $NetBSD: ohcivar.h,v 1.52 2012/03/06 02:49:03 mrg Exp $ */
2/* $FreeBSD: src/sys/dev/usb/ohcivar.h,v 1.13 1999/11/17 22:33:41 n_hibma Exp $ */ 2/* $FreeBSD: src/sys/dev/usb/ohcivar.h,v 1.13 1999/11/17 22:33:41 n_hibma Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 1998 The NetBSD Foundation, Inc. 5 * Copyright (c) 1998 The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Lennart Augustsson (lennart@augustsson.net) at 9 * by Lennart Augustsson (lennart@augustsson.net) at
10 * Carlstedt Research & Technology. 10 * Carlstedt Research & Technology.
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:
@@ -99,29 +99,27 @@ typedef struct ohci_softc { @@ -99,29 +99,27 @@ typedef struct ohci_softc {
99 99
100 LIST_HEAD(, ohci_soft_td) sc_hash_tds[OHCI_HASH_SIZE]; 100 LIST_HEAD(, ohci_soft_td) sc_hash_tds[OHCI_HASH_SIZE];
101 LIST_HEAD(, ohci_soft_itd) sc_hash_itds[OHCI_HASH_SIZE]; 101 LIST_HEAD(, ohci_soft_itd) sc_hash_itds[OHCI_HASH_SIZE];
102 102
103 int sc_noport; 103 int sc_noport;
104 u_int8_t sc_addr; /* device address */ 104 u_int8_t sc_addr; /* device address */
105 u_int8_t sc_conf; /* device configuration */ 105 u_int8_t sc_conf; /* device configuration */
106 106
107 int sc_endian; 107 int sc_endian;
108#define OHCI_LITTLE_ENDIAN 0 /* typical (uninitialized default) */ 108#define OHCI_LITTLE_ENDIAN 0 /* typical (uninitialized default) */
109#define OHCI_BIG_ENDIAN 1 /* big endian OHCI? never seen it */ 109#define OHCI_BIG_ENDIAN 1 /* big endian OHCI? never seen it */
110#define OHCI_HOST_ENDIAN 2 /* if OHCI always matches CPU */ 110#define OHCI_HOST_ENDIAN 2 /* if OHCI always matches CPU */
111 111
112#ifdef USB_USE_SOFTINTR 
113 char sc_softwake; 112 char sc_softwake;
114#endif /* USB_USE_SOFTINTR */ 
115 113
116 ohci_soft_ed_t *sc_freeeds; 114 ohci_soft_ed_t *sc_freeeds;
117 ohci_soft_td_t *sc_freetds; 115 ohci_soft_td_t *sc_freetds;
118 ohci_soft_itd_t *sc_freeitds; 116 ohci_soft_itd_t *sc_freeitds;
119 117
120 SIMPLEQ_HEAD(, usbd_xfer) sc_free_xfers; /* free xfers */ 118 SIMPLEQ_HEAD(, usbd_xfer) sc_free_xfers; /* free xfers */
121 119
122 usbd_xfer_handle sc_intrxfer; 120 usbd_xfer_handle sc_intrxfer;
123 121
124 char sc_vendor[32]; 122 char sc_vendor[32];
125 int sc_id_vendor; 123 int sc_id_vendor;
126 124
127 u_int32_t sc_control; /* Preserved during suspend/standby */ 125 u_int32_t sc_control; /* Preserved during suspend/standby */

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

--- src/sys/dev/usb/uhci.c 2012/03/06 02:36:46 1.243
+++ src/sys/dev/usb/uhci.c 2012/03/06 02:49:03 1.244
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: uhci.c,v 1.243 2012/03/06 02:36:46 mrg Exp $ */ 1/* $NetBSD: uhci.c,v 1.244 2012/03/06 02:49:03 mrg Exp $ */
2/* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */ 2/* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. 5 * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Lennart Augustsson (lennart@augustsson.net) at 9 * by Lennart Augustsson (lennart@augustsson.net) at
10 * Carlstedt Research & Technology. 10 * Carlstedt Research & Technology.
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.243 2012/03/06 02:36:46 mrg Exp $"); 45__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.244 2012/03/06 02:49:03 mrg 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#include <sys/systm.h> 50#include <sys/systm.h>
51#include <sys/kernel.h> 51#include <sys/kernel.h>
52#include <sys/malloc.h> 52#include <sys/malloc.h>
53#include <sys/device.h> 53#include <sys/device.h>
54#include <sys/select.h> 54#include <sys/select.h>
55#include <sys/extent.h> 55#include <sys/extent.h>
56#include <sys/proc.h> 56#include <sys/proc.h>
57#include <sys/queue.h> 57#include <sys/queue.h>
58#include <sys/bus.h> 58#include <sys/bus.h>
@@ -1360,32 +1360,30 @@ uhci_softintr(void *v) @@ -1360,32 +1360,30 @@ uhci_softintr(void *v)
1360 * way of knowing which transfer it was. You can scan down 1360 * way of knowing which transfer it was. You can scan down
1361 * the TDs and QHs of the previous frame to limit the search, 1361 * the TDs and QHs of the previous frame to limit the search,
1362 * but that assumes that the interrupt was not delayed by more 1362 * but that assumes that the interrupt was not delayed by more
1363 * than 1 ms, which may not always be true (e.g. after debug 1363 * than 1 ms, which may not always be true (e.g. after debug
1364 * output on a slow console). 1364 * output on a slow console).
1365 * We scan all interrupt descriptors to see if any have 1365 * We scan all interrupt descriptors to see if any have
1366 * completed. 1366 * completed.
1367 */ 1367 */
1368 for (ii = LIST_FIRST(&sc->sc_intrhead); ii; ii = nextii) { 1368 for (ii = LIST_FIRST(&sc->sc_intrhead); ii; ii = nextii) {
1369 nextii = LIST_NEXT(ii, list); 1369 nextii = LIST_NEXT(ii, list);
1370 uhci_check_intr(sc, ii); 1370 uhci_check_intr(sc, ii);
1371 } 1371 }
1372 1372
1373#ifdef USB_USE_SOFTINTR 
1374 if (sc->sc_softwake) { 1373 if (sc->sc_softwake) {
1375 sc->sc_softwake = 0; 1374 sc->sc_softwake = 0;
1376 wakeup(&sc->sc_softwake); 1375 wakeup(&sc->sc_softwake);
1377 } 1376 }
1378#endif /* USB_USE_SOFTINTR */ 
1379 1377
1380 sc->sc_bus.intr_context--; 1378 sc->sc_bus.intr_context--;
1381} 1379}
1382 1380
1383/* Check for an interrupt. */ 1381/* Check for an interrupt. */
1384void 1382void
1385uhci_check_intr(uhci_softc_t *sc, uhci_intr_info_t *ii) 1383uhci_check_intr(uhci_softc_t *sc, uhci_intr_info_t *ii)
1386{ 1384{
1387 uhci_soft_td_t *std, *lstd; 1385 uhci_soft_td_t *std, *lstd;
1388 u_int32_t status; 1386 u_int32_t status;
1389 1387
1390 DPRINTFN(15, ("uhci_check_intr: ii=%p\n", ii)); 1388 DPRINTFN(15, ("uhci_check_intr: ii=%p\n", ii));
1391#ifdef DIAGNOSTIC 1389#ifdef DIAGNOSTIC
@@ -2120,34 +2118,30 @@ uhci_abort_xfer(usbd_xfer_handle xfer, u @@ -2120,34 +2118,30 @@ uhci_abort_xfer(usbd_xfer_handle xfer, u
2120 std->offs + offsetof(uhci_td_t, td_status), 2118 std->offs + offsetof(uhci_td_t, td_status),
2121 sizeof(std->td.td_status), 2119 sizeof(std->td.td_status),
2122 BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); 2120 BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
2123 } 2121 }
2124 splx(s); 2122 splx(s);
2125 2123
2126 /* 2124 /*
2127 * Step 2: Wait until we know hardware has finished any possible 2125 * Step 2: Wait until we know hardware has finished any possible
2128 * use of the xfer. Also make sure the soft interrupt routine 2126 * use of the xfer. Also make sure the soft interrupt routine
2129 * has run. 2127 * has run.
2130 */ 2128 */
2131 usb_delay_ms(upipe->pipe.device->bus, 2); /* Hardware finishes in 1ms */ 2129 usb_delay_ms(upipe->pipe.device->bus, 2); /* Hardware finishes in 1ms */
2132 s = splusb(); 2130 s = splusb();
2133#ifdef USB_USE_SOFTINTR 
2134 sc->sc_softwake = 1; 2131 sc->sc_softwake = 1;
2135#endif /* USB_USE_SOFTINTR */ 
2136 usb_schedsoftintr(&sc->sc_bus); 2132 usb_schedsoftintr(&sc->sc_bus);
2137#ifdef USB_USE_SOFTINTR 
2138 DPRINTFN(1,("uhci_abort_xfer: tsleep\n")); 2133 DPRINTFN(1,("uhci_abort_xfer: tsleep\n"));
2139 tsleep(&sc->sc_softwake, PZERO, "uhciab", 0); 2134 tsleep(&sc->sc_softwake, PZERO, "uhciab", 0);
2140#endif /* USB_USE_SOFTINTR */ 
2141 splx(s); 2135 splx(s);
2142 2136
2143 /* 2137 /*
2144 * Step 3: Execute callback. 2138 * Step 3: Execute callback.
2145 */ 2139 */
2146 DPRINTFN(1,("uhci_abort_xfer: callback\n")); 2140 DPRINTFN(1,("uhci_abort_xfer: callback\n"));
2147 s = splusb(); 2141 s = splusb();
2148#ifdef DIAGNOSTIC 2142#ifdef DIAGNOSTIC
2149 ii->isdone = 1; 2143 ii->isdone = 1;
2150#endif 2144#endif
2151 wake = xfer->hcflags & UXFER_ABORTWAIT; 2145 wake = xfer->hcflags & UXFER_ABORTWAIT;
2152 xfer->hcflags &= ~(UXFER_ABORTING | UXFER_ABORTWAIT); 2146 xfer->hcflags &= ~(UXFER_ABORTING | UXFER_ABORTWAIT);
2153 usb_transfer_complete(xfer); 2147 usb_transfer_complete(xfer);

cvs diff -r1.49 -r1.50 src/sys/dev/usb/uhcivar.h (expand / switch to unified diff)

--- src/sys/dev/usb/uhcivar.h 2012/02/24 06:48:25 1.49
+++ src/sys/dev/usb/uhcivar.h 2012/03/06 02:49:03 1.50
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: uhcivar.h,v 1.49 2012/02/24 06:48:25 mrg Exp $ */ 1/* $NetBSD: uhcivar.h,v 1.50 2012/03/06 02:49:03 mrg Exp $ */
2/* $FreeBSD: src/sys/dev/usb/uhcivar.h,v 1.14 1999/11/17 22:33:42 n_hibma Exp $ */ 2/* $FreeBSD: src/sys/dev/usb/uhcivar.h,v 1.14 1999/11/17 22:33:42 n_hibma Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 1998 The NetBSD Foundation, Inc. 5 * Copyright (c) 1998 The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Lennart Augustsson (lennart@augustsson.net) at 9 * by Lennart Augustsson (lennart@augustsson.net) at
10 * Carlstedt Research & Technology. 10 * Carlstedt Research & Technology.
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:
@@ -147,29 +147,27 @@ typedef struct uhci_softc { @@ -147,29 +147,27 @@ typedef struct uhci_softc {
147 u_int32_t sc_loops; /* number of QHs that wants looping */ 147 u_int32_t sc_loops; /* number of QHs that wants looping */
148 148
149 uhci_soft_td_t *sc_freetds; /* TD free list */ 149 uhci_soft_td_t *sc_freetds; /* TD free list */
150 uhci_soft_qh_t *sc_freeqhs; /* QH free list */ 150 uhci_soft_qh_t *sc_freeqhs; /* QH free list */
151 151
152 SIMPLEQ_HEAD(, usbd_xfer) sc_free_xfers; /* free xfers */ 152 SIMPLEQ_HEAD(, usbd_xfer) sc_free_xfers; /* free xfers */
153 153
154 u_int8_t sc_addr; /* device address */ 154 u_int8_t sc_addr; /* device address */
155 u_int8_t sc_conf; /* device configuration */ 155 u_int8_t sc_conf; /* device configuration */
156 156
157 u_int8_t sc_saved_sof; 157 u_int8_t sc_saved_sof;
158 u_int16_t sc_saved_frnum; 158 u_int16_t sc_saved_frnum;
159 159
160#ifdef USB_USE_SOFTINTR 
161 char sc_softwake; 160 char sc_softwake;
162#endif /* USB_USE_SOFTINTR */ 
163 161
164 char sc_isreset; 162 char sc_isreset;
165 char sc_suspend; 163 char sc_suspend;
166 char sc_dying; 164 char sc_dying;
167 165
168 LIST_HEAD(, uhci_intr_info) sc_intrhead; 166 LIST_HEAD(, uhci_intr_info) sc_intrhead;
169 167
170 /* Info for the root hub interrupt "pipe". */ 168 /* Info for the root hub interrupt "pipe". */
171 int sc_ival; /* time between root hub intrs */ 169 int sc_ival; /* time between root hub intrs */
172 usbd_xfer_handle sc_intr_xfer; /* root hub interrupt transfer */ 170 usbd_xfer_handle sc_intr_xfer; /* root hub interrupt transfer */
173 struct callout sc_poll_handle; 171 struct callout sc_poll_handle;
174 172
175 char sc_vendor[32]; /* vendor string for root hub */ 173 char sc_vendor[32]; /* vendor string for root hub */

cvs diff -r1.127 -r1.128 src/sys/dev/usb/usb.c (expand / switch to unified diff)

--- src/sys/dev/usb/usb.c 2011/12/23 00:51:48 1.127
+++ src/sys/dev/usb/usb.c 2012/03/06 02:49:03 1.128
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: usb.c,v 1.127 2011/12/23 00:51:48 jakllsch Exp $ */ 1/* $NetBSD: usb.c,v 1.128 2012/03/06 02:49:03 mrg Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2002, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 2002, 2008 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. 9 * Carlstedt Research & Technology.
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
@@ -27,27 +27,27 @@ @@ -27,27 +27,27 @@
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/* 33/*
34 * USB specifications and other documentation can be found at 34 * USB specifications and other documentation can be found at
35 * http://www.usb.org/developers/docs/ and 35 * http://www.usb.org/developers/docs/ and
36 * http://www.usb.org/developers/devclass_docs/ 36 * http://www.usb.org/developers/devclass_docs/
37 */ 37 */
38 38
39#include <sys/cdefs.h> 39#include <sys/cdefs.h>
40__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.127 2011/12/23 00:51:48 jakllsch Exp $"); 40__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.128 2012/03/06 02:49:03 mrg Exp $");
41 41
42#include "opt_compat_netbsd.h" 42#include "opt_compat_netbsd.h"
43#include "opt_usb.h" 43#include "opt_usb.h"
44 44
45#include <sys/param.h> 45#include <sys/param.h>
46#include <sys/systm.h> 46#include <sys/systm.h>
47#include <sys/kernel.h> 47#include <sys/kernel.h>
48#include <sys/malloc.h> 48#include <sys/malloc.h>
49#include <sys/device.h> 49#include <sys/device.h>
50#include <sys/kthread.h> 50#include <sys/kthread.h>
51#include <sys/proc.h> 51#include <sys/proc.h>
52#include <sys/conf.h> 52#include <sys/conf.h>
53#include <sys/fcntl.h> 53#include <sys/fcntl.h>
@@ -218,37 +218,35 @@ usb_doattach(device_t self) @@ -218,37 +218,35 @@ usb_doattach(device_t self)
218 speed = USB_SPEED_FULL; 218 speed = USB_SPEED_FULL;
219 break; 219 break;
220 case USBREV_2_0: 220 case USBREV_2_0:
221 speed = USB_SPEED_HIGH; 221 speed = USB_SPEED_HIGH;
222 break; 222 break;
223 default: 223 default:
224 panic("usb_doattach"); 224 panic("usb_doattach");
225 } 225 }
226 226
227 ue = usb_alloc_event(); 227 ue = usb_alloc_event();
228 ue->u.ue_ctrlr.ue_bus = device_unit(self); 228 ue->u.ue_ctrlr.ue_bus = device_unit(self);
229 usb_add_event(USB_EVENT_CTRLR_ATTACH, ue); 229 usb_add_event(USB_EVENT_CTRLR_ATTACH, ue);
230 230
231#ifdef USB_USE_SOFTINTR 
232 /* XXX we should have our own level */ 231 /* XXX we should have our own level */
233 sc->sc_bus->soft = softint_establish(SOFTINT_NET, 232 sc->sc_bus->soft = softint_establish(SOFTINT_NET,
234 sc->sc_bus->methods->soft_intr, sc->sc_bus); 233 sc->sc_bus->methods->soft_intr, sc->sc_bus);
235 if (sc->sc_bus->soft == NULL) { 234 if (sc->sc_bus->soft == NULL) {
236 aprint_error("%s: can't register softintr\n", 235 aprint_error("%s: can't register softintr\n",
237 device_xname(self)); 236 device_xname(self));
238 sc->sc_dying = 1; 237 sc->sc_dying = 1;
239 return; 238 return;
240 } 239 }
241#endif 
242 240
243 err = usbd_new_device(self, sc->sc_bus, 0, speed, 0, 241 err = usbd_new_device(self, sc->sc_bus, 0, speed, 0,
244 &sc->sc_port); 242 &sc->sc_port);
245 if (!err) { 243 if (!err) {
246 dev = sc->sc_port.device; 244 dev = sc->sc_port.device;
247 if (dev->hub == NULL) { 245 if (dev->hub == NULL) {
248 sc->sc_dying = 1; 246 sc->sc_dying = 1;
249 aprint_error("%s: root device is not a hub\n", 247 aprint_error("%s: root device is not a hub\n",
250 device_xname(self)); 248 device_xname(self));
251 return; 249 return;
252 } 250 }
253 sc->sc_bus->root_hub = dev; 251 sc->sc_bus->root_hub = dev;
254#if 1 252#if 1
@@ -900,35 +898,31 @@ usb_async_intr(void *cookie) @@ -900,35 +898,31 @@ usb_async_intr(void *cookie)
900{ 898{
901 proc_t *proc; 899 proc_t *proc;
902 900
903 mutex_enter(proc_lock); 901 mutex_enter(proc_lock);
904 if ((proc = usb_async_proc) != NULL) 902 if ((proc = usb_async_proc) != NULL)
905 psignal(proc, SIGIO); 903 psignal(proc, SIGIO);
906 mutex_exit(proc_lock); 904 mutex_exit(proc_lock);
907} 905}
908 906
909void 907void
910usb_schedsoftintr(usbd_bus_handle bus) 908usb_schedsoftintr(usbd_bus_handle bus)
911{ 909{
912 DPRINTFN(10,("usb_schedsoftintr: polling=%d\n", bus->use_polling)); 910 DPRINTFN(10,("usb_schedsoftintr: polling=%d\n", bus->use_polling));
913#ifdef USB_USE_SOFTINTR 
914 if (bus->use_polling) { 911 if (bus->use_polling) {
915 bus->methods->soft_intr(bus); 912 bus->methods->soft_intr(bus);
916 } else { 913 } else {
917 softint_schedule(bus->soft); 914 softint_schedule(bus->soft);
918 } 915 }
919#else 
920 bus->methods->soft_intr(bus); 
921#endif /* USB_USE_SOFTINTR */ 
922} 916}
923 917
924int 918int
925usb_activate(device_t self, enum devact act) 919usb_activate(device_t self, enum devact act)
926{ 920{
927 struct usb_softc *sc = device_private(self); 921 struct usb_softc *sc = device_private(self);
928 922
929 switch (act) { 923 switch (act) {
930 case DVACT_DEACTIVATE: 924 case DVACT_DEACTIVATE:
931 sc->sc_dying = 1; 925 sc->sc_dying = 1;
932 return 0; 926 return 0;
933 default: 927 default:
934 return EOPNOTSUPP; 928 return EOPNOTSUPP;
@@ -963,32 +957,30 @@ usb_detach(device_t self, int flags) @@ -963,32 +957,30 @@ usb_detach(device_t self, int flags)
963 if (sc->sc_port.device != NULL && 957 if (sc->sc_port.device != NULL &&
964 (rc = usb_disconnect_port(&sc->sc_port, self, flags)) != 0) 958 (rc = usb_disconnect_port(&sc->sc_port, self, flags)) != 0)
965 return rc; 959 return rc;
966 960
967 pmf_device_deregister(self); 961 pmf_device_deregister(self);
968 /* Kill off event thread. */ 962 /* Kill off event thread. */
969 sc->sc_dying = 1; 963 sc->sc_dying = 1;
970 while (sc->sc_event_thread != NULL) { 964 while (sc->sc_event_thread != NULL) {
971 wakeup(&sc->sc_bus->needs_explore); 965 wakeup(&sc->sc_bus->needs_explore);
972 tsleep(sc, PWAIT, "usbdet", hz * 60); 966 tsleep(sc, PWAIT, "usbdet", hz * 60);
973 } 967 }
974 DPRINTF(("usb_detach: event thread dead\n")); 968 DPRINTF(("usb_detach: event thread dead\n"));
975 969
976#ifdef USB_USE_SOFTINTR 
977 if (sc->sc_bus->soft != NULL) { 970 if (sc->sc_bus->soft != NULL) {
978 softint_disestablish(sc->sc_bus->soft); 971 softint_disestablish(sc->sc_bus->soft);
979 sc->sc_bus->soft = NULL; 972 sc->sc_bus->soft = NULL;
980 } 973 }
981#endif 
982 974
983 ue = usb_alloc_event(); 975 ue = usb_alloc_event();
984 ue->u.ue_ctrlr.ue_bus = device_unit(self); 976 ue->u.ue_ctrlr.ue_bus = device_unit(self);
985 usb_add_event(USB_EVENT_CTRLR_DETACH, ue); 977 usb_add_event(USB_EVENT_CTRLR_DETACH, ue);
986 978
987 return (0); 979 return (0);
988} 980}
989 981
990#ifdef COMPAT_30 982#ifdef COMPAT_30
991Static void 983Static void
992usb_copy_old_devinfo(struct usb_device_info_old *uo, 984usb_copy_old_devinfo(struct usb_device_info_old *uo,
993 const struct usb_device_info *ue) 985 const struct usb_device_info *ue)
994{ 986{

cvs diff -r1.93 -r1.94 src/sys/dev/usb/usb.h (expand / switch to unified diff)

--- src/sys/dev/usb/usb.h 2011/08/23 16:16:43 1.93
+++ src/sys/dev/usb/usb.h 2012/03/06 02:49:03 1.94
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: usb.h,v 1.93 2011/08/23 16:16:43 christos Exp $ */ 1/* $NetBSD: usb.h,v 1.94 2012/03/06 02:49:03 mrg Exp $ */
2/* $FreeBSD: src/sys/dev/usb/usb.h,v 1.14 1999/11/17 22:33:46 n_hibma Exp $ */ 2/* $FreeBSD: src/sys/dev/usb/usb.h,v 1.14 1999/11/17 22:33:46 n_hibma Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 1998 The NetBSD Foundation, Inc. 5 * Copyright (c) 1998 The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Lennart Augustsson (lennart@augustsson.net) at 9 * by Lennart Augustsson (lennart@augustsson.net) at
10 * Carlstedt Research & Technology. 10 * Carlstedt Research & Technology.
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:
@@ -41,28 +41,26 @@ @@ -41,28 +41,26 @@
41#include <sys/ioctl.h> 41#include <sys/ioctl.h>
42 42
43#if defined(_KERNEL) 43#if defined(_KERNEL)
44#include <sys/mallocvar.h> 44#include <sys/mallocvar.h>
45 45
46MALLOC_DECLARE(M_USB); 46MALLOC_DECLARE(M_USB);
47MALLOC_DECLARE(M_USBDEV); 47MALLOC_DECLARE(M_USBDEV);
48MALLOC_DECLARE(M_USBHC); 48MALLOC_DECLARE(M_USBHC);
49 49
50#include <sys/device.h> 50#include <sys/device.h>
51 51
52#endif 52#endif
53 53
54#define USB_USE_SOFTINTR 
55 
56#ifdef USB_DEBUG 54#ifdef USB_DEBUG
57#define UKBD_DEBUG 1 55#define UKBD_DEBUG 1
58#define UHIDEV_DEBUG 1 56#define UHIDEV_DEBUG 1
59#define UHID_DEBUG 1 57#define UHID_DEBUG 1
60#define OHCI_DEBUG 1 58#define OHCI_DEBUG 1
61#define UGEN_DEBUG 1 59#define UGEN_DEBUG 1
62#define UHCI_DEBUG 1 60#define UHCI_DEBUG 1
63#define UHUB_DEBUG 1 61#define UHUB_DEBUG 1
64#define ULPT_DEBUG 1 62#define ULPT_DEBUG 1
65#define UCOM_DEBUG 1 63#define UCOM_DEBUG 1
66#define UPLCOM_DEBUG 1 64#define UPLCOM_DEBUG 1
67#define UMCT_DEBUG 1 65#define UMCT_DEBUG 1
68#define UMODEM_DEBUG 1 66#define UMODEM_DEBUG 1