-/* $OpenBSD: clock.c,v 1.15 2020/07/06 13:33:07 pirofti Exp $ */
+/* $OpenBSD: clock.c,v 1.16 2022/12/06 00:56:52 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.2 2000/01/11 10:29:35 nisimura Exp $ */
/*
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/clockintr.h>
#include <sys/device.h>
#include <sys/kernel.h>
#include <sys/evcount.h>
};
/*
- * Start the real-time and statistics clocks. Leave stathz 0 since there
- * are no other timers available.
+ * Start the real-time and statistics clocks.
*/
void
cpu_initclocks()
#endif
tick = 1000000 / hz; /* number of microseconds between interrupts */
+ tick_nsec = 1000000000 / hz;
+
clock_tc.tc_frequency = hz;
tc_init(&clock_tc);
+
+ stathz = hz;
+ profhz = stathz;
+ clockintr_init(0);
+
+ clockintr_cpu_init(NULL);
+
clockinitted = 1;
rtc_todr.todr_gettime = rtc_gettime;
todr_handle = &rtc_todr;
}
-/*
- * We assume newhz is either stathz or profhz, and that neither will
- * change after being set up above. Could recalculate intervals here
- * but that would be a drag.
- */
void
setstatclockrate(int newhz)
{
- /* nothing we can do */
+ clockintr_setstatclockrate(newhz);
}
/*
*(volatile uint32_t *)(ci->ci_clock_ack) = ~0;
if (clockinitted)
- hardclock(eframe);
+ clockintr_dispatch(eframe);
return 1;
}
-/* $OpenBSD: machdep.c,v 1.140 2022/10/25 11:39:33 aoyama Exp $ */
+/* $OpenBSD: machdep.c,v 1.141 2022/12/06 00:56:52 cheloha Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
+#include <sys/clockintr.h>
#include <sys/proc.h>
#include <sys/user.h>
#include <sys/buf.h>
set_vbr(kernel_vbr);
+ clockintr_cpu_init(NULL);
+
spl0();
SCHED_LOCK(s);
set_psr(get_psr() & ~PSR_IND);
-/* $OpenBSD: _types.h,v 1.18 2018/03/05 01:15:25 deraadt Exp $ */
+/* $OpenBSD: _types.h,v 1.19 2022/12/06 00:56:52 cheloha Exp $ */
/*-
* Copyright (c) 1990, 1993
#ifndef _M88K__TYPES_H_
#define _M88K__TYPES_H_
+#define __HAVE_CLOCKINTR
+
#if defined(_KERNEL)
typedef struct label_t {
long val[19];
-/* $OpenBSD: cpu.h,v 1.70 2021/07/06 09:34:06 kettenis Exp $ */
+/* $OpenBSD: cpu.h,v 1.71 2022/12/06 00:56:52 cheloha Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
* Copyright (c) 1992, 1993
#include <machine/pcb.h>
#include <machine/psl.h>
#include <machine/intr.h>
+#include <sys/clockintr.h>
#include <sys/queue.h>
#include <sys/sched.h>
#include <sys/srp.h>
#ifdef GPROF
struct gmonparam *ci_gmon;
#endif
+ struct clockintr_queue ci_queue;
char ci_panicbuf[512];
};