From: cheloha Date: Tue, 6 Dec 2022 00:56:52 +0000 (+0000) Subject: m88k, luna88k: switch to clockintr X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=882ee9bc19bba83b0ea7438031d363e9b3f54cdc;p=openbsd m88k, luna88k: switch to clockintr - Initialize tick_nsec during cpu_initclocks() We have no control over the interrupt clock on luna88k, so this switch is trivial. Bringup help and testing from aoyama@ and miod@. Link: https://marc.info/?l=openbsd-tech&m=166776371203450&w=2 ok aoyama@ mlarkin@ --- diff --git a/sys/arch/luna88k/luna88k/clock.c b/sys/arch/luna88k/luna88k/clock.c index 97138a03097..2a298aea4c3 100644 --- a/sys/arch/luna88k/luna88k/clock.c +++ b/sys/arch/luna88k/luna88k/clock.c @@ -1,4 +1,4 @@ -/* $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 $ */ /* @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -118,8 +119,7 @@ struct timecounter clock_tc = { }; /* - * 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() @@ -131,8 +131,17 @@ 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; @@ -140,15 +149,10 @@ cpu_initclocks() 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); } /* @@ -166,7 +170,7 @@ clockintr(void *eframe) *(volatile uint32_t *)(ci->ci_clock_ack) = ~0; if (clockinitted) - hardclock(eframe); + clockintr_dispatch(eframe); return 1; } diff --git a/sys/arch/luna88k/luna88k/machdep.c b/sys/arch/luna88k/luna88k/machdep.c index e2f6350e7b0..371342f1e2c 100644 --- a/sys/arch/luna88k/luna88k/machdep.c +++ b/sys/arch/luna88k/luna88k/machdep.c @@ -1,4 +1,4 @@ -/* $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 @@ -60,6 +60,7 @@ #include #include #include +#include #include #include #include @@ -779,6 +780,8 @@ secondary_main() set_vbr(kernel_vbr); + clockintr_cpu_init(NULL); + spl0(); SCHED_LOCK(s); set_psr(get_psr() & ~PSR_IND); diff --git a/sys/arch/m88k/include/_types.h b/sys/arch/m88k/include/_types.h index 51c0b829132..5527be96aa6 100644 --- a/sys/arch/m88k/include/_types.h +++ b/sys/arch/m88k/include/_types.h @@ -1,4 +1,4 @@ -/* $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 @@ -35,6 +35,8 @@ #ifndef _M88K__TYPES_H_ #define _M88K__TYPES_H_ +#define __HAVE_CLOCKINTR + #if defined(_KERNEL) typedef struct label_t { long val[19]; diff --git a/sys/arch/m88k/include/cpu.h b/sys/arch/m88k/include/cpu.h index 8b0c30b6ba0..2b313e6b80f 100644 --- a/sys/arch/m88k/include/cpu.h +++ b/sys/arch/m88k/include/cpu.h @@ -1,4 +1,4 @@ -/* $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 @@ -60,6 +60,7 @@ #include #include #include +#include #include #include #include @@ -177,6 +178,7 @@ struct cpu_info { #ifdef GPROF struct gmonparam *ci_gmon; #endif + struct clockintr_queue ci_queue; char ci_panicbuf[512]; };