summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-07-30 22:29:50 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-07-30 22:29:50 +0000
commitf1e4171338c4f3d8dca2bc58e710f5bd11361295 (patch)
tree6ce9165aeabb3c0d9712f7813ca69b0a69157e48 /sys/arch
parent285ab627ce1b536c0946c2a8dd9da91bb7610161 (diff)
Move struct evcount inside struct intrhand, and modernize intrhand
usage; similar to (and from) mvme88k. Also remove unused haltvec structures and related code.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/mvme68k/dev/cl.c58
-rw-r--r--sys/arch/mvme68k/dev/clock.c27
-rw-r--r--sys/arch/mvme68k/dev/fooip.c4
-rw-r--r--sys/arch/mvme68k/dev/if_ie.c21
-rw-r--r--sys/arch/mvme68k/dev/if_le.c10
-rw-r--r--sys/arch/mvme68k/dev/if_levar.h3
-rw-r--r--sys/arch/mvme68k/dev/ipic.c9
-rw-r--r--sys/arch/mvme68k/dev/ipicreg.h4
-rw-r--r--sys/arch/mvme68k/dev/lp.c4
-rw-r--r--sys/arch/mvme68k/dev/mc.c19
-rw-r--r--sys/arch/mvme68k/dev/mcreg.h4
-rw-r--r--sys/arch/mvme68k/dev/memc.c4
-rw-r--r--sys/arch/mvme68k/dev/pcc.c19
-rw-r--r--sys/arch/mvme68k/dev/pccreg.h4
-rw-r--r--sys/arch/mvme68k/dev/pcctwo.c17
-rw-r--r--sys/arch/mvme68k/dev/pcctworeg.h4
-rw-r--r--sys/arch/mvme68k/dev/sbicdma.c6
-rw-r--r--sys/arch/mvme68k/dev/ssh.c3
-rw-r--r--sys/arch/mvme68k/dev/sshdma.c11
-rw-r--r--sys/arch/mvme68k/dev/sshvar.h3
-rw-r--r--sys/arch/mvme68k/dev/vme.c9
-rw-r--r--sys/arch/mvme68k/dev/vme.h4
-rw-r--r--sys/arch/mvme68k/dev/vs.c3
-rw-r--r--sys/arch/mvme68k/dev/vsdma.c15
-rw-r--r--sys/arch/mvme68k/dev/vsvar.h3
-rw-r--r--sys/arch/mvme68k/dev/wdsc.c365
-rw-r--r--sys/arch/mvme68k/dev/wl.c26
-rw-r--r--sys/arch/mvme68k/dev/zs.c12
-rw-r--r--sys/arch/mvme68k/include/cpu.h15
-rw-r--r--sys/arch/mvme68k/mvme68k/autoconf.c6
-rw-r--r--sys/arch/mvme68k/mvme68k/machdep.c59
-rw-r--r--sys/arch/mvme68k/mvme68k/trap.c96
32 files changed, 379 insertions, 468 deletions
diff --git a/sys/arch/mvme68k/dev/cl.c b/sys/arch/mvme68k/dev/cl.c
index 16031058d30..c990995a766 100644
--- a/sys/arch/mvme68k/dev/cl.c
+++ b/sys/arch/mvme68k/dev/cl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cl.c,v 1.37 2004/07/30 09:50:15 miod Exp $ */
+/* $OpenBSD: cl.c,v 1.38 2004/07/30 22:29:44 miod Exp $ */
/*
* Copyright (c) 1995 Dale Rahn. All rights reserved.
@@ -35,7 +35,6 @@
#include <sys/time.h>
#include <sys/device.h>
#include <sys/syslog.h>
-#include <sys/evcount.h>
#include <machine/autoconf.h>
#include <machine/conf.h>
@@ -115,12 +114,6 @@ char cl_dmabuf [CLCD_PORTS_PER_CHIP * CL_BUFSIZE * 4];
struct clsoftc {
struct device sc_dev;
- struct evcount sc_txintrcnt;
- char sc_txintrname[16 + 3];
- struct evcount sc_rxintrcnt;
- char sc_rxintrname[16 + 3];
- struct evcount sc_mxintrcnt;
- char sc_mxintrname[16 + 3];
time_t sc_rotime; /* time of last ring overrun */
time_t sc_fotime; /* time of last fifo overrun */
u_char *pbase;
@@ -130,6 +123,10 @@ struct clsoftc {
struct intrhand sc_ih_m;
struct intrhand sc_ih_t;
struct intrhand sc_ih_r;
+ char sc_errintrname[16 + 4];
+ char sc_mxintrname[16 + 3];
+ char sc_rxintrname[16 + 3];
+ char sc_txintrname[16 + 3];
int sc_flags;
int ssir;
};
@@ -363,33 +360,26 @@ clattach(parent, self, aux)
sc->sc_ih_r.ih_arg = sc;
sc->sc_ih_r.ih_ipl = ca->ca_ipl;
sc->sc_ih_r.ih_wantframe = 0;
- switch (ca->ca_bustype) {
- case BUS_PCCTWO:
- pcctwointr_establish(PCC2V_SCC_RXE,&sc->sc_ih_e);
- pcctwointr_establish(PCC2V_SCC_M,&sc->sc_ih_m);
- pcctwointr_establish(PCC2V_SCC_TX,&sc->sc_ih_t);
- pcctwointr_establish(PCC2V_SCC_RX,&sc->sc_ih_r);
- sys_pcc2->pcc2_sccerr = 0x01; /* clear errors */
-
- /* enable all interrupts at ca_ipl */
- sys_pcc2->pcc2_sccirq = PCC2_IRQ_IEN | (ca->ca_ipl & 0x7);
- sys_pcc2->pcc2_scctx = PCC2_IRQ_IEN | (ca->ca_ipl & 0x7);
- sys_pcc2->pcc2_sccrx = PCC2_IRQ_IEN | (ca->ca_ipl & 0x7);
- break;
- }
- snprintf(sc->sc_txintrname, sizeof sc->sc_txintrname,
- "%s_tx", self->dv_xname);
- evcount_attach(&sc->sc_txintrcnt, sc->sc_txintrname,
- (void *)&sc->sc_ih_t.ih_ipl, &evcount_intr);
- snprintf(sc->sc_rxintrname, sizeof sc->sc_rxintrname,
- "%s_rx", self->dv_xname);
- evcount_attach(&sc->sc_rxintrcnt, sc->sc_rxintrname,
- (void *)&sc->sc_ih_r.ih_ipl, &evcount_intr);
+ snprintf(sc->sc_errintrname, sizeof sc->sc_errintrname,
+ "%s_err", self->dv_xname);
snprintf(sc->sc_mxintrname, sizeof sc->sc_mxintrname,
"%s_mx", self->dv_xname);
- evcount_attach(&sc->sc_mxintrcnt, sc->sc_mxintrname,
- (void *)&sc->sc_ih_m.ih_ipl, &evcount_intr);
+ snprintf(sc->sc_rxintrname, sizeof sc->sc_rxintrname,
+ "%s_rx", self->dv_xname);
+ snprintf(sc->sc_txintrname, sizeof sc->sc_txintrname,
+ "%s_tx", self->dv_xname);
+
+ pcctwointr_establish(PCC2V_SCC_RXE,&sc->sc_ih_e, sc->sc_errintrname);
+ pcctwointr_establish(PCC2V_SCC_M,&sc->sc_ih_m, sc->sc_mxintrname);
+ pcctwointr_establish(PCC2V_SCC_TX,&sc->sc_ih_t, sc->sc_txintrname);
+ pcctwointr_establish(PCC2V_SCC_RX,&sc->sc_ih_r, sc->sc_rxintrname);
+ sys_pcc2->pcc2_sccerr = 0x01; /* clear errors */
+
+ /* enable all interrupts at ca_ipl */
+ sys_pcc2->pcc2_sccirq = PCC2_IRQ_IEN | (ca->ca_ipl & 0x7);
+ sys_pcc2->pcc2_scctx = PCC2_IRQ_IEN | (ca->ca_ipl & 0x7);
+ sys_pcc2->pcc2_sccrx = PCC2_IRQ_IEN | (ca->ca_ipl & 0x7);
printf("\n");
}
@@ -1446,7 +1436,6 @@ cl_mintr(arg)
log(LOG_WARNING, "cl_mintr extra intr\n");
return 0;
}
- sc->sc_mxintrcnt.ec_count++;
channel = mir & 0x03;
misr = sc->cl_reg->cl_misr;
@@ -1508,7 +1497,6 @@ cl_txintr(arg)
log(LOG_WARNING, "cl_txintr extra intr\n");
return 0;
}
- sc->sc_txintrcnt.ec_count++;
channel = tir & 0x03;
cmr = sc->cl_reg->cl_cmr;
@@ -1632,7 +1620,7 @@ cl_rxintr(arg)
log(LOG_WARNING, "cl_rxintr extra intr\n");
return 0;
}
- sc->sc_rxintrcnt.ec_count++;
+
channel = rir & 0x3;
cmr = sc->cl_reg->cl_cmr;
reoir = 0x08;
diff --git a/sys/arch/mvme68k/dev/clock.c b/sys/arch/mvme68k/dev/clock.c
index 734a6ec84fa..6de74f83f17 100644
--- a/sys/arch/mvme68k/dev/clock.c
+++ b/sys/arch/mvme68k/dev/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.12 2004/07/30 10:02:42 miod Exp $ */
+/* $OpenBSD: clock.c,v 1.13 2004/07/30 22:29:44 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -67,7 +67,6 @@
#include <sys/device.h>
#include <sys/kernel.h>
#include <sys/systm.h>
-#include <sys/evcount.h>
#include <machine/psl.h>
#include <machine/autoconf.h>
@@ -103,9 +102,7 @@ int statmin; /* statclock interval - 1/2*variance */
struct clocksoftc {
struct device sc_dev;
struct intrhand sc_profih;
- struct evcount sc_profcnt;
struct intrhand sc_statih;
- struct evcount sc_statcnt;
};
void clockattach(struct device *, struct device *, void *);
@@ -161,33 +158,28 @@ clockattach(parent, self, args)
case BUS_PCC:
prof_reset = ca->ca_ipl | PCC_IRQ_IEN | PCC_TIMERACK;
stat_reset = ca->ca_ipl | PCC_IRQ_IEN | PCC_TIMERACK;
- pccintr_establish(PCCV_TIMER1, &sc->sc_profih);
- pccintr_establish(PCCV_TIMER2, &sc->sc_statih);
+ pccintr_establish(PCCV_TIMER1, &sc->sc_profih, "clock");
+ pccintr_establish(PCCV_TIMER2, &sc->sc_statih, "stat");
break;
#endif
#if NMC > 0
case BUS_MC:
prof_reset = ca->ca_ipl | MC_IRQ_IEN | MC_IRQ_ICLR;
stat_reset = ca->ca_ipl | MC_IRQ_IEN | MC_IRQ_ICLR;
- mcintr_establish(MCV_TIMER1, &sc->sc_profih);
- mcintr_establish(MCV_TIMER2, &sc->sc_statih);
+ mcintr_establish(MCV_TIMER1, &sc->sc_profih, "clock");
+ mcintr_establish(MCV_TIMER2, &sc->sc_statih, "stat");
break;
#endif
#if NPCCTWO > 0
case BUS_PCCTWO:
prof_reset = ca->ca_ipl | PCC2_IRQ_IEN | PCC2_IRQ_ICLR;
stat_reset = ca->ca_ipl | PCC2_IRQ_IEN | PCC2_IRQ_ICLR;
- pcctwointr_establish(PCC2V_TIMER1, &sc->sc_profih);
- pcctwointr_establish(PCC2V_TIMER2, &sc->sc_statih);
+ pcctwointr_establish(PCC2V_TIMER1, &sc->sc_profih, "clock");
+ pcctwointr_establish(PCC2V_TIMER2, &sc->sc_statih, "stat");
break;
#endif
}
- evcount_attach(&sc->sc_statcnt, "stat", (void *)&sc->sc_statih.ih_ipl,
- &evcount_intr);
- evcount_attach(&sc->sc_profcnt, "clock", (void *)&sc->sc_profih.ih_ipl,
- &evcount_intr);
-
printf("\n");
}
@@ -198,8 +190,6 @@ int
clockintr(arg)
void *arg;
{
- struct clocksoftc *sc = clock_cd.cd_devs[0];
-
switch (clockbus) {
#if NPCC > 0
case BUS_PCC:
@@ -218,7 +208,6 @@ clockintr(arg)
#endif
}
- sc->sc_profcnt.ec_count++;
hardclock(arg);
return (1);
}
@@ -313,7 +302,6 @@ int
statintr(cap)
void *cap;
{
- struct clocksoftc *sc = clock_cd.cd_devs[0];
register u_long newint, r, var;
switch (clockbus) {
@@ -334,7 +322,6 @@ statintr(cap)
#endif
}
- sc->sc_statcnt.ec_count++;
statclock((struct clockframe *)cap);
/*
diff --git a/sys/arch/mvme68k/dev/fooip.c b/sys/arch/mvme68k/dev/fooip.c
index 980cf73774a..6b05f709976 100644
--- a/sys/arch/mvme68k/dev/fooip.c
+++ b/sys/arch/mvme68k/dev/fooip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fooip.c,v 1.8 2004/07/02 17:57:29 miod Exp $ */
+/* $OpenBSD: fooip.c,v 1.9 2004/07/30 22:29:44 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -97,7 +97,7 @@ fooipattach(parent, self, args)
sc->sc_ih.ih_fn = fooipintr;
sc->sc_ih.ih_arg = sc;
sc->sc_ih.ih_ipl = ca->ca_ipl;
- ipicintr_establish(ca->ca_vec, &sc->sc_ih);
+ ipicintr_establish(ca->ca_vec, &sc->sc_ih, self->dv_xname);
sc->sc_regs->fooip_vec = ca->ca_vec;
sc->sc_ipicsc->sc_ipic->ipic_irq[sc->sc_slot][0] = ca->ca_ipl |
diff --git a/sys/arch/mvme68k/dev/if_ie.c b/sys/arch/mvme68k/dev/if_ie.c
index cd4eb5239fe..58522049a5a 100644
--- a/sys/arch/mvme68k/dev/if_ie.c
+++ b/sys/arch/mvme68k/dev/if_ie.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ie.c,v 1.26 2004/07/30 09:50:15 miod Exp $ */
+/* $OpenBSD: if_ie.c,v 1.27 2004/07/30 22:29:44 miod Exp $ */
/*-
* Copyright (c) 1999 Steve Murphree, Jr.
@@ -105,7 +105,6 @@ Mode of operation:
#include <sys/errno.h>
#include <sys/syslog.h>
#include <sys/device.h>
-#include <sys/evcount.h>
#include <net/if.h>
#include <net/if_types.h>
@@ -170,7 +169,7 @@ struct vm_map *ie_map; /* for obio */
struct ie_softc {
struct device sc_dev; /* device structure */
struct intrhand sc_ih, sc_failih; /* interrupt info */
- struct evcount sc_intrcnt; /* # of interrupts, per ie */
+ char sc_failintrname[16 + 4];
caddr_t sc_iobase; /* KVA of base of 24 bit addr space */
caddr_t sc_maddr; /* KVA of base of chip's RAM (16bit addr sp.)*/
@@ -478,19 +477,22 @@ ieattach(parent, self, aux)
sc->sc_failih.ih_arg = sc;
sc->sc_failih.ih_ipl = pri;
+ snprintf(sc->sc_failintrname, sizeof sc->sc_failintrname, "%s_err", self->dv_xname);
+
switch (sc->sc_bustype) {
#if NMC > 0
case BUS_MC:
- mcintr_establish(MCV_IE, &sc->sc_ih);
+ mcintr_establish(MCV_IE, &sc->sc_ih, self->dv_xname);
sys_mc->mc_ieirq = pri | MC_SC_SNOOP | MC_IRQ_IEN |
MC_IRQ_ICLR;
- mcintr_establish(MCV_IEFAIL, &sc->sc_failih);
+ mcintr_establish(MCV_IEFAIL, &sc->sc_failih,
+ sc->sc_failintrname);
sys_mc->mc_iefailirq = pri | MC_IRQ_IEN | MC_IRQ_ICLR;
break;
#endif
#if NPCCTWO > 0
case BUS_PCCTWO:
- pcctwointr_establish(PCC2V_IE, &sc->sc_ih);
+ pcctwointr_establish(PCC2V_IE, &sc->sc_ih, self->dv_xname);
switch (cputyp) {
#ifdef MVME172
case CPU_172:
@@ -508,15 +510,13 @@ ieattach(parent, self, aux)
sys_pcc2->pcc2_ieirq = pri | PCC2_SC_SNOOP |
PCC2_IRQ_IEN | PCC2_IRQ_ICLR;
}
- pcctwointr_establish(PCC2V_IEFAIL, &sc->sc_failih);
+ pcctwointr_establish(PCC2V_IEFAIL, &sc->sc_failih,
+ sc->sc_failintrname);
sys_pcc2->pcc2_iefailirq = pri | PCC2_IRQ_IEN |
PCC2_IRQ_ICLR;
break;
#endif
}
-
- evcount_attach(&sc->sc_intrcnt, self->dv_xname,
- (void *)&sc->sc_ih.ih_ipl, &evcount_intr);
}
/*
@@ -629,7 +629,6 @@ loop:
if ((status = sc->scb->ie_status) & IE_ST_WHENCE)
goto loop;
- sc->sc_intrcnt.ec_count++;
return 1;
}
diff --git a/sys/arch/mvme68k/dev/if_le.c b/sys/arch/mvme68k/dev/if_le.c
index 0fc0da89488..f9e9f6ea41c 100644
--- a/sys/arch/mvme68k/dev/if_le.c
+++ b/sys/arch/mvme68k/dev/if_le.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_le.c,v 1.28 2004/07/30 09:50:15 miod Exp $ */
+/* $OpenBSD: if_le.c,v 1.29 2004/07/30 22:29:45 miod Exp $ */
/*-
* Copyright (c) 1982, 1992, 1993
@@ -40,7 +40,6 @@
#include <sys/socket.h>
#include <sys/device.h>
#include <sys/malloc.h>
-#include <sys/evcount.h>
#include <net/if.h>
@@ -402,19 +401,16 @@ leattach(parent, self, aux)
lesc->sc_ih.ih_fn = vle_intr;
lesc->sc_ih.ih_arg = sc;
lesc->sc_ih.ih_ipl = pri;
- vmeintr_establish(ca->ca_vec + 0, &lesc->sc_ih);
+ vmeintr_establish(ca->ca_vec + 0, &lesc->sc_ih, self->dv_xname);
break;
#if NPCC > 0
case BUS_PCC:
lesc->sc_ih.ih_fn = am7990_intr;
lesc->sc_ih.ih_arg = sc;
lesc->sc_ih.ih_ipl = pri;
- pccintr_establish(PCCV_LE, &lesc->sc_ih);
+ pccintr_establish(PCCV_LE, &lesc->sc_ih, self->dv_xname);
sys_pcc->pcc_leirq = pri | PCC_IRQ_IEN;
break;
#endif
}
-
- evcount_attach(&lesc->sc_intrcnt, self->dv_xname,
- (void *)&lesc->sc_ih.ih_ipl, &evcount_intr);
}
diff --git a/sys/arch/mvme68k/dev/if_levar.h b/sys/arch/mvme68k/dev/if_levar.h
index 465e840b0b8..ded8d952d14 100644
--- a/sys/arch/mvme68k/dev/if_levar.h
+++ b/sys/arch/mvme68k/dev/if_levar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_levar.h,v 1.6 2004/07/30 09:50:15 miod Exp $ */
+/* $OpenBSD: if_levar.h,v 1.7 2004/07/30 22:29:45 miod Exp $ */
/* $NetBSD: if_levar.h,v 1.5 1996/05/07 01:27:32 thorpej Exp $ */
/*-
@@ -48,7 +48,6 @@ struct le_softc {
struct intrhand sc_ih; /* interrupt vectoring */
void *sc_r1; /* LANCE registers */
u_short csr; /* Control/Status reg image */
- struct evcount sc_intrcnt;
u_char sc_ipl;
u_char sc_vec;
};
diff --git a/sys/arch/mvme68k/dev/ipic.c b/sys/arch/mvme68k/dev/ipic.c
index fae6327b70b..ff766a2c20c 100644
--- a/sys/arch/mvme68k/dev/ipic.c
+++ b/sys/arch/mvme68k/dev/ipic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipic.c,v 1.14 2004/07/02 17:57:29 miod Exp $ */
+/* $OpenBSD: ipic.c,v 1.15 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -160,7 +160,7 @@ ipicattach(parent, self, args)
* the MC chip is rev 1. XXX - smurph
*/
if (sys_mc->mc_chiprev == 0x01)
- printf(": rev 1\n");
+ printf(": rev 1\n");
else
printf(": rev %d\n", sc->sc_ipic->ipic_chiprev);
@@ -188,9 +188,10 @@ ipicunmap(sc, addr, len)
}
int
-ipicintr_establish(vec, ih)
+ipicintr_establish(vec, ih, name)
int vec;
struct intrhand *ih;
+ const char *name;
{
- return (intr_establish(vec, ih));
+ return intr_establish(vec, ih, name);
}
diff --git a/sys/arch/mvme68k/dev/ipicreg.h b/sys/arch/mvme68k/dev/ipicreg.h
index fccbbfa92c2..2f5b24b1fd9 100644
--- a/sys/arch/mvme68k/dev/ipicreg.h
+++ b/sys/arch/mvme68k/dev/ipicreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipicreg.h,v 1.5 2003/06/02 05:09:14 deraadt Exp $ */
+/* $OpenBSD: ipicreg.h,v 1.6 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -108,4 +108,4 @@ struct ipicsoftc {
int sc_nip;
};
-int ipicintr_establish(int, struct intrhand *);
+int ipicintr_establish(int, struct intrhand *, const char *);
diff --git a/sys/arch/mvme68k/dev/lp.c b/sys/arch/mvme68k/dev/lp.c
index d82e7e77214..73a97b612ef 100644
--- a/sys/arch/mvme68k/dev/lp.c
+++ b/sys/arch/mvme68k/dev/lp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lp.c,v 1.9 2004/07/02 17:57:29 miod Exp $ */
+/* $OpenBSD: lp.c,v 1.10 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -86,7 +86,7 @@ lpattach(parent, self, args)
sc->sc_ih.ih_fn = lpintr;
sc->sc_ih.ih_arg = sc;
sc->sc_ih.ih_ipl = ca->ca_ipl;
- pccintr_establish(PCCV_PRINTER, &sc->sc_ih);
+ pccintr_establish(PCCV_PRINTER, &sc->sc_ih, self->dv_xname);
sys_pcc->pcc_lpirq = ca->ca_ipl | PCC_IRQ_IEN | PCC_LPIRQ_ACK;
}
diff --git a/sys/arch/mvme68k/dev/mc.c b/sys/arch/mvme68k/dev/mc.c
index 5fe4dd4a604..cbc4ad1929f 100644
--- a/sys/arch/mvme68k/dev/mc.c
+++ b/sys/arch/mvme68k/dev/mc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mc.c,v 1.15 2004/07/02 17:57:29 miod Exp $ */
+/* $OpenBSD: mc.c,v 1.16 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -150,7 +150,7 @@ mcattach(parent, self, args)
sc->sc_nmiih.ih_fn = mcabort;
sc->sc_nmiih.ih_ipl = 7;
sc->sc_nmiih.ih_wantframe = 1;
- mcintr_establish(MCV_ABORT, &sc->sc_nmiih);
+ mcintr_establish(MCV_ABORT, &sc->sc_nmiih, self->dv_xname);
sc->sc_mc->mc_abortirq = 7 | MC_IRQ_IEN | MC_IRQ_ICLR;
sc->sc_mc->mc_vecbase = MC_VECBASE;
@@ -164,15 +164,18 @@ mcattach(parent, self, args)
* MC interrupts land in a MC_NVEC sized hole starting at MC_VECBASE
*/
int
-mcintr_establish(vec, ih)
+mcintr_establish(vec, ih, name)
int vec;
struct intrhand *ih;
+ const char *name;
{
- if (vec >= MC_NVEC) {
- printf("mc: illegal vector: 0x%x\n", vec);
- panic("mcintr_establish");
- }
- return (intr_establish(MC_VECBASE+vec, ih));
+#ifdef DIAGNOSTIC
+ if (vec < 0 || vec >= MC_NVEC)
+ panic("mcintr_establish: illegal vector for %s: 0x%x",
+ name, vec);
+#endif
+
+ return intr_establish(MC_VECBASE + vec, ih, name);
}
int
diff --git a/sys/arch/mvme68k/dev/mcreg.h b/sys/arch/mvme68k/dev/mcreg.h
index 19765a708b9..c70c69fe78c 100644
--- a/sys/arch/mvme68k/dev/mcreg.h
+++ b/sys/arch/mvme68k/dev/mcreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mcreg.h,v 1.8 2003/06/02 05:09:14 deraadt Exp $ */
+/* $OpenBSD: mcreg.h,v 1.9 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -168,4 +168,4 @@ void mc_enableflashwrite(int on);
#define MC_DISFLASHWRITE_OFFSET 0xc8000
int mc_hasflash(void);
-int mcintr_establish(int, struct intrhand *);
+int mcintr_establish(int, struct intrhand *, const char *);
diff --git a/sys/arch/mvme68k/dev/memc.c b/sys/arch/mvme68k/dev/memc.c
index 74c9a21ea85..9dd36658381 100644
--- a/sys/arch/mvme68k/dev/memc.c
+++ b/sys/arch/mvme68k/dev/memc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: memc.c,v 1.9 2004/01/14 20:50:48 miod Exp $ */
+/* $OpenBSD: memc.c,v 1.10 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -105,7 +105,7 @@ memcattach(parent, self, args)
sc->sc_ih.ih_fn = memcintr;
sc->sc_ih.ih_ipl = 7;
sc->sc_ih.ih_wantframe = 1;
- mcintr_establish(xxx, &sc->sc_ih);
+ mcintr_establish(xxx, &sc->sc_ih, self->dv_xname);
#endif
switch (sc->sc_memc->memc_chipid) {
diff --git a/sys/arch/mvme68k/dev/pcc.c b/sys/arch/mvme68k/dev/pcc.c
index cffe31650c2..45250dac7d7 100644
--- a/sys/arch/mvme68k/dev/pcc.c
+++ b/sys/arch/mvme68k/dev/pcc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcc.c,v 1.13 2004/07/02 17:57:29 miod Exp $ */
+/* $OpenBSD: pcc.c,v 1.14 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -149,7 +149,7 @@ pccattach(parent, self, args)
sc->sc_nmiih.ih_fn = pccabort;
sc->sc_nmiih.ih_ipl = 7;
sc->sc_nmiih.ih_wantframe = 1;
- pccintr_establish(PCCV_ABORT, &sc->sc_nmiih);
+ pccintr_establish(PCCV_ABORT, &sc->sc_nmiih, self->dv_xname);
sc->sc_pcc->pcc_vecbase = PCC_VECBASE;
sc->sc_pcc->pcc_abortirq = PCC_ABORT_IEN | PCC_ABORT_ACK;
@@ -164,15 +164,18 @@ pccattach(parent, self, args)
* PCC interrupts land in a PCC_NVEC sized hole starting at PCC_VECBASE
*/
int
-pccintr_establish(vec, ih)
+pccintr_establish(vec, ih, name)
int vec;
struct intrhand *ih;
+ const char *name;
{
- if (vec >= PCC_NVEC) {
- printf("pcc: illegal vector: 0x%x\n", vec);
- panic("pccintr_establish");
- }
- return (intr_establish(PCC_VECBASE+vec, ih));
+#ifdef DIAGNOSTIC
+ if (vec < 0 || vec >= PCC_NVEC)
+ panic("pccintr_establish: illegal vector for %s: 0x%x",
+ name, vec);
+#endif
+
+ return intr_establish(PCC_VECBASE + vec, ih, name);
}
int
diff --git a/sys/arch/mvme68k/dev/pccreg.h b/sys/arch/mvme68k/dev/pccreg.h
index 2db734e72d4..eea8f9126d4 100644
--- a/sys/arch/mvme68k/dev/pccreg.h
+++ b/sys/arch/mvme68k/dev/pccreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pccreg.h,v 1.6 2003/06/02 05:09:14 deraadt Exp $ */
+/* $OpenBSD: pccreg.h,v 1.7 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -147,7 +147,7 @@ extern struct pccreg *sys_pcc;
#define ZS1_PHYS_147 (INTIOBASE_147 + 0x3800)
/* XXX */
-int pccintr_establish(int vec, struct intrhand *ih);
+int pccintr_establish(int, struct intrhand *, const char *);
int pccspeed(struct pccreg *);
#define PCC_GENCTL_IEN 0x10
diff --git a/sys/arch/mvme68k/dev/pcctwo.c b/sys/arch/mvme68k/dev/pcctwo.c
index dbb4089d6b9..7abf48ccfa8 100644
--- a/sys/arch/mvme68k/dev/pcctwo.c
+++ b/sys/arch/mvme68k/dev/pcctwo.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: pcctwo.c,v 1.13 2004/07/02 17:57:29 miod Exp $ */
+/* $OpenBSD: pcctwo.c,v 1.14 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -159,13 +159,16 @@ pcctwoattach(parent, self, args)
* PCC2 interrupts land in a PCC2_NVEC sized hole starting at PCC2_VECBASE
*/
int
-pcctwointr_establish(vec, ih)
+pcctwointr_establish(vec, ih, name)
int vec;
struct intrhand *ih;
+ const char *name;
{
- if (vec >= PCC2_NVEC) {
- printf("pcctwo: illegal vector: 0x%x\n", vec);
- panic("pcctwointr_establish");
- }
- return (intr_establish(PCC2_VECBASE+vec, ih));
+#ifdef DIAGNOSTIC
+ if (vec < 0 || vec >= PCC2_NVEC)
+ panic("pcctwointr_establish: illegal vector for %s: 0x%x",
+ name, vec);
+#endif
+
+ return intr_establish(PCC2_VECBASE + vec, ih, name);
}
diff --git a/sys/arch/mvme68k/dev/pcctworeg.h b/sys/arch/mvme68k/dev/pcctworeg.h
index 74d255d94f4..acf36ee3de0 100644
--- a/sys/arch/mvme68k/dev/pcctworeg.h
+++ b/sys/arch/mvme68k/dev/pcctworeg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcctworeg.h,v 1.5 2003/06/02 05:09:14 deraadt Exp $ */
+/* $OpenBSD: pcctworeg.h,v 1.6 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -144,4 +144,4 @@ extern struct pcctworeg *sys_pcc2;
#define PCC2_SC_INVAL (2 << 6)
#define PCC2_SC_RESV (3 << 6)
-int pcctwointr_establish(int, struct intrhand *);
+int pcctwointr_establish(int, struct intrhand *, const char *);
diff --git a/sys/arch/mvme68k/dev/sbicdma.c b/sys/arch/mvme68k/dev/sbicdma.c
index bde1e079715..7cb03aae52e 100644
--- a/sys/arch/mvme68k/dev/sbicdma.c
+++ b/sys/arch/mvme68k/dev/sbicdma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sbicdma.c,v 1.10 2004/07/02 17:57:29 miod Exp $ */
+/* $OpenBSD: sbicdma.c,v 1.11 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -126,12 +126,12 @@ sbicdmaattach(parent, self, args)
sc->sc_ih.ih_fn = sbicdma_scintr;
sc->sc_ih.ih_arg = sc;
sc->sc_ih.ih_ipl = ca->ca_ipl;
- pccintr_establish(PCCV_SBIC, &sc->sc_ih);
+ pccintr_establish(PCCV_SBIC, &sc->sc_ih, self->dv_xname);
sc->sc_dmaih.ih_fn = sbicdma_dmaintr;
sc->sc_dmaih.ih_arg = sc;
sc->sc_dmaih.ih_ipl = ca->ca_ipl;
- pccintr_establish(PCCV_DMA, &sc->sc_dmaih);
+ pccintr_establish(PCCV_DMA, &sc->sc_dmaih, self->dv_xname);
sys_pcc->pcc_dmairq = sc->sc_dmaih.ih_ipl | PCC_IRQ_INT;
sys_pcc->pcc_sbicirq = sc->sc_ih.ih_ipl | PCC_SBIC_RESETIRQ;
diff --git a/sys/arch/mvme68k/dev/ssh.c b/sys/arch/mvme68k/dev/ssh.c
index 8e37c655a9a..13a5d744f70 100644
--- a/sys/arch/mvme68k/dev/ssh.c
+++ b/sys/arch/mvme68k/dev/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.10 2004/07/30 09:50:15 miod Exp $ */
+/* $OpenBSD: ssh.c,v 1.11 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch
@@ -46,7 +46,6 @@
#include <sys/dkstat.h>
#include <sys/buf.h>
#include <sys/malloc.h>
-#include <sys/evcount.h>
#include <scsi/scsi_all.h>
#include <scsi/scsiconf.h>
diff --git a/sys/arch/mvme68k/dev/sshdma.c b/sys/arch/mvme68k/dev/sshdma.c
index 1279a3040fe..2d14a9fc8c3 100644
--- a/sys/arch/mvme68k/dev/sshdma.c
+++ b/sys/arch/mvme68k/dev/sshdma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshdma.c,v 1.10 2004/07/30 09:50:15 miod Exp $ */
+/* $OpenBSD: sshdma.c,v 1.11 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -37,7 +37,6 @@
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/device.h>
-#include <sys/evcount.h>
#include <scsi/scsi_all.h>
#include <scsi/scsiconf.h>
@@ -158,21 +157,18 @@ void *auxp;
switch (ca->ca_bustype) {
#if NMC > 0
case BUS_MC:
- mcintr_establish(MCV_NCR, &sc->sc_ih);
+ mcintr_establish(MCV_NCR, &sc->sc_ih, self->dv_xname);
sys_mc->mc_ncrirq = ca->ca_ipl | MC_IRQ_IEN;
break;
#endif
#if NPCCTWO > 0
case BUS_PCCTWO:
- pcctwointr_establish(PCC2V_NCR, &sc->sc_ih);
+ pcctwointr_establish(PCC2V_NCR, &sc->sc_ih, self->dv_xname);
sys_pcc2->pcc2_ncrirq = ca->ca_ipl | PCC2_IRQ_IEN;
break;
#endif
}
- evcount_attach(&sc->sc_intrcnt, self->dv_xname,
- (void *)&sc->sc_ih.ih_ipl, &evcount_intr);
-
/*
* attach all scsi units on us, watching for boot device
* (see dk_establish).
@@ -208,7 +204,6 @@ afsc_dmaintr(arg)
sc->sc_dstat = rp->ssh_dstat;
sc->sc_sstat0 = rp->ssh_sstat0;
sshintr(sc);
- sc->sc_intrcnt.ec_count++;
return (1);
}
diff --git a/sys/arch/mvme68k/dev/sshvar.h b/sys/arch/mvme68k/dev/sshvar.h
index 87cff1a2c1b..9160fc30d55 100644
--- a/sys/arch/mvme68k/dev/sshvar.h
+++ b/sys/arch/mvme68k/dev/sshvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshvar.h,v 1.4 2004/07/30 09:50:15 miod Exp $ */
+/* $OpenBSD: sshvar.h,v 1.5 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -121,7 +121,6 @@ struct ssh_tinfo {
struct ssh_softc {
struct device sc_dev;
struct intrhand sc_ih;
- struct evcount sc_intrcnt;
u_char sc_istat;
u_char sc_dstat;
diff --git a/sys/arch/mvme68k/dev/vme.c b/sys/arch/mvme68k/dev/vme.c
index fa8674b84ce..58acfcc1733 100644
--- a/sys/arch/mvme68k/dev/vme.c
+++ b/sys/arch/mvme68k/dev/vme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vme.c,v 1.21 2004/07/02 18:02:13 miod Exp $ */
+/* $OpenBSD: vme.c,v 1.22 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -391,9 +391,10 @@ vmeattach(parent, self, args)
* interrupt. If you share you will lose.
*/
int
-vmeintr_establish(vec, ih)
+vmeintr_establish(vec, ih, name)
int vec;
struct intrhand *ih;
+ const char *name;
{
struct vmesoftc *sc = (struct vmesoftc *) vme_cd.cd_devs[0];
#if NPCC > 0
@@ -404,7 +405,7 @@ vmeintr_establish(vec, ih)
#endif
int x;
- x = (intr_establish(vec, ih));
+ x = intr_establish(vec, ih, name);
switch (vmebustype) {
#if NPCC > 0
@@ -506,7 +507,7 @@ vme2chip_init(sc)
sc->sc_abih.ih_ipl = 7;
sc->sc_abih.ih_wantframe = 1;
- intr_establish(110, &sc->sc_abih); /* XXX 110 */
+ intr_establish(110, &sc->sc_abih, sc->sc_dev.dv_xname); /* XXX 110 */
vme2->vme2_irqen |= VME2_IRQ_AB;
}
#endif
diff --git a/sys/arch/mvme68k/dev/vme.h b/sys/arch/mvme68k/dev/vme.h
index bd97ca4a6f9..171b1a67cd0 100644
--- a/sys/arch/mvme68k/dev/vme.h
+++ b/sys/arch/mvme68k/dev/vme.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vme.h,v 1.10 2004/04/24 21:09:36 miod Exp $ */
+/* $OpenBSD: vme.h,v 1.11 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -333,5 +333,5 @@ void * vmemap(struct vmesoftc *sc, void * vmeaddr, int len,
int bustype);
int vmerw(struct vmesoftc *sc, struct uio *uio, int flags, int bus);
-int vmeintr_establish(int, struct intrhand *);
+int vmeintr_establish(int, struct intrhand *, const char *);
int vmescan(struct device *, void *, void *, int);
diff --git a/sys/arch/mvme68k/dev/vs.c b/sys/arch/mvme68k/dev/vs.c
index 64ddb0b89ce..fe9c4644dd8 100644
--- a/sys/arch/mvme68k/dev/vs.c
+++ b/sys/arch/mvme68k/dev/vs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vs.c,v 1.17 2004/07/30 09:50:15 miod Exp $ */
+/* $OpenBSD: vs.c,v 1.18 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 1999 Steve Murphree, Jr.
@@ -44,7 +44,6 @@
#include <sys/dkstat.h>
#include <sys/buf.h>
#include <sys/malloc.h>
-#include <sys/evcount.h>
#include <scsi/scsi_all.h>
#include <scsi/scsiconf.h>
diff --git a/sys/arch/mvme68k/dev/vsdma.c b/sys/arch/mvme68k/dev/vsdma.c
index 8c7586584e4..31d6f1ca22c 100644
--- a/sys/arch/mvme68k/dev/vsdma.c
+++ b/sys/arch/mvme68k/dev/vsdma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vsdma.c,v 1.8 2004/07/30 09:50:15 miod Exp $ */
+/* $OpenBSD: vsdma.c,v 1.9 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 1999 Steve Murphree, Jr.
* All rights reserved.
@@ -42,7 +42,6 @@
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/device.h>
-#include <sys/evcount.h>
#include <scsi/scsi_all.h>
#include <scsi/scsiconf.h>
@@ -124,15 +123,11 @@ vsattach(parent, self, auxp)
vs_initialize(sc);
- vmeintr_establish(sc->sc_nvec, &sc->sc_ih_n);
- vmeintr_establish(sc->sc_evec, &sc->sc_ih_e);
-
- evcount_attach(&sc->sc_intrcnt_n, self->dv_xname,
- (void *)&sc->sc_ih_n.ih_ipl, &evcount_intr);
snprintf(sc->sc_intrname_e, sizeof sc->sc_intrname_e,
"%s_err", self->dv_xname);
- evcount_attach(&sc->sc_intrcnt_e, self->dv_xname,
- (void *)&sc->sc_ih_e.ih_ipl, &evcount_intr);
+
+ vmeintr_establish(sc->sc_nvec, &sc->sc_ih_n, self->dv_xname);
+ vmeintr_establish(sc->sc_evec, &sc->sc_ih_e, sc->sc_intrname_e);
/*
* attach all scsi units on us, watching for boot device
@@ -169,7 +164,6 @@ vs_nintr(arg)
printf("Normal Interrupt!!!\n");
#endif
vs_intr(sc);
- sc->sc_intrcnt_n.ec_count++;
return (1);
}
@@ -184,7 +178,6 @@ vs_eintr(arg)
printf("Error Interrupt!!!\n");
#endif
vs_intr(sc);
- sc->sc_intrcnt_e.ec_count++;
return (1);
}
diff --git a/sys/arch/mvme68k/dev/vsvar.h b/sys/arch/mvme68k/dev/vsvar.h
index 719b7664d2c..a0f8b44c1c3 100644
--- a/sys/arch/mvme68k/dev/vsvar.h
+++ b/sys/arch/mvme68k/dev/vsvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vsvar.h,v 1.5 2004/07/30 09:50:15 miod Exp $ */
+/* $OpenBSD: vsvar.h,v 1.6 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 1999 Steve Murphree, Jr.
* Copyright (c) 1990 The Regents of the University of California.
@@ -61,7 +61,6 @@ struct vs_tinfo {
struct vs_softc {
struct device sc_dev;
struct intrhand sc_ih_e, sc_ih_n;
- struct evcount sc_intrcnt_e, sc_intrcnt_n;
char sc_intrname_e[16 + 4];
u_short sc_ipl;
u_short sc_evec;
diff --git a/sys/arch/mvme68k/dev/wdsc.c b/sys/arch/mvme68k/dev/wdsc.c
index d598f6f7417..2eb6cad82b9 100644
--- a/sys/arch/mvme68k/dev/wdsc.c
+++ b/sys/arch/mvme68k/dev/wdsc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wdsc.c,v 1.10 2004/07/02 17:57:29 miod Exp $ */
+/* $OpenBSD: wdsc.c,v 1.11 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 1996 Steve Woodford
@@ -58,17 +58,17 @@ extern void sbicinit(struct sbic_softc *);
extern int sbicintr(struct sbic_softc *);
struct scsi_adapter wdsc_scsiswitch = {
- sbic_scsicmd,
- sbic_minphys,
- 0, /* no lun support */
- 0, /* no lun support */
+ sbic_scsicmd,
+ sbic_minphys,
+ 0, /* no lun support */
+ 0, /* no lun support */
};
struct scsi_device wdsc_scsidev = {
- NULL, /* use default error handler */
- NULL, /* do not have a start functio */
- NULL, /* have no async handler */
- NULL, /* Use default done routine */
+ NULL, /* use default error handler */
+ NULL, /* do not have a start function */
+ NULL, /* have no async handler */
+ NULL, /* Use default done routine */
};
struct cfattach wdsc_ca = {
@@ -91,14 +91,14 @@ int shift_nosync = 0;
*/
int
wdscmatch(pdp, cdp, auxp)
- struct device *pdp;
- struct cfdata *cdp;
- void *auxp;
+ struct device *pdp;
+ struct cfdata *cdp;
+ void *auxp;
{
- /*
- * Match everything
- */
- return(1);
+ /*
+ * Match everything
+ */
+ return(1);
}
@@ -106,77 +106,76 @@ wdscmatch(pdp, cdp, auxp)
* Attach the wdsc driver
*/
void
-wdscattach(pdp, dp, auxp)
- struct device *pdp, *dp;
- void *auxp;
+wdscattach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
{
- struct sbic_softc *sc = (struct sbic_softc *)dp;
- struct confargs *ca = auxp;
- int tmp;
-
- sc->sc_enintr = wdsc_enintr;
- sc->sc_dmago = wdsc_dmago;
- sc->sc_dmanext = wdsc_dmanext;
- sc->sc_dmastop = wdsc_dmastop;
- sc->sc_dmacmd = 0;
-
- sc->sc_link.adapter_softc = sc;
- sc->sc_link.adapter_target = 7;
- sc->sc_link.adapter = &wdsc_scsiswitch;
- sc->sc_link.device = &wdsc_scsidev;
- sc->sc_link.openings = 2;
-
- printf(": target %d\n", sc->sc_link.adapter_target);
-
- sc->sc_sbicp = (sbic_regmap_p)ca->ca_vaddr;
-
- /*
- * Eveything is a valid dma address.
- *
- */
- sc->sc_dmamask = 0;
-
- /*
- * The onboard WD33C93 of the '147 is usually clocked at 10MHz...
- * (We use 10 times this for accuracy in later calculations)
- */
- sc->sc_clkfreq = 100;
-
- /*
- * Initialise the hardware
- */
- sbicinit(sc);
-
- sc->sc_ipl = ca->ca_ipl;
-
- sys_pcc->pcc_sbicirq = ca->ca_ipl | PCC_IRQ_INT;
- sys_pcc->pcc_dmairq = ca->ca_ipl | PCC_IRQ_INT;
- sys_pcc->pcc_dmacsr = 0;
-
- /*
- * Fix up the interrupts
- */
- sc->sc_dmaih.ih_fn = wdsc_dmaintr;
- sc->sc_dmaih.ih_arg = sc;
- sc->sc_dmaih.ih_ipl = ca->ca_ipl;
- pccintr_establish(PCCV_DMA, &sc->sc_dmaih);
-
- sc->sc_sbicih.ih_fn = wdsc_scsiintr;
- sc->sc_sbicih.ih_arg = sc;
- sc->sc_sbicih.ih_ipl = ca->ca_ipl;
- pccintr_establish(PCCV_SBIC, &sc->sc_sbicih);
-
- sys_pcc->pcc_sbicirq = ca->ca_ipl | PCC_IRQ_IEN | PCC_IRQ_INT;
-
- /*
- * Attach all scsi units on us, watching for boot device
- * (see dk_establish).
- */
- tmp = bootpart;
- if (ca->ca_paddr != bootaddr)
- bootpart = -1; /* invalid flag to dk_establish */
- config_found(dp, &sc->sc_link, scsiprint);
- bootpart = tmp; /* restore old value */
+ struct sbic_softc *sc = (struct sbic_softc *)self;
+ struct confargs *ca = aux;
+ int tmp;
+
+ sc->sc_enintr = wdsc_enintr;
+ sc->sc_dmago = wdsc_dmago;
+ sc->sc_dmanext = wdsc_dmanext;
+ sc->sc_dmastop = wdsc_dmastop;
+ sc->sc_dmacmd = 0;
+
+ sc->sc_link.adapter_softc = sc;
+ sc->sc_link.adapter_target = 7;
+ sc->sc_link.adapter = &wdsc_scsiswitch;
+ sc->sc_link.device = &wdsc_scsidev;
+ sc->sc_link.openings = 2;
+
+ printf(": SCSI ID %d\n", sc->sc_link.adapter_target);
+
+ sc->sc_sbicp = (sbic_regmap_p)ca->ca_vaddr;
+
+ /*
+ * Everything is a valid dma address.
+ */
+ sc->sc_dmamask = 0;
+
+ /*
+ * The onboard WD33C93 of the '147 is usually clocked at 10MHz...
+ * (We use 10 times this for accuracy in later calculations)
+ */
+ sc->sc_clkfreq = 100;
+
+ /*
+ * Initialize the hardware
+ */
+ sbicinit(sc);
+
+ sc->sc_ipl = ca->ca_ipl;
+
+ sys_pcc->pcc_sbicirq = ca->ca_ipl | PCC_IRQ_INT;
+ sys_pcc->pcc_dmairq = ca->ca_ipl | PCC_IRQ_INT;
+ sys_pcc->pcc_dmacsr = 0;
+
+ /*
+ * Fix up the interrupts
+ */
+ sc->sc_dmaih.ih_fn = wdsc_dmaintr;
+ sc->sc_dmaih.ih_arg = sc;
+ sc->sc_dmaih.ih_ipl = ca->ca_ipl;
+ pccintr_establish(PCCV_DMA, &sc->sc_dmaih, self->dv_xname);
+
+ sc->sc_sbicih.ih_fn = wdsc_scsiintr;
+ sc->sc_sbicih.ih_arg = sc;
+ sc->sc_sbicih.ih_ipl = ca->ca_ipl;
+ pccintr_establish(PCCV_SBIC, &sc->sc_sbicih, self->dv_xname);
+
+ sys_pcc->pcc_sbicirq = ca->ca_ipl | PCC_IRQ_IEN | PCC_IRQ_INT;
+
+ /*
+ * Attach all scsi units on us, watching for boot device
+ * (see dk_establish).
+ */
+ tmp = bootpart;
+ if (ca->ca_paddr != bootaddr)
+ bootpart = -1;
+ config_found(parent, &sc->sc_link, scsiprint);
+ bootpart = tmp; /* restore old value */
}
/*
@@ -184,11 +183,11 @@ wdscattach(pdp, dp, auxp)
*/
void
wdsc_enintr(dev)
- struct sbic_softc *dev;
+ struct sbic_softc *dev;
{
- dev->sc_flags |= SBICF_INTR;
+ dev->sc_flags |= SBICF_INTR;
- sys_pcc->pcc_dmairq = dev->sc_ipl | PCC_IRQ_IEN | PCC_IRQ_INT;
+ sys_pcc->pcc_dmairq = dev->sc_ipl | PCC_IRQ_IEN | PCC_IRQ_INT;
}
/*
@@ -196,33 +195,33 @@ wdsc_enintr(dev)
*/
int
wdsc_dmago(dev, addr, count, flags)
- struct sbic_softc *dev;
- char *addr;
- int count, flags;
+ struct sbic_softc *dev;
+ char *addr;
+ int count, flags;
{
- /*
- * Set up the command word based on flags
- */
- if ( (flags & DMAGO_READ) == 0 )
- dev->sc_dmacmd = DMAC_CSR_ENABLE | DMAC_CSR_WRITE;
- else
- dev->sc_dmacmd = DMAC_CSR_ENABLE;
-
- dev->sc_flags |= SBICF_INTR;
- dev->sc_tcnt = dev->sc_cur->dc_count << 1;
-
- /*
- * Prime the hardware.
- * Note, it's probably not necessary to do this here, since dmanext
- * is called just prior to the actual transfer.
- */
- sys_pcc->pcc_dmacsr = 0;
- sys_pcc->pcc_dmairq = dev->sc_ipl | PCC_IRQ_IEN | PCC_IRQ_INT;
- sys_pcc->pcc_dmadaddr = (unsigned long)dev->sc_cur->dc_addr;
- sys_pcc->pcc_dmabcnt = (unsigned long)dev->sc_tcnt | (1 << 24);
- sys_pcc->pcc_dmacsr = dev->sc_dmacmd;
-
- return(dev->sc_tcnt);
+ /*
+ * Set up the command word based on flags
+ */
+ if ((flags & DMAGO_READ) == 0)
+ dev->sc_dmacmd = DMAC_CSR_ENABLE | DMAC_CSR_WRITE;
+ else
+ dev->sc_dmacmd = DMAC_CSR_ENABLE;
+
+ dev->sc_flags |= SBICF_INTR;
+ dev->sc_tcnt = dev->sc_cur->dc_count << 1;
+
+ /*
+ * Prime the hardware.
+ * Note, it's probably not necessary to do this here, since dmanext
+ * is called just prior to the actual transfer.
+ */
+ sys_pcc->pcc_dmacsr = 0;
+ sys_pcc->pcc_dmairq = dev->sc_ipl | PCC_IRQ_IEN | PCC_IRQ_INT;
+ sys_pcc->pcc_dmadaddr = (unsigned long)dev->sc_cur->dc_addr;
+ sys_pcc->pcc_dmabcnt = (unsigned long)dev->sc_tcnt | (1 << 24);
+ sys_pcc->pcc_dmacsr = dev->sc_dmacmd;
+
+ return dev->sc_tcnt;
}
/*
@@ -230,29 +229,29 @@ wdsc_dmago(dev, addr, count, flags)
*/
int
wdsc_dmanext(dev)
- struct sbic_softc *dev;
+ struct sbic_softc *dev;
{
- if ( dev->sc_cur > dev->sc_last ) {
- /*
- * Shouldn't happen !!
- */
- printf("wdsc_dmanext at end !!!\n");
- wdsc_dmastop(dev);
- return(0);
- }
-
- dev->sc_tcnt = dev->sc_cur->dc_count << 1;
-
- /*
- * Load the next DMA address
- */
- sys_pcc->pcc_dmacsr = 0;
- sys_pcc->pcc_dmairq = dev->sc_ipl | PCC_IRQ_IEN | PCC_IRQ_INT;
- sys_pcc->pcc_dmadaddr = (unsigned long)dev->sc_cur->dc_addr;
- sys_pcc->pcc_dmabcnt = (unsigned long)dev->sc_tcnt | (1 << 24);
- sys_pcc->pcc_dmacsr = dev->sc_dmacmd;
-
- return(dev->sc_tcnt);
+ if (dev->sc_cur > dev->sc_last) {
+ /*
+ * Shouldn't happen !!
+ */
+ printf("wdsc_dmanext at end !!!\n");
+ wdsc_dmastop(dev);
+ return 0;
+ }
+
+ dev->sc_tcnt = dev->sc_cur->dc_count << 1;
+
+ /*
+ * Load the next DMA address
+ */
+ sys_pcc->pcc_dmacsr = 0;
+ sys_pcc->pcc_dmairq = dev->sc_ipl | PCC_IRQ_IEN | PCC_IRQ_INT;
+ sys_pcc->pcc_dmadaddr = (unsigned long)dev->sc_cur->dc_addr;
+ sys_pcc->pcc_dmabcnt = (unsigned long)dev->sc_tcnt | (1 << 24);
+ sys_pcc->pcc_dmacsr = dev->sc_dmacmd;
+
+ return dev->sc_tcnt;
}
/*
@@ -260,16 +259,16 @@ wdsc_dmanext(dev)
*/
void
wdsc_dmastop(dev)
- struct sbic_softc *dev;
+ struct sbic_softc *dev;
{
- int s;
+ int s;
- s = splbio();
+ s = splbio();
- sys_pcc->pcc_dmacsr = 0;
- sys_pcc->pcc_dmairq = dev->sc_ipl | PCC_IRQ_INT;
+ sys_pcc->pcc_dmacsr = 0;
+ sys_pcc->pcc_dmairq = dev->sc_ipl | PCC_IRQ_INT;
- splx(s);
+ splx(s);
}
/*
@@ -279,26 +278,26 @@ int
wdsc_dmaintr(arg)
void *arg;
{
- struct sbic_softc *dev = (struct sbic_softc *)arg;
- int found = 0;
-
- /*
- * Really a DMA interrupt?
- */
- if ( (sys_pcc->pcc_dmairq & PCC_IRQ_INT) == 0 )
- return(0);
-
- /*
- * Was it a completion interrupt?
- * XXXSCW Note: Support for other DMA interrupts is required, eg. buserr
- */
- if ( sys_pcc->pcc_dmacsr & DMAC_CSR_DONE ) {
- ++found;
-
- sys_pcc->pcc_dmairq = dev->sc_ipl | PCC_IRQ_IEN | PCC_IRQ_INT;
- }
-
- return(found);
+ struct sbic_softc *dev = (struct sbic_softc *)arg;
+ int found = 0;
+
+ /*
+ * Really a DMA interrupt?
+ */
+ if ((sys_pcc->pcc_dmairq & PCC_IRQ_INT) == 0)
+ return 0;
+
+ /*
+ * Was it a completion interrupt?
+ * XXXSCW Note: Support for other DMA interrupts is required, eg. buserr
+ */
+ if (sys_pcc->pcc_dmacsr & DMAC_CSR_DONE) {
+ ++found;
+
+ sys_pcc->pcc_dmairq = dev->sc_ipl | PCC_IRQ_IEN | PCC_IRQ_INT;
+ }
+
+ return found;
}
/*
@@ -308,24 +307,24 @@ int
wdsc_scsiintr(arg)
void *arg;
{
- struct sbic_softc *dev = (struct sbic_softc *)arg;
- int found;
-
- /*
- * Really a SCSI interrupt?
- */
- if ( (sys_pcc->pcc_sbicirq & PCC_IRQ_INT) == 0 )
- return(0);
-
- /*
- * Go handle it
- */
- found = sbicintr(dev);
-
- /*
- * Acknowledge and clear the interrupt
- */
- sys_pcc->pcc_sbicirq = dev->sc_ipl | PCC_IRQ_IEN | PCC_IRQ_INT;
-
- return(found);
+ struct sbic_softc *dev = (struct sbic_softc *)arg;
+ int found;
+
+ /*
+ * Really a SCSI interrupt?
+ */
+ if ((sys_pcc->pcc_sbicirq & PCC_IRQ_INT) == 0)
+ return 0;
+
+ /*
+ * Go handle it
+ */
+ found = sbicintr(dev);
+
+ /*
+ * Acknowledge and clear the interrupt
+ */
+ sys_pcc->pcc_sbicirq = dev->sc_ipl | PCC_IRQ_IEN | PCC_IRQ_INT;
+
+ return found;
}
diff --git a/sys/arch/mvme68k/dev/wl.c b/sys/arch/mvme68k/dev/wl.c
index a4026a66b04..80bc8e6b513 100644
--- a/sys/arch/mvme68k/dev/wl.c
+++ b/sys/arch/mvme68k/dev/wl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wl.c,v 1.16 2004/07/30 09:50:15 miod Exp $ */
+/* $OpenBSD: wl.c,v 1.17 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 1995 Dale Rahn. All rights reserved.
@@ -33,7 +33,6 @@
#include <sys/time.h>
#include <sys/device.h>
#include <sys/syslog.h>
-#include <sys/evcount.h>
#include <machine/autoconf.h>
#include <machine/conf.h>
@@ -114,11 +113,8 @@ struct cl_info {
struct wlsoftc {
struct device sc_dev;
- struct evcount sc_txintrcnt;
char sc_txintrname[16 + 3];
- struct evcount sc_rxintrcnt;
char sc_rxintrname[16 + 3];
- struct evcount sc_mxintrcnt;
char sc_mxintrname[16 + 3];
time_t sc_rotime; /* time of last ring overrun */
@@ -330,23 +326,17 @@ wlattach(parent, self, aux)
sc->sc_ih_r.ih_ipl = ca->ca_ipl;
sc->sc_ih_r.ih_wantframe = 0;
- vmeintr_establish(ca->ca_vec + 0, &sc->sc_ih_e);
- vmeintr_establish(ca->ca_vec + 1, &sc->sc_ih_m);
- vmeintr_establish(ca->ca_vec + 2, &sc->sc_ih_t);
- vmeintr_establish(ca->ca_vec + 3, &sc->sc_ih_r);
-
snprintf(sc->sc_txintrname, sizeof sc->sc_txintrname,
"%s_tx", self->dv_xname);
- evcount_attach(&sc->sc_txintrcnt, sc->sc_txintrname,
- (void *)&sc->sc_ih_t.ih_ipl, &evcount_intr);
snprintf(sc->sc_rxintrname, sizeof sc->sc_rxintrname,
"%s_rx", self->dv_xname);
- evcount_attach(&sc->sc_rxintrcnt, sc->sc_rxintrname,
- (void *)&sc->sc_ih_r.ih_ipl, &evcount_intr);
snprintf(sc->sc_mxintrname, sizeof sc->sc_mxintrname,
"%s_mx", self->dv_xname);
- evcount_attach(&sc->sc_mxintrcnt, sc->sc_mxintrname,
- (void *)&sc->sc_ih_m.ih_ipl, &evcount_intr);
+
+ vmeintr_establish(ca->ca_vec + 0, &sc->sc_ih_e, sc->sc_rxintrname);
+ vmeintr_establish(ca->ca_vec + 1, &sc->sc_ih_m, sc->sc_mxintrname);
+ vmeintr_establish(ca->ca_vec + 2, &sc->sc_ih_t, sc->sc_txintrname);
+ vmeintr_establish(ca->ca_vec + 3, &sc->sc_ih_r, sc->sc_rxintrname);
p = sc->sc_memkv;
s = splhigh();
@@ -1136,8 +1126,6 @@ cl_mintr(sc)
printf("stk 0x%x mir 0x%x chan 0x%x\n",
sc->cl_reg->cl_stk, mir, channel);
- sc->sc_mxintrcnt.ec_count++;
-
if (misr & MISR_TIMER1) {
/* timers are not currently used?? */
log(LOG_WARNING, "cl_mintr: channel %x timer 1 unexpected\n",channel);
@@ -1194,7 +1182,6 @@ cl_txintr(sc)
printf("stk 0x%x tir 0x%x chan 0x%x cmr 0x%x tisr 0x%x tftc 0x%x\n",
sc->cl_reg->cl_stk, tir, chan, cmr, tisr, tftc);
- sc->sc_txintrcnt.ec_count++;
sc->sc_cl[chan].txcnt++;
tp = sc->sc_cl[chan].tty;
@@ -1269,7 +1256,6 @@ cl_rxintr(sc)
/*printf("stk 0x%x rir 0x%x chan 0x%x cmr 0x%x risrl 0x%x\n",
sc->cl_reg->cl_stk, rir, chan, cmr, risrl);*/
- sc->sc_rxintrcnt.ec_count++;
sc->sc_cl[chan].rxcnt++;
if (risrl & RISRL_TIMEOUT) {
diff --git a/sys/arch/mvme68k/dev/zs.c b/sys/arch/mvme68k/dev/zs.c
index e9ee1e689b7..a8e0562529c 100644
--- a/sys/arch/mvme68k/dev/zs.c
+++ b/sys/arch/mvme68k/dev/zs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zs.c,v 1.17 2004/07/30 09:50:15 miod Exp $ */
+/* $OpenBSD: zs.c,v 1.18 2004/07/30 22:29:45 miod Exp $ */
/*
* Copyright (c) 2000 Steve Murphree, Jr.
@@ -40,7 +40,6 @@
#include <sys/syslog.h>
#include <sys/fcntl.h>
#include <sys/device.h>
-#include <sys/evcount.h>
#include <machine/autoconf.h>
#include <machine/conf.h>
@@ -109,7 +108,6 @@ struct zs {
struct zssoftc {
struct device sc_dev;
struct zs sc_zs[2];
- struct evcount sc_intrcnt;
struct intrhand sc_ih;
int sc_flags;
};
@@ -216,7 +214,7 @@ zsattach(parent, self, args)
switch (ca->ca_bustype) {
#if NPCC > 0
case BUS_PCC:
- pccintr_establish(PCCV_ZS, &sc->sc_ih);
+ pccintr_establish(PCCV_ZS, &sc->sc_ih, self->dv_xname);
break;
#endif
#if NMC > 0
@@ -228,7 +226,7 @@ zsattach(parent, self, args)
* mc_rev1_bug - XXX smurph
*/
mc_rev1_bug = 1; /* defined in scc.h */
- mcintr_establish(MCV_ZS, &sc->sc_ih);
+ mcintr_establish(MCV_ZS, &sc->sc_ih, self->dv_xname);
break;
#endif
}
@@ -303,9 +301,6 @@ zsattach(parent, self, args)
#endif
}
initirq = 1;
-
- evcount_attach(&sc->sc_intrcnt, self->dv_xname,
- (void *)&sc->sc_ih.ih_ipl, &evcount_intr);
}
void
@@ -780,7 +775,6 @@ zsirq(arg)
zs_extint(zp);
ZWRITE0(&zp->scc, 0x38); /* reset highest IUS */
- sc->sc_intrcnt.ec_count++;
return (1);
}
diff --git a/sys/arch/mvme68k/include/cpu.h b/sys/arch/mvme68k/include/cpu.h
index 5f3aeb08da3..f9770cac365 100644
--- a/sys/arch/mvme68k/include/cpu.h
+++ b/sys/arch/mvme68k/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.18 2004/06/13 21:49:18 niklas Exp $ */
+/* $OpenBSD: cpu.h,v 1.19 2004/07/30 22:29:48 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -91,6 +91,7 @@
* Get interrupt glue.
*/
#include <machine/intr.h>
+#include <sys/evcount.h>
/*
* definitions of cpu-dependent requirements
@@ -175,26 +176,24 @@ extern int iiomapsize;
extern int cputyp;
#define CPU_147 0x147
#define CPU_162 0x162
+#define CPU_165 0x165
#define CPU_166 0x166
#define CPU_167 0x167
#define CPU_172 0x172
#define CPU_177 0x177
struct intrhand {
- struct intrhand *ih_next;
+ SLIST_ENTRY(intrhand) ih_link;
int (*ih_fn)(void *);
void *ih_arg;
int ih_ipl;
int ih_wantframe;
+ struct evcount ih_count;
};
-int intr_establish(int, struct intrhand *);
+int intr_establish(int, struct intrhand *, const char *);
-struct haltvec {
- struct haltvec *hv_next;
- void (*hv_fn)(void);
- int hv_pri;
-};
+#define NVMEINTR 256
struct frame;
struct fpframe;
diff --git a/sys/arch/mvme68k/mvme68k/autoconf.c b/sys/arch/mvme68k/mvme68k/autoconf.c
index ab7605e7cb2..3bbdb2f48b0 100644
--- a/sys/arch/mvme68k/mvme68k/autoconf.c
+++ b/sys/arch/mvme68k/mvme68k/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.26 2004/07/02 17:34:23 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.27 2004/07/30 22:29:48 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -94,7 +94,7 @@ int findblkmajor(struct device *);
struct device *getdisk(char *, int, int, dev_t *);
struct device *parsedisk(char *, int, int, dev_t *);
-extern void init_sir(void);
+extern void init_intrs(void);
extern void dumpconf(void);
/*
@@ -182,7 +182,7 @@ cpu_configure()
{
bootdv = NULL; /* set by device drivers (if found) */
- init_sir();
+ init_intrs();
extio = extent_create("extio",
(u_long)extiobase, (u_long)extiobase + ctob(EIOMAPSIZE),
diff --git a/sys/arch/mvme68k/mvme68k/machdep.c b/sys/arch/mvme68k/mvme68k/machdep.c
index 921a2b8579b..0c9a6d43838 100644
--- a/sys/arch/mvme68k/mvme68k/machdep.c
+++ b/sys/arch/mvme68k/mvme68k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.85 2004/07/30 09:50:18 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.86 2004/07/30 22:29:48 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -193,7 +193,6 @@ void initvectors(void);
void mvme68k_init(void);
void identifycpu(void);
int cpu_sysctl(int *, u_int, void *, size_t *, void *, size_t, struct proc *);
-void halt_establish(void (*)(void), int);
void dumpconf(void);
void straytrap(int, u_short);
void netintr(void *);
@@ -657,54 +656,6 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
int waittime = -1;
-static struct haltvec *halts;
-
-/* XXX insert by priority */
-void
-halt_establish(fn, pri)
- void (*fn)(void);
- int pri;
-{
- struct haltvec *hv, *h;
-
- hv = (struct haltvec *)malloc(sizeof(*hv), M_TEMP, M_NOWAIT);
- if (hv == NULL)
- return;
- hv->hv_fn = fn;
- hv->hv_pri = pri;
- hv->hv_next = NULL;
-
- /* put higher priorities earlier in the list */
- h = halts;
- if (h == NULL) {
- halts = hv;
- return;
- }
-
- if (h->hv_pri < pri) {
- /* higher than first element */
- hv->hv_next = halts;
- halts = hv;
- return;
- }
-
- while (h) {
- if (h->hv_next == NULL) {
- /* no more elements, must be the lowest priority */
- h->hv_next = hv;
- return;
- }
-
- if (h->hv_next->hv_pri < pri) {
- /* next element is lower */
- hv->hv_next = h->hv_next;
- h->hv_next = hv;
- return;
- }
- h = h->hv_next;
- }
-}
-
__dead void
boot(howto)
int howto;
@@ -755,10 +706,6 @@ haltsys:
if (howto & RB_HALT) {
printf("halted\n\n");
} else {
- struct haltvec *hv;
-
- for (hv = halts; hv; hv = hv->hv_next)
- (*hv->hv_fn)();
doboot();
}
for (;;);
@@ -1002,8 +949,8 @@ straytrap(pc, evec)
int pc;
u_short evec;
{
- printf("unexpected trap (vector %d) from %x\n",
- (evec & 0xFFF) >> 2, pc);
+ printf("unexpected trap (vector 0x%x) from %x\n",
+ (evec & 0xFFF) >> 2, pc);
}
int *nofault;
diff --git a/sys/arch/mvme68k/mvme68k/trap.c b/sys/arch/mvme68k/mvme68k/trap.c
index 6a970019eb1..396373cb3b9 100644
--- a/sys/arch/mvme68k/mvme68k/trap.c
+++ b/sys/arch/mvme68k/mvme68k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.54 2004/04/18 20:19:52 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.55 2004/07/30 22:29:49 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -165,7 +165,7 @@ u_char next_sir;
void trap(int, u_int, u_int, struct frame);
void syscall(register_t, struct frame);
-void init_sir(void);
+void init_intrs(void);
void hardintr(int, int, void *);
int writeback(struct frame *fp, int docachepush);
@@ -244,7 +244,7 @@ again:
/*
* Trap is called from locore to handle most types of processor traps,
* including events such as simulated software interrupts/AST's.
- * System calls are broken out for efficiency. T_ADDRERR
+ * System calls are broken out for efficiency.
*/
/*ARGSUSED*/
void
@@ -1156,23 +1156,25 @@ allocate_sir(proc, arg)
return (1 << bit);
}
+typedef SLIST_HEAD(,intrhand) intrhand_t;
+intrhand_t intrs[NVMEINTR];
+
void
-init_sir()
+init_intrs()
{
+ int i;
extern void netintr(void *);
+ /* hard interrupts... */
+ for (i = 0; i < NVMEINTR; i++)
+ SLIST_INIT(&intrs[i]);
+
+ /* soft interrupts... */
sir_routines[0] = netintr;
sir_routines[1] = (void (*)(void *))softclock;
next_sir = 2;
}
-struct intrhand *intrs[256];
-
-/*
- * XXX
- * This is an EXTREMELY good candidate for rewriting in assembly!!
- */
-#ifndef INTR_ASM
void
hardintr(pc, evec, frame)
int pc;
@@ -1183,28 +1185,31 @@ hardintr(pc, evec, frame)
int vec = (evec & 0xfff) >> 2; /* XXX should be m68k macro? */
/*extern u_long intrcnt[];*/ /* XXX from locore */
struct intrhand *ih;
+ intrhand_t *list;
int count = 0;
int r;
uvmexp.intrs++;
/* intrcnt[level]++; */
- for (ih = intrs[vec]; ih; ih = ih->ih_next) {
-#if 0
- if (vec >= 0x70 && vec <= 0x73) {
- zscnputc(0, '[');
- zscnputc(0, '0' + (vec - 0x70));
+
+ list = &intrs[vec];
+ if (SLIST_EMPTY(list)) {
+ straytrap(pc, evec);
+ } else {
+ SLIST_FOREACH(ih, list, ih_link) {
+ r = (*ih->ih_fn)(ih->ih_wantframe ? frame : ih->ih_arg);
+ if (r != 0) {
+ ih->ih_count.ec_count++;
+ count++;
+ }
}
-#endif
- r = (*ih->ih_fn)(ih->ih_wantframe ? frame : ih->ih_arg);
- if (r > 0)
- count++;
- }
- if (count != 0)
- return;
- straytrap(pc, evec);
+ if (count == 0) {
+ printf("Unclaimed interrupt (vector %d) from %x\n",
+ evec, pc);
+ }
+ }
}
-#endif /* !INTR_ASM */
/*
* find a useable interrupt vector in the range start, end. It starts at
@@ -1218,7 +1223,7 @@ intr_findvec(start, end)
extern u_long *vectab[], hardtrap, badtrap;
int vec;
- if (start < 0 || end > 255 || start > end)
+ if (start < 0 || end >= NVMEINTR || start > end)
return (-1);
for (vec = end; vec > start; --vec)
if (vectab[vec] == &badtrap || vectab[vec] == &hardtrap)
@@ -1233,28 +1238,45 @@ intr_findvec(start, end)
* allocated to deal with chained interrupt handlers).
*/
int
-intr_establish(vec, ih)
+intr_establish(vec, ih, name)
int vec;
struct intrhand *ih;
+ const char *name;
{
extern u_long *vectab[], hardtrap, badtrap;
- struct intrhand *ihx;
+ struct intrhand *intr;
+ intrhand_t *list;
+
+#ifdef DIAGNOSTIC
+ if (vec < 0 || vec >= NVMEINTR) {
+ panic("intr_establish: vec (0x%x) out of bounds", vec);
+ return (-1);
+ }
+#endif
if (vectab[vec] != &badtrap && vectab[vec] != &hardtrap) {
- printf("intr_establish: vec %d unavailable\n", vec);
+#ifdef DIAGNOSTIC
+ panic("intr_establish: vec (%x) unavailable for devices", vec);
+#endif
return (-1);
}
vectab[vec] = &hardtrap;
- ih->ih_next = NULL; /* just in case */
+ list = &intrs[vec];
+ if (!SLIST_EMPTY(list)) {
+ intr = SLIST_FIRST(list);
+ if (intr->ih_ipl != ih->ih_ipl) {
+#ifdef DIAGNOSTIC
+ panic("intr_establish: there are other handlers with "
+ "vec (0x%x) at ipl %x, but you want it at %x",
+ vec, intr->ih_ipl, ih->ih_ipl);
+#endif
+ return (-1);
+ }
+ }
- /* attach at tail */
- if ((ihx = intrs[vec])) {
- while (ihx->ih_next)
- ihx = ihx->ih_next;
- ihx->ih_next = ih;
- } else
- intrs[vec] = ih;
+ evcount_attach(&ih->ih_count, name, &ih->ih_ipl, &evcount_intr);
+ SLIST_INSERT_HEAD(list, ih, ih_link);
return (0);
}