Module Name: src
Committed By: thorpej
Date: Mon Jan 15 00:35:24 UTC 2024
Modified Files:
src/sys/arch/news68k/conf: files.news68k
src/sys/arch/news68k/dev: timer_hb.c
src/sys/arch/news68k/include: cpu.h intr.h types.h vectors.h
src/sys/arch/news68k/news68k: genassym.cf isr.h locore.s
Removed Files:
src/sys/arch/news68k/news68k: isr.c
Log Message:
Switch news68k over to the common interrupt dispatch code.
To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/news68k/conf/files.news68k
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/news68k/dev/timer_hb.c
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/news68k/include/cpu.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/news68k/include/intr.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/news68k/include/types.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/news68k/include/vectors.h
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/news68k/news68k/genassym.cf
cvs rdiff -u -r1.25 -r0 src/sys/arch/news68k/news68k/isr.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/news68k/news68k/isr.h
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/news68k/news68k/locore.s
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/news68k/conf/files.news68k
diff -u src/sys/arch/news68k/conf/files.news68k:1.38 src/sys/arch/news68k/conf/files.news68k:1.39
--- src/sys/arch/news68k/conf/files.news68k:1.38 Sat Jan 13 23:59:47 2024
+++ src/sys/arch/news68k/conf/files.news68k Mon Jan 15 00:35:23 2024
@@ -1,4 +1,4 @@
-# $NetBSD: files.news68k,v 1.38 2024/01/13 23:59:47 thorpej Exp $
+# $NetBSD: files.news68k,v 1.39 2024/01/15 00:35:23 thorpej Exp $
# NEWS68K-specific configuration info
@@ -15,7 +15,6 @@ file arch/news68k/news68k/bus_space.c
#file arch/news68k/news68k/cons_machdep.c
file arch/news68k/news68k/clock.c
file arch/news68k/news68k/disksubr.c disk
-file arch/news68k/news68k/isr.c
file arch/news68k/news68k/machdep.c
file arch/news68k/news68k/mainbus.c
file arch/news68k/news68k/pmap_bootstrap.c compile-with "${NOPROF_C}"
@@ -24,6 +23,8 @@ file arch/news68k/news68k/trap.c
file arch/m68k/m68k/cacheops.c
file arch/m68k/m68k/db_memrw.c ddb | kgdb
file arch/m68k/m68k/kgdb_machdep.c kgdb
+file arch/m68k/m68k/m68k_intr.c
+file arch/m68k/m68k/m68k_intr_stubs.s
file arch/m68k/m68k/m68k_trap.c
file arch/m68k/m68k/mmu_subr.s
file arch/m68k/m68k/pmap_motorola.c
Index: src/sys/arch/news68k/dev/timer_hb.c
diff -u src/sys/arch/news68k/dev/timer_hb.c:1.19 src/sys/arch/news68k/dev/timer_hb.c:1.20
--- src/sys/arch/news68k/dev/timer_hb.c:1.19 Tue Nov 22 14:31:02 2011
+++ src/sys/arch/news68k/dev/timer_hb.c Mon Jan 15 00:35:23 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: timer_hb.c,v 1.19 2011/11/22 14:31:02 tsutsui Exp $ */
+/* $NetBSD: timer_hb.c,v 1.20 2024/01/15 00:35:23 thorpej Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: timer_hb.c,v 1.19 2011/11/22 14:31:02 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: timer_hb.c,v 1.20 2024/01/15 00:35:23 thorpej Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: timer_hb.c,v
#include <machine/cpu.h>
#include <machine/bus.h>
+#include <machine/vectors.h>
#include <dev/clock_subr.h>
@@ -62,7 +63,7 @@ __KERNEL_RCSID(0, "$NetBSD: timer_hb.c,v
static int timer_hb_match(device_t, cfdata_t, void *);
static void timer_hb_attach(device_t, device_t, void *);
static void timer_hb_initclocks(int, int);
-void clock_intr(struct clockframe *);
+void clock_intr(struct clockframe);
static inline void leds_intr(void);
@@ -113,7 +114,7 @@ timer_hb_attach(device_t parent, device_
timer_config(timer_hb_initclocks);
#if 0 /* XXX this will be done in timer_hb_initclocks() */
- isrlink_custom(ha->ha_ipl, (void *)_isr_clock);
+ vec_set_entry(VECI_INTRAV0 + ha->ha_ipl, _isr_clock);
#endif
}
@@ -130,7 +131,7 @@ timer_hb_initclocks(int prof, int stat)
s = splhigh();
/* Install isr (in locore.s) that calls clock_intr(). */
- isrlink_custom(TIMER_LEVEL, (void *)_isr_clock);
+ vec_set_entry(VECI_INTRAV0 + TIMER_LEVEL, _isr_clock);
/* enable the clock */
*ctrl_timer = 1;
@@ -144,7 +145,7 @@ timer_hb_initclocks(int prof, int stat)
* from sun3/sun3x/clock.c -tsutsui
*/
void
-clock_intr(struct clockframe *cf)
+clock_intr(struct clockframe cf)
{
#ifdef LED_IDLE_CHECK
extern char _Idle[]; /* locore.s */
@@ -162,7 +163,7 @@ clock_intr(struct clockframe *cf)
leds_intr();
/* Call common clock interrupt handler. */
- hardclock(cf);
+ hardclock(&cf);
curcpu()->ci_data.cpu_nintr++;
}
Index: src/sys/arch/news68k/include/cpu.h
diff -u src/sys/arch/news68k/include/cpu.h:1.49 src/sys/arch/news68k/include/cpu.h:1.50
--- src/sys/arch/news68k/include/cpu.h:1.49 Sat Jan 13 23:59:47 2024
+++ src/sys/arch/news68k/include/cpu.h Mon Jan 15 00:35:23 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.49 2024/01/13 23:59:47 thorpej Exp $ */
+/* $NetBSD: cpu.h,v 1.50 2024/01/15 00:35:23 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -80,19 +80,20 @@
/*
* Arguments to hardclock and gatherstats encapsulate the previous
* machine state in an opaque clockframe. On the news68k, we use
- * what the hardware pushes on an interrupt (frame format 0).
+ * what the locore.s glue puts on the stack before calling C-code.
*/
struct clockframe {
- u_short sr; /* sr at time of interrupt */
- u_long pc; /* pc at time of interrupt */
- u_short vo; /* vector offset (4-word frame) */
-};
+ u_int cf_regs[4]; /* d0,d1,a0,a1 */
+ u_short cf_sr; /* sr at time of interrupt */
+ u_long cf_pc; /* pc at time of interrupt */
+ u_short cf_vo; /* vector offset (4-word frame) */
+} __attribute__((packed));
-#define CLKF_USERMODE(framep) (((framep)->sr & PSL_S) == 0)
-#define CLKF_PC(framep) ((framep)->pc)
+#define CLKF_USERMODE(framep) (((framep)->cf_sr & PSL_S) == 0)
+#define CLKF_PC(framep) ((framep)->cf_pc)
#if 0
/* We would like to do it this way... */
-#define CLKF_INTR(framep) (((framep)->sr & PSL_M) == 0)
+#define CLKF_INTR(framep) (((framep)->cf_sr & PSL_M) == 0)
#else
/* but until we start using PSL_M, we have to do this instead */
#include <machine/intr.h>
Index: src/sys/arch/news68k/include/intr.h
diff -u src/sys/arch/news68k/include/intr.h:1.28 src/sys/arch/news68k/include/intr.h:1.29
--- src/sys/arch/news68k/include/intr.h:1.28 Tue Jul 11 11:09:13 2023
+++ src/sys/arch/news68k/include/intr.h Mon Jan 15 00:35:23 2024
@@ -1,11 +1,11 @@
-/* $NetBSD: intr.h,v 1.28 2023/07/11 11:09:13 riastradh Exp $ */
+/* $NetBSD: intr.h,v 1.29 2024/01/15 00:35:23 thorpej Exp $ */
/*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * Copyright (c) 2024 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
- * by Minoura Makoto and Jason R. Thorpe.
+ * by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,81 +30,17 @@
*/
#ifndef _NEWS68K_INTR_H_
-#define _NEWS68K_INTR_H_
+#define _NEWS68K_INTR_H_
-#include <sys/types.h>
+#include <m68k/psl.h>
-#include <sys/evcnt.h>
-#include <sys/queue.h>
-#include <sys/stdbool.h>
+#define MACHINE_PSL_IPL_SOFTCLOCK PSL_IPL2
+#define MACHINE_PSL_IPL_SOFTBIO PSL_IPL2
+#define MACHINE_PSL_IPL_SOFTNET PSL_IPL2
+#define MACHINE_PSL_IPL_SOFTSERIAL PSL_IPL2
+#define MACHINE_PSL_IPL_VM PSL_IPL5
+#define MACHINE_PSL_IPL_SCHED PSL_IPL7
-#include <machine/psl.h>
+#include <m68k/intr.h>
-#include <m68k/asm_single.h>
-
-#define IPL_NONE 0
-#define IPL_SOFTCLOCK 1
-#define IPL_SOFTBIO 2
-#define IPL_SOFTNET 3
-#define IPL_SOFTSERIAL 4
-#define IPL_VM 5
-#define IPL_SCHED 6
-#define IPL_HIGH 7
-#define NIPL 8
-
-extern int idepth;
-
-static __inline bool
-cpu_intr_p(void)
-{
-
- return idepth != 0;
-}
-
-extern const uint16_t ipl2psl_table[NIPL];
-
-typedef int ipl_t;
-typedef struct {
- uint16_t _psl;
-} ipl_cookie_t;
-
-#ifdef _KERNEL
-
-static __inline ipl_cookie_t
-makeiplcookie(ipl_t ipl)
-{
-
- return (ipl_cookie_t){._psl = ipl2psl_table[ipl]};
-}
-
-static __inline int
-splraiseipl(ipl_cookie_t icookie)
-{
-
- return _splraise(icookie._psl);
-}
-
-static __inline void
-splx(int sr)
-{
-
- __asm volatile("movw %0,%%sr" : : "di" (sr));
-}
-
-/*
- * news68k can handle software interrupts by its own hardware
- * so has no need to check for any simulated interrupts, etc.
- */
-#define spl0() _spl0()
-
-#define splsoftbio() splraise2()
-#define splsoftclock() splraise2()
-#define splsoftnet() splraise2()
-#define splsoftserial() splraise2()
-#define splvm() splraise5()
-#define splhigh() spl7()
-#define splsched() spl7()
-
-#endif
-
-#endif /* _NEWS68K_INTR_H_ */
+#endif /* _NEWS68K_INTR_H_ */
Index: src/sys/arch/news68k/include/types.h
diff -u src/sys/arch/news68k/include/types.h:1.13 src/sys/arch/news68k/include/types.h:1.14
--- src/sys/arch/news68k/include/types.h:1.13 Thu Apr 1 04:43:00 2021
+++ src/sys/arch/news68k/include/types.h Mon Jan 15 00:35:23 2024
@@ -1,6 +1,7 @@
-/* $NetBSD: types.h,v 1.13 2021/04/01 04:43:00 simonb Exp $ */
+/* $NetBSD: types.h,v 1.14 2024/01/15 00:35:23 thorpej Exp $ */
#include <m68k/types.h>
#define __HAVE_LEGACY_INTRCNT
#define __HAVE_MM_MD_KERNACC
+#define __HAVE_M68K_INTR_VECTORED
Index: src/sys/arch/news68k/include/vectors.h
diff -u src/sys/arch/news68k/include/vectors.h:1.1 src/sys/arch/news68k/include/vectors.h:1.2
--- src/sys/arch/news68k/include/vectors.h:1.1 Sat Jan 13 23:59:47 2024
+++ src/sys/arch/news68k/include/vectors.h Mon Jan 15 00:35:23 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: vectors.h,v 1.1 2024/01/13 23:59:47 thorpej Exp $ */
+/* $NetBSD: vectors.h,v 1.2 2024/01/15 00:35:23 thorpej Exp $ */
/*-
* Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -38,12 +38,12 @@
#define MACHINE_AV0_HANDLER spurintr
#define MACHINE_AV1_HANDLER lev1intr
-#define MACHINE_AV2_HANDLER intrhand_autovec
+#define MACHINE_AV2_HANDLER intrstub_autovec
#define MACHINE_AV3_HANDLER lev3intr
#define MACHINE_AV4_HANDLER lev4intr
-#define MACHINE_AV5_HANDLER intrhand_autovec
-#define MACHINE_AV6_HANDLER intrhand_autovec
-#define MACHINE_AV7_HANDLER intrhand_autovec
+#define MACHINE_AV5_HANDLER intrstub_autovec
+#define MACHINE_AV6_HANDLER intrstub_autovec
+#define MACHINE_AV7_HANDLER intrstub_autovec
#endif /* _KERNEL */
Index: src/sys/arch/news68k/news68k/genassym.cf
diff -u src/sys/arch/news68k/news68k/genassym.cf:1.34 src/sys/arch/news68k/news68k/genassym.cf:1.35
--- src/sys/arch/news68k/news68k/genassym.cf:1.34 Tue Jan 9 04:16:26 2024
+++ src/sys/arch/news68k/news68k/genassym.cf Mon Jan 15 00:35:24 2024
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.34 2024/01/09 04:16:26 thorpej Exp $
+# $NetBSD: genassym.cf,v 1.35 2024/01/15 00:35:24 thorpej Exp $
#
# Copyright (c) 1982, 1990, 1993
@@ -74,6 +74,8 @@ endif
define M68K_MMU_MOTOROLA 1
+define __HAVE_M68K_INTR_VECTORED 1
+
# values for fputype
define FPU_NONE FPU_NONE
define FPU_68881 FPU_68881
Index: src/sys/arch/news68k/news68k/isr.h
diff -u src/sys/arch/news68k/news68k/isr.h:1.9 src/sys/arch/news68k/news68k/isr.h:1.10
--- src/sys/arch/news68k/news68k/isr.h:1.9 Sun Jan 14 23:01:43 2024
+++ src/sys/arch/news68k/news68k/isr.h Mon Jan 15 00:35:24 2024
@@ -1,7 +1,7 @@
-/* $NetBSD: isr.h,v 1.9 2024/01/14 23:01:43 thorpej Exp $ */
+/* $NetBSD: isr.h,v 1.10 2024/01/15 00:35:24 thorpej Exp $ */
/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
+ * Copyright (c) 2004 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -29,35 +29,40 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/queue.h>
+#ifndef _NEWS68k_ISR_H_
+#define _NEWS68k_ISR_H_
+
+#include <sys/intr.h>
/*
- * Autovectored interrupt handler cookie.
+ * Aliases for the legacy news68k ISR routines.
*/
-struct isr_autovec {
- LIST_ENTRY(isr_autovec) isr_link;
- int (*isr_func)(void *);
- void *isr_arg;
- int isr_ipl;
- int isr_priority;
-};
-typedef LIST_HEAD(, isr_autovec) isr_autovec_list_t;
+static inline void
+isrinit(void)
+{
+ m68k_intr_init(NULL);
+}
+
+static inline void
+isrlink_autovec(int (*func)(void *), void *arg, int ipl, int isrpri)
+{
+ /* XXX leaks interrupt handle. */
+ m68k_intr_establish(func, arg, NULL, 0, ipl, isrpri, 0);
+}
+
+static inline void
+isrlink_vectored(int (*func)(void *), void *arg, int ipl, int vec)
+{
+ /* XXX leaks interrupt handle. */
+ m68k_intr_establish(func, arg, NULL, vec, ipl, 0, 0);
+}
+
+static inline void
+isrunlink_vectored(int vec)
+{
+ /* XXX isrlink_*() functions should return handle. */
+ panic("isrunlink_vectored");
+}
-/*
- * Vectored interrupt handler cookie. The handler may request to
- * receive the exception frame as an argument by specifying NULL
- * when establishing the interrupt.
- */
-struct isr_vectored {
- int (*isr_func)(void *);
- void *isr_arg;
- int isr_ipl;
-};
-
-void isrinit(void);
-void isrlink_autovec(int (*)(void *), void *, int, int);
-void isrlink_vectored(int (*)(void *), void *, int, int);
-void isrunlink_vectored(int);
-void isrdispatch_autovec(int);
-void isrdispatch_vectored(int, int, void *);
+#endif /* _NEWS68k_ISR_H_ */
Index: src/sys/arch/news68k/news68k/locore.s
diff -u src/sys/arch/news68k/news68k/locore.s:1.79 src/sys/arch/news68k/news68k/locore.s:1.80
--- src/sys/arch/news68k/news68k/locore.s:1.79 Sat Jan 13 23:59:47 2024
+++ src/sys/arch/news68k/news68k/locore.s Mon Jan 15 00:35:24 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.79 2024/01/13 23:59:47 thorpej Exp $ */
+/* $NetBSD: locore.s,v 1.80 2024/01/15 00:35:24 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -649,19 +649,6 @@ Lbrkpt3:
/*
* Interrupt handlers.
- *
- * For auto-vectored interrupts, the CPU provides the
- * vector 0x18+level. Note we count spurious interrupts,
- * but don't do anything else with them.
- *
- * _intrhand_autovec is the entry point for auto-vectored
- * interrupts.
- *
- * For vectored interrupts, we pull the pc, evec, and exception frame
- * and pass them to the vectored interrupt dispatcher. The vectored
- * interrupt dispatcher will deal with strays.
- *
- * _intrhand_vectored is the entry point for vectored interrupts.
*/
ENTRY_NOPROFILE(spurintr) /* Level 0 */
@@ -671,17 +658,6 @@ ENTRY_NOPROFILE(spurintr) /* Level 0 */
INTERRUPT_RESTOREREG
rte
-ENTRY_NOPROFILE(intrhand_autovec) /* Levels 1 through 6 */
- addql #1,_C_LABEL(idepth)
- INTERRUPT_SAVEREG
- movw %sp@(22),%sp@- | push exception vector
- clrw %sp@-
- jbsr _C_LABEL(isrdispatch_autovec) | call dispatcher
- addql #4,%sp
- INTERRUPT_RESTOREREG
- subql #1,_C_LABEL(idepth)
- rte
-
ENTRY_NOPROFILE(lev1intr) /* Level 1: AST interrupt */
addql #1,_C_LABEL(idepth)
INTERRUPT_SAVEREG
@@ -717,23 +693,10 @@ ENTRY_NOPROFILE(lev4intr) /* Level 4: s
subql #1,_C_LABEL(idepth)
rte
-#if 0
-ENTRY_NOPROFILE(lev5intr) /* Level 5: kb, ms (zs is vectored) */
- addql #1,_C_LABEL(idepth)
- INTERRUPT_SAVEREG
- jbsr _C_LABEL(intrhand_lev5)
- INTERRUPT_RESTOREREG
- subql #1,_C_LABEL(idepth)
- rte
-#endif
-
ENTRY_NOPROFILE(_isr_clock) /* Level 6: clock (see clock_hb.c) */
addql #1,_C_LABEL(idepth)
INTERRUPT_SAVEREG
- lea %sp@(16),%a1
- movl %a1,%sp@-
jbsr _C_LABEL(clock_intr)
- addql #4,%sp
INTERRUPT_RESTOREREG
subql #1,_C_LABEL(idepth)
rte
@@ -753,20 +716,6 @@ ENTRY_NOPROFILE(lev7intr) /* Level 7: N
rte
#endif
-ENTRY_NOPROFILE(intrhand_vectored)
- addql #1,_C_LABEL(idepth)
- INTERRUPT_SAVEREG
- lea %sp@(16),%a1 | get pointer to frame
- movl %a1,%sp@-
- movw %sp@(26),%d0
- movl %d0,%sp@- | push exception vector info
- movl %sp@(26),%sp@- | and PC
- jbsr _C_LABEL(isrdispatch_vectored) | call dispatcher
- lea %sp@(12),%sp | pop value args
- INTERRUPT_RESTOREREG
- subql #1,_C_LABEL(idepth)
- rte
-
/*
* Emulation of VAX REI instruction.
*