summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2009-10-26 18:11:28 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2009-10-26 18:11:28 +0000
commitc59ae6a58debfeb7c691946f04c9439b2212a8da (patch)
tree3a68489d4b81016cf45b7b2eda28b3d4b920c998 /sys/arch
parente31bfa5cb2aa3a4e92018f8e49d51ce3118473b2 (diff)
Add new xbow routines to explicitely trigger or clear an interrupt source,
instead of embedding that knowledge in xbridge(4); will be used elsewhere shortly.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/sgi/sgi/ip27_machdep.c18
-rw-r--r--sys/arch/sgi/xbow/xbow.c25
-rw-r--r--sys/arch/sgi/xbow/xbow.h7
-rw-r--r--sys/arch/sgi/xbow/xbridge.c27
-rw-r--r--sys/arch/sgi/xbow/xheart.c20
5 files changed, 69 insertions, 28 deletions
diff --git a/sys/arch/sgi/sgi/ip27_machdep.c b/sys/arch/sgi/sgi/ip27_machdep.c
index 5a93e655a4a..cc3dae388f5 100644
--- a/sys/arch/sgi/sgi/ip27_machdep.c
+++ b/sys/arch/sgi/sgi/ip27_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip27_machdep.c,v 1.29 2009/10/23 21:19:17 miod Exp $ */
+/* $OpenBSD: ip27_machdep.c,v 1.30 2009/10/26 18:11:25 miod Exp $ */
/*
* Copyright (c) 2008, 2009 Miodrag Vallat.
@@ -70,6 +70,8 @@ int ip27_hub_intr_register(int, int, int *);
int ip27_hub_intr_establish(int (*)(void *), void *, int, int,
const char *);
void ip27_hub_intr_disestablish(int);
+void ip27_hub_intr_clear(int);
+void ip27_hub_intr_set(int);
uint32_t hubpi_intr0(uint32_t, struct trap_frame *);
uint32_t hubpi_intr1(uint32_t, struct trap_frame *);
void ip27_hub_intr_makemasks(void);
@@ -253,6 +255,8 @@ ip27_setup()
xbow_intr_widget_intr_register = ip27_hub_intr_register;
xbow_intr_widget_intr_establish = ip27_hub_intr_establish;
xbow_intr_widget_intr_disestablish = ip27_hub_intr_disestablish;
+ xbow_intr_widget_intr_clear = ip27_hub_intr_clear;
+ xbow_intr_widget_intr_set = ip27_hub_intr_set;
set_intr(INTPRI_XBOW_HW1, CR_INT_1, hubpi_intr1);
set_intr(INTPRI_XBOW_HW0, CR_INT_0, hubpi_intr0);
@@ -706,6 +710,18 @@ ip27_hub_intr_disestablish(int intrbit)
free(ih, M_DEVBUF);
}
+void
+ip27_hub_intr_clear(int intrbit)
+{
+ IP27_RHUB_PI_S(masternasid, 0, HUBPI_IR_CHANGE, PI_IR_CLR | intrbit);
+}
+
+void
+ip27_hub_intr_set(int intrbit)
+{
+ IP27_RHUB_PI_S(masternasid, 0, HUBPI_IR_CHANGE, PI_IR_SET | intrbit);
+}
+
/*
* Recompute interrupt masks.
*/
diff --git a/sys/arch/sgi/xbow/xbow.c b/sys/arch/sgi/xbow/xbow.c
index 6d98973722a..566c99bda9d 100644
--- a/sys/arch/sgi/xbow/xbow.c
+++ b/sys/arch/sgi/xbow/xbow.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xbow.c,v 1.20 2009/10/08 19:14:23 miod Exp $ */
+/* $OpenBSD: xbow.c,v 1.21 2009/10/26 18:11:27 miod Exp $ */
/*
* Copyright (c) 2008, 2009 Miodrag Vallat.
@@ -654,6 +654,9 @@ xbow_space_vaddr(bus_space_tag_t t, bus_space_handle_t h)
*
* Interrupt handling should be done at the Heart/Hub driver level, we only
* act as a proxy here.
+ *
+ * Note that, for the time being, interrupt handling is implicitly done at
+ * the master nasid; other nodes do not handle interrupts.
*/
int xbow_intr_widget = 0;
@@ -662,6 +665,8 @@ int (*xbow_intr_widget_intr_register)(int, int, int *) = NULL;
int (*xbow_intr_widget_intr_establish)(int (*)(void *), void *, int, int,
const char *) = NULL;
void (*xbow_intr_widget_intr_disestablish)(int) = NULL;
+void (*xbow_intr_widget_intr_set)(int) = NULL;
+void (*xbow_intr_widget_intr_clear)(int) = NULL;
int
xbow_intr_register(int widget, int level, int *intrbit)
@@ -692,6 +697,24 @@ xbow_intr_disestablish(int intrbit)
(*xbow_intr_widget_intr_disestablish)(intrbit);
}
+void
+xbow_intr_clear(int intrbit)
+{
+ if (xbow_intr_widget_intr_clear == NULL)
+ return;
+
+ (*xbow_intr_widget_intr_clear)(intrbit);
+}
+
+void
+xbow_intr_set(int intrbit)
+{
+ if (xbow_intr_widget_intr_set == NULL)
+ return;
+
+ (*xbow_intr_widget_intr_set)(intrbit);
+}
+
/*
* Widget mapping code.
*/
diff --git a/sys/arch/sgi/xbow/xbow.h b/sys/arch/sgi/xbow/xbow.h
index 875028b2a64..146dcec5fed 100644
--- a/sys/arch/sgi/xbow/xbow.h
+++ b/sys/arch/sgi/xbow/xbow.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: xbow.h,v 1.7 2009/08/18 19:31:59 miod Exp $ */
+/* $OpenBSD: xbow.h,v 1.8 2009/10/26 18:11:27 miod Exp $ */
/*
* Copyright (c) 2008 Miodrag Vallat.
@@ -53,6 +53,9 @@ extern int (*xbow_intr_widget_intr_establish)(int (*)(void *), void *,
int, int, const char *);
extern void (*xbow_intr_widget_intr_disestablish)(int);
+extern void (*xbow_intr_widget_intr_set)(int);
+extern void (*xbow_intr_widget_intr_clear)(int);
+
/*
* Common Widget Registers. Every widget provides them.
*
@@ -127,6 +130,8 @@ void xbow_build_bus_space(struct mips_bus_space *, int, int);
int xbow_intr_register(int, int, int *);
int xbow_intr_establish(int (*)(void *), void *, int, int, const char *);
void xbow_intr_disestablish(int);
+void xbow_intr_clear(int);
+void xbow_intr_set(int);
paddr_t xbow_widget_map_space(struct device *, u_int,
bus_addr_t *, bus_size_t *);
diff --git a/sys/arch/sgi/xbow/xbridge.c b/sys/arch/sgi/xbow/xbridge.c
index e454d79926b..6f2600cce69 100644
--- a/sys/arch/sgi/xbow/xbridge.c
+++ b/sys/arch/sgi/xbow/xbridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xbridge.c,v 1.55 2009/10/22 22:08:54 miod Exp $ */
+/* $OpenBSD: xbridge.c,v 1.56 2009/10/26 18:11:27 miod Exp $ */
/*
* Copyright (c) 2008, 2009 Miodrag Vallat.
@@ -54,7 +54,6 @@
#include <dev/cardbus/rbus.h>
#include <mips64/archtype.h>
-#include <sgi/xbow/hub.h>
#include <sgi/xbow/xbow.h>
#include <sgi/xbow/xbowdevs.h>
@@ -62,7 +61,6 @@
#ifdef TGT_OCTANE
#include <sgi/sgi/ip30.h>
-#include <sgi/xbow/xheartreg.h>
#endif
#include "cardbus.h"
@@ -1105,27 +1103,8 @@ xbridge_intr_handler(void *v)
if (ISSET(xb->xb_flags, XF_XBRIDGE))
xbridge_write_reg(xb, BRIDGE_INT_FORCE_PIN(xi->xi_intrbit), 1);
else {
- if (xbridge_read_reg(xb, BRIDGE_ISR) & (1 << xi->xi_intrbit)) {
- switch (sys_config.system_type) {
-#if defined(TGT_OCTANE)
- case SGI_OCTANE:
- {
- paddr_t heart;
- heart = PHYS_TO_XKPHYS(HEART_PIU_BASE, CCA_NC);
- *(volatile uint64_t *)(heart + HEART_ISR_SET) =
- xi->xi_intrsrc;
- }
- break;
-#endif
-#if defined(TGT_ORIGIN200) || defined(TGT_ORIGIN2000)
- case SGI_O200:
- case SGI_O300:
- IP27_RHUB_PI_S(xb->xb_nasid, 0, HUBPI_IR_CHANGE,
- PI_IR_SET | xi->xi_intrsrc);
- break;
-#endif
- }
- }
+ if (xbridge_read_reg(xb, BRIDGE_ISR) & (1 << xi->xi_intrbit))
+ xbow_intr_set(xi->xi_intrsrc);
}
return 1;
diff --git a/sys/arch/sgi/xbow/xheart.c b/sys/arch/sgi/xbow/xheart.c
index ed51dfd4b1e..abdff45dc6f 100644
--- a/sys/arch/sgi/xbow/xheart.c
+++ b/sys/arch/sgi/xbow/xheart.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xheart.c,v 1.13 2009/10/22 22:08:54 miod Exp $ */
+/* $OpenBSD: xheart.c,v 1.14 2009/10/26 18:11:27 miod Exp $ */
/*
* Copyright (c) 2008 Miodrag Vallat.
@@ -66,6 +66,8 @@ int xheart_ow_pulse(struct xheart_softc *, int, int);
int xheart_intr_register(int, int, int *);
int xheart_intr_establish(int (*)(void *), void *, int, int, const char *);
void xheart_intr_disestablish(int);
+void xheart_intr_clear(int);
+void xheart_intr_set(int);
uint32_t xheart_intr_handler(uint32_t, struct trap_frame *);
void xheart_intr_makemasks(void);
void xheart_setintrmask(int);
@@ -137,6 +139,8 @@ xheart_attach(struct device *parent, struct device *self, void *aux)
xbow_intr_widget_intr_register = xheart_intr_register;
xbow_intr_widget_intr_establish = xheart_intr_establish;
xbow_intr_widget_intr_disestablish = xheart_intr_disestablish;
+ xbow_intr_widget_intr_clear = xheart_intr_clear;
+ xbow_intr_widget_intr_set = xheart_intr_set;
xheart_intem = 0;
/*
@@ -351,6 +355,20 @@ xheart_intr_disestablish(int intrbit)
free(ih, M_DEVBUF);
}
+void
+xheart_intr_clear(int intrbit)
+{
+ *(volatile uint64_t *)PHYS_TO_XKPHYS(HEART_PIU_BASE + HEART_ISR_CLR,
+ CCA_NC) = 1UL << intrbit;
+}
+
+void
+xheart_intr_set(int intrbit)
+{
+ *(volatile uint64_t *)PHYS_TO_XKPHYS(HEART_PIU_BASE + HEART_ISR_SET,
+ CCA_NC) = 1UL << intrbit;
+}
+
/*
* Recompute interrupt masks.
*/