* splsoftusb, IPL_SOFTUSB, and IPL_HARDUSB defines in usbdi.h
-> the current names are confusing (didn't change other drivers) * fix invalid memory access in usbd_transfer (kern/24636) -> needed for this driver * fix USB HC detach race condition (kern/32011) -> main patch needed for this driver, sc_dying changes in other drivers not necessary but seem right to me Patch from Matthew Orgass. http://mail-index.netbsd.org/tech-kern/2007/06/26/0001.html
This commit is contained in:
parent
44c89c7646
commit
2db72b9118
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ehci.c,v 1.123 2007/02/26 13:26:45 drochner Exp $ */
|
||||
/* $NetBSD: ehci.c,v 1.124 2007/08/15 04:00:33 kiyohara Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004,2005 The NetBSD Foundation, Inc.
|
||||
|
@ -61,7 +61,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.123 2007/02/26 13:26:45 drochner Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.124 2007/08/15 04:00:33 kiyohara Exp $");
|
||||
|
||||
#include "ohci.h"
|
||||
#include "uhci.h"
|
||||
|
@ -948,9 +948,9 @@ ehci_activate(device_ptr_t self, enum devact act)
|
|||
return (EOPNOTSUPP);
|
||||
|
||||
case DVACT_DEACTIVATE:
|
||||
sc->sc_dying = 1;
|
||||
if (sc->sc_child != NULL)
|
||||
rv = config_deactivate(sc->sc_child);
|
||||
sc->sc_dying = 1;
|
||||
break;
|
||||
}
|
||||
return (rv);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ohci.c,v 1.182 2007/02/26 13:26:46 drochner Exp $ */
|
||||
/* $NetBSD: ohci.c,v 1.183 2007/08/15 04:00:33 kiyohara Exp $ */
|
||||
/* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -48,7 +48,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.182 2007/02/26 13:26:46 drochner Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.183 2007/08/15 04:00:33 kiyohara Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -374,9 +374,9 @@ ohci_activate(device_ptr_t self, enum devact act)
|
|||
return (EOPNOTSUPP);
|
||||
|
||||
case DVACT_DEACTIVATE:
|
||||
sc->sc_dying = 1;
|
||||
if (sc->sc_child != NULL)
|
||||
rv = config_deactivate(sc->sc_child);
|
||||
sc->sc_dying = 1;
|
||||
break;
|
||||
}
|
||||
return (rv);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uhci.c,v 1.209 2007/08/01 22:40:16 jmcneill Exp $ */
|
||||
/* $NetBSD: uhci.c,v 1.210 2007/08/15 04:00:33 kiyohara Exp $ */
|
||||
/* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -49,7 +49,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.209 2007/08/01 22:40:16 jmcneill Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.210 2007/08/15 04:00:33 kiyohara Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -573,6 +573,7 @@ uhci_activate(device_ptr_t self, enum devact act)
|
|||
return (EOPNOTSUPP);
|
||||
|
||||
case DVACT_DEACTIVATE:
|
||||
sc->sc_dying = 1;
|
||||
if (sc->sc_child != NULL)
|
||||
rv = config_deactivate(sc->sc_child);
|
||||
break;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: usb.c,v 1.98 2007/07/14 21:02:39 ad Exp $ */
|
||||
/* $NetBSD: usb.c,v 1.99 2007/08/15 04:00:34 kiyohara Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
|
||||
|
@ -44,7 +44,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.98 2007/07/14 21:02:39 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.99 2007/08/15 04:00:34 kiyohara Exp $");
|
||||
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
||||
|
@ -206,7 +206,7 @@ USB_ATTACH(usb)
|
|||
|
||||
#ifdef USB_USE_SOFTINTR
|
||||
/* XXX we should have our own level */
|
||||
sc->sc_bus->soft = softintr_establish(IPL_SOFTNET,
|
||||
sc->sc_bus->soft = softintr_establish(IPL_SOFTUSB,
|
||||
sc->sc_bus->methods->soft_intr, sc->sc_bus);
|
||||
if (sc->sc_bus->soft == NULL) {
|
||||
printf("%s: can't register softintr\n", USBDEVNAME(sc->sc_dev));
|
||||
|
@ -912,21 +912,17 @@ usb_detach(device_ptr_t self, int flags)
|
|||
|
||||
DPRINTF(("usb_detach: start\n"));
|
||||
|
||||
sc->sc_dying = 1;
|
||||
/* Kill off event thread. */
|
||||
while (sc->sc_event_thread != NULL) {
|
||||
wakeup(&sc->sc_bus->needs_explore);
|
||||
tsleep(sc, PWAIT, "usbdet", hz * 60);
|
||||
}
|
||||
DPRINTF(("usb_detach: event thread dead\n"));
|
||||
|
||||
/* Make all devices disconnect. */
|
||||
if (sc->sc_port.device != NULL)
|
||||
usb_disconnect_port(&sc->sc_port, self);
|
||||
|
||||
/* Kill off event thread. */
|
||||
if (sc->sc_event_thread != NULL) {
|
||||
wakeup(&sc->sc_bus->needs_explore);
|
||||
if (tsleep(sc, PWAIT, "usbdet", hz * 60))
|
||||
printf("%s: event thread didn't die\n",
|
||||
USBDEVNAME(sc->sc_dev));
|
||||
DPRINTF(("usb_detach: event thread dead\n"));
|
||||
}
|
||||
|
||||
#ifdef USB_USE_SOFTINTR
|
||||
if (sc->sc_bus->soft != NULL) {
|
||||
softintr_disestablish(sc->sc_bus->soft);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: usbdi.c,v 1.119 2007/02/26 13:44:40 drochner Exp $ */
|
||||
/* $NetBSD: usbdi.c,v 1.120 2007/08/15 04:00:34 kiyohara Exp $ */
|
||||
/* $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -39,7 +39,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.119 2007/02/26 13:44:40 drochner Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.120 2007/08/15 04:00:34 kiyohara Exp $");
|
||||
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
||||
|
@ -271,10 +271,10 @@ usbd_transfer(usbd_xfer_handle xfer)
|
|||
usbd_pipe_handle pipe = xfer->pipe;
|
||||
usb_dma_t *dmap = &xfer->dmabuf;
|
||||
usbd_status err;
|
||||
u_int size;
|
||||
unsigned int size, flags;
|
||||
int s;
|
||||
|
||||
DPRINTFN(5,("usbd_transfer: xfer=%p, flags=%d, pipe=%p, running=%d\n",
|
||||
DPRINTFN(5,("usbd_transfer: xfer=%p, flags=%#x, pipe=%p, running=%d\n",
|
||||
xfer, xfer->flags, pipe, pipe->running));
|
||||
#ifdef USB_DEBUG
|
||||
if (usbdebug > 5)
|
||||
|
@ -300,11 +300,13 @@ usbd_transfer(usbd_xfer_handle xfer)
|
|||
xfer->rqflags |= URQ_AUTO_DMABUF;
|
||||
}
|
||||
|
||||
flags = xfer->flags;
|
||||
|
||||
/* Copy data if going out. */
|
||||
if (!(xfer->flags & USBD_NO_COPY) && size != 0 &&
|
||||
!usbd_xfer_isread(xfer))
|
||||
if (!(flags & USBD_NO_COPY) && size != 0 && !usbd_xfer_isread(xfer))
|
||||
memcpy(KERNADDR(dmap, 0), xfer->buffer, size);
|
||||
|
||||
/* xfer is not valid after the transfer method unless synchronous */
|
||||
err = pipe->methods->transfer(xfer);
|
||||
|
||||
if (err != USBD_IN_PROGRESS && err) {
|
||||
|
@ -317,7 +319,7 @@ usbd_transfer(usbd_xfer_handle xfer)
|
|||
}
|
||||
}
|
||||
|
||||
if (!(xfer->flags & USBD_SYNCHRONOUS))
|
||||
if (!(flags & USBD_SYNCHRONOUS))
|
||||
return (err);
|
||||
|
||||
/* Sync transfer, wait for completion. */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: usbdi.h,v 1.74 2007/03/13 15:00:07 drochner Exp $ */
|
||||
/* $NetBSD: usbdi.h,v 1.75 2007/08/15 04:00:34 kiyohara Exp $ */
|
||||
/* $FreeBSD: src/sys/dev/usb/usbdi.h,v 1.18 1999/11/17 22:33:49 n_hibma Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -282,5 +282,9 @@ struct usbif_attach_arg {
|
|||
#define splusb splsoftnet
|
||||
#define splhardusb splbio
|
||||
#define IPL_USB IPL_BIO
|
||||
#define splsoftusb splusb
|
||||
#define IPL_SOFTUSB IPL_SOFTNET
|
||||
#define IPL_HARDUSB IPL_USB
|
||||
|
||||
|
||||
#endif /* _USBDI_H_ */
|
||||
|
|
Loading…
Reference in New Issue