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 add support for nvidia hdaudio controllers



details:   https://anonhg.NetBSD.org/src/rev/12a67b7a3bbe
branches:  trunk
changeset: 756908:12a67b7a3bbe
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Aug 07 16:59:48 2010 +0000

description:
add support for nvidia hdaudio controllers

diffstat:

 sys/dev/pci/hdaudio/hdaudio_pci.c |  17 +++++++++++++++--
 sys/dev/pci/hdaudio/hdaudio_pci.h |  38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 2 deletions(-)

diffs (87 lines):

diff -r cc05322fbcce -r 12a67b7a3bbe sys/dev/pci/hdaudio/hdaudio_pci.c
--- a/sys/dev/pci/hdaudio/hdaudio_pci.c Sat Aug 07 16:41:34 2010 +0000
+++ b/sys/dev/pci/hdaudio/hdaudio_pci.c Sat Aug 07 16:59:48 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio_pci.c,v 1.5 2010/02/24 22:38:08 dyoung Exp $ */
+/* $NetBSD: hdaudio_pci.c,v 1.6 2010/08/07 16:59:48 jmcneill 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.5 2010/02/24 22:38:08 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.6 2010/08/07 16:59:48 jmcneill Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -49,6 +49,7 @@
 
 #include <dev/pci/hdaudio/hdaudioreg.h>
 #include <dev/pci/hdaudio/hdaudiovar.h>
+#include <dev/pci/hdaudio/hdaudio_pci.h>
 
 struct hdaudio_pci_softc {
        struct hdaudio_softc    sc_hdaudio;     /* must be first */
@@ -153,6 +154,18 @@
        if (!pmf_device_register(self, NULL, hdaudio_pci_resume))
                aprint_error_dev(self, "couldn't establish power handler\n");
 
+       switch (PCI_VENDOR(pa->pa_id)) {
+       case PCI_VENDOR_NVIDIA:
+               /* enable snooping */
+               csr = pci_conf_read(sc->sc_pc, sc->sc_tag,
+                   HDAUDIO_NV_REG_SNOOP);
+               csr &= ~HDAUDIO_NV_SNOOP_MASK;
+               csr |= HDAUDIO_NV_SNOOP_ENABLE;
+               pci_conf_write(sc->sc_pc, sc->sc_tag,
+                   HDAUDIO_NV_REG_SNOOP, csr);
+               break;
+       }
+
        /* Attach bus-independent HD audio layer */
        hdaudio_attach(self, &sc->sc_hdaudio);
 }
diff -r cc05322fbcce -r 12a67b7a3bbe sys/dev/pci/hdaudio/hdaudio_pci.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/pci/hdaudio/hdaudio_pci.h Sat Aug 07 16:59:48 2010 +0000
@@ -0,0 +1,38 @@
+/* $NetBSD: hdaudio_pci.h,v 1.1 2010/08/07 16:59:48 jmcneill Exp $ */
+
+/*
+ * Copyright (c) 2010 Jared D. McNeill <jmcneill%invisible.ca@localhost>
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Precedence Technologies Ltd
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _HDAUDIO_PCI_H
+#define _HDAUDIO_PCI_H
+
+#define        HDAUDIO_NV_REG_SNOOP    0x4c
+#define          HDAUDIO_NV_SNOOP_MASK         0x00ff0000
+#define          HDAUDIO_NV_SNOOP_ENABLE       0x000f0000
+
+#endif /* !_HDAUDIO_PCI_H */



Home | Main Index | Thread Index | Old Index