Module Name:    src
Committed By:   macallan
Date:           Wed Nov 16 22:05:19 UTC 2016

Modified Files:
        src/sys/dev/pci: voyager.c

Log Message:
add more plumbing to pass a clockframe around so pwmclock can work again

Hi nick!


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/voyager.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/voyager.c
diff -u src/sys/dev/pci/voyager.c:1.11 src/sys/dev/pci/voyager.c:1.12
--- src/sys/dev/pci/voyager.c:1.11	Fri Jan  1 20:48:15 2016
+++ src/sys/dev/pci/voyager.c	Wed Nov 16 22:05:19 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyager.c,v 1.11 2016/01/01 20:48:15 macallan Exp $	*/
+/*	$NetBSD: voyager.c,v 1.12 2016/11/16 22:05:19 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -26,7 +26,7 @@
  */
  
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: voyager.c,v 1.11 2016/01/01 20:48:15 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: voyager.c,v 1.12 2016/11/16 22:05:19 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -88,6 +88,8 @@ struct voyager_softc {
 	struct voyager_intr sc_intrs[32];
 };
 
+void *voyager_cookie = NULL;
+
 static int	voyager_match(device_t, cfdata_t, void *);
 static void	voyager_attach(device_t, device_t, void *);
 static int	voyager_print(void *, const char *);
@@ -162,6 +164,8 @@ voyager_attach(device_t parent, device_t
 	sc->sc_iot = pa->pa_iot;
 	sc->sc_dev = self;
 
+	voyager_cookie = sc;
+
 	pci_aprint_devinfo(pa, NULL);
 
 	if (pci_mapreg_map(pa, 0x14, PCI_MAPREG_TYPE_MEM, 0,
@@ -195,7 +199,8 @@ voyager_attach(device_t parent, device_t
 	}
 
 	intrstr = pci_intr_string(sc->sc_pc, ih, intrbuf, sizeof(intrbuf));
-	sc->sc_ih = pci_intr_establish(sc->sc_pc, ih, IPL_AUDIO, voyager_intr, sc);
+	sc->sc_ih = pci_intr_establish(sc->sc_pc, ih, IPL_VM,
+	    voyager_intr, NULL); /* so we get the clock frame instead */
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "couldn't establish interrupt");
 		if (intrstr != NULL)
@@ -389,7 +394,7 @@ voyager_twiddle_bits(void *cookie, int r
 static int
 voyager_intr(void *cookie)
 {
-	struct voyager_softc *sc = cookie;
+	struct voyager_softc *sc = voyager_cookie;
 	struct voyager_intr *ih;
 	uint32_t intrs;
 	uint32_t mask, bit;
@@ -405,7 +410,11 @@ voyager_intr(void *cookie)
 		intrs &= ~bit;
 		ih = &sc->sc_intrs[num];
 		if (ih->vih_func != NULL) {
-			ih->vih_func(ih->vih_arg);
+			if (ih->vih_arg == NULL) {
+				ih->vih_func(cookie);
+			} else {
+				ih->vih_func(ih->vih_arg);
+			}
 		}
 		ih->vih_count.ev_count++;
 	}

Reply via email to