Module Name: src Committed By: mrg Date: Sun Mar 11 00:34:46 UTC 2012
Modified Files: src/sys/arch/mips/adm5120/dev: ahci.c src/sys/dev/ic: sl811hs.c src/sys/dev/usb: ehci.c ohci.c uhci.c usbdi.c usbdivar.h Log Message: pull down from usbmp branch: - remove usbd_bus{} intr_context member, and replace the checks against it with cpu_intr_p() and cpu_softintr_p(). To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/adm5120/dev/ahci.c cvs rdiff -u -r1.31 -r1.32 src/sys/dev/ic/sl811hs.c cvs rdiff -u -r1.186 -r1.187 src/sys/dev/usb/ehci.c cvs rdiff -u -r1.222 -r1.223 src/sys/dev/usb/ohci.c cvs rdiff -u -r1.246 -r1.247 src/sys/dev/usb/uhci.c cvs rdiff -u -r1.135 -r1.136 src/sys/dev/usb/usbdi.c cvs rdiff -u -r1.94 -r1.95 src/sys/dev/usb/usbdivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/mips/adm5120/dev/ahci.c diff -u src/sys/arch/mips/adm5120/dev/ahci.c:1.7 src/sys/arch/mips/adm5120/dev/ahci.c:1.8 --- src/sys/arch/mips/adm5120/dev/ahci.c:1.7 Fri Jul 1 18:38:49 2011 +++ src/sys/arch/mips/adm5120/dev/ahci.c Sun Mar 11 00:34:46 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ahci.c,v 1.7 2011/07/01 18:38:49 dyoung Exp $ */ +/* $NetBSD: ahci.c,v 1.8 2012/03/11 00:34:46 mrg Exp $ */ /*- * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko. @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.7 2011/07/01 18:38:49 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.8 2012/03/11 00:34:46 mrg Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -460,9 +460,7 @@ ahci_poll_hub(void *arg) xfer->actlen = 1; xfer->status = USBD_NORMAL_COMPLETION; s = splusb(); - xfer->device->bus->intr_context++; usb_transfer_complete(xfer); - xfer->device->bus->intr_context--; splx(s); } @@ -1289,9 +1287,7 @@ ahci_poll_device(void *arg) xfer->status = USBD_NORMAL_COMPLETION; s = splusb(); - xfer->device->bus->intr_context++; usb_transfer_complete(xfer); - xfer->device->bus->intr_context--; splx(s); } Index: src/sys/dev/ic/sl811hs.c diff -u src/sys/dev/ic/sl811hs.c:1.31 src/sys/dev/ic/sl811hs.c:1.32 --- src/sys/dev/ic/sl811hs.c:1.31 Sun Nov 27 14:36:20 2011 +++ src/sys/dev/ic/sl811hs.c Sun Mar 11 00:34:46 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: sl811hs.c,v 1.31 2011/11/27 14:36:20 rmind Exp $ */ +/* $NetBSD: sl811hs.c,v 1.32 2012/03/11 00:34:46 mrg Exp $ */ /* * Not (c) 2007 Matthew Orgass @@ -84,7 +84,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.31 2011/11/27 14:36:20 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.32 2012/03/11 00:34:46 mrg Exp $"); #include "opt_slhci.h" @@ -1470,7 +1470,6 @@ slhci_do_callback(struct slhci_softc *sc int repeat; - sc->sc_bus.intr_context++; start_cc_time(&t_callback, (u_int)xfer); simple_unlock(&sc->sc_lock); splx(*s); @@ -1482,7 +1481,6 @@ slhci_do_callback(struct slhci_softc *sc *s = splhardusb(); simple_lock(&sc->sc_lock); stop_cc_time(&t_callback); - sc->sc_bus.intr_context--; if (repeat && !sc->sc_bus.use_polling) slhci_do_repeat(sc, xfer); @@ -3660,8 +3658,7 @@ slhci_log_sc(void) DDOLOG("frame=%d rootintr=%p", t->frame, t->rootintr, 0,0); - DDOLOG("use_polling=%d intr_context=%d", ssc->sc_bus.use_polling, - ssc->sc_bus.intr_context, 0,0); + DDOLOG("use_polling=%d", ssc->sc_bus.use_polling, 0, 0, 0); } void Index: src/sys/dev/usb/ehci.c diff -u src/sys/dev/usb/ehci.c:1.186 src/sys/dev/usb/ehci.c:1.187 --- src/sys/dev/usb/ehci.c:1.186 Tue Mar 6 03:35:29 2012 +++ src/sys/dev/usb/ehci.c Sun Mar 11 00:34:45 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ehci.c,v 1.186 2012/03/06 03:35:29 mrg Exp $ */ +/* $NetBSD: ehci.c,v 1.187 2012/03/11 00:34:45 mrg Exp $ */ /* * Copyright (c) 2004-2008 The NetBSD Foundation, Inc. @@ -52,7 +52,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.186 2012/03/06 03:35:29 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.187 2012/03/11 00:34:45 mrg Exp $"); #include "ohci.h" #include "uhci.h" @@ -68,6 +68,7 @@ __KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.1 #include <sys/queue.h> #include <sys/mutex.h> #include <sys/bus.h> +#include <sys/cpu.h> #include <machine/endian.h> @@ -613,7 +614,6 @@ ehci_intr1(ehci_softc_t *sc) return (0); EOWRITE4(sc, EHCI_USBSTS, intrs); /* Acknowledge */ - sc->sc_bus.intr_context++; sc->sc_bus.no_intrs++; if (eintrs & EHCI_STS_IAA) { DPRINTF(("ehci_intr1: door bell\n")); @@ -637,8 +637,6 @@ ehci_intr1(ehci_softc_t *sc) eintrs &= ~EHCI_STS_PCD; } - sc->sc_bus.intr_context--; - if (eintrs != 0) { /* Block unprocessed interrupts. */ sc->sc_eintrs &= ~eintrs; @@ -687,10 +685,7 @@ ehci_softintr(void *v) ehci_softc_t *sc = bus->hci_private; struct ehci_xfer *ex, *nextex; - DPRINTFN(10,("%s: ehci_softintr (%d)\n", device_xname(sc->sc_dev), - sc->sc_bus.intr_context)); - - sc->sc_bus.intr_context++; + DPRINTFN(10,("%s: ehci_softintr\n", device_xname(sc->sc_dev))); /* * The only explanation I can think of for why EHCI is as brain dead @@ -713,8 +708,6 @@ ehci_softintr(void *v) sc->sc_softwake = 0; wakeup(&sc->sc_softwake); } - - sc->sc_bus.intr_context--; } /* Check for an interrupt. */ @@ -2916,7 +2909,7 @@ ehci_abort_xfer(usbd_xfer_handle xfer, u return; } - if (xfer->device->bus->intr_context) + if (cpu_intr_p() || cpu_softintr_p()) panic("ehci_abort_xfer: not in process context"); /* Index: src/sys/dev/usb/ohci.c diff -u src/sys/dev/usb/ohci.c:1.222 src/sys/dev/usb/ohci.c:1.223 --- src/sys/dev/usb/ohci.c:1.222 Sat Mar 10 23:01:07 2012 +++ src/sys/dev/usb/ohci.c Sun Mar 11 00:34:46 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ohci.c,v 1.222 2012/03/10 23:01:07 mrg Exp $ */ +/* $NetBSD: ohci.c,v 1.223 2012/03/11 00:34:46 mrg Exp $ */ /* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */ /* @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.222 2012/03/10 23:01:07 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.223 2012/03/11 00:34:46 mrg Exp $"); #include "opt_usb.h" @@ -53,8 +53,9 @@ __KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.2 #include <sys/select.h> #include <sys/proc.h> #include <sys/queue.h> - #include <sys/bus.h> +#include <sys/cpu.h> + #include <machine/endian.h> #include <dev/usb/usb.h> @@ -1155,7 +1156,6 @@ ohci_intr1(ohci_softc_t *sc) return (0); } - sc->sc_bus.intr_context++; sc->sc_bus.no_intrs++; if (eintrs & OHCI_SO) { sc->sc_overrun_cnt++; @@ -1194,8 +1194,6 @@ ohci_intr1(ohci_softc_t *sc) callout_reset(&sc->sc_tmo_rhsc, hz, ohci_rhsc_enable, sc); } - sc->sc_bus.intr_context--; - if (eintrs != 0) { /* Block unprocessed interrupts. */ OWRITE4(sc, OHCI_INTERRUPT_DISABLE, eintrs); @@ -1255,8 +1253,6 @@ ohci_softintr(void *v) DPRINTFN(10,("ohci_softintr: enter\n")); - sc->sc_bus.intr_context++; - s = splhardusb(); usb_syncmem(&sc->sc_hccadma, offsetof(struct ohci_hcca, hcca_done_head), sizeof(sc->sc_hcca->hcca_done_head), @@ -1462,7 +1458,6 @@ ohci_softintr(void *v) wakeup(&sc->sc_softwake); } - sc->sc_bus.intr_context--; DPRINTFN(10,("ohci_softintr: done:\n")); } @@ -2240,7 +2235,7 @@ ohci_abort_xfer(usbd_xfer_handle xfer, u return; } - if (xfer->device->bus->intr_context) + if (cpu_intr_p() || cpu_softintr_p()) panic("ohci_abort_xfer: not in process context"); /* Index: src/sys/dev/usb/uhci.c diff -u src/sys/dev/usb/uhci.c:1.246 src/sys/dev/usb/uhci.c:1.247 --- src/sys/dev/usb/uhci.c:1.246 Sat Mar 10 23:01:07 2012 +++ src/sys/dev/usb/uhci.c Sun Mar 11 00:34:46 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uhci.c,v 1.246 2012/03/10 23:01:07 mrg Exp $ */ +/* $NetBSD: uhci.c,v 1.247 2012/03/11 00:34:46 mrg Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */ /* @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.246 2012/03/10 23:01:07 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.247 2012/03/11 00:34:46 mrg Exp $"); #include "opt_usb.h" @@ -56,6 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.2 #include <sys/proc.h> #include <sys/queue.h> #include <sys/bus.h> +#include <sys/cpu.h> #include <machine/endian.h> @@ -1014,9 +1015,7 @@ uhci_poll_hub(void *addr) xfer->actlen = 1; xfer->status = USBD_NORMAL_COMPLETION; s = splusb(); - xfer->device->bus->intr_context++; usb_transfer_complete(xfer); - xfer->device->bus->intr_context--; splx(s); } @@ -1349,10 +1348,7 @@ uhci_softintr(void *v) uhci_softc_t *sc = bus->hci_private; uhci_intr_info_t *ii, *nextii; - DPRINTFN(10,("%s: uhci_softintr (%d)\n", device_xname(sc->sc_dev), - sc->sc_bus.intr_context)); - - sc->sc_bus.intr_context++; + DPRINTFN(10,("%s: uhci_softintr\n", device_xname(sc->sc_dev))); /* * Interrupts on UHCI really suck. When the host controller @@ -1374,8 +1370,6 @@ uhci_softintr(void *v) sc->sc_softwake = 0; wakeup(&sc->sc_softwake); } - - sc->sc_bus.intr_context--; } /* Check for an interrupt. */ @@ -2078,7 +2072,7 @@ uhci_abort_xfer(usbd_xfer_handle xfer, u return; } - if (xfer->device->bus->intr_context) + if (cpu_intr_p() || cpu_softintr_p()) panic("uhci_abort_xfer: not in process context"); /* Index: src/sys/dev/usb/usbdi.c diff -u src/sys/dev/usb/usbdi.c:1.135 src/sys/dev/usb/usbdi.c:1.136 --- src/sys/dev/usb/usbdi.c:1.135 Tue Mar 6 02:36:46 2012 +++ src/sys/dev/usb/usbdi.c Sun Mar 11 00:34:46 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi.c,v 1.135 2012/03/06 02:36:46 mrg Exp $ */ +/* $NetBSD: usbdi.c,v 1.136 2012/03/11 00:34:46 mrg Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $ */ /* @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.135 2012/03/06 02:36:46 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.136 2012/03/11 00:34:46 mrg Exp $"); #include "opt_compat_netbsd.h" #include "opt_usb.h" @@ -43,8 +43,8 @@ __KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1. #include <sys/device.h> #include <sys/malloc.h> #include <sys/proc.h> - #include <sys/bus.h> +#include <sys/cpu.h> #include <dev/usb/usb.h> #include <dev/usb/usbdi.h> @@ -931,7 +931,7 @@ usbd_do_request_flags_pipe(usbd_device_h usbd_status err; #ifdef DIAGNOSTIC - if (dev->bus->intr_context) { + if (cpu_intr_p() || cpu_softintr_p()) { printf("usbd_do_request: not in process context\n"); return (USBD_INVAL); } Index: src/sys/dev/usb/usbdivar.h diff -u src/sys/dev/usb/usbdivar.h:1.94 src/sys/dev/usb/usbdivar.h:1.95 --- src/sys/dev/usb/usbdivar.h:1.94 Tue Mar 6 02:36:46 2012 +++ src/sys/dev/usb/usbdivar.h Sun Mar 11 00:34:45 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: usbdivar.h,v 1.94 2012/03/06 02:36:46 mrg Exp $ */ +/* $NetBSD: usbdivar.h,v 1.95 2012/03/11 00:34:45 mrg Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $ */ /* @@ -110,7 +110,6 @@ struct usbd_bus { char use_polling; device_t usbctl; struct usb_device_stats stats; - int intr_context; u_int no_intrs; int usbrev; /* USB revision */ #define USBREV_UNKNOWN 0