This patch switches luna88k to clockintr(9).

We have no control over the interrupt clock on luna88k so the patch
is pretty simple.

aoyama@ has built a release and upgraded from the resulting bsd.rd on
his LUNA-88K2.

A test on a different machine might help.  Not sure how many there
are.

Index: sys/arch/luna88k/luna88k/clock.c
===================================================================
RCS file: /cvs/src/sys/arch/luna88k/luna88k/clock.c,v
retrieving revision 1.15
diff -u -p -r1.15 clock.c
--- sys/arch/luna88k/luna88k/clock.c    6 Jul 2020 13:33:07 -0000       1.15
+++ sys/arch/luna88k/luna88k/clock.c    6 Nov 2022 18:59:28 -0000
@@ -47,6 +47,7 @@
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/clockintr.h>
 #include <sys/device.h>
 #include <sys/kernel.h>
 #include <sys/evcount.h>
@@ -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;
 }
 
Index: sys/arch/luna88k/luna88k/machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/luna88k/luna88k/machdep.c,v
retrieving revision 1.140
diff -u -p -r1.140 machdep.c
--- sys/arch/luna88k/luna88k/machdep.c  25 Oct 2022 11:39:33 -0000      1.140
+++ sys/arch/luna88k/luna88k/machdep.c  6 Nov 2022 18:59:28 -0000
@@ -60,6 +60,7 @@
 #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>
@@ -778,6 +779,8 @@ secondary_main()
        __cpu_simple_unlock(&cpu_boot_mutex);
 
        set_vbr(kernel_vbr);
+
+       clockintr_cpu_init(NULL);
 
        spl0();
        SCHED_LOCK(s);
Index: sys/arch/m88k/include/cpu.h
===================================================================
RCS file: /cvs/src/sys/arch/m88k/include/cpu.h,v
retrieving revision 1.70
diff -u -p -r1.70 cpu.h
--- sys/arch/m88k/include/cpu.h 6 Jul 2021 09:34:06 -0000       1.70
+++ sys/arch/m88k/include/cpu.h 6 Nov 2022 18:59:28 -0000
@@ -60,6 +60,7 @@
 #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>
@@ -177,6 +178,7 @@ struct cpu_info {
 #ifdef GPROF
        struct gmonparam *ci_gmon;
 #endif
+       struct clockintr_queue ci_queue;
        char             ci_panicbuf[512];
 };
 
Index: sys/arch/m88k/include/_types.h
===================================================================
RCS file: /cvs/src/sys/arch/m88k/include/_types.h,v
retrieving revision 1.18
diff -u -p -r1.18 _types.h
--- sys/arch/m88k/include/_types.h      5 Mar 2018 01:15:25 -0000       1.18
+++ sys/arch/m88k/include/_types.h      6 Nov 2022 18:59:28 -0000
@@ -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];

Reply via email to