Deregister PMF handlers during detachment. Complete the host controller

shutdown.
This commit is contained in:
dyoung 2011-04-04 22:48:15 +00:00
parent 444d8f7fa7
commit 2e65254f9b
3 changed files with 15 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ehci_pci.c,v 1.51 2011/04/04 20:37:56 dyoung Exp $ */
/* $NetBSD: ehci_pci.c,v 1.52 2011/04/04 22:48:15 dyoung Exp $ */
/*
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.51 2011/04/04 20:37:56 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.52 2011/04/04 22:48:15 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -282,11 +282,13 @@ ehci_pci_detach(device_t self, int flags)
struct ehci_pci_softc *sc = device_private(self);
int rv;
pmf_device_deregister(self);
rv = ehci_detach(&sc->sc, flags);
if (rv)
return rv;
pmf_device_deregister(self);
ehci_shutdown(self, flags);
/* disable interrupts */
EOWRITE2(&sc->sc, EHCI_USBINTR, 0);
/* XXX grotty hack to flush the write */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ohci_pci.c,v 1.46 2010/05/25 08:37:10 pgoyette Exp $ */
/* $NetBSD: ohci_pci.c,v 1.47 2011/04/04 22:48:15 dyoung Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ohci_pci.c,v 1.46 2010/05/25 08:37:10 pgoyette Exp $");
__KERNEL_RCSID(0, "$NetBSD: ohci_pci.c,v 1.47 2011/04/04 22:48:15 dyoung Exp $");
#include "ehci.h"
@ -186,11 +186,14 @@ ohci_pci_detach(device_t self, int flags)
struct ohci_pci_softc *sc = device_private(self);
int rv;
pmf_device_deregister(self);
rv = ohci_detach(&sc->sc, flags);
if (rv)
return rv;
pmf_device_deregister(self);
ohci_shutdown(self, flags);
if (sc->sc.sc_size) {
/* Disable interrupts, so we don't get any spurious ones. */
bus_space_write_4(sc->sc.iot, sc->sc.ioh,

View File

@ -1,4 +1,4 @@
/* $NetBSD: uhci_pci.c,v 1.52 2010/05/25 08:50:54 cegger Exp $ */
/* $NetBSD: uhci_pci.c,v 1.53 2011/04/04 22:48:15 dyoung Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uhci_pci.c,v 1.52 2010/05/25 08:50:54 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: uhci_pci.c,v 1.53 2011/04/04 22:48:15 dyoung Exp $");
#include "ehci.h"
@ -203,12 +203,12 @@ uhci_pci_detach(device_t self, int flags)
struct uhci_pci_softc *sc = device_private(self);
int rv;
pmf_device_deregister(self);
rv = uhci_detach(&sc->sc, flags);
if (rv)
return (rv);
pmf_device_deregister(self);
/* disable interrupts and acknowledge any pending */
bus_space_write_2(sc->sc.iot, sc->sc.ioh, UHCI_INTR, 0);
bus_space_write_2(sc->sc.iot, sc->sc.ioh, UHCI_STS,