Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci/hdaudio disestalish interrupt and unmap register...



details:   https://anonhg.NetBSD.org/src/rev/e9670cd109f4
branches:  trunk
changeset: 333298:e9670cd109f4
user:      nonaka <nonaka%NetBSD.org@localhost>
date:      Tue Oct 28 02:49:52 2014 +0000

description:
disestalish interrupt and unmap register when attach failed.

diffstat:

 sys/dev/pci/hdaudio/hdaudio_pci.c |  16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r fbfbacf51f55 -r e9670cd109f4 sys/dev/pci/hdaudio/hdaudio_pci.c
--- a/sys/dev/pci/hdaudio/hdaudio_pci.c Mon Oct 27 21:46:45 2014 +0000
+++ b/sys/dev/pci/hdaudio/hdaudio_pci.c Tue Oct 28 02:49:52 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio_pci.c,v 1.12 2014/03/29 19:28:25 christos Exp $ */
+/* $NetBSD: hdaudio_pci.c,v 1.13 2014/10/28 02:49:52 nonaka Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd <support%precedence.co.uk@localhost>
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.12 2014/03/29 19:28:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.13 2014/10/28 02:49:52 nonaka Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -162,7 +162,17 @@
        hdaudio_pci_reinit(sc);
 
        /* Attach bus-independent HD audio layer */
-       hdaudio_attach(self, &sc->sc_hdaudio);
+       if (hdaudio_attach(self, &sc->sc_hdaudio)) {
+               pci_intr_disestablish(sc->sc_pc, sc->sc_ih);
+               sc->sc_ih = NULL;
+               bus_space_unmap(sc->sc_hdaudio.sc_memt,
+                               sc->sc_hdaudio.sc_memh,
+                               sc->sc_hdaudio.sc_memsize);
+               sc->sc_hdaudio.sc_memvalid = false;
+               csr = pci_conf_read(sc->sc_pc, sc->sc_tag, PCI_COMMAND_STATUS_REG);
+               csr &= ~(PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_BACKTOBACK_ENABLE);
+               pci_conf_write(sc->sc_pc, sc->sc_tag, PCI_COMMAND_STATUS_REG, csr);
+       }
 }
 
 static int



Home | Main Index | Thread Index | Old Index