diff options
| author | kardel <kardel@NetBSD.org> | 2006-06-07 22:33:33 +0000 |
|---|---|---|
| committer | kardel <kardel@NetBSD.org> | 2006-06-07 22:33:33 +0000 |
| commit | de4337ab213f1d688efc566f2a531d4797702afa (patch) | |
| tree | 739490982edd162b0226b01f0ec9df8b3ec4efc9 /sys/dev | |
| parent | d3390a5a9b73b51a142a58fa60ac0deddb555c02 (diff) | |
merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/clockctl.c | 12 | ||||
| -rw-r--r-- | sys/dev/ic/com.c | 49 | ||||
| -rw-r--r-- | sys/dev/ic/comvar.h | 6 | ||||
| -rw-r--r-- | sys/dev/ic/hd64570.c | 14 | ||||
| -rw-r--r-- | sys/dev/ic/icp.c | 8 | ||||
| -rw-r--r-- | sys/dev/ic/mlx.c | 50 | ||||
| -rw-r--r-- | sys/dev/ic/ncr53c9x.c | 8 | ||||
| -rw-r--r-- | sys/dev/ic/nslm7x.c | 33 | ||||
| -rw-r--r-- | sys/dev/ic/z8530tty.c | 61 | ||||
| -rw-r--r-- | sys/dev/pci/amr.c | 12 | ||||
| -rw-r--r-- | sys/dev/pci/viaenv.c | 15 | ||||
| -rw-r--r-- | sys/dev/pckbport/pms.c | 9 | ||||
| -rw-r--r-- | sys/dev/pckbport/synaptics.c | 7 | ||||
| -rw-r--r-- | sys/dev/ppbus/pps_ppbus.c | 54 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_etimer.h | 12 | ||||
| -rw-r--r-- | sys/dev/scsipi/st.c | 5 | ||||
| -rw-r--r-- | sys/dev/sun/kbd.c | 6 | ||||
| -rw-r--r-- | sys/dev/sun/ms.c | 10 | ||||
| -rw-r--r-- | sys/dev/wscons/wsevent.c | 9 |
19 files changed, 241 insertions, 139 deletions
diff --git a/sys/dev/clockctl.c b/sys/dev/clockctl.c index a95000cb64f..a2f4281b2ac 100644 --- a/sys/dev/clockctl.c +++ b/sys/dev/clockctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: clockctl.c,v 1.16 2006/03/09 23:44:43 christos Exp $ */ +/* $NetBSD: clockctl.c,v 1.17 2006/06/07 22:33:34 kardel Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: clockctl.c,v 1.16 2006/03/09 23:44:43 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: clockctl.c,v 1.17 2006/06/07 22:33:34 kardel Exp $"); #include "opt_ntp.h" @@ -119,8 +119,12 @@ clockctlioctl(dev, cmd, data, flags, l) if (error) return (error); - error = ntp_adjtime1(&ntv, args, &retval); - (void)copyout(&retval, &args->retval, sizeof(retval)); + ntp_adjtime1(&ntv); + + error = copyout(&ntv, args->tp, sizeof(ntv)); + if (error == 0) + (void)copyout(&retval, &args->retval, sizeof(retval)); + return (error); } #endif /* NTP */ diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index 9160caedb4f..e81dc9912eb 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1,4 +1,4 @@ -/* $NetBSD: com.c,v 1.243 2006/05/14 21:42:27 elad Exp $ */ +/* $NetBSD: com.c,v 1.244 2006/06/07 22:33:34 kardel Exp $ */ /*- * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc. @@ -73,7 +73,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.243 2006/05/14 21:42:27 elad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.244 2006/06/07 22:33:34 kardel Exp $"); #include "opt_com.h" #include "opt_ddb.h" @@ -219,11 +219,13 @@ static int comconsrate; static tcflag_t comconscflag; static struct cnm_state com_cnm_state; +#ifndef __HAVE_TIMECOUNTER static int ppscap = PPS_TSFMT_TSPEC | PPS_CAPTUREASSERT | PPS_CAPTURECLEAR | PPS_OFFSETASSERT | PPS_OFFSETCLEAR; +#endif /* !__HAVE_TIMECOUNTER */ #ifndef __HAVE_GENERIC_SOFT_INTERRUPTS #ifdef __NO_SOFT_SERIAL_INTERRUPT @@ -753,9 +755,11 @@ com_shutdown(struct com_softc *sc) /* Clear any break condition set with TIOCSBRK. */ com_break(sc, 0); +#ifndef __HAVE_TIMECOUNTER /* Turn off PPS capture on last close. */ sc->sc_ppsmask = 0; sc->ppsparam.mode = 0; +#endif /* !__HAVE_TIMECOUNTER */ /* * Hang up if necessary. Wait a bit, so the other side has time to @@ -872,8 +876,14 @@ comopen(dev_t dev, int flag, int mode, struct lwp *l) sc->sc_msr = bus_space_read_1(sc->sc_iot, sc->sc_ioh, com_msr); /* Clear PPS capture state on first open. */ +#ifdef __HAVE_TIMECOUNTER + memset(&sc->sc_pps_state, 0, sizeof(sc->sc_pps_state)); + sc->sc_pps_state.ppscap = PPS_CAPTUREASSERT | PPS_CAPTURECLEAR; + pps_init(&sc->sc_pps_state); +#else /* !__HAVE_TIMECOUNTER */ sc->sc_ppsmask = 0; sc->ppsparam.mode = 0; +#endif /* !__HAVE_TIMECOUNTER */ COM_UNLOCK(sc); splx(s2); @@ -1095,6 +1105,19 @@ comioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct lwp *l) *(int *)data = com_to_tiocm(sc); break; +#ifdef __HAVE_TIMECOUNTER + case PPS_IOC_CREATE: + case PPS_IOC_DESTROY: + case PPS_IOC_GETPARAMS: + case PPS_IOC_SETPARAMS: + case PPS_IOC_GETCAP: + case PPS_IOC_FETCH: +#ifdef PPS_SYNC + case PPS_IOC_KCBIND: +#endif + error = pps_ioctl(cmd, data, &sc->sc_pps_state); + break; +#else /* !__HAVE_TIMECOUNTER */ case PPS_IOC_CREATE: break; @@ -1187,8 +1210,18 @@ comioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct lwp *l) break; } #endif /* PPS_SYNC */ +#endif /* !__HAVE_TIMECOUNTER */ case TIOCDCDTIMESTAMP: /* XXX old, overloaded API used by xntpd v3 */ +#ifdef __HAVE_TIMECOUNTER +#ifndef PPS_TRAILING_EDGE + TIMESPEC_TO_TIMEVAL((struct timeval *)data, + &sc->sc_pps_state.ppsinfo.assert_timestamp); +#else + TIMESPEC_TO_TIMEVAL((struct timeval *)data, + &sc->sc_pps_state.ppsinfo.clear_timestamp); +#endif +#else /* !__HAVE_TIMECOUNTER */ /* * Some GPS clocks models use the falling rather than * rising edge as the on-the-second signal. @@ -1206,6 +1239,7 @@ comioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct lwp *l) TIMESPEC_TO_TIMEVAL((struct timeval *)data, &sc->ppsinfo.clear_timestamp); #endif +#endif /* !__HAVE_TIMECOUNTER */ break; default: @@ -2147,6 +2181,16 @@ again: do { msr = bus_space_read_1(iot, ioh, com_msr); delta = msr ^ sc->sc_msr; sc->sc_msr = msr; +#ifdef __HAVE_TIMECOUNTER + if ((sc->sc_pps_state.ppsparam.mode & PPS_CAPTUREBOTH) && + (delta & MSR_DCD)) { + pps_capture(&sc->sc_pps_state); + pps_event(&sc->sc_pps_state, + (msr & MSR_DCD) ? + PPS_CAPTUREASSERT : + PPS_CAPTURECLEAR); + } +#else /* !__HAVE_TIMECOUNTER */ /* * Pulse-per-second (PSS) signals on edge of DCD? * Process these even if line discipline is ignoring DCD. @@ -2194,6 +2238,7 @@ again: do { sc->ppsinfo.current_mode = sc->ppsparam.mode; } } +#endif /* !__HAVE_TIMECOUNTER */ /* * Process normal status changes diff --git a/sys/dev/ic/comvar.h b/sys/dev/ic/comvar.h index 42f0b56ba94..311321408f0 100644 --- a/sys/dev/ic/comvar.h +++ b/sys/dev/ic/comvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: comvar.h,v 1.51 2006/03/05 17:33:33 christos Exp $ */ +/* $NetBSD: comvar.h,v 1.52 2006/06/07 22:33:35 kardel Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -137,12 +137,16 @@ struct com_softc { void (*disable)(struct com_softc *); int enabled; +#ifdef __HAVE_TIMECOUNTER + struct pps_state sc_pps_state; /* pps state */ +#else /* !__HAVE_TIMECOUNTER */ /* PPS signal on DCD, with or without inkernel clock disciplining */ u_char sc_ppsmask; /* pps signal mask */ u_char sc_ppsassert; /* pps leading edge */ u_char sc_ppsclear; /* pps trailing edge */ pps_info_t ppsinfo; pps_params_t ppsparam; +#endif /* !__HAVE_TIMECOUNTER */ #if NRND > 0 && defined(RND_COM) rndsource_element_t rnd_source; diff --git a/sys/dev/ic/hd64570.c b/sys/dev/ic/hd64570.c index 4fce50785b5..62671b9fff4 100644 --- a/sys/dev/ic/hd64570.c +++ b/sys/dev/ic/hd64570.c @@ -1,4 +1,4 @@ -/* $NetBSD: hd64570.c,v 1.31 2006/03/28 17:38:30 thorpej Exp $ */ +/* $NetBSD: hd64570.c,v 1.32 2006/06/07 22:33:35 kardel Exp $ */ /* * Copyright (c) 1999 Christian E. Hopps @@ -65,7 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hd64570.c,v 1.31 2006/03/28 17:38:30 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hd64570.c,v 1.32 2006/06/07 22:33:35 kardel Exp $"); #include "bpfilter.h" #include "opt_inet.h" @@ -413,6 +413,7 @@ sca_init(struct sca_softc *sc) void sca_port_attach(struct sca_softc *sc, u_int port) { + struct timeval now; sca_port_t *scp = &sc->sc_ports[port]; struct ifnet *ifp; static u_int ntwo_unit = 0; @@ -475,7 +476,8 @@ sca_port_attach(struct sca_softc *sc, u_int port) /* * reset the last seen times on the cisco keepalive protocol */ - scp->cka_lasttx = time.tv_usec; + getmicrotime(&now); + scp->cka_lasttx = now.tv_usec; scp->cka_lastrx = 0; } @@ -1568,7 +1570,7 @@ sca_frame_process(sca_port_t *scp) u_int16_t len; u_int32_t t; - t = (time.tv_sec - boottime.tv_sec) * 1000; + t = time_uptime * 1000; desc = &scp->sp_rxdesc[scp->sp_rxstart]; bufp = scp->sp_rxbuf + SCA_BSIZE * scp->sp_rxstart; len = sca_desc_read_buflen(scp->sca, desc); @@ -1821,6 +1823,7 @@ static void sca_port_up(sca_port_t *scp) { struct sca_softc *sc = scp->sca; + struct timeval now; #if 0 u_int8_t ier0, ier1; #endif @@ -1885,7 +1888,8 @@ sca_port_up(sca_port_t *scp) */ scp->sp_txinuse = 0; scp->sp_txcur = 0; - scp->cka_lasttx = time.tv_usec; + getmicrotime(&now); + scp->cka_lasttx = now.tv_usec; scp->cka_lastrx = 0; } diff --git a/sys/dev/ic/icp.c b/sys/dev/ic/icp.c index 30dc92f831a..d87a4fa3d5b 100644 --- a/sys/dev/ic/icp.c +++ b/sys/dev/ic/icp.c @@ -1,4 +1,4 @@ -/* $NetBSD: icp.c,v 1.19 2006/03/28 17:38:30 thorpej Exp $ */ +/* $NetBSD: icp.c,v 1.20 2006/06/07 22:33:35 kardel Exp $ */ /*- * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc. @@ -83,7 +83,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: icp.c,v 1.19 2006/03/28 17:38:30 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: icp.c,v 1.20 2006/06/07 22:33:35 kardel Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1323,7 +1323,7 @@ icp_store_event(struct icp_softc *icp, u_int16_t source, u_int16_t idx, (evt->size == 0 && e->event_data.size == 0 && strcmp((char *) e->event_data.event_string, (char *) evt->event_string) == 0))) { - e->last_stamp = time.tv_sec; + e->last_stamp = time_second; e->same_count++; } else { if (icp_event_buffer[icp_event_lastidx].event_source != 0) { @@ -1339,7 +1339,7 @@ icp_store_event(struct icp_softc *icp, u_int16_t source, u_int16_t idx, e = &icp_event_buffer[icp_event_lastidx]; e->event_source = source; e->event_idx = idx; - e->first_stamp = e->last_stamp = time.tv_sec; + e->first_stamp = e->last_stamp = time_second; e->same_count = 1; e->event_data = *evt; e->application = 0; diff --git a/sys/dev/ic/mlx.c b/sys/dev/ic/mlx.c index 53ac7f0e61c..9836500ca40 100644 --- a/sys/dev/ic/mlx.c +++ b/sys/dev/ic/mlx.c @@ -1,4 +1,4 @@ -/* $NetBSD: mlx.c,v 1.42 2006/04/14 21:06:47 christos Exp $ */ +/* $NetBSD: mlx.c,v 1.43 2006/06/07 22:33:36 kardel Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -74,7 +74,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mlx.c,v 1.42 2006/04/14 21:06:47 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mlx.c,v 1.43 2006/06/07 22:33:36 kardel Exp $"); #include "ld.h" @@ -135,8 +135,6 @@ static int mlx_rebuild(struct mlx_softc *, int, int); static void mlx_shutdown(void *); static int mlx_user_command(struct mlx_softc *, struct mlx_usercommand *); -static inline time_t mlx_curtime(void); - dev_type_open(mlxopen); dev_type_close(mlxclose); dev_type_ioctl(mlxioctl); @@ -254,23 +252,6 @@ struct { }; /* - * Return the current time in seconds - we're not particularly interested in - * precision here. - */ -static inline time_t -mlx_curtime(void) -{ - time_t rt; - int s; - - s = splclock(); - rt = mono_time.tv_sec; - splx(s); - - return (rt); -} - -/* * Initialise the controller and our interface. */ void @@ -810,7 +791,7 @@ mlxioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct lwp *l) /* Looks ok, go with it. */ mlx->mlx_pause.mp_which = mp->mp_which; - mlx->mlx_pause.mp_when = mlx_curtime() + mp->mp_when; + mlx->mlx_pause.mp_when = time_second + mp->mp_when; mlx->mlx_pause.mp_howlong = mlx->mlx_pause.mp_when + mp->mp_howlong; @@ -999,13 +980,10 @@ mlx_periodic(struct mlx_softc *mlx) { struct mlx_ccb *mc, *nmc; int etype, s; - time_t ct; - - ct = mlx_curtime(); if ((mlx->mlx_pause.mp_which != 0) && (mlx->mlx_pause.mp_when > 0) && - (ct >= mlx->mlx_pause.mp_when)) { + (time_second >= mlx->mlx_pause.mp_when)) { /* * Start bus pause. */ @@ -1016,15 +994,15 @@ mlx_periodic(struct mlx_softc *mlx) /* * Stop pause if required. */ - if (ct >= mlx->mlx_pause.mp_howlong) { + if (time_second >= mlx->mlx_pause.mp_howlong) { mlx_pause_action(mlx); mlx->mlx_pause.mp_which = 0; } - } else if (ct > (mlx->mlx_lastpoll + 10)) { + } else if (time_second > (mlx->mlx_lastpoll + 10)) { /* * Run normal periodic activities... */ - mlx->mlx_lastpoll = ct; + mlx->mlx_lastpoll = time_second; /* * Check controller status. @@ -1068,7 +1046,7 @@ mlx_periodic(struct mlx_softc *mlx) s = splbio(); for (mc = TAILQ_FIRST(&mlx->mlx_ccb_worklist); mc != NULL; mc = nmc) { nmc = TAILQ_NEXT(mc, mc_chain.tailq); - if (mc->mc_expiry > ct) { + if (mc->mc_expiry > time_second) { /* * The remaining CCBs will expire after this one, so * there's no point in going further. @@ -1479,9 +1457,6 @@ mlx_pause_action(struct mlx_softc *mlx) { struct mlx_ccb *mc; int failsafe, i, cmd; - time_t ct; - - ct = mlx_curtime(); /* What are we doing here? */ if (mlx->mlx_pause.mp_when == 0) { @@ -1495,11 +1470,12 @@ mlx_pause_action(struct mlx_softc *mlx) * period, which is specified in multiples of 30 seconds. * This constrains us to a maximum pause of 450 seconds. */ - failsafe = ((mlx->mlx_pause.mp_howlong - ct) + 5) / 30; + failsafe = ((mlx->mlx_pause.mp_howlong - time_second) + 5) / 30; if (failsafe > 0xf) { failsafe = 0xf; - mlx->mlx_pause.mp_howlong = ct + (0xf * 30) - 5; + mlx->mlx_pause.mp_howlong = + time_second + (0xf * 30) - 5; } } @@ -1542,7 +1518,7 @@ mlx_pause_done(struct mlx_ccb *mc) else if (command == MLX_CMD_STOPCHANNEL) printf("%s: channel %d pausing for %ld seconds\n", mlx->mlx_dv.dv_xname, channel, - (long)(mlx->mlx_pause.mp_howlong - mlx_curtime())); + (long)(mlx->mlx_pause.mp_howlong - time_second)); else printf("%s: channel %d resuming\n", mlx->mlx_dv.dv_xname, channel); @@ -2083,7 +2059,7 @@ mlx_ccb_submit(struct mlx_softc *mlx, struct mlx_ccb *mc) /* Mark the command as currently being processed. */ mc->mc_status = MLX_STATUS_BUSY; - mc->mc_expiry = mlx_curtime() + MLX_TIMEOUT; + mc->mc_expiry = time_second + MLX_TIMEOUT; /* Spin waiting for the mailbox. */ for (i = 100; i != 0; i--) { diff --git a/sys/dev/ic/ncr53c9x.c b/sys/dev/ic/ncr53c9x.c index 2d16297fbe5..494eeaf0f28 100644 --- a/sys/dev/ic/ncr53c9x.c +++ b/sys/dev/ic/ncr53c9x.c @@ -1,4 +1,4 @@ -/* $NetBSD: ncr53c9x.c,v 1.119 2006/03/29 04:16:49 thorpej Exp $ */ +/* $NetBSD: ncr53c9x.c,v 1.120 2006/06/07 22:33:36 kardel Exp $ */ /*- * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc. @@ -77,7 +77,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.119 2006/03/29 04:16:49 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.120 2006/06/07 22:33:36 kardel Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1110,7 +1110,7 @@ ncr53c9x_sched(sc) if (lun < NCR_NLUN) ti->lun[lun] = li; } - li->last_used = time.tv_sec; + li->last_used = time_second; if (tag == 0) { /* Try to issue this as an un-tagged command */ if (li->untagged == NULL) @@ -2948,7 +2948,7 @@ ncr53c9x_watch(arg) struct ncr53c9x_linfo *li; int t, s; /* Delete any structures that have not been used in 10min. */ - time_t old = time.tv_sec - (10 * 60); + time_t old = time_second - (10 * 60); s = splbio(); simple_lock(&sc->sc_lock); diff --git a/sys/dev/ic/nslm7x.c b/sys/dev/ic/nslm7x.c index 8e4fcac1e1b..dc94a368000 100644 --- a/sys/dev/ic/nslm7x.c +++ b/sys/dev/ic/nslm7x.c @@ -1,4 +1,4 @@ -/* $NetBSD: nslm7x.c,v 1.25 2006/05/13 09:03:21 xtraeme Exp $ */ +/* $NetBSD: nslm7x.c,v 1.26 2006/06/07 22:33:36 kardel Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nslm7x.c,v 1.25 2006/05/13 09:03:21 xtraeme Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nslm7x.c,v 1.26 2006/06/07 22:33:36 kardel Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -435,27 +435,20 @@ lm_gtredata(sme, tred) struct sysmon_envsys *sme; struct envsys_tre_data *tred; { - static const struct timeval onepointfive = { 1, 500000 }; - struct timeval t; - struct lm_softc *sc = sme->sme_cookie; - int i, s; - - /* read new values at most once every 1.5 seconds */ - timeradd(&sc->lastread, &onepointfive, &t); - s = splclock(); - i = timercmp(&mono_time, &t, >); - if (i) { - sc->lastread.tv_sec = mono_time.tv_sec; - sc->lastread.tv_usec = mono_time.tv_usec; - } - splx(s); + static const struct timeval onepointfive = { 1, 500000 }; + struct timeval t, utv; + struct lm_softc *sc = sme->sme_cookie; - if (i) - sc->refresh_sensor_data(sc); + /* read new values at most once every 1.5 seconds */ + getmicrouptime(&utv); + timeradd(&sc->lastread, &onepointfive, &t); + if (timercmp(&utv, &t, >)) { + sc->lastread = utv; + sc->refresh_sensor_data(sc); - *tred = sc->sensors[tred->sensor]; + *tred = sc->sensors[tred->sensor]; - return 0; + return 0; } int diff --git a/sys/dev/ic/z8530tty.c b/sys/dev/ic/z8530tty.c index 083fecd7560..9ef5792063d 100644 --- a/sys/dev/ic/z8530tty.c +++ b/sys/dev/ic/z8530tty.c @@ -1,4 +1,4 @@ -/* $NetBSD: z8530tty.c,v 1.107 2006/05/14 21:42:27 elad Exp $ */ +/* $NetBSD: z8530tty.c,v 1.108 2006/06/07 22:33:36 kardel Exp $ */ /*- * Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999 @@ -137,7 +137,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: z8530tty.c,v 1.107 2006/05/14 21:42:27 elad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: z8530tty.c,v 1.108 2006/06/07 22:33:36 kardel Exp $"); #include "opt_kgdb.h" #include "opt_ntp.h" @@ -184,11 +184,13 @@ u_int zstty_rbuf_size = ZSTTY_RING_SIZE; u_int zstty_rbuf_hiwat = (ZSTTY_RING_SIZE * 1) / 4; u_int zstty_rbuf_lowat = (ZSTTY_RING_SIZE * 3) / 4; +#ifndef __HAVE_TIMECOUNTER static int zsppscap = PPS_TSFMT_TSPEC | PPS_CAPTUREASSERT | PPS_CAPTURECLEAR | PPS_OFFSETASSERT | PPS_OFFSETCLEAR; +#endif /* __HAVE_TIMECOUNTER */ struct zstty_softc { struct device zst_dev; /* required first: base device */ @@ -237,10 +239,14 @@ struct zstty_softc { /* PPS signal on DCD, with or without inkernel clock disciplining */ u_char zst_ppsmask; /* pps signal mask */ +#ifdef __HAVE_TIMECOUNTER + struct pps_state zst_pps_state; +#else /* !__HAVE_TIMECOUNTER */ u_char zst_ppsassert; /* pps leading edge */ u_char zst_ppsclear; /* pps trailing edge */ pps_info_t ppsinfo; pps_params_t ppsparam; +#endif /* !__HAVE_TIMECOUNTER */ }; /* Definition of the driver for autoconfig. */ @@ -507,9 +513,11 @@ zs_shutdown(zst) /* Clear any break condition set with TIOCSBRK. */ zs_break(cs, 0); +#ifndef __HAVE_TIMECOUNTER /* Turn off PPS capture on last close. */ zst->zst_ppsmask = 0; zst->ppsparam.mode = 0; +#endif /* __HAVE_TIMECOUNTER */ /* * Hang up if necessary. Wait a bit, so the other side has time to @@ -636,7 +644,13 @@ zsopen(dev, flags, mode, l) /* Clear PPS capture state on first open. */ zst->zst_ppsmask = 0; +#ifdef __HAVE_TIMECOUNTER + memset(&zst->zst_pps_state, 0, sizeof(zst->zst_pps_state)); + zst->zst_pps_state.ppscap = PPS_CAPTUREASSERT | PPS_CAPTURECLEAR; + pps_init(&zst->zst_pps_state); +#else /* !__HAVE_TIMECOUNTER */ zst->ppsparam.mode = 0; +#endif /* !__HAVE_TIMECOUNTER */ simple_unlock(&cs->cs_lock); splx(s2); @@ -853,6 +867,23 @@ zsioctl(dev, cmd, data, flag, l) *(int *)data = zs_to_tiocm(zst); break; +#ifdef __HAVE_TIMECOUNTER + case PPS_IOC_CREATE: + case PPS_IOC_DESTROY: + case PPS_IOC_GETPARAMS: + case PPS_IOC_SETPARAMS: + case PPS_IOC_GETCAP: + case PPS_IOC_FETCH: +#ifdef PPS_SYNC + case PPS_IOC_KCBIND: +#endif + error = pps_ioctl(cmd, data, &zst->zst_pps_state); + if (zst->zst_pps_state.ppsparam.mode & PPS_CAPTUREBOTH) + zst->zst_ppsmask = ZSRR0_DCD; + else + zst->zst_ppsmask = 0; + break; +#else /* !__HAVE_TIMECOUNTER */ case PPS_IOC_CREATE: break; @@ -967,17 +998,22 @@ zsioctl(dev, cmd, data, flag, l) break; } #endif /* PPS_SYNC */ +#endif /* !__HAVE_TIMECOUNTER */ case TIOCDCDTIMESTAMP: /* XXX old, overloaded API used by xntpd v3 */ if (cs->cs_rr0_pps == 0) { error = EINVAL; break; } - /* - * Some GPS clocks models use the falling rather than - * rising edge as the on-the-second signal. - * The old API has no way to specify PPS polarity. - */ +#ifdef __HAVE_TIMECOUNTER +#ifndef PPS_TRAILING_EDGE + TIMESPEC_TO_TIMEVAL((struct timeval *)data, + &zst->zst_pps_state.ppsinfo.assert_timestamp); +#else + TIMESPEC_TO_TIMEVAL((struct timeval *)data, + &zst->zst_pps_state.ppsinfo.clear_timestamp); +#endif +#else /* !__HAVE_TIMECOUNTER */ zst->zst_ppsmask = ZSRR0_DCD; #ifndef PPS_TRAILING_EDGE zst->zst_ppsassert = ZSRR0_DCD; @@ -990,6 +1026,7 @@ zsioctl(dev, cmd, data, flag, l) TIMESPEC_TO_TIMEVAL((struct timeval *)data, &zst->ppsinfo.clear_timestamp); #endif +#endif /* !__HAVE_TIMECOUNTER */ /* * Now update interrupts. */ @@ -1659,6 +1696,15 @@ zstty_stint(cs, force) * Pulse-per-second clock signal on edge of DCD? */ if (ISSET(delta, zst->zst_ppsmask)) { +#ifdef __HAVE_TIMECOUNTER + if (zst->zst_pps_state.ppsparam.mode & PPS_CAPTUREBOTH) { + pps_capture(&zst->zst_pps_state); + pps_event(&zst->zst_pps_state, + (ISSET(cs->cs_rr0, zst->zst_ppsmask)) + ? PPS_CAPTUREASSERT + : PPS_CAPTURECLEAR); + } +#else /* !__HAVE_TIMECOUNTER */ struct timeval tv; if (ISSET(rr0, zst->zst_ppsmask) == zst->zst_ppsassert) { /* XXX nanotime() */ @@ -1700,6 +1746,7 @@ zstty_stint(cs, force) zst->ppsinfo.clear_sequence++; zst->ppsinfo.current_mode = zst->ppsparam.mode; } +#endif /* !__HAVE_TIMECOUNTER */ } /* diff --git a/sys/dev/pci/amr.c b/sys/dev/pci/amr.c index 93447b9e0d5..a5d4d83e78e 100644 --- a/sys/dev/pci/amr.c +++ b/sys/dev/pci/amr.c @@ -1,4 +1,4 @@ -/* $NetBSD: amr.c,v 1.34 2006/04/17 13:31:02 elad Exp $ */ +/* $NetBSD: amr.c,v 1.35 2006/06/07 22:33:36 kardel Exp $ */ /*- * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: amr.c,v 1.34 2006/04/17 13:31:02 elad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: amr.c,v 1.35 2006/06/07 22:33:36 kardel Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -833,7 +833,6 @@ amr_thread(void *cookie) struct amr_ccb *ac; struct amr_logdrive *al; struct amr_enquiry *ae; - time_t curtime; int rv, i, s; amr = cookie; @@ -850,10 +849,9 @@ amr_thread(void *cookie) s = splbio(); amr_intr(cookie); - curtime = (time_t)mono_time.tv_sec; ac = TAILQ_FIRST(&amr->amr_ccb_active); while (ac != NULL) { - if (ac->ac_start_time + AMR_TIMEOUT > curtime) + if (ac->ac_start_time + AMR_TIMEOUT > time_uptime) break; if ((ac->ac_flags & AC_MOAN) == 0) { printf("%s: ccb %d timed out; mailbox:\n", @@ -1189,7 +1187,7 @@ amr_quartz_submit(struct amr_softc *amr, struct amr_ccb *ac) bus_dmamap_sync(amr->amr_dmat, amr->amr_dmamap, 0, sizeof(struct amr_mailbox), BUS_DMASYNC_PREWRITE); - ac->ac_start_time = (time_t)mono_time.tv_sec; + ac->ac_start_time = time_uptime; ac->ac_flags |= AC_ACTIVE; amr_outl(amr, AMR_QREG_IDB, (amr->amr_mbox_paddr + 16) | AMR_QIDB_SUBMIT); @@ -1223,7 +1221,7 @@ amr_std_submit(struct amr_softc *amr, struct amr_ccb *ac) bus_dmamap_sync(amr->amr_dmat, amr->amr_dmamap, 0, sizeof(struct amr_mailbox), BUS_DMASYNC_PREWRITE); - ac->ac_start_time = (time_t)mono_time.tv_sec; + ac->ac_start_time = time_uptime; ac->ac_flags |= AC_ACTIVE; amr_outb(amr, AMR_SREG_CMD, AMR_SCMD_POST); return (0); diff --git a/sys/dev/pci/viaenv.c b/sys/dev/pci/viaenv.c index 5616b6910af..8189f9e1227 100644 --- a/sys/dev/pci/viaenv.c +++ b/sys/dev/pci/viaenv.c @@ -1,4 +1,4 @@ -/* $NetBSD: viaenv.c,v 1.13 2005/12/11 12:22:51 christos Exp $ */ +/* $NetBSD: viaenv.c,v 1.14 2006/06/07 22:33:37 kardel Exp $ */ /* * Copyright (c) 2000 Johan Danielsson @@ -35,7 +35,7 @@ /* driver for the hardware monitoring part of the VIA VT82C686A */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: viaenv.c,v 1.13 2005/12/11 12:22:51 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: viaenv.c,v 1.14 2006/06/07 22:33:37 kardel Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -202,17 +202,16 @@ static void viaenv_refresh_sensor_data(struct viaenv_softc *sc) { static const struct timeval onepointfive = { 1, 500000 }; - struct timeval t; + struct timeval t, utv; u_int8_t v, v2; - int i, s; + int i; /* Read new values at most once every 1.5 seconds. */ timeradd(&sc->sc_lastread, &onepointfive, &t); - s = splclock(); - i = timercmp(&mono_time, &t, >); + getmicrouptime(&utv); + i = timercmp(&utv, &t, >); if (i) - sc->sc_lastread = mono_time; - splx(s); + sc->sc_lastread = utv; if (i == 0) return; diff --git a/sys/dev/pckbport/pms.c b/sys/dev/pckbport/pms.c index 2604dd19787..d143bfebc1f 100644 --- a/sys/dev/pckbport/pms.c +++ b/sys/dev/pckbport/pms.c @@ -1,4 +1,4 @@ -/* $NetBSD: pms.c,v 1.10 2006/03/29 07:11:08 thorpej Exp $ */ +/* $NetBSD: pms.c,v 1.11 2006/06/07 22:33:37 kardel Exp $ */ /*- * Copyright (c) 2004 Kentaro Kurahone. @@ -28,7 +28,7 @@ #include "opt_pms.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pms.c,v 1.10 2006/03/29 07:11:08 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pms.c,v 1.11 2006/06/07 22:33:37 kardel Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -493,16 +493,13 @@ pmsinput(void *vsc, int data) u_int changed; int dx, dy, dz = 0; int newbuttons = 0; - int s; if (!sc->sc_enabled) { /* Interrupts are not expected. Discard the byte. */ return; } - s = splclock(); - sc->current = mono_time; - splx(s); + getmicrouptime(&sc->current); if (sc->inputstate > 0) { struct timeval diff; diff --git a/sys/dev/pckbport/synaptics.c b/sys/dev/pckbport/synaptics.c index baa449eb84e..ecef5c998dd 100644 --- a/sys/dev/pckbport/synaptics.c +++ b/sys/dev/pckbport/synaptics.c @@ -1,4 +1,4 @@ -/* $NetBSD: synaptics.c,v 1.9 2005/12/24 20:27:52 perry Exp $ */ +/* $NetBSD: synaptics.c,v 1.10 2006/06/07 22:33:37 kardel Exp $ */ /* * Copyright (c) 2005, Steve C. Woodford @@ -650,16 +650,13 @@ pms_synaptics_input(void *vsc, int data) struct synaptics_softc *sc = &psc->u.synaptics; struct timeval diff; struct synaptics_packet sp; - int s; if (!psc->sc_enabled) { /* Interrupts are not expected. Discard the byte. */ return; } - s = splclock(); - psc->current = mono_time; - splx(s); + getmicrouptime(&psc->current); if (psc->inputstate > 0) { timersub(&psc->current, &psc->last, &diff); diff --git a/sys/dev/ppbus/pps_ppbus.c b/sys/dev/ppbus/pps_ppbus.c index b14865cbd65..7b6d008ca9a 100644 --- a/sys/dev/ppbus/pps_ppbus.c +++ b/sys/dev/ppbus/pps_ppbus.c @@ -1,6 +1,8 @@ -/* $NetBSD: pps_ppbus.c,v 1.6 2006/05/10 10:33:40 drochner Exp $ */ +/* $NetBSD: pps_ppbus.c,v 1.7 2006/06/07 22:33:37 kardel Exp $ */ /* + * ported to timecounters by Frank Kardel 2006 + * * Copyright (c) 2004 * Matthias Drochner. All rights reserved. * @@ -27,7 +29,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pps_ppbus.c,v 1.6 2006/05/10 10:33:40 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pps_ppbus.c,v 1.7 2006/06/07 22:33:37 kardel Exp $"); #include "opt_ntp.h" @@ -47,11 +49,15 @@ struct pps_softc { struct ppbus_device_softc pps_dev; struct device *ppbus; int busy; +#ifdef __HAVE_TIMECOUNTER + struct pps_state pps_state; /* pps state */ +#else /* !__HAVE_TIMECOUNTER */ pps_info_t ppsinfo; pps_params_t ppsparam; #ifdef PPS_SYNC int hardpps; #endif +#endif /* !__HAVE_TIMECOUNTER */ }; static int pps_probe(struct device *, struct cfdata *, void *); @@ -70,7 +76,9 @@ const struct cdevsw pps_cdevsw = { static void ppsintr(void *arg); +#ifndef __HAVE_TIMECOUNTER static int ppscap = PPS_TSFMT_TSPEC | PPS_CAPTUREASSERT | PPS_OFFSETASSERT; +#endif static int pps_probe(struct device *parent, struct cfdata *match, void *aux) @@ -125,6 +133,12 @@ ppsopen(dev_t dev, int flags, int fmt, struct lwp *l) ppbus_set_mode(sc->ppbus, PPBUS_PS2, 0); ppbus_wctr(sc->ppbus, IRQENABLE | PCD | nINIT | SELECTIN); +#ifdef __HAVE_TIMECOUNTER + memset((void *)&sc->pps_state, 0, sizeof(sc->pps_state)); + sc->pps_state.ppscap = PPS_CAPTUREASSERT; + pps_init(&sc->pps_state); +#endif /* __HAVE_TIMECOUNTER */ + sc->busy = 1; return (0); } @@ -135,11 +149,16 @@ ppsclose(dev_t dev, int flags, int fmt, struct lwp *l) struct pps_softc *sc = device_lookup(&pps_cd, minor(dev)); struct device *ppbus = sc->ppbus; - sc->ppsparam.mode = 0; sc->busy = 0; +#ifdef __HAVE_TIMECOUNTER + sc->pps_state.ppsparam.mode = 0; +#else /* !__HAVE_TIMECOUNTER */ + sc->ppsparam.mode = 0; #ifdef PPS_SYNC sc->hardpps = 0; #endif +#endif /* __HAVE_TIMECOUNTER */ + ppbus_wdtr(ppbus, 0); ppbus_wctr(ppbus, 0); @@ -154,11 +173,25 @@ ppsintr(void *arg) { struct pps_softc *sc = arg; struct device *ppbus = sc->ppbus; +#ifndef __HAVE_TIMECOUNTER struct timeval tv; +#else /* __HAVE_TIMECOUNTER */ + pps_capture(&sc->pps_state); +#endif /* __HAVE_TIMECOUNTER */ + if (!(ppbus_rstr(ppbus) & nACK)) return; +#ifdef __HAVE_TIMECOUNTER + if (sc->pps_state.ppsparam.mode & PPS_ECHOASSERT) + ppbus_wctr(ppbus, IRQENABLE | AUTOFEED); + + pps_event(&sc->pps_state, PPS_CAPTUREASSERT); + + if (sc->pps_state.ppsparam.mode & PPS_ECHOASSERT) + ppbus_wctr(ppbus, IRQENABLE); +#else /* !__HAVE_TIMECOUNTER */ microtime(&tv); TIMEVAL_TO_TIMESPEC(&tv, &sc->ppsinfo.assert_timestamp); if (sc->ppsparam.mode & PPS_OFFSETASSERT) { @@ -172,6 +205,7 @@ ppsintr(void *arg) #endif sc->ppsinfo.assert_sequence++; sc->ppsinfo.current_mode = sc->ppsparam.mode; +#endif /* !__HAVE_TIMECOUNTER */ } static int @@ -181,6 +215,19 @@ ppsioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct lwp *l) int error = 0; switch (cmd) { +#ifdef __HAVE_TIMECOUNTER + case PPS_IOC_CREATE: + case PPS_IOC_DESTROY: + case PPS_IOC_GETPARAMS: + case PPS_IOC_SETPARAMS: + case PPS_IOC_GETCAP: + case PPS_IOC_FETCH: +#ifdef PPS_SYNC + case PPS_IOC_KCBIND: +#endif + error = pps_ioctl(cmd, data, &sc->pps_state); + break; +#else /* !__HAVE_TIMECOUNTER */ case PPS_IOC_CREATE: break; @@ -224,6 +271,7 @@ ppsioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct lwp *l) sc->hardpps = 0; break; #endif +#endif /* !__HAVE_TIMECOUNTER */ default: error = EPASSTHROUGH; diff --git a/sys/dev/raidframe/rf_etimer.h b/sys/dev/raidframe/rf_etimer.h index 140918e22a7..4e38b2b887b 100644 --- a/sys/dev/raidframe/rf_etimer.h +++ b/sys/dev/raidframe/rf_etimer.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_etimer.h,v 1.10 2005/12/11 12:23:37 christos Exp $ */ +/* $NetBSD: rf_etimer.h,v 1.11 2006/06/07 22:33:37 kardel Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -42,19 +42,13 @@ struct RF_Etimer_s { #define RF_ETIMER_START(_t_) \ { \ - int _s; \ memset(&(_t_), 0, sizeof (_t_)); \ - _s = splclock(); \ - (_t_).st = mono_time; \ - splx(_s); \ + getmicrouptime(&(_t_).st); \ } #define RF_ETIMER_STOP(_t_) \ { \ - int _s; \ - _s = splclock(); \ - (_t_).et = mono_time; \ - splx(_s); \ + getmicrouptime(&(_t_).et); \ } #define RF_ETIMER_EVAL(_t_) \ diff --git a/sys/dev/scsipi/st.c b/sys/dev/scsipi/st.c index b76af98955c..7071ebbde99 100644 --- a/sys/dev/scsipi/st.c +++ b/sys/dev/scsipi/st.c @@ -1,4 +1,4 @@ -/* $NetBSD: st.c,v 1.190 2006/04/20 12:13:52 blymn Exp $ */ +/* $NetBSD: st.c,v 1.191 2006/06/07 22:33:37 kardel Exp $ */ /*- * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.190 2006/04/20 12:13:52 blymn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.191 2006/06/07 22:33:37 kardel Exp $"); #include "opt_scsi.h" @@ -1348,7 +1348,6 @@ stdone(struct scsipi_xfer *xs, int error) iostat_unbusy(st->stats, bp->b_bcount, ((bp->b_flags & B_READ) == B_READ)); - #if NRND > 0 rnd_add_uint32(&st->rnd_source, bp->b_blkno); #endif diff --git a/sys/dev/sun/kbd.c b/sys/dev/sun/kbd.c index aed92bdde9c..677bc5baf21 100644 --- a/sys/dev/sun/kbd.c +++ b/sys/dev/sun/kbd.c @@ -1,4 +1,4 @@ -/* $NetBSD: kbd.c,v 1.55 2005/12/14 00:41:17 christos Exp $ */ +/* $NetBSD: kbd.c,v 1.56 2006/06/07 22:33:38 kardel Exp $ */ /* * Copyright (c) 1992, 1993 @@ -47,7 +47,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.55 2005/12/14 00:41:17 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.56 2006/06/07 22:33:38 kardel Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -794,7 +794,7 @@ kbd_input_event(struct kbd_softc *k, int code) fe->id = KEY_CODE(code); fe->value = KEY_UP(code) ? VKEY_UP : VKEY_DOWN; - fe->time = time; + getmicrotime(&fe->time); k->k_events.ev_put = put; EV_WAKEUP(&k->k_events); } diff --git a/sys/dev/sun/ms.c b/sys/dev/sun/ms.c index 4ded52beb3b..9dc617d8a50 100644 --- a/sys/dev/sun/ms.c +++ b/sys/dev/sun/ms.c @@ -1,4 +1,4 @@ -/* $NetBSD: ms.c,v 1.31 2006/03/10 20:25:45 macallan Exp $ */ +/* $NetBSD: ms.c,v 1.32 2006/06/07 22:33:38 kardel Exp $ */ /* * Copyright (c) 1992, 1993 @@ -52,7 +52,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ms.c,v 1.31 2006/03/10 20:25:45 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ms.c,v 1.32 2006/06/07 22:33:38 kardel Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -372,7 +372,7 @@ ms_input(ms, c) d = to_one[d - 1]; /* from 1..7 to {1,2,4} */ fe->id = to_id[d - 1]; /* from {1,2,4} to ID */ fe->value = mb & d ? VKEY_DOWN : VKEY_UP; - fe->time = time; + getmicrotime(&fe->time); ADVANCE; ub ^= d; } @@ -380,7 +380,7 @@ ms_input(ms, c) NEXT; fe->id = LOC_X_DELTA; fe->value = ms->ms_dx; - fe->time = time; + getmicrotime(&fe->time); ADVANCE; ms->ms_dx = 0; } @@ -388,7 +388,7 @@ ms_input(ms, c) NEXT; fe->id = LOC_Y_DELTA; fe->value = ms->ms_dy; - fe->time = time; + getmicrotime(&fe->time); ADVANCE; ms->ms_dy = 0; } diff --git a/sys/dev/wscons/wsevent.c b/sys/dev/wscons/wsevent.c index 0367ca08ca0..c116a8c56d8 100644 --- a/sys/dev/wscons/wsevent.c +++ b/sys/dev/wscons/wsevent.c @@ -1,4 +1,4 @@ -/* $NetBSD: wsevent.c,v 1.18 2006/02/07 09:13:02 jmmv Exp $ */ +/* $NetBSD: wsevent.c,v 1.19 2006/06/07 22:33:38 kardel Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -111,7 +111,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.18 2006/02/07 09:13:02 jmmv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.19 2006/06/07 22:33:38 kardel Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -339,7 +339,6 @@ int wsevent_inject(struct wseventvar *ev, struct wscons_event *events, size_t nevents) { - int oldspl; size_t avail, i; struct timespec t; @@ -355,9 +354,7 @@ wsevent_inject(struct wseventvar *ev, struct wscons_event *events, return ENOSPC; /* Use the current time for all events. */ - oldspl = splhigh(); - TIMEVAL_TO_TIMESPEC(&time, &t); - splx(oldspl); + getnanotime(&t); /* Inject the events. */ for (i = 0; i < nevents; i++) { |
