Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Disable and disestablish interrupt in ppbdetach().



details:   https://anonhg.NetBSD.org/src/rev/4fa2075e1ace
branches:  trunk
changeset: 823503:4fa2075e1ace
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Apr 26 03:54:37 2017 +0000

description:
Disable and disestablish interrupt in ppbdetach().

diffstat:

 sys/dev/pci/ppb.c |  21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diffs (56 lines):

diff -r 5562fd623f84 -r 4fa2075e1ace sys/dev/pci/ppb.c
--- a/sys/dev/pci/ppb.c Wed Apr 26 03:29:36 2017 +0000
+++ b/sys/dev/pci/ppb.c Wed Apr 26 03:54:37 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ppb.c,v 1.58 2017/04/24 23:01:45 chs Exp $     */
+/*     $NetBSD: ppb.c,v 1.59 2017/04/26 03:54:37 msaitoh Exp $ */
 
 /*
  * Copyright (c) 1996, 1998 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.58 2017/04/24 23:01:45 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.59 2017/04/26 03:54:37 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -47,7 +47,8 @@
 
 #define        PCIE_SLCSR_NOTIFY_MASK                                  \
        (PCIE_SLCSR_ABE | PCIE_SLCSR_PFE | PCIE_SLCSR_MSE |     \
-        PCIE_SLCSR_PDE | PCIE_SLCSR_CCE | PCIE_SLCSR_HPE)
+        PCIE_SLCSR_PDE | PCIE_SLCSR_CCE | PCIE_SLCSR_HPE |     \
+        PCIE_SLCSR_DLLSCE)
 
 static const char pcie_linkspeed_strings[4][5] = {
        "1.25", "2.5", "5.0", "8.0",
@@ -349,6 +350,7 @@
 ppbdetach(device_t self, int flags)
 {
        struct ppb_softc *sc = device_private(self);
+       pcireg_t slcsr;
        int rc;
 
        if ((rc = config_detach_children(self, flags)) != 0)
@@ -363,6 +365,19 @@
        evcnt_detach(&sc->sc_ev_cc);
        evcnt_detach(&sc->sc_ev_lacs);
 
+       /* Clear any pending events and disable interrupt */
+       slcsr = pci_conf_read(sc->sc_pc, sc->sc_tag,
+             sc->sc_pciecapoff + PCIE_SLCSR);
+       slcsr &= ~PCIE_SLCSR_NOTIFY_MASK;
+       pci_conf_write(sc->sc_pc, sc->sc_tag,
+               sc->sc_pciecapoff + PCIE_SLCSR, slcsr);
+
+       /* Disestablish the interrupt handler */
+       if (sc->sc_intrhand != NULL) {
+               pci_intr_disestablish(sc->sc_pc, sc->sc_intrhand);
+               pci_intr_release(sc->sc_pc, sc->sc_pihp, 1);
+       }
+
        pmf_device_deregister(self);
        return 0;
 }



Home | Main Index | Thread Index | Old Index