New callout mechanism with two major improvements over the old

timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
  resource allocation.
- Insertion and removal of callouts is constant time, important as
  this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
This commit is contained in:
thorpej 2000-03-23 06:40:33 +00:00
parent b667a5a357
commit 7b918b4088
57 changed files with 445 additions and 240 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: adb_direct.c,v 1.12 2000/01/27 17:39:20 tsubai Exp $ */
/* $NetBSD: adb_direct.c,v 1.13 2000/03/23 06:40:33 thorpej Exp $ */
/* From: adb_direct.c 2.02 4/18/97 jpw */
@ -62,6 +62,7 @@
#include <sys/param.h>
#include <sys/cdefs.h>
#include <sys/systm.h>
#include <sys/callout.h>
#include <sys/device.h>
#include <machine/param.h>
@ -243,6 +244,9 @@ int tickle_count = 0; /* how many tickles seen for this packet? */
int tickle_serial = 0; /* the last packet tickled */
int adb_cuda_serial = 0; /* the current packet */
struct callout adb_cuda_tickle_ch = CALLOUT_INITIALIZER;
struct callout adb_soft_intr_ch = CALLOUT_INITIALIZER;
volatile u_char *Via1Base;
extern int adb_polling; /* Are we polling? */
@ -345,7 +349,8 @@ adb_cuda_tickle(void)
tickle_count = 0;
}
timeout((void *)adb_cuda_tickle, 0, ADB_TICKLE_TICKS);
callout_reset(&adb_cuda_tickle_ch, ADB_TICKLE_TICKS,
(void *)adb_cuda_tickle, NULL);
}
/*
@ -1447,7 +1452,8 @@ adb_reinit(void)
#endif
if (adbHardware == ADB_HW_CUDA)
timeout((void *)adb_cuda_tickle, 0, ADB_TICKLE_TICKS);
callout_reset(&adb_cuda_tickle_ch, ADB_TICKLE_TICKS,
(void *)adb_cuda_tickle, NULL);
if (adbHardware != ADB_HW_PB) /* ints must be on for PB? */
splx(s);
@ -2093,7 +2099,7 @@ ADBOp(Ptr buffer, Ptr compRout, Ptr data, short commandNum)
int
setsoftadb()
{
timeout((void *)adb_soft_intr, NULL, 1);
callout_reset(&adb_soft_intr_ch, 1, (void *)adb_soft_intr, NULL);
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: aed.c,v 1.4 1999/02/17 14:56:56 tsubai Exp $ */
/* $NetBSD: aed.c,v 1.5 2000/03/23 06:40:33 thorpej Exp $ */
/*
* Copyright (C) 1994 Bradley A. Grantham
@ -103,6 +103,8 @@ aedattach(parent, self, aux)
struct adb_attach_args *aa_args = (struct adb_attach_args *)aux;
struct aed_softc *sc = (struct aed_softc *)self;
callout_init(&sc->sc_repeat_ch);
sc->origaddr = aa_args->origaddr;
sc->adbaddr = aa_args->adbaddr;
sc->handler_id = aa_args->handler_id;
@ -320,7 +322,8 @@ aed_kbdrpt(kstate)
aed_handoff(&aed_sc->sc_rptevent); /* do key down */
if (aed_sc->sc_repeating == aed_sc->sc_rptevent.u.k.key) {
timeout(aed_kbdrpt, kstate, aed_sc->sc_rptinterval);
callout_reset(&aed_sc->sc_repeat_ch, aed_sc->sc_rptinterval,
aed_kbdrpt, kstate);
}
}
@ -340,15 +343,16 @@ aed_dokeyupdown(event)
if (ADBK_PRESS(event->u.k.key) && keyboard[kbd_key][0] != 0) {
/* ignore shift & control */
if (aed_sc->sc_repeating != -1) {
untimeout(aed_kbdrpt, (void *)aed_sc);
callout_stop(&aed_sc->sc_repeat_ch);
}
aed_sc->sc_rptevent = *event;
aed_sc->sc_repeating = kbd_key;
timeout(aed_kbdrpt, (void *)aed_sc, aed_sc->sc_rptdelay);
callout_reset(&aed_sc->sc_repeat_ch, aed_sc->sc_rptdelay,
aed_kbdrpt, (void *)aed_sc);
} else {
if (aed_sc->sc_repeating != -1) {
aed_sc->sc_repeating = -1;
untimeout(aed_kbdrpt, (void *)aed_sc);
callout_stop(&aed_sc->sc_repeat_ch);
}
aed_sc->sc_rptevent = *event;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: aedvar.h,v 1.1 1998/10/13 11:21:21 tsubai Exp $ */
/* $NetBSD: aedvar.h,v 1.2 2000/03/23 06:40:33 thorpej Exp $ */
/*
* Copyright (C) 1994 Bradley A. Grantham
@ -30,6 +30,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/callout.h>
#include <machine/adbsys.h>
/* Event queue definitions */
@ -41,6 +42,8 @@
struct aed_softc {
struct device sc_dev;
struct callout sc_repeat_ch;
/* ADB info */
u_char origaddr; /* ADB device type (ADBADDR_AED) */
u_char adbaddr; /* current ADB address */

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_bm.c,v 1.6 2000/02/02 17:09:43 thorpej Exp $ */
/* $NetBSD: if_bm.c,v 1.7 2000/03/23 06:40:34 thorpej Exp $ */
/*-
* Copyright (C) 1998, 1999, 2000 Tsubai Masanari. All rights reserved.
@ -37,6 +37,7 @@
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/systm.h>
#include <sys/callout.h>
#include <vm/vm.h>
@ -73,6 +74,7 @@ struct bmac_softc {
struct device sc_dev;
struct ethercom sc_ethercom;
#define sc_if sc_ethercom.ec_if
struct callout sc_tick_ch;
vaddr_t sc_regs;
dbdma_regmap_t *sc_txdma;
dbdma_regmap_t *sc_rxdma;
@ -194,6 +196,8 @@ bmac_attach(parent, self, aux)
struct mii_data *mii = &sc->sc_mii;
u_char laddr[6];
callout_init(&sc->sc_tick_ch);
sc->sc_flags =0;
if (strcmp(ca->ca_name, "ethernet") == 0) {
char name[64];
@ -400,8 +404,7 @@ bmac_init(sc)
bmac_start(ifp);
untimeout(bmac_mii_tick, sc);
timeout(bmac_mii_tick, sc, hz);
callout_reset(&sc->sc_tick_ch, hz, bmac_mii_tick, sc);
}
void
@ -546,7 +549,7 @@ bmac_stop(sc)
s = splnet();
untimeout(bmac_mii_tick, sc);
callout_stop(&sc->sc_tick_ch);
mii_down(&sc->sc_mii);
/* Disable TX/RX. */
@ -1000,5 +1003,5 @@ bmac_mii_tick(v)
mii_tick(&sc->sc_mii);
splx(s);
timeout(bmac_mii_tick, sc, hz);
callout_reset(&sc->sc_tick_ch, hz, bmac_mii_tick, sc);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_gm.c,v 1.2 2000/03/04 11:17:00 tsubai Exp $ */
/* $NetBSD: if_gm.c,v 1.3 2000/03/23 06:40:34 thorpej Exp $ */
/*-
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
@ -37,6 +37,7 @@
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/systm.h>
#include <sys/callout.h>
#include <vm/vm.h>
@ -78,6 +79,7 @@ struct gmac_softc {
caddr_t sc_txbuf[NTXBUF];
caddr_t sc_rxbuf[NRXBUF];
struct mii_data sc_mii;
struct callout sc_tick_ch;
char sc_laddr[6];
};
@ -213,6 +215,8 @@ gmac_attach(parent, self, aux)
printf(": Ethernet address %s\n", ether_sprintf(laddr));
printf("%s: interrupting at %s\n", sc->sc_dev.dv_xname, intrstr);
callout_init(&sc->sc_tick_ch);
gmac_reset(sc);
gmac_init_mac(sc);
@ -584,7 +588,7 @@ gmac_stop(sc)
s = splnet();
untimeout(gmac_mii_tick, sc);
callout_stop(&sc->sc_tick_ch);
mii_down(&sc->sc_mii);
gmac_stop_txdma(sc);
@ -680,8 +684,7 @@ gmac_init(sc)
ifp->if_flags &= ~IFF_OACTIVE;
ifp->if_timer = 0;
untimeout(gmac_mii_tick, sc);
timeout(gmac_mii_tick, sc, 1);
callout_reset(&sc->sc_tick_ch, 1, gmac_mii_tick, sc);
gmac_start(ifp);
}
@ -911,5 +914,5 @@ gmac_mii_tick(v)
mii_tick(&sc->sc_mii);
splx(s);
timeout(gmac_mii_tick, sc, hz);
callout_reset(&sc->sc_tick_ch, hz, gmac_mii_tick, sc);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mesh.c,v 1.3 1999/12/28 13:49:20 tsubai Exp $ */
/* $NetBSD: mesh.c,v 1.4 2000/03/23 06:40:34 thorpej Exp $ */
/*-
* Copyright (C) 1999 Internet Research Institute, Inc.
@ -474,7 +474,7 @@ mesh_select(sc, scb)
sc->sc_prevphase = MESH_SELECTING;
sc->sc_nextstate = MESH_IDENTIFY;
timeout(mesh_timeout, scb, 10*hz);
callout_reset(&scb->xs->xs_callout, 10 * hz, mesh_timeout, scb);
}
void
@ -1027,7 +1027,7 @@ mesh_done(sc, scb)
sc->sc_nextstate = MESH_BUSFREE;
sc->sc_nexus = NULL;
untimeout(mesh_timeout, scb);
callout_stop(&scb->xs->xs_callout);
if (scb->status == SCSI_BUSY) {
xs->error = XS_BUSY;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ofcons.c,v 1.3 2000/03/06 21:36:09 thorpej Exp $ */
/* $NetBSD: ofcons.c,v 1.4 2000/03/23 06:40:34 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -239,7 +239,7 @@ ofcstart(tp)
tp->t_state &= ~TS_BUSY;
if (cl->c_cc) {
tp->t_state |= TS_TIMEOUT;
timeout(ttrstrt, (void *)tp, 1);
callout_reset(&tp->t_rstrt_ch, 1, ttrstrt, tp);
}
if (cl->c_cc <= tp->t_lowat) {
if (tp->t_state & TS_ASLEEP) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: z8530tty.c,v 1.4 1999/02/06 20:04:31 tsubai Exp $ */
/* $NetBSD: z8530tty.c,v 1.5 2000/03/23 06:40:34 thorpej Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999
@ -142,6 +142,8 @@ struct zstty_softc {
struct tty *zst_tty;
struct zs_chanstate *zst_cs;
struct callout zst_diag_ch;
u_int zst_overflows,
zst_floods,
zst_errors;
@ -256,6 +258,8 @@ zstty_attach(parent, self, aux)
int channel, s, tty_unit;
dev_t dev;
callout_init(&zst->zst_diag_ch);
tty_unit = zst->zst_dev.dv_unit;
channel = args->channel;
cs = zsc->zsc_cs[channel];
@ -1343,7 +1347,8 @@ zstty_rxsoft(zst, tp)
if (cc == zstty_rbuf_size) {
zst->zst_floods++;
if (zst->zst_errors++ == 0)
timeout(zstty_diag, zst, 60 * hz);
callout_start(&zst->zst_diag_ch, 60 * hz,
zstty_diag, zst);
}
while (cc) {
@ -1353,7 +1358,8 @@ zstty_rxsoft(zst, tp)
if (ISSET(rr1, ZSRR1_DO)) {
zst->zst_overflows++;
if (zst->zst_errors++ == 0)
timeout(zstty_diag, zst, 60 * hz);
callout_start(&zst->zst_diag_ch,
60 * hz, zstty_diag, zst);
}
if (ISSET(rr1, ZSRR1_FE))
SET(code, TTY_FE);

View File

@ -1,4 +1,4 @@
/* $NetBSD: com.c,v 1.3 2000/03/06 21:36:09 thorpej Exp $ */
/* $NetBSD: com.c,v 1.4 2000/03/23 06:41:07 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@ -161,6 +161,7 @@ void comsoft __P((void *));
void comsoft __P((void));
#else
void comsoft __P((void *));
struct callout comsoft_callout = CALLOUT_INITIALIZER;
#endif
#endif
integrate void com_rxsoft __P((struct com_softc *, struct tty *));
@ -398,6 +399,8 @@ com_attach_subr(sc)
int *hayespp;
#endif
callout_init(&sc->sc_diag_callout);
/* Disable interrupts before configuring the device. */
sc->sc_ier = 0;
bus_space_write_1(iot, ioh, com_ier, sc->sc_ier);
@ -1156,7 +1159,7 @@ com_schedrx(sc)
#else
if (!com_softintr_scheduled) {
com_softintr_scheduled = 1;
timeout(comsoft, NULL, 1);
callout_reset(&comsoft_callout, 1, comsoft, NULL);
}
#endif
#endif
@ -1720,7 +1723,8 @@ com_rxsoft(sc, tp)
if (cc == com_rbuf_size) {
sc->sc_floods++;
if (sc->sc_errors++ == 0)
timeout(comdiag, sc, 60 * hz);
callout_reset(&sc->sc_diag_callout, 60 * hz,
comdiag, sc);
}
while (cc) {
@ -1730,7 +1734,8 @@ com_rxsoft(sc, tp)
if (ISSET(lsr, LSR_OE)) {
sc->sc_overflows++;
if (sc->sc_errors++ == 0)
timeout(comdiag, sc, 60 * hz);
callout_reset(&sc->sc_diag_callout,
60 * hz, comdiag, sc);
}
if (ISSET(lsr, LSR_BI | LSR_FE))
SET(code, TTY_FE);
@ -2136,7 +2141,7 @@ comintr(arg)
#else
if (!com_softintr_scheduled) {
com_softintr_scheduled = 1;
timeout(comsoft, NULL, 1);
callout_reset(&comsoft_callout, 1, comsoft, NULL);
}
#endif
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: lpt.c,v 1.6 2000/03/18 22:33:03 scw Exp $ */
/* $NetBSD: lpt.c,v 1.7 2000/03/23 06:41:28 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -94,6 +94,7 @@ lpt_attach_subr(sc)
{
sc->sc_state = 0;
callout_init(&sc->sc_wakeup_ch);
}
/*
@ -185,7 +186,7 @@ lpt_wakeup(arg)
lpt_intr(sc);
splx(s);
timeout(lpt_wakeup, sc, STEP);
callout_reset(&sc->sc_wakeup_ch, STEP, lpt_wakeup, sc);
}
/*
@ -208,7 +209,7 @@ lptclose(dev, flag, mode, p)
(void) pushbytes(sc);
if ((sc->sc_flags & LPT_NOINTR) == 0)
untimeout(lpt_wakeup, sc);
callout_stop(&sc->sc_wakeup_ch);
(sc->sc_funcs->lf_close) (sc);

View File

@ -1,4 +1,4 @@
/* $NetBSD: lptvar.h,v 1.3 2000/03/18 22:33:03 scw Exp $ */
/* $NetBSD: lptvar.h,v 1.4 2000/03/23 06:41:28 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -43,11 +43,14 @@
#ifndef __mvme68k_lptvar_h
#define __mvme68k_lptvar_h
#include <sys/callout.h>
struct lpt_funcs;
struct lpt_softc {
struct device sc_dev;
struct callout sc_wakeup_ch;
struct lpt_funcs *sc_funcs;
void *sc_arg;
size_t sc_count;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbic.c,v 1.12 2000/03/18 22:33:04 scw Exp $ */
/* $NetBSD: sbic.c,v 1.13 2000/03/23 06:41:28 thorpej Exp $ */
/*
* Changes Copyright (c) 1996 Steve Woodford
@ -854,6 +854,7 @@ sbicinit(dev)
TAILQ_INIT(&dev->ready_list);
TAILQ_INIT(&dev->nexus_list);
TAILQ_INIT(&dev->free_list);
callout_init(&dev->sc_timo_ch);
dev->sc_nexus = NULL;
dev->sc_xs = NULL;
@ -872,7 +873,7 @@ sbicinit(dev)
/*
* make sure timeout is really not needed
*/
timeout((void *)sbictimeout, dev, 30 * hz);
callout_reset(&dev->sc_timo_ch, 30 * hz, (void *)sbictimeout, dev);
#endif
} else
@ -2701,6 +2702,6 @@ sbictimeout(dev)
splx(s);
timeout((void *)sbictimeout, dev, 30 * hz);
callout_reset(&dev->sc_timo_ch, 30 * hz, (void *)sbictimeout, dev);
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbicvar.h,v 1.6 2000/03/18 22:33:04 scw Exp $ */
/* $NetBSD: sbicvar.h,v 1.7 2000/03/23 06:41:28 thorpej Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
@ -39,6 +39,7 @@
*/
#ifndef _SBICVAR_H_
#define _SBICVAR_H_
#include <sys/callout.h>
#include <sys/malloc.h>
@ -105,6 +106,8 @@ struct sbic_softc {
void *sc_driver; /* driver specific field */
int sc_ipl;
struct callout sc_timo_ch;
/* Lists of command blocks */
TAILQ_HEAD(acb_list, sbic_acb) free_list,
ready_list,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ncr5380sbc.c,v 1.2 2000/03/19 16:28:04 tsutsui Exp $ */
/* $NetBSD: ncr5380sbc.c,v 1.3 2000/03/23 06:41:56 thorpej Exp $ */
/*
* Copyright (c) 1995 David Jones, Gordon W. Ross
@ -795,7 +795,7 @@ finish:
/* Clear our pointers to the request. */
sc->sc_current = NULL;
sc->sc_matrix[sr->sr_target][sr->sr_lun] = NULL;
untimeout(ncr5380_cmd_timeout, sr);
callout_stop(&sr->sr_xs->xs_callout);
/* Make the request free. */
sr->sr_xs = NULL;
@ -1034,7 +1034,8 @@ next_job:
if ((sr->sr_flags & SR_IMMED) == 0) {
i = (xs->timeout * hz) / 1000;
NCR_TRACE("sched: set timeout=%d\n", i);
timeout(ncr5380_cmd_timeout, sr, i);
callout_reset(&sr->sr_xs->xs_callout, i,
ncr5380_cmd_timeout, sr);
}
have_nexus:

View File

@ -1,4 +1,4 @@
/* $NetBSD: bmcons.c,v 1.5 2000/03/06 21:36:10 thorpej Exp $ */
/* $NetBSD: bmcons.c,v 1.6 2000/03/23 06:42:12 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@ -559,7 +559,8 @@ bmcnstart(tp)
*/
if (nch == 0) {
nch = getc(&tp->t_outq);
timeout(ttrstrt, (caddr_t)tp, (nch&0x7f)+6);
callout_reset(&tp->t_rstrt_ch, (nch&0x7f)+6,
ttrstrt, tp);
tp->t_state |= TS_TIMEOUT;
goto out;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: kbms_if.c,v 1.4 1999/12/18 06:54:05 tsubai Exp $ */
/* $NetBSD: kbms_if.c,v 1.5 2000/03/23 06:42:12 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@ -45,6 +45,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/callout.h>
#include <machine/adrsmap.h>
#include <newsmips/dev/scc.h>
@ -119,6 +120,9 @@ static struct kbm_sw Kbm_port[] = {
extern int kbd_flush();
static struct callout ms_helper_ch = CALLOUT_INITIALIZER;
statuc struct callout kb_soft_ch = CALLOUT_INITIALIZER;
void
kbm_open(chan)
int chan;
@ -186,7 +190,7 @@ kbm_rint(chan)
if (xputc(code, SCC_MOUSE) < 0)
printf("mouse queue overflow\n");
/* KU:XXX softcall? */
timeout(_ms_helper, (caddr_t)0, 0);
callout_reset(&ms_helper_ch, 0, _ms_helper, NULL);
#endif
break;
}
@ -197,7 +201,7 @@ kbm_rint(chan)
if (xputc(code, SCC_KEYBOARD) < 0)
printf("keyboard queue overflow\n");
/* KU:XXX softcall? */
timeout(kb_softint, (caddr_t)0, 0);
callout_reset(&kb_soft_ch, 0, kb_softint, NULL);
#endif
break;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: sc_wrap.c,v 1.14 1999/12/18 05:00:56 tsubai Exp $ */
/* $NetBSD: sc_wrap.c,v 1.15 2000/03/23 06:42:12 thorpej Exp $ */
/*
* This driver is slow! Need to rewrite.
@ -336,9 +336,9 @@ start:
scb->sc_cpoint = scb->msgbuf;
scb->scb_softc = sc;
timeout(cxd1185_timeout, scb, hz * 10);
callout_reset(&scb->xs->xs_callout, hz * 10, cxd1185_timeout, scb);
sc_send(scb, chan, ie);
untimeout(cxd1185_timeout, scb);
callout_stop(&scb->xs->xs_callout);
nextscb = scb->chain.tqe_next;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vt100.c,v 1.3 1998/06/01 19:31:05 tsubai Exp $ */
/* $NetBSD: vt100.c,v 1.4 2000/03/23 06:42:12 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@ -43,6 +43,7 @@
#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/callout.h>
#include <machine/framebuf.h>
#include <machine/keyboard.h>
#include <newsmips/dev/kbreg.h>
@ -144,6 +145,8 @@ int fpn;
lPoint fpp;
int fpa;
static struct callout auto_dimmer_ch = CALLOUT_INITIALIZER;
void
vt100init()
{
@ -373,7 +376,7 @@ auto_dimmer()
dimmer_counter = dim_cnt;
}
splx(s);
timeout(auto_dimmer, (caddr_t) 0, 60 * hz);
callout_reset(&auto_dimmer_ch, 60 * hz, auto_dimmer, NULL);
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: lpt.c,v 1.30 1999/05/18 23:52:53 thorpej Exp $ */
/* $NetBSD: lpt.c,v 1.31 2000/03/23 06:42:33 thorpej Exp $ */
/*
* Copyright (c) 1994 Matthias Pfaller.
@ -62,6 +62,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/callout.h>
#include <sys/proc.h>
#include <sys/user.h>
#include <sys/buf.h>
@ -154,8 +155,12 @@ struct lpt_softc {
#define LPT_AUTOLF 0x20 /* automatic LF on CR */
#define LPT_NOPRIME 0x40 /* don't prime on open */
struct callout sc_out_ch;
#if defined(INET) && defined(PLIP)
struct ethercom sc_ethercom;
struct callout sc_plipout_ch;
struct callout sc_pliprx_ch;
u_char *sc_ifbuf;
int sc_ifierrs; /* consecutive input errors */
int sc_ifoerrs; /* consecutive output errors */
@ -267,6 +272,8 @@ lptattach(parent, self, aux)
sc->sc_state = 0;
sc->sc_i8255 = i8255;
callout_init(&sc->sc_out_ch);
#if defined(INET) && defined(PLIP)
plipattach(sc, self->dv_unit);
#endif
@ -475,7 +482,7 @@ lptintr(arg)
/* is printer online and ready for output? */
if (notready(i8255->port_c, sc)) {
i8255->port_control = LPT_IRQDISABLE;
timeout(lptout, sc, STEP);
callout_reset(&sc->sc_out_ch, STEP, lptout, sc);
return;
}
/* send char */
@ -520,6 +527,9 @@ plipattach(sc, unit)
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
u_int8_t myaddr[ETHER_ADDR_LEN];
callout_init(&sc->sc_plipout_ch);
callout_init(&sc->sc_pliprx_ch);
sc->sc_ifbuf = NULL;
sprintf(ifp->if_xname, "plip%d", unit);
memset(myaddr, 0, sizeof(myaddr));
@ -769,7 +779,7 @@ plipinput(sc)
i8255->port_a &= ~(LPA_ACKENABLE | LPA_ACTIVE);
if (sc->sc_ifierrs)
untimeout(pliprxenable, sc);
callout_stop(&sc->sc_pliprx_ch);
#if defined(COMPAT_PLIP10)
if (ifp->if_flags & IFF_LINK0) {
@ -854,7 +864,8 @@ err:
log(LOG_NOTICE, "%s: rx hard error\n", ifp->if_xname);
i8255->port_a |= LPA_ACTIVE;
/* But we will retry from time to time. */
timeout(pliprxenable, sc, PLIPRETRY * 10);
callout_reset(&sc->sc_pliprx_ch, PLIPRETRY * 10,
pliprxenable, sc);
}
ifp->if_ierrors++;
sc->sc_ifierrs++;
@ -975,7 +986,7 @@ plipoutput(arg)
ifp->if_flags |= IFF_OACTIVE;
if (sc->sc_ifoerrs)
untimeout(plipoutput, sc);
callout_stop(&sc->sc_plipout_ch);
for (;;) {
s = splimp();
@ -1056,7 +1067,7 @@ retry:
s = splimp();
IF_PREPEND(&ifp->if_snd, m0);
splx(s);
timeout(plipoutput, sc, PLIPRETRY);
callout_reset(&sc->sc_plipout_ch, PLIPRETRY, plipoutput, sc);
} else {
if (sc->sc_ifoerrs == PLIPMXRETRY) {
log(LOG_NOTICE, "%s: tx hard error\n", ifp->if_xname);

View File

@ -1,4 +1,4 @@
/* $NetBSD: dc.c,v 1.62 2000/03/06 21:36:10 thorpej Exp $ */
/* $NetBSD: dc.c,v 1.63 2000/03/23 06:43:01 thorpej Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: dc.c,v 1.62 2000/03/06 21:36:10 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: dc.c,v 1.63 2000/03/23 06:43:01 thorpej Exp $");
/*
* devDC7085.c --
@ -112,6 +112,8 @@ static int cold_dcparam __P((struct tty *tp, struct termios *t,
struct dc_softc *sc));
static void dc_reset __P((dcregs *dcaddr));
struct callout dcscan_ch = CALLOUT_INITIALIZER;
void ttrstrt __P((void *));
@ -301,7 +303,7 @@ dcattach(sc, addr, dtr_mask, rtscts_mask, speed,
if (dc_timer == 0) {
dc_timer = 1;
timeout(dcscan, (void *)0, hz);
callout_reset(&dcscan_ch, hz, dcscan, NULL);
}
sc->dc_19200 = speed;
@ -1164,7 +1166,7 @@ dcscan(arg)
#endif /* HW_FLOW_CONTROL */
}
splx(s);
timeout(dcscan, (void *)0, hz);
callout_reset(&dcscan_ch, hz, dcscan, NULL);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: device.h,v 1.14 2000/01/08 01:02:35 simonb Exp $ */
/* $NetBSD: device.h,v 1.15 2000/03/23 06:43:01 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@ -38,6 +38,8 @@
* @(#)device.h 8.1 (Berkeley) 6/10/93
*/
#include <sys/callout.h>
/*
* This structure is used to encapsulate the routines for a device driver.
* This allows an "object oriented" approach so a controller device driver
@ -109,6 +111,7 @@ typedef struct ScsiCmd {
int cmdlen; /* length of data in cmdbuf */
u_char *cmd; /* buffer for the SCSI command */
int error; /* compatibility hack for new scsi */
struct callout timo_ch; /* timeout callout handle */
} ScsiCmd;
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: dtop.c,v 1.50 2000/03/13 23:52:32 soren Exp $ */
/* $NetBSD: dtop.c,v 1.51 2000/03/23 06:43:01 thorpej Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -94,7 +94,7 @@ SOFTWARE.
********************************************************/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: dtop.c,v 1.50 2000/03/13 23:52:32 soren Exp $");
__KERNEL_RCSID(0, "$NetBSD: dtop.c,v 1.51 2000/03/23 06:43:01 thorpej Exp $");
#include "opt_ddb.h"
#include "rasterconsole.h"
@ -269,12 +269,13 @@ dtopattach(parent, self, aux)
struct dtop_softc *sc = (struct dtop_softc*) self;
int i;
sc->poll = (poll_reg_t)MIPS_PHYS_TO_KSEG1(XINE_REG_INTR);
sc->data = (data_reg_t)d->iada_addr;
for (i = 0; i < DTOP_MAX_DEVICES; i++)
for (i = 0; i < DTOP_MAX_DEVICES; i++) {
sc->device[i].handler = dtop_null_device_handler;
callout_init(&sc->device[i].repeat_ch);
}
/* a lot more needed here, fornow: */
sc->device[DTOP_DEVICE_NO(0x6a)].handler = dtop_locator_handler;
@ -854,7 +855,7 @@ dtop_keyboard_handler(dev, msg, event, outc)
s = splhigh();
if (dev->keyboard.k_ar_state != K_AR_IDLE) {
dev->keyboard.k_ar_state = K_AR_IDLE;
untimeout(dtop_keyboard_repeat, (void *)dev);
callout_stop(&dev->repeat_ch);
}
splx(s);
msg_len = msg->code.val.len;
@ -965,7 +966,8 @@ dtop_keyboard_handler(dev, msg, event, outc)
bcopy(save, dev->keyboard.last_codes, msg_len);
dev->keyboard.last_codes_count = msg_len;
if (dev->keyboard.k_ar_state == K_AR_ACTIVE)
timeout(dtop_keyboard_repeat, (void *)dev, hz / 2);
callout_reset(&dev->repeat_ch, hz / 2,
dtop_keyboard_repeat, (void *)dev);
return (outc);
}
@ -1008,7 +1010,8 @@ dtop_keyboard_repeat(arg)
}
}
if (gotone)
timeout(dtop_keyboard_repeat, arg, hz / 20);
callout_reset(&dev->repeat_ch, hz / 20,
dtop_keyboard_repeat, dev);
else
dev->keyboard.k_ar_state = K_AR_IDLE;
splx(s);

View File

@ -1,4 +1,4 @@
/* $NetBSD: dtopreg.h,v 1.6 1999/04/24 08:01:03 simonb Exp $ */
/* $NetBSD: dtopreg.h,v 1.7 2000/03/23 06:43:01 thorpej Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -92,6 +92,8 @@
#ifndef _DTOP_H_
#define _DTOP_H_
#include <sys/callout.h>
#define DTOP_MAX_DEVICES 14
#define DTOP_MAX_MSG_SIZE 36 /* 3 hdr + 32 data + 1 checksum */
@ -263,6 +265,7 @@ typedef union {
} locator;
/* add more as they come along */
struct callout repeat_ch;
} dtop_device, *dtop_device_t;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rcons.c,v 1.38 2000/01/10 03:24:33 simonb Exp $ */
/* $NetBSD: rcons.c,v 1.39 2000/03/23 06:43:01 thorpej Exp $ */
/*
* Copyright (c) 1995
@ -422,7 +422,7 @@ rconsstart(tp)
tp->t_state &= ~TS_BUSY;
} else {
/* called at interrupt level - do it later */
timeout(rcons_later, (void*)tp, 0);
callout_reset(&tp->t_rstrt_ch, 0, rcons_later, tp);
}
}
if (cl->c_cc <= tp->t_lowat) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: rz.c,v 1.57 2000/03/03 17:51:28 mhitch Exp $ */
/* $NetBSD: rz.c,v 1.58 2000/03/23 06:43:01 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: rz.c,v 1.57 2000/03/03 17:51:28 mhitch Exp $");
__KERNEL_RCSID(0, "$NetBSD: rz.c,v 1.58 2000/03/23 06:43:01 thorpej Exp $");
/*
* SCSI CCS (Command Command Set) disk driver.
@ -413,6 +413,7 @@ rzprobe(xxxsd)
return (0);
BUFQ_INIT(&sc->sc_tab);
callout_init(&sc->sc_cmd.timo_ch);
/* init some parameters that don't change */
sc->sc_sd = sd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: tz.c,v 1.27 2000/01/21 23:29:06 thorpej Exp $ */
/* $NetBSD: tz.c,v 1.28 2000/03/23 06:43:01 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@ -203,6 +203,7 @@ tzprobe(xxxsd)
return (0);
BUFQ_INIT(&sc->sc_tab);
callout_init(&sc->sc_cmd.timo_ch);
/* init some parameters that don't change */
sc->sc_sd = sd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pccons.c,v 1.1 2000/02/29 15:21:43 nonaka Exp $ */
/* $NetBSD: pccons.c,v 1.2 2000/03/23 06:43:35 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -162,6 +162,8 @@ static struct video_state {
char so_at; /* standout attributes */
} vs;
static struct callout async_update_ch = CALLOUT_INITIALIZER;
struct pc_softc {
struct device sc_dev;
void *sc_ih;
@ -457,13 +459,13 @@ async_update()
if (kernel || polling) {
if (async)
untimeout(do_async_update, NULL);
callout_stop(&async_update_ch);
do_async_update((void *)1);
} else {
if (async)
return;
async = 1;
timeout(do_async_update, NULL, 1);
callout_reset(&async_update_ch, 1, do_async_update, NULL);
}
}
@ -809,7 +811,7 @@ pcstart(tp)
tp->t_state &= ~TS_BUSY;
if (cl->c_cc) {
tp->t_state |= TS_TIMEOUT;
timeout(ttrstrt, tp, 1);
callout_reset(&tp->t_rstrt_ch, 1, ttrstrt, tp);
}
if (cl->c_cc <= tp->t_lowat) {
if (tp->t_state & TS_ASLEEP) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: sci.c,v 1.6 2000/02/22 01:37:11 msaitoh Exp $ */
/* $NetBSD: sci.c,v 1.7 2000/03/23 06:43:52 thorpej Exp $ */
/*-
* Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved.
@ -140,6 +140,8 @@ struct sci_softc {
struct tty *sc_tty;
void *sc_ih;
struct callout sc_diag_ch;
#if 0
bus_space_tag_t sc_iot; /* ISA i/o space identifier */
bus_space_handle_t sc_ioh; /* ISA io handle */
@ -248,6 +250,7 @@ int scicn_speed = 9600;
#ifndef __GENERIC_SOFT_INTERRUPTS
#ifdef __NO_SOFT_SERIAL_INTERRUPT
volatile int sci_softintr_scheduled;
struct callout sci_soft_ch = CALLOUT_INITIALIZER;
#endif
#endif
@ -493,6 +496,8 @@ sci_attach(parent, self, aux)
SET(sc->sc_hwflags, SCI_HW_DEV_OK);
SET(sc->sc_hwflags, SCI_HW_CONSOLE);
callout_init(&sc->sc_diag_ch);
#if 0
if (irq != IRQUNK) {
sc->sc_ih = shb_intr_establish(irq,
@ -987,7 +992,7 @@ sci_schedrx(sc)
#else
if (!sci_softintr_scheduled) {
sci_softintr_scheduled = 1;
timeout(scisoft, NULL, 1);
callout_reset(&sci_soft_ch, 1, scisoft, NULL);
}
#endif
#endif
@ -1079,7 +1084,7 @@ sci_rxsoft(sc, tp)
if (cc == sci_rbuf_size) {
sc->sc_floods++;
if (sc->sc_errors++ == 0)
timeout(scidiag, sc, 60 * hz);
callout_reset(&sc->sc_diag_ch, 60 * hz, scidiag, sc);
}
while (cc) {
@ -1469,7 +1474,7 @@ sciintr(arg)
#else
if (!sci_softintr_scheduled) {
sci_softintr_scheduled = 1;
timeout(scisoft, NULL, 1);
callout_reset(&sci_soft_ch, 1, scisoft, 1);
}
#endif
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: scif.c,v 1.7 2000/02/22 01:37:11 msaitoh Exp $ */
/* $NetBSD: scif.c,v 1.8 2000/03/23 06:43:52 thorpej Exp $ */
/*-
* Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved.
@ -141,6 +141,8 @@ struct scif_softc {
struct tty *sc_tty;
void *sc_ih;
struct callout sc_diag_ch;
#if 0
bus_space_tag_t sc_iot; /* ISA i/o space identifier */
bus_space_handle_t sc_ioh; /* ISA io handle */
@ -250,6 +252,7 @@ unsigned int scifcn_speed = 9600;
#ifndef __GENERIC_SOFT_INTERRUPTS
#ifdef __NO_SOFT_SERIAL_INTERRUPT
volatile int scif_softintr_scheduled;
struct callout scif_soft_ch = CALLOUT_INITIALIZER;
#endif
#endif
@ -516,6 +519,8 @@ scif_attach(parent, self, aux)
SET(sc->sc_hwflags, SCIF_HW_DEV_OK);
SET(sc->sc_hwflags, SCIF_HW_CONSOLE);
callout_init(&sc->sc_diag_ch);
#if 0
if (irq != IRQUNK) {
sc->sc_ih = shb_intr_establish(irq,
@ -1028,7 +1033,7 @@ scif_schedrx(sc)
#else
if (!scif_softintr_scheduled) {
scif_softintr_scheduled = 1;
timeout(scifsoft, NULL, 1);
callout_reset(&scif_soft_ch, 1, scifsoft, NULL);
}
#endif
#endif
@ -1126,7 +1131,7 @@ scif_rxsoft(sc, tp)
if (cc == scif_rbuf_size) {
sc->sc_floods++;
if (sc->sc_errors++ == 0)
timeout(scifdiag, sc, 60 * hz);
callout(&sc->sc_diag_ch, 60 * hz, scifdiag, sc);
}
while (cc) {
@ -1532,7 +1537,7 @@ scifintr(arg)
#else
if (!scif_softintr_scheduled) {
scif_softintr_scheduled = 1;
timeout(scifsoft, NULL, 1);
callout_reset(&scif_soft_ch, 1, scifsoft, NULL);
}
#endif
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: fd.c,v 1.77 2000/02/07 20:16:53 thorpej Exp $ */
/* $NetBSD: fd.c,v 1.78 2000/03/23 06:44:45 thorpej Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -81,6 +81,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/callout.h>
#include <sys/kernel.h>
#include <sys/file.h>
#include <sys/ioctl.h>
@ -149,6 +150,9 @@ struct fdc_softc {
struct device sc_dev; /* boilerplate */
bus_space_tag_t sc_bustag;
struct callout sc_timo_ch; /* timeout callout */
struct callout sc_intr_ch; /* pseudo-intr callout */
struct fd_softc *sc_fd[4]; /* pointers to children */
TAILQ_HEAD(drivehead, fd_softc) sc_drives;
enum fdc_state sc_state;
@ -235,6 +239,8 @@ struct fd_softc {
struct fd_type *sc_deftype; /* default type descriptor */
struct fd_type *sc_type; /* current type descriptor */
struct callout sc_motor_ch;
daddr_t sc_blkno; /* starting block number */
int sc_bcount; /* byte count left */
int sc_skip; /* bytes already transferred */
@ -601,6 +607,9 @@ fdcattach(fdc, pri)
int drive_attached;
char code;
callout_init(&fdc->sc_timo_ch);
callout_init(&fdc->sc_intr_ch);
fdc->sc_state = DEVIDLE;
fdc->sc_itask = FDC_ITASK_NONE;
fdc->sc_istatus = FDC_ISTATUS_NONE;
@ -752,6 +761,8 @@ fdattach(parent, self, aux)
struct fd_type *type = fa->fa_deftype;
int drive = fa->fa_drive;
callout_init(&fd->sc_motor_ch);
/* XXX Allow `flags' to override device type? */
if (type)
@ -859,7 +870,7 @@ fdstrategy(bp)
/* Queue transfer on drive, activate drive and controller if idle. */
s = splbio();
disksort_cylinder(&fd->sc_q, bp);
untimeout(fd_motor_off, fd); /* a good idea */
callout_stop(&fd->sc_motor_ch); /* a good idea */
if (fd->sc_active == 0)
fdstart(fd);
#ifdef DIAGNOSTIC
@ -924,7 +935,7 @@ fdfinish(fd, bp)
biodone(bp);
/* turn off motor 5s from now */
timeout(fd_motor_off, fd, 5 * hz);
callout_reset(&fd->sc_motor_ch, 5 * hz, fd_motor_off, fd);
fdc->sc_state = DEVIDLE;
}
@ -1434,7 +1445,7 @@ loop:
fd->sc_skip = 0;
fd->sc_bcount = bp->b_bcount;
fd->sc_blkno = (bp->b_blkno * DEV_BSIZE) / FD_BSIZE(fd);
untimeout(fd_motor_off, fd);
callout_stop(&fd->sc_motor_ch);
if ((fd->sc_flags & FD_MOTOR_WAIT) != 0) {
fdc->sc_state = MOTORWAIT;
return (1);
@ -1443,7 +1454,7 @@ loop:
/* Turn on the motor, being careful about pairing. */
struct fd_softc *ofd = fdc->sc_fd[fd->sc_drive ^ 1];
if (ofd && ofd->sc_flags & FD_MOTOR) {
untimeout(fd_motor_off, ofd);
callout_stop(&ofd->sc_motor_ch);
ofd->sc_flags &= ~(FD_MOTOR | FD_MOTOR_WAIT);
}
fd->sc_flags |= FD_MOTOR | FD_MOTOR_WAIT;
@ -1451,7 +1462,8 @@ loop:
fdc->sc_state = MOTORWAIT;
if ((fdc->sc_flags & FDC_NEEDMOTORWAIT) != 0) { /*XXX*/
/* Allow .25s for motor to stabilize. */
timeout(fd_motor_on, fd, hz / 4);
callout_reset(&fd->sc_motor_ch, hz / 4,
fd_motor_on, fd);
} else {
fd->sc_flags &= ~FD_MOTOR_WAIT;
goto loop;
@ -1481,7 +1493,7 @@ loop:
fd->sc_dk.dk_seek++;
disk_busy(&fd->sc_dk);
timeout(fdctimeout, fdc, 4 * hz);
callout_reset(&fdc->sc_timo_ch, 4 * hz, fdctimeot, fdc);
/* specify command */
FDC_WRFIFO(fdc, NE7CMD_SPECIFY);
@ -1543,7 +1555,7 @@ loop:
disk_busy(&fd->sc_dk);
/* allow 3 seconds for operation */
timeout(fdctimeout, fdc, 3 * hz);
callout_reset(&fdc->sc_timo_ch, 3 * hz, fdctimeout, fdc);
if (finfo != NULL) {
/* formatting */
@ -1571,11 +1583,12 @@ loop:
return (1); /* will return later */
case SEEKWAIT:
untimeout(fdctimeout, fdc);
callout_stop(&fdc->sc_timo_ch);
fdc->sc_state = SEEKCOMPLETE;
if (fdc->sc_flags & FDC_NEEDHEADSETTLE) {
/* allow 1/50 second for heads to settle */
timeout(fdcpseudointr, fdc, hz / 50);
callout_reset(&fdc->sc_intr_ch, hz / 50,
fdcpseudointr, fdc);
return (1); /* will return later */
}
/*FALLTHROUGH*/
@ -1605,7 +1618,7 @@ loop:
fdc->sc_state = IOCLEANUPWAIT;
fdc->sc_nstat = 0;
/* 1/10 second should be enough */
timeout(fdctimeout, fdc, hz/10);
callout_reset(&fdc->sc_timo_ch, hz / 10, fdctimeout, fdc);
FTC_FLIP;
return (1);
@ -1623,13 +1636,13 @@ loop:
goto loop;
case IOCLEANUPWAIT: /* IO FAILED, cleanup succeeded */
untimeout(fdctimeout, fdc);
callout_stop(&fdc->sc_timo_ch);
disk_unbusy(&fd->sc_dk, (bp->b_bcount - bp->b_resid));
fdcretry(fdc);
goto loop;
case IOCOMPLETE: /* IO DONE, post-analyze */
untimeout(fdctimeout, fdc);
callout_stop(&fdc->sc_timo_ch);
disk_unbusy(&fd->sc_dk, (bp->b_bcount - bp->b_resid));
@ -1712,12 +1725,12 @@ loop:
fdc->sc_nstat = 0;
fdc->sc_itask = FDC_ITASK_SENSEI;
fdc->sc_state = RESETCOMPLETE;
timeout(fdctimeout, fdc, hz / 2);
callout_reset(&fdc->sc_timo_ch, hz / 2, fdctimeout, fdc);
fdc_reset(fdc);
return (1); /* will return later */
case RESETCOMPLETE:
untimeout(fdctimeout, fdc);
callout_stop(&fdc->sc_timo_ch);
fdconf(fdc);
/* FALLTHROUGH */
@ -1725,18 +1738,19 @@ loop:
fdc->sc_state = RECALWAIT;
fdc->sc_itask = FDC_ITASK_SENSEI;
fdc->sc_nstat = 0;
timeout(fdctimeout, fdc, 5 * hz);
callout_reset(&fdc->sc_timo_ch, 5 * hz, fdctimeout, fdc);
/* recalibrate function */
FDC_WRFIFO(fdc, NE7CMD_RECAL);
FDC_WRFIFO(fdc, fd->sc_drive);
return (1); /* will return later */
case RECALWAIT:
untimeout(fdctimeout, fdc);
callout_stop(&fdc->sc_timo_ch);
fdc->sc_state = RECALCOMPLETE;
if (fdc->sc_flags & FDC_NEEDHEADSETTLE) {
/* allow 1/30 second for heads to settle */
timeout(fdcpseudointr, fdc, hz / 30);
callout_reset(&fdc->sc_intr_ch, hz / 30,
fdcpseudointr, fdc);
return (1); /* will return later */
}
@ -1770,7 +1784,7 @@ xxx:
* We get here if the chip locks up in FDC_WRFIFO()
* Cancel any operation and schedule a reset
*/
untimeout(fdctimeout, fdc);
callout_stop(&fdc->sc_timo_ch);
fdcretry(fdc);
(fdc)->sc_state = DORESET;
goto loop;

View File

@ -1,4 +1,4 @@
/* $NetBSD: kd.c,v 1.8 2000/03/20 11:27:16 pk Exp $ */
/* $NetBSD: kd.c,v 1.9 2000/03/23 06:44:45 thorpej Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -369,7 +369,7 @@ kdstart(tp)
tp->t_state &= ~TS_BUSY;
} else {
/* called at interrupt level - do it later */
timeout(kd_later, (void*)tp, 0);
callout_reset(&tp->t_rstrt_ch, kd_later, tp, 0);
}
}
if (cl->c_cc <= tp->t_lowat) {
@ -476,7 +476,7 @@ kd_rom_iopen(cc)
struct cons_channel *cc;
{
/* Poll for ROM input 4 times per second */
timeout(kd_rom_intr, cc, hz/4);
callout_reset(&cc->cc_callout, hz / 4, kd_rom_intr, cc);
return (0);
}
@ -485,7 +485,7 @@ kd_rom_iclose(cc)
struct cons_channel *cc;
{
untimeout(kd_rom_intr, cc);
callout_stop(&cc->cc_callout);
return (0);
}
@ -500,7 +500,7 @@ kd_rom_intr(arg)
int s, c;
/* Re-schedule */
timeout(kd_rom_intr, arg, hz/4);
callout_reset(&cc->cc_callout, hz / 4, kd_rom_intr, cc);
s = spltty();

View File

@ -1,4 +1,4 @@
/* $NetBSD: tctrl.c,v 1.7 2000/03/14 21:24:54 jdc Exp $ */
/* $NetBSD: tctrl.c,v 1.8 2000/03/23 06:44:45 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -38,6 +38,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/callout.h>
#include <sys/ioctl.h>
#include <sys/select.h>
#include <sys/tty.h>
@ -119,6 +120,8 @@ struct tctrl_softc {
#define TCTRL_STD_DEV 0
#define TCTRL_APMCTL_DEV 8
static struct tctrl_event_ch = CALLOUT_INITIALIZER;
static int tctrl_match __P((struct device *parent, struct cfdata *cf,
void *aux));
static void tctrl_attach __P((struct device *parent, struct device *self,
@ -291,7 +294,8 @@ tctrl_intr(arg)
case TCTRL_IDLE:
if (d == 0xfa) {
/* external event */
timeout(tctrl_read_event_status, (void *)0, 1);
callout_reset(&tctrl_event_ch, 1,
tctrl_read_event_status, NULL);
} else {
printf("%s: (op=0x%02x): unexpected data (0x%02x)\n",
sc->sc_dev.dv_xname, sc->sc_op, d);

View File

@ -1,4 +1,4 @@
/* $NetBSD: auxreg.c,v 1.26 2000/01/28 15:47:18 pk Exp $ */
/* $NetBSD: auxreg.c,v 1.27 2000/03/23 06:44:46 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@ -46,6 +46,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/callout.h>
#include <sys/device.h>
#include <sys/kernel.h>
@ -71,6 +72,8 @@ struct cfattach auxreg_obio_ca = {
};
#ifdef BLINK
static struct callout blink_ch = CALLOUT_INITIALIZER;
static void blink __P((void *zero));
static void
@ -90,7 +93,7 @@ blink(zero)
* etc.
*/
s = (((averunnable.ldavg[0] + FSCALE) * hz) >> (FSHIFT + 1));
timeout(blink, (caddr_t)0, s);
callout_reset(&blink_ch, s, blink, NULL);
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: cons.c,v 1.2 1999/08/05 18:08:13 thorpej Exp $ */
/* $NetBSD: cons.c,v 1.3 2000/03/23 06:45:37 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@ -482,7 +482,7 @@ cnfbstart(tp)
/* printspl = 1;*/
prom_printf("cnfbstart: timeout\r\n");
#endif
timeout(cnfbdma, tp, 1);
callout_reset(&tp->t_rstrt_ch, 1, cnfbdma, tp);
}
}
splx(s);

View File

@ -1,4 +1,4 @@
/* $NetBSD: fd.c,v 1.12 2000/03/16 02:36:56 eeh Exp $ */
/* $NetBSD: fd.c,v 1.13 2000/03/23 06:45:37 thorpej Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995 Charles M. Hannum.
@ -45,6 +45,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/callout.h>
#include <sys/kernel.h>
#include <sys/file.h>
#include <sys/ioctl.h>
@ -110,6 +111,10 @@ struct fdc_softc {
struct device sc_dev; /* boilerplate */
struct intrhand sc_sih;
struct intrhand sc_hih;
struct callout sc_timo_ch; /* timeout callout */
struct callout sc_intr_ch; /* pseudo-intr callout */
caddr_t sc_reg;
struct fd_softc *sc_fd[4]; /* pointers to children */
TAILQ_HEAD(drivehead, fd_softc) sc_drives;
@ -193,6 +198,8 @@ struct fd_softc {
struct fd_type *sc_deftype; /* default type descriptor */
struct fd_type *sc_type; /* current type descriptor */
struct callout sc_motor_ch;
daddr_t sc_blkno; /* starting block number */
int sc_bcount; /* byte count left */
int sc_skip; /* bytes already transferred */
@ -371,6 +378,9 @@ fdcattach(parent, self, aux)
fdc->sc_reg = (caddr_t)mapiodev(ca->ca_ra.ra_reg, 0,
ca->ca_ra.ra_len);
callout_init(&fdc->sc_timo_ch);
callout_init(&fdc->sc_intr_ch);
fdc->sc_state = DEVIDLE;
fdc->sc_istate = ISTATE_IDLE;
fdc->sc_flags |= FDC_EIS;
@ -525,6 +535,8 @@ fdattach(parent, self, aux)
struct fd_type *type = fa->fa_deftype;
int drive = fa->fa_drive;
callout_init(&fd->sc_motor_ch);
/* XXX Allow `flags' to override device type? */
if (type)
@ -628,7 +640,7 @@ fdstrategy(bp)
/* Queue transfer on drive, activate drive and controller if idle. */
s = splbio();
disksort_cylinder(&fd->sc_q, bp);
untimeout(fd_motor_off, fd); /* a good idea */
callout_stop(&fd->sc_motor_ch); /* a good idea */
if (fd->sc_active == 0)
fdstart(fd);
#ifdef DIAGNOSTIC
@ -693,7 +705,7 @@ fdfinish(fd, bp)
biodone(bp);
/* turn off motor 5s from now */
timeout(fd_motor_off, fd, 5 * hz);
callout_reset(&fd->sc_motor_ch, 5 * hz, fd_motor_off, fd);
fdc->sc_state = DEVIDLE;
}
@ -1154,7 +1166,7 @@ loop:
fd->sc_skip = 0;
fd->sc_bcount = bp->b_bcount;
fd->sc_blkno = bp->b_blkno / (FDC_BSIZE / DEV_BSIZE);
untimeout(fd_motor_off, fd);
callout_stop(&fd->sc_motor_ch);
if ((fd->sc_flags & FD_MOTOR_WAIT) != 0) {
fdc->sc_state = MOTORWAIT;
return (1);
@ -1163,7 +1175,7 @@ loop:
/* Turn on the motor, being careful about pairing. */
struct fd_softc *ofd = fdc->sc_fd[fd->sc_drive ^ 1];
if (ofd && ofd->sc_flags & FD_MOTOR) {
untimeout(fd_motor_off, ofd);
callout_stop(&ofd->sc_motor_ch);
ofd->sc_flags &= ~(FD_MOTOR | FD_MOTOR_WAIT);
}
fd->sc_flags |= FD_MOTOR | FD_MOTOR_WAIT;
@ -1171,7 +1183,8 @@ loop:
fdc->sc_state = MOTORWAIT;
if (fdc->sc_flags & FDC_82077) { /* XXX */
/* Allow .25s for motor to stabilize. */
timeout(fd_motor_on, fd, hz / 4);
callout_reset(&fd->sc_motor_ch, hz / 4,
fd_motor_on, fd);
} else {
fd->sc_flags &= ~FD_MOTOR_WAIT;
goto loop;
@ -1213,7 +1226,7 @@ loop:
fd->sc_dk.dk_seek++;
disk_busy(&fd->sc_dk);
timeout(fdctimeout, fdc, 4 * hz);
callout_reset(&fdc->sc_timo_ch, 4 * hz, fdctimeout, fdc);
return (1);
case DOIO:
@ -1282,15 +1295,16 @@ loop:
disk_busy(&fd->sc_dk);
/* allow 2 seconds for operation */
timeout(fdctimeout, fdc, 2 * hz);
callout_reset(&fdc->sc_timo_ch, 2 * hz, fdctimeout, fdc);
return (1); /* will return later */
case SEEKWAIT:
untimeout(fdctimeout, fdc);
callout_stop(&fdc->sc_timo_ch);
fdc->sc_state = SEEKCOMPLETE;
if (fdc->sc_flags & FDC_NEEDHEADSETTLE) {
/* allow 1/50 second for heads to settle */
timeout(fdcpseudointr, fdc, hz / 50);
callout_reset(&fdc->sc_intr_ch, hz / 50,
fdcpseudointr, fdc);
return (1); /* will return later */
}
/*FALLTHROUGH*/
@ -1321,7 +1335,7 @@ loop:
goto loop;
case IOCOMPLETE: /* IO DONE, post-analyze */
untimeout(fdctimeout, fdc);
callout_stop(&fdc->sc_timo_ch);
disk_unbusy(&fd->sc_dk, (bp->b_bcount - bp->b_resid));
@ -1405,11 +1419,11 @@ loop:
fdc->sc_nstat = 0;
fdc->sc_istate = ISTATE_SENSEI;
fdc->sc_state = RESETCOMPLETE;
timeout(fdctimeout, fdc, hz / 2);
callout_reset(&fdc->sc_timo_ch, hz / 2, fdctimeout, fdc);
return (1); /* will return later */
case RESETCOMPLETE:
untimeout(fdctimeout, fdc);
callout_stop(&fdc->sc_timo_ch);
fdconf(fdc);
/* fall through */
@ -1420,15 +1434,16 @@ loop:
/* recalibrate function */
OUT_FDC(fdc, NE7CMD_RECAL, RECALTIMEDOUT);
OUT_FDC(fdc, fd->sc_drive, RECALTIMEDOUT);
timeout(fdctimeout, fdc, 5 * hz);
callout_reset(&fdc->sc_timo_ch, 5 * hz, fdctimeout, fdc);
return (1); /* will return later */
case RECALWAIT:
untimeout(fdctimeout, fdc);
callout_stop(&fdc->sc_timo_ch);
fdc->sc_state = RECALCOMPLETE;
if (fdc->sc_flags & FDC_NEEDHEADSETTLE) {
/* allow 1/30 second for heads to settle */
timeout(fdcpseudointr, fdc, hz / 30);
callout_reset(&fdc->sc_intr_ch, hz / 30,
fdcpseudointr, fdc);
return (1); /* will return later */
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: kd.c,v 1.10 2000/03/21 10:56:23 pk Exp $ */
/* $NetBSD: kd.c,v 1.11 2000/03/23 06:45:37 thorpej Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -358,7 +358,8 @@ kdstart(tp)
tp->t_state &= ~TS_BUSY;
} else {
/* called at interrupt level - do it later */
timeout(kd_later, (void*)tp, 0);
callout_reset(&tp->t_rstrt_ch, 0,
kd_later, tp);
}
} else {
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: auxreg.c,v 1.1.1.1 1998/06/20 04:58:52 eeh Exp $ */
/* $NetBSD: auxreg.c,v 1.2 2000/03/23 06:45:38 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@ -46,6 +46,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/callout.h>
#include <sys/device.h>
#include <sys/kernel.h>
@ -65,6 +66,7 @@ extern struct cfdriver auxreg_cd;
#ifdef BLINK
static void blink __P((void *zero));
static struct callout blink_ch = CALLOUT_INITIALIZER;
static void
blink(zero)
@ -83,7 +85,7 @@ blink(zero)
* etc.
*/
s = (((averunnable.ldavg[0] + FSCALE) * hz) >> (FSHIFT + 1));
timeout(blink, (caddr_t)0, s);
callout_reset(&blink_ch, s, blink, NULL);
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: fd.c,v 1.15 2000/02/07 20:16:53 thorpej Exp $ */
/* $NetBSD: fd.c,v 1.16 2000/03/23 06:46:17 thorpej Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995 Charles M. Hannum.
@ -43,6 +43,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/callout.h>
#include <sys/kernel.h>
#include <sys/file.h>
#include <sys/ioctl.h>
@ -114,6 +115,10 @@ enum fdc_state {
struct fdc_softc {
struct device sc_dev; /* boilerplate */
caddr_t sc_reg;
struct callout sc_timo_ch; /* timeout callout */
struct callout sc_intr_ch; /* pseudo-intr callout */
struct fd_softc *sc_fd[4]; /* pointers to children */
TAILQ_HEAD(drivehead, fd_softc) sc_drives;
enum fdc_state sc_state;
@ -192,6 +197,8 @@ struct fd_softc {
struct fd_type *sc_deftype; /* default type descriptor */
struct fd_type *sc_type; /* current type descriptor */
struct callout sc_motor_ch;
daddr_t sc_blkno; /* starting block number */
int sc_bcount; /* byte count left */
int sc_skip; /* bytes already transferred */
@ -359,6 +366,9 @@ fdcattach(parent, self, aux)
fdc->sc_reg = (caddr_t)bus_mapin(ca->ca_bustype, ca->ca_paddr,
sizeof(union fdreg));
callout_init(&fdc->sc_timo_ch);
callout_init(&fdc->sc_intr_ch);
fdc->sc_state = DEVIDLE;
fdc->sc_istate = ISTATE_IDLE;
fdc->sc_flags |= FDC_EIS;
@ -496,6 +506,8 @@ fdattach(parent, self, aux)
struct fd_type *type = fa->fa_deftype;
int drive = fa->fa_drive;
callout_init(&fd->sc_motor_ch);
/* XXX Allow `flags' to override device type? */
if (type)
@ -623,7 +635,7 @@ fdstrategy(bp)
/* Queue transfer on drive, activate drive and controller if idle. */
s = splbio();
disksort_cylinder(&fd->sc_q, bp);
untimeout(fd_motor_off, fd); /* a good idea */
callout_stop(&fd->sc_motor_ch); /* a good idea */
if (fd->sc_active == 0)
fdstart(fd);
#ifdef DIAGNOSTIC
@ -688,7 +700,7 @@ fdfinish(fd, bp)
biodone(bp);
/* turn off motor 5s from now */
timeout(fd_motor_off, fd, 5 * hz);
callout_reset(&fd->sc_motor_ch, 5 * hz, fd_motor_off, fd);
fdc->sc_state = DEVIDLE;
}
@ -1144,7 +1156,7 @@ loop:
fd->sc_skip = 0;
fd->sc_bcount = bp->b_bcount;
fd->sc_blkno = bp->b_blkno / (FDC_BSIZE / DEV_BSIZE);
untimeout(fd_motor_off, fd);
callout_stop(&fd->sc_motor_ch);
if ((fd->sc_flags & FD_MOTOR_WAIT) != 0) {
fdc->sc_state = MOTORWAIT;
return (1);
@ -1153,7 +1165,7 @@ loop:
/* Turn on the motor, being careful about pairing. */
struct fd_softc *ofd = fdc->sc_fd[fd->sc_drive ^ 1];
if (ofd && ofd->sc_flags & FD_MOTOR) {
untimeout(fd_motor_off, ofd);
callout_stop(&ofd->sc_motor_ch);
ofd->sc_flags &= ~(FD_MOTOR | FD_MOTOR_WAIT);
}
fd->sc_flags |= FD_MOTOR | FD_MOTOR_WAIT;
@ -1161,7 +1173,8 @@ loop:
fdc->sc_state = MOTORWAIT;
if (fdc->sc_flags & FDC_82077) { /* XXX */
/* Allow .25s for motor to stabilize. */
timeout(fd_motor_on, fd, hz / 4);
callout_reset(&fd->sc_motor_ch, hz / 4,
fd_motor_on, fd);
} else {
fd->sc_flags &= ~FD_MOTOR_WAIT;
goto loop;
@ -1202,7 +1215,7 @@ loop:
fd->sc_dk.dk_seek++;
disk_busy(&fd->sc_dk);
timeout(fdctimeout, fdc, 4 * hz);
callout_reset(&fdc->sc_timo_ch, 4 * hz, fdctimeout, fdc);
return (1);
case DOIO:
@ -1282,15 +1295,16 @@ loop:
disk_busy(&fd->sc_dk);
/* allow 2 seconds for operation */
timeout(fdctimeout, fdc, 2 * hz);
callout_reset(&fdc->sc_timo_ch, 2 * hz, fdctimeout, fdc);
return (1); /* will return later */
case SEEKWAIT:
untimeout(fdctimeout, fdc);
callout_stop(&fdc->sc_timo_ch);
fdc->sc_state = SEEKCOMPLETE;
if (fdc->sc_flags & FDC_NEEDHEADSETTLE) {
/* allow 1/50 second for heads to settle */
timeout(fdcpseudointr, fdc, hz / 50);
callout_reset(&fdc->sc_intr_ch, hz / 50,
fdcpseudointr, fdc);
return (1); /* will return later */
}
/*FALLTHROUGH*/
@ -1325,7 +1339,7 @@ loop:
goto loop;
case IOCOMPLETE: /* IO DONE, post-analyze */
untimeout(fdctimeout, fdc);
callout_stop(&fdc->sc_timo_ch);
disk_unbusy(&fd->sc_dk, (bp->b_bcount - bp->b_resid));
@ -1406,11 +1420,11 @@ loop:
fdc->sc_nstat = 0;
fdc->sc_istate = ISTATE_SENSEI;
fdc->sc_state = RESETCOMPLETE;
timeout(fdctimeout, fdc, hz / 2);
callout_reset(&fdc->sc_timo_ch, hz / 2, fdctimeout, fdc);
return (1); /* will return later */
case RESETCOMPLETE:
untimeout(fdctimeout, fdc);
callout_stop(&fdc->sc_timo_ch);
fdconf(fdc);
/* fall through */
@ -1421,15 +1435,16 @@ loop:
/* recalibrate function */
OUT_FDC(fdc, NE7CMD_RECAL, RECALTIMEDOUT);
OUT_FDC(fdc, fd->sc_drive, RECALTIMEDOUT);
timeout(fdctimeout, fdc, 5 * hz);
callout_reset(&fdc->sc_timo_ch, 5 * hz, fdctimeout, fdc);
return (1); /* will return later */
case RECALWAIT:
untimeout(fdctimeout, fdc);
callout_stop(&fdc->sc_timo_ch);
fdc->sc_state = RECALCOMPLETE;
if (fdc->sc_flags & FDC_NEEDHEADSETTLE) {
/* allow 1/30 second for heads to settle */
timeout(fdcpseudointr, fdc, hz / 30);
callout_reset(&fdc->sc_intr_ch, hz / 30,
fdcpseudointr, fdc);
return (1); /* will return later */
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: kd.c,v 1.29 2000/03/19 13:29:14 pk Exp $ */
/* $NetBSD: kd.c,v 1.30 2000/03/23 06:46:17 thorpej Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -314,7 +314,8 @@ kdstart(tp)
tp->t_state &= ~TS_BUSY;
} else {
/* called at interrupt level - do it later */
timeout(kd_later, (void*)tp, 0);
callout_reset(&tp->t_rstrt_ch, 0,
kd_later, tp);
}
} else {
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: xd.c,v 1.25 2000/01/21 23:39:55 thorpej Exp $ */
/* $NetBSD: xd.c,v 1.26 2000/03/23 06:46:17 thorpej Exp $ */
/*
*
@ -440,6 +440,7 @@ xdcattach(parent, self, aux)
/* init queue of waiting bufs */
BUFQ_INIT(&xdc->sc_wq);
callout_init(&xdc->sc_tick_ch);
/*
* section 7 of the manual tells us how to init the controller:
@ -487,7 +488,7 @@ xdcattach(parent, self, aux)
(void) config_found(self, (void *) &xa, xdc_print);
/* start the watchdog clock */
timeout(xdc_tick, xdc, XDC_TICKCNT);
callout_reset(&xdc->sc_tick_ch, XDC_TICKCNT, xdc_tick, xdc);
}
int
@ -2137,7 +2138,7 @@ xdc_tick(arg)
/* until next time */
timeout(xdc_tick, xdcsc, XDC_TICKCNT);
callout_reset(&xdcsc->sc_tick_ch, XDC_TICKCNT, xdc_tick, xdcsc);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: xdvar.h,v 1.6 2000/01/21 23:39:55 thorpej Exp $ */
/* $NetBSD: xdvar.h,v 1.7 2000/03/23 06:46:17 thorpej Exp $ */
/*
*
@ -40,6 +40,8 @@
* author: Chuck Cranor <chuck@ccrc.wustl.edu>
*/
#include <sys/callout.h>
/*
* i/o request: wrapper for hardware's iopb data structure
*/
@ -138,6 +140,8 @@ struct xdc_softc {
struct device sc_dev; /* device struct, reqd by autoconf */
struct evcnt sc_intrcnt; /* event counter (for vmstat -i) */
struct callout sc_tick_ch;
struct xdc *xdc; /* vaddr of vme registers */
int bustype; /* from attach args */

View File

@ -1,4 +1,4 @@
/* $NetBSD: xy.c,v 1.25 2000/02/07 20:16:54 thorpej Exp $ */
/* $NetBSD: xy.c,v 1.26 2000/03/23 06:46:17 thorpej Exp $ */
/*
*
@ -427,12 +427,14 @@ xycattach(parent, self, aux)
ca->ca_intpri, ca->ca_intvec);
evcnt_attach(&xyc->sc_dev, "intr", &xyc->sc_intrcnt);
callout_init(&xyc->sc_tick_ch);
/* now we must look for disks using autoconfig */
for (xa.driveno = 0; xa.driveno < XYC_MAXDEV; xa.driveno++)
(void) config_found(self, (void *) &xa, xyc_print);
/* start the watchdog clock */
timeout(xyc_tick, xyc, XYC_TICKCNT);
callout_reset(&xyc->sc_tick_ch, XYC_TICKCNT, xyc_tick, xyc);
}
static int
@ -1977,7 +1979,7 @@ xyc_tick(arg)
/* until next time */
timeout(xyc_tick, xycsc, XYC_TICKCNT);
callout_rest(&xycsc->sc_tick_ch, XYC_TICKCNT, xyc_tick, xycsc);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: xyvar.h,v 1.5 2000/01/21 23:39:55 thorpej Exp $ */
/* $NetBSD: xyvar.h,v 1.6 2000/03/23 06:46:17 thorpej Exp $ */
/*
*
@ -40,6 +40,8 @@
* author: Chuck Cranor <chuck@ccrc.wustl.edu>
*/
#include <sys/callout.h>
/*
* i/o request: wrapper for hardware's iopb data structure
*/
@ -141,6 +143,8 @@ struct xyc_softc {
struct device sc_dev; /* device struct, reqd by autoconf */
struct evcnt sc_intrcnt; /* event counter (for vmstat -i) */
struct callout sc_tick_ch;
struct xyc *xyc; /* vaddr of vme registers */
int bustype; /* from attach args */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ctu.c,v 1.9 2000/02/07 20:16:54 thorpej Exp $ */
/* $NetBSD: ctu.c,v 1.10 2000/03/23 06:46:44 thorpej Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -43,6 +43,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/callout.h>
#include <sys/kernel.h>
#include <sys/buf.h>
#include <sys/fcntl.h>
@ -98,6 +99,7 @@ void ctustrategy __P((struct buf *));
int ctuioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
int ctudump __P((dev_t, daddr_t, caddr_t, size_t));
static struct callout ctu_watch_ch = CALLOUT_INITIALIZER;
void
ctuattach()
@ -131,7 +133,7 @@ ctuopen(dev, oflags, devtype, p)
tu_sc.sc_error = 0;
mtpr(0100, PR_CSRS); /* Enable receive interrupt */
timeout(ctuwatch, 0, 100); /* Check once/second */
callout_reset(&ctu_watch_ch, hz, ctuwatch, NULL);
tu_sc.sc_state = SC_INIT;
@ -161,7 +163,7 @@ ctuclose(dev, oflags, devtype, p)
mtpr(0, PR_CSRS);
mtpr(0, PR_CSTS);
tu_sc.sc_state = SC_UNUSED;
untimeout(ctuwatch, 0);
callout_stop(&ctu_watch_ch);
return 0;
}
@ -398,7 +400,7 @@ ctuwatch(arg)
void *arg;
{
timeout(ctuwatch, 0, 1000);
callout_reset(&ctu_watch_ch, hz, ctuwatch, NULL);
if (tu_sc.sc_state == SC_GET_RESP && tu_sc.sc_tpblk != 0 &&
tu_sc.sc_tpblk == oldtp && (tu_sc.sc_tpblk % 128 != 0)) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: smg.c,v 1.20 1999/12/12 14:40:55 ragge Exp $ */
/* $NetBSD: smg.c,v 1.21 2000/03/23 06:46:44 thorpej Exp $ */
/*
* Copyright (c) 1998 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -33,6 +33,7 @@
#include <sys/param.h>
#include <sys/device.h>
#include <sys/systm.h>
#include <sys/callout.h>
#include <sys/time.h>
#include <sys/malloc.h>
#include <sys/conf.h>
@ -140,6 +141,8 @@ struct smg_screen {
static struct smg_screen smg_conscreen;
static struct smg_screen *curscr;
static struct callout smg_cursor_ch = CALLOUT_INITIALIZER;
int
smg_match(parent, match, aux)
struct device *parent;
@ -191,7 +194,7 @@ smg_attach(parent, self, aux)
aa.console = !(vax_confdata & 0x20);
aa.scrdata = &smg_screenlist;
aa.accessops = &smg_accessops;
timeout(smg_crsr_blink, 0, hz/2);
callout_reset(&smc_cursor_ch, hz / 2, smg_crsr_blink, NULL);
config_found(self, &aa, wsemuldisplaydevprint);
}
@ -205,7 +208,7 @@ smg_crsr_blink(arg)
{
if (cur_on)
*cursor ^= 255;
timeout(smg_crsr_blink, 0, hz/2);
callout_reset(&smg_cursor_ch, hz / 2, smg_crsr_blink, NULL);
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: com.c,v 1.16 1999/11/22 03:53:40 sommerfeld Exp $ */
/* $NetBSD: com.c,v 1.17 2000/03/23 06:47:32 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -118,6 +118,8 @@ struct com_softc {
void *sc_ih;
struct tty *sc_tty;
struct callout sc_diag_ch;
int sc_overflows;
int sc_floods;
int sc_errors;
@ -145,6 +147,8 @@ struct com_softc {
u_char sc_ibufs[2][COM_IBUFSIZE];
};
struct callout com_poll_ch = CALLOUT_INITIALIZER;
int comprobe __P((struct device *, struct cfdata *, void *));
void comattach __P((struct device *, struct device *, void *));
int comprobe1 __P((int));
@ -348,6 +352,8 @@ comattach(parent, dev, aux)
int *hayespp;
#endif
callout_init(&sc->sc_diag_ch);
sc->sc_iobase = iobase;
sc->sc_hwflags = 0;
sc->sc_swflags = 0;
@ -483,7 +489,7 @@ comopen(dev, flag, mode, p)
ttsetwater(tp);
if (comsopen++ == 0)
timeout(compoll, NULL, 1);
callout_reset(&com_poll_ch, 1, compoll, NULL);
sc->sc_ibufp = sc->sc_ibuf = sc->sc_ibufs[0];
sc->sc_ibufhigh = sc->sc_ibuf + COM_IHIGHWATER;
@ -585,7 +591,7 @@ comclose(dev, flag, mode, p)
}
CLR(tp->t_state, TS_BUSY | TS_FLUSH);
if (--comsopen == 0)
untimeout(compoll, NULL);
callout_stop(&com_poll_ch);
splx(s);
ttyclose(tp);
#ifdef notyet /* XXXX */
@ -1041,7 +1047,8 @@ compoll(arg)
if (*ibufp & LSR_OE) {
sc->sc_overflows++;
if (sc->sc_errors++ == 0)
timeout(comdiag, sc, 60 * hz);
callout_reset(&sc->sc_diag_ch, 60 * hz,
comdiag, sc);
}
/* This is ugly, but fast. */
c |= lsrmap[(*ibufp++ & (LSR_BI|LSR_FE|LSR_PE)) >> 2];
@ -1050,7 +1057,7 @@ compoll(arg)
}
out:
timeout(compoll, NULL, 1);
callout_reset(&com_poll_ch, 1, compoll, NULL);
}
int
@ -1090,7 +1097,8 @@ comintr(arg)
if (p >= sc->sc_ibufend) {
sc->sc_floods++;
if (sc->sc_errors++ == 0)
timeout(comdiag, sc, 60 * hz);
callout_reset(&sc->sc_diag_ch,
60 * hz, comdiag, sc);
} else {
*p++ = data;
*p++ = lsr;

View File

@ -1,4 +1,4 @@
/* $NetBSD: fd.c,v 1.30 2000/02/07 20:16:54 thorpej Exp $ */
/* $NetBSD: fd.c,v 1.31 2000/03/23 06:47:32 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -79,6 +79,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/callout.h>
#include <sys/kernel.h>
#include <sys/conf.h>
#include <sys/file.h>
@ -150,6 +151,10 @@ struct fdc_softc {
bus_space_tag_t sc_iot; /* intio i/o space identifier */
bus_space_handle_t sc_ioh; /* intio io handle */
struct callout sc_timo_ch; /* timeout callout */
struct callout sc_intr_ch; /* pseudo-intr callout */
bus_dma_tag_t sc_dmat; /* intio dma tag */
bus_dmamap_t sc_dmamap; /* dma map */
u_int8_t *sc_addr; /* physical address */
@ -220,6 +225,8 @@ struct fd_softc {
struct fd_type *sc_deftype; /* default type descriptor */
struct fd_type *sc_type; /* current type descriptor */
struct callout sc_motor_ch;
daddr_t sc_blkno; /* starting block number */
int sc_bcount; /* byte count left */
int sc_opts; /* user-set options */
@ -422,6 +429,9 @@ fdcattach(parent, self, aux)
printf("\n");
callout_init(&fdc->sc_timo_ch);
callout_init(&fdc->sc_intr_ch);
/* Re-map the I/O space. */
bus_space_map(iot, ia->ia_addr, 0x2000, BUS_SPACE_MAP_SHIFTED, &ioh);
@ -579,6 +589,8 @@ fdattach(parent, self, aux)
struct fd_type *type = &fd_types[0]; /* XXX 1.2MB */
int drive = fa->fa_drive;
callout_init(&fd->sc_motor_ch);
fd->sc_flags = 0;
if (type)
@ -680,7 +692,7 @@ fdstrategy(bp)
/* Queue transfer on drive, activate drive and controller if idle. */
s = splbio();
disksort_cylinder(&fd->sc_q, bp);
untimeout(fd_motor_off, fd); /* a good idea */
callout_stop(&fd->sc_motor_ch); /* a good idea */
if (fd->sc_active == 0)
fdstart(fd);
#ifdef DIAGNOSTIC
@ -749,7 +761,7 @@ fdfinish(fd, bp)
biodone(bp);
/* turn off motor 5s from now */
timeout(fd_motor_off, fd, 5 * hz);
callout_reset(&fd->sc_motor_ch, 5 * hz, fd_motor_off, fd);
fdc->sc_state = DEVIDLE;
}
@ -1097,7 +1109,7 @@ loop:
fd->sc_skip = 0;
fd->sc_bcount = bp->b_bcount;
fd->sc_blkno = bp->b_blkno / (FDC_BSIZE / DEV_BSIZE);
untimeout(fd_motor_off, fd);
callout_stop(&fd->sc_motor_ch);
if ((fd->sc_flags & FD_MOTOR_WAIT) != 0) {
fdc->sc_state = MOTORWAIT;
return 1;
@ -1108,7 +1120,7 @@ loop:
for (i = 0; i < 4; i++) {
struct fd_softc *ofd = fdc->sc_fd[i];
if (ofd && ofd->sc_flags & FD_MOTOR) {
untimeout(fd_motor_off, ofd);
callout_stop(&ofd->sc_motor_ch);
ofd->sc_flags &= ~(FD_MOTOR | FD_MOTOR_WAIT);
break;
}
@ -1117,7 +1129,8 @@ loop:
fd_set_motor(fdc, 0);
fdc->sc_state = MOTORWAIT;
/* allow .5s for motor to stabilize */
timeout(fd_motor_on, fd, hz / 2);
callout_reset(&fd->sc_motor_ch, hz / 2,
fd_motor_on, fd);
return 1;
}
/* Make sure the right drive is selected. */
@ -1144,7 +1157,7 @@ loop:
fd->sc_dk.dk_seek++;
disk_busy(&fd->sc_dk);
timeout(fdctimeout, fdc, 4 * hz);
callout_stop(&fdc->sc_timo_ch, 4 * hz, fdctimeout, fdc);
return 1;
case DOIO:
@ -1234,7 +1247,7 @@ loop:
disk_busy(&fd->sc_dk);
/* allow 2 seconds for operation */
timeout(fdctimeout, fdc, 2 * hz);
callout_reset(&fdc->sc_timo_ch, 2 * hz, fdctimeout, fdc);
return 1; /* will return later */
case DOCOPY:
@ -1252,7 +1265,7 @@ loop:
out_fdc(iot, ioh, type->datalen); /* data length */
fdc->sc_state = COPYCOMPLETE;
/* allow 2 seconds for operation */
timeout(fdctimeout, fdc, 2 * hz);
callout_reset(&fdc->sc_timo_ch, 2 * hz, fdctimeout, fdc);
return 1; /* will return later */
case DOIOHALF:
@ -1303,15 +1316,15 @@ loop:
out_fdc(iot, ioh, fd->sc_type->datalen); /* data length */
fdc->sc_state = IOCOMPLETE;
/* allow 2 seconds for operation */
timeout(fdctimeout, fdc, 2 * hz);
callout_reset(&fdc->sc_timo_ch, 2 * hz, fdctimeout, fdc);
return 1; /* will return later */
case SEEKWAIT:
untimeout(fdctimeout, fdc);
callout_stop(&fdc->sc_timo_ch);
fdc->sc_state = SEEKCOMPLETE;
/* allow 1/50 second for heads to settle */
#if 0
timeout(fdcpseudointr, fdc, hz / 50);
callout_reset(&fdc->sc_intr_ch, hz / 50, fdcpseudointr, fdc);
#endif
return 1;
@ -1348,7 +1361,7 @@ loop:
goto loop;
case IOCOMPLETE: /* IO DONE, post-analyze */
untimeout(fdctimeout, fdc);
callout_stop(&fdc->sc_timo_ch);
DPRINTF(("fdcintr: in IOCOMPLETE\n"));
if ((tmp = fdcresult(fdc)) != 7 || (st0 & 0xf8) != 0) {
printf("fdcintr: resnum=%d, st0=%x\n", tmp, st0);
@ -1388,7 +1401,7 @@ loop:
case COPYCOMPLETE: /* IO DONE, post-analyze */
DPRINTF(("fdcintr: COPYCOMPLETE:"));
untimeout(fdctimeout, fdc);
callout_stop(&fdc->sc_timo_ch);
if ((tmp = fdcresult(fdc)) != 7 || (st0 & 0xf8) != 0) {
printf("fdcintr: resnum=%d, st0=%x\n", tmp, st0);
#if 0
@ -1410,12 +1423,12 @@ loop:
DELAY(100);
fd_set_motor(fdc, 0);
fdc->sc_state = RESETCOMPLETE;
timeout(fdctimeout, fdc, hz / 2);
callout_reset(&fdc->sc_timo_ch, hz / 2, fdctimeout, fdc);
return 1; /* will return later */
case RESETCOMPLETE:
DPRINTF(("fdcintr: in RESETCOMPLETE\n"));
untimeout(fdctimeout, fdc);
callout_stop(&fdc->sc_timo_ch);
/* clear the controller output buffer */
for (i = 0; i < 4; i++) {
out_fdc(iot, ioh, NE7CMD_SENSEI);
@ -1428,16 +1441,16 @@ loop:
out_fdc(iot, ioh, NE7CMD_RECAL); /* recalibrate function */
out_fdc(iot, ioh, fd->sc_drive);
fdc->sc_state = RECALWAIT;
timeout(fdctimeout, fdc, 5 * hz);
callout_reset(&fdc->sc_timo_ch, 5 * hz, fdctimeout, fdc);
return 1; /* will return later */
case RECALWAIT:
DPRINTF(("fdcintr: in RECALWAIT\n"));
untimeout(fdctimeout, fdc);
callout_stop(&fdc->sc_timo_ch);
fdc->sc_state = RECALCOMPLETE;
/* allow 1/30 second for heads to settle */
#if 0
timeout(fdcpseudointr, fdc, hz / 30);
callout_reset(&fdc->sc_intr_ch, hz / 30, fdcpseudointr, fdc);
#endif
return 1; /* will return later */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite.c,v 1.20 1999/06/27 14:14:30 minoura Exp $ */
/* $NetBSD: ite.c,v 1.21 2000/03/23 06:47:32 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -556,7 +556,7 @@ itestart(tp)
/* we have characters remaining. */
if (rbp->c_cc) {
tp->t_state |= TS_TIMEOUT;
timeout(ttrstrt, (caddr_t)tp, 1);
callout_reset(&tp->t_rstrt_ch, 1, ttrstrt, tp);
}
/* wakeup we are below */
if (rbp->c_cc <= tp->t_lowat) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: mha.c,v 1.18 1999/11/18 15:03:03 minoura Exp $ */
/* $NetBSD: mha.c,v 1.19 2000/03/23 06:47:33 thorpej Exp $ */
/*-
* Copyright (c) 1996-1999 The NetBSD Foundation, Inc.
@ -729,7 +729,8 @@ mha_scsi_cmd(xs)
ACB_SETQ(acb, ACB_QREADY);
TAILQ_INSERT_TAIL(&sc->ready_list, acb, chain);
#if 1
timeout(mha_timeout, acb, (xs->timeout*hz)/1000);
callout_reset(&acb->xs->xs_callout, (xs->timeout*hz)/1000,
mha_timeout, acb);
#endif
/*
@ -919,7 +920,7 @@ mha_done(sc, acb)
SPC_TRACE(("[mha_done(error:%x)] ", xs->error));
#if 1
untimeout(mha_timeout, acb);
callout_stop(&acb->xs->xs_callout);
#endif
/*
@ -962,7 +963,8 @@ mha_done(sc, acb)
ACB_SETQ(acb, ACB_QREADY);
ti->lubusy &= ~(1<<sc_link->scsipi_scsi.lun);
ti->senses++;
timeout(mha_timeout, acb, (xs->timeout*hz)/1000);
callout_reset(&acb->xs->xs_callout,
(xs->timeout*hz)/1000, mha_timeout, acb);
if (sc->sc_nexus == acb) {
sc->sc_nexus = NULL;
sc->sc_state = SPC_IDLE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ms.c,v 1.9 2000/01/14 08:22:42 itohy Exp $ */
/* $NetBSD: ms.c,v 1.10 2000/03/23 06:47:33 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@ -101,6 +101,8 @@ struct ms_softc {
struct device ms_dev; /* required first: base device */
struct zs_chanstate *ms_cs;
struct callout ms_modem_ch;
/* Flags to communicate with ms_softintr() */
volatile int ms_intr_flags;
#define INTR_RX_OVERRUN 1
@ -181,6 +183,8 @@ ms_attach(parent, self, aux)
struct cfdata *cf;
int reset, s;
callout_init(&ms->ms_modem_ch);
cf = ms->ms_dev.dv_cfdata;
cs = zsc->zsc_cs[1];
cs->cs_private = ms;
@ -254,7 +258,7 @@ msclose(dev, flags, mode, p)
ms = ms_cd.cd_devs[minor(dev)];
ms->ms_ready = 0; /* stop accepting events */
untimeout(ms_modem, ms);
callout_stop(&ms->ms_modem_ch);
ev_fini(&ms->ms_events);
ms->ms_events.ev_io = NULL;
@ -688,5 +692,5 @@ ms_modem(arg)
}
(void) splx(s);
timeout(ms_modem, ms, 2);
callout_reset(&ms->ms_modem_ch, 2, ms_modem, ms);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: opmbell.c,v 1.6 1999/03/24 14:07:39 minoura Exp $ */
/* $NetBSD: opmbell.c,v 1.7 2000/03/23 06:47:33 thorpej Exp $ */
/*
* Copyright (c) 1995 MINOURA Makoto, Takuya Harakawa.
@ -53,6 +53,7 @@
#include <sys/malloc.h>
#include <sys/file.h>
#include <sys/systm.h>
#include <sys/callout.h>
#include <sys/conf.h>
#include <x68k/x68k/iodevice.h>
@ -81,6 +82,8 @@ struct bell_softc {
struct bell_softc *bell_softc;
struct callout bell_ch = CALLOUT_INITIALIZER;
static struct opm_voice vtab[NBELL];
/* sc_flags values */
@ -437,7 +440,7 @@ opm_bell()
bell_on(sc);
sc->sc_flags |= BELLF_OUT;
timeout(bell_timeout, (caddr_t)NULL, ticks);
callout_reset(&bell_ch, ticks, bell_timeout, NULL);
}
}
@ -449,7 +452,7 @@ bell_timeout(arg)
sc->sc_flags &= ~BELLF_OUT;
bell_off(sc);
untimeout(bell_timeout, (caddr_t)NULL);
callout_stop(&bell_ch);
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: par.c,v 1.9 1999/08/05 18:08:14 thorpej Exp $ */
/* $NetBSD: par.c,v 1.10 2000/03/23 06:47:33 thorpej Exp $ */
/*
* Copyright (c) 1982, 1990 The Regents of the University of California.
@ -54,6 +54,7 @@
#include <sys/malloc.h>
#include <sys/file.h>
#include <sys/systm.h>
#include <sys/callout.h>
#include <sys/proc.h>
#include <sys/conf.h>
@ -77,6 +78,8 @@ struct par_softc {
#define sc_burst sc_param.burst
#define sc_timo sc_param.timo
#define sc_delay sc_param.delay
struct callout sc_timo_ch;
struct callout sc_start_ch;
} ;
/* sc_flags values */
@ -88,6 +91,8 @@ struct par_softc {
#define PARF_OREAD 0x40 /* no support */
#define PARF_OWRITE 0x80
static struct callout intr_callout = CALLOUT_INITIALIZER;
#define UNIT(x) minor(x)
#ifdef DEBUG
@ -138,6 +143,9 @@ parattach(pdp, dp, aux)
sc->sc_flags = PARF_ALIVE;
printf(": parallel port (write only, interrupt)\n");
ioctlr.intr &= (~PRTI_EN);
callout_init(&sc->sc_timo_ch);
callout_init(&sc->sc_start_ch);
}
int
@ -191,11 +199,10 @@ void
parstart(arg)
void *arg;
{
int unit = (int)arg;
struct par_softc *sc = par_cd.cd_devs[unit];
struct par_softc *sc = arg;
#ifdef DEBUG
if (pardebug & PDB_FOLLOW)
printf("parstart(%x)\n", unit);
printf("parstart(%x)\n", sc->sc_dev.dv_unit);
#endif
sc->sc_flags &= ~PARF_DELAY;
wakeup(sc);
@ -205,11 +212,10 @@ void
partimo(arg)
void *arg;
{
int unit = (int)arg;
struct par_softc *sc = par_cd.cd_devs[unit];
struct par_softc *sc = arg;
#ifdef DEBUG
if (pardebug & PDB_FOLLOW)
printf("partimo(%x)\n", unit);
printf("partimo(%x)\n", sc->sc_dev.dv_unit);
#endif
sc->sc_flags &= ~(PARF_UIO|PARF_TIMO);
wakeup(sc);
@ -253,7 +259,7 @@ parrw(dev, uio)
sc->sc_flags |= PARF_UIO;
if (sc->sc_timo > 0) {
sc->sc_flags |= PARF_TIMO;
timeout(partimo, (void *) unit, sc->sc_timo);
callout_reset(&sc->sc_timo_ch, sc->sc_timo, partimo, sc);
}
while (uio->uio_resid > 0) {
len = min(buflen, uio->uio_resid);
@ -276,7 +282,7 @@ parrw(dev, uio)
sc->sc_flags);
#endif
if (sc->sc_flags & PARF_TIMO) {
untimeout(partimo, (void *) unit);
callout_stop(&sc->sc_timo_ch);
sc->sc_flags &= ~PARF_TIMO;
}
splx(s);
@ -309,7 +315,8 @@ parrw(dev, uio)
*/
if (sc->sc_delay > 0) {
sc->sc_flags |= PARF_DELAY;
timeout(parstart, (void *) unit, sc->sc_delay);
callout_reset(&sc->sc_start_ch, sc->sc_delay,
parstart, sc);
error = tsleep(sc, PCATCH|(PZERO-1), "par-cdelay", 0);
if (error) {
splx(s);
@ -330,11 +337,11 @@ parrw(dev, uio)
}
s = splsoftclock();
if (sc->sc_flags & PARF_TIMO) {
untimeout(partimo, (void *) unit);
callout_stop(&sc->sc_timo_ch);
sc->sc_flags &= ~PARF_TIMO;
}
if (sc->sc_flags & PARF_DELAY) {
untimeout(parstart, (void *) unit);
callout_stop(&sc->sc_start_ch);
sc->sc_flags &= ~PARF_DELAY;
}
splx(s);
@ -449,7 +456,7 @@ parintr(arg)
*/
if (mask) {
if (partimeout_pending)
untimeout (parintr, 0);
callout_stop(&intr_callout);
if (parsend_pending)
parsend_pending = 0;
}
@ -478,7 +485,7 @@ parsendch(ch)
extern int hz;
/* wait a second, and try again */
timeout (parintr, 0, hz);
callout_reset(&intr_callout, hz, parintr, 0);
partimeout_pending = 1;
/* this is essentially a flipflop to have us wait for the
first character being transmitted when trying to transmit
@ -493,7 +500,7 @@ parsendch(ch)
printf ("parsendch interrupted, error = %d\n", error);
#endif
if (partimeout_pending)
untimeout (parintr, 0);
callout_stop(&intr_callout);
partimeout_pending = 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.77 2000/02/21 20:38:51 erh Exp $ */
/* $NetBSD: machdep.c,v 1.78 2000/03/23 06:47:33 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -57,6 +57,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/callout.h>
#include <sys/signalvar.h>
#include <sys/kernel.h>
#include <sys/map.h>
@ -999,6 +1000,8 @@ int crashandburn = 0;
int candbdelay = 50; /* give em half a second */
void candbtimer __P((void *));
static struct callout candbtimer_ch = CALLOUT_INITIALIZER;
void
candbtimer(arg)
void *arg;
@ -1040,7 +1043,8 @@ nmihand(frame)
"forced crash, nosync" : "forced crash");
}
crashandburn++;
timeout(candbtimer, (void *)0, candbdelay);
callout_reset(&candbtimer_ch, candbdelay,
candbtimer, NULL);
}
#endif /* DDB */
#endif /* PANICBUTTON */

View File

@ -1,4 +1,4 @@
/* $NetBSD: hpux_compat.c,v 1.45 1999/08/25 04:50:08 thorpej Exp $ */
/* $NetBSD: hpux_compat.c,v 1.46 2000/03/23 06:48:16 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -1208,7 +1208,7 @@ hpux_sys_alarm_6x(p, v, retval)
} */ *uap = v;
int s = splhigh();
untimeout(realitexpire, (caddr_t)p);
callout_stop(&p->p_realit_ch);
timerclear(&p->p_realtimer.it_interval);
*retval = 0;
if (timerisset(&p->p_realtimer.it_value) &&
@ -1221,7 +1221,8 @@ hpux_sys_alarm_6x(p, v, retval)
}
p->p_realtimer.it_value = time;
p->p_realtimer.it_value.tv_sec += SCARG(uap, deltat);
timeout(realitexpire, (caddr_t)p, hzto(&p->p_realtimer.it_value));
callout_reset(&p->p_realit_ch, hxto(&p->p_realtimer.it_value),
realitexpire, p);
splx(s);
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_misc_notalpha.c,v 1.52 1999/08/16 19:06:29 tron Exp $ */
/* $NetBSD: linux_misc_notalpha.c,v 1.53 2000/03/23 06:48:17 thorpej Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -93,7 +93,7 @@ linux_sys_alarm(p, v, retval)
/*
* Clear any pending timer alarms.
*/
untimeout(realitexpire, p);
callout_stop(&p->p_realit_ch);
timerclear(&itp->it_interval);
if (timerisset(&itp->it_value) &&
timercmp(&itp->it_value, &time, >))
@ -127,7 +127,8 @@ linux_sys_alarm(p, v, retval)
if (timerisset(&it.it_value)) {
timeradd(&it.it_value, &time, &it.it_value);
timeout(realitexpire, p, hzto(&it.it_value));
callout_reset(&p->p_realit_ch, hzto(&it.it_value),
realitexpire, p);
}
p->p_realtimer = it;
splx(s);

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_netbsd.c,v 1.23 2000/02/06 16:45:56 eeh Exp $ */
/* $NetBSD: netbsd32_netbsd.c,v 1.24 2000/03/23 06:48:17 thorpej Exp $ */
/*
* Copyright (c) 1998 Matthew R. Green
@ -2313,10 +2313,11 @@ netbsd32_setitimer(p, v, retval)
return (EINVAL);
s = splclock();
if (which == ITIMER_REAL) {
untimeout(realitexpire, p);
callout_stop(&p->p_realit_ch);
if (timerisset(&aitv.it_value)) {
timeradd(&aitv.it_value, &time, &aitv.it_value);
timeout(realitexpire, p, hzto(&aitv.it_value));
callout_reset(&p->p_realit_ch, hzto(&aitv.it_value),
realitexpire, p);
}
p->p_realtimer = aitv;
} else

View File

@ -1,4 +1,4 @@
/* $NetBSD: param.c,v 1.32 1999/12/04 10:55:11 ragge Exp $ */
/* $NetBSD: param.c,v 1.33 2000/03/23 06:48:37 thorpej Exp $ */
/*
* Copyright (c) 1980, 1986, 1989 Regents of the University of California.
@ -80,23 +80,31 @@
#ifdef TIMEZONE
#error TIMEZONE is an obsolete kernel option.
#endif
#ifdef DST
#error DST is an obsolete kernel option.
#endif
#ifndef RTC_OFFSET
#define RTC_OFFSET 0
#endif
#ifndef HZ
#define HZ 100
#endif
#ifndef MAXFILES
#define MAXFILES (3 * (NPROC + MAXUSERS) + 80)
#endif
int hz = HZ;
int tick = 1000000 / HZ;
int tickadj = 240000 / (60 * HZ); /* can adjust 240ms in 60s */
int rtc_offset = RTC_OFFSET;
int maxproc = NPROC;
int desiredvnodes = NVNODE;
int maxfiles = 3 * (NPROC + MAXUSERS) + 80;
int ncallout = 16 + NPROC;
int maxfiles = MAXFILES;
int ncallout = 16 + NPROC; /* size of callwheel (rounded to ^2) */
u_long sb_max = SB_MAX; /* maximum socket buffer size */
int fscale = FSCALE; /* kernel uses `FSCALE', user uses `fscale' */
@ -173,7 +181,6 @@ struct msginfo msginfo = {
* them here forces loader errors if this file is omitted
* (if they've been externed everywhere else; hah!).
*/
struct callout *callout;
struct buf *buf;
char *buffers;