summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Soule Cheloha <cheloha@cvs.openbsd.org>2022-12-06 01:19:36 +0000
committerScott Soule Cheloha <cheloha@cvs.openbsd.org>2022-12-06 01:19:36 +0000
commit656d13ac36208edf9648baec945ce9b599abe4ab (patch)
tree348f312266d57d457d59ce85a87181b6281b77e0
parent3c2847bf0badabedcd7cd3a32c5f1026b2ecf603 (diff)
sh, landisk: switch to clockintr
Patch review and testing by miod@. Link: https://marc.info/?l=openbsd-tech&m=166776412003652&w=2 ok mlarkin@, probably ok miod@
-rw-r--r--sys/arch/sh/include/_types.h4
-rw-r--r--sys/arch/sh/include/cpu.h5
-rw-r--r--sys/arch/sh/sh/clock.c15
3 files changed, 18 insertions, 6 deletions
diff --git a/sys/arch/sh/include/_types.h b/sys/arch/sh/include/_types.h
index 208b3f44152..7a75ef6de95 100644
--- a/sys/arch/sh/include/_types.h
+++ b/sys/arch/sh/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.20 2018/03/05 01:15:25 deraadt Exp $ */
+/* $OpenBSD: _types.h,v 1.21 2022/12/06 01:19:35 cheloha Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -35,6 +35,8 @@
#ifndef _SH__TYPES_H_
#define _SH__TYPES_H_
+#define __HAVE_CLOCKINTR
+
#if defined(_KERNEL)
typedef struct label_t {
long val[9];
diff --git a/sys/arch/sh/include/cpu.h b/sys/arch/sh/include/cpu.h
index 08ee0b723c8..8bd445f1737 100644
--- a/sys/arch/sh/include/cpu.h
+++ b/sys/arch/sh/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.33 2022/02/21 10:44:58 jsg Exp $ */
+/* $OpenBSD: cpu.h,v 1.34 2022/12/06 01:19:35 cheloha Exp $ */
/* $NetBSD: cpu.h,v 1.41 2006/01/21 04:24:12 uwe Exp $ */
/*-
@@ -55,6 +55,7 @@
*/
#include <machine/intr.h>
+#include <sys/clockintr.h>
#include <sys/sched.h>
struct cpu_info {
@@ -71,6 +72,8 @@ struct cpu_info {
int ci_want_resched;
+ struct clockintr_queue ci_queue;
+
char ci_panicbuf[512];
};
diff --git a/sys/arch/sh/sh/clock.c b/sys/arch/sh/sh/clock.c
index f403f15c7a1..ea9cfa3de36 100644
--- a/sys/arch/sh/sh/clock.c
+++ b/sys/arch/sh/sh/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.11 2020/10/20 15:59:17 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.12 2022/12/06 01:19:35 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.32 2006/09/05 11:09:36 uwe Exp $ */
/*-
@@ -33,6 +33,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
+#include <sys/clockintr.h>
#include <sys/device.h>
#include <sys/timetc.h>
@@ -205,7 +206,7 @@ sh_clock_get_pclock(void)
void
setstatclockrate(int newhz)
{
- /* XXX not yet */
+ clockintr_setstatclockrate(newhz);
}
u_int
@@ -261,6 +262,12 @@ cpu_initclocks(void)
tick = 1000000 / hz;
tick_nsec = 1000000000 / hz;
+ stathz = hz;
+ profhz = stathz;
+ clockintr_init(0);
+
+ clockintr_cpu_init(NULL);
+
/*
* Use TMU channel 0 as hard clock
*/
@@ -332,7 +339,7 @@ sh3_clock_intr(void *arg) /* trap frame */
/* clear underflow status */
_reg_bclr_2(SH3_TCR0, TCR_UNF);
- hardclock(arg);
+ clockintr_dispatch(arg);
return (1);
}
@@ -353,7 +360,7 @@ sh4_clock_intr(void *arg) /* trap frame */
/* clear underflow status */
_reg_bclr_2(SH4_TCR0, TCR_UNF);
- hardclock(arg);
+ clockintr_dispatch(arg);
return (1);
}