Module Name: src Committed By: dyoung Date: Fri Apr 17 17:21:31 UTC 2009
Modified Files: src/sys/dev/pci: ehci_pci.c uhci_pci.c Log Message: Disable interrupts on the h/w before detaching the interrupt handler. Protects against the problem described in <http://mail-index.netbsd.org/port-i386/2009/04/10/msg001317.html>, Xintr_ioapic_levelN jumps to 0 during shutdown. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/dev/pci/ehci_pci.c cvs rdiff -u -r1.45 -r1.46 src/sys/dev/pci/uhci_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/ehci_pci.c diff -u src/sys/dev/pci/ehci_pci.c:1.39 src/sys/dev/pci/ehci_pci.c:1.40 --- src/sys/dev/pci/ehci_pci.c:1.39 Tue Apr 7 18:25:26 2009 +++ src/sys/dev/pci/ehci_pci.c Fri Apr 17 17:21:31 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: ehci_pci.c,v 1.39 2009/04/07 18:25:26 dyoung Exp $ */ +/* $NetBSD: ehci_pci.c,v 1.40 2009/04/17 17:21:31 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.39 2009/04/07 18:25:26 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.40 2009/04/17 17:21:31 dyoung Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -230,6 +230,12 @@ rv = ehci_detach(&sc->sc, flags); if (rv) return (rv); + + /* disable interrupts */ + EOWRITE2(&sc->sc, EHCI_USBINTR, 0); + /* XXX grotty hack to flush the write */ + EOREAD2(&sc->sc, EHCI_USBINTR); + if (sc->sc_ih != NULL) { pci_intr_disestablish(sc->sc_pc, sc->sc_ih); sc->sc_ih = NULL; Index: src/sys/dev/pci/uhci_pci.c diff -u src/sys/dev/pci/uhci_pci.c:1.45 src/sys/dev/pci/uhci_pci.c:1.46 --- src/sys/dev/pci/uhci_pci.c:1.45 Tue Apr 7 18:25:26 2009 +++ src/sys/dev/pci/uhci_pci.c Fri Apr 17 17:21:31 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: uhci_pci.c,v 1.45 2009/04/07 18:25:26 dyoung Exp $ */ +/* $NetBSD: uhci_pci.c,v 1.46 2009/04/17 17:21:31 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.45 2009/04/07 18:25:26 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uhci_pci.c,v 1.46 2009/04/17 17:21:31 dyoung Exp $"); #include "ehci.h" @@ -208,6 +208,12 @@ rv = uhci_detach(&sc->sc, flags); if (rv) return (rv); + + /* 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, + bus_space_read_2(sc->sc.iot, sc->sc.ioh, UHCI_STS)); + if (sc->sc_ih != NULL) { pci_intr_disestablish(sc->sc_pc, sc->sc_ih); sc->sc_ih = NULL;