In rev 1.51 of usb_port.h I switched over to using the USB_USE_SOFTINTR
code path to fix a bug in the non USB_USE_SOFTINTR path that caused the usb bus to hang and generally misbehave when devices were unplugged. In the process though it also reduced the throughput of usb devices because of a less than optimal implementation under FreeBSD. This commit fixes the non USB_USE_SOFTINTR code in uhci and ohci so that it works again, and switches back to using this code path. The uhci code has been tested, but the ohci code hasn't. It's essentially the same anyway and so I don't envisage any difficulties. Code for uhci submitted by: Maksim Yevmenkin <myevmenk@exodus.net>
This commit is contained in:
parent
3264749d81
commit
9b80ac7383
@ -1462,10 +1462,12 @@ ohci_softintr(void *v)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USB_USE_SOFTINTR
|
||||||
if (sc->sc_softwake) {
|
if (sc->sc_softwake) {
|
||||||
sc->sc_softwake = 0;
|
sc->sc_softwake = 0;
|
||||||
wakeup(&sc->sc_softwake);
|
wakeup(&sc->sc_softwake);
|
||||||
}
|
}
|
||||||
|
#endif /* USB_USE_SOFTINTR */
|
||||||
|
|
||||||
sc->sc_bus.intr_context--;
|
sc->sc_bus.intr_context--;
|
||||||
DPRINTFN(10,("ohci_softintr: done:\n"));
|
DPRINTFN(10,("ohci_softintr: done:\n"));
|
||||||
@ -2228,9 +2230,13 @@ ohci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
|
|||||||
*/
|
*/
|
||||||
usb_delay_ms(opipe->pipe.device->bus, 20); /* Hardware finishes in 1ms */
|
usb_delay_ms(opipe->pipe.device->bus, 20); /* Hardware finishes in 1ms */
|
||||||
s = splusb();
|
s = splusb();
|
||||||
|
#ifdef USB_USE_SOFTINTR
|
||||||
sc->sc_softwake = 1;
|
sc->sc_softwake = 1;
|
||||||
|
#endif /* USB_USE_SOFTINTR */
|
||||||
usb_schedsoftintr(&sc->sc_bus);
|
usb_schedsoftintr(&sc->sc_bus);
|
||||||
|
#ifdef USB_USE_SOFTINTR
|
||||||
tsleep(&sc->sc_softwake, PZERO, "ohciab", 0);
|
tsleep(&sc->sc_softwake, PZERO, "ohciab", 0);
|
||||||
|
#endif /* USB_USE_SOFTINTR */
|
||||||
splx(s);
|
splx(s);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -111,7 +111,10 @@ typedef struct ohci_softc {
|
|||||||
int sc_noport;
|
int sc_noport;
|
||||||
u_int8_t sc_addr; /* device address */
|
u_int8_t sc_addr; /* device address */
|
||||||
u_int8_t sc_conf; /* device configuration */
|
u_int8_t sc_conf; /* device configuration */
|
||||||
|
|
||||||
|
#ifdef USB_USE_SOFTINTR
|
||||||
char sc_softwake;
|
char sc_softwake;
|
||||||
|
#endif /* USB_USE_SOFTINTR */
|
||||||
|
|
||||||
ohci_soft_ed_t *sc_freeeds;
|
ohci_soft_ed_t *sc_freeeds;
|
||||||
ohci_soft_td_t *sc_freetds;
|
ohci_soft_td_t *sc_freetds;
|
||||||
|
@ -1268,10 +1268,12 @@ uhci_softintr(void *v)
|
|||||||
LIST_FOREACH(ii, &sc->sc_intrhead, list)
|
LIST_FOREACH(ii, &sc->sc_intrhead, list)
|
||||||
uhci_check_intr(sc, ii);
|
uhci_check_intr(sc, ii);
|
||||||
|
|
||||||
|
#ifdef USB_USE_SOFTINTR
|
||||||
if (sc->sc_softwake) {
|
if (sc->sc_softwake) {
|
||||||
sc->sc_softwake = 0;
|
sc->sc_softwake = 0;
|
||||||
wakeup(&sc->sc_softwake);
|
wakeup(&sc->sc_softwake);
|
||||||
}
|
}
|
||||||
|
#endif /* USB_USE_SOFTINTR */
|
||||||
|
|
||||||
sc->sc_bus.intr_context--;
|
sc->sc_bus.intr_context--;
|
||||||
}
|
}
|
||||||
@ -1927,10 +1929,14 @@ uhci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
|
|||||||
*/
|
*/
|
||||||
usb_delay_ms(upipe->pipe.device->bus, 2); /* Hardware finishes in 1ms */
|
usb_delay_ms(upipe->pipe.device->bus, 2); /* Hardware finishes in 1ms */
|
||||||
s = splusb();
|
s = splusb();
|
||||||
|
#ifdef USB_USE_SOFTINTR
|
||||||
sc->sc_softwake = 1;
|
sc->sc_softwake = 1;
|
||||||
|
#endif /* USB_USE_SOFTINTR */
|
||||||
usb_schedsoftintr(&sc->sc_bus);
|
usb_schedsoftintr(&sc->sc_bus);
|
||||||
|
#ifdef USB_USE_SOFTINTR
|
||||||
DPRINTFN(1,("uhci_abort_xfer: tsleep\n"));
|
DPRINTFN(1,("uhci_abort_xfer: tsleep\n"));
|
||||||
tsleep(&sc->sc_softwake, PZERO, "uhciab", 0);
|
tsleep(&sc->sc_softwake, PZERO, "uhciab", 0);
|
||||||
|
#endif /* USB_USE_SOFTINTR */
|
||||||
splx(s);
|
splx(s);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -167,7 +167,10 @@ typedef struct uhci_softc {
|
|||||||
u_int8_t sc_saved_sof;
|
u_int8_t sc_saved_sof;
|
||||||
u_int16_t sc_saved_frnum;
|
u_int16_t sc_saved_frnum;
|
||||||
|
|
||||||
|
#ifdef USB_USE_SOFTINTR
|
||||||
char sc_softwake;
|
char sc_softwake;
|
||||||
|
#endif /* USB_USE_SOFTINTR */
|
||||||
|
|
||||||
char sc_isreset;
|
char sc_isreset;
|
||||||
char sc_suspend;
|
char sc_suspend;
|
||||||
char sc_dying;
|
char sc_dying;
|
||||||
|
@ -339,7 +339,10 @@ MALLOC_DECLARE(M_USBHC);
|
|||||||
|
|
||||||
#define USBVERBOSE
|
#define USBVERBOSE
|
||||||
|
|
||||||
|
/* We don't the soft interrupt code on FreeBSD.
|
||||||
|
#if 0
|
||||||
#define USB_USE_SOFTINTR
|
#define USB_USE_SOFTINTR
|
||||||
|
#endif
|
||||||
|
|
||||||
#define Static static
|
#define Static static
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user