summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2002-08-01 18:26:36 +0000
committerJason Wright <jason@cvs.openbsd.org>2002-08-01 18:26:36 +0000
commit4ff6683542ff75e7606e1e8fb5647aea921b0d60 (patch)
tree4a986e1e75731c02fc0766a4f72650decb55835b /sys/arch/sparc64
parent8e8f6bff4be30b660aaa84e51d775660ae6c2e08 (diff)
add support for mapping interrupts.
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r--sys/arch/sparc64/dev/schizo.c53
1 files changed, 51 insertions, 2 deletions
diff --git a/sys/arch/sparc64/dev/schizo.c b/sys/arch/sparc64/dev/schizo.c
index ba7c53c1b03..2819e098597 100644
--- a/sys/arch/sparc64/dev/schizo.c
+++ b/sys/arch/sparc64/dev/schizo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: schizo.c,v 1.6 2002/07/24 19:12:00 jason Exp $ */
+/* $OpenBSD: schizo.c,v 1.7 2002/08/01 18:26:35 jason Exp $ */
/*
* Copyright (c) 2002 Jason L. Wright (jason@thought.net)
@@ -557,7 +557,56 @@ _schizo_intr_establish(t, ihandle, level, flags, handler, arg)
int (*handler)(void *);
void *arg;
{
- return (NULL);
+ struct schizo_pbm *pbm = t->cookie;
+ struct schizo_softc *sc = pbm->sp_sc;
+ struct intrhand *ih = NULL;
+ volatile u_int64_t *intrmapptr = NULL, *intrclrptr = NULL;
+ int ino;
+ long vec = INTVEC(ihandle);
+
+ ih = (struct intrhand *)malloc(sizeof(struct intrhand), M_DEVBUF,
+ M_NOWAIT);
+ if (ih == NULL)
+ return (NULL);
+
+ vec = INTVEC(ihandle);
+ ino = INTINO(vec);
+
+ if (level == IPL_NONE)
+ level = INTLEV(vec);
+ if (level == IPL_NONE) {
+ printf(": no IPL, setting IPL 2.\n");
+ level = 2;
+ }
+
+ if ((flags & BUS_INTR_ESTABLISH_SOFTINTR) == 0) {
+ struct schizo_pbm_regs *pbmreg;
+
+ pbmreg = pbm->sp_bus_a ? &sc->sc_regs->pbm_a :
+ &sc->sc_regs->pbm_b;
+ intrmapptr = &pbmreg->imap[ino];
+ intrclrptr = &pbmreg->iclr[ino];
+ }
+
+ ih->ih_map = intrmapptr;
+ ih->ih_clr = intrclrptr;
+ ih->ih_fun = handler;
+ ih->ih_pil = level;
+ ih->ih_number = ino;
+
+ intr_establish(ih->ih_pil, ih);
+
+ if (intrmapptr != NULL) {
+ u_int64_t intrmap;
+
+ intrmap = *intrmapptr;
+ intrmap |= INTMAP_V;
+ *intrmapptr = intrmap;
+ intrmap = *intrmapptr;
+ ih->ih_number |= intrmap & INTMAP_INR;
+ }
+
+ return (ih);
}
const struct cfattach schizo_ca = {