Module Name: src
Committed By: thorpej
Date: Mon Jan 15 02:16:52 UTC 2024
Modified Files:
src/sys/arch/luna68k/conf: files.luna68k
src/sys/arch/luna68k/include: cpu.h intr.h vectors.h
src/sys/arch/luna68k/luna68k: isr.h locore.s
Removed Files:
src/sys/arch/luna68k/luna68k: isr.c
Log Message:
Switch luna68k over to the common interrupt dispatch code.
To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/luna68k/conf/files.luna68k
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/luna68k/include/cpu.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/luna68k/include/intr.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/include/vectors.h
cvs rdiff -u -r1.27 -r0 src/sys/arch/luna68k/luna68k/isr.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/luna68k/luna68k/isr.h
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/luna68k/luna68k/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/luna68k/conf/files.luna68k
diff -u src/sys/arch/luna68k/conf/files.luna68k:1.33 src/sys/arch/luna68k/conf/files.luna68k:1.34
--- src/sys/arch/luna68k/conf/files.luna68k:1.33 Sun Jan 14 00:17:46 2024
+++ src/sys/arch/luna68k/conf/files.luna68k Mon Jan 15 02:16:52 2024
@@ -1,5 +1,5 @@
#
-# $NetBSD: files.luna68k,v 1.33 2024/01/14 00:17:46 thorpej Exp $
+# $NetBSD: files.luna68k,v 1.34 2024/01/15 02:16:52 thorpej Exp $
#
maxpartitions 8
maxusers 2 8 64
@@ -10,7 +10,6 @@ defflag PANICBUTTON
file arch/luna68k/luna68k/autoconf.c
file arch/luna68k/luna68k/clock.c
file arch/luna68k/luna68k/disksubr.c
-file arch/luna68k/luna68k/isr.c
file arch/luna68k/luna68k/machdep.c
file arch/luna68k/luna68k/pmap_bootstrap.c
file arch/luna68k/luna68k/trap.c
@@ -18,6 +17,8 @@ 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/fpu.c compile-with "${M68K_KERN_FPU}"
+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/luna68k/include/cpu.h
diff -u src/sys/arch/luna68k/include/cpu.h:1.39 src/sys/arch/luna68k/include/cpu.h:1.40
--- src/sys/arch/luna68k/include/cpu.h:1.39 Tue Jan 9 04:16:25 2024
+++ src/sys/arch/luna68k/include/cpu.h Mon Jan 15 02:16:52 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.39 2024/01/09 04:16:25 thorpej Exp $ */
+/* $NetBSD: cpu.h,v 1.40 2024/01/15 02:16:52 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -57,19 +57,20 @@
/*
* Arguments to hardclock and gatherstats encapsulate the previous
* machine state in an opaque clockframe. On the luna68k, 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 */
#define CLKF_INTR(framep) (0) /* XXX */
Index: src/sys/arch/luna68k/include/intr.h
diff -u src/sys/arch/luna68k/include/intr.h:1.16 src/sys/arch/luna68k/include/intr.h:1.17
--- src/sys/arch/luna68k/include/intr.h:1.16 Tue Jul 11 11:06:04 2023
+++ src/sys/arch/luna68k/include/intr.h Mon Jan 15 02:16:52 2024
@@ -1,11 +1,11 @@
-/* $NetBSD: intr.h,v 1.16 2023/07/11 11:06:04 riastradh Exp $ */
+/* $NetBSD: intr.h,v 1.17 2024/01/15 02:16:52 thorpej Exp $ */
/*-
- * Copyright (c) 2000 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 Tohru Nishimura.
+ * by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,67 +29,18 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef _MACHINE_INTR_H
-#define _MACHINE_INTR_H
+#ifndef _LUNA68K_INTR_H_
+#define _LUNA68K_INTR_H_
-#if defined(_KERNEL) || defined(_KMEMUSER)
-typedef struct {
- uint16_t _psl;
-} ipl_cookie_t;
-#endif
+#include <m68k/psl.h>
-#ifdef _KERNEL
+#define MACHINE_PSL_IPL_SOFTCLOCK PSL_IPL1
+#define MACHINE_PSL_IPL_SOFTBIO PSL_IPL1
+#define MACHINE_PSL_IPL_SOFTNET PSL_IPL1
+#define MACHINE_PSL_IPL_SOFTSERIAL PSL_IPL1
+#define MACHINE_PSL_IPL_VM PSL_IPL4
+#define MACHINE_PSL_IPL_SCHED PSL_IPL5
-/*
- * spl functions
- */
-#include <machine/psl.h>
-
-#define spl0() _spl0()
-#define splnone() spl0()
-#define splsoftclock() splraise1()
-#define splsoftbio() splraise1()
-#define splsoftnet() splraise1()
-#define splsoftserial() splraise1()
-#define splvm() splraise4()
-#define splsched() splraise5()
-#define splhigh() spl7()
-
-#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 const uint16_t ipl2psl_table[NIPL];
-
-typedef int ipl_t;
-
-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("movew %0,%%sr" : : "di" (sr));
-}
-
-#endif /* _KERNEL */
+#include <m68k/intr.h>
-#endif /* _MACHINE_INTR_H */
+#endif /* _LUNA68K_INTR_H */
Index: src/sys/arch/luna68k/include/vectors.h
diff -u src/sys/arch/luna68k/include/vectors.h:1.1 src/sys/arch/luna68k/include/vectors.h:1.2
--- src/sys/arch/luna68k/include/vectors.h:1.1 Sun Jan 14 00:17:46 2024
+++ src/sys/arch/luna68k/include/vectors.h Mon Jan 15 02:16:52 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: vectors.h,v 1.1 2024/01/14 00:17:46 thorpej Exp $ */
+/* $NetBSD: vectors.h,v 1.2 2024/01/15 02:16:52 thorpej Exp $ */
/*-
* Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -37,12 +37,12 @@
#include <m68k/vectors.h>
#define MACHINE_AV0_HANDLER spurintr
-#define MACHINE_AV1_HANDLER intrhand_autovec
-#define MACHINE_AV2_HANDLER intrhand_autovec
-#define MACHINE_AV3_HANDLER intrhand_autovec
-#define MACHINE_AV4_HANDLER intrhand_autovec
+#define MACHINE_AV1_HANDLER intrstub_autovec
+#define MACHINE_AV2_HANDLER intrstub_autovec
+#define MACHINE_AV3_HANDLER intrstub_autovec
+#define MACHINE_AV4_HANDLER intrstub_autovec
#define MACHINE_AV5_HANDLER lev5intr
-#define MACHINE_AV6_HANDLER intrhand_autovec
+#define MACHINE_AV6_HANDLER intrstub_autovec
#define MACHINE_AV7_HANDLER lev7intr
#endif /* _KERNEL */
Index: src/sys/arch/luna68k/luna68k/isr.h
diff -u src/sys/arch/luna68k/luna68k/isr.h:1.5 src/sys/arch/luna68k/luna68k/isr.h:1.6
--- src/sys/arch/luna68k/luna68k/isr.h:1.5 Sun Jan 14 00:17:46 2024
+++ src/sys/arch/luna68k/luna68k/isr.h Mon Jan 15 02:16:52 2024
@@ -1,7 +1,7 @@
-/* $NetBSD: isr.h,v 1.5 2024/01/14 00:17:46 thorpej Exp $ */
+/* $NetBSD: isr.h,v 1.6 2024/01/15 02:16:52 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,54 +29,26 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/queue.h>
+#ifndef _LUNA68K_ISR_H_
+#define _LUNA68K_ISR_H_
-/*
- * The location and size of the autovectored interrupt portion
- * of the vector table.
- */
-#define ISRAUTOVEC 0x18
-#define NISRAUTOVEC 8
-
-/*
- * The location and size of the vectored interrupt portion
- * of the vector table.
- */
-#define ISRVECTORED 0x40
-#define NISRVECTORED 192
+#include <sys/intr.h>
/*
- * Autovectored interrupt handler cookie.
+ * Aliases for the legacy luna68k 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);
+}
-/*
- * 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;
-};
-
-/*
- * Autovectored ISR priorities. These are not the same as interrupt levels.
- */
-#define ISRPRI_BIO 0
-#define ISRPRI_NET 1
-#define ISRPRI_TTY 2
-#define ISRPRI_TTYNOBUF 3
-
-void isrinit(void);
-void isrlink_autovec(int (*)(void *), void *, int, int);
-void isrdispatch_autovec(int);
+#endif /* _LUNA68K_ISR_H_ */
Index: src/sys/arch/luna68k/luna68k/locore.s
diff -u src/sys/arch/luna68k/luna68k/locore.s:1.76 src/sys/arch/luna68k/luna68k/locore.s:1.77
--- src/sys/arch/luna68k/luna68k/locore.s:1.76 Sun Jan 14 00:17:46 2024
+++ src/sys/arch/luna68k/luna68k/locore.s Mon Jan 15 02:16:52 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.76 2024/01/14 00:17:46 thorpej Exp $ */
+/* $NetBSD: locore.s,v 1.77 2024/01/15 02:16:52 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -552,17 +552,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.
*/
ENTRY_NOPROFILE(spurintr) /* Level 0 */
@@ -572,15 +561,6 @@ ENTRY_NOPROFILE(spurintr) /* Level 0 */
INTERRUPT_RESTOREREG
jra _ASM_LABEL(rei)
-ENTRY_NOPROFILE(intrhand_autovec) /* Levels 1 through 6 */
- INTERRUPT_SAVEREG
- movw %sp@(22),%sp@- | push exception vector
- clrw %sp@-
- jbsr _C_LABEL(isrdispatch_autovec) | call dispatcher
- addql #4,%sp
- INTERRUPT_RESTOREREG
- jra _ASM_LABEL(rei) | all done
-
ENTRY_NOPROFILE(lev7intr) /* Level 7: NMI */
addql #1,_C_LABEL(intrcnt)+32
clrl %sp@-
@@ -603,7 +583,7 @@ ENTRY_NOPROFILE(lev5intr)
tstl _C_LABEL(clock_enable) | is hardclock() available?
jeq 1f
INTERRUPT_SAVEREG
- lea %sp@(16),%a1 | %a1 = &clockframe
+ lea %sp@(0),%a1 | %a1 = &clockframe
movl %a1,%sp@-
jbsr _C_LABEL(hardclock) | hardclock(&frame)
addql #4,%sp
@@ -616,7 +596,7 @@ ENTRY_NOPROFILE(lev5intr)
| XP device has also lev5 intr,
| routing to autovec
subql #1,_C_LABEL(idepth)
- jbra _ASM_LABEL(intrhand_autovec)
+ jbra _C_LABEL(intrstub_autovec)
#endif
/*