From: cheloha Date: Tue, 6 Dec 2022 01:19:35 +0000 (+0000) Subject: sh, landisk: switch to clockintr X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a2953de374c0861047d84c6d3ba4d0a7fbfd2cf8;p=openbsd 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@ --- 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 +#include #include 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 #include #include +#include #include #include @@ -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); }