diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-03-10 09:14:07 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-03-10 09:14:07 +0000 |
commit | 8be19390d68917bbad04b8329790eb50f5281208 (patch) | |
tree | 7ed75ef852ff5695404c131ac118f55e2b269025 /sys/dev/usb/ohci.c | |
parent | 89f5b2fc7363899bc4ee99e1fb9675e5531dec00 (diff) |
Move per HC polling code to the stack.
This code contains a use-after-free which be addressed in an upcoming
diff.
This fix xhci(4) polling mode.
ok kettenis@
Diffstat (limited to 'sys/dev/usb/ohci.c')
-rw-r--r-- | sys/dev/usb/ohci.c | 55 |
1 files changed, 1 insertions, 54 deletions
diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c index c955b5b3087..ee9370970a4 100644 --- a/sys/dev/usb/ohci.c +++ b/sys/dev/usb/ohci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ohci.c,v 1.147 2016/09/15 02:00:17 dlg Exp $ */ +/* $OpenBSD: ohci.c,v 1.148 2017/03/10 09:14:06 mpi Exp $ */ /* $NetBSD: ohci.c,v 1.139 2003/02/22 05:24:16 tsutsui Exp $ */ /* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */ @@ -90,7 +90,6 @@ usbd_status ohci_open(struct usbd_pipe *); int ohci_setaddr(struct usbd_device *, int); void ohci_poll(struct usbd_bus *); void ohci_softintr(void *); -void ohci_waitintr(struct ohci_softc *, struct usbd_xfer *); void ohci_add_done(struct ohci_softc *, ohci_physaddr_t); void ohci_rhsc(struct ohci_softc *, struct usbd_xfer *); @@ -1506,42 +1505,6 @@ ohci_root_ctrl_done(struct usbd_xfer *xfer) { } -/* - * Wait here until controller claims to have an interrupt. - * Then call ohci_intr and return. Use timeout to avoid waiting - * too long. - */ -void -ohci_waitintr(struct ohci_softc *sc, struct usbd_xfer *xfer) -{ - int timo; - u_int32_t intrs; - - xfer->status = USBD_IN_PROGRESS; - for (timo = xfer->timeout; timo >= 0; timo--) { - usb_delay_ms(&sc->sc_bus, 1); - if (sc->sc_bus.dying) - break; - intrs = OREAD4(sc, OHCI_INTERRUPT_STATUS) & sc->sc_eintrs; - DPRINTFN(15,("ohci_waitintr: 0x%04x\n", intrs)); -#ifdef OHCI_DEBUG - if (ohcidebug > 15) - ohci_dumpregs(sc); -#endif - if (intrs) { - ohci_intr1(sc); - if (xfer->status != USBD_IN_PROGRESS) - return; - } - } - - /* Timeout */ - DPRINTF(("ohci_waitintr: timeout\n")); - xfer->status = USBD_TIMEOUT; - usb_transfer_complete(xfer); - /* XXX should free TD */ -} - void ohci_poll(struct usbd_bus *bus) { @@ -2686,9 +2649,6 @@ ohci_device_ctrl_start(struct usbd_xfer *xfer) if (err) return (err); - if (sc->sc_bus.use_polling) - ohci_waitintr(sc, xfer); - return (USBD_IN_PROGRESS); } @@ -2826,9 +2786,6 @@ ohci_device_bulk_start(struct usbd_xfer *xfer) splx(s); - if (sc->sc_bus.use_polling) - ohci_waitintr(sc, xfer); - return (USBD_IN_PROGRESS); } @@ -2944,9 +2901,6 @@ ohci_device_intr_start(struct usbd_xfer *xfer) #endif splx(s); - if (sc->sc_bus.use_polling) - ohci_waitintr(sc, xfer); - return (USBD_IN_PROGRESS); } @@ -3220,13 +3174,6 @@ ohci_device_isoc_start(struct usbd_xfer *xfer) printf("ohci_device_isoc_start: not in progress %p\n", xfer); #endif - /* XXX anything to do? */ - - if (sc->sc_bus.use_polling) { - DPRINTF(("Starting ohci isoc xfer with polling. Bad idea?\n")); - ohci_waitintr(sc, xfer); - } - return (USBD_IN_PROGRESS); } |