summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2007-09-10 20:29:51 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2007-09-10 20:29:51 +0000
commitc4f42c01876981fed5feb5928db5ade75a9da2c3 (patch)
treecb746662508b3d68b7ccf841196c688448dd746b /sys
parent6655e6cfc2764db20f7539845edb28d545478731 (diff)
Pass a real ipl level to add_nubus_intr(), and make sure the interrupt
handler is invoked with spl raised to the given level, otherwise all nubus interrupts are processed at level 2.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/mac68k/dev/grf_mv.c56
-rw-r--r--sys/arch/mac68k/dev/if_ae_nubus.c4
-rw-r--r--sys/arch/mac68k/dev/if_sm_nubus.c5
-rw-r--r--sys/arch/mac68k/dev/if_sn_nubus.c4
-rw-r--r--sys/arch/mac68k/dev/if_sn_obio.c5
-rw-r--r--sys/arch/mac68k/include/viareg.h4
-rw-r--r--sys/arch/mac68k/mac68k/via.c21
7 files changed, 54 insertions, 45 deletions
diff --git a/sys/arch/mac68k/dev/grf_mv.c b/sys/arch/mac68k/dev/grf_mv.c
index 4f76744acdd..1952836e6f3 100644
--- a/sys/arch/mac68k/dev/grf_mv.c
+++ b/sys/arch/mac68k/dev/grf_mv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grf_mv.c,v 1.33 2007/01/12 13:52:07 martin Exp $ */
+/* $OpenBSD: grf_mv.c,v 1.34 2007/09/10 20:29:46 miod Exp $ */
/* $NetBSD: grf_nubus.c,v 1.62 2001/01/22 20:27:02 briggs Exp $ */
/*
@@ -235,17 +235,17 @@ macfb_nubus_attach(struct device *parent, struct device *self, void *aux)
case NUBUS_DRHW_PVC:
sc->cli_offset = 0xa0000;
sc->cli_value = 0;
- add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_generic_write1, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_WVC:
sc->cli_offset = 0xa00000;
sc->cli_value = 0;
- add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_generic_write1, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_COLORMAX:
- add_nubus_intr(na->slot, grfmv_intr_cmax, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_cmax, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_SE30:
@@ -254,48 +254,48 @@ macfb_nubus_attach(struct device *parent, struct device *self, void *aux)
case NUBUS_DRHW_MDC:
sc->cli_offset = 0x200148;
sc->cli_value = 1;
- add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_generic_write4, sc,
sc->sc_dev.dv_xname);
/* Enable interrupts; to disable, write 0x7 to this location */
bus_space_write_4(sc->sc_tag, sc->sc_regh, 0x20013C, 5);
break;
case NUBUS_DRHW_CB264:
- add_nubus_intr(na->slot, grfmv_intr_cb264, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_cb264, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_CB364:
- add_nubus_intr(na->slot, grfmv_intr_cb364, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_cb364, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_RPC8:
sc->cli_offset = 0xfdff8f;
sc->cli_value = 0xff;
- add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_generic_write1, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_RPC8XJ:
sc->cli_value = 0x66;
- add_nubus_intr(na->slot, grfmv_intr_radius, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_radius, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_RPC24X:
case NUBUS_DRHW_BOOGIE:
sc->cli_value = 0x64;
- add_nubus_intr(na->slot, grfmv_intr_radius, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_radius, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_RPC24XP:
- add_nubus_intr(na->slot, grfmv_intr_radius24, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_radius24, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_RADGSC:
- add_nubus_intr(na->slot, grfmv_intr_radius_gsc, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_radius_gsc, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_RDCGX:
case NUBUS_DRHW_MPGX:
- add_nubus_intr(na->slot, grfmv_intr_radius_gx, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_radius_gx, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_FIILX:
@@ -303,34 +303,34 @@ macfb_nubus_attach(struct device *parent, struct device *self, void *aux)
case NUBUS_DRHW_FUTURASX:
sc->cli_offset = 0xf05000;
sc->cli_value = 0x80;
- add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_generic_write1, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_SAM768:
- add_nubus_intr(na->slot, grfmv_intr_cti, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_cti, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_SUPRGFX:
- add_nubus_intr(na->slot, grfmv_intr_supermacgfx, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_supermacgfx, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_SPECTRM8:
sc->cli_offset = 0x0de178;
sc->cli_value = 0x80;
- add_nubus_intr(na->slot, grfmv_intr_generic_or4, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_generic_or4, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_LAPIS:
- add_nubus_intr(na->slot, grfmv_intr_lapis, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_lapis, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_RELAX200:
- add_nubus_intr(na->slot, grfmv_intr_relax_200, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_relax_200, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_BAER:
case NUBUS_DRHW_FORMAC:
- add_nubus_intr(na->slot, grfmv_intr_formac, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_formac, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_ROPS24LXI:
@@ -339,41 +339,41 @@ macfb_nubus_attach(struct device *parent, struct device *self, void *aux)
case NUBUS_DRHW_THUNDER24:
sc->cli_offset = 0xfb0010;
sc->cli_value = 0x00;
- add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_generic_write4, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_ROPSPPGT:
sc->cli_offset = 0xf50010;
sc->cli_value = 0x02;
- add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_generic_write4, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_VIMAGE:
- add_nubus_intr(na->slot, grfmv_intr_vimage, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_vimage, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_GVIMAGE:
- add_nubus_intr(na->slot, grfmv_intr_gvimage, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_gvimage, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_MC2124NB:
sc->cli_offset = 0xfd1000;
sc->cli_value = 0x00;
- add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_generic_write4, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_MICRON:
sc->cli_offset = 0xa00014;
sc->cli_value = 0;
- add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_generic_write4, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_MVC:
- add_nubus_intr(na->slot, grfmv_intr_mvc, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_mvc, sc,
sc->sc_dev.dv_xname);
break;
case NUBUS_DRHW_VILTRO340:
- add_nubus_intr(na->slot, grfmv_intr_viltro_340, sc,
+ add_nubus_intr(na->slot, IPL_TTY, grfmv_intr_viltro_340, sc,
sc->sc_dev.dv_xname);
break;
default:
diff --git a/sys/arch/mac68k/dev/if_ae_nubus.c b/sys/arch/mac68k/dev/if_ae_nubus.c
index fd5d165275b..39664052df3 100644
--- a/sys/arch/mac68k/dev/if_ae_nubus.c
+++ b/sys/arch/mac68k/dev/if_ae_nubus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ae_nubus.c,v 1.17 2007/01/22 13:17:45 martin Exp $ */
+/* $OpenBSD: if_ae_nubus.c,v 1.18 2007/09/10 20:29:46 miod Exp $ */
/* $NetBSD: if_ae_nubus.c,v 1.17 1997/05/01 18:17:16 briggs Exp $ */
/*
@@ -378,7 +378,7 @@ ae_nubus_attach(parent, self, aux)
}
/* make sure interrupts are vectored to us */
- add_nubus_intr(na->slot, dp8390_intr, sc, sc->sc_dev.dv_xname);
+ add_nubus_intr(na->slot, IPL_NET, dp8390_intr, sc, sc->sc_dev.dv_xname);
}
static int
diff --git a/sys/arch/mac68k/dev/if_sm_nubus.c b/sys/arch/mac68k/dev/if_sm_nubus.c
index fd8dbab67bc..16b47774682 100644
--- a/sys/arch/mac68k/dev/if_sm_nubus.c
+++ b/sys/arch/mac68k/dev/if_sm_nubus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sm_nubus.c,v 1.1 2006/01/29 15:58:20 martin Exp $ */
+/* $OpenBSD: if_sm_nubus.c,v 1.2 2007/09/10 20:29:46 miod Exp $ */
/* $NetBSD: if_sm_nubus.c,v 1.2 2000/08/01 13:08:39 briggs Exp $ */
/*
@@ -161,5 +161,6 @@ sm_nubus_attach(parent, self, aux)
smc91cxx_attach(smc, myaddr);
- add_nubus_intr(na->slot, smc91cxx_intr, smc, smc->sc_dev.dv_xname);
+ add_nubus_intr(na->slot, IPL_NET, smc91cxx_intr, smc,
+ smc->sc_dev.dv_xname);
}
diff --git a/sys/arch/mac68k/dev/if_sn_nubus.c b/sys/arch/mac68k/dev/if_sn_nubus.c
index 3b7ad8936ee..5a2f6698961 100644
--- a/sys/arch/mac68k/dev/if_sn_nubus.c
+++ b/sys/arch/mac68k/dev/if_sn_nubus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sn_nubus.c,v 1.18 2006/03/23 04:10:13 brad Exp $ */
+/* $OpenBSD: if_sn_nubus.c,v 1.19 2007/09/10 20:29:46 miod Exp $ */
/* $NetBSD: if_sn_nubus.c,v 1.13 1997/05/11 19:11:34 scottr Exp $ */
/*
* Copyright (C) 1997 Allen Briggs
@@ -257,7 +257,7 @@ sn_nubus_attach(struct device *parent, struct device *self, void *aux)
return;
}
- add_nubus_intr(sc->slotno, snintr, sc, sc->sc_dev.dv_xname);
+ add_nubus_intr(sc->slotno, IPL_NET, snintr, sc, sc->sc_dev.dv_xname);
}
static int
diff --git a/sys/arch/mac68k/dev/if_sn_obio.c b/sys/arch/mac68k/dev/if_sn_obio.c
index 766985d2cf3..84794e924d1 100644
--- a/sys/arch/mac68k/dev/if_sn_obio.c
+++ b/sys/arch/mac68k/dev/if_sn_obio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sn_obio.c,v 1.23 2006/03/23 04:17:23 brad Exp $ */
+/* $OpenBSD: if_sn_obio.c,v 1.24 2007/09/10 20:29:46 miod Exp $ */
/* $NetBSD: if_sn_obio.c,v 1.9 1997/04/22 20:56:15 scottr Exp $ */
/*
@@ -181,7 +181,8 @@ sn_obio_attach(struct device *parent, struct device *self, void *aux)
if (mac68k_machine.aux_interrupts)
intr_establish(snintr, sc, 3, sc->sc_dev.dv_xname);
else
- add_nubus_intr(sc->slotno, snintr, sc, sc->sc_dev.dv_xname);
+ add_nubus_intr(sc->slotno, IPL_NET, snintr, sc,
+ sc->sc_dev.dv_xname);
}
static int
diff --git a/sys/arch/mac68k/include/viareg.h b/sys/arch/mac68k/include/viareg.h
index 960b1597f1b..4fc3dc5c32e 100644
--- a/sys/arch/mac68k/include/viareg.h
+++ b/sys/arch/mac68k/include/viareg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: viareg.h,v 1.18 2006/01/13 21:02:01 miod Exp $ */
+/* $OpenBSD: viareg.h,v 1.19 2007/09/10 20:29:48 miod Exp $ */
/* $NetBSD: viareg.h,v 1.6 1997/02/28 07:41:41 scottr Exp $ */
/*-
@@ -213,7 +213,7 @@ typedef SLIST_HEAD(, via2hand) via2hand_t;
void via_init(void);
void via_powerdown(void);
void via_set_modem(int);
-void add_nubus_intr(int, int (*)(void *), void *, const char *);
+void add_nubus_intr(int, int, int (*)(void *), void *, const char *);
void enable_nubus_intr(void);
void via1_register_irq(int, int (*)(void *), void *, const char *);
int via2_register_irq(struct via2hand *, const char *);
diff --git a/sys/arch/mac68k/mac68k/via.c b/sys/arch/mac68k/mac68k/via.c
index f0902bb0dc1..9042dc80b93 100644
--- a/sys/arch/mac68k/mac68k/via.c
+++ b/sys/arch/mac68k/mac68k/via.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: via.c,v 1.30 2007/07/29 21:25:23 miod Exp $ */
+/* $OpenBSD: via.c,v 1.31 2007/09/10 20:29:50 miod Exp $ */
/* $NetBSD: via.c,v 1.62 1997/09/10 04:38:48 scottr Exp $ */
/*-
@@ -167,7 +167,7 @@ via_init()
nubus_intr.vh_fn = rbv_nubus_intr;
via2_register_irq(&nubus_intr, NULL);
/* XXX necessary? */
- add_nubus_intr(0, slot_ignore, (void *)0, "dummy");
+ add_nubus_intr(0, IPL_NONE, slot_ignore, (void *)0, "dummy");
}
}
@@ -298,7 +298,7 @@ rbv_intr(void *arg)
int nubus_intr_mask = 0;
void
-add_nubus_intr(int slot, int (*func)(void *), void *client_data,
+add_nubus_intr(int slot, int ipl, int (*func)(void *), void *client_data,
const char *name)
{
struct intrhand *ih;
@@ -328,10 +328,10 @@ add_nubus_intr(int slot, int (*func)(void *), void *client_data,
ih->ih_fn = func;
ih->ih_arg = client_data;
- ih->ih_ipl = slot + 9;
+ ih->ih_ipl = ipl;
evcount_attach(&ih->ih_count, name, (void *)&ih->ih_ipl, &evcount_intr);
- nubus_intr_mask |= (1 << slot);
+ nubus_intr_mask |= 1 << slot;
splx(s);
}
@@ -354,6 +354,7 @@ oss_intr(void *arg)
struct intrhand *ih;
u_int8_t intbits, bitnum;
u_int mask;
+ int s;
intbits = via2_reg(vIFR + rIFR);
@@ -365,8 +366,10 @@ oss_intr(void *arg)
for (bitnum = 0, ih = slotintrs; ; bitnum++, ih++) {
if (intbits & mask) {
if (ih->ih_fn != NULL) {
+ s = _splraise(IPLTOPSL(ih->ih_ipl));
if ((*ih->ih_fn)(ih->ih_arg) != 0)
ih->ih_count.ec_count++;
+ splx(s);
}
via2_reg(rIFR) = mask;
}
@@ -384,7 +387,7 @@ via2_nubus_intr(void *bitarg)
{
struct intrhand *ih;
u_int8_t i, intbits, mask;
- int rv = 0;
+ int s, rv = 0;
via2_reg(vIFR) = V2IF_SLOTINT;
while ((intbits = (~via2_reg(vBufA)) & nubus_intr_mask)) {
@@ -392,10 +395,12 @@ via2_nubus_intr(void *bitarg)
i--, ih--, mask >>= 1) {
if (intbits & mask) {
if (ih->ih_fn != NULL) {
+ s = _splraise(IPLTOPSL(ih->ih_ipl));
if ((*ih->ih_fn)(ih->ih_arg) != 0) {
ih->ih_count.ec_count++;
rv = 1;
}
+ splx(s);
}
}
}
@@ -410,7 +415,7 @@ rbv_nubus_intr(void *bitarg)
{
struct intrhand *ih;
u_int8_t i, intbits, mask;
- int rv = 0;
+ int s, rv = 0;
via2_reg(rIFR) = 0x80 | V2IF_SLOTINT;
while ((intbits = (~via2_reg(rBufA)) & via2_reg(rSlotInt))) {
@@ -418,10 +423,12 @@ rbv_nubus_intr(void *bitarg)
i--, ih--, mask >>= 1) {
if (intbits & mask) {
if (ih->ih_fn != NULL) {
+ s = _splraise(IPLTOPSL(ih->ih_ipl));
if ((*ih->ih_fn)(ih->ih_arg) != 0) {
ih->ih_count.ec_count++;
rv = 1;
}
+ splx(s);
}
}
}