summaryrefslogtreecommitdiff
path: root/sys/arch/hp300
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2001-05-01 16:51:11 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2001-05-01 16:51:11 +0000
commite6700178859f7c12ca3ca6223f8890b62c03e5c2 (patch)
tree3606a37015a96d78af7694a8d7340afdd1b0de8c /sys/arch/hp300
parent61ce39031c354943763c896117ea06630bc3f0f4 (diff)
convert to new timeouts
Diffstat (limited to 'sys/arch/hp300')
-rw-r--r--sys/arch/hp300/dev/apci.c11
-rw-r--r--sys/arch/hp300/dev/dma.c11
-rw-r--r--sys/arch/hp300/dev/fhpib.c19
-rw-r--r--sys/arch/hp300/dev/hd.c9
-rw-r--r--sys/arch/hp300/dev/hdvar.h3
-rw-r--r--sys/arch/hp300/dev/ite.c4
-rw-r--r--sys/arch/hp300/dev/mt.c20
-rw-r--r--sys/arch/hp300/dev/nhpib.c15
-rw-r--r--sys/arch/hp300/dev/ppi.c19
9 files changed, 78 insertions, 33 deletions
diff --git a/sys/arch/hp300/dev/apci.c b/sys/arch/hp300/dev/apci.c
index f43514d25ee..571fb98f588 100644
--- a/sys/arch/hp300/dev/apci.c
+++ b/sys/arch/hp300/dev/apci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apci.c,v 1.3 1997/09/14 03:43:01 downsj Exp $ */
+/* $OpenBSD: apci.c,v 1.4 2001/05/01 16:51:08 millert Exp $ */
/* $NetBSD: apci.c,v 1.1 1997/05/12 08:12:36 thorpej Exp $ */
/*
@@ -69,6 +69,7 @@
#include <sys/kernel.h>
#include <sys/syslog.h>
#include <sys/device.h>
+#include <sys/timeout.h>
#include <machine/autoconf.h>
#include <machine/cpu.h>
@@ -89,6 +90,7 @@ struct apci_softc {
struct device sc_dev; /* generic device glue */
struct apciregs *sc_apci; /* device registers */
struct tty *sc_tty; /* tty glue */
+ struct timeout sc_timeout; /* timeout */
int sc_ferr,
sc_perr,
sc_oflow,
@@ -227,6 +229,9 @@ apciattach(parent, self, aux)
frodo_intr_establish(parent, apciintr, sc, fa->fa_line,
(sc->sc_flags & APCI_HASFIFO) ? IPL_TTY : IPL_TTYNOBUF);
+ /* Initialize timeout structure */
+ timeout_set(&sc->sc_timeout, apcitimeout, sc);
+
/* Set soft carrier if requested by operator. */
if (self->dv_cfdata->cf_flags)
sc->sc_flags |= APCI_SOFTCAR;
@@ -368,7 +373,7 @@ apciopen(dev, flag, mode, p)
if (error == 0) {
/* clear errors, start timeout */
sc->sc_ferr = sc->sc_perr = sc->sc_oflow = sc->sc_toterr = 0;
- timeout(apcitimeout, sc, hz);
+ timeout_add(&sc->sc_timeout, hz);
}
return (error);
@@ -876,7 +881,7 @@ apcitimeout(arg)
sc->sc_dev.dv_xname, ferr, perr, oflow, sc->sc_toterr);
}
- timeout(apcitimeout, sc, hz);
+ timeout_add(&sc->sc_timeout, hz);
}
int
diff --git a/sys/arch/hp300/dev/dma.c b/sys/arch/hp300/dev/dma.c
index 78c0420c7d7..70ae2e7956a 100644
--- a/sys/arch/hp300/dev/dma.c
+++ b/sys/arch/hp300/dev/dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dma.c,v 1.8 1997/07/06 08:01:49 downsj Exp $ */
+/* $OpenBSD: dma.c,v 1.9 2001/05/01 16:51:08 millert Exp $ */
/* $NetBSD: dma.c,v 1.19 1997/05/05 21:02:39 thorpej Exp $ */
/*
@@ -50,6 +50,7 @@
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/device.h>
+#include <sys/timeout.h>
#include <machine/frame.h>
#include <machine/cpu.h>
@@ -85,6 +86,9 @@ struct dma_channel {
struct dma_softc {
struct dmareg *sc_dmareg; /* pointer to our hardware */
struct dma_channel sc_chan[NDMACHAN]; /* 2 channels */
+#ifdef DEBUG
+ struct timeout sc_timeout; /* DMA timeout */
+#endif
TAILQ_HEAD(, dmaqueue) sc_queue; /* job queue */
char sc_type; /* A, B, or C */
int sc_ipl; /* our interrupt level */
@@ -177,7 +181,8 @@ dmainit()
#ifdef DEBUG
/* make sure timeout is really not needed */
- timeout(dmatimeout, sc, 30 * hz);
+ timeout_set(&sc->sc_timeout, dmatimeout, sc);
+ timeout_add(&sc->sc_timeout, 30 * hz);
#endif
printf("98620%c, 2 channels, %d bit DMA\n",
@@ -588,6 +593,6 @@ dmatimeout(arg)
}
splx(s);
}
- timeout(dmatimeout, sc, 30 * hz);
+ timeout_add(&sc->sc_timeout, 30 * hz);
}
#endif
diff --git a/sys/arch/hp300/dev/fhpib.c b/sys/arch/hp300/dev/fhpib.c
index c2dbe3ff313..c45742ab320 100644
--- a/sys/arch/hp300/dev/fhpib.c
+++ b/sys/arch/hp300/dev/fhpib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fhpib.c,v 1.8 1997/07/06 08:01:50 downsj Exp $ */
+/* $OpenBSD: fhpib.c,v 1.9 2001/05/01 16:51:09 millert Exp $ */
/* $NetBSD: fhpib.c,v 1.18 1997/05/05 21:04:16 thorpej Exp $ */
/*
@@ -46,6 +46,7 @@
#include <sys/kernel.h>
#include <sys/buf.h>
#include <sys/device.h>
+#include <sys/timeout.h>
#include <machine/autoconf.h>
#include <machine/intr.h>
@@ -109,6 +110,10 @@ struct hpib_controller fhpib_controller = {
struct fhpib_softc {
struct device sc_dev; /* generic device glue */
struct fhpibdevice *sc_regs; /* device registers */
+ struct timeout sc_dma_to; /* DMA done timeout */
+#ifdef DEBUG
+ struct timeout sc_watch_to; /* fhpibppwatch timeout */
+#endif
int sc_cmd;
struct hpibbus_softc *sc_hpibbus; /* XXX */
};
@@ -157,6 +162,12 @@ fhpibattach(parent, self, aux)
ipl = DIO_IPL(sc->sc_regs);
printf(" ipl %d: %s\n", ipl, DIO_DEVICE_DESC_FHPIB);
+ /* Initialize timeout structures */
+ timeout_set(&sc->sc_dma_to, fhpibdmadone, sc);
+#ifdef DEBUG
+ timeout_set(&sc->sc_watch_to, fhpibppwatch, sc);
+#endif
+
/* Establish the interrupt handler. */
(void) dio_intr_establish(fhpibintr, sc, ipl, IPL_BIO);
@@ -480,7 +491,7 @@ fhpibdone(hs)
if (hs->sc_flags & HPIBF_READ) {
hd->hpib_imask = IM_IDLE | IM_BYTE;
if (hs->sc_flags & HPIBF_TIMO)
- timeout(fhpibdmadone, hs, hz >> 2);
+ timeout_add(&sc->sc_dma_to, hz >> 2);
} else {
cnt = hs->sc_count;
if (cnt) {
@@ -536,7 +547,7 @@ fhpibintr(arg)
hq = hs->sc_queue.tqh_first;
if (hs->sc_flags & HPIBF_IO) {
if (hs->sc_flags & HPIBF_TIMO)
- untimeout(fhpibdmadone, hs);
+ timeout_del(&sc->sc_dma_to);
stat0 = hd->hpib_cmd;
hd->hpib_cmd = sc->sc_cmd & ~CT_8BIT;
hd->hpib_stat = 0;
@@ -645,7 +656,7 @@ fhpibppwatch(arg)
hd->hpib_stat = ST_IENAB;
hd->hpib_imask = IM_IDLE | IM_ROOM;
} else
- timeout(fhpibppwatch, sc, 1);
+ timeout_add(&sc->sc_watch_to, 1);
return;
}
if ((fhpibdebug & FDB_PPOLL) && sc->sc_dev.dv_unit == fhpibdebugunit)
diff --git a/sys/arch/hp300/dev/hd.c b/sys/arch/hp300/dev/hd.c
index 95920e3f231..d6d2501afff 100644
--- a/sys/arch/hp300/dev/hd.c
+++ b/sys/arch/hp300/dev/hd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hd.c,v 1.11 1998/10/04 01:02:26 millert Exp $ */
+/* $OpenBSD: hd.c,v 1.12 2001/05/01 16:51:09 millert Exp $ */
/* $NetBSD: rd.c,v 1.33 1997/07/10 18:14:08 kleink Exp $ */
/*
@@ -314,6 +314,9 @@ hdattach(parent, self, aux)
hderrthresh = 0;
#endif
+ /* Initialize timeout structure */
+ timeout_set(&sc->sc_timeout, hdrestart, sc);
+
dk_establish(&sc->sc_dkdev, &sc->sc_dev); /* XXX */
}
@@ -708,7 +711,7 @@ done:
}
/*
- * Called from timeout() when handling maintenance releases
+ * Called via timeout(9) when handling maintenance releases
*/
void
hdrestart(arg)
@@ -1014,7 +1017,7 @@ hderror(unit)
rs->sc_stats.hdtimeouts++;
#endif
hpibfree(rs->sc_dev.dv_parent, &rs->sc_hq);
- timeout(hdrestart, rs, hdtimo * hz);
+ timeout_add(&rs->sc_timeout, hdtimo * hz);
return(0);
}
/*
diff --git a/sys/arch/hp300/dev/hdvar.h b/sys/arch/hp300/dev/hdvar.h
index 85a71d05cfa..2ef6c939d25 100644
--- a/sys/arch/hp300/dev/hdvar.h
+++ b/sys/arch/hp300/dev/hdvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hdvar.h,v 1.2 1997/02/10 01:33:56 downsj Exp $ */
+/* $OpenBSD: hdvar.h,v 1.3 2001/05/01 16:51:09 millert Exp $ */
/* $NetBSD: rdvar.h,v 1.6 1997/01/30 09:14:19 thorpej Exp $ */
/*
@@ -80,6 +80,7 @@ struct hd_softc {
struct hd_clearcmd sc_clear;
struct buf sc_tab; /* buffer queue */
struct hdstats sc_stats;
+ struct timeout sc_timeout;
};
/* sc_flags values */
diff --git a/sys/arch/hp300/dev/ite.c b/sys/arch/hp300/dev/ite.c
index dfb3acae522..752f17b1614 100644
--- a/sys/arch/hp300/dev/ite.c
+++ b/sys/arch/hp300/dev/ite.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ite.c,v 1.11 1998/03/06 17:24:12 millert Exp $ */
+/* $OpenBSD: ite.c,v 1.12 2001/05/01 16:51:09 millert Exp $ */
/* $NetBSD: ite.c,v 1.38 1997/03/31 07:37:25 scottr Exp $ */
/*
@@ -473,7 +473,7 @@ itestart(tp)
}
if (hiwat) {
tp->t_state |= TS_TIMEOUT;
- timeout(ttrstrt, tp, 1);
+ timeout_add(&tp->t_rstrt_to, 1);
}
}
tp->t_state &= ~TS_BUSY;
diff --git a/sys/arch/hp300/dev/mt.c b/sys/arch/hp300/dev/mt.c
index 678e0d0b9fe..a93ad40172e 100644
--- a/sys/arch/hp300/dev/mt.c
+++ b/sys/arch/hp300/dev/mt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mt.c,v 1.6 1997/04/16 11:56:13 downsj Exp $ */
+/* $OpenBSD: mt.c,v 1.7 2001/05/01 16:51:10 millert Exp $ */
/* $NetBSD: mt.c,v 1.8 1997/03/31 07:37:29 scottr Exp $ */
/*
@@ -78,6 +78,8 @@ struct mt_softc {
tpr_t sc_ttyp;
struct buf sc_tab; /* buf queue */
struct buf sc_bufstore; /* XXX buffer storage */
+ struct timeout sc_start_to; /* spl_mtstart timeout */
+ struct timeout sc_intr_to; /* spl_mtintr timeout */
};
#ifdef DEBUG
@@ -157,6 +159,10 @@ mtattach(parent, self, aux)
sc->sc_hq.hq_start = mtstart;
sc->sc_hq.hq_go = mtgo;
sc->sc_hq.hq_intr = mtintr;
+
+ /* Initialize timeout structures */
+ timeout_set(&sc->sc_start_to, spl_mtstart, sc);
+ timeout_set(&sc->sc_intr_to, spl_mtintr, sc);
}
int
@@ -551,7 +557,7 @@ mtstart(arg)
* but not otherwise.
*/
if (sc->sc_flags & (MTF_DSJTIMEO | MTF_STATTIMEO)) {
- timeout(spl_mtstart, sc, hz >> 5);
+ timeout_add(&sc->sc_start_to, hz >> 5);
return;
}
case 2:
@@ -637,7 +643,7 @@ mtstart(arg)
break;
case -2:
- timeout(spl_mtstart, sc, hz >> 5);
+ timeout_add(&sc->sc_start_to, hz >> 5);
return;
}
@@ -652,7 +658,7 @@ mtstart(arg)
sc->sc_dev.dv_xname);
goto fatalerror;
}
- timeout(spl_mtintr, sc, 4 * hz);
+ timeout_add(&sc->sc_intr_to, 4 * hz);
hpibawait(sc->sc_hpibno);
return;
@@ -791,7 +797,7 @@ mtintr(arg)
* to the request for DSJ. It's probably just "busy" figuring
* it out and will know in a little bit...
*/
- timeout(spl_mtintr, sc, hz >> 5);
+ timeout_add(&sc->sc_intr_to, hz >> 5);
return;
default:
@@ -809,7 +815,7 @@ mtintr(arg)
sc->sc_stat3, sc->sc_stat5);
if ((bp->b_flags & B_CMD) && bp->b_cmd == MTRESET)
- untimeout(spl_mtintr, sc);
+ timeout_del(&sc->sc_intr_to);
if (sc->sc_stat3 & SR3_POWERUP)
sc->sc_flags &= MTF_OPEN | MTF_EXISTS;
goto error;
@@ -861,7 +867,7 @@ mtintr(arg)
sc->sc_flags |= MTF_HITBOF;
}
if (bp->b_cmd == MTRESET) {
- untimeout(spl_mtintr, sc);
+ timeout_del(&sc->sc_intr_to);
sc->sc_flags |= MTF_ALIVE;
}
} else {
diff --git a/sys/arch/hp300/dev/nhpib.c b/sys/arch/hp300/dev/nhpib.c
index d9978bf0075..167a94c9803 100644
--- a/sys/arch/hp300/dev/nhpib.c
+++ b/sys/arch/hp300/dev/nhpib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nhpib.c,v 1.8 1997/07/06 08:01:54 downsj Exp $ */
+/* $OpenBSD: nhpib.c,v 1.9 2001/05/01 16:51:10 millert Exp $ */
/* $NetBSD: nhpib.c,v 1.17 1997/05/05 21:06:41 thorpej Exp $ */
/*
@@ -46,6 +46,7 @@
#include <sys/kernel.h>
#include <sys/buf.h>
#include <sys/device.h>
+#include <sys/timeout.h>
#include <machine/autoconf.h>
#include <machine/intr.h>
@@ -113,6 +114,8 @@ struct nhpib_softc {
struct device sc_dev; /* generic device glue */
struct nhpibdevice *sc_regs; /* device registers */
struct hpibbus_softc *sc_hpibbus; /* XXX */
+ struct timeout sc_read_to; /* nhpibreadtimo timeout */
+ struct timeout sc_watch_to; /* nhpibppwatch timeout */
};
int nhpibmatch __P((struct device *, void *, void *));
@@ -179,6 +182,10 @@ nhpibattach(parent, self, aux)
/* Establish the interrupt handler. */
(void) dio_intr_establish(nhpibintr, sc, ipl, IPL_BIO);
+ /* Initialize timeout structures */
+ timeout_set(&sc->sc_read_to, nhpibreadtimo, &sc->sc_hpibbus);
+ timeout_set(&sc->sc_watch_to, nhpibppwatch, &sc->sc_hpibbus);
+
ha.ha_ops = &nhpib_controller;
ha.ha_type = type; /* XXX */
ha.ha_ba = (type == HPIBA) ? HPIBA_BA :
@@ -425,7 +432,7 @@ nhpibdone(hs)
if (hs->sc_flags & HPIBF_READ) {
if ((hs->sc_flags & HPIBF_TIMO) &&
(hd->hpib_ids & IDS_IR) == 0)
- timeout(nhpibreadtimo, hs, hz >> 2);
+ timeout_add(&sc->sc_read_to, hz >> 2);
} else {
if (hs->sc_count == 1) {
(void) nhpibwait(hd, MIS_BO);
@@ -467,7 +474,7 @@ nhpibintr(arg)
hs->sc_flags &= ~HPIBF_TIMO;
dmastop(hs->sc_dq->dq_chan);
} else if (hs->sc_flags & HPIBF_TIMO)
- untimeout(nhpibreadtimo, hs);
+ timeout_del(&sc->sc_read_to);
hd->hpib_acr = AUX_TCA;
hs->sc_flags &= ~(HPIBF_DONE|HPIBF_IO|HPIBF_READ|HPIBF_TIMO);
@@ -544,5 +551,5 @@ again:
/* timeouts not working yet */
goto again;
else
- timeout(nhpibppwatch, hs, 1);
+ timeout_add(&sc->sc_watch_to, 1);
}
diff --git a/sys/arch/hp300/dev/ppi.c b/sys/arch/hp300/dev/ppi.c
index 175f2f137dd..21b93167729 100644
--- a/sys/arch/hp300/dev/ppi.c
+++ b/sys/arch/hp300/dev/ppi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ppi.c,v 1.7 2000/07/06 15:42:48 ho Exp $ */
+/* $OpenBSD: ppi.c,v 1.8 2001/05/01 16:51:10 millert Exp $ */
/* $NetBSD: ppi.c,v 1.13 1997/04/02 22:37:33 scottr Exp $ */
/*
@@ -48,6 +48,7 @@
#include <sys/errno.h>
#include <sys/malloc.h>
#include <sys/proc.h>
+#include <sys/timeout.h>
#include <sys/uio.h>
#include <hp300/dev/hpibvar.h>
@@ -64,6 +65,8 @@ struct ppi_softc {
#define sc_delay sc_param.delay
int sc_sec;
int sc_slave; /* HP-IB slave address */
+ struct timeout sc_to; /* ppitimo timeout */
+ struct timeout sc_start_to; /* ppistart timeout */
};
/* sc_flags values */
@@ -151,6 +154,10 @@ ppiattach(parent, self, aux)
sc->sc_hq.hq_intr = ppinoop;
sc->sc_flags = PPIF_ALIVE;
+
+ /* Initialize timeout structures */
+ timeout_set(&sc->sc_to, ppitimo, sc);
+ timeout_set(&sc->sc_to, ppistart, sc);
}
void
@@ -293,7 +300,7 @@ ppirw(dev, uio)
sc->sc_flags |= PPIF_UIO;
if (sc->sc_timo > 0) {
sc->sc_flags |= PPIF_TIMO;
- timeout(ppitimo, sc, sc->sc_timo);
+ timeout_add(&sc->sc_to, sc->sc_timo);
}
len = cnt = 0;
while (uio->uio_resid > 0) {
@@ -320,7 +327,7 @@ again:
sc->sc_flags);
#endif
if (sc->sc_flags & PPIF_TIMO) {
- untimeout(ppitimo, sc);
+ timeout_del(&sc->sc_to);
sc->sc_flags &= ~PPIF_TIMO;
}
splx(s);
@@ -374,7 +381,7 @@ again:
*/
if (sc->sc_delay > 0) {
sc->sc_flags |= PPIF_DELAY;
- timeout(ppistart, sc, sc->sc_delay);
+ timeout_add(&sc->sc_start_to, sc->sc_delay);
error = tsleep(sc, (PCATCH|PZERO) + 1, "hpib", 0);
if (error) {
splx(s);
@@ -395,11 +402,11 @@ again:
}
s = splsoftclock();
if (sc->sc_flags & PPIF_TIMO) {
- untimeout(ppitimo, sc);
+ timeout_del(&sc->sc_to);
sc->sc_flags &= ~PPIF_TIMO;
}
if (sc->sc_flags & PPIF_DELAY) {
- untimeout(ppistart, sc);
+ timeout_del(&sc->sc_start_to);
sc->sc_flags &= ~PPIF_DELAY;
}
splx(s);