-.\" $OpenBSD: tc_init.9,v 1.10 2023/01/17 10:10:11 jsg Exp $
+.\" $OpenBSD: tc_init.9,v 1.11 2023/02/04 19:19:36 cheloha Exp $
.\"
.\" Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
.\"
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: January 17 2023 $
+.Dd $Mdocdate: February 4 2023 $
.Dt TC_INIT 9
.Os
.Sh NAME
.Bd -literal -offset indent
struct timecounter {
timecounter_get_t *tc_get_timecount;
- timecounter_pps_t *tc_poll_pps;
u_int tc_counter_mask;
u_int64_t tc_frequency;
char *tc_name;
This function reads the counter.
It is not required to mask any unimplemented bits out, as long as they
are constant.
-.It Ft void Fn (*tc_poll_pps) "struct timecounter *"
-This function is optional and can be set to NULL.
-It will be called whenever the timecounter is rewound, and is intended
-to check for PPS events.
-Normal hardware does not need it but timecounters which latch PPS in
-hardware do.
.It Va tc_counter_mask
This mask should mask off any unimplemented bits.
.It Va tc_frequency
-/* $OpenBSD: clock.c,v 1.26 2022/12/10 15:02:29 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.27 2023/02/04 19:19:36 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.29 2000/06/05 21:47:10 thorpej Exp $ */
/*
u_int rpcc_get_timecount(struct timecounter *);
struct timecounter rpcc_timecounter = {
.tc_get_timecount = rpcc_get_timecount,
- .tc_poll_pps = NULL,
.tc_counter_mask = ~0u,
.tc_frequency = 0,
.tc_name = "rpcc",
-/* $OpenBSD: tsc.c,v 1.30 2022/10/24 00:56:33 cheloha Exp $ */
+/* $OpenBSD: tsc.c,v 1.31 2023/02/04 19:19:36 cheloha Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* Copyright (c) 2016,2017 Reyk Floeter <reyk@openbsd.org>
struct timecounter tsc_timecounter = {
.tc_get_timecount = tsc_get_timecount_lfence,
- .tc_poll_pps = NULL,
.tc_counter_mask = ~0u,
.tc_frequency = 0,
.tc_name = "tsc",
-/* $OpenBSD: clock.c,v 1.38 2022/11/08 17:34:13 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.39 2023/02/04 19:19:36 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.1 2003/04/26 18:39:50 fvdl Exp $ */
/*-
static struct timecounter i8254_timecounter = {
.tc_get_timecount = i8254_get_timecount,
- .tc_poll_pps = NULL,
.tc_counter_mask = ~0u,
.tc_frequency = TIMER_FREQ,
.tc_name = "i8254",
-/* $OpenBSD: agtimer.c,v 1.16 2023/01/17 02:58:22 cheloha Exp $ */
+/* $OpenBSD: agtimer.c,v 1.17 2023/02/04 19:19:36 cheloha Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Patrick Wildt <patrick@blueri.se>
static struct timecounter agtimer_timecounter = {
.tc_get_timecount = agtimer_get_timecount,
- .tc_poll_pps = NULL,
.tc_counter_mask = 0xffffffff,
.tc_frequency = 0,
.tc_name = "agtimer",
-/* $OpenBSD: amptimer.c,v 1.15 2023/01/17 02:47:55 cheloha Exp $ */
+/* $OpenBSD: amptimer.c,v 1.16 2023/02/04 19:19:36 cheloha Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
*
static struct timecounter amptimer_timecounter = {
.tc_get_timecount = amptimer_get_timecount,
- .tc_poll_pps = NULL,
.tc_counter_mask = 0xffffffff,
.tc_frequency = 0,
.tc_name = "amptimer",
-/* $OpenBSD: agtimer.c,v 1.21 2023/01/09 15:22:53 kettenis Exp $ */
+/* $OpenBSD: agtimer.c,v 1.22 2023/02/04 19:19:36 cheloha Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Patrick Wildt <patrick@blueri.se>
static struct timecounter agtimer_timecounter = {
.tc_get_timecount = agtimer_get_timecount_default,
- .tc_poll_pps = NULL,
.tc_counter_mask = 0xffffffff,
.tc_frequency = 0,
.tc_name = "agtimer",
-/* $OpenBSD: dmtimer.c,v 1.17 2023/01/27 22:16:52 cheloha Exp $ */
+/* $OpenBSD: dmtimer.c,v 1.18 2023/02/04 19:19:36 cheloha Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Raphael Graf <r@undefined.ch>
static struct timecounter dmtimer_timecounter = {
.tc_get_timecount = dmtimer_get_timecount,
- .tc_poll_pps = NULL,
.tc_counter_mask = 0xffffffff,
.tc_frequency = 0,
.tc_name = "dmtimer",
-/* $OpenBSD: gptimer.c,v 1.18 2023/01/25 14:14:39 cheloha Exp $ */
+/* $OpenBSD: gptimer.c,v 1.19 2023/02/04 19:19:36 cheloha Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
static struct timecounter gptimer_timecounter = {
.tc_get_timecount = gptimer_get_timecount,
- .tc_poll_pps = NULL,
.tc_counter_mask = 0xffffffff,
.tc_frequency = 0,
.tc_name = "gptimer",
-/* $OpenBSD: sxitimer.c,v 1.19 2023/01/17 02:38:59 cheloha Exp $ */
+/* $OpenBSD: sxitimer.c,v 1.20 2023/02/04 19:19:36 cheloha Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Raphael Graf <r@undefined.ch>
static struct timecounter sxitimer_timecounter = {
.tc_get_timecount = sxitimer_get_timecount,
- .tc_poll_pps = NULL,
.tc_counter_mask = 0xffffffff,
.tc_frequency = 0,
.tc_name = "sxitimer",
-/* $OpenBSD: clock.c,v 1.34 2023/01/20 17:18:08 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.35 2023/02/04 19:19:36 cheloha Exp $ */
/*
* Copyright (c) 1998-2003 Michael Shalayeff
struct timecounter itmr_timecounter = {
.tc_get_timecount = itmr_get_timecount,
- .tc_poll_pps = NULL,
.tc_counter_mask = 0xffffffff,
.tc_frequency = 0,
.tc_name = "itmr",
-/* $OpenBSD: clock.c,v 1.63 2023/01/30 10:49:05 jsg Exp $ */
+/* $OpenBSD: clock.c,v 1.64 2023/02/04 19:19:36 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.39 1996/05/12 23:11:54 mycroft Exp $ */
/*-
static struct timecounter i8254_timecounter = {
.tc_get_timecount = i8254_get_timecount,
- .tc_poll_pps = NULL,
.tc_counter_mask = ~0u,
.tc_frequency = TIMER_FREQ,
.tc_name = "i8254",
-/* $OpenBSD: geodesc.c,v 1.17 2022/02/21 10:24:28 mpi Exp $ */
+/* $OpenBSD: geodesc.c,v 1.18 2023/02/04 19:19:36 cheloha Exp $ */
/*
* Copyright (c) 2003 Markus Friedl <markus@openbsd.org>
struct timecounter geodesc_timecounter = {
.tc_get_timecount = geodesc_get_timecount,
- .tc_poll_pps = 0,
.tc_counter_mask = 0xffffffff,
.tc_frequency = 27000000,
.tc_name = "GEOTSC",
-/* $OpenBSD: gscpm.c,v 1.13 2022/02/21 10:24:28 mpi Exp $ */
+/* $OpenBSD: gscpm.c,v 1.14 2023/02/04 19:19:36 cheloha Exp $ */
/*
* Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
*
struct timecounter gscpm_timecounter = {
.tc_get_timecount = gscpm_get_timecount,
- .tc_poll_pps = 0,
.tc_counter_mask = 0xffffff,
.tc_frequency = 3579545,
.tc_name = "GSCPM",
-/* $OpenBSD: ichpcib.c,v 1.32 2023/01/30 10:49:05 jsg Exp $ */
+/* $OpenBSD: ichpcib.c,v 1.33 2023/02/04 19:19:36 cheloha Exp $ */
/*
* Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
*
struct timecounter ichpcib_timecounter = {
.tc_get_timecount = ichpcib_get_timecount,
- .tc_poll_pps = 0,
.tc_counter_mask = 0xffffff,
.tc_frequency = 3579545,
.tc_name = "ICHPM",
-/* $OpenBSD: generic3a_machdep.c,v 1.11 2021/07/24 08:21:13 visa Exp $ */
+/* $OpenBSD: generic3a_machdep.c,v 1.12 2023/02/04 19:19:36 cheloha Exp $ */
/*
* Copyright (c) 2009, 2010, 2012 Miodrag Vallat.
struct timecounter rs780e_timecounter = {
.tc_get_timecount = rs780e_get_timecount,
- .tc_poll_pps = NULL,
.tc_counter_mask = 0xffffffffu, /* truncated to 32 bits */
.tc_frequency = HPET_FREQ,
.tc_name = "hpet",
-/* $OpenBSD: clock.c,v 1.52 2023/01/27 22:13:48 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.53 2023/02/04 19:19:36 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.1 1996/09/30 16:34:40 ws Exp $ */
/*
static struct timecounter tb_timecounter = {
.tc_get_timecount = tb_get_timecount,
- .tc_poll_pps = NULL,
.tc_counter_mask = 0xffffffff,
.tc_frequency = 0,
.tc_name = "tb",
-/* $OpenBSD: mips64_machdep.c,v 1.40 2022/11/19 16:23:48 cheloha Exp $ */
+/* $OpenBSD: mips64_machdep.c,v 1.41 2023/02/04 19:19:36 cheloha Exp $ */
/*
* Copyright (c) 2009, 2010, 2012 Miodrag Vallat.
struct timecounter cp0_timecounter = {
.tc_get_timecount = cp0_get_timecount,
- .tc_poll_pps = 0,
.tc_counter_mask = 0xffffffff,
.tc_frequency = 0,
.tc_name = "CP0",
-/* $OpenBSD: machdep.c,v 1.135 2023/01/11 03:20:52 visa Exp $ */
+/* $OpenBSD: machdep.c,v 1.136 2023/02/04 19:19:36 cheloha Exp $ */
/*
* Copyright (c) 2009, 2010 Miodrag Vallat.
struct timecounter ioclock_timecounter = {
.tc_get_timecount = ioclock_get_timecount,
- .tc_poll_pps = NULL,
.tc_counter_mask = 0xffffffff, /* truncated to 32 bits */
.tc_frequency = 0, /* determined at runtime */
.tc_name = "ioclock",
-/* $OpenBSD: clock.c,v 1.8 2023/01/27 22:14:43 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.9 2023/02/04 19:19:36 cheloha Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
static struct timecounter tb_timecounter = {
.tc_get_timecount = tb_get_timecount,
- .tc_poll_pps = NULL,
.tc_counter_mask = 0xffffffff,
.tc_frequency = 0,
.tc_name = "tb",
-/* $OpenBSD: clock.c,v 1.8 2023/01/27 15:37:16 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.9 2023/02/04 19:19:37 cheloha Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
static struct timecounter tb_timecounter = {
.tc_get_timecount = tb_get_timecount,
- .tc_poll_pps = NULL,
.tc_counter_mask = 0xffffffff,
.tc_frequency = 0,
.tc_name = "tb",
-/* $OpenBSD: psycho.c,v 1.81 2022/10/16 01:22:39 jsg Exp $ */
+/* $OpenBSD: psycho.c,v 1.82 2023/02/04 19:19:37 cheloha Exp $ */
/* $NetBSD: psycho.c,v 1.39 2001/10/07 20:30:41 eeh Exp $ */
/*
struct timecounter stick_timecounter = {
.tc_get_timecount = stick_get_timecount,
- .tc_poll_pps = NULL,
.tc_counter_mask = ~0u,
.tc_frequency = 0,
.tc_name = "stick",
-/* $OpenBSD: clock.c,v 1.75 2023/01/13 03:22:18 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.76 2023/02/04 19:19:37 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.41 2001/07/24 19:29:25 eeh Exp $ */
/*
struct timecounter tick_timecounter = {
.tc_get_timecount = tick_get_timecount,
- .tc_poll_pps = NULL,
.tc_counter_mask = ~0u,
.tc_frequency = 0,
.tc_name = "tick",
struct timecounter sys_tick_timecounter = {
.tc_get_timecount = sys_tick_get_timecount,
- .tc_poll_pps = NULL,
.tc_counter_mask = ~0u,
.tc_frequency = 0,
.tc_name = "sys_tick",
-/* $OpenBSD: acpihpet.c,v 1.30 2022/11/08 14:54:47 cheloha Exp $ */
+/* $OpenBSD: acpihpet.c,v 1.31 2023/02/04 19:19:37 cheloha Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
static struct timecounter hpet_timecounter = {
.tc_get_timecount = acpihpet_gettime,
- .tc_poll_pps = 0,
.tc_counter_mask = 0xffffffff,
.tc_frequency = 0,
.tc_name = 0,
-/* $OpenBSD: acpitimer.c,v 1.16 2022/08/25 17:43:34 cheloha Exp $ */
+/* $OpenBSD: acpitimer.c,v 1.17 2023/02/04 19:19:37 cheloha Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
static struct timecounter acpi_timecounter = {
.tc_get_timecount = acpi_get_timecount,
- .tc_poll_pps = 0,
.tc_counter_mask = 0x00ffffff, /* 24 bits */
.tc_frequency = ACPI_FREQUENCY,
.tc_name = 0,
-/* $OpenBSD: amdpm.c,v 1.38 2022/03/11 18:00:45 mpi Exp $ */
+/* $OpenBSD: amdpm.c,v 1.39 2023/02/04 19:19:37 cheloha Exp $ */
/*
* Copyright (c) 2006 Alexander Yurchenko <grange@openbsd.org>
static struct timecounter amdpm_timecounter = {
.tc_get_timecount = amdpm_get_timecount,
- .tc_poll_pps = 0,
.tc_counter_mask = 0xffffff,
.tc_frequency = AMDPM_FREQUENCY,
.tc_name = "AMDPM",
-/* $OpenBSD: viapm.c,v 1.21 2022/03/11 18:00:52 mpi Exp $ */
+/* $OpenBSD: viapm.c,v 1.22 2023/02/04 19:19:37 cheloha Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis <kettenis@openbsd.org>
static struct timecounter viapm_timecounter = {
.tc_get_timecount = viapm_get_timecount,
- .tc_poll_pps = 0,
.tc_counter_mask = 0xffffff,
.tc_frequency = VIAPM_FREQUENCY,
.tc_name = "VIAPM",
struct timecounter hv_timecounter = {
.tc_get_timecount = hv_gettime,
- .tc_poll_pps = 0,
.tc_counter_mask = 0xffffffff,
.tc_frequency = 10000000,
.tc_name = "hyperv",
-/* $OpenBSD: pvclock.c,v 1.8 2021/11/05 11:38:29 mpi Exp $ */
+/* $OpenBSD: pvclock.c,v 1.9 2023/02/04 19:19:37 cheloha Exp $ */
/*
* Copyright (c) 2018 Reyk Floeter <reyk@openbsd.org>
struct timecounter pvclock_timecounter = {
.tc_get_timecount = pvclock_get_timecount,
- .tc_poll_pps = NULL,
.tc_counter_mask = ~0u,
.tc_frequency = 0,
.tc_name = NULL,
-/* $OpenBSD: kern_tc.c,v 1.81 2022/12/13 17:30:36 cheloha Exp $ */
+/* $OpenBSD: kern_tc.c,v 1.82 2023/02/04 19:19:36 cheloha Exp $ */
/*
* Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
static struct timecounter dummy_timecounter = {
.tc_get_timecount = dummy_get_timecount,
- .tc_poll_pps = NULL,
.tc_counter_mask = ~0u,
.tc_frequency = 1000000,
.tc_name = "dummy",
th->th_offset = *new_offset;
}
-#ifdef notyet
- /*
- * Hardware latching timecounters may not generate interrupts on
- * PPS events, so instead we poll them. There is a finite risk that
- * the hardware might capture a count which is later than the one we
- * got above, and therefore possibly in the next NTP second which might
- * have a different rate than the current NTP second. It doesn't
- * matter in practice.
- */
- if (tho->th_counter->tc_poll_pps)
- tho->th_counter->tc_poll_pps(tho->th_counter);
-#endif
-
/*
* If changing the boot time or clock adjustment, do so before
* NTP processing.
-/* $OpenBSD: timetc.h,v 1.13 2022/08/12 02:20:36 cheloha Exp $ */
+/* $OpenBSD: timetc.h,v 1.14 2023/02/04 19:19:35 cheloha Exp $ */
/*
* Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
struct timecounter;
typedef u_int timecounter_get_t(struct timecounter *);
-typedef void timecounter_pps_t(struct timecounter *);
/*
* Locks used to protect struct members in this file:
* mask any unimplemented bits out, as long as they are
* constant.
*/
- timecounter_pps_t *tc_poll_pps; /* [I] */
- /*
- * This function is optional. It will be called whenever the
- * timecounter is rewound, and is intended to check for PPS
- * events. Normal hardware does not need it but timecounters
- * which latch PPS in hardware (like sys/pci/xrpu.c) do.
- */
u_int tc_counter_mask; /* [I] */
/* This mask should mask off any unimplemented bits. */
u_int64_t tc_frequency; /* [I] */