From ac1bdba169fd42a2a5a79ada6f9f2c6fe4decd94 Mon Sep 17 00:00:00 2001
From: Mark Kettenis <kettenis@cvs.openbsd.org>
Date: Sat, 12 Jul 2008 12:21:05 +0000
Subject: Use the proper interrupt target ID on Oberon.

---
 sys/arch/sparc64/dev/pyro.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

(limited to 'sys/arch/sparc64/dev')

diff --git a/sys/arch/sparc64/dev/pyro.c b/sys/arch/sparc64/dev/pyro.c
index 146164c5abe..dad704e0491 100644
--- a/sys/arch/sparc64/dev/pyro.c
+++ b/sys/arch/sparc64/dev/pyro.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: pyro.c,v 1.12 2008/05/24 14:54:03 kettenis Exp $	*/
+/*	$OpenBSD: pyro.c,v 1.13 2008/07/12 12:21:04 kettenis Exp $	*/
 
 /*
  * Copyright (c) 2002 Jason L. Wright (jason@thought.net)
@@ -56,6 +56,17 @@ int pyro_debug = ~0;
 #define DPRINTF(l, s)
 #endif
 
+#define FIRE_INTRMAP_INT_CNTRL_NUM_MASK	0x000003c0
+#define FIRE_INTRMAP_INT_CNTRL_NUM0	0x00000040
+#define FIRE_INTRMAP_INT_CNTRL_NUM1	0x00000080
+#define FIRE_INTRMAP_INT_CNTRL_NUM2	0x00000100
+#define FIRE_INTRMAP_INT_CNTRL_NUM3	0x00000200
+#define FIRE_INTRMAP_T_JPID_SHIFT	26
+#define FIRE_INTRMAP_T_JPID_MASK	0x7c000000
+
+#define OBERON_INTRMAP_T_DESTID_SHIFT	21
+#define OBERON_INTRMAP_T_DESTID_MASK	0x7fe00000
+
 extern struct sparc_pci_chipset _sparc_pci_chipset;
 
 int pyro_match(struct device *, void *, void *);
@@ -505,7 +516,16 @@ _pyro_intr_establish(bus_space_tag_t t, bus_space_tag_t t0, int ihandle,
 		u_int64_t intrmap;
 
 		intrmap = *intrmapptr;
-		intrmap |= (1LL << 6);
+		intrmap &= ~FIRE_INTRMAP_INT_CNTRL_NUM_MASK;
+		intrmap |= FIRE_INTRMAP_INT_CNTRL_NUM0;
+		if (sc->sc_oberon) {
+			intrmap &= ~OBERON_INTRMAP_T_DESTID_MASK;
+			intrmap |= CPU_JUPITERID <<
+			    OBERON_INTRMAP_T_DESTID_SHIFT;
+		} else {
+			intrmap &= ~FIRE_INTRMAP_T_JPID_MASK;
+			intrmap |= CPU_UPAID << FIRE_INTRMAP_T_JPID_SHIFT;
+		}
 		intrmap |= INTMAP_V;
 		*intrmapptr = intrmap;
 		intrmap = *intrmapptr;
-- 
cgit v1.2.3