Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64 config and attachment goop for tadpmu



details:   https://anonhg.NetBSD.org/src/rev/d79e0a75e718
branches:  trunk
changeset: 993981:d79e0a75e718
user:      macallan <macallan%NetBSD.org@localhost>
date:      Sat Oct 13 20:11:48 2018 +0000

description:
config and attachment goop for tadpmu

diffstat:

 sys/arch/sparc64/conf/files.sparc64 |   6 +++-
 sys/arch/sparc64/dev/pckbc_ebus.c   |  48 +++++++++++++++++++++++++++++++++---
 sys/arch/sparc64/dev/tadpmu.c       |   6 +++-
 3 files changed, 51 insertions(+), 9 deletions(-)

diffs (132 lines):

diff -r 2db1c96d83fc -r d79e0a75e718 sys/arch/sparc64/conf/files.sparc64
--- a/sys/arch/sparc64/conf/files.sparc64       Sat Oct 13 19:53:43 2018 +0000
+++ b/sys/arch/sparc64/conf/files.sparc64       Sat Oct 13 20:11:48 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.sparc64,v 1.154 2017/12/19 14:34:08 nakayama Exp $
+#      $NetBSD: files.sparc64,v 1.155 2018/10/13 20:11:48 macallan Exp $
 
 # @(#)files.sparc64    8.1 (Berkeley) 7/19/93
 # sparc64-specific configuration info
@@ -164,8 +164,10 @@
 
 # ebus PS/2 keyboard attachment for Tadpole SPARCle, etc.
 include "dev/pckbport/files.pckbport"
-attach pckbc at ebus with pckbc_ebus
+attach pckbc at ebus with pckbc_ebus : sysmon_envsys
 file   arch/sparc64/dev/pckbc_ebus.c           pckbc_ebus
+defflag opt_tadpmu.h   HAVE_TADPMU
+file   arch/sparc64/dev/tadpmu.c               pckbc_ebus
 
 device zstty {}: tty
 attach zstty at zs
diff -r 2db1c96d83fc -r d79e0a75e718 sys/arch/sparc64/dev/pckbc_ebus.c
--- a/sys/arch/sparc64/dev/pckbc_ebus.c Sat Oct 13 19:53:43 2018 +0000
+++ b/sys/arch/sparc64/dev/pckbc_ebus.c Sat Oct 13 20:11:48 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pckbc_ebus.c,v 1.2 2015/08/14 10:59:27 nakayama Exp $ */
+/*     $NetBSD: pckbc_ebus.c,v 1.3 2018/10/13 20:11:48 macallan Exp $ */
 
 /*
  * Copyright (c) 2002 Valeriy E. Ushakov
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pckbc_ebus.c,v 1.2 2015/08/14 10:59:27 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pckbc_ebus.c,v 1.3 2018/10/13 20:11:48 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -47,9 +47,13 @@
 #include <dev/ebus/ebusreg.h>
 #include <dev/ebus/ebusvar.h>
 
+#include "opt_tadpmu.h"
+#include <sparc64/dev/tadpmureg.h>
+#include <sparc64/dev/tadpmuvar.h>
+
 struct pckbc_ebus_softc {
        struct pckbc_softc psc_pckbc;   /* real "pckbc" softc */
-       uint32_t psc_intr[PCKBC_NSLOTS];
+       uint32_t psc_intr[5];   /* Tadpole Viper's pckbc has 3 slots */
 };
 
 static int     pckbc_ebus_match(device_t, cfdata_t, void *);
@@ -118,7 +122,7 @@
                        return;
                }
        } else {
-               for (i = 0; i < PCKBC_NSLOTS; i++)
+               for (i = 0; i < ea->ea_nintr; i++)
                        sc->psc_intr[i] = ea->ea_intr[i];
        }
 
@@ -182,9 +186,43 @@
        /* finish off the attach */
        aprint_normal("\n");
        pckbc_attach(psc);
+#ifdef HAVE_TADPMU
+       /* now look for a tadpmu child device */
+       char name[64], *p;
+       int pmu = 0;
+       for (node = prom_firstchild(ea->ea_node);
+            node != 0; node = prom_nextsibling(node)) {
+               if((p = prom_getpropstringA(node, "name", name, 64)) != NULL) {
+                       if (strcmp(name, "tadpmu") == 0) {
+                               pmu = node;
+                               break;
+                       }
+               }
+       }
+       if (pmu != 0) {
+               void *irq;
+
+               bus_space_handle_t hcmd, hdata;
+               if (bus_space_map(iot, ioaddr + TADPMU_CMD,  1, 0, &hcmd) != 0) {
+                       bus_space_unmap(iot, hcmd, 1);
+                       aprint_error(": unable to map PMU cmd register\n");
+                       return;
+               }
+               if (bus_space_map(iot, ioaddr + TADPMU_DATA,  1, 0, &hdata) != 0) {
+                       bus_space_unmap(iot, hdata, 1);
+                       aprint_error(": unable to map PMU data register\n");
+                       return;
+               }
+               tadpmu_init(iot, hcmd, hdata);
+               irq = bus_intr_establish(iot, sc->psc_intr[2], IPL_TTY,
+                                        tadpmu_intr, sc);
+               if (irq == NULL) {
+                       aprint_error("failed to establish tadpmu interrupt\n");
+               }
+       }
+#endif
 }
 
-
 static void
 pckbc_ebus_intr_establish(struct pckbc_softc *sc, pckbport_slot_t slot)
 {
diff -r 2db1c96d83fc -r d79e0a75e718 sys/arch/sparc64/dev/tadpmu.c
--- a/sys/arch/sparc64/dev/tadpmu.c     Sat Oct 13 19:53:43 2018 +0000
+++ b/sys/arch/sparc64/dev/tadpmu.c     Sat Oct 13 20:11:48 2018 +0000
@@ -1,4 +1,4 @@
-/*/* $NetBSD: tadpmu.c,v 1.2 2018/10/13 19:53:43 macallan Exp $ */
+/*/* $NetBSD: tadpmu.c,v 1.3 2018/10/13 20:11:48 macallan Exp $ */
 
 /*-
  * Copyright (c) 2018 Michael Lorenz <macallan%netbsd.org@localhost>
@@ -28,6 +28,8 @@
 
 /* a driver for the PMU found in Tadpole Wiper and possibly SPARCle laptops */
 
+#include "opt_tadpmu.h"
+#ifdef HAVE_TADPMU
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -315,4 +317,4 @@
 
        return 0;
 }
-
+#endif /* HAVE_TADPMU */



Home | Main Index | Thread Index | Old Index