diff options
| author | thorpej <thorpej@NetBSD.org> | 2000-03-23 07:01:25 +0000 |
|---|---|---|
| committer | thorpej <thorpej@NetBSD.org> | 2000-03-23 07:01:25 +0000 |
| commit | fc96443d15841c054ada325a7591d905aade4ae2 (patch) | |
| tree | d86394c3673309d14fbe1847d8b277e71a9e05ee /sys/dev | |
| parent | 7b918b40885e9e3be8055683d3749a90e5d131f9 (diff) | |
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.
Diffstat (limited to 'sys/dev')
118 files changed, 800 insertions, 405 deletions
diff --git a/sys/dev/ata/ata_wdc.c b/sys/dev/ata/ata_wdc.c index 83e2b710b0c..46a0385f2cc 100644 --- a/sys/dev/ata/ata_wdc.c +++ b/sys/dev/ata/ata_wdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ata_wdc.c,v 1.23 2000/01/17 00:01:00 bouyer Exp $ */ +/* $NetBSD: ata_wdc.c,v 1.24 2000/03/23 07:01:27 thorpej Exp $ */ /* * Copyright (c) 1998 Manuel Bouyer. @@ -170,7 +170,8 @@ wdc_ata_bio_start(chp, xfer) /* start timeout machinery */ if ((ata_bio->flags & ATA_POLL) == 0) - timeout(wdctimeout, chp, ATA_DELAY / 1000 * hz); + callout_reset(&chp->ch_callout, ATA_DELAY / 1000 * hz, + wdctimeout, chp); _wdc_ata_bio_start(chp, xfer); } @@ -588,7 +589,7 @@ wdc_ata_bio_kill_xfer(chp, xfer) struct ata_bio *ata_bio = xfer->cmd; int drive = xfer->drive; - untimeout(wdctimeout, chp); + callout_stop(&chp->ch_callout); /* remove this command from xfer queue */ wdc_free_xfer(chp, xfer); @@ -614,7 +615,7 @@ wdc_ata_bio_done(chp, xfer) (u_int)xfer->c_flags), DEBUG_XFERS); - untimeout(wdctimeout, chp); + callout_stop(&chp->ch_callout); /* feed back residual bcount to our caller */ ata_bio->bcount = xfer->c_bcount; diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c index b393e23c007..abe1ffdca75 100644 --- a/sys/dev/ata/wd.c +++ b/sys/dev/ata/wd.c @@ -1,4 +1,4 @@ -/* $NetBSD: wd.c,v 1.202 2000/02/07 20:16:55 thorpej Exp $ */ +/* $NetBSD: wd.c,v 1.203 2000/03/23 07:01:27 thorpej Exp $ */ /* * Copyright (c) 1998 Manuel Bouyer. All rights reserved. @@ -134,6 +134,7 @@ struct wd_softc { struct device sc_dev; struct disk sc_dk; struct buf_queue sc_q; + struct callout sc_restart_ch; /* IDE disk soft states */ struct ata_bio sc_wdc_bio; /* current transfer */ struct buf *sc_bp; /* buf being transfered */ @@ -261,6 +262,7 @@ wdattach(parent, self, aux) char buf[41], pbuf[9], c, *p, *q; WDCDEBUG_PRINT(("wdattach\n"), DEBUG_FUNCS | DEBUG_PROBE); + callout_init(&wd->sc_restart_ch); BUFQ_INIT(&wd->sc_q); wd->openings = aa_link->aa_openings; @@ -551,7 +553,7 @@ __wdstart(wd, bp) disk_busy(&wd->sc_dk); switch (wdc_ata_bio(wd->drvp, &wd->sc_wdc_bio)) { case WDC_TRY_AGAIN: - timeout(wdrestart, wd, hz); + callout_reset(&wd->sc_restart_ch, hz, wdrestart, wd); break; case WDC_QUEUED: case WDC_COMPLETE: @@ -595,7 +597,8 @@ retry: /* Just reset and retry. Can we do more ? */ wd->sc_wdc_bio.blkdone, wd->sc_dk.dk_label); if (wd->retries++ < WDIORETRIES) { printf(", retrying\n"); - timeout(wdrestart, wd, RECOVERYTIME); + callout_reset(&wd->sc_restart_ch, RECOVERYTIME, + wdrestart, wd); return; } printf("\n"); diff --git a/sys/dev/eisa/ahb.c b/sys/dev/eisa/ahb.c index 1e47310a6da..0f8bd0e97b1 100644 --- a/sys/dev/eisa/ahb.c +++ b/sys/dev/eisa/ahb.c @@ -1,4 +1,4 @@ -/* $NetBSD: ahb.c,v 1.28 1999/09/30 23:04:39 thorpej Exp $ */ +/* $NetBSD: ahb.c,v 1.29 2000/03/23 07:01:28 thorpej Exp $ */ #include "opt_ddb.h" @@ -324,7 +324,8 @@ ahb_send_mbox(sc, opcode, ecb) ecb->xs->sc_link->scsipi_scsi.target); if ((ecb->xs->xs_control & XS_CTL_POLL) == 0) - timeout(ahb_timeout, ecb, (ecb->timeout * hz) / 1000); + callout_reset(&ecb->xs->xs_callout, + (ecb->timeout * hz) / 1000, ahb_timeout, ecb); } /* @@ -357,7 +358,8 @@ ahb_send_immed(sc, cmd, ecb) ecb->xs->sc_link->scsipi_scsi.target); if ((ecb->xs->xs_control & XS_CTL_POLL) == 0) - timeout(ahb_timeout, ecb, (ecb->timeout * hz) / 1000); + callout_reset(&ecb->xs->xs_callout, + (ecb->timeout * hz) / 1000, ahb_timeout, ecb); } /* @@ -426,7 +428,7 @@ ahbintr(arg) goto next; } - untimeout(ahb_timeout, ecb); + callout_stop(&ecb->xs->xs_callout); ahb_done(sc, ecb); next: diff --git a/sys/dev/eisa/uha_eisa.c b/sys/dev/eisa/uha_eisa.c index 44911c5d127..9e2a38be7c7 100644 --- a/sys/dev/eisa/uha_eisa.c +++ b/sys/dev/eisa/uha_eisa.c @@ -1,4 +1,4 @@ -/* $NetBSD: uha_eisa.c,v 1.14 1999/09/30 23:04:39 thorpej Exp $ */ +/* $NetBSD: uha_eisa.c,v 1.15 2000/03/23 07:01:28 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -262,7 +262,8 @@ u24_start_mbox(sc, mscp) bus_space_write_1(iot, ioh, U24_LINT, U24_OGMFULL); if ((mscp->xs->xs_control & XS_CTL_POLL) == 0) - timeout(uha_timeout, mscp, (mscp->timeout * hz) / 1000); + callout_reset(&mscp->xs->xs_callout, + (mscp->timeout * hz) / 1000, uha_timeout, mscp); } int @@ -330,7 +331,7 @@ u24_intr(arg) sc->sc_dev.dv_xname); continue; /* whatever it was, it'll timeout */ } - untimeout(uha_timeout, mscp); + callout_stop(&mscp->xs->xs_callout); uha_done(sc, mscp); if ((bus_space_read_1(iot, ioh, U24_SINT) & U24_SDIP) == 0) diff --git a/sys/dev/ic/adv.c b/sys/dev/ic/adv.c index d8645cd1665..a8c28fa9ce1 100644 --- a/sys/dev/ic/adv.c +++ b/sys/dev/ic/adv.c @@ -1,4 +1,4 @@ -/* $NetBSD: adv.c,v 1.15 2000/02/12 19:12:52 thorpej Exp $ */ +/* $NetBSD: adv.c,v 1.16 2000/03/23 07:01:28 thorpej Exp $ */ /* * Generic driver for the Advanced Systems Inc. Narrow SCSI controllers @@ -40,6 +40,7 @@ #include <sys/types.h> #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/kernel.h> #include <sys/errno.h> #include <sys/ioctl.h> @@ -235,6 +236,8 @@ adv_init_ccb(sc, ccb) { int hashnum, error; + callout_init(&ccb->ccb_watchdog); + /* * Create the DMA map for this CCB. */ @@ -345,18 +348,21 @@ adv_start_ccbs(sc) while ((ccb = sc->sc_waiting_ccb.tqh_first) != NULL) { if (ccb->flags & CCB_WATCHDOG) - untimeout(adv_watchdog, ccb); + callout_stop(&ccb->ccb_watchdog); if (AscExeScsiQueue(sc, &ccb->scsiq) == ASC_BUSY) { ccb->flags |= CCB_WATCHDOG; - timeout(adv_watchdog, ccb, - (ADV_WATCH_TIMEOUT * hz) / 1000); + callout_reset(&ccb->ccb_watchdog, + (ADV_WATCH_TIMEOUT * hz) / 1000, + adv_watchdog, ccb); break; } TAILQ_REMOVE(&sc->sc_waiting_ccb, ccb, chain); if ((ccb->xs->xs_control & XS_CTL_POLL) == 0) - timeout(adv_timeout, ccb, (ccb->timeout * hz) / 1000); + callout_reset(&ccb->xs->xs_callout, + (ccb->timeout * hz) / 1000, + adv_timeout, ccb); } } @@ -901,7 +907,7 @@ adv_narrow_isr_callback(sc, qdonep) xs->sc_link->scsipi_scsi.target, xs->sc_link->scsipi_scsi.lun, xs->cmd->opcode); #endif - untimeout(adv_timeout, ccb); + callout_stop(&ccb->xs->xs_callout); /* * If we were a data transfer, unload the map that described diff --git a/sys/dev/ic/adv.h b/sys/dev/ic/adv.h index 35ebcd00785..76222f143ff 100644 --- a/sys/dev/ic/adv.h +++ b/sys/dev/ic/adv.h @@ -1,4 +1,4 @@ -/* $NetBSD: adv.h,v 1.6 1999/08/07 07:20:15 thorpej Exp $ */ +/* $NetBSD: adv.h,v 1.7 2000/03/23 07:01:28 thorpej Exp $ */ /* * Generic driver definitions and exported functions for the Advanced @@ -53,6 +53,8 @@ struct adv_ccb struct scsipi_sense_data scsi_sense; + struct callout ccb_watchdog; + TAILQ_ENTRY(adv_ccb) chain; struct adv_ccb *nexthash; u_long hashkey; diff --git a/sys/dev/ic/adw.c b/sys/dev/ic/adw.c index 61cc597c401..86cf1c5057c 100644 --- a/sys/dev/ic/adw.c +++ b/sys/dev/ic/adw.c @@ -1,4 +1,4 @@ -/* $NetBSD: adw.c,v 1.14 2000/02/12 19:19:42 thorpej Exp $ */ +/* $NetBSD: adw.c,v 1.15 2000/03/23 07:01:28 thorpej Exp $ */ /* * Generic driver for the Advanced Systems Inc. SCSI controllers @@ -40,6 +40,7 @@ #include <sys/types.h> #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/kernel.h> #include <sys/errno.h> #include <sys/ioctl.h> @@ -501,7 +502,8 @@ adw_queue_ccb(sc, ccb, retry) TAILQ_REMOVE(&sc->sc_waiting_ccb, ccb, chain); if ((ccb->xs->xs_control & XS_CTL_POLL) == 0) - timeout(adw_timeout, ccb, (ccb->timeout * hz) / 1000); + callout_reset(&ccb->xs->xs_callout, + (ccb->timeout * hz) / 1000, adw_timeout, ccb); } return(errcode); @@ -1074,7 +1076,7 @@ adw_isr_callback(sc, scsiq) ccb = adw_ccb_phys_kv(sc, scsiq->ccb_ptr); - untimeout(adw_timeout, ccb); + callout_stop(&ccb->xs->xs_callout); /* if(ccb->flags & CCB_ABORTING) { printf("Retrying request\n"); diff --git a/sys/dev/ic/aha.c b/sys/dev/ic/aha.c index a0270b18ebf..4c6804fcf60 100644 --- a/sys/dev/ic/aha.c +++ b/sys/dev/ic/aha.c @@ -1,4 +1,4 @@ -/* $NetBSD: aha.c,v 1.25 2000/02/12 19:12:52 thorpej Exp $ */ +/* $NetBSD: aha.c,v 1.26 2000/03/23 07:01:28 thorpej Exp $ */ #include "opt_ddb.h" @@ -64,6 +64,7 @@ #include <sys/types.h> #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/kernel.h> #include <sys/errno.h> #include <sys/ioctl.h> @@ -384,7 +385,7 @@ AGAIN: goto next; } - untimeout(aha_timeout, ccb); + callout_stop(&ccb->xs->xs_callout); aha_done(sc, ccb); next: @@ -492,6 +493,8 @@ aha_init_ccb(sc, ccb) bus_dma_tag_t dmat = sc->sc_dmat; int hashnum, error; + callout_init(&ccb->xs->xs_callout); + /* * Create the DMA map for this CCB. */ @@ -696,7 +699,8 @@ aha_start_ccbs(sc) bus_space_write_1(iot, ioh, AHA_CMD_PORT, AHA_START_SCSI); if ((ccb->xs->xs_control & XS_CTL_POLL) == 0) - timeout(aha_timeout, ccb, (ccb->timeout * hz) / 1000); + callout_reset(&ccb->xs->xs_callout, + (ccb->timeout * hz) / 1000, aha_timeout, ccb); ++sc->sc_mbofull; aha_nextmbx(wmbo, wmbx, mbo); diff --git a/sys/dev/ic/aic6360.c b/sys/dev/ic/aic6360.c index 215a0a243cd..b99f3bc50b2 100644 --- a/sys/dev/ic/aic6360.c +++ b/sys/dev/ic/aic6360.c @@ -1,4 +1,4 @@ -/* $NetBSD: aic6360.c,v 1.66 2000/03/20 22:53:36 enami Exp $ */ +/* $NetBSD: aic6360.c,v 1.67 2000/03/23 07:01:28 thorpej Exp $ */ #include "opt_ddb.h" #ifdef DDB @@ -123,6 +123,7 @@ #include <sys/types.h> #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/kernel.h> #include <sys/errno.h> #include <sys/ioctl.h> @@ -445,12 +446,12 @@ aic_init(sc, bus_reset) sc->sc_state = AIC_CLEANING; if ((acb = sc->sc_nexus) != NULL) { acb->xs->error = XS_DRIVER_STUFFUP; - untimeout(aic_timeout, acb); + callout_stop(&acb->xs->xs_callout); aic_done(sc, acb); } while ((acb = sc->nexus_list.tqh_first) != NULL) { acb->xs->error = XS_DRIVER_STUFFUP; - untimeout(aic_timeout, acb); + callout_stop(&acb->xs->xs_callout); aic_done(sc, acb); } } @@ -1849,8 +1850,9 @@ loop: /* On our first connection, schedule a timeout. */ if ((acb->xs->xs_control & XS_CTL_POLL) == 0) - timeout(aic_timeout, acb, - (acb->timeout * hz) / 1000); + callout_reset(&acb->xs->xs_callout, + (acb->timeout * hz) / 1000, + aic_timeout, acb); sc->sc_state = AIC_CONNECTED; } else if ((sstat1 & SELTO) != 0) { @@ -2066,7 +2068,7 @@ reset: return 1; finish: - untimeout(aic_timeout, acb); + callout_stop(&acb->xs->xs_callout); aic_done(sc, acb); goto out; diff --git a/sys/dev/ic/aic7xxx.c b/sys/dev/ic/aic7xxx.c index dff11025f33..941ab7267b3 100644 --- a/sys/dev/ic/aic7xxx.c +++ b/sys/dev/ic/aic7xxx.c @@ -1,4 +1,4 @@ -/* $NetBSD: aic7xxx.c,v 1.43 2000/03/16 10:33:45 fvdl Exp $ */ +/* $NetBSD: aic7xxx.c,v 1.44 2000/03/23 07:01:29 thorpej Exp $ */ /* * Generic driver for the aic7xxx based adaptec SCSI controllers @@ -1870,9 +1870,8 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat) * retrieve the sense. */ if (!(scb->xs->xs_control & XS_CTL_POLL)) { - untimeout(ahc_timeout, (caddr_t)scb); - timeout(ahc_timeout, (caddr_t)scb, - 5 * hz); + callout_reset(&scb->xs->xs_callout, + 5 * hz, ahc_timeout, scb); } } break; @@ -3312,7 +3311,7 @@ ahc_done(struct ahc_softc *ahc, struct scb *scb) sc_link = xs->sc_link; LIST_REMOVE(scb, plinks); - untimeout(ahc_timeout, (caddr_t)scb); + callout_stop(&scb->xs->xs_callout); #ifdef AHC_DEBUG if (ahc_debug & AHC_SHOWCMDS) { @@ -3361,8 +3360,9 @@ ahc_done(struct ahc_softc *ahc, struct scb *scb) struct scsipi_xfer *txs = scbp->xs; if (!(txs->xs_control & XS_CTL_POLL)) { - timeout(ahc_timeout, scbp, - (scbp->xs->timeout * hz)/1000); + callout_reset(&scbp->xs->xs_callout, + (scbp->xs->timeout * hz) / 1000, + ahc_timeout, scbp); } scbp = LIST_NEXT(scbp, plinks); } @@ -4095,8 +4095,8 @@ ahc_execute_scb(void *arg, bus_dma_segment_t *dm_segs, int nsegments) scb->flags |= SCB_ACTIVE; if (!(xs->xs_control & XS_CTL_POLL)) - timeout(ahc_timeout, (caddr_t)scb, - (xs->timeout * hz) / 1000); + callout_reset(&scb->xs->xs_callout, (xs->timeout * hz) / 1000, + ahc_timeout, scb); if ((scb->flags & SCB_TARGET_IMMEDIATE) != 0) { #if 0 @@ -4545,7 +4545,7 @@ ahc_set_recoveryscb(struct ahc_softc *ahc, struct scb *scb) */ scbp = ahc->pending_ccbs.lh_first; while (scbp != NULL) { - untimeout(ahc_timeout, scbp); + callout_stop(&scbp->xs->xs_callout); scbp = scbp->plinks.le_next; } } @@ -4699,8 +4699,9 @@ bus_reset: scb->flags |= SCB_OTHERTCL_TIMEOUT; newtimeout = MAX(active_scb->xs->timeout, scb->xs->timeout); - timeout(ahc_timeout, scb, - (newtimeout * hz) / 1000); + callout_reset(&scb->xs->xs_callout, + (newtimeout * hz) / 1000, + ahc_timeout, scb); splx(s); return; } @@ -4728,7 +4729,8 @@ bus_reset: scsi_print_addr(active_scb->xs->sc_link); printf("BDR message in message buffer\n"); active_scb->flags |= SCB_DEVICE_RESET; - timeout(ahc_timeout, (caddr_t)active_scb, 2 * hz); + callout_reset(&active_scb->xs->xs_callout, + 2 * hz, ahc_timeout, active_scb); unpause_sequencer(ahc); } else { int disconnected; @@ -4818,7 +4820,8 @@ bus_reset: ahc_outb(ahc, KERNEL_QINPOS, ahc->qinfifonext); } - timeout(ahc_timeout, (caddr_t)scb, 2 * hz); + callout_reset(&scb->xs->xs_callout, 2 * hz, + ahc_timeout, scb); unpause_sequencer(ahc); } else { /* Go "immediatly" to the bus reset */ diff --git a/sys/dev/ic/bha.c b/sys/dev/ic/bha.c index 376d4341dd7..3f9aca035e0 100644 --- a/sys/dev/ic/bha.c +++ b/sys/dev/ic/bha.c @@ -1,4 +1,4 @@ -/* $NetBSD: bha.c,v 1.34 2000/02/12 19:12:53 thorpej Exp $ */ +/* $NetBSD: bha.c,v 1.35 2000/03/23 07:01:29 thorpej Exp $ */ /*- * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. @@ -57,6 +57,7 @@ #include <sys/types.h> #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/kernel.h> #include <sys/errno.h> #include <sys/ioctl.h> @@ -1442,7 +1443,8 @@ bha_start_ccbs(sc) bus_space_write_1(iot, ioh, BHA_CMD_PORT, BHA_START_SCSI); if ((ccb->xs->xs_control & XS_CTL_POLL) == 0) - timeout(bha_timeout, ccb, (ccb->timeout * hz) / 1000); + callout_reset(&ccb->xs->xs_callout, + (ccb->timeout * hz) / 1000, bha_timeout, ccb); ++sc->sc_mbofull; mbo = bha_nextmbo(sc, mbo); @@ -1540,7 +1542,7 @@ bha_finish_ccbs(sc) goto next; } - untimeout(bha_timeout, ccb); + callout_stop(&ccb->xs->xs_callout); bha_done(sc, ccb); next: diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index be6e5842360..16a7aead451 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1,4 +1,4 @@ -/* $NetBSD: com.c,v 1.169 2000/03/06 21:36:12 thorpej Exp $ */ +/* $NetBSD: com.c,v 1.170 2000/03/23 07:01:29 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); @@ -1152,7 +1155,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 @@ -1716,7 +1719,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) { @@ -1726,7 +1730,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); @@ -2130,7 +2135,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 diff --git a/sys/dev/ic/comvar.h b/sys/dev/ic/comvar.h index 884a7cc8ed2..c15f1c5e793 100644 --- a/sys/dev/ic/comvar.h +++ b/sys/dev/ic/comvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: comvar.h,v 1.31 2000/01/23 21:06:01 soda Exp $ */ +/* $NetBSD: comvar.h,v 1.32 2000/03/23 07:01:30 thorpej Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -35,6 +35,7 @@ #include <sys/rnd.h> #endif +#include <sys/callout.h> #include <sys/timepps.h> int comcnattach __P((bus_space_tag_t, int, int, int, tcflag_t)); @@ -63,6 +64,8 @@ struct com_softc { void *sc_si; struct tty *sc_tty; + struct callout sc_diag_callout; + int sc_iobase; /* XXX ISA-centric name */ int sc_frequency; diff --git a/sys/dev/ic/cy.c b/sys/dev/ic/cy.c index cd656765388..a41b2599b0a 100644 --- a/sys/dev/ic/cy.c +++ b/sys/dev/ic/cy.c @@ -1,4 +1,4 @@ -/* $NetBSD: cy.c,v 1.11 1999/09/09 21:52:11 tron Exp $ */ +/* $NetBSD: cy.c,v 1.12 2000/03/23 07:01:30 thorpej Exp $ */ /* * cy.c @@ -29,6 +29,7 @@ #include <sys/device.h> #include <sys/malloc.h> #include <sys/systm.h> +#include <sys/callout.h> #include <machine/bus.h> @@ -57,6 +58,8 @@ static int cy_events = 0; cdev_decl(cy); +struct callout cy_poll_callout = CALLOUT_INITIALIZER; + /* * Common probe routine */ @@ -306,7 +309,7 @@ cyopen(dev, flag, mode, p) /* hmm... need spltty() here? */ if (cy_open == 0) { cy_open = 1; - timeout(cy_poll, NULL, 1); + callout_reset(&cy_poll_callout, 1, cy_poll, NULL); } /* this sets parameters and raises DTR */ cyparam(tp, &tp->t_termios); @@ -1063,7 +1066,7 @@ cy_poll(arg) counter = 0; out: - timeout(cy_poll, NULL, 1); + callout_reset(&cy_poll_callout, 1, cy_poll, NULL); } /* diff --git a/sys/dev/ic/elink3.c b/sys/dev/ic/elink3.c index 0fde2fc419f..898f347fcd8 100644 --- a/sys/dev/ic/elink3.c +++ b/sys/dev/ic/elink3.c @@ -1,4 +1,4 @@ -/* $NetBSD: elink3.c,v 1.77 2000/03/06 21:02:00 thorpej Exp $ */ +/* $NetBSD: elink3.c,v 1.78 2000/03/23 07:01:30 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -75,6 +75,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/kernel.h> #include <sys/mbuf.h> #include <sys/socket.h> @@ -358,6 +359,9 @@ epconfig(sc, chipset, enaddr) u_int16_t i; u_int8_t myla[6]; + callout_init(&sc->sc_mii_callout); + callout_init(&sc->sc_mbuf_callout); + sc->ep_chipset = chipset; /* @@ -736,7 +740,7 @@ ep_tick(arg) mii_tick(&sc->sc_mii); splx(s); - timeout(ep_tick, sc, hz); + callout_reset(&sc->sc_mii_callout, hz, ep_tick, sc); } /* @@ -853,7 +857,7 @@ epinit(sc) if (sc->ep_flags & ELINK_FLAGS_MII) { /* Start the one second clock. */ - timeout(ep_tick, sc, hz); + callout_reset(&sc->sc_mii_callout, hz, ep_tick, sc); } /* Attempt to start output, if any. */ @@ -1622,7 +1626,7 @@ epget(sc, totlen) } else { /* If the queue is no longer full, refill. */ if (sc->last_mb == sc->next_mb) - timeout(epmbuffill, sc, 1); + callout_reset(&sc->sc_mbuf_callout, 1, epmbuffill, sc); /* Convert one of our saved mbuf's. */ sc->next_mb = (sc->next_mb + 1) % MAX_MBS; m->m_data = m->m_pktdat; @@ -1895,7 +1899,7 @@ epstop(sc) if (sc->ep_flags & ELINK_FLAGS_MII) { /* Stop the one second clock. */ - untimeout(ep_tick, sc); + callout_stop(&sc->sc_mbuf_callout); /* Down the MII. */ mii_down(&sc->sc_mii); @@ -2060,7 +2064,7 @@ epmbuffill(v) sc->last_mb = i; /* If the queue was not filled, try again. */ if (sc->last_mb != sc->next_mb) - timeout(epmbuffill, sc, 1); + callout_reset(&sc->sc_mbuf_callout, 1, epmbuffill, sc); splx(s); } @@ -2078,7 +2082,7 @@ epmbufempty(sc) } } sc->last_mb = sc->next_mb = 0; - untimeout(epmbuffill, sc); + callout_stop(&sc->sc_mbuf_callout); splx(s); } @@ -2156,8 +2160,8 @@ ep_detach(self, flags) epdisable(sc); - untimeout(ep_tick, sc); - untimeout(epmbuffill, sc); + callout_stop(&sc->sc_mii_callout); + callout_stop(&sc->sc_mbuf_callout); if (sc->ep_flags & ELINK_FLAGS_MII) { /* Detach all PHYs */ diff --git a/sys/dev/ic/elink3var.h b/sys/dev/ic/elink3var.h index ab63390b84f..bcd7522c95e 100644 --- a/sys/dev/ic/elink3var.h +++ b/sys/dev/ic/elink3var.h @@ -1,4 +1,4 @@ -/* $NetBSD: elink3var.h,v 1.24 2000/02/08 12:49:12 enami Exp $ */ +/* $NetBSD: elink3var.h,v 1.25 2000/03/23 07:01:30 thorpej Exp $ */ /* * Copyright (c) 1994 Herb Peyerl <hpeyerl@beer.org> @@ -45,6 +45,8 @@ struct ep_softc { struct ethercom sc_ethercom; /* Ethernet common part */ struct mii_data sc_mii; /* MII/media control */ + struct callout sc_mii_callout; /* MII callout handle */ + struct callout sc_mbuf_callout; /* mbuf fill callout */ bus_space_tag_t sc_iot; /* bus cookie */ bus_space_handle_t sc_ioh; /* bus i/o handle */ bus_space_tag_t sc_memt; /* RoadRunner only */ diff --git a/sys/dev/ic/elinkxl.c b/sys/dev/ic/elinkxl.c index a61ec838e92..740831fc987 100644 --- a/sys/dev/ic/elinkxl.c +++ b/sys/dev/ic/elinkxl.c @@ -1,4 +1,4 @@ -/* $NetBSD: elinkxl.c,v 1.29 2000/03/06 21:02:00 thorpej Exp $ */ +/* $NetBSD: elinkxl.c,v 1.30 2000/03/23 07:01:30 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -43,6 +43,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/kernel.h> #include <sys/mbuf.h> #include <sys/socket.h> @@ -201,6 +202,8 @@ ex_config(sc) bus_space_handle_t ioh = sc->sc_ioh; int i, error, attach_stage; + callout_init(&sc->ex_mii_callout); + ex_reset(sc); val = ex_read_eeprom(sc, EEPROM_OEM_ADDR0); @@ -662,7 +665,7 @@ ex_init(sc) splx(s); - timeout(ex_tick, sc, hz); + callout_reset(&sc->ex_mii_callout, hz, ex_tick, sc); } /* @@ -1458,7 +1461,7 @@ ex_tick(arg) splx(s); - timeout(ex_tick, sc, hz); + callout_reset(&sc->ex_mii_callout, hz, ex_tick, sc); } void @@ -1526,7 +1529,7 @@ ex_stop(sc) bus_space_write_2(iot, ioh, ELINK_COMMAND, C_INTR_LATCH); - untimeout(ex_tick, sc); + callout_stop(&sc->ex_mii_callout); if (sc->ex_conf & EX_CONF_MII) mii_down(&sc->ex_mii); @@ -1588,7 +1591,7 @@ ex_detach(sc) int i; /* Unhook our tick handler. */ - untimeout(ex_tick, sc); + callout_stop(&sc->ex_mii_callout); if (sc->ex_conf & EX_CONF_MII) { /* Detach all PHYs */ diff --git a/sys/dev/ic/elinkxlvar.h b/sys/dev/ic/elinkxlvar.h index 81cfee003de..50a17e96eaf 100644 --- a/sys/dev/ic/elinkxlvar.h +++ b/sys/dev/ic/elinkxlvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: elinkxlvar.h,v 1.4 2000/02/05 18:11:56 augustss Exp $ */ +/* $NetBSD: elinkxlvar.h,v 1.5 2000/03/23 07:01:30 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -77,6 +77,7 @@ struct ex_softc { u_int ex_connectors; /* Connectors on this card. */ mii_data_t ex_mii; /* mii bus data */ + struct callout ex_mii_callout; /* mii callout */ u_int ex_conf; /* config flags */ #define EX_CONF_MII 0x0001 /* has MII bus */ diff --git a/sys/dev/ic/hme.c b/sys/dev/ic/hme.c index 74e8261b166..66705feb92c 100644 --- a/sys/dev/ic/hme.c +++ b/sys/dev/ic/hme.c @@ -1,4 +1,4 @@ -/* $NetBSD: hme.c,v 1.8 2000/02/14 17:14:28 pk Exp $ */ +/* $NetBSD: hme.c,v 1.9 2000/03/23 07:01:30 thorpej Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -317,8 +317,7 @@ hme_config(sc) RND_TYPE_NET, 0); #endif - /* Start the one second clock */ - timeout(hme_tick, sc, hz); + callout_init(&sc->sc_tick_ch); } void @@ -332,7 +331,7 @@ hme_tick(arg) mii_tick(&sc->sc_mii); splx(s); - timeout(hme_tick, sc, hz); + callout_reset(&sc->sc_tick_ch, hz, hme_tick, sc); } void @@ -354,7 +353,7 @@ hme_stop(sc) bus_space_handle_t seb = sc->sc_seb; int n; - untimeout(hme_tick, sc); + callout_stop(&sc->sc_tick_ch); mii_down(&sc->sc_mii); /* Reset transmitter and receiver */ @@ -613,6 +612,9 @@ hme_init(sc) if (sc->sc_hwinit) (*sc->sc_hwinit)(sc); + /* Start the one second timer. */ + callout_reset(&sc->sc_tick_ch, hz, hme_tick, sc); + ifp->if_flags |= IFF_RUNNING; ifp->if_flags &= ~IFF_OACTIVE; ifp->if_timer = 0; diff --git a/sys/dev/ic/hmevar.h b/sys/dev/ic/hmevar.h index ac65d265098..f3bdc0bd5d5 100644 --- a/sys/dev/ic/hmevar.h +++ b/sys/dev/ic/hmevar.h @@ -1,4 +1,4 @@ -/* $NetBSD: hmevar.h,v 1.2 1999/12/18 14:05:37 pk Exp $ */ +/* $NetBSD: hmevar.h,v 1.3 2000/03/23 07:01:30 thorpej Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -38,6 +38,7 @@ #include "rnd.h" +#include <sys/callout.h> #if NRND > 0 #include <sys/rnd.h> #endif @@ -67,6 +68,7 @@ struct hme_softc { struct ethercom sc_ethercom; /* Ethernet common part */ struct mii_data sc_mii; /* MII media control */ #define sc_media sc_mii.mii_media/* shorthand */ + struct callout sc_tick_ch; /* tick callout */ /* The following bus handles are to be provided by the bus front-end */ bus_space_tag_t sc_bustag; /* bus tag */ diff --git a/sys/dev/ic/i82365.c b/sys/dev/ic/i82365.c index 2fbd2b09325..52fd195c4c1 100644 --- a/sys/dev/ic/i82365.c +++ b/sys/dev/ic/i82365.c @@ -1,4 +1,4 @@ -/* $NetBSD: i82365.c,v 1.56 2000/02/27 22:57:20 enami Exp $ */ +/* $NetBSD: i82365.c,v 1.57 2000/03/23 07:01:30 thorpej Exp $ */ #define PCICDEBUG @@ -377,9 +377,13 @@ pcic_attach_socket_finish(h) /* enable interrupts on card detect, poll for them if no irq avail */ reg = PCIC_CSC_INTR_CD_ENABLE; - if (sc->irq == -1) - timeout(pcic_poll_intr, sc, hz / 2); - else + if (sc->irq == -1) { + if (sc->poll_established == 0) { + callout_init(&sc->poll_ch); + callout_reset(&sc->poll_ch, hz / 2, pcic_poll_intr, sc); + sc->poll_established = 1; + } + } else reg |= sc->irq << PCIC_CSC_INTR_IRQ_SHIFT; pcic_write(h, PCIC_CSC_INTR, reg); @@ -672,7 +676,7 @@ pcic_poll_intr(arg) for (i = 0; i < PCIC_NSLOTS; i++) if (sc->handle[i].flags & PCIC_FLAG_SOCKETP) (void)pcic_intr_socket(&sc->handle[i]); - timeout(pcic_poll_intr, sc, hz / 2); + callout_reset(&sc->poll_ch, hz / 2, pcic_poll_intr, sc); splx(s); } diff --git a/sys/dev/ic/i82365var.h b/sys/dev/ic/i82365var.h index e8b41044fdf..93464db5fde 100644 --- a/sys/dev/ic/i82365var.h +++ b/sys/dev/ic/i82365var.h @@ -1,4 +1,4 @@ -/* $NetBSD: i82365var.h,v 1.14 2000/02/26 17:24:44 thorpej Exp $ */ +/* $NetBSD: i82365var.h,v 1.15 2000/03/23 07:01:31 thorpej Exp $ */ /* * Copyright (c) 1997 Marc Horowitz. All rights reserved. @@ -30,6 +30,7 @@ */ #include <sys/device.h> +#include <sys/callout.h> #include <sys/lock.h> #include <dev/pcmcia/pcmciareg.h> @@ -118,6 +119,9 @@ struct pcic_softc { bus_space_tag_t iot; bus_space_handle_t ioh; + struct callout poll_ch; + int poll_established; + pcmcia_chipset_tag_t pct; struct lock sc_pcic_lock; diff --git a/sys/dev/ic/i82557.c b/sys/dev/ic/i82557.c index 783d3532a35..172044ceea1 100644 --- a/sys/dev/ic/i82557.c +++ b/sys/dev/ic/i82557.c @@ -1,4 +1,4 @@ -/* $NetBSD: i82557.c,v 1.23 2000/03/20 07:52:58 thorpej Exp $ */ +/* $NetBSD: i82557.c,v 1.24 2000/03/23 07:01:31 thorpej Exp $ */ /*- * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. @@ -78,6 +78,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/mbuf.h> #include <sys/malloc.h> #include <sys/kernel.h> @@ -242,6 +243,8 @@ fxp_attach(sc) int rseg, i, error; struct fxp_phytype *fp; + callout_init(&sc->sc_callout); + /* * Allocate the control data structures, and create and load the * DMA map for it. @@ -1158,7 +1161,7 @@ fxp_tick(arg) /* * Schedule another timeout one second from now. */ - timeout(fxp_tick, sc, hz); + callout_reset(&sc->sc_callout, hz, fxp_tick, sc); } /* @@ -1205,7 +1208,7 @@ fxp_stop(sc, drain) /* * Cancel stats updater. */ - untimeout(fxp_tick, sc); + callout_stop(&sc->sc_callout); if (sc->sc_flags & FXPF_MII) { /* Down the MII. */ mii_down(&sc->sc_mii); @@ -1475,7 +1478,7 @@ fxp_init(sc) /* * Start the one second timer. */ - timeout(fxp_tick, sc, hz); + callout_reset(&sc->sc_callout, hz, fxp_tick, sc); /* * Attempt to start output on the interface. @@ -1923,7 +1926,7 @@ fxp_detach(sc) int i; /* Unhook our tick handler. */ - untimeout(fxp_tick, sc); + callout_stop(&sc->sc_callout); if (sc->sc_flags & FXPF_MII) { /* Detach all PHYs */ diff --git a/sys/dev/ic/i82557var.h b/sys/dev/ic/i82557var.h index 75c1c129039..0d55550ca23 100644 --- a/sys/dev/ic/i82557var.h +++ b/sys/dev/ic/i82557var.h @@ -1,4 +1,4 @@ -/* $NetBSD: i82557var.h,v 1.11 2000/02/12 04:05:49 enami Exp $ */ +/* $NetBSD: i82557var.h,v 1.12 2000/03/23 07:01:31 thorpej Exp $ */ /*- * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. @@ -66,6 +66,8 @@ * Id: if_fxpvar.h,v 1.4 1997/11/29 08:11:01 davidg Exp */ +#include <sys/callout.h> + /* * Misc. defintions for the Intel i82557 fast Ethernet controller * driver. @@ -163,6 +165,7 @@ struct fxp_softc { void *sc_ih; /* interrupt handler cookie */ struct mii_data sc_mii; /* MII/media information */ + struct callout sc_callout; /* MII callout */ /* * We create a single DMA map that maps all data structure diff --git a/sys/dev/ic/isp_netbsd.c b/sys/dev/ic/isp_netbsd.c index 38190217324..bb8dc9e3ae4 100644 --- a/sys/dev/ic/isp_netbsd.c +++ b/sys/dev/ic/isp_netbsd.c @@ -1,4 +1,4 @@ -/* $NetBSD: isp_netbsd.c,v 1.23 2000/02/12 02:25:28 mjacob Exp $ */ +/* $NetBSD: isp_netbsd.c,v 1.24 2000/03/23 07:01:31 thorpej Exp $ */ /* * Platform (NetBSD) dependent common attachment code for Qlogic adapters. * Matthew Jacob <mjacob@nas.nasa.gov> @@ -146,8 +146,10 @@ isp_attach(isp) /* * Start the watchdog. */ + callout_init(&isp->isp_osinfo._watchdog); isp->isp_dogactive = 1; - timeout(isp_watch, isp, WATCH_INTERVAL * hz); + callout_reset(&isp->isp_osinfo._watchdog, WATCH_INTERVAL * hz, + isp_watch, isp); /* * And attach children (if any). @@ -315,7 +317,8 @@ ispcmd(xs) break; case CMD_RQLATER: result = SUCCESSFULLY_QUEUED; - timeout(isp_command_requeue, xs, hz); + callout_reset(&xs->xs_callout, hz, + isp_command_requeue, xs); break; case CMD_COMPLETE: result = COMPLETE; @@ -426,7 +429,8 @@ isp_watch(arg) break; } } - timeout(isp_watch, isp, WATCH_INTERVAL * hz); + callout_reset(&isp->isp_osinfo._watchdog, WATCH_INTERVAL * hz, + isp_watch, isp); isp->isp_dogactive = 1; (void) splx(s); } @@ -453,7 +457,7 @@ isp_uninit(isp) * Turn off the watchdog (if active). */ if (isp->isp_dogactive) { - untimeout(isp_watch, isp); + callout_stop(&isp->isp_osinfo._watchdog); isp->isp_dogactive = 0; } @@ -648,7 +652,8 @@ isp_async(isp, cmd, arg) break; case ISPASYNC_LOOP_UP: isp->isp_osinfo.blocked = 0; - timeout(isp_internal_restart, isp, 1); + callout_reset(&isp->isp_osinfo._restart, 1, + isp_internal_restart, isp); printf("%s: Loop UP\n", isp->isp_name); break; case ISPASYNC_PDB_CHANGED: diff --git a/sys/dev/ic/isp_netbsd.h b/sys/dev/ic/isp_netbsd.h index fe21f1bb06a..12a84a4ff55 100644 --- a/sys/dev/ic/isp_netbsd.h +++ b/sys/dev/ic/isp_netbsd.h @@ -1,4 +1,4 @@ -/* $NetBSD: isp_netbsd.h,v 1.22 2000/02/19 01:51:21 mjacob Exp $ */ +/* $NetBSD: isp_netbsd.h,v 1.23 2000/03/23 07:01:31 thorpej Exp $ */ /* * NetBSD Specific definitions for the Qlogic ISP Host Adapter * Matthew Jacob <mjacob@nas.nasa.gov> @@ -75,6 +75,8 @@ struct isposinfo { #define seed un._seed #define discovered un._discovered TAILQ_HEAD(, scsipi_xfer) waitq; + struct callout _watchdog; + struct callout _restart; }; #define MAXISPREQUEST 256 diff --git a/sys/dev/ic/lpt.c b/sys/dev/ic/lpt.c index 185d69a3530..bb29c2ae687 100644 --- a/sys/dev/ic/lpt.c +++ b/sys/dev/ic/lpt.c @@ -1,4 +1,4 @@ -/* $NetBSD: lpt.c,v 1.55 1999/03/29 21:50:06 perry Exp $ */ +/* $NetBSD: lpt.c,v 1.56 2000/03/23 07:01:31 thorpej Exp $ */ /* * Copyright (c) 1993, 1994 Charles M. Hannum. @@ -108,6 +108,8 @@ lpt_attach_subr(sc) bus_space_write_1(iot, ioh, lpt_control, LPC_NINIT); + callout_init(&sc->sc_wakeup_ch); + sc->sc_dev_ok = 1; } @@ -236,7 +238,7 @@ lptwakeup(arg) lptintr(sc); splx(s); - timeout(lptwakeup, sc, STEP); + callout_reset(&sc->sc_wakeup_ch, STEP, lptwakeup, sc); } /* @@ -258,7 +260,7 @@ lptclose(dev, flag, mode, p) (void) lptpushbytes(sc); if ((sc->sc_flags & LPT_NOINTR) == 0) - untimeout(lptwakeup, sc); + callout_stop(&sc->sc_wakeup_ch); bus_space_write_1(iot, ioh, lpt_control, LPC_NINIT); sc->sc_state = 0; diff --git a/sys/dev/ic/lptvar.h b/sys/dev/ic/lptvar.h index 1c3ad3b142d..d69109abf7b 100644 --- a/sys/dev/ic/lptvar.h +++ b/sys/dev/ic/lptvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: lptvar.h,v 1.49 1998/08/15 03:02:46 mycroft Exp $ */ +/* $NetBSD: lptvar.h,v 1.50 2000/03/23 07:01:31 thorpej Exp $ */ /* * Copyright (c) 1993, 1994 Charles M. Hannum. @@ -56,9 +56,12 @@ #ifndef _LPT_VAR_H_ #define _LPT_VAR_H_ +#include <sys/callout.h> + struct lpt_softc { struct device sc_dev; void *sc_ih; + struct callout sc_wakeup_ch; size_t sc_count; void *sc_inbuf; u_char *sc_cp; diff --git a/sys/dev/ic/mb89352.c b/sys/dev/ic/mb89352.c index 0ba24abefaf..161417546b9 100644 --- a/sys/dev/ic/mb89352.c +++ b/sys/dev/ic/mb89352.c @@ -1,4 +1,4 @@ -/* $NetBSD: mb89352.c,v 1.4 1999/09/30 23:04:41 thorpej Exp $ */ +/* $NetBSD: mb89352.c,v 1.5 2000/03/23 07:01:31 thorpej Exp $ */ /* NecBSD: mb89352.c,v 1.4 1998/03/14 07:31:20 kmatsuda Exp */ #ifdef DDB @@ -375,12 +375,12 @@ spc_init(sc) sc->sc_state = SPC_CLEANING; if ((acb = sc->sc_nexus) != NULL) { acb->xs->error = XS_DRIVER_STUFFUP; - untimeout(spc_timeout, acb); + callout_stop(&acb->xs->xs_callout); spc_done(sc, acb); } while ((acb = sc->nexus_list.tqh_first) != NULL) { acb->xs->error = XS_DRIVER_STUFFUP; - untimeout(spc_timeout, acb); + callout_stop(&acb->xs->xs_callout); spc_done(sc, acb); } } @@ -1807,7 +1807,9 @@ loop: /* On our first connection, schedule a timeout. */ if ((acb->xs->xs_control & XS_CTL_POLL) == 0) - timeout(spc_timeout, acb, (acb->timeout * hz) / 1000); + callout_reset(&acb->xs->xs_callout, + (acb->timeout * hz) / 1000, + spc_timeout, acb); sc->sc_state = SPC_CONNECTED; } else if ((ints & INTS_TIMEOUT) != 0) { @@ -2018,7 +2020,7 @@ reset: return 1; finish: - untimeout(spc_timeout, acb); + callout_stop(&acb->xs->xs_callout); bus_space_write_1(iot, ioh, INTS, ints); ints = 0; spc_done(sc, acb); diff --git a/sys/dev/ic/ncr5380sbc.c b/sys/dev/ic/ncr5380sbc.c index aa0edc449c7..39970fcb7c7 100644 --- a/sys/dev/ic/ncr5380sbc.c +++ b/sys/dev/ic/ncr5380sbc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ncr5380sbc.c,v 1.33 2000/03/18 17:14:34 mycroft Exp $ */ +/* $NetBSD: ncr5380sbc.c,v 1.34 2000/03/23 07:01:32 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: diff --git a/sys/dev/ic/ncr53c9x.c b/sys/dev/ic/ncr53c9x.c index b2b697e3e4f..75514068903 100644 --- a/sys/dev/ic/ncr53c9x.c +++ b/sys/dev/ic/ncr53c9x.c @@ -1,4 +1,4 @@ -/* $NetBSD: ncr53c9x.c,v 1.47 2000/03/22 03:27:56 mycroft Exp $ */ +/* $NetBSD: ncr53c9x.c,v 1.48 2000/03/23 07:01:32 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -79,6 +79,7 @@ #include <sys/types.h> #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/kernel.h> #include <sys/errno.h> #include <sys/ioctl.h> @@ -524,8 +525,8 @@ ncr53c9x_select(sc, ecb) * always possible that the interrupt may never happen. */ if ((ecb->xs->xs_control & XS_CTL_POLL) == 0) - timeout(ncr53c9x_timeout, ecb, - (ecb->timeout * hz) / 1000); + callout_reset(&ecb->xs->xs_callout, (ecb->timeout * hz) / 1000, + ncr53c9x_timeout, ecb); /* * The docs say the target register is never reset, and I @@ -850,7 +851,7 @@ ncr53c9x_done(sc, ecb) NCR_TRACE(("[ncr53c9x_done(error:%x)] ", xs->error)); - untimeout(ncr53c9x_timeout, ecb); + callout_stop(&ecb->xs->xs_callout); /* * Now, if we've come here with no error code, i.e. we've kept the @@ -1674,7 +1675,7 @@ again: goto reset; } printf("sending REQUEST SENSE\n"); - untimeout(ncr53c9x_timeout, ecb); + callout_stop(&ecb->xs->xs_callout); ncr53c9x_sense(sc, ecb); goto out; } @@ -1740,7 +1741,7 @@ printf("<<RESELECT CONT'd>>"); */ if (sc->sc_state == NCR_SELECTING) { NCR_MISC(("backoff selector ")); - untimeout(ncr53c9x_timeout, ecb); + callout_stop(&ecb->xs->xs_callout); sc_link = ecb->xs->sc_link; ti = &sc->sc_tinfo[sc_link->scsipi_scsi.target]; TAILQ_INSERT_HEAD(&sc->ready_list, ecb, chain); @@ -2169,12 +2170,10 @@ ncr53c9x_abort(sc, ecb) ncr53c9x_sched_msgout(SEND_ABORT); /* - * Reschedule timeout. First, cancel a queued timeout (if any) - * in case someone decides to call ncr53c9x_abort() from - * elsewhere. + * Reschedule timeout. */ - untimeout(ncr53c9x_timeout, ecb); - timeout(ncr53c9x_timeout, ecb, (ecb->timeout * hz) / 1000); + callout_reset(&ecb->xs->xs_callout, (ecb->timeout * hz) / 1000, + ncr53c9x_timeout, ecb); } else { /* The command should be on the nexus list */ if ((ecb->flags & ECB_NEXUS) == 0) { diff --git a/sys/dev/ic/pckbc.c b/sys/dev/ic/pckbc.c index 2a33979adae..3638fe62ee1 100644 --- a/sys/dev/ic/pckbc.c +++ b/sys/dev/ic/pckbc.c @@ -1,4 +1,4 @@ -/* $NetBSD: pckbc.c,v 1.1 1999/12/03 22:48:25 thorpej Exp $ */ +/* $NetBSD: pckbc.c,v 1.2 2000/03/23 07:01:32 thorpej Exp $ */ /* * Copyright (c) 1998 @@ -33,6 +33,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/kernel.h> #include <sys/proc.h> #include <sys/device.h> @@ -705,7 +706,7 @@ pckbc_start(t, slot) if (cmd->flags & KBC_CMDFLAG_SYNC) wakeup(cmd); else { - untimeout(pckbc_cleanup, t); + callout_stop(&t->t_cleanup); TAILQ_INSERT_TAIL(&q->freequeue, cmd, next); } cmd = TAILQ_FIRST(&q->cmdqueue); @@ -770,7 +771,7 @@ pckbc_cmdresponse(t, slot, data) if (cmd->flags & KBC_CMDFLAG_SYNC) wakeup(cmd); else { - untimeout(pckbc_cleanup, t); + callout_stop(&t->t_cleanup); TAILQ_INSERT_TAIL(&q->freequeue, cmd, next); } if (!CMD_IN_QUEUE(q)) @@ -838,7 +839,7 @@ pckbc_enqueue_cmd(self, slot, cmd, len, responselen, sync, respbuf) } else res = nc->status; } else - timeout(pckbc_cleanup, t, 1*hz); + callout_reset(&t->t_cleanup, hz, pckbc_cleanup, t); if (sync) { if (respbuf) @@ -940,6 +941,7 @@ pckbc_cnattach(iot, addr, slot) pckbc_consdata.t_ioh_d = ioh_d; pckbc_consdata.t_ioh_c = ioh_c; pckbc_consdata.t_addr = addr; + callout_init(&pckbc_consdata.t_cleanup); /* flush */ (void) pckbc_poll_data1(iot, ioh_d, ioh_c, PCKBC_KBD_SLOT, 0); diff --git a/sys/dev/ic/pckbcvar.h b/sys/dev/ic/pckbcvar.h index 4de703873dd..5cca6a3194c 100644 --- a/sys/dev/ic/pckbcvar.h +++ b/sys/dev/ic/pckbcvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: pckbcvar.h,v 1.1 1999/12/03 22:48:25 thorpej Exp $ */ +/* $NetBSD: pckbcvar.h,v 1.2 2000/03/23 07:01:32 thorpej Exp $ */ /* * Copyright (c) 1998 @@ -35,6 +35,8 @@ #ifndef _DEV_IC_PCKBCVAR_H_ #define _DEV_IC_PCKBCVAR_H_ +#include <sys/callout.h> + typedef void *pckbc_tag_t; typedef int pckbc_slot_t; #define PCKBC_KBD_SLOT 0 @@ -55,6 +57,8 @@ struct pckbc_internal { struct pckbc_slotdata *t_slotdata[PCKBC_NSLOTS]; struct pckbc_softc *t_sc; /* back pointer */ + + struct callout t_cleanup; }; typedef void (*pckbc_inputfcn) __P((void *, int)); diff --git a/sys/dev/ic/smc83c170.c b/sys/dev/ic/smc83c170.c index f0925cc273f..246141d7810 100644 --- a/sys/dev/ic/smc83c170.c +++ b/sys/dev/ic/smc83c170.c @@ -1,4 +1,4 @@ -/* $NetBSD: smc83c170.c,v 1.28 2000/03/06 21:02:01 thorpej Exp $ */ +/* $NetBSD: smc83c170.c,v 1.29 2000/03/23 07:01:32 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -48,6 +48,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/mbuf.h> #include <sys/malloc.h> #include <sys/kernel.h> @@ -126,6 +127,8 @@ epic_attach(sc) u_int8_t enaddr[ETHER_ADDR_LEN], devname[12 + 1]; u_int16_t myea[ETHER_ADDR_LEN / 2], mydevname[6]; + callout_init(&sc->sc_mii_callout); + /* * Allocate the control data structures, and create and load the * DMA map for it. @@ -891,7 +894,7 @@ epic_tick(arg) mii_tick(&sc->sc_mii); splx(s); - timeout(epic_tick, sc, hz); + callout_reset(&sc->sc_mii_callout, hz, epic_tick, sc); } /* @@ -1082,7 +1085,7 @@ epic_init(sc) /* * Start the one second clock. */ - timeout(epic_tick, sc, hz); + callout_reset(&sc->sc_mii_callout, hz, epic_tick, sc); /* * Attempt to start output on the interface. @@ -1133,7 +1136,7 @@ epic_stop(sc, drain) /* * Stop the one second clock. */ - untimeout(epic_tick, sc); + callout_stop(&sc->sc_mii_callout); /* Down the MII. */ mii_down(&sc->sc_mii); diff --git a/sys/dev/ic/smc83c170var.h b/sys/dev/ic/smc83c170var.h index ab5fa21a594..6cfb7fcf582 100644 --- a/sys/dev/ic/smc83c170var.h +++ b/sys/dev/ic/smc83c170var.h @@ -1,4 +1,4 @@ -/* $NetBSD: smc83c170var.h,v 1.3 1999/02/12 05:55:27 thorpej Exp $ */ +/* $NetBSD: smc83c170var.h,v 1.4 2000/03/23 07:01:32 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -40,6 +40,8 @@ #ifndef _DEV_IC_SMC83C170VAR_H_ #define _DEV_IC_SMC83C170VAR_H_ +#include <sys/callout.h> + /* * Misc. definitions for the Standard Microsystems Corp. 83C170 * Ethernet PCI Integrated Controller (EPIC/100) driver. @@ -106,6 +108,7 @@ struct epic_softc { void *sc_sdhook; /* shutdown hook */ struct mii_data sc_mii; /* MII/media information */ + struct callout sc_mii_callout; /* MII callout */ bus_dmamap_t sc_cddmamap; /* control data DMA map */ #define sc_cddma sc_cddmamap->dm_segs[0].ds_addr diff --git a/sys/dev/ic/smc90cx6.c b/sys/dev/ic/smc90cx6.c index 9664f1f080b..434821dcc6a 100644 --- a/sys/dev/ic/smc90cx6.c +++ b/sys/dev/ic/smc90cx6.c @@ -1,4 +1,4 @@ -/* $NetBSD: smc90cx6.c,v 1.33 1999/09/25 20:43:43 is Exp $ */ +/* $NetBSD: smc90cx6.c,v 1.34 2000/03/23 07:01:32 thorpej Exp $ */ /*- * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc. @@ -219,6 +219,7 @@ bah_attach_subr(sc) (void (*) __P((void *)))bah_start, ifp); #endif + callout_init(&sc->sc_recon_ch); } /* @@ -805,7 +806,7 @@ bahintr(arg) * double time if necessary. */ - untimeout(bah_reconwatch, (void *)sc); + callout_stop(&sc->sc_recon_ch); newsec = time.tv_sec; if ((newsec - sc->sc_recontime <= 2) && (++sc->sc_reconcount == ARC_EXCESSIVE_RECONS)) { @@ -814,7 +815,8 @@ bahintr(arg) "cable problem?\n", sc->sc_dev.dv_xname); } sc->sc_recontime = newsec; - timeout(bah_reconwatch, (void *)sc, 15*hz); + callout_reset(&sc->sc_recon_ch, 15 * hz, + bah_reconwatch, (void *)sc); } if (maskedisr & BAH_RI) { diff --git a/sys/dev/ic/smc90cx6var.h b/sys/dev/ic/smc90cx6var.h index 19b41f58b09..573acfd2bc4 100644 --- a/sys/dev/ic/smc90cx6var.h +++ b/sys/dev/ic/smc90cx6var.h @@ -1,4 +1,4 @@ -/* $NetBSD: smc90cx6var.h,v 1.4 1999/02/16 23:34:13 is Exp $ */ +/* $NetBSD: smc90cx6var.h,v 1.5 2000/03/23 07:01:32 thorpej Exp $ */ /*- * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc. @@ -52,6 +52,8 @@ #ifndef _SMC90CX6VAR_H_ #define _SMC90CX6VAR_H_ +#include <sys/callout.h> + struct bah_softc { struct device sc_dev; struct arccom sc_arccom; /* Common arcnet structures */ @@ -60,6 +62,7 @@ struct bah_softc { void (*sc_reset)(struct bah_softc *, int); void *sc_rxcookie; /* softcallback cookies */ void *sc_txcookie; + struct callout sc_recon_ch; u_long sc_recontime; /* seconds only, I'm lazy */ u_long sc_reconcount; /* for the above */ u_long sc_reconcount_excessive; /* for the above */ diff --git a/sys/dev/ic/tropic.c b/sys/dev/ic/tropic.c index 06eb2f15358..1cb6f163dfc 100644 --- a/sys/dev/ic/tropic.c +++ b/sys/dev/ic/tropic.c @@ -1,4 +1,4 @@ -/* $NetBSD: tropic.c,v 1.6 1999/12/17 08:26:31 fvdl Exp $ */ +/* $NetBSD: tropic.c,v 1.7 2000/03/23 07:01:32 thorpej Exp $ */ /* * Ported to NetBSD by Onno van der Linden @@ -38,6 +38,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/kernel.h> #include <sys/proc.h> #include <sys/mbuf.h> @@ -441,6 +442,10 @@ tr_attach(sc) bpfattach(&ifp->if_bpf, ifp, DLT_IEEE802, sizeof(struct token_header)); #endif + callout_init(&sc->sc_timeout_callout); + callout_init(&sc->sc_init_callout); + callout_init(&sc->sc_reinit_callout); + /* * XXX rnd stuff */ @@ -889,7 +894,7 @@ tr_intr(arg) sc->sc_xmit_buffers); #endif sc->sc_xmit_correlator = 0; - untimeout(tr_timeout, sc); + callout_stop(&sc->sc_timeout_callout); wakeup(&sc->tr_sleepevent); } else @@ -905,7 +910,8 @@ tr_intr(arg) * XXX untimeout depending on the error, timeout in other cases * XXX error 0x24 && autospeed mode: open again !!!! */ - timeout(tr_init, sc, hz*30); + callout_reset(&sc->sc_init_callout, + hz * 30, tr_init, sc); } break; @@ -918,12 +924,12 @@ tr_intr(arg) ifp->if_flags &= ~IFF_RUNNING; ifp->if_flags &= ~IFF_UP; ifp->if_flags &= ~IFF_OACTIVE; - untimeout(tr_timeout, sc); + callout_stop(&sc->sc_timeout_callout); wakeup(&sc->tr_sleepevent); } break; case DIR_SET_DEFAULT_RING_SPEED: - untimeout(tr_timeout, sc); + callout_stop(&sc->sc_timeout_callout); wakeup(&sc->tr_sleepevent); break; @@ -936,7 +942,7 @@ tr_intr(arg) SRB_OPNSAP_STATIONID); printf("%s: Token Ring opened\n", sc->sc_dev.dv_xname); - untimeout(tr_timeout, sc); + callout_stop(&sc->sc_timeout_callout); wakeup(&sc->tr_sleepevent); break; /* XXX DLC_CLOSE_SAP not needed ? */ @@ -1036,7 +1042,8 @@ tr_intr(arg) ifp->if_flags &= ~IFF_RUNNING; ifp->if_flags &= ~IFF_UP; if_qflush(&ifp->if_snd); - timeout(tr_reinit, sc ,hz*30); + callout_reset(&sc->sc_reinit_callout, + hz * 30, tr_reinit, sc); } else { #ifdef TROPICDEBUG @@ -1710,7 +1717,7 @@ void tr_sleep(sc) struct tr_softc *sc; { - timeout(tr_timeout, sc, hz*30); + callout_reset(&sc->sc_timeout_callout, hz * 30, tr_timeout, sc); sleep(&sc->tr_sleepevent, 1); } diff --git a/sys/dev/ic/tropicvar.h b/sys/dev/ic/tropicvar.h index f83cdab372b..98d83985701 100644 --- a/sys/dev/ic/tropicvar.h +++ b/sys/dev/ic/tropicvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: tropicvar.h,v 1.4 1999/10/17 23:53:45 cgd Exp $ */ +/* $NetBSD: tropicvar.h,v 1.5 2000/03/23 07:01:33 thorpej Exp $ */ /* * Mach Operating System @@ -32,6 +32,8 @@ /* $ACIS:if_lanvar.h 12.0$ */ +#include <sys/callout.h> + /* * This file contains structures used in the "tr" driver for the * IBM TOKEN-RING NETWORK PC ADAPTER @@ -69,6 +71,10 @@ struct tr_softc { bus_space_handle_t sc_sramh; /* handle for the shared ram area */ bus_space_handle_t sc_mmioh; /* handle for the bios/mmio area */ + struct callout sc_timeout_callout; + struct callout sc_init_callout; + struct callout sc_reinit_callout; + int (*sc_mediachange) __P((struct tr_softc *)); void (*sc_mediastatus) __P((struct tr_softc *, struct ifmediareq *)); struct rbcb rbc; /* receiver buffer control block */ diff --git a/sys/dev/ic/tulip.c b/sys/dev/ic/tulip.c index d1ffe58faad..6cf24077565 100644 --- a/sys/dev/ic/tulip.c +++ b/sys/dev/ic/tulip.c @@ -1,4 +1,4 @@ -/* $NetBSD: tulip.c,v 1.55 2000/03/20 07:52:58 thorpej Exp $ */ +/* $NetBSD: tulip.c,v 1.56 2000/03/23 07:01:33 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -48,6 +48,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/mbuf.h> #include <sys/malloc.h> #include <sys/kernel.h> @@ -234,6 +235,9 @@ tlp_attach(sc, enaddr) struct ifnet *ifp = &sc->sc_ethercom.ec_if; int i, error; + callout_init(&sc->sc_nway_callout); + callout_init(&sc->sc_tick_callout); + /* * NOTE: WE EXPECT THE FRONT-END TO INITIALIZE sc_regshift! */ @@ -583,7 +587,7 @@ tlp_detach(sc) /* Unhook our tick handler. */ if (sc->sc_tick) - untimeout(sc->sc_tick, sc); + callout_stop(&sc->sc_tick_callout); if (sc->sc_flags & TULIPF_HAS_MII) { /* Detach all PHYs */ @@ -1843,7 +1847,7 @@ tlp_init(sc) if (sc->sc_tick != NULL) { /* Start the one second clock. */ - timeout(sc->sc_tick, sc, hz); + callout_reset(&sc->sc_tick_callout, hz, sc->sc_tick, sc); } /* @@ -1959,7 +1963,7 @@ tlp_stop(sc, drain) if (sc->sc_tick != NULL) { /* Stop the one second clock. */ - untimeout(sc->sc_tick, sc); + callout_stop(&sc->sc_tick_callout); } if (sc->sc_flags & TULIPF_HAS_MII) { @@ -2993,7 +2997,7 @@ tlp_mii_tick(arg) mii_tick(&sc->sc_mii); splx(s); - timeout(sc->sc_tick, sc, hz); + callout_reset(&sc->sc_tick_callout, hz, sc->sc_tick, sc); } /* @@ -5062,7 +5066,7 @@ tlp_pnic_nway_tick(arg) tlp_pnic_nway_service(sc, MII_TICK); splx(s); - timeout(tlp_pnic_nway_tick, sc, hz); + callout_reset(&sc->sc_tick_callout, hz, tlp_pnic_nway_tick, sc); } /* @@ -5198,7 +5202,8 @@ tlp_pnic_nway_auto(sc, waitfor) */ if ((sc->sc_flags & TULIPF_DOINGAUTO) == 0) { sc->sc_flags |= TULIPF_DOINGAUTO; - timeout(tlp_pnic_nway_auto_timeout, sc, hz >> 1); + callout_reset(&sc->sc_nway_callout, hz >> 1, + tlp_pnic_nway_auto_timeout, sc); } return (EJUSTRETURN); } diff --git a/sys/dev/ic/tulipvar.h b/sys/dev/ic/tulipvar.h index 68c41f6911e..bb6ba1354de 100644 --- a/sys/dev/ic/tulipvar.h +++ b/sys/dev/ic/tulipvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: tulipvar.h,v 1.31 2000/03/19 21:45:24 thorpej Exp $ */ +/* $NetBSD: tulipvar.h,v 1.32 2000/03/23 07:01:33 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -41,6 +41,7 @@ #define _DEV_IC_TULIPVAR_H_ #include <sys/queue.h> +#include <sys/callout.h> /* * Misc. definitions for the Digital Semiconductor ``Tulip'' (21x4x) @@ -292,6 +293,7 @@ struct tulip_softc { */ int sc_nway_ticks; /* tick counter */ struct ifmedia_entry *sc_nway_active; /* the active media */ + struct callout sc_nway_callout; tulip_chip_t sc_chip; /* chip type */ int sc_rev; /* chip revision */ @@ -323,6 +325,7 @@ struct tulip_softc { /* Media tick function. */ void (*sc_tick) __P((void *)); + struct callout sc_tick_callout; /* Power management hooks. */ int (*sc_enable) __P((struct tulip_softc *)); diff --git a/sys/dev/ic/vga.c b/sys/dev/ic/vga.c index 39bbf7fc68c..5e85bdbfea6 100644 --- a/sys/dev/ic/vga.c +++ b/sys/dev/ic/vga.c @@ -1,4 +1,4 @@ -/* $NetBSD: vga.c,v 1.25 2000/01/25 02:44:03 ad Exp $ */ +/* $NetBSD: vga.c,v 1.26 2000/03/23 07:01:33 thorpej Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -29,6 +29,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/kernel.h> #include <sys/device.h> #include <sys/malloc.h> @@ -102,6 +103,8 @@ struct vga_config { struct vgascreen *wantedscreen; void (*switchcb) __P((void *, int, int)); void *switchcbarg; + + struct callout vc_switch_callout; }; static int vgaconsole, vga_console_type, vga_console_attached; @@ -496,6 +499,7 @@ vga_init(vc, iot, memt) LIST_INIT(&vc->screens); vc->active = NULL; vc->currenttype = vh->vh_mono ? &vga_stdscreen_mono : &vga_stdscreen; + callout_init(&vc->vc_switch_callout); vc->vc_fonts[0] = &vga_builtinfont; for (i = 1; i < 8; i++) @@ -722,7 +726,8 @@ vga_show_screen(v, cookie, waitok, cb, cbarg) vc->switchcb = cb; vc->switchcbarg = cbarg; if (cb) { - timeout((void(*)(void *))vga_doswitch, vc, 0); + callout_reset(&vc->vc_switch_callout, 0, + (void(*)(void *))vga_doswitch, vc); return (EAGAIN); } diff --git a/sys/dev/ic/wdc.c b/sys/dev/ic/wdc.c index 8517d344d15..f2c0197854e 100644 --- a/sys/dev/ic/wdc.c +++ b/sys/dev/ic/wdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc.c,v 1.80 2000/03/20 22:53:36 enami Exp $ */ +/* $NetBSD: wdc.c,v 1.81 2000/03/23 07:01:33 thorpej Exp $ */ /* @@ -280,6 +280,8 @@ wdcattach(chp) struct ataparams params; static int inited = 0; + callout_init(&chp->ch_callout); + if ((error = wdc_addref(chp)) != 0) { printf("%s: unable to enable controller\n", chp->wdc->sc_dev.dv_xname); @@ -292,7 +294,6 @@ wdcattach(chp) /* initialise global data */ if (inited == 0) { - /* Initialize the wdc_xfer pool. */ pool_init(&wdc_xfer_pool, sizeof(struct wdc_xfer), 0, 0, 0, "wdcspl", 0, NULL, NULL, M_DEVBUF); @@ -887,7 +888,7 @@ wdctimeout(arg) * in case it will miss another irq while in this transfer * We arbitray chose it to be 1s */ - timeout(wdctimeout, chp, hz); + callout_reset(&chp->ch_callout, hz, wdctimeout, chp); xfer->c_flags |= C_TIMEOU; chp->ch_flags &= ~WDCF_IRQ_WAIT; xfer->c_intr(chp, xfer, 1); @@ -1241,7 +1242,8 @@ __wdccommand_start(chp, xfer) wdc_c->r_sector, wdc_c->r_count, wdc_c->r_precomp); if ((wdc_c->flags & AT_POLL) == 0) { chp->ch_flags |= WDCF_IRQ_WAIT; /* wait for interrupt */ - timeout(wdctimeout, chp, wdc_c->timeout / 1000 * hz); + callout_reset(&chp->ch_callout, wdc_c->timeout / 1000 * hz, + wdctimeout, chp); return; } /* @@ -1307,7 +1309,7 @@ __wdccommand_done(chp, xfer) WDCDEBUG_PRINT(("__wdccommand_done %s:%d:%d\n", chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive), DEBUG_FUNCS); - untimeout(wdctimeout, chp); + callout_stop(&chp->ch_callout); if (chp->ch_status & WDCS_DWF) wdc_c->flags |= AT_DF; diff --git a/sys/dev/ic/wdcvar.h b/sys/dev/ic/wdcvar.h index 3a021dbb73c..7ccd850dfd0 100644 --- a/sys/dev/ic/wdcvar.h +++ b/sys/dev/ic/wdcvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: wdcvar.h,v 1.21 2000/03/20 22:53:36 enami Exp $ */ +/* $NetBSD: wdcvar.h,v 1.22 2000/03/23 07:01:33 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -40,6 +40,8 @@ #include <dev/scsipi/scsipi_all.h> #include <dev/scsipi/scsipiconf.h> +#include <sys/callout.h> + #define WAITTIME (10 * hz) /* time to wait for a completion */ /* this is a lot for hard drives, but not for cdroms */ @@ -48,6 +50,8 @@ struct channel_queue { /* per channel queue (may be shared) */ }; struct channel_softc { /* Per channel data */ + /* Out timeout callout */ + struct callout ch_callout; /* Our location */ int channel; /* Our controller's softc */ diff --git a/sys/dev/ic/z8530tty.c b/sys/dev/ic/z8530tty.c index 37d8b9dbf4d..74c090720a9 100644 --- a/sys/dev/ic/z8530tty.c +++ b/sys/dev/ic/z8530tty.c @@ -1,4 +1,4 @@ -/* $NetBSD: z8530tty.c,v 1.64 2000/03/19 12:42:45 pk Exp $ */ +/* $NetBSD: z8530tty.c,v 1.65 2000/03/23 07:01:34 thorpej Exp $ */ /*- * Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999 @@ -152,6 +152,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; @@ -275,6 +277,8 @@ zstty_attach(parent, self, aux) dev_t dev; char *i, *o; + callout_init(&zst->zst_diag_ch); + tty_unit = zst->zst_dev.dv_unit; channel = args->channel; cs = zsc->zsc_cs[channel]; @@ -1610,7 +1614,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); } /* If not yet open, drop the entire buffer content here */ @@ -1627,7 +1632,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); diff --git a/sys/dev/isa/ega.c b/sys/dev/isa/ega.c index e65ac372089..549976abcd0 100644 --- a/sys/dev/isa/ega.c +++ b/sys/dev/isa/ega.c @@ -1,4 +1,4 @@ -/* $NetBSD: ega.c,v 1.3 2000/01/25 02:44:04 ad Exp $ */ +/* $NetBSD: ega.c,v 1.4 2000/03/23 07:01:34 thorpej Exp $ */ /* * Copyright (c) 1999 @@ -34,6 +34,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/kernel.h> #include <sys/device.h> #include <sys/malloc.h> @@ -87,6 +88,8 @@ struct ega_config { struct egascreen *wantedscreen; void (*switchcb) __P((void *, int, int)); void *switchcbarg; + + struct callout switch_callout; }; struct ega_softc { @@ -434,6 +437,7 @@ ega_init(vc, iot, memt, mono) LIST_INIT(&vc->screens); vc->active = NULL; vc->currenttype = vh->vh_mono ? &ega_stdscreen_mono : &ega_stdscreen; + callout_init(&vc->switch_callout); vc->vc_fonts[0] = &ega_builtinfont; for (i = 1; i < 4; i++) @@ -683,7 +687,8 @@ ega_show_screen(v, cookie, waitok, cb, cbarg) vc->switchcb = cb; vc->switchcbarg = cbarg; if (cb) { - timeout((void(*)(void *))ega_doswitch, vc, 0); + callout_reset(&vc->switch_callout, 0, + (void(*)(void *))ega_doswitch); return (EAGAIN); } diff --git a/sys/dev/isa/ess.c b/sys/dev/isa/ess.c index efcca777103..dfaf26aac53 100644 --- a/sys/dev/isa/ess.c +++ b/sys/dev/isa/ess.c @@ -1,4 +1,4 @@ -/* $NetBSD: ess.c,v 1.50 2000/02/07 22:07:31 thorpej Exp $ */ +/* $NetBSD: ess.c,v 1.51 2000/03/23 07:01:34 thorpej Exp $ */ /* * Copyright 1997 @@ -776,6 +776,10 @@ ess_setup_sc(sc, doinit) struct ess_softc *sc; int doinit; { + + callout_init(&sc->sc_poll1_ch); + callout_init(&sc->sc_poll2_ch); + /* Reset the chip. */ if (ess_reset(sc) != 0) { DPRINTF(("ess_setup_sc: couldn't reset chip\n")); @@ -1303,7 +1307,8 @@ ess_audio1_trigger_output(addr, start, end, blksize, intr, arg, param) sc->sc_audio1.buffersize = (char *)end - (char *)start; sc->sc_audio1.dmacount = 0; sc->sc_audio1.blksize = blksize; - timeout(ess_audio1_poll, sc, hz/30); + callout_reset(&sc->sc_poll1_ch, hz / 30, + ess_audio1_poll, sc); } reg = ess_read_x_reg(sc, ESS_XCMD_AUDIO_CTRL); @@ -1381,7 +1386,8 @@ ess_audio2_trigger_output(addr, start, end, blksize, intr, arg, param) sc->sc_audio2.buffersize = (char *)end - (char *)start; sc->sc_audio2.dmacount = 0; sc->sc_audio2.blksize = blksize; - timeout(ess_audio2_poll, sc, hz/30); + callout_reset(&sc->sc_poll2_ch, hz / 30, + ess_audio2_poll, sc); } reg = ess_read_mix_reg(sc, ESS_MREG_AUDIO2_CTRL2); @@ -1450,7 +1456,8 @@ ess_audio1_trigger_input(addr, start, end, blksize, intr, arg, param) sc->sc_audio1.buffersize = (char *)end - (char *)start; sc->sc_audio1.dmacount = 0; sc->sc_audio1.blksize = blksize; - timeout(ess_audio1_poll, sc, hz/30); + callout_reset(&sc->sc_poll1_ch, hz / 30, + ess_audio1_poll, sc); } reg = ess_read_x_reg(sc, ESS_XCMD_AUDIO_CTRL); @@ -1515,7 +1522,7 @@ ess_audio1_halt(addr) ESS_AUDIO1_CTRL2_FIFO_ENABLE); isa_dmaabort(sc->sc_ic, sc->sc_audio1.drq); if (sc->sc_audio1.polled) - untimeout(ess_audio1_poll, sc); + callout_stop(&sc->sc_poll1_ch); sc->sc_audio1.active = 0; } @@ -1536,7 +1543,7 @@ ess_audio2_halt(addr) ESS_AUDIO2_CTRL1_FIFO_ENABLE); isa_dmaabort(sc->sc_ic, sc->sc_audio2.drq); if (sc->sc_audio2.polled) - untimeout(ess_audio2_poll, sc); + callout_stop(&sc->sc_poll2_ch); sc->sc_audio2.active = 0; } @@ -1620,7 +1627,7 @@ ess_audio1_poll(addr) (*sc->sc_audio1.intr)(sc->sc_audio1.arg, dmacount); #endif - timeout(ess_audio1_poll, sc, hz/30); + callout_reset(&sc->sc_poll1_ch, hz / 30, ess_audio1_poll, sc); } void @@ -1651,7 +1658,7 @@ ess_audio2_poll(addr) (*sc->sc_audio2.intr)(sc->sc_audio2.arg, dmacount); #endif - timeout(ess_audio2_poll, sc, hz/30); + callout_reset(&sc->sc_poll2_ch, hz / 30, ess_audio2_poll, sc); } int diff --git a/sys/dev/isa/essvar.h b/sys/dev/isa/essvar.h index 200c04b2421..ee734eb1dd6 100644 --- a/sys/dev/isa/essvar.h +++ b/sys/dev/isa/essvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: essvar.h,v 1.16 2000/02/07 22:07:31 thorpej Exp $ */ +/* $NetBSD: essvar.h,v 1.17 2000/03/23 07:01:34 thorpej Exp $ */ /* * Copyright 1997 * Digital Equipment Corporation. All rights reserved. @@ -33,7 +33,7 @@ */ /* -** @(#) $RCSfile: essvar.h,v $ $Revision: 1.16 $ (SHARK) $Date: 2000/02/07 22:07:31 $ +** @(#) $RCSfile: essvar.h,v $ $Revision: 1.17 $ (SHARK) $Date: 2000/03/23 07:01:34 $ ** **++ ** @@ -62,6 +62,9 @@ ** **-- */ + +#include <sys/callout.h> + #define ESS_DAC_PLAY_VOL 0 #define ESS_MIC_PLAY_VOL 1 #define ESS_LINE_PLAY_VOL 2 @@ -125,6 +128,9 @@ struct ess_softc bus_space_tag_t sc_iot; /* tag */ bus_space_handle_t sc_ioh; /* handle */ + struct callout sc_poll1_ch; /* audio1 poll */ + struct callout sc_poll2_ch; /* audio2 poll */ + int sc_iobase; /* I/O port base address */ u_short sc_open; /* reference count of open calls */ diff --git a/sys/dev/isa/gus.c b/sys/dev/isa/gus.c index abee76ce1d6..6a1484560e7 100644 --- a/sys/dev/isa/gus.c +++ b/sys/dev/isa/gus.c @@ -1,4 +1,4 @@ -/* $NetBSD: gus.c,v 1.68 2000/02/07 22:07:31 thorpej Exp $ */ +/* $NetBSD: gus.c,v 1.69 2000/03/23 07:01:34 thorpej Exp $ */ /*- * Copyright (c) 1996, 1999 The NetBSD Foundation, Inc. @@ -99,6 +99,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/errno.h> #include <sys/ioctl.h> #include <sys/syslog.h> @@ -185,6 +186,8 @@ struct gus_softc { bus_space_handle_t sc_ioh3; /* ICS2101 handle */ bus_space_handle_t sc_ioh4; /* MIDI handle */ + struct callout sc_dmaout_ch; + int sc_iobase; /* I/O base address */ int sc_irq; /* IRQ used */ int sc_playdrq; /* DMA channel for play */ @@ -807,6 +810,8 @@ gusattach(parent, self, aux) int iobase, i; unsigned char c,d,m; + callout_init(&sc->sc_dmaout_ch); + sc->sc_iot = iot = ia->ia_iot; sc->sc_ic = ia->ia_ic; iobase = ia->ia_iobase; @@ -1459,7 +1464,7 @@ gus_dmaout_intr(sc) SELECT_GUS_REG(iot, ioh2, GUSREG_DMA_CONTROL); if (bus_space_read_1(iot, ioh2, GUS_DATA_HIGH) & GUSMASK_DMA_IRQPEND) { - untimeout(gus_dmaout_timeout, sc); + callout_stop(&sc->sc_dmaout_ch); gus_dmaout_dointr(sc); return 1; } @@ -2010,8 +2015,7 @@ gusdmaout(sc, flags, gusaddr, buffaddr, length) /* * XXX If we don't finish in one second, give up... */ - untimeout(gus_dmaout_timeout, sc); /* flush old one, if there is one */ - timeout(gus_dmaout_timeout, sc, hz); + callout_reset(&sc->sc_dmaout_ch, hz, gus_dmaout_timeout, sc); } /* @@ -3080,7 +3084,7 @@ gus_halt_out_dma(addr) SELECT_GUS_REG(iot, ioh2, GUSREG_DMA_CONTROL); bus_space_write_1(iot, ioh2, GUS_DATA_HIGH, 0); - untimeout(gus_dmaout_timeout, sc); + callout_stop(&sc->sc_dmaout_ch); isa_dmaabort(sc->sc_ic, sc->sc_playdrq); sc->sc_flags &= ~(GUS_DMAOUT_ACTIVE|GUS_LOCKED); sc->sc_dmaoutintr = 0; diff --git a/sys/dev/isa/mcd.c b/sys/dev/isa/mcd.c index ab95d323478..c0d5a7bb5f2 100644 --- a/sys/dev/isa/mcd.c +++ b/sys/dev/isa/mcd.c @@ -1,4 +1,4 @@ -/* $NetBSD: mcd.c,v 1.65 2000/02/07 20:16:56 thorpej Exp $ */ +/* $NetBSD: mcd.c,v 1.66 2000/03/23 07:01:35 thorpej Exp $ */ /* * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved. @@ -58,6 +58,7 @@ #include <sys/types.h> #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/kernel.h> #include <sys/proc.h> #include <sys/conf.h> @@ -120,6 +121,8 @@ struct mcd_softc { struct disk sc_dk; void *sc_ih; + struct callout sc_pintr_ch; + bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; @@ -247,6 +250,7 @@ mcdattach(parent, self, aux) } BUFQ_INIT(&sc->buf_queue); + callout_init(&sc->sc_pintr_ch); /* * Initialize and attach the disk structure. @@ -1181,7 +1185,7 @@ mcdintr(arg) mbx->state = MCD_S_WAITMODE; case MCD_S_WAITMODE: - untimeout(mcd_pseudointr, sc); + callout_stop(&sc->sc_pintr_ch); for (i = 20; i; i--) { x = bus_space_read_1(iot, ioh, MCD_XFER); if ((x & MCD_XF_STATUSUNAVAIL) == 0) @@ -1219,7 +1223,7 @@ mcdintr(arg) mbx->state = MCD_S_WAITREAD; case MCD_S_WAITREAD: - untimeout(mcd_pseudointr, sc); + callout_stop(&sc->sc_pintr_ch); nextblock: loop: for (i = 20; i; i--) { @@ -1277,7 +1281,8 @@ mcdintr(arg) printf("%s: sleep in state %d\n", sc->sc_dev.dv_xname, mbx->state); #endif - timeout(mcd_pseudointr, sc, hz / 100); + callout_reset(&sc->sc_pintr_ch, hz / 100, + mcd_pseudointr, sc); return -1; } diff --git a/sys/dev/isa/pckbc_isa.c b/sys/dev/isa/pckbc_isa.c index eefd9fb1aef..629e8d2a28a 100644 --- a/sys/dev/isa/pckbc_isa.c +++ b/sys/dev/isa/pckbc_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: pckbc_isa.c,v 1.1 1999/12/03 22:48:25 thorpej Exp $ */ +/* $NetBSD: pckbc_isa.c,v 1.2 2000/03/23 07:01:35 thorpej Exp $ */ /* * Copyright (c) 1998 @@ -160,6 +160,7 @@ pckbc_isa_attach(parent, self, aux) t->t_ioh_c = ioh_c; t->t_addr = IO_KBD; t->t_cmdbyte = KC8_CPU; /* Enable ports */ + callout_init(&t->t_cleanup); } t->t_sc = sc; diff --git a/sys/dev/isa/pcppi.c b/sys/dev/isa/pcppi.c index 5797e5548e0..9efd1a96683 100644 --- a/sys/dev/isa/pcppi.c +++ b/sys/dev/isa/pcppi.c @@ -1,4 +1,4 @@ -/* $NetBSD: pcppi.c,v 1.3 2000/03/10 06:10:36 thorpej Exp $ */ +/* $NetBSD: pcppi.c,v 1.4 2000/03/23 07:01:35 thorpej Exp $ */ /* * Copyright (c) 1996 Carnegie-Mellon University. @@ -29,6 +29,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/kernel.h> #include <sys/proc.h> #include <sys/device.h> @@ -57,6 +58,8 @@ struct pcppi_softc { bus_space_tag_t sc_iot; bus_space_handle_t sc_ppi_ioh, sc_pit1_ioh; + struct callout sc_bell_ch; + int sc_bellactive, sc_bellpitch; int sc_slp; int sc_timeout; @@ -150,6 +153,8 @@ pcppi_attach(parent, self, aux) bus_space_tag_t iot; struct pcppi_attach_args pa; + callout_init(&sc->sc_bell_ch); + sc->sc_iot = iot = ia->ia_iot; if (bus_space_map(iot, IO_TIMER1, 4, 0, &sc->sc_pit1_ioh) || @@ -182,7 +187,7 @@ pcppi_bell(self, pitch, period, slp) if (sc->sc_bellactive) { if (sc->sc_timeout) { sc->sc_timeout = 0; - untimeout(pcppi_bell_stop, sc); + callout_stop(&sc->sc_bell_ch); } if (sc->sc_slp) wakeup(pcppi_bell_stop); @@ -210,13 +215,12 @@ pcppi_bell(self, pitch, period, slp) sc->sc_bellpitch = pitch; sc->sc_bellactive = 1; - if (slp & PCPPI_BELL_POLL) { delay((period * 1000000) / hz); pcppi_bell_stop(sc); } else { sc->sc_timeout = 1; - timeout(pcppi_bell_stop, sc, period); + callout_reset(&sc->sc_bell_ch, period, pcppi_bell_stop, sc); if (slp & PCPPI_BELL_SLEEP) { sc->sc_slp = 1; tsleep(pcppi_bell_stop, PCPPIPRI | PCATCH, "bell", 0); diff --git a/sys/dev/isa/satlink.c b/sys/dev/isa/satlink.c index c539893c9b0..045494300b8 100644 --- a/sys/dev/isa/satlink.c +++ b/sys/dev/isa/satlink.c @@ -1,4 +1,4 @@ -/* $NetBSD: satlink.c,v 1.8 2000/02/07 22:07:31 thorpej Exp $ */ +/* $NetBSD: satlink.c,v 1.9 2000/03/23 07:01:35 thorpej Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -46,6 +46,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/errno.h> #include <sys/ioctl.h> #include <sys/device.h> @@ -83,6 +84,7 @@ struct satlink_softc { int sc_lastresid; /* residual */ struct selinfo sc_selq; /* our select/poll queue */ struct satlink_id sc_id; /* ID cached at attach time */ + struct callout sc_ch; /* callout pseudo-interrupt */ }; /* sc_flags */ @@ -185,6 +187,8 @@ satlinkattach(parent, self, aux) sc->sc_id.sid_grpid, sc->sc_id.sid_userid, sc->sc_id.sid_serial); + callout_reset(&sc->sc_ch); + sc->sc_bufsize = isa_dmamaxsize(sc->sc_ic, sc->sc_drq); /* Allocate and map the ring buffer. */ @@ -245,7 +249,7 @@ satlinkopen(dev, flags, fmt, p) sc->sc_flags |= SATF_ISOPEN; - timeout(satlinktimeout, sc, SATLINK_TIMEOUT); + callout_reset(&sc->sc_ch, SATLINK_TIMEOUT, satlinktimeout, sc); return (0); } @@ -265,7 +269,7 @@ satlinkclose(dev, flags, fmt, p) splx(s); isa_dmaabort(sc->sc_ic, sc->sc_drq); - untimeout(satlinktimeout, sc); + callout_stop(&sc->sc_ch); return (0); } @@ -446,5 +450,5 @@ satlinktimeout(arg) selwakeup(&sc->sc_selq); out: - timeout(satlinktimeout, sc, SATLINK_TIMEOUT); + callout_reset(&sc->sc_ch, SATLINK_TIMEOUT, satlinktimeout, sc); } diff --git a/sys/dev/isa/seagate.c b/sys/dev/isa/seagate.c index d8c0896b91a..24d50ddd72f 100644 --- a/sys/dev/isa/seagate.c +++ b/sys/dev/isa/seagate.c @@ -1,4 +1,4 @@ -/* $NetBSD: seagate.c,v 1.34 1999/09/30 23:04:41 thorpej Exp $ */ +/* $NetBSD: seagate.c,v 1.35 2000/03/23 07:01:35 thorpej Exp $ */ /* * ST01/02, Future Domain TMC-885, TMC-950 SCSI driver @@ -599,7 +599,8 @@ sea_scsi_cmd(xs) * Usually return SUCCESSFULLY QUEUED */ if ((flags & XS_CTL_POLL) == 0) { - timeout(sea_timeout, scb, (xs->timeout * hz) / 1000); + callout_reset(&scb->xs->xs_callout, (xs->timeout * hz) / 1000, + sea_timeout, scb); splx(s); return SUCCESSFULLY_QUEUED; } @@ -839,7 +840,8 @@ sea_timeout(arg) sea_abort(sea, scb); /* 2 secs for the abort */ if ((xs->xs_control & XS_CTL_POLL) == 0) - timeout(sea_timeout, scb, 2 * hz); + callout_reset(&scb->xs->xs_callout, 2 * hz, + sea_timeout, scb); } splx(s); @@ -1194,7 +1196,7 @@ sea_done(sea, scb) { struct scsipi_xfer *xs = scb->xs; - untimeout(sea_timeout, scb); + callout_stop(&scb->xs->xs_callout); xs->resid = scb->datalen; diff --git a/sys/dev/isa/uha_isa.c b/sys/dev/isa/uha_isa.c index de15c338ede..f74ff917c03 100644 --- a/sys/dev/isa/uha_isa.c +++ b/sys/dev/isa/uha_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: uha_isa.c,v 1.18 1999/09/30 23:04:41 thorpej Exp $ */ +/* $NetBSD: uha_isa.c,v 1.19 2000/03/23 07:01:35 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -302,7 +302,8 @@ u14_start_mbox(sc, mscp) bus_space_write_1(iot, ioh, U14_LINT, U14_OGMFULL); if ((mscp->xs->xs_control & XS_CTL_POLL) == 0) - timeout(uha_timeout, mscp, (mscp->timeout * hz) / 1000); + callout_reset(&mscp->xs->xs_callout, + (mscp->timeout * hz) / 1000, uha_timeout, mscp); } /* @@ -379,7 +380,7 @@ u14_intr(arg) continue; /* whatever it was, it'll timeout */ } - untimeout(uha_timeout, mscp); + callout_stop(&mscp->xs->xs_callout); uha_done(sc, mscp); if ((bus_space_read_1(iot, ioh, U14_SINT) & U14_SDIP) == 0) diff --git a/sys/dev/isa/wdc_isa.c b/sys/dev/isa/wdc_isa.c index d299f374a2b..124b59087be 100644 --- a/sys/dev/isa/wdc_isa.c +++ b/sys/dev/isa/wdc_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_isa.c,v 1.17 2000/02/08 18:40:51 thorpej Exp $ */ +/* $NetBSD: wdc_isa.c,v 1.18 2000/03/23 07:01:35 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -85,10 +85,12 @@ wdc_isa_probe(parent, match, aux) struct cfdata *match; void *aux; { - struct channel_softc ch = { 0 }; + struct channel_softc ch; struct isa_attach_args *ia = aux; int result = 0; + memset(&ch, 0, sizeof(ch)); + ch.cmd_iot = ia->ia_iot; if (bus_space_map(ch.cmd_iot, ia->ia_iobase, WDC_ISA_REG_NPORTS, 0, &ch.cmd_ioh)) diff --git a/sys/dev/isa/wds.c b/sys/dev/isa/wds.c index 5df9f8b035f..935e7bc7c5d 100644 --- a/sys/dev/isa/wds.c +++ b/sys/dev/isa/wds.c @@ -1,4 +1,4 @@ -/* $NetBSD: wds.c,v 1.39 1999/09/30 23:04:41 thorpej Exp $ */ +/* $NetBSD: wds.c,v 1.40 2000/03/23 07:01:36 thorpej Exp $ */ #include "opt_ddb.h" @@ -455,7 +455,7 @@ AGAIN: } #endif /* WDSDEBUG */ - untimeout(wds_timeout, scb); + callout_stop(&scb->xs->xs_callout); wds_done(sc, scb, wmbi->stat); next: @@ -814,7 +814,8 @@ wds_start_scbs(sc) wds_cmd(sc->sc_iot, sc->sc_ioh, &c, sizeof c); if ((scb->flags & SCB_POLLED) == 0) - timeout(wds_timeout, scb, (scb->timeout * hz) / 1000); + callout_reset(&scb->xs->xs_callout, + (scb->timeout * hz) / 1000, wds_timeout, scb); ++sc->sc_mbofull; wds_nextmbx(wmbo, wmbx, mbo); diff --git a/sys/dev/isa/wt.c b/sys/dev/isa/wt.c index f60e0636383..01307303101 100644 --- a/sys/dev/isa/wt.c +++ b/sys/dev/isa/wt.c @@ -1,4 +1,4 @@ -/* $NetBSD: wt.c,v 1.48 2000/02/08 18:40:51 thorpej Exp $ */ +/* $NetBSD: wt.c,v 1.49 2000/03/23 07:01:36 thorpej Exp $ */ /* * Streamer tape driver. @@ -52,6 +52,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> @@ -124,6 +125,8 @@ struct wt_softc { bus_space_handle_t sc_ioh; isa_chipset_tag_t sc_ic; + struct callout sc_timer_ch; + enum wttype type; /* type of controller */ int chan; /* dma channel number, 1..3 */ int flags; /* state of tape drive */ @@ -242,6 +245,8 @@ wtattach(parent, self, aux) sc->sc_ioh = ioh; sc->sc_ic = ia->ia_ic; + callout_init(&sc->sc_timer_ch); + /* Try Wangtek. */ if (wtreset(iot, ioh, &wtregs)) { sc->type = WANGTEK; @@ -972,7 +977,8 @@ wtclock(sc) * Some controllers seem to lose dma interrupts too often. To make the * tape stream we need 1 tick timeout. */ - timeout(wttimer, sc, (sc->flags & TPACTIVE) ? 1 : hz); + callout_reset(&sc->sc_timer_ch, (sc->flags & TPACTIVE) ? 1 : hz, + wttimer, sc); } /* diff --git a/sys/dev/isa/ym.c b/sys/dev/isa/ym.c index 0696f598dc6..290592aca79 100644 --- a/sys/dev/isa/ym.c +++ b/sys/dev/isa/ym.c @@ -1,4 +1,4 @@ -/* $NetBSD: ym.c,v 1.13 1999/12/27 03:21:56 itohy Exp $ */ +/* $NetBSD: ym.c,v 1.14 2000/03/23 07:01:36 thorpej Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -204,6 +204,8 @@ ym_attach(sc) static struct ad1848_volume vol_opl3 = {YM_VOL_OPL3, YM_VOL_OPL3}; struct audio_attach_args arg; + callout_init(&sc->sc_powerdown_ch); + /* Mute the output to reduce noise during initialization. */ ym_mute(sc, SA3_VOL_L, 1); ym_mute(sc, SA3_VOL_R, 1); @@ -1027,7 +1029,7 @@ ym_power_hook(why, v) /* * suspending... */ - untimeout(ym_powerdown_blocks, sc); + callout_stop(&sc->sc_powerdown_ch); if (sc->sc_turning_off) ym_powerdown_blocks(sc); @@ -1170,7 +1172,7 @@ ym_chip_powerup(sc, nosleep) ym_mute(sc, SA3_VOL_R, sc->master_mute); } -/* timeout() handler for power-down */ +/* callout handler for power-down */ void ym_powerdown_blocks(arg) void *arg; @@ -1250,12 +1252,12 @@ ym_power_ctl(sc, parts, onoff) } sc->sc_in_power_ctl |= YM_POWER_CTL_INUSE; - /* Defeat timeout(9) interrupts. */ + /* Defeat softclock interrupts. */ s = splsoftclock(); /* If ON requested to parts which are scheduled to OFF, cancel it. */ if (onoff && sc->sc_turning_off && (sc->sc_turning_off &= ~parts) == 0) - untimeout(ym_powerdown_blocks, sc); + callout_stop(&sc->sc_powerdown_ch); if (!onoff && sc->sc_turning_off) parts &= ~sc->sc_turning_off; @@ -1265,7 +1267,7 @@ ym_power_ctl(sc, parts, onoff) /* Cancel previous timeout if needed. */ if (parts != 0 && sc->sc_turning_off) - untimeout(ym_powerdown_blocks, sc); + callout_stop(&sc->sc_powerdown_ch); (void) splx(s); @@ -1303,7 +1305,8 @@ ym_power_ctl(sc, parts, onoff) /* Schedule turning off. */ if (sc->sc_pow_mode != YM_POWER_NOSAVE && sc->sc_turning_off) - timeout(ym_powerdown_blocks, sc, hz * sc->sc_pow_timeout); + callout_reset(&sc->sc_powerdown_ch, hz * sc->sc_pow_timeout, + ym_powerdown_blocks, sc); unlock: if (sc->sc_in_power_ctl & YM_POWER_CTL_WANTED) diff --git a/sys/dev/isa/ymvar.h b/sys/dev/isa/ymvar.h index d22cf46c5c5..bf97d7ea949 100644 --- a/sys/dev/isa/ymvar.h +++ b/sys/dev/isa/ymvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: ymvar.h,v 1.5 1999/12/27 03:21:56 itohy Exp $ */ +/* $NetBSD: ymvar.h,v 1.6 2000/03/23 07:01:36 thorpej Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -71,6 +71,8 @@ * */ +#include <sys/callout.h> + /* * Original code from OpenBSD. */ @@ -155,6 +157,8 @@ struct ym_softc { bus_space_handle_t sc_opl_ioh; bus_space_handle_t sc_sb_ioh; /* only used to disable it */ + struct callout sc_powerdown_ch; + int master_mute, mic_mute; struct ad1848_volume master_gain; u_int8_t mic_gain; diff --git a/sys/dev/midi.c b/sys/dev/midi.c index 937b09a50a9..93dd44098aa 100644 --- a/sys/dev/midi.c +++ b/sys/dev/midi.c @@ -1,4 +1,4 @@ -/* $NetBSD: midi.c,v 1.14 2000/01/18 18:49:35 augustss Exp $ */ +/* $NetBSD: midi.c,v 1.15 2000/03/23 07:01:26 thorpej Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -48,6 +48,7 @@ #include <sys/malloc.h> #include <sys/proc.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/syslog.h> #include <sys/kernel.h> #include <sys/signalvar.h> @@ -137,6 +138,9 @@ midiattach(parent, self, aux) return; } #endif + + callout_init(&sc->sc_callout); + sc->hw_if = hwp; sc->hw_hdl = hdlp; midi_attach(sc, parent); @@ -518,7 +522,8 @@ midi_start_output(sc, intr) psignal(sc->async, SIGIO); if (mb->used > 0) { if (!(sc->props & MIDI_PROP_OUT_INTR)) - timeout(midi_timeout, sc, midi_wait); + callout_reset(&sc->sc_callout, midi_wait, + midi_timeout, sc); } else sc->pbus = 0; splx(s); diff --git a/sys/dev/midivar.h b/sys/dev/midivar.h index 1fbc63d88e4..c0722d55fa2 100644 --- a/sys/dev/midivar.h +++ b/sys/dev/midivar.h @@ -1,4 +1,4 @@ -/* $NetBSD: midivar.h,v 1.6 1998/11/25 22:17:07 augustss Exp $ */ +/* $NetBSD: midivar.h,v 1.7 2000/03/23 07:01:26 thorpej Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -43,6 +43,8 @@ #include "sequencer.h" +#include <sys/callout.h> + struct midi_buffer { u_char *inp; u_char *outp; @@ -71,6 +73,8 @@ struct midi_softc { struct selinfo rsel; /* read selector */ struct proc *async; /* process who wants audio SIGIO */ + struct callout sc_callout; + /* MIDI input state machine */ int in_state; #define MIDI_IN_START 0 diff --git a/sys/dev/mii/mii.c b/sys/dev/mii/mii.c index a1f6f3741f6..9b3c105fa34 100644 --- a/sys/dev/mii/mii.c +++ b/sys/dev/mii/mii.c @@ -1,4 +1,4 @@ -/* $NetBSD: mii.c,v 1.19 2000/02/02 17:09:44 thorpej Exp $ */ +/* $NetBSD: mii.c,v 1.20 2000/03/23 07:01:36 thorpej Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -144,6 +144,7 @@ mii_attach(parent, mii, capmask, phyloc, offloc, flags) /* * Link it up in the parent's MII data. */ + callout_init(&child->mii_nway_ch); LIST_INSERT_HEAD(&mii->mii_phys, child, mii_list); child->mii_offset = offset; mii->mii_instance++; diff --git a/sys/dev/mii/mii_physubr.c b/sys/dev/mii/mii_physubr.c index 24fecbd6a73..1ac942be590 100644 --- a/sys/dev/mii/mii_physubr.c +++ b/sys/dev/mii/mii_physubr.c @@ -1,4 +1,4 @@ -/* $NetBSD: mii_physubr.c,v 1.16 2000/03/15 20:34:43 thorpej Exp $ */ +/* $NetBSD: mii_physubr.c,v 1.17 2000/03/23 07:01:36 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -138,7 +138,8 @@ mii_phy_auto(sc, waitfor) */ if ((sc->mii_flags & MIIF_DOINGAUTO) == 0) { sc->mii_flags |= MIIF_DOINGAUTO; - timeout(mii_phy_auto_timeout, sc, hz >> 1); + callout_reset(&sc->mii_nway_ch, hz >> 1, + mii_phy_auto_timeout, sc); } return (EJUSTRETURN); } @@ -242,7 +243,7 @@ mii_phy_down(sc) if (sc->mii_flags & MIIF_DOINGAUTO) { sc->mii_flags &= ~MIIF_DOINGAUTO; - untimeout(mii_phy_auto_timeout, sc); + callout_stop(&sc->mii_nway_ch); } } @@ -416,7 +417,7 @@ mii_phy_detach(self, flags) struct mii_softc *sc = (void *) self; if (sc->mii_flags & MIIF_DOINGAUTO) - untimeout(mii_phy_auto_timeout, sc); + callout_stop(&sc->mii_nway_ch); mii_phy_delete_media(sc); diff --git a/sys/dev/mii/miivar.h b/sys/dev/mii/miivar.h index e443f0e9085..5b91ab66151 100644 --- a/sys/dev/mii/miivar.h +++ b/sys/dev/mii/miivar.h @@ -1,4 +1,4 @@ -/* $NetBSD: miivar.h,v 1.17 2000/03/06 20:56:57 thorpej Exp $ */ +/* $NetBSD: miivar.h,v 1.18 2000/03/23 07:01:36 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -41,6 +41,7 @@ #define _DEV_MII_MIIVAR_H_ #include <sys/queue.h> +#include <sys/callout.h> /* * Media Independent Interface datat structure defintions. @@ -129,6 +130,9 @@ struct mii_softc { int mii_flags; /* misc. flags; see below */ int mii_capabilities; /* capabilities from BMSR */ int mii_ticks; /* MII_TICK counter */ + + struct callout mii_nway_ch; /* NWAY callout */ + int mii_media_active; /* last active media */ int mii_media_status; /* last active status */ }; diff --git a/sys/dev/ofw/ofcons.c b/sys/dev/ofw/ofcons.c index 826fb824576..1f9fb5f3db8 100644 --- a/sys/dev/ofw/ofcons.c +++ b/sys/dev/ofw/ofcons.c @@ -1,4 +1,4 @@ -/* $NetBSD: ofcons.c,v 1.9 1998/03/21 04:08:37 mycroft Exp $ */ +/* $NetBSD: ofcons.c,v 1.10 2000/03/23 07:01:37 thorpej Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -36,6 +36,7 @@ #include <sys/device.h> #include <sys/proc.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/tty.h> #include <dev/cons.h> @@ -45,6 +46,7 @@ struct ofcons_softc { struct device of_dev; struct tty *of_tty; + struct callout sc_poll_ch; int of_flags; }; /* flags: */ @@ -87,6 +89,8 @@ ofcons_attach(parent, self, aux) void *aux; { printf("\n"); + + callout_reset(&sc->sc_poll_ch); } static void ofcons_start __P((struct tty *)); @@ -128,7 +132,7 @@ ofcons_open(dev, flag, mode, p) if (!(sc->of_flags & OFPOLL)) { sc->of_flags |= OFPOLL; - timeout(ofcons_poll, sc, 1); + callout_reset(&sc->sc_poll_ch, 1, ofcons_poll, 1); } return (*linesw[tp->t_line].l_open)(dev, tp); @@ -143,7 +147,7 @@ ofcons_close(dev, flag, mode, p) struct ofcons_softc *sc = ofcons_cd.cd_devs[minor(dev)]; struct tty *tp = sc->of_tty; - untimeout(ofcons_poll, sc); + callout_stop(&sc->sc_poll_ch); sc->of_flags &= ~OFPOLL; (*linesw[tp->t_line].l_close)(tp, flag); ttyclose(tp); @@ -231,7 +235,7 @@ ofcons_start(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, (void *)tp); } if (cl->c_cc <= tp->t_lowat) { if (tp->t_state & TS_ASLEEP) { @@ -266,7 +270,7 @@ ofcons_poll(aux) if (tp && (tp->t_state & TS_ISOPEN)) (*linesw[tp->t_line].l_rint)(ch, tp); } - timeout(ofcons_poll, sc, 1); + callout_reset(&sc->sc_poll_ch, 1, ofcons_poll, 1); } static int @@ -348,12 +352,12 @@ ofcons_cnpollc(dev, on) return; if (on) { if (sc->of_flags & OFPOLL) - untimeout(ofcons_poll, sc); + callout_stop(&sc->sc_poll_ch); sc->of_flags &= ~OFPOLL; } else { if (!(sc->of_flags & OFPOLL)) { sc->of_flags |= OFPOLL; - timeout(ofcons_poll, sc, 1); + callout_reset(&sc->sc_poll_ch, 1, ofcons_poll, sc); } } } diff --git a/sys/dev/ofw/ofnet.c b/sys/dev/ofw/ofnet.c index 05e46ba841d..b92ac20ef90 100644 --- a/sys/dev/ofw/ofnet.c +++ b/sys/dev/ofw/ofnet.c @@ -1,4 +1,4 @@ -/* $NetBSD: ofnet.c,v 1.17 1999/05/18 23:52:57 thorpej Exp $ */ +/* $NetBSD: ofnet.c,v 1.18 2000/03/23 07:01:37 thorpej Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -36,6 +36,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/device.h> #include <sys/ioctl.h> #include <sys/mbuf.h> @@ -76,6 +77,7 @@ struct ofnet_softc { int sc_phandle; int sc_ihandle; struct ethercom sc_ethercom; + struct callout sc_callout; }; static int ofnet_match __P((struct device *, struct cfdata *, void *)); @@ -151,7 +153,9 @@ ofnet_attach(parent, self, aux) sizeof myaddr) < 0) panic("ofnet_attach: no mac-address"); printf(": address %s\n", ether_sprintf(myaddr)); - + + callout_init(&of->sc_callout); + bcopy(of->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); ifp->if_softc = of; ifp->if_start = ofnet_start; @@ -272,7 +276,7 @@ ofnet_timer(arg) struct ofnet_softc *of = arg; ofnet_read(of); - timeout(ofnet_timer, of, 1); + callout_reset(&of->sc_callout, 1, ofnet_timer, of); } static void @@ -295,7 +299,7 @@ static void ofnet_stop(of) struct ofnet_softc *of; { - untimeout(ofnet_timer, of); + callout_stop(&of->sc_callout); of->sc_ethercom.ec_if.if_flags &= ~IFF_RUNNING; } diff --git a/sys/dev/pci/if_de.c b/sys/dev/pci/if_de.c index d957fee3b07..df4df751241 100644 --- a/sys/dev/pci/if_de.c +++ b/sys/dev/pci/if_de.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_de.c,v 1.89 2000/02/23 08:31:25 fair Exp $ */ +/* $NetBSD: if_de.c,v 1.90 2000/03/23 07:01:37 thorpej Exp $ */ /*- * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com) @@ -45,6 +45,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/mbuf.h> #include <sys/protosw.h> #include <sys/socket.h> @@ -224,7 +225,8 @@ tulip_timeout( if (sc->tulip_flags & TULIP_TIMEOUTPENDING) return; sc->tulip_flags |= TULIP_TIMEOUTPENDING; - timeout(tulip_timeout_callback, sc, (hz + TULIP_HZ / 2) / TULIP_HZ); + callout_reset(&sc->tulip_to_ch, (hz + TULIP_HZ / 2) / TULIP_HZ, + tulip_timeout_callback, sc); } #if defined(TULIP_NEED_FASTTIMEOUT) @@ -247,7 +249,7 @@ tulip_fasttimeout( if (sc->tulip_flags & TULIP_FASTTIMEOUTPENDING) return; sc->tulip_flags |= TULIP_FASTTIMEOUTPENDING; - timeout(tulip_fasttimeout_callback, sc, 1); + callout_reset(&sc->tulip_fto_ch, 1, tulip_fasttimeout_callback, sc); } #endif @@ -5792,6 +5794,9 @@ tulip_pci_attach( #endif /* __bsdi__ */ #if defined(__NetBSD__) + callout_init(&sc->tulip_to_ch); + callout_init(&sc->tulip_fto_ch); + csr_base = 0; { bus_space_tag_t iot, memt; diff --git a/sys/dev/pci/if_devar.h b/sys/dev/pci/if_devar.h index e11346b5321..6e45b8c2013 100644 --- a/sys/dev/pci/if_devar.h +++ b/sys/dev/pci/if_devar.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_devar.h,v 1.33 2000/01/15 18:39:32 matt Exp $ */ +/* $NetBSD: if_devar.h,v 1.34 2000/03/23 07:01:38 thorpej Exp $ */ /*- * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com) @@ -493,6 +493,8 @@ struct _tulip_softc_t { struct device tulip_dev; /* base device */ void *tulip_ih; /* intrrupt vectoring */ void *tulip_ats; /* shutdown hook */ + struct callout tulip_to_ch; /* tulip_timeout_callback() */ + struct callout tulip_fto_ch; /* tulip_fasttimeout_callback() */ bus_space_tag_t tulip_bustag; bus_space_handle_t tulip_bushandle; /* CSR region handle */ pci_chipset_tag_t tulip_pc; diff --git a/sys/dev/pci/if_rl.c b/sys/dev/pci/if_rl.c index ae31583cf43..6b173d03303 100644 --- a/sys/dev/pci/if_rl.c +++ b/sys/dev/pci/if_rl.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_rl.c,v 1.7 2000/03/06 21:02:02 thorpej Exp $ */ +/* $NetBSD: if_rl.c,v 1.8 2000/03/23 07:01:38 thorpej Exp $ */ /* * Copyright (c) 1997, 1998 @@ -92,6 +92,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/device.h> #include <sys/sockio.h> #include <sys/mbuf.h> @@ -762,6 +763,8 @@ rl_attach(parent, self, aux) bus_dma_segment_t dmaseg; int error, dmanseg; + callout_init(&sc->rl_tick_ch); + s = splimp(); /* @@ -1486,7 +1489,7 @@ static void rl_init(xsc) (void)splx(s); - timeout(rl_tick, sc, hz); + callout_reset(&sc->rl_tick_ch, hz, rl_tick, sc); } /* @@ -1646,7 +1649,7 @@ static void rl_stop(sc) ifp = &sc->ethercom.ec_if; ifp->if_timer = 0; - untimeout(rl_tick, sc); + callout_stop(&sc->rl_tick_ch); mii_down(&sc->mii); @@ -1693,5 +1696,5 @@ rl_tick(arg) mii_tick(&sc->mii); splx(s); - timeout(rl_tick, sc, hz); + callout_reset(&sc->rl_tick_ch, hz, rl_tick, sc); } diff --git a/sys/dev/pci/if_rlreg.h b/sys/dev/pci/if_rlreg.h index 6665d939e8b..e95166990ca 100644 --- a/sys/dev/pci/if_rlreg.h +++ b/sys/dev/pci/if_rlreg.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_rlreg.h,v 1.1 1999/06/27 15:19:41 drochner Exp $ */ +/* $NetBSD: if_rlreg.h,v 1.2 2000/03/23 07:01:38 thorpej Exp $ */ /* * Copyright (c) 1997, 1998 @@ -359,6 +359,7 @@ struct rl_softc { struct device sc_dev; /* generic device structures */ struct ethercom ethercom; /* interface info */ struct mii_data mii; + struct callout rl_tick_ch; /* tick callout */ bus_space_handle_t rl_bhandle; /* bus space handle */ bus_space_tag_t rl_btag; /* bus space tag */ u_int8_t rl_type; diff --git a/sys/dev/pci/if_sip.c b/sys/dev/pci/if_sip.c index eb4bf28519a..bf0c0f79917 100644 --- a/sys/dev/pci/if_sip.c +++ b/sys/dev/pci/if_sip.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_sip.c,v 1.8 2000/03/06 21:02:02 thorpej Exp $ */ +/* $NetBSD: if_sip.c,v 1.9 2000/03/23 07:01:39 thorpej Exp $ */ /*- * Copyright (c) 1999 Network Computer, Inc. @@ -42,6 +42,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/mbuf.h> #include <sys/malloc.h> #include <sys/kernel.h> @@ -178,6 +179,8 @@ struct sip_softc { struct mii_data sc_mii; /* MII/media information */ + struct callout sc_tick_ch; /* tick callout */ + bus_dmamap_t sc_cddmamap; /* control data DMA map */ #define sc_cddma sc_cddmamap->dm_segs[0].ds_addr @@ -346,6 +349,8 @@ sip_attach(parent, self, aux) pcireg_t pmode; u_int16_t enaddr[ETHER_ADDR_LEN / 2]; + callout_init(&sc->sc_tick_ch); + sip = sip_lookup(pa); if (sip == NULL) { printf("\n"); @@ -1304,7 +1309,7 @@ sip_tick(arg) mii_tick(&sc->sc_mii); splx(s); - timeout(sip_tick, sc, hz); + callout_reset(&sc->sc_tick_ch, hz, sip_tick, sc); } /* @@ -1512,7 +1517,7 @@ sip_init(sc) /* * Start the one second MII clock. */ - timeout(sip_tick, sc, hz); + callout_reset(&sc->sc_tick_ch, hz, sip_tick, sc); /* * ...all done! @@ -1566,7 +1571,7 @@ sip_stop(sc, drain) /* * Stop the one second clock. */ - untimeout(sip_tick, sc); + callout_stop(&sc->sc_tick_ch); /* Down the MII. */ mii_down(&sc->sc_mii); diff --git a/sys/dev/pci/if_tl.c b/sys/dev/pci/if_tl.c index ae908bba9fa..51ee780817b 100644 --- a/sys/dev/pci/if_tl.c +++ b/sys/dev/pci/if_tl.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_tl.c,v 1.31 2000/03/06 21:02:02 thorpej Exp $ */ +/* $NetBSD: if_tl.c,v 1.32 2000/03/23 07:01:39 thorpej Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. All rights reserved. @@ -302,6 +302,9 @@ tl_pci_attach(parent, self, aux) printf("\n"); + callout_init(&sc->tl_tick_ch); + callout_init(&sc->tl_restart_ch); + tp = tl_lookup_product(pa->pa_id); if (tp == NULL) panic("tl_pci_attach: impossible"); @@ -459,7 +462,7 @@ tl_reset(sc) /* read stats */ if (sc->tl_if.if_flags & IFF_RUNNING) { - untimeout(tl_ticks, sc); + callout_stop(&sc->tl_tick_ch); tl_read_stats(sc); } /* Reset adapter */ @@ -513,7 +516,7 @@ static void tl_shutdown(v) DELAY(100000); /* stop statistics reading loop, read stats */ - untimeout(tl_ticks, sc); + callout_stop(&sc->tl_tick_ch); tl_read_stats(sc); /* Down the MII. */ @@ -640,7 +643,7 @@ static int tl_init(sc) mii_mediachg(&sc->tl_mii); /* start ticks calls */ - timeout(tl_ticks, sc, hz); + callout_reset(&sc->tl_tick_ch, hz, tl_ticks, sc); /* write adress of Rx list and enable interrupts */ TL_HR_WRITE(sc, TL_HOST_CH_PARM, vtophys(&sc->Rx_list[0].hw_list)); TL_HR_WRITE(sc, TL_HOST_CMD, @@ -985,7 +988,7 @@ tl_intr(v) sc->sc_dev.dv_xname); tl_reset(sc); /* shedule reinit of the board */ - timeout(tl_restart, sc, 1); + callout_reset(&sc->tl_restart_ch, 1, tl_restart, sc); return(1); } #endif @@ -1077,7 +1080,7 @@ tl_intr(v) TL_HR_READ(sc, TL_HOST_CH_PARM)); tl_reset(sc); /* shedule reinit of the board */ - timeout(tl_restart, sc, 1); + callout_reset(&sc->tl_restart_ch, 1, tl_restart, sc); return(1); } else { u_int8_t netstat; @@ -1524,7 +1527,7 @@ static void tl_ticks(v) } /* read statistics every seconds */ - timeout(tl_ticks, v, hz); + callout_reset(&sc->tl_tick_ch, hz, tl_ticks, sc); } static void diff --git a/sys/dev/pci/if_tlvar.h b/sys/dev/pci/if_tlvar.h index 4a387f39e5b..dae24cdd7a9 100644 --- a/sys/dev/pci/if_tlvar.h +++ b/sys/dev/pci/if_tlvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_tlvar.h,v 1.3 1999/01/11 22:45:42 tron Exp $ */ +/* $NetBSD: if_tlvar.h,v 1.4 2000/03/23 07:01:39 thorpej Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. All rights reserved. @@ -48,6 +48,8 @@ struct tl_softc { const struct tl_product_desc *tl_product; void* tl_ih; struct ethercom tl_ec; + struct callout tl_tick_ch; /* tick callout */ + struct callout tl_restart_ch; /* restart callout */ u_int8_t tl_enaddr[ETHER_ADDR_LEN]; /* hardware adress */ u_int16_t tl_flags; #define TL_IFACT 0x0001 /* chip has interface activity */ diff --git a/sys/dev/pci/if_vr.c b/sys/dev/pci/if_vr.c index 22e269e161e..b61533c4f53 100644 --- a/sys/dev/pci/if_vr.c +++ b/sys/dev/pci/if_vr.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_vr.c,v 1.33 2000/03/06 21:02:02 thorpej Exp $ */ +/* $NetBSD: if_vr.c,v 1.34 2000/03/23 07:01:39 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -107,6 +107,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/sockio.h> #include <sys/mbuf.h> #include <sys/malloc.h> @@ -214,6 +215,8 @@ struct vr_softc { u_int8_t vr_enaddr[ETHER_ADDR_LEN]; struct mii_data vr_mii; /* MII/media info */ + struct callout vr_tick_ch; /* tick callout */ + bus_dmamap_t vr_cddmamap; /* control data DMA map */ #define vr_cddma vr_cddmamap->dm_segs[0].ds_addr @@ -1185,7 +1188,7 @@ vr_init(sc) ifp->if_flags &= ~IFF_OACTIVE; /* Start one second timer. */ - timeout(vr_tick, sc, hz); + callout_reset(&sc->vr_tick_ch, hz, vr_tick, sc); /* Attempt to start output on the interface. */ vr_start(ifp); @@ -1350,7 +1353,7 @@ vr_tick(arg) mii_tick(&sc->vr_mii); splx(s); - timeout(vr_tick, sc, hz); + callout_reset(&sc->vr_tick_ch, hz, vr_tick, sc); } /* @@ -1387,7 +1390,7 @@ vr_stop(sc, drain) int i; /* Cancel one second timer. */ - untimeout(vr_tick, sc); + callout_stop(&sc->vr_tick_ch); /* Down the MII. */ mii_down(&sc->vr_mii); @@ -1499,6 +1502,8 @@ vr_attach(parent, self, aux) #define PCI_CONF_WRITE(r, v) pci_conf_write(pa->pa_pc, pa->pa_tag, (r), (v)) #define PCI_CONF_READ(r) pci_conf_read(pa->pa_pc, pa->pa_tag, (r)) + callout_init(&sc->vr_tick_ch); + vrt = vr_lookup(pa); if (vrt == NULL) { printf("\n"); diff --git a/sys/dev/pci/ncr.c b/sys/dev/pci/ncr.c index d8c3d8b0f2a..7af54083e1a 100644 --- a/sys/dev/pci/ncr.c +++ b/sys/dev/pci/ncr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ncr.c,v 1.97 2000/03/18 06:59:02 cgd Exp $ */ +/* $NetBSD: ncr.c,v 1.98 2000/03/23 07:01:39 thorpej Exp $ */ /************************************************************************** ** @@ -209,6 +209,7 @@ #ifdef KERNEL #include <sys/systm.h> +#include <sys/callout.h> #include <sys/malloc.h> #include <sys/buf.h> #include <sys/kernel.h> @@ -1139,6 +1140,7 @@ struct ncb { struct device sc_dev; pci_chipset_tag_t sc_pc; void *sc_ih; + struct callout sc_timo_ch; bus_space_tag_t sc_st; bus_space_handle_t sc_sh; bus_dma_tag_t sc_dmat; @@ -1532,7 +1534,7 @@ static int read_tekram_eeprom #if 0 static char ident[] = - "\n$NetBSD: ncr.c,v 1.97 2000/03/18 06:59:02 cgd Exp $\n"; + "\n$NetBSD: ncr.c,v 1.98 2000/03/23 07:01:39 thorpej Exp $\n"; #endif static const u_long ncr_version = NCR_VERSION * 11 @@ -3727,6 +3729,8 @@ static void ncr_attach (pcici_t config_id, int unit) bus_dma_segment_t seg; int rseg, error; + callout_init(&np->sc_timo_ch); + i = ncr_chip_lookup(pa->pa_id, rev); printf(": %s\n", ncr_chip_table[i].name); @@ -6031,7 +6035,7 @@ static void ncr_timeout (void *arg) splx (oldspl); } - timeout (ncr_timeout, (caddr_t) np, step ? step : 1); + callout_reset (&np->sc_timo_ch, step ? step : 1, ncr_timeout, np); if (INB(nc_istat) & (INTF|SIP|DIP)) { @@ -6401,7 +6405,7 @@ void ncr_exception (ncb_p np) if (i%16==15) printf (".\n"); }; - untimeout (ncr_timeout, (caddr_t) np); + callout_stop (&np->sc_timo_ch); printf ("%s: halted!\n", ncr_name(np)); /* diff --git a/sys/dev/pci/pccbb.c b/sys/dev/pci/pccbb.c index 078b87a8053..44568e76252 100644 --- a/sys/dev/pci/pccbb.c +++ b/sys/dev/pci/pccbb.c @@ -1,4 +1,4 @@ -/* $NetBSD: pccbb.c,v 1.36 2000/03/22 09:35:07 haya Exp $ */ +/* $NetBSD: pccbb.c,v 1.37 2000/03/23 07:01:40 thorpej Exp $ */ /* * Copyright (c) 1998, 1999 and 2000 @@ -945,9 +945,10 @@ pccbbintr(arg) */ (sc->sc_flags & CBB_CARDEXIST) == 0) { if (sc->sc_flags & CBB_INSERTING) { - untimeout(pci113x_insert, sc); + callout_stop(&sc->sc_insert_ch); } - timeout(pci113x_insert, sc, hz / 10); + callout_reset(&sc->sc_insert_ch, hz / 10, + pci113x_insert, sc); sc->sc_flags |= CBB_INSERTING; } } @@ -1008,7 +1009,8 @@ pci113x_insert(arg) /* who are you? */ } } else { - timeout(pci113x_insert, sc, hz / 10); + callout_reset(&sc->sc_insert_ch, hz / 10, + pci113x_insert, sc); } } @@ -1220,6 +1222,7 @@ struct cb_poll_str { int level; pccard_chipset_tag_t ct; int count; + struct callout poll_ch; }; static struct cb_poll_str cb_poll[10]; @@ -1237,7 +1240,7 @@ cb_pcmcia_poll(arg) int s; u_int32_t spsr; /* socket present-state reg */ - timeout(cb_pcmcia_poll, arg, hz / 10); + callout_reset(&poll->poll_ch, hz / 10, cb_pcmcia_poll, poll); switch (poll->level) { case IPL_NET: s = splnet(); @@ -2624,6 +2627,7 @@ struct pccbb_poll_str { struct pcic_handle *ph; int count; int num; + struct callout poll_ch; }; static struct pccbb_poll_str pccbb_poll[10]; @@ -2641,7 +2645,7 @@ pccbb_pcmcia_poll(arg) int s; u_int32_t spsr; /* socket present-state reg */ - timeout(pccbb_pcmcia_poll, arg, hz * 2); + callout_reset(&poll->poll_ch, hz * 2, pccbb_pcmcia_poll, arg); switch (poll->level) { case IPL_NET: s = splnet(); diff --git a/sys/dev/pci/pccbbvar.h b/sys/dev/pci/pccbbvar.h index ab3557de5c1..78bd6e2ae3e 100644 --- a/sys/dev/pci/pccbbvar.h +++ b/sys/dev/pci/pccbbvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: pccbbvar.h,v 1.11 2000/03/22 09:35:08 haya Exp $ */ +/* $NetBSD: pccbbvar.h,v 1.12 2000/03/23 07:01:40 thorpej Exp $ */ /* * Copyright (c) 1999 HAYAKAWA Koichi. All rights reserved. * @@ -30,6 +30,7 @@ /* require sys/device.h */ /* require sys/queue.h */ +/* require sys/callout.h */ /* require dev/ic/i82365reg.h */ /* require dev/ic/i82365var.h */ @@ -116,6 +117,8 @@ struct pccbb_softc { bus_space_tag_t sc_base_memt; bus_space_handle_t sc_base_memh; + struct callout sc_insert_ch; + void *sc_ih; /* interrupt handler */ int sc_intrline; /* interrupt line */ pcitag_t sc_intrtag; /* copy of pa->pa_intrtag */ diff --git a/sys/dev/pcmcia/esp_pcmcia.c b/sys/dev/pcmcia/esp_pcmcia.c index 6a7dc8a2201..f6cba726e0d 100644 --- a/sys/dev/pcmcia/esp_pcmcia.c +++ b/sys/dev/pcmcia/esp_pcmcia.c @@ -1,4 +1,4 @@ -/* $NetBSD: esp_pcmcia.c,v 1.4 2000/03/20 06:01:11 mycroft Exp $ */ +/* $NetBSD: esp_pcmcia.c,v 1.5 2000/03/23 07:01:42 thorpej Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -71,6 +71,9 @@ struct esp_pcmcia_softc { int sc_io_window; /* our i/o window */ struct pcmcia_function *sc_pf; /* our PCMCIA function */ void *sc_ih; /* interrupt handler */ +#ifdef ESP_PCMCIA_POLL + struct callout sc_poll_ch; +#endif int sc_flags; #define ESP_PCMCIA_ATTACHED 1 /* attach completed */ #define ESP_PCMCIA_ATTACHING 2 /* attach in progress */ @@ -237,6 +240,10 @@ esp_pcmcia_init(esc) sc->sc_glue = &esp_pcmcia_glue; +#ifdef ESP_PCMCIA_POLL + callout_init(&esc->sc_poll_ch); +#endif + sc->sc_rev = NCR_VARIANT_ESP406; sc->sc_id = 7; sc->sc_freq = 40; @@ -295,7 +302,7 @@ esp_pcmcia_enable(arg, onoff) if (onoff) { #ifdef ESP_PCMCIA_POLL - timeout(esp_pcmcia_poll, esc, 1); + callout_reset(&esc->sc_poll_ch, 1, esp_pcmcia_poll, esc); #else /* Establish the interrupt handler. */ esc->sc_ih = pcmcia_intr_establish(esc->sc_pf, IPL_BIO, @@ -327,7 +334,7 @@ esp_pcmcia_enable(arg, onoff) } else { pcmcia_function_disable(esc->sc_pf); #ifdef ESP_PCMCIA_POLL - untimeout(esp_pcmcia_poll, esc); + callout_stop(&esc->sc_poll_ch); #else pcmcia_intr_disestablish(esc->sc_pf, esc->sc_ih); #endif @@ -344,7 +351,7 @@ esp_pcmcia_poll(arg) struct esp_pcmcia_softc *esc = arg; (void) ncr53c9x_intr(&esc->sc_ncr53c9x); - timeout(esp_pcmcia_poll, esc, 1); + callout_reset(&esc->sc_poll_ch, 1, esp_pcmcia_poll, esc); } #endif diff --git a/sys/dev/pcmcia/if_ray.c b/sys/dev/pcmcia/if_ray.c index 6c4af980c12..bc23a622f09 100644 --- a/sys/dev/pcmcia/if_ray.c +++ b/sys/dev/pcmcia/if_ray.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ray.c,v 1.16 2000/03/10 05:47:42 onoe Exp $ */ +/* $NetBSD: if_ray.c,v 1.17 2000/03/23 07:01:42 thorpej Exp $ */ /* * Copyright (c) 2000 Christian E. Hopps * All rights reserved. @@ -54,6 +54,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/mbuf.h> #include <sys/socket.h> #include <sys/ioctl.h> @@ -159,6 +160,12 @@ struct ray_softc { int sc_resumeinit; int sc_resetloop; + struct callout sc_check_ccs_ch; + struct callout sc_check_scheduled_ch; + struct callout sc_reset_resetloop_ch; + struct callout sc_disable_ch; + struct callout sc_start_join_timo_ch; + struct ray_ecf_startup sc_ecf_startup; struct ray_startup_params_head sc_startup; union { @@ -569,6 +576,12 @@ ray_attach(parent, self, aux) sc->sc_countrycode = sc->sc_dcountrycode = RAY_PID_COUNTRY_CODE_DEFAULT; sc->sc_resumeinit = 0; + callout_init(&sc->sc_check_ccs_ch); + callout_init(&sc->sc_check_scheduled_ch); + callout_init(&sc->sc_reset_resetloop_ch); + callout_init(&sc->sc_disable_ch); + callout_init(&sc->sc_start_join_timo_ch); + /* * attach the interface */ @@ -823,10 +836,10 @@ ray_stop(sc) { RAY_DPRINTF(("%s: stop\n", sc->sc_xname)); - untimeout(ray_check_ccs, sc); + callout_stop(&sc->sc_check_ccs_ch); sc->sc_timocheck = 0; - untimeout(ray_check_scheduled, sc); + callout_stop(&sc->sc_check_scheduled_ch); sc->sc_timoneed = 0; if (sc->sc_repreq) { @@ -853,15 +866,17 @@ ray_reset(sc) if (sc->sc_resetloop == RAY_MAX_RESETS) { printf("%s: unable to correct, disabling\n", sc->sc_xname); - untimeout(ray_reset_resetloop, sc); - timeout((void (*)(void *))ray_disable, sc, 1); + callout_stop(&sc->sc_reset_resetloop_ch); + callout_reset(&sc->sc_disable_ch, 1, + (void (*)(void *))ray_disable, sc); } } else { printf("%s: unexpected failure resetting hw [%d more]\n", sc->sc_xname, RAY_MAX_RESETS - sc->sc_resetloop); - untimeout(ray_reset_resetloop, sc); + callout_stop(&sc->sc_reset_resetloop_ch); ray_init(sc); - timeout(ray_reset_resetloop, sc, 30 * hz); + callout_reset(&sc->sc_reset_resetloop_ch, 30 * hz, + ray_reset_resetloop, sc); } } @@ -1663,7 +1678,7 @@ ray_check_scheduled(arg) sc->sc_xname, sc->sc_scheduled, sc->sc_running, RAY_ECF_READY(sc))); if (sc->sc_timoneed) { - untimeout(ray_check_scheduled, sc); + callout_stop(&sc->sc_check_scheduled_ch); sc->sc_timoneed = 0; } @@ -1743,13 +1758,15 @@ breakout: /* give a chance for the interrupt to occur */ sc->sc_ccsinuse[i] = 2; if (!sc->sc_timocheck) { - timeout(ray_check_ccs, sc, 1); + callout_reset(&sc->sc_check_ccs_ch, 1, + ray_check_ccs, sc); sc->sc_timocheck = 1; } } else if ((fp = ray_ccs_done(sc, ccs))) (*fp)(sc); } else { - timeout(ray_check_ccs, sc, RAY_CHECK_CCS_TIMEOUT); + callout_reset(&sc->sc_check_ccs_ch, RAY_CHECK_CCS_TIMEOUT, + ray_check_ccs, sc); sc->sc_timocheck = 1; } splx(s); @@ -2102,7 +2119,8 @@ ray_set_pending(sc, cmdf) sc->sc_scheduled |= cmdf; if (!sc->sc_timoneed) { RAY_DPRINTF(("%s: ray_set_pending new timo\n", sc->sc_xname)); - timeout(ray_check_scheduled, sc, RAY_CHECK_SCHED_TIMEOUT); + callout_reset(&sc->sc_check_scheduled_ch, + RAY_CHECK_SCHED_TIMEOUT, ray_check_scheduled, sc); sc->sc_timoneed = 1; } } @@ -2158,7 +2176,7 @@ ray_cmd_cancel(sc, cmdf) /* if nothing else needed cancel the timer */ if (sc->sc_scheduled == 0 && sc->sc_timoneed) { - untimeout(ray_check_scheduled, sc); + callout_stop(&sc->sc_check_scheduled_ch); sc->sc_timoneed = 0; } } @@ -2179,7 +2197,8 @@ ray_cmd_ran(sc, cmdf) sc->sc_running |= cmdf; if ((cmdf & SCP_TIMOCHECK_CMD_MASK) && !sc->sc_timocheck) { - timeout(ray_check_ccs, sc, RAY_CHECK_CCS_TIMEOUT); + callout_reset(&sc->sc_check_ccs_ch, RAY_CHECK_CCS_TIMEOUT, + ray_check_ccs, sc); sc->sc_timocheck = 1; } } @@ -2214,7 +2233,7 @@ ray_cmd_done(sc, cmdf) ray_cmd_schedule(sc, sc->sc_scheduled & SCP_UPD_MASK); } if ((sc->sc_running & SCP_TIMOCHECK_CMD_MASK) == 0 && sc->sc_timocheck){ - untimeout(ray_check_ccs, sc); + callout_stop(&sc->sc_check_ccs_ch); sc->sc_timocheck = 0; } } @@ -2591,7 +2610,8 @@ ray_start_join_net(sc) SRAM_WRITE_FIELD_1(sc, ccs, ray_cmd_net, c_upd_param, 1); } if (ray_issue_cmd(sc, ccs, SCP_UPD_STARTJOIN)) - timeout(ray_start_join_timo, sc, RAY_START_TIMEOUT); + callout_reset(&sc->sc_start_join_timo_ch, RAY_START_TIMEOUT, + ray_start_join_timo, sc); } static void @@ -2623,7 +2643,7 @@ ray_start_join_net_done(sc, cmd, ccs, stat) { struct ray_net_params np; - untimeout(ray_start_join_timo, sc); + callout_stop(&sc->sc_start_join_timo_ch); ray_cmd_done(sc, SCP_UPD_STARTJOIN); if (stat == RAY_CCS_STATUS_FAIL) { @@ -2633,7 +2653,8 @@ ray_start_join_net_done(sc, cmd, ccs, stat) } if (stat == RAY_CCS_STATUS_BUSY || stat == RAY_CCS_STATUS_FREE) { /* handle the timeout condition */ - timeout(ray_start_join_timo, sc, RAY_START_TIMEOUT); + callout_reset(&sc->sc_start_join_timo_ch, RAY_START_TIMEOUT, + ray_start_join_timo, sc); /* be safe -- not a lot occurs with no net though */ if (!RAY_ECF_READY(sc)) diff --git a/sys/dev/pcmcia/if_wi.c b/sys/dev/pcmcia/if_wi.c index eb6cd8d7165..6a448965fd5 100644 --- a/sys/dev/pcmcia/if_wi.c +++ b/sys/dev/pcmcia/if_wi.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_wi.c,v 1.13 2000/03/06 21:02:39 thorpej Exp $ */ +/* $NetBSD: if_wi.c,v 1.14 2000/03/23 07:01:42 thorpej Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -31,7 +31,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_wi.c,v 1.13 2000/03/06 21:02:39 thorpej Exp $ + * $Id: if_wi.c,v 1.14 2000/03/23 07:01:42 thorpej Exp $ */ /* @@ -79,6 +79,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/device.h> #include <sys/socket.h> #include <sys/mbuf.h> @@ -116,7 +117,7 @@ #if !defined(lint) static const char rcsid[] = - "$Id: if_wi.c,v 1.13 2000/03/06 21:02:39 thorpej Exp $"; + "$Id: if_wi.c,v 1.14 2000/03/23 07:01:42 thorpej Exp $"; #endif #ifdef foo @@ -258,6 +259,8 @@ wi_attach(parent, self, aux) sc->wi_btag = sc->sc_pcioh.iot; sc->wi_bhandle = sc->sc_pcioh.ioh; + callout_init(&sc->wi_inquire_ch); + /* Make sure interrupts are disabled. */ CSR_WRITE_2(sc, WI_INT_EN, 0); CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF); @@ -518,7 +521,7 @@ void wi_inquire(xsc) if ((sc->sc_dev.dv_flags & DVF_ACTIVE) == 0) return; - timeout(wi_inquire, sc, hz * 60); + callout_reset(&sc->wi_inquire_ch, hz * 60, wi_inquire, sc); /* Don't do this while we're transmitting */ if (ifp->if_flags & IFF_OACTIVE) @@ -1401,7 +1404,7 @@ wi_init(sc) ifp->if_flags |= IFF_RUNNING; ifp->if_flags &= ~IFF_OACTIVE; - timeout(wi_inquire, sc, hz * 60); + callout_reset(&sc->wi_inquire_ch, hz * 60, wi_inquire, sc); } static void wi_start(ifp) @@ -1537,7 +1540,8 @@ static void wi_stop(sc) CSR_WRITE_2(sc, WI_INT_EN, 0); wi_cmd(sc, WI_CMD_DISABLE|sc->wi_portnum, 0); - untimeout(wi_inquire, sc); + + callout_stop(&sc->wi_inquire_ch); ifp->if_flags &= ~(IFF_OACTIVE | IFF_RUNNING); ifp->if_timer = 0; @@ -1603,7 +1607,7 @@ wi_detach(self, flags) /* Nothing to detach. */ return (0); - untimeout(wi_inquire, sc); + callout_stop(&sc->wi_inquire_ch); if (sc->sc_sdhook != NULL) shutdownhook_disestablish(sc->sc_sdhook); wi_disable(sc); diff --git a/sys/dev/pcmcia/if_wivar.h b/sys/dev/pcmcia/if_wivar.h index e29b54b6e94..23eb4dd2ce3 100644 --- a/sys/dev/pcmcia/if_wivar.h +++ b/sys/dev/pcmcia/if_wivar.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_wivar.h,v 1.7 2000/03/06 10:31:28 enami Exp $ */ +/* $NetBSD: if_wivar.h,v 1.8 2000/03/23 07:01:42 thorpej Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -31,7 +31,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_wivar.h,v 1.7 2000/03/06 10:31:28 enami Exp $ + * $Id: if_wivar.h,v 1.8 2000/03/23 07:01:42 thorpej Exp $ */ @@ -60,6 +60,8 @@ struct wi_softc { bus_space_tag_t wi_btag; bus_space_handle_t wi_bhandle; + struct callout wi_inquire_ch; + void *sc_sdhook; /* saved shutdown hook for card */ void *sc_ih; u_int8_t sc_macaddr[ETHER_ADDR_LEN]; diff --git a/sys/dev/qbus/dz.c b/sys/dev/qbus/dz.c index d9a97ae17f8..924452d5c47 100644 --- a/sys/dev/qbus/dz.c +++ b/sys/dev/qbus/dz.c @@ -1,4 +1,4 @@ -/* $NetBSD: dz.c,v 1.19 2000/01/24 02:40:29 matt Exp $ */ +/* $NetBSD: dz.c,v 1.20 2000/03/23 07:01:42 thorpej Exp $ */ /* * Copyright (c) 1996 Ken C. Wellsch. All rights reserved. * Copyright (c) 1992, 1993 @@ -40,6 +40,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/ioctl.h> #include <sys/tty.h> #include <sys/proc.h> @@ -122,7 +123,8 @@ cdev_decl(dz); * The DZ series doesn't interrupt on carrier transitions, * so we have to use a timer to watch it. */ -int dz_timer = 0; /* true if timer started */ +int dz_timer; /* true if timer started */ +struct callout dzscan_ch; #define DZ_DZ 8 /* Unibus DZ-11 board linecount */ #define DZ_DZV 4 /* Q-bus DZV-11 or DZQ-11 */ @@ -149,7 +151,8 @@ dzattach(sc) if (dz_timer == 0) { dz_timer = 1; - timeout(dzscan, (void *)0, hz); + callout_init(&dzscan_ch); + callout_reset(&dzscan_ch, hz, dzscan, NULL); } printf("\n"); return; @@ -711,6 +714,6 @@ dzscan(arg) sc->sc_rxint = 0; } (void) splx(s); - timeout(dzscan, (void *)0, hz); + callout_reset(&dzscan_ch, hz, dzscan, NULL); return; } diff --git a/sys/dev/rcons/rcons.h b/sys/dev/rcons/rcons.h index cb3d94d8d68..aab6977a025 100644 --- a/sys/dev/rcons/rcons.h +++ b/sys/dev/rcons/rcons.h @@ -1,4 +1,4 @@ -/* $NetBSD: rcons.h,v 1.10 2000/03/20 11:24:46 pk Exp $ */ +/* $NetBSD: rcons.h,v 1.11 2000/03/23 07:01:42 thorpej Exp $ */ /* * Copyright (c) 1992, 1993 @@ -48,6 +48,8 @@ #include "opt_rcons.h" +#include <sys/callout.h> + /* Avoid dragging in dev/wscons/wsdisplayvar.h */ struct wsdisplay_emulops; @@ -63,6 +65,8 @@ struct rconsole { u_int rc_row; /* emulator row */ u_int rc_col; /* emulator column */ + struct callout rc_belltmr_ch; + /* These may be overridden in the kernel config file. */ int rc_deffgcolor; /* default fg color */ int rc_defbgcolor; /* default bg color */ diff --git a/sys/dev/rcons/rcons_kern.c b/sys/dev/rcons/rcons_kern.c index 148f2ed67b1..0d4138df0fb 100644 --- a/sys/dev/rcons/rcons_kern.c +++ b/sys/dev/rcons/rcons_kern.c @@ -1,4 +1,4 @@ -/* $NetBSD: rcons_kern.c,v 1.11 2000/03/20 11:24:46 pk Exp $ */ +/* $NetBSD: rcons_kern.c,v 1.12 2000/03/23 07:01:43 thorpej Exp $ */ /* * Copyright (c) 1991, 1993 @@ -104,7 +104,7 @@ rcons_output(tp) /* Come back if there's more to do */ if (tp->t_outq.c_cc) { tp->t_state |= TS_TIMEOUT; - timeout(ttrstrt, tp, 1); + callout_reset(&tp->t_rstrt_ch, 1, ttrstrt, tp); } if (tp->t_outq.c_cc <= tp->t_lowat) { if (tp->t_state&TS_ASLEEP) { @@ -140,7 +140,8 @@ rcons_bell(rc) splx(s); (*rc->rc_bell)(1); /* XXX Chris doesn't like the following divide */ - timeout(rcons_belltmr, rc, hz/10); + callout_reset(&rc->rc_belltmr_ch, hz / 10, + rcons_belltmr, rc); } } @@ -159,12 +160,14 @@ rcons_belltmr(p) (*rc->rc_bell)(0); if (i != 0) /* XXX Chris doesn't like the following divide */ - timeout(rcons_belltmr, rc, hz/30); + callout_reset(&rc->rc_belltmr_ch, hz / 30, + rcons_belltmr, rc); } else { rc->rc_ringing = 1; splx(s); (*rc->rc_bell)(1); - timeout(rcons_belltmr, rc, hz/10); + callout_reset(&rc->rc_belltmr_ch, hz / 10, + rcons_belltmr, rc); } } @@ -174,7 +177,9 @@ rcons_init(rc, clear) int clear; { mydevicep = rc; - + + callout_init(&rc->rc_belltmr_ch); + /* Initialize operations set, clear screen and turn cursor on */ rcons_init_ops(rc); if (clear) { diff --git a/sys/dev/rnd.c b/sys/dev/rnd.c index fdbe1605185..f46208f7ff5 100644 --- a/sys/dev/rnd.c +++ b/sys/dev/rnd.c @@ -1,4 +1,4 @@ -/* $NetBSD: rnd.c,v 1.16 1999/06/12 10:58:47 pk Exp $ */ +/* $NetBSD: rnd.c,v 1.17 2000/03/23 07:01:26 thorpej Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -47,6 +47,7 @@ #include <sys/kernel.h> #include <sys/conf.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/rnd.h> #include <sys/vnode.h> #include <sys/pool.h> @@ -136,6 +137,8 @@ static rndsource_t rnd_source_no_collect = { NULL }; +struct callout rnd_callout = CALLOUT_INITIALIZER; + void rndattach __P((int)); int rndopen __P((dev_t, int, int, struct proc *)); int rndclose __P((dev_t, int, int, struct proc *)); @@ -861,7 +864,7 @@ rnd_add_uint32(rs, val) if (rnd_timeout_pending == 0) { rnd_timeout_pending = 1; - timeout(rnd_timeout, NULL, 1); + callout_reset(&rnd_callout, 1, rnd_timeout, NULL); } splx(s); diff --git a/sys/dev/sbus/be.c b/sys/dev/sbus/be.c index d3b540c56b3..bdd1d806c88 100644 --- a/sys/dev/sbus/be.c +++ b/sys/dev/sbus/be.c @@ -1,4 +1,4 @@ -/* $NetBSD: be.c,v 1.16 2000/02/14 17:06:45 pk Exp $ */ +/* $NetBSD: be.c,v 1.17 2000/03/23 07:01:43 thorpej Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -73,6 +73,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/kernel.h> #include <sys/errno.h> #include <sys/ioctl.h> @@ -133,6 +134,8 @@ struct be_softc { #define sc_media sc_mii.mii_media/* shorthand */ int sc_phys[2]; /* MII instance -> phy */ + struct callout sc_tick_ch; + /* * Some `mii_softc' items we need to emulate MII operation * for our internal transceiver. @@ -342,6 +345,8 @@ beattach(parent, self, aux) ifmedia_init(&mii->mii_media, 0, be_ifmedia_upd, be_ifmedia_sts); + callout_init(&sc->sc_tick_ch); + /* * Initialize transceiver and determine which PHY connection to use. */ @@ -654,7 +659,7 @@ bestop(sc) bus_space_tag_t t = sc->sc_bustag; bus_space_handle_t br = sc->sc_br; - untimeout(be_tick, sc); + callout_stop(&sc->sc_tick_ch); /* Down the MII. */ mii_down(&sc->sc_mii); @@ -1145,7 +1150,7 @@ beinit(sc) ifp->if_flags &= ~IFF_OACTIVE; be_ifmedia_upd(ifp); - timeout(be_tick, sc, hz); + callout_reset(&sc->sc_tick_ch, hz, be_tick, sc); splx(s); } @@ -1432,7 +1437,7 @@ be_tick(arg) (void)be_intphy_service(sc, &sc->sc_mii, MII_TICK); splx(s); - timeout(be_tick, sc, hz); + callout_reset(&sc->sc_tick_ch, hz, be_tick, sc); } void diff --git a/sys/dev/sbus/magma.c b/sys/dev/sbus/magma.c index 21075e888fd..8404efeab46 100644 --- a/sys/dev/sbus/magma.c +++ b/sys/dev/sbus/magma.c @@ -1,4 +1,4 @@ -/* $NetBSD: magma.c,v 1.5 1999/11/21 15:01:51 pk Exp $ */ +/* $NetBSD: magma.c,v 1.6 2000/03/23 07:01:43 thorpej Exp $ */ /* * magma.c * @@ -1430,6 +1430,9 @@ mbpp_attach(parent, dev, args) for( port = 0 ; port < sc->ms_board->mb_npar ; port++ ) { mp = &ms->ms_port[port]; + callout_init(&mp->mp_timeout_ch); + callout_init(&mp->mp_start_ch); + if( sc->ms_ncd1190 ) mp->mp_cd1190 = &sc->ms_cd1190[port]; else @@ -1627,7 +1630,8 @@ mbpp_rw(dev, uio) */ if( mp->mp_timeout > 0 ) { SET(mp->mp_flags, MBPPF_TIMEOUT); - timeout(mbpp_timeout, mp, mp->mp_timeout); + callout_reset(&mp->mp_timeout_ch, mp->mp_timeout, + mbpp_timeout, mp); } len = cnt = 0; @@ -1673,7 +1677,8 @@ again: /* goto bad */ if( mp->mp_delay > 0 ) { s = splsoftclock(); SET(mp->mp_flags, MBPPF_DELAY); - timeout(mbpp_start, mp, mp->mp_delay); + callout_reset(&mp->mp_start_ch, mp->mp_delay, + mbpp_start, mp); error = tsleep(mp, PCATCH | PZERO, "mbppdelay", 0); splx(s); if( error ) break; @@ -1695,11 +1700,11 @@ again: /* goto bad */ */ s = splsoftclock(); if( ISSET(mp->mp_flags, MBPPF_TIMEOUT) ) { - untimeout(mbpp_timeout, mp); + callout_stop(&mp->mp_timeout_ch); CLR(mp->mp_flags, MBPPF_TIMEOUT); } if( ISSET(mp->mp_flags, MBPPF_DELAY) ) { - untimeout(mbpp_start, mp); + callout_stop(&mp->mp_start_ch); CLR(mp->mp_flags, MBPPF_DELAY); } splx(s); diff --git a/sys/dev/sbus/magmareg.h b/sys/dev/sbus/magmareg.h index b40e940debf..3203ab98820 100644 --- a/sys/dev/sbus/magmareg.h +++ b/sys/dev/sbus/magmareg.h @@ -1,4 +1,4 @@ -/* $NetBSD: magmareg.h,v 1.2 1998/06/07 21:14:17 pk Exp $ */ +/* $NetBSD: magmareg.h,v 1.3 2000/03/23 07:01:43 thorpej Exp $ */ /* magmareg.h * * Copyright (c) 1998 Iain Hibbert @@ -165,6 +165,9 @@ struct mbpp_port { struct cd1400 *mp_cd1400; /* for LC2+1Sp card */ struct cd1190 *mp_cd1190; /* all the others */ + struct callout mp_timeout_ch; + struct callout mp_start_ch; + int mp_flags; struct mbpp_param mp_param; diff --git a/sys/dev/scsipi/atapi_wdc.c b/sys/dev/scsipi/atapi_wdc.c index ba957364ce2..fc8ece8a27c 100644 --- a/sys/dev/scsipi/atapi_wdc.c +++ b/sys/dev/scsipi/atapi_wdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: atapi_wdc.c,v 1.31 2000/03/20 22:57:00 enami Exp $ */ +/* $NetBSD: atapi_wdc.c,v 1.32 2000/03/23 07:01:43 thorpej Exp $ */ /* * Copyright (c) 1998 Manuel Bouyer. @@ -150,7 +150,7 @@ wdc_atapi_kill_xfer(chp, xfer) { struct scsipi_xfer *sc_xfer = xfer->cmd; - untimeout(wdctimeout, chp); + callout_stop(&chp->ch_callout); /* remove this command from xfer queue */ wdc_free_xfer(chp, xfer); sc_xfer->xs_status |= XS_STS_DONE; @@ -289,7 +289,8 @@ wdc_atapi_start(chp, xfer) } /* start timeout machinery */ if ((sc_xfer->xs_control & XS_CTL_POLL) == 0) - timeout(wdctimeout, chp, sc_xfer->timeout * hz / 1000); + callout_reset(&chp->ch_callout, sc_xfer->timeout * hz / 1000, + wdctimeout, chp); /* Do control operations specially. */ if (drvp->state < READY) { if (drvp->state != PIOMODE) { @@ -695,7 +696,7 @@ again: sizeof(sc_xfer->sense.scsi_sense); xfer->c_skip = 0; xfer->c_flags |= C_SENSE; - untimeout(wdctimeout, chp); + callout_stop(&chp->ch_callout); wdc_atapi_start(chp, xfer); return 1; } @@ -815,7 +816,7 @@ piomode: ready: drvp->state = READY; xfer->c_intr = wdc_atapi_intr; - untimeout(wdctimeout, chp); + callout_stop(&chp->ch_callout); wdc_atapi_start(chp, xfer); return 1; } @@ -857,7 +858,7 @@ wdc_atapi_done(chp, xfer) WDCDEBUG_PRINT(("wdc_atapi_done %s:%d:%d: flags 0x%x\n", chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive, (u_int)xfer->c_flags), DEBUG_XFERS); - untimeout(wdctimeout, chp); + callout_stop(&chp->ch_callout); /* remove this command from xfer queue */ wdc_free_xfer(chp, xfer); sc_xfer->xs_status |= XS_STS_DONE; diff --git a/sys/dev/scsipi/if_se.c b/sys/dev/scsipi/if_se.c index 91a8269d5f8..d6ec3be3d8c 100644 --- a/sys/dev/scsipi/if_se.c +++ b/sys/dev/scsipi/if_se.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_se.c,v 1.27 2000/03/13 23:52:37 soren Exp $ */ +/* $NetBSD: if_se.c,v 1.28 2000/03/23 07:01:43 thorpej Exp $ */ /* * Copyright (c) 1997 Ian W. Dall <ian.dall@dsto.defence.gov.au> @@ -68,6 +68,7 @@ #include <sys/types.h> #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/syslog.h> #include <sys/kernel.h> #include <sys/file.h> @@ -184,6 +185,10 @@ struct se_softc { struct device sc_dev; struct ethercom sc_ethercom; /* Ethernet common part */ struct scsipi_link *sc_link; /* contains our targ, lun, etc. */ + + struct callout sc_ifstart_ch; + struct callout sc_recv_ch; + char *sc_tbuf; char *sc_rbuf; int protos; @@ -310,6 +315,9 @@ seattach(parent, self, aux) printf("\n"); SC_DEBUG(sc_link, SDEV_DB2, ("seattach: ")); + callout_init(&sc->sc_ifstart_ch); + callout_init(&sc->sc_recv_ch); + /* * Store information needed to contact our base driver */ @@ -505,7 +513,8 @@ sedone(xs) if(IS_SEND(cmd)) { if (xs->error == XS_BUSY) { printf("se: busy, retry txmit\n"); - timeout(se_delayed_ifstart, ifp, hz); + callout_reset(&sc->sc_ifstart_ch, hz, + se_delayed_ifstart, ifp); } else { ifp->if_flags &= ~IFF_OACTIVE; /* the generic scsipi_done will call @@ -518,7 +527,8 @@ sedone(xs) /* scsipi_free_xs will call start. Harmless. */ if (error) { /* Reschedule after a delay */ - timeout(se_recv, (void *)sc, se_poll); + callout_reset(&sc->sc_recv_ch, se_poll, + se_recv, (void *)sc); } else { int n, ntimeo; n = se_read(sc, xs->data, xs->datalen - xs->resid); @@ -543,7 +553,8 @@ sedone(xs) * after the next send. */ sc->sc_flags |= SE_NEED_RECV; else { - timeout(se_recv, (void *)sc, ntimeo); + callout_reset(&sc->sc_recv_ch, ntimeo, + se_recv, (void *)sc); } } } @@ -569,7 +580,7 @@ se_recv(v) sc->sc_rbuf, RBUF_LEN, SERETRIES, SETIMEOUT, NULL, XS_CTL_NOSLEEP|XS_CTL_ASYNC|XS_CTL_DATA_IN); if (error) - timeout(se_recv, (void *)sc, se_poll); + callout_reset(&sc->sc_recv_ch, se_poll, se_recv, (void *)sc); } /* @@ -974,7 +985,7 @@ se_stop(sc) { /* Don't schedule any reads */ - untimeout(se_recv, sc); + callout_stop(&sc->sc_recv_ch); /* How can we abort any scsi cmds in progress? */ } diff --git a/sys/dev/scsipi/scsipi_base.c b/sys/dev/scsipi/scsipi_base.c index a1ebaa29cdc..ffda1b42244 100644 --- a/sys/dev/scsipi/scsipi_base.c +++ b/sys/dev/scsipi/scsipi_base.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsipi_base.c,v 1.29 2000/01/17 17:59:48 bouyer Exp $ */ +/* $NetBSD: scsipi_base.c,v 1.30 2000/03/23 07:01:44 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -131,6 +131,7 @@ scsipi_get_xs(sc_link, flags) * than SCSI */ if (xs != NULL) { + callout_init(&xs->xs_callout); xs->xs_control = flags; TAILQ_INSERT_TAIL(&sc_link->pending_xfers, xs, device_q); bzero(&xs->cmdstore, sizeof(xs->cmdstore)); diff --git a/sys/dev/scsipi/scsipiconf.h b/sys/dev/scsipi/scsipiconf.h index 8712ec6a420..287bf8924c3 100644 --- a/sys/dev/scsipi/scsipiconf.h +++ b/sys/dev/scsipi/scsipiconf.h @@ -1,4 +1,4 @@ -/* $NetBSD: scsipiconf.h,v 1.37 2000/01/20 17:10:18 mjacob Exp $ */ +/* $NetBSD: scsipiconf.h,v 1.38 2000/03/23 07:01:44 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -59,6 +59,7 @@ typedef int boolean; +#include <sys/callout.h> #include <sys/queue.h> #include <dev/scsipi/scsipi_debug.h> @@ -258,6 +259,7 @@ struct scsipi_link { struct scsipi_xfer { TAILQ_ENTRY(scsipi_xfer) adapter_q; /* queue entry for use by adapter */ TAILQ_ENTRY(scsipi_xfer) device_q; /* device's pending xfers */ + struct callout xs_callout; /* callout for adapter use */ int xs_control; /* control flags */ __volatile int xs_status; /* status flags */ struct scsipi_link *sc_link; /* all about our device and adapter */ diff --git a/sys/dev/sequencer.c b/sys/dev/sequencer.c index d0a9a6902c8..0ad2ef6a525 100644 --- a/sys/dev/sequencer.c +++ b/sys/dev/sequencer.c @@ -1,4 +1,4 @@ -/* $NetBSD: sequencer.c,v 1.14 1999/10/11 12:53:14 augustss Exp $ */ +/* $NetBSD: sequencer.c,v 1.15 2000/03/23 07:01:27 thorpej Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -151,6 +151,9 @@ void sequencerattach(n) int n; { + + for (n = 0; n < NSEQUENCER; n++) + callout_init(&seqdevs[n].sc_callout); } int @@ -315,7 +318,7 @@ sequencerclose(dev, flags, ifmt, p) seq_drain(sc); s = splaudio(); if (sc->timeout) { - untimeout(seq_timeout, sc); + callout_stop(&sc->sc_callout); sc->timeout = 0; } splx(s); @@ -891,7 +894,8 @@ seq_timer(sc, cmd, parm, b) } #endif sc->timeout = 1; - timeout(seq_timeout, sc, ticks); + callout_reset(&sc->sc_callout, ticks, + seq_timeout, sc); } #ifdef SEQUENCER_DEBUG else if (tick < 0) diff --git a/sys/dev/sequencervar.h b/sys/dev/sequencervar.h index 3a62b2d3a46..4d320cf9b69 100644 --- a/sys/dev/sequencervar.h +++ b/sys/dev/sequencervar.h @@ -1,4 +1,4 @@ -/* $NetBSD: sequencervar.h,v 1.5 1998/11/25 22:17:07 augustss Exp $ */ +/* $NetBSD: sequencervar.h,v 1.6 2000/03/23 07:01:27 thorpej Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -36,6 +36,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include <sys/callout.h> + struct midi_softc; struct syn_timer { @@ -78,6 +80,7 @@ struct midi_dev { struct sequencer_softc { struct device dev; struct device *sc_dev; /* Hardware device struct */ + struct callout sc_callout; int isopen; /* Open indicator */ int flags; /* Open flags */ int mode; diff --git a/sys/dev/sun/kbd.c b/sys/dev/sun/kbd.c index b636144f27d..02da9af1277 100644 --- a/sys/dev/sun/kbd.c +++ b/sys/dev/sun/kbd.c @@ -1,4 +1,4 @@ -/* $NetBSD: kbd.c,v 1.24 2000/03/22 16:08:51 pk Exp $ */ +/* $NetBSD: kbd.c,v 1.25 2000/03/23 07:01:44 thorpej Exp $ */ /* * Copyright (c) 1992, 1993 @@ -139,7 +139,7 @@ kbdopen(dev, flags, mode, p) if (k->k_repeating) { k->k_repeating = 0; - untimeout(kbd_repeat, k); + callout_stop(&k->k_repeat_ch); } return (0); @@ -658,7 +658,8 @@ kbd_repeat(arg) if (k->k_repeating && k->k_repeatsym >= 0) { (void)kbd_input_keysym(k, k->k_repeatsym); - timeout(kbd_repeat, k, k->k_repeat_step); + callout_reset(&k->k_repeat_ch, k->k_repeat_step, + kbd_repeat, k); } splx(s); } @@ -728,7 +729,7 @@ kbd_input_raw(k, c) /* Any input stops auto-repeat (i.e. key release). */ if (k->k_repeating) { k->k_repeating = 0; - untimeout(kbd_repeat, k); + callout_stop(&k->k_repeat_ch); } /* Translate this code to a keysym */ @@ -751,7 +752,8 @@ kbd_input_raw(k, c) /* Setup for auto-repeat after initial delay. */ k->k_repeating = 1; k->k_repeatsym = keysym; - timeout(kbd_repeat, k, k->k_repeat_start); + callout_reset(&k->k_reset_ch, k->k_repeat_start, + kbd_repeat, k); return; } diff --git a/sys/dev/sun/kbd_zs.c b/sys/dev/sun/kbd_zs.c index 0ff2ac919c0..adb489a6969 100644 --- a/sys/dev/sun/kbd_zs.c +++ b/sys/dev/sun/kbd_zs.c @@ -1,4 +1,4 @@ -/* $NetBSD: kbd_zs.c,v 1.3 2000/03/22 16:08:51 pk Exp $ */ +/* $NetBSD: kbd_zs.c,v 1.4 2000/03/23 07:01:44 thorpej Exp $ */ /* * Copyright (c) 1992, 1993 @@ -163,6 +163,8 @@ kbd_zs_attach(parent, self, aux) } printf("\n"); + callout_init(&k->k_repeat_ch); + /* Initialize the speed, etc. */ s = splzs(); if (k->k_isconsole == 0) { diff --git a/sys/dev/sun/kbdvar.h b/sys/dev/sun/kbdvar.h index ad38ed9acae..89469300d2d 100644 --- a/sys/dev/sun/kbdvar.h +++ b/sys/dev/sun/kbdvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: kbdvar.h,v 1.3 2000/03/22 16:08:51 pk Exp $ */ +/* $NetBSD: kbdvar.h,v 1.4 2000/03/23 07:01:44 thorpej Exp $ */ /* * Copyright (c) 1992, 1993 @@ -44,6 +44,8 @@ * @(#)kbd.c 8.2 (Berkeley) 10/30/93 */ +#include <sys/callout.h> + /* * How many input characters we can buffer. * The port-specific var.h may override this. @@ -115,6 +117,8 @@ struct kbd_softc { int k_repeating; /* we've called timeout() */ struct kbd_state k_state; /* ASCII translation state */ + struct callout k_repeat_ch; + /* Console hooks */ char k_isconsole; struct cons_channel *k_cc; @@ -126,7 +130,6 @@ struct kbd_softc { u_char k_magic1; /* L1 */ u_char k_magic2; /* A */ - /* * The transmit ring buffer. */ diff --git a/sys/dev/tc/asc.c b/sys/dev/tc/asc.c index ccc055e78e2..8f6967bc8d4 100644 --- a/sys/dev/tc/asc.c +++ b/sys/dev/tc/asc.c @@ -1,4 +1,4 @@ -/* $NetBSD: asc.c,v 1.58 2000/03/14 08:23:29 nisimura Exp $ */ +/* $NetBSD: asc.c,v 1.59 2000/03/23 07:01:45 thorpej Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -581,8 +581,9 @@ asc_start(scsicmd) * Kludge: use a 60 second timeout if data is being transfered, * otherwise use a 30 minute timeout. */ - timeout(asc_timeout, scsicmd, hz * (scsicmd->buflen == 0 ? - 1800 : 60)); + callout_reset(&scsicmd->timo_ch, + hz * (scsicmd->buflen == 0 ? 1800 : 60), + asc_timeout, scsicmd); asc_startcmd(asc, sdp->sd_drive); splx(s); } @@ -1371,7 +1372,7 @@ asc_end(asc, status, ss, ir) scsicmd = asc->cmd[target]; asc->cmd[target] = (ScsiCmd *)0; state = &asc->st[target]; - untimeout(asc_timeout, scsicmd); + callout_stop(&scsicmd->timo_ch); #ifdef DEBUG if (asc_debug > 1) { diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c index d2644d22676..e4eb00e5b61 100644 --- a/sys/dev/usb/if_aue.c +++ b/sys/dev/usb/if_aue.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_aue.c,v 1.31 2000/03/16 18:27:21 uch Exp $ */ +/* $NetBSD: if_aue.c,v 1.32 2000/03/23 07:01:45 thorpej Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. @@ -861,6 +861,8 @@ USB_ATTACH(aue) #elif defined(__NetBSD__) || defined(__OpenBSD__) + callout_init(&sc->aue_stat_ch); + printf("%s: Ethernet address %s\n", USBDEVNAME(sc->aue_dev), ether_sprintf(eaddr)); diff --git a/sys/dev/usb/if_auereg.h b/sys/dev/usb/if_auereg.h index 546e2383903..9fb85ae33ce 100644 --- a/sys/dev/usb/if_auereg.h +++ b/sys/dev/usb/if_auereg.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_auereg.h,v 1.6 2000/03/01 19:00:51 augustss Exp $ */ +/* $NetBSD: if_auereg.h,v 1.7 2000/03/23 07:01:45 thorpej Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. @@ -239,6 +239,7 @@ struct aue_softc { #elif defined(__NetBSD__) struct ethercom aue_ec; struct mii_data aue_mii; + struct callout aue_stat_ch; #if NRND > 0 rndsource_element_t rnd_source; #endif diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c index 5d0d439e489..1da5d27840f 100644 --- a/sys/dev/usb/if_cue.c +++ b/sys/dev/usb/if_cue.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_cue.c,v 1.13 2000/03/15 22:40:30 augustss Exp $ */ +/* $NetBSD: if_cue.c,v 1.14 2000/03/23 07:01:45 thorpej Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. @@ -68,6 +68,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/sockio.h> #include <sys/mbuf.h> #include <sys/malloc.h> @@ -621,6 +622,8 @@ USB_ATTACH(cue) #elif defined(__NetBSD__) || defined(__OpenBSD__) + callout_init(&sc->cue_stat_ch); + printf("%s: Ethernet address %s\n", USBDEVNAME(sc->cue_dev), ether_sprintf(eaddr)); diff --git a/sys/dev/usb/if_cuereg.h b/sys/dev/usb/if_cuereg.h index 7fc5d439e4e..04842078005 100644 --- a/sys/dev/usb/if_cuereg.h +++ b/sys/dev/usb/if_cuereg.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_cuereg.h,v 1.5 2000/03/02 12:37:50 augustss Exp $ */ +/* $NetBSD: if_cuereg.h,v 1.6 2000/03/23 07:01:45 thorpej Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. @@ -176,6 +176,7 @@ struct cue_softc { #define GET_IFP(sc) (&(sc)->arpcom.ac_if) #elif defined(__NetBSD__) struct ethercom cue_ec; + struct callout cue_stat_ch; #if NRND > 0 rndsource_element_t rnd_source; #endif diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c index c66f3ff8e90..0731ac72c1f 100644 --- a/sys/dev/usb/if_kue.c +++ b/sys/dev/usb/if_kue.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_kue.c,v 1.19 2000/03/20 01:31:10 augustss Exp $ */ +/* $NetBSD: if_kue.c,v 1.20 2000/03/23 07:01:45 thorpej Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. @@ -84,6 +84,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/sockio.h> #include <sys/mbuf.h> #include <sys/malloc.h> diff --git a/sys/dev/usb/if_kuereg.h b/sys/dev/usb/if_kuereg.h index 92a09321851..27605dd4eda 100644 --- a/sys/dev/usb/if_kuereg.h +++ b/sys/dev/usb/if_kuereg.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_kuereg.h,v 1.6 2000/03/20 00:41:55 augustss Exp $ */ +/* $NetBSD: if_kuereg.h,v 1.7 2000/03/23 07:01:45 thorpej Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. @@ -168,6 +168,7 @@ struct kue_softc { #define GET_IFP(sc) (&(sc)->arpcom.ac_if) #elif defined(__NetBSD__) struct ethercom kue_ec; + struct callout kue_stat_ch; #if NRND > 0 rndsource_element_t rnd_source; #endif diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c index 45dde0b428c..d4e27196f66 100644 --- a/sys/dev/usb/ohci.c +++ b/sys/dev/usb/ohci.c @@ -1,4 +1,4 @@ -/* $NetBSD: ohci.c,v 1.78 2000/03/20 00:37:00 augustss Exp $ */ +/* $NetBSD: ohci.c,v 1.79 2000/03/23 07:01:46 thorpej Exp $ */ /* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */ /* @@ -1849,7 +1849,8 @@ ohci_abort_xfer(xfer, status) #if 1 if (xfer->device->bus->intr_context) { /* We have no process context, so we can't use tsleep(). */ - timeout(ohci_abort_xfer_end, xfer, hz / USB_FRAMES_PER_SECOND); + callout_reset(&xfer->abort_handle, hz / USB_FRAMES_PER_SECOND, + ohci_abort_xfer_end, xfer); } else { #if defined(DIAGNOSTIC) && defined(__i386__) && defined(__FreeBSD__) KASSERT(intr_nesting_level == 0, diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c index 3775ae21e79..43ec6a33f97 100644 --- a/sys/dev/usb/uhci.c +++ b/sys/dev/usb/uhci.c @@ -1,4 +1,4 @@ -/* $NetBSD: uhci.c,v 1.88 2000/03/16 12:40:51 tsutsui Exp $ */ +/* $NetBSD: uhci.c,v 1.89 2000/03/23 07:01:46 thorpej Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */ /* @@ -1692,7 +1692,8 @@ uhci_abort_xfer(xfer, status) /* Make sure hardware has completed. */ if (xfer->device->bus->intr_context) { /* We have no process context, so we can't use tsleep(). */ - timeout(uhci_abort_xfer_end, xfer, hz / USB_FRAMES_PER_SECOND); + callout_reset(&xfer->abort_handle, hz / USB_FRAMES_PER_SECOND, + uhci_abort_xfer_end, xfer); } else { #if defined(DIAGNOSTIC) && defined(__i386__) && defined(__FreeBSD__) KASSERT(intr_nesting_level == 0, @@ -2236,7 +2237,8 @@ uhci_device_isoc_abort(xfer) /* make sure hardware has completed, */ if (xfer->device->bus->intr_context) { /* We have no process context, so we can't use tsleep(). */ - timeout(uhci_abort_xfer_end, xfer, hz / USB_FRAMES_PER_SECOND); + callout_reset(&xfer->abort_handle, hz / USB_FRAMES_PER_SECOND, + uhci_abort_xfer_end, xfer); } else { usb_delay_ms(xfer->pipe->device->bus, 1); /* and call final part of interrupt handler. */ diff --git a/sys/dev/usb/uhcivar.h b/sys/dev/usb/uhcivar.h index 15374919d26..9b0f16f9ab7 100644 --- a/sys/dev/usb/uhcivar.h +++ b/sys/dev/usb/uhcivar.h @@ -1,4 +1,4 @@ -/* $NetBSD: uhcivar.h,v 1.23 2000/02/22 16:03:44 augustss Exp $ */ +/* $NetBSD: uhcivar.h,v 1.24 2000/03/23 07:01:46 thorpej Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhcivar.h,v 1.14 1999/11/17 22:33:42 n_hibma Exp $ */ /* @@ -74,6 +74,9 @@ typedef struct uhci_intr_info { uhci_soft_td_t *stdstart; uhci_soft_td_t *stdend; LIST_ENTRY(uhci_intr_info) list; +#if defined(__NetBSD__) + struct callout timeout_handle; +#endif #if defined(__FreeBSD__) struct callout_handle timeout_handle; #endif /* defined(__FreeBSD__) */ diff --git a/sys/dev/usb/ukbd.c b/sys/dev/usb/ukbd.c index 791e8044002..e9852126bf0 100644 --- a/sys/dev/usb/ukbd.c +++ b/sys/dev/usb/ukbd.c @@ -1,4 +1,4 @@ -/* $NetBSD: ukbd.c,v 1.56 2000/02/29 21:37:01 augustss Exp $ */ +/* $NetBSD: ukbd.c,v 1.57 2000/03/23 07:01:46 thorpej Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -43,6 +43,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/kernel.h> #include <sys/device.h> #include <sys/ioctl.h> @@ -180,6 +181,8 @@ struct ukbd_softc { int sc_leds; #if defined(__NetBSD__) + struct callout sc_rawrepeat_ch; + struct device *sc_wskbddev; #if defined(WSDISPLAY_COMPAT_RAWKBD) #define REP_DELAY1 400 @@ -342,6 +345,8 @@ USB_ATTACH(ukbd) a.accessops = &ukbd_accessops; a.accesscookie = sc; + callout_init(&sc->sc_rawrepeat_ch); + /* Flash the leds; no real purpose, just shows we're alive. */ ukbd_set_leds(sc, WSKBD_LED_SCROLL | WSKBD_LED_NUM | WSKBD_LED_CAPS); usbd_delay_ms(uaa->device, 400); @@ -568,10 +573,11 @@ ukbd_intr(xfer, addr, status) s = spltty(); wskbd_rawinput(sc->sc_wskbddev, cbuf, j); splx(s); - untimeout(ukbd_rawrepeat, sc); + callout_stop(&sc->sc_rawrepeat_ch); if (npress != 0) { sc->sc_nrep = npress; - timeout(ukbd_rawrepeat, sc, hz * REP_DELAY1 / 1000); + callout_reset(&sc->sc_rawrepeat_ch, + hz * REP_DELAY1 / 1000, ukbd_rawrepeat, sc); } return; } @@ -623,7 +629,8 @@ ukbd_rawrepeat(v) s = spltty(); wskbd_rawinput(sc->sc_wskbddev, sc->sc_rep, sc->sc_nrep); splx(s); - timeout(ukbd_rawrepeat, sc, hz * REP_DELAYN / 1000); + callout_reset(&sc->sc_rawrepeat_ch, hz * REP_DELAYN / 1000, + ukbd_rawrepeat, sc); } #endif @@ -651,7 +658,7 @@ ukbd_ioctl(v, cmd, data, flag, p) case WSKBDIO_SETMODE: DPRINTF(("ukbd_ioctl: set raw = %d\n", *(int *)data)); sc->sc_rawkbd = *(int *)data == WSKBD_RAW; - untimeout(ukbd_rawrepeat, sc); + callout_stop(&sc->sc_rawrepeat_ch); return (0); #endif } diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h index 2f622b3fafd..b67af3dcb5e 100644 --- a/sys/dev/usb/usb_port.h +++ b/sys/dev/usb/usb_port.h @@ -1,4 +1,4 @@ -/* $NetBSD: usb_port.h,v 1.21 2000/02/02 07:34:00 augustss Exp $ */ +/* $NetBSD: usb_port.h,v 1.22 2000/03/23 07:01:46 thorpej Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_port.h,v 1.21 1999/11/17 22:33:47 n_hibma Exp $ */ /* @@ -80,8 +80,8 @@ typedef struct device *device_ptr_t; u_int offs; \ } usb_dma_t -#define usb_timeout(f, d, t, h) timeout((f), (d), (t)) -#define usb_untimeout(f, d, h) untimeout((f), (d)) +#define usb_timeout(f, d, t, h) callout_reset(&(h), (t), (f), (d)) +#define usb_untimeout(f, d, h) callout_stop(&(h)) #define logprintf printf diff --git a/sys/dev/usb/usbdivar.h b/sys/dev/usb/usbdivar.h index 16d2a6170e7..777787e886c 100644 --- a/sys/dev/usb/usbdivar.h +++ b/sys/dev/usb/usbdivar.h @@ -1,4 +1,4 @@ -/* $NetBSD: usbdivar.h,v 1.47 2000/02/22 11:30:56 augustss Exp $ */ +/* $NetBSD: usbdivar.h,v 1.48 2000/03/23 07:01:46 thorpej Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $ */ /* @@ -38,6 +38,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include <sys/callout.h> + /* From usb_mem.h */ DECLARE_USB_DMA_T; @@ -200,8 +202,12 @@ struct usbd_xfer { void *hcpriv; /* private use by the HC driver */ int hcprivint; +#if defined(__NetBSD__) + struct callout timo_handle; + struct callout abort_handle; +#endif #if defined(__FreeBSD__) - struct callout_handle timo_handle; + struct callout_handle timo_handle; #endif }; diff --git a/sys/dev/vme/xd.c b/sys/dev/vme/xd.c index d9d192ebb33..717174baa39 100644 --- a/sys/dev/vme/xd.c +++ b/sys/dev/vme/xd.c @@ -1,4 +1,4 @@ -/* $NetBSD: xd.c,v 1.18 2000/01/21 23:41:45 thorpej Exp $ */ +/* $NetBSD: xd.c,v 1.19 2000/03/23 07:01:46 thorpej Exp $ */ /* * @@ -526,6 +526,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: @@ -576,7 +577,7 @@ xdcattach(parent, self, aux) (void) config_found(self, (void *) &xa, NULL); /* start the watchdog clock */ - timeout(xdc_tick, xdc, XDC_TICKCNT); + callout_reset(&xdc->sc_tick_ch, XDC_TICKCNT, xdc_tick, xdc); } @@ -2239,7 +2240,7 @@ xdc_tick(arg) /* until next time */ - timeout(xdc_tick, xdcsc, XDC_TICKCNT); + callout_reset(&xdcsc->sc_tick_ch, XDC_TICKCNT, xdc_tick, xdcsc); } /* diff --git a/sys/dev/vme/xdvar.h b/sys/dev/vme/xdvar.h index f528685842f..1606df48055 100644 --- a/sys/dev/vme/xdvar.h +++ b/sys/dev/vme/xdvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: xdvar.h,v 1.4 2000/01/21 23:41:45 thorpej Exp $ */ +/* $NetBSD: xdvar.h,v 1.5 2000/03/23 07:01:47 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 */ struct xd_softc *sc_drives[XDC_MAXDEV]; /* drives on this controller */ diff --git a/sys/dev/vme/xy.c b/sys/dev/vme/xy.c index 3eb349d06d5..838611681f9 100644 --- a/sys/dev/vme/xy.c +++ b/sys/dev/vme/xy.c @@ -1,4 +1,4 @@ -/* $NetBSD: xy.c,v 1.16 2000/02/07 20:16:58 thorpej Exp $ */ +/* $NetBSD: xy.c,v 1.17 2000/03/23 07:01:47 thorpej Exp $ */ /* * @@ -478,6 +478,7 @@ xycattach(parent, self, aux) vme_intr_establish(ct, ih, IPL_BIO, xycintr, xyc); evcnt_attach(&xyc->sc_dev, "intr", &xyc->sc_intrcnt); + callout_init(&xyc->sc_tick_ch); /* now we must look for disks using autoconfig */ xa.fullmode = XY_SUB_POLL; @@ -487,7 +488,7 @@ xycattach(parent, self, aux) (void) config_found(self, (void *) &xa, NULL); /* start the watchdog clock */ - timeout(xyc_tick, xyc, XYC_TICKCNT); + callout_reset(&xyc->sc_tick_ch, XYC_TICKCNT, xyc_tick, xyc); } @@ -2069,7 +2070,7 @@ xyc_tick(arg) /* until next time */ - timeout(xyc_tick, xycsc, XYC_TICKCNT); + callout_reset(&xycsc->sc_tick_ch, XYC_TICKCNT, xyc_tick, xycsc); } /* diff --git a/sys/dev/vme/xyvar.h b/sys/dev/vme/xyvar.h index 444d077c281..9f49bea5a88 100644 --- a/sys/dev/vme/xyvar.h +++ b/sys/dev/vme/xyvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: xyvar.h,v 1.5 2000/01/21 23:43:10 thorpej Exp $ */ +/* $NetBSD: xyvar.h,v 1.6 2000/03/23 07:01:47 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 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 */ struct xy_softc *sc_drives[XYC_MAXDEV]; /* drives on this controller */ diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c index 1bdfe63e66d..c3b2f081cba 100644 --- a/sys/dev/wscons/wsdisplay.c +++ b/sys/dev/wscons/wsdisplay.c @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay.c,v 1.35 2000/03/06 21:37:16 thorpej Exp $ */ +/* $NetBSD: wsdisplay.c,v 1.36 2000/03/23 07:01:47 thorpej Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.35 2000/03/06 21:37:16 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.36 2000/03/23 07:01:47 thorpej Exp $"); #include <sys/param.h> #include <sys/conf.h> @@ -1220,7 +1220,8 @@ wsdisplaystart(tp) /* Come back if there's more to do */ if (tp->t_outq.c_cc) { tp->t_state |= TS_TIMEOUT; - timeout(ttrstrt, tp, (hz > 128) ? (hz / 128) : 1); + callout_reset(&tp->t_rstrt_ch, (hz > 128) ? (hz / 128) : 1, + ttrstrt, tp); } if (tp->t_outq.c_cc <= tp->t_lowat) { if (tp->t_state&TS_ASLEEP) { @@ -1701,7 +1702,8 @@ wsdisplay_kbdholdscreen(dev, hold) scr->scr_hold_screen = 1; else { scr->scr_hold_screen = 0; - timeout(ttrstrt, scr->scr_tty, 0); /* "immediate" */ + callout_reset(&scr->scr_tty->t_rstrt_ch, 0, + ttrstrt, scr->scr_tty); /* "immediate" */ } } diff --git a/sys/dev/wscons/wsdisplay_compat_usl.c b/sys/dev/wscons/wsdisplay_compat_usl.c index ed7814e4dff..e9228bec13f 100644 --- a/sys/dev/wscons/wsdisplay_compat_usl.c +++ b/sys/dev/wscons/wsdisplay_compat_usl.c @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_compat_usl.c,v 1.11 1999/12/06 18:52:23 drochner Exp $ */ +/* $NetBSD: wsdisplay_compat_usl.c,v 1.12 2000/03/23 07:01:47 thorpej Exp $ */ /* * Copyright (c) 1998 @@ -37,6 +37,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/ioctl.h> #include <sys/kernel.h> #include <sys/proc.h> @@ -62,6 +63,8 @@ struct usl_syncdata { int s_frsig; /* unused */ void (*s_callback) __P((void *, int, int)); void *s_cbarg; + struct callout s_attach_ch; + struct callout s_detach_ch; }; static int usl_sync_init __P((struct wsscreen *, struct usl_syncdata **, @@ -113,6 +116,8 @@ usl_sync_init(scr, sdp, p, acqsig, relsig, frsig) sd->s_acqsig = acqsig; sd->s_relsig = relsig; sd->s_frsig = frsig; + callout_init(&sd->s_attach_ch); + callout_init(&sd->s_detach_ch); res = wsscreen_attach_sync(scr, &usl_syncops, sd); if (res) { free(sd, M_DEVBUF); @@ -127,11 +132,11 @@ usl_sync_done(sd) struct usl_syncdata *sd; { if (sd->s_flags & SF_DETACHPENDING) { - untimeout(usl_detachtimeout, sd); + callout_stop(&sd->s_detach_ch); (*sd->s_callback)(sd->s_cbarg, 0, 0); } if (sd->s_flags & SF_ATTACHPENDING) { - untimeout(usl_attachtimeout, sd); + callout_stop(&sd->s_attach_ch); (*sd->s_callback)(sd->s_cbarg, ENXIO, 0); } wsscreen_detach_sync(sd->s_scr); @@ -185,7 +190,8 @@ usl_detachproc(cookie, waitok, callback, cbarg) sd->s_cbarg = cbarg; sd->s_flags |= SF_DETACHPENDING; psignal(sd->s_proc, sd->s_relsig); - timeout(usl_detachtimeout, sd, wscompat_usl_synctimeout * hz); + callout_reset(&sd->s_detach_ch, wscompat_usl_synctimeout * hz, + usl_detachtimeout, sd); return (EAGAIN); } @@ -200,7 +206,7 @@ usl_detachack(sd, ack) return (EINVAL); } - untimeout(usl_detachtimeout, sd); + callout_stop(&sd->s_detach_ch); sd->s_flags &= ~SF_DETACHPENDING; if (sd->s_callback) @@ -250,7 +256,8 @@ usl_attachproc(cookie, waitok, callback, cbarg) sd->s_cbarg = cbarg; sd->s_flags |= SF_ATTACHPENDING; psignal(sd->s_proc, sd->s_acqsig); - timeout(usl_attachtimeout, sd, wscompat_usl_synctimeout * hz); + callout_reset(&sd->s_attach_ch, wscompat_usl_synctimeout * hz, + usl_attachtimeout, sd); return (EAGAIN); } @@ -265,7 +272,7 @@ usl_attachack(sd, ack) return (EINVAL); } - untimeout(usl_attachtimeout, sd); + callout_stop(&sd->s_attach_ch); sd->s_flags &= ~SF_ATTACHPENDING; if (sd->s_callback) diff --git a/sys/dev/wscons/wskbd.c b/sys/dev/wscons/wskbd.c index 1a5c2ab4d89..367fb7f2d36 100644 --- a/sys/dev/wscons/wskbd.c +++ b/sys/dev/wscons/wskbd.c @@ -1,4 +1,4 @@ -/* $NetBSD: wskbd.c,v 1.37 2000/03/06 21:37:16 thorpej Exp $ */ +/* $NetBSD: wskbd.c,v 1.38 2000/03/23 07:01:47 thorpej Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.37 2000/03/06 21:37:16 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.38 2000/03/23 07:01:47 thorpej Exp $"); /* * Copyright (c) 1992, 1993 @@ -95,6 +95,7 @@ __KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.37 2000/03/06 21:37:16 thorpej Exp $"); #include <sys/proc.h> #include <sys/syslog.h> #include <sys/systm.h> +#include <sys/callout.h> #include <sys/malloc.h> #include <sys/tty.h> #include <sys/signalvar.h> @@ -166,6 +167,7 @@ struct wskbd_softc { struct wskbd_keyrepeat_data sc_keyrepeat_data; int sc_repeating; /* we've called timeout() */ + struct callout sc_repeat_ch; int sc_translating; /* xlate to chars for emulation */ @@ -377,6 +379,8 @@ wskbd_attach(parent, self, aux) wskbd_update_layout(sc->id, ap->keymap->layout); } + callout_init(&sc->sc_repeat_ch); + sc->id->t_sc = sc; sc->sc_accessops = ap->accessops; @@ -479,8 +483,8 @@ wskbd_repeat(v) wsdisplay_kbdinput(sc->sc_displaydv, sc->id->t_symbols[i]); } - timeout(wskbd_repeat, sc, - (hz * sc->sc_keyrepeat_data.delN) / 1000); + callout_reset(&sc->sc_repeat_ch, + (hz * sc->sc_keyrepeat_data.delN) / 1000, wskbd_repeat, sc); splx(s); } #endif @@ -565,7 +569,7 @@ wskbd_input(dev, type, value) #if NWSDISPLAY > 0 if (sc->sc_repeating) { sc->sc_repeating = 0; - untimeout(wskbd_repeat, sc); + callout_stop(&sc->sc_repeat_ch); } /* @@ -582,8 +586,9 @@ wskbd_input(dev, type, value) } sc->sc_repeating = num; - timeout(wskbd_repeat, sc, - (hz * sc->sc_keyrepeat_data.del1) / 1000); + callout_reset(&sc->sc_repeat_ch, + (hz * sc->sc_keyrepeat_data.del1) / 1000, + wskbd_repeat, sc); } return; } @@ -1029,7 +1034,7 @@ getkeyrepeat: #if NWSDISPLAY > 0 if (sc->sc_repeating) { sc->sc_repeating = 0; - untimeout(wskbd_repeat, sc); + callout_stop(&sc->sc_repeat_ch); } #endif splx(s); |
