diff options
| author | joerg <joerg@NetBSD.org> | 2008-01-20 18:09:03 +0000 |
|---|---|---|
| committer | joerg <joerg@NetBSD.org> | 2008-01-20 18:09:03 +0000 |
| commit | 3615cf77159918b7f0f329fe9bd331e3ebdced7d (patch) | |
| tree | 22973ad9165e64bd43f42f088fc6f91ebe013a06 /sys/dev | |
| parent | eb444c6f8554c82b259e7c89caa6aa6b2f24aac7 (diff) | |
Now that __HAVE_TIMECOUNTER and __HAVE_GENERIC_TODR are invariants,
remove the conditionals and the code associated with the undef case.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/acpi/acpi_timer.c | 20 | ||||
| -rw-r--r-- | sys/dev/ic/acpipmtimer.c | 8 | ||||
| -rw-r--r-- | sys/dev/ic/com.c | 188 | ||||
| -rw-r--r-- | sys/dev/ic/comvar.h | 11 | ||||
| -rw-r--r-- | sys/dev/ic/z8530tty.c | 205 | ||||
| -rw-r--r-- | sys/dev/ppbus/pps_ppbus.c | 91 |
6 files changed, 12 insertions, 511 deletions
diff --git a/sys/dev/acpi/acpi_timer.c b/sys/dev/acpi/acpi_timer.c index 02862da730a..493809a408f 100644 --- a/sys/dev/acpi/acpi_timer.c +++ b/sys/dev/acpi/acpi_timer.c @@ -1,17 +1,14 @@ -/* $NetBSD: acpi_timer.c,v 1.9 2007/09/26 19:48:45 ad Exp $ */ +/* $NetBSD: acpi_timer.c,v 1.10 2008/01/20 18:09:10 joerg Exp $ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: acpi_timer.c,v 1.9 2007/09/26 19:48:45 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_timer.c,v 1.10 2008/01/20 18:09:10 joerg Exp $"); #include <sys/types.h> -#include <dev/acpi/acpi_timer.h> - -#ifdef __HAVE_TIMECOUNTER - #include <sys/systm.h> #include <sys/time.h> #include <sys/timetc.h> #include <dev/acpi/acpica.h> +#include <dev/acpi/acpi_timer.h> static int acpitimer_test(void); static uint32_t acpitimer_delta(uint32_t, uint32_t); @@ -133,14 +130,3 @@ acpitimer_test() return (n); } - -#else - -int -acpitimer_init() -{ - - return (0); -} - -#endif diff --git a/sys/dev/ic/acpipmtimer.c b/sys/dev/ic/acpipmtimer.c index 4aeff06bf70..d7942b0aafb 100644 --- a/sys/dev/ic/acpipmtimer.c +++ b/sys/dev/ic/acpipmtimer.c @@ -1,12 +1,10 @@ -/* $NetBSD: acpipmtimer.c,v 1.4 2007/10/19 11:59:44 ad Exp $ */ +/* $NetBSD: acpipmtimer.c,v 1.5 2008/01/20 18:09:10 joerg Exp $ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: acpipmtimer.c,v 1.4 2007/10/19 11:59:44 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpipmtimer.c,v 1.5 2008/01/20 18:09:10 joerg Exp $"); #include <sys/types.h> -#ifdef __HAVE_TIMECOUNTER - #include <sys/systm.h> #include <sys/device.h> #include <sys/malloc.h> @@ -89,5 +87,3 @@ acpihwtimer_read_fast(struct timecounter *tc) return r(h); } - -#endif diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index c0376119cbc..ccc2dc556b6 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1,4 +1,4 @@ -/* $NetBSD: com.c,v 1.269 2008/01/05 12:44:13 ad Exp $ */ +/* $NetBSD: com.c,v 1.270 2008/01/20 18:09:10 joerg Exp $ */ /*- * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc. @@ -73,7 +73,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.269 2008/01/05 12:44:13 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.270 2008/01/20 18:09:10 joerg Exp $"); #include "opt_com.h" #include "opt_ddb.h" @@ -228,14 +228,6 @@ 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 */ - #ifdef KGDB #include <sys/kgdb.h> @@ -685,12 +677,6 @@ 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 * notice even if we immediately open the port again. @@ -793,14 +779,9 @@ comopen(dev_t dev, int flag, int mode, struct lwp *l) sc->sc_msr = CSR_READ_1(&sc->sc_regs, COM_REG_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 */ mutex_spin_exit(&sc->sc_lock); @@ -1023,7 +1004,6 @@ comioctl(dev_t dev, u_long cmd, void *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: @@ -1035,103 +1015,8 @@ comioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l) #endif error = pps_ioctl(cmd, data, &sc->sc_pps_state); break; -#else /* !__HAVE_TIMECOUNTER */ - case PPS_IOC_CREATE: - break; - - case PPS_IOC_DESTROY: - break; - - case PPS_IOC_GETPARAMS: { - pps_params_t *pp; - pp = (pps_params_t *)data; - *pp = sc->ppsparam; - break; - } - - case PPS_IOC_SETPARAMS: { - pps_params_t *pp; - int mode; - pp = (pps_params_t *)data; - if (pp->mode & ~ppscap) { - error = EINVAL; - break; - } - sc->ppsparam = *pp; - /* - * Compute msr masks from user-specified timestamp state. - */ - mode = sc->ppsparam.mode; - switch (mode & PPS_CAPTUREBOTH) { - case 0: - sc->sc_ppsmask = 0; - break; - - case PPS_CAPTUREASSERT: - sc->sc_ppsmask = MSR_DCD; - sc->sc_ppsassert = MSR_DCD; - sc->sc_ppsclear = -1; - break; - - case PPS_CAPTURECLEAR: - sc->sc_ppsmask = MSR_DCD; - sc->sc_ppsassert = -1; - sc->sc_ppsclear = 0; - break; - - case PPS_CAPTUREBOTH: - sc->sc_ppsmask = MSR_DCD; - sc->sc_ppsassert = MSR_DCD; - sc->sc_ppsclear = 0; - break; - - default: - error = EINVAL; - break; - } - break; - } - - case PPS_IOC_GETCAP: - *(int*)data = ppscap; - break; - - case PPS_IOC_FETCH: { - pps_info_t *pi; - pi = (pps_info_t *)data; - *pi = sc->ppsinfo; - break; - } - -#ifdef PPS_SYNC - case PPS_IOC_KCBIND: { - int edge = (*(int *)data) & PPS_CAPTUREBOTH; - - if (edge == 0) { - /* - * remove binding for this source; ignore - * the request if this is not the current - * hardpps source - */ - if (pps_kc_hardpps_source == sc) { - pps_kc_hardpps_source = NULL; - pps_kc_hardpps_mode = 0; - } - } else { - /* - * bind hardpps to this source, replacing any - * previously specified source or edges - */ - pps_kc_hardpps_source = sc; - pps_kc_hardpps_mode = edge; - } - 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); @@ -1139,25 +1024,6 @@ comioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l) 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. - * The old API has no way to specify PPS polarity. - */ - sc->sc_ppsmask = MSR_DCD; -#ifndef PPS_TRAILING_EDGE - sc->sc_ppsassert = MSR_DCD; - sc->sc_ppsclear = -1; - TIMESPEC_TO_TIMEVAL((struct timeval *)data, - &sc->ppsinfo.assert_timestamp); -#else - sc->sc_ppsassert = -1; - sc->sc_ppsclear = 0; - TIMESPEC_TO_TIMEVAL((struct timeval *)data, - &sc->ppsinfo.clear_timestamp); -#endif -#endif /* !__HAVE_TIMECOUNTER */ break; default: @@ -2014,7 +1880,6 @@ again: do { msr = CSR_READ_1(regsp, COM_REG_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); @@ -2023,55 +1888,6 @@ again: do { 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. - */ - if (delta & sc->sc_ppsmask) { - struct timeval tv; - if ((msr & sc->sc_ppsmask) == sc->sc_ppsassert) { - /* XXX nanotime() */ - microtime(&tv); - TIMEVAL_TO_TIMESPEC(&tv, - &sc->ppsinfo.assert_timestamp); - if (sc->ppsparam.mode & PPS_OFFSETASSERT) { - timespecadd(&sc->ppsinfo.assert_timestamp, - &sc->ppsparam.assert_offset, - &sc->ppsinfo.assert_timestamp); - } - -#ifdef PPS_SYNC - if (pps_kc_hardpps_source == sc && - pps_kc_hardpps_mode & PPS_CAPTUREASSERT) { - hardpps(&tv, tv.tv_usec); - } -#endif - sc->ppsinfo.assert_sequence++; - sc->ppsinfo.current_mode = sc->ppsparam.mode; - - } else if ((msr & sc->sc_ppsmask) == sc->sc_ppsclear) { - /* XXX nanotime() */ - microtime(&tv); - TIMEVAL_TO_TIMESPEC(&tv, - &sc->ppsinfo.clear_timestamp); - if (sc->ppsparam.mode & PPS_OFFSETCLEAR) { - timespecadd(&sc->ppsinfo.clear_timestamp, - &sc->ppsparam.clear_offset, - &sc->ppsinfo.clear_timestamp); - } - -#ifdef PPS_SYNC - if (pps_kc_hardpps_source == sc && - pps_kc_hardpps_mode & PPS_CAPTURECLEAR) { - hardpps(&tv, tv.tv_usec); - } -#endif - sc->ppsinfo.clear_sequence++; - 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 f959edfbc19..5c617bce852 100644 --- a/sys/dev/ic/comvar.h +++ b/sys/dev/ic/comvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: comvar.h,v 1.58 2007/12/14 03:36:55 dyoung Exp $ */ +/* $NetBSD: comvar.h,v 1.59 2008/01/20 18:09:11 joerg Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -206,16 +206,7 @@ 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/z8530tty.c b/sys/dev/ic/z8530tty.c index d52664eb49c..191629e3f3c 100644 --- a/sys/dev/ic/z8530tty.c +++ b/sys/dev/ic/z8530tty.c @@ -1,4 +1,4 @@ -/* $NetBSD: z8530tty.c,v 1.119 2007/12/22 15:45:15 ad Exp $ */ +/* $NetBSD: z8530tty.c,v 1.120 2008/01/20 18:09:11 joerg 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.119 2007/12/22 15:45:15 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: z8530tty.c,v 1.120 2008/01/20 18:09:11 joerg Exp $"); #include "opt_kgdb.h" #include "opt_ntp.h" @@ -184,14 +184,6 @@ 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 */ struct tty *zst_tty; @@ -239,14 +231,7 @@ 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. */ @@ -510,12 +495,6 @@ 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 * notice even if we immediately open the port again. @@ -631,13 +610,9 @@ 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 */ mutex_spin_exit(&cs->cs_lock); @@ -848,7 +823,6 @@ 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: @@ -864,129 +838,12 @@ zsioctl(dev, cmd, data, flag, l) else zst->zst_ppsmask = 0; break; -#else /* !__HAVE_TIMECOUNTER */ - case PPS_IOC_CREATE: - break; - - case PPS_IOC_DESTROY: - break; - - case PPS_IOC_GETPARAMS: { - pps_params_t *pp; - pp = (pps_params_t *)data; - *pp = zst->ppsparam; - break; - } - - case PPS_IOC_SETPARAMS: { - pps_params_t *pp; - int mode; - if (cs->cs_rr0_pps == 0) { - error = EINVAL; - break; - } - pp = (pps_params_t *)data; - if (pp->mode & ~zsppscap) { - error = EINVAL; - break; - } - zst->ppsparam = *pp; - /* - * compute masks from user-specified timestamp state. - */ - mode = zst->ppsparam.mode; - switch (mode & PPS_CAPTUREBOTH) { - case 0: - zst->zst_ppsmask = 0; - break; - - case PPS_CAPTUREASSERT: - zst->zst_ppsmask = ZSRR0_DCD; - zst->zst_ppsassert = ZSRR0_DCD; - zst->zst_ppsclear = -1; - break; - - case PPS_CAPTURECLEAR: - zst->zst_ppsmask = ZSRR0_DCD; - zst->zst_ppsassert = -1; - zst->zst_ppsclear = 0; - break; - - case PPS_CAPTUREBOTH: - zst->zst_ppsmask = ZSRR0_DCD; - zst->zst_ppsassert = ZSRR0_DCD; - zst->zst_ppsclear = 0; - break; - - default: - error = EINVAL; - break; - } - - /* - * Now update interrupts. - */ - zs_maskintr(zst); - /* - * If nothing is being transmitted, set up new current values, - * else mark them as pending. - */ - if (!cs->cs_heldchange) { - if (zst->zst_tx_busy) { - zst->zst_heldtbc = zst->zst_tbc; - zst->zst_tbc = 0; - cs->cs_heldchange = 1; - } else - zs_loadchannelregs(cs); - } - - break; - } - - case PPS_IOC_GETCAP: - *(int *)data = zsppscap; - break; - - case PPS_IOC_FETCH: { - pps_info_t *pi; - pi = (pps_info_t *)data; - *pi = zst->ppsinfo; - break; - } - -#ifdef PPS_SYNC - case PPS_IOC_KCBIND: { - int edge = (*(int *)data) & PPS_CAPTUREBOTH; - - if (edge == 0) { - /* - * remove binding for this source; ignore - * the request if this is not the current - * hardpps source - */ - if (pps_kc_hardpps_source == zst) { - pps_kc_hardpps_source = NULL; - pps_kc_hardpps_mode = 0; - } - } else { - /* - * bind hardpps to this source, replacing any - * previously specified source or edges - */ - pps_kc_hardpps_source = zst; - pps_kc_hardpps_mode = edge; - } - 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; } -#ifdef __HAVE_TIMECOUNTER #ifndef PPS_TRAILING_EDGE TIMESPEC_TO_TIMEVAL((struct timeval *)data, &zst->zst_pps_state.ppsinfo.assert_timestamp); @@ -994,20 +851,6 @@ zsioctl(dev, cmd, data, flag, l) 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; - zst->zst_ppsclear = -1; - TIMESPEC_TO_TIMEVAL((struct timeval *)data, - &zst->ppsinfo.assert_timestamp); -#else - zst->zst_ppsassert = -1; - zst->zst_ppsclear = 01; - TIMESPEC_TO_TIMEVAL((struct timeval *)data, - &zst->ppsinfo.clear_timestamp); -#endif -#endif /* !__HAVE_TIMECOUNTER */ /* * Now update interrupts. */ @@ -1659,7 +1502,6 @@ 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, @@ -1667,49 +1509,6 @@ zstty_stint(cs, force) ? PPS_CAPTUREASSERT : PPS_CAPTURECLEAR); } -#else /* !__HAVE_TIMECOUNTER */ - struct timeval tv; - if (ISSET(rr0, zst->zst_ppsmask) == zst->zst_ppsassert) { - /* XXX nanotime() */ - microtime(&tv); - TIMEVAL_TO_TIMESPEC(&tv, - &zst->ppsinfo.assert_timestamp); - if (zst->ppsparam.mode & PPS_OFFSETASSERT) { - timespecadd(&zst->ppsinfo.assert_timestamp, - &zst->ppsparam.assert_offset, - &zst->ppsinfo.assert_timestamp); - } - -#ifdef PPS_SYNC - if (pps_kc_hardpps_source == zst && - pps_kc_hardpps_mode & PPS_CAPTUREASSERT) { - hardpps(&tv, tv.tv_usec); - } -#endif - zst->ppsinfo.assert_sequence++; - zst->ppsinfo.current_mode = zst->ppsparam.mode; - } else if (ISSET(rr0, zst->zst_ppsmask) == - zst->zst_ppsclear) { - /* XXX nanotime() */ - microtime(&tv); - TIMEVAL_TO_TIMESPEC(&tv, - &zst->ppsinfo.clear_timestamp); - if (zst->ppsparam.mode & PPS_OFFSETCLEAR) { - timespecadd(&zst->ppsinfo.clear_timestamp, - &zst->ppsparam.clear_offset, - &zst->ppsinfo.clear_timestamp); - } - -#ifdef PPS_SYNC - if (pps_kc_hardpps_source == zst && - pps_kc_hardpps_mode & PPS_CAPTURECLEAR) { - hardpps(&tv, tv.tv_usec); - } -#endif - zst->ppsinfo.clear_sequence++; - zst->ppsinfo.current_mode = zst->ppsparam.mode; - } -#endif /* !__HAVE_TIMECOUNTER */ } /* diff --git a/sys/dev/ppbus/pps_ppbus.c b/sys/dev/ppbus/pps_ppbus.c index e19124d9ae0..f227e297e45 100644 --- a/sys/dev/ppbus/pps_ppbus.c +++ b/sys/dev/ppbus/pps_ppbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: pps_ppbus.c,v 1.9 2007/03/04 06:02:28 christos Exp $ */ +/* $NetBSD: pps_ppbus.c,v 1.10 2008/01/20 18:09:11 joerg Exp $ */ /* * ported to timecounters by Frank Kardel 2006 @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pps_ppbus.c,v 1.9 2007/03/04 06:02:28 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pps_ppbus.c,v 1.10 2008/01/20 18:09:11 joerg Exp $"); #include "opt_ntp.h" @@ -49,15 +49,7 @@ 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 *); @@ -76,10 +68,6 @@ 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) { @@ -133,11 +121,9 @@ 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); @@ -150,14 +136,7 @@ ppsclose(dev_t dev, int flags, int fmt, struct lwp *l) struct device *ppbus = sc->ppbus; 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); @@ -173,17 +152,12 @@ 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); @@ -191,21 +165,6 @@ ppsintr(void *arg) 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) { - timespecadd(&sc->ppsinfo.assert_timestamp, - &sc->ppsparam.assert_offset, - &sc->ppsinfo.assert_timestamp); - } -#ifdef PPS_SYNC - if (sc->hardpps) - hardpps(&tv, tv.tv_usec); -#endif - sc->ppsinfo.assert_sequence++; - sc->ppsinfo.current_mode = sc->ppsparam.mode; -#endif /* !__HAVE_TIMECOUNTER */ } static int @@ -215,7 +174,6 @@ ppsioctl(dev_t dev, u_long cmd, void *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: @@ -227,51 +185,6 @@ ppsioctl(dev_t dev, u_long cmd, void *data, int flags, struct lwp *l) #endif error = pps_ioctl(cmd, data, &sc->pps_state); break; -#else /* !__HAVE_TIMECOUNTER */ - case PPS_IOC_CREATE: - break; - - case PPS_IOC_DESTROY: - break; - - case PPS_IOC_GETPARAMS: { - pps_params_t *pp; - pp = (pps_params_t *)data; - *pp = sc->ppsparam; - break; - } - - case PPS_IOC_SETPARAMS: { - pps_params_t *pp; - pp = (pps_params_t *)data; - if (pp->mode & ~(ppscap)) { - error = EINVAL; - break; - } - sc->ppsparam = *pp; - break; - } - - case PPS_IOC_GETCAP: - *(int*)data = ppscap; - break; - - case PPS_IOC_FETCH: { - pps_info_t *pi; - pi = (pps_info_t *)data; - *pi = sc->ppsinfo; - break; - } - -#ifdef PPS_SYNC - case PPS_IOC_KCBIND: - if (*(int *)data & PPS_CAPTUREASSERT) - sc->hardpps = 1; - else - sc->hardpps = 0; - break; -#endif -#endif /* !__HAVE_TIMECOUNTER */ default: error = EPASSTHROUGH; |
