Module Name: src
Committed By: thorpej
Date: Tue Jan 16 01:26:34 UTC 2024
Modified Files:
src/sys/arch/mvme68k/conf: files.mvme68k
src/sys/arch/mvme68k/include: cpu.h intr.h types.h vectors.h
src/sys/arch/mvme68k/mvme68k: genassym.cf isr.h locore.s machdep.c
trap.c
Removed Files:
src/sys/arch/mvme68k/mvme68k: isr.c
Log Message:
Switch mvme68k over to the common interrupt dispatch code and G/C
__HAVE_LEGACY_INTRCNT.
To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/mvme68k/conf/files.mvme68k
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/mvme68k/include/cpu.h
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/mvme68k/include/intr.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/mvme68k/include/types.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mvme68k/include/vectors.h
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/mvme68k/mvme68k/genassym.cf
cvs rdiff -u -r1.36 -r0 src/sys/arch/mvme68k/mvme68k/isr.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mvme68k/mvme68k/isr.h
cvs rdiff -u -r1.126 -r1.127 src/sys/arch/mvme68k/mvme68k/locore.s
cvs rdiff -u -r1.162 -r1.163 src/sys/arch/mvme68k/mvme68k/machdep.c
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/mvme68k/mvme68k/trap.c
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/mvme68k/conf/files.mvme68k
diff -u src/sys/arch/mvme68k/conf/files.mvme68k:1.67 src/sys/arch/mvme68k/conf/files.mvme68k:1.68
--- src/sys/arch/mvme68k/conf/files.mvme68k:1.67 Sat Jan 13 20:18:46 2024
+++ src/sys/arch/mvme68k/conf/files.mvme68k Tue Jan 16 01:26:34 2024
@@ -1,4 +1,4 @@
-# $NetBSD: files.mvme68k,v 1.67 2024/01/13 20:18:46 thorpej Exp $
+# $NetBSD: files.mvme68k,v 1.68 2024/01/16 01:26:34 thorpej Exp $
# config file for mvme68k
@@ -91,13 +91,14 @@ file arch/mvme68k/mvme68k/bus_space.c
file arch/mvme68k/mvme68k/clock.c
file arch/mvme68k/mvme68k/conf.c
file arch/mvme68k/mvme68k/disksubr.c
-file arch/mvme68k/mvme68k/isr.c
file arch/mvme68k/mvme68k/machdep.c
file arch/mvme68k/mvme68k/pmap_bootstrap.c compile-with "${NOPROF_C}"
file arch/mvme68k/mvme68k/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/mvme68k/include/cpu.h
diff -u src/sys/arch/mvme68k/include/cpu.h:1.52 src/sys/arch/mvme68k/include/cpu.h:1.53
--- src/sys/arch/mvme68k/include/cpu.h:1.52 Tue Jan 9 04:16:26 2024
+++ src/sys/arch/mvme68k/include/cpu.h Tue Jan 16 01:26:34 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.52 2024/01/09 04:16:26 thorpej Exp $ */
+/* $NetBSD: cpu.h,v 1.53 2024/01/16 01:26:34 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -60,17 +60,17 @@
/*
* Arguments to hardclock and gatherstats encapsulate the previous
* machine state in an opaque clockframe. On the mvme68k, 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 fmt:4,
- vec:12; /* 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)
/*
* The clock interrupt handler can determine if it's a nested
@@ -78,8 +78,7 @@ struct clockframe {
* (Remember, the clock interrupt handler itself will cause the
* depth counter to be incremented).
*/
-extern volatile unsigned int interrupt_depth;
-#define CLKF_INTR(framep) (interrupt_depth > 1)
+#define CLKF_INTR(framep) (idepth > 1)
/*
Index: src/sys/arch/mvme68k/include/intr.h
diff -u src/sys/arch/mvme68k/include/intr.h:1.22 src/sys/arch/mvme68k/include/intr.h:1.23
--- src/sys/arch/mvme68k/include/intr.h:1.22 Tue Jul 11 11:07:54 2023
+++ src/sys/arch/mvme68k/include/intr.h Tue Jan 16 01:26:34 2024
@@ -1,11 +1,11 @@
-/* $NetBSD: intr.h,v 1.22 2023/07/11 11:07:54 riastradh Exp $ */
+/* $NetBSD: intr.h,v 1.23 2024/01/16 01:26:34 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 Jason R. Thorpe and Steve C. Woodford.
+ * by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,65 +29,21 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef _MVME68K_INTR_H
-#define _MVME68K_INTR_H
+#ifndef _MVME68K_INTR_H_
+#define _MVME68K_INTR_H_
-#include <machine/psl.h>
+#include <m68k/psl.h>
-#define IPL_NONE 0 /* disable only this interrupt */
-#define IPL_SOFTCLOCK 1 /* clock software interrupts */
-#define IPL_SOFTBIO 2 /* block software interrupts */
-#define IPL_SOFTNET 3 /* network software interrupts */
-#define IPL_SOFTSERIAL 4 /* serial software interrupts */
-#define IPL_VM 5
-#define IPL_SCHED 6
-#define IPL_HIGH 7
-#define NIPL 8
-
-#if defined(_KERNEL) || defined(_KMEMUSER)
-typedef struct {
- uint16_t _psl;
-} ipl_cookie_t;
-#endif
-
-#ifdef _KERNEL
-#define spl0() _spl0()
-#define splsoftclock() splraise1()
-#define splsoftbio() splraise1()
-#define splsoftnet() splraise1()
-#define splsoftserial() splraise1()
-#define splvm() splraise3()
-#define splsched() spl7()
-#define splhigh() spl7()
-
-#ifndef _LOCORE
-
-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)
-{
+#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_IPL3
+#define MACHINE_PSL_IPL_SCHED PSL_IPL7
- __asm volatile("movw %0,%%sr" : : "di" (sr));
-}
+#define MACHINE_INTREVCNT_NAMES \
+ { "spur", "lev1", "lev2", "lev3", "lev4", "clock", "lev6", "nmi" }
-#endif /* !_LOCORE */
-#endif /* _KERNEL */
+#include <m68k/intr.h>
-#endif /* _MVME68K_INTR_H */
+#endif /* _MVME68K_INTR_H */
Index: src/sys/arch/mvme68k/include/types.h
diff -u src/sys/arch/mvme68k/include/types.h:1.15 src/sys/arch/mvme68k/include/types.h:1.16
--- src/sys/arch/mvme68k/include/types.h:1.15 Thu Apr 1 04:43:00 2021
+++ src/sys/arch/mvme68k/include/types.h Tue Jan 16 01:26:34 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: types.h,v 1.15 2021/04/01 04:43:00 simonb Exp $ */
+/* $NetBSD: types.h,v 1.16 2024/01/16 01:26:34 thorpej Exp $ */
#ifndef _MACHINE_TYPES_H_
#define _MACHINE_TYPES_H_
@@ -6,6 +6,6 @@
#include <m68k/types.h>
#define __HAVE_DEVICE_REGISTER
-#define __HAVE_LEGACY_INTRCNT
+#define __HAVE_M68K_INTR_VECTORED
#endif
Index: src/sys/arch/mvme68k/include/vectors.h
diff -u src/sys/arch/mvme68k/include/vectors.h:1.1 src/sys/arch/mvme68k/include/vectors.h:1.2
--- src/sys/arch/mvme68k/include/vectors.h:1.1 Sat Jan 13 20:18:46 2024
+++ src/sys/arch/mvme68k/include/vectors.h Tue Jan 16 01:26:34 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: vectors.h,v 1.1 2024/01/13 20:18:46 thorpej Exp $ */
+/* $NetBSD: vectors.h,v 1.2 2024/01/16 01:26:34 thorpej Exp $ */
/*-
* Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -36,14 +36,14 @@
#include <m68k/vectors.h>
-#define MACHINE_AV0_HANDLER intrhand_autovec
-#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_AV5_HANDLER intrhand_autovec
-#define MACHINE_AV6_HANDLER intrhand_autovec
-#define MACHINE_AV7_HANDLER intrhand_autovec
+#define MACHINE_AV0_HANDLER intrstub_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 intrstub_autovec
+#define MACHINE_AV6_HANDLER intrstub_autovec
+#define MACHINE_AV7_HANDLER intrstub_autovec
#endif /* _KERNEL */
Index: src/sys/arch/mvme68k/mvme68k/genassym.cf
diff -u src/sys/arch/mvme68k/mvme68k/genassym.cf:1.40 src/sys/arch/mvme68k/mvme68k/genassym.cf:1.41
--- src/sys/arch/mvme68k/mvme68k/genassym.cf:1.40 Wed Dec 27 17:35:36 2023
+++ src/sys/arch/mvme68k/mvme68k/genassym.cf Tue Jan 16 01:26:34 2024
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.40 2023/12/27 17:35:36 thorpej Exp $
+# $NetBSD: genassym.cf,v 1.41 2024/01/16 01:26:34 thorpej Exp $
#
# Copyright (c) 1982, 1990, 1993
@@ -67,6 +67,8 @@ endif
# MMU options
define M68K_MMU_MOTOROLA 1
+define __HAVE_M68K_INTR_VECTORED 1
+
# values for mmutype
define MMU_68060 MMU_68060
define MMU_68040 MMU_68040
Index: src/sys/arch/mvme68k/mvme68k/isr.h
diff -u src/sys/arch/mvme68k/mvme68k/isr.h:1.12 src/sys/arch/mvme68k/mvme68k/isr.h:1.13
--- src/sys/arch/mvme68k/mvme68k/isr.h:1.12 Mon Apr 28 20:23:29 2008
+++ src/sys/arch/mvme68k/mvme68k/isr.h Tue Jan 16 01:26:34 2024
@@ -1,7 +1,7 @@
-/* $NetBSD: isr.h,v 1.12 2008/04/28 20:23:29 martin Exp $ */
+/* $NetBSD: isr.h,v 1.13 2024/01/16 01:26:34 thorpej Exp $ */
/*-
- * Copyright (c) 1996 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
@@ -29,56 +29,55 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/queue.h>
+#ifndef _MVME68K_ISR_H_
+#define _MVME68K_ISR_H_
-/*
- * The location and size of the autovectored interrupt portion
- * of the vector table.
- */
-#define ISRAUTOVEC 0x18
-#define NISRAUTOVEC 8
-#define NIPLS 8
+#include <sys/intr.h>
/*
- * The location and size of the vectored interrupt portion
- * of the vector table.
+ * Aliases for the legacy mvme68k ISR routines.
*/
-#define ISRVECTORED 0x40
-#define NISRVECTORED 192
-/*
- * Autovectored interrupt handler cookie.
- */
-struct isr_autovec {
- LIST_ENTRY(isr_autovec) isr_link;
- int (*isr_func)(void *);
- void *isr_arg;
- int isr_ipl;
- int isr_priority;
- struct evcnt *isr_evcnt;
-};
+static inline void
+isrinit(void)
+{
+ extern int nmihand(void *);
+
+ m68k_intr_init(NULL);
+ m68k_intr_establish(nmihand, NULL, NULL, 0, 7, 0, 0);
+}
+
+static inline void
+isrlink_autovec(int (*func)(void *), void *arg, int ipl, int isrpri,
+ struct evcnt *ev)
+{
+ /* XXX leaks interrupt handle. */
+ m68k_intr_establish(func, arg, ev, 0, ipl, isrpri, 0);
+}
+
+static inline void
+isrlink_vectored(int (*func)(void *), void *arg, int ipl, int vec,
+ struct evcnt *ev)
+{
+ /* XXX leaks interrupt handle. */
+ m68k_intr_establish(func, arg, ev, vec, ipl, 0, 0);
+}
+
+static inline struct evcnt *
+isrlink_evcnt(int ipl)
+{
+ KASSERT(ipl >= 0 && ipl <= 7);
+ return &m68k_intr_evcnt[ipl];
+}
+
+static inline void
+isrunlink_vectored(int vec)
+{
+ /* XXX isrlink_vectored() should return a handle. */
+ void *ih = m68k_intrvec_intrhand(vec);
+ if (ih != NULL) {
+ m68k_intr_disestablish(ih);
+ }
+}
-typedef LIST_HEAD(, isr_autovec) isr_autovec_list_t;
-
-/*
- * 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;
- struct evcnt *isr_evcnt;
-};
-
-extern struct evcnt mvme68k_irq_evcnt[];
-
-void isrinit(void);
-struct evcnt *isrlink_evcnt(int);
-void isrlink_autovec(int (*)(void *), void *, int, int, struct evcnt *);
-void isrlink_vectored(int (*)(void *), void *, int, int, struct evcnt *);
-void isrunlink_vectored(int);
-void isrdispatch_autovec(struct clockframe *);
-void isrdispatch_vectored(int, struct clockframe *);
-void netintr(void);
+#endif /* _MVME68K_ISR_H_ */
Index: src/sys/arch/mvme68k/mvme68k/locore.s
diff -u src/sys/arch/mvme68k/mvme68k/locore.s:1.126 src/sys/arch/mvme68k/mvme68k/locore.s:1.127
--- src/sys/arch/mvme68k/mvme68k/locore.s:1.126 Sat Jan 13 20:18:47 2024
+++ src/sys/arch/mvme68k/mvme68k/locore.s Tue Jan 16 01:26:34 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.126 2024/01/13 20:18:47 thorpej Exp $ */
+/* $NetBSD: locore.s,v 1.127 2024/01/16 01:26:34 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -913,47 +913,6 @@ Lbrkpt3:
#include <m68k/m68k/sigreturn.s>
/*
- * Interrupt handlers.
- *
- * For auto-vectored interrupts, the CPU provides the
- * vector 0x18+level.
- *
- * 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(intrhand_autovec)
- addql #1,_C_LABEL(interrupt_depth)
- INTERRUPT_SAVEREG
- lea %sp@(16),%a1 | get pointer to frame
- movl %a1,%sp@-
- jbsr _C_LABEL(isrdispatch_autovec) | call dispatcher
- addql #4,%sp
- jbra Lintrhand_exit
-
-ENTRY_NOPROFILE(intrhand_vectored)
- addql #1,_C_LABEL(interrupt_depth)
- INTERRUPT_SAVEREG
- lea %sp@(16),%a1 | get pointer to frame
- movl %a1,%sp@-
- movw %sr,%d0
- bfextu %d0,21,3,%d0 | Get current ipl
- movl %d0,%sp@- | Push it
- jbsr _C_LABEL(isrdispatch_vectored) | call dispatcher
- addql #8,%sp
-Lintrhand_exit:
- INTERRUPT_RESTOREREG
- subql #1,_C_LABEL(interrupt_depth)
-
- /* FALLTHROUGH to rei */
-
-/*
* Emulation of VAX REI instruction.
*
* This code deals with checking for and servicing ASTs
@@ -1193,24 +1152,3 @@ GLOBAL(intiobase_phys)
GLOBAL(intiotop_phys)
.long 0 | PA of top of board's I/O registers
-
-/*
- * interrupt counters.
- * XXXSCW: Will go away soon; kept here to keep vmstat happy
- */
-GLOBAL(intrnames)
- .asciz "spur"
- .asciz "lev1"
- .asciz "lev2"
- .asciz "lev3"
- .asciz "lev4"
- .asciz "clock"
- .asciz "lev6"
- .asciz "nmi"
- .asciz "statclock"
-GLOBAL(eintrnames)
- .even
-
-GLOBAL(intrcnt)
- .long 0,0,0,0,0,0,0,0,0
-GLOBAL(eintrcnt)
Index: src/sys/arch/mvme68k/mvme68k/machdep.c
diff -u src/sys/arch/mvme68k/mvme68k/machdep.c:1.162 src/sys/arch/mvme68k/mvme68k/machdep.c:1.163
--- src/sys/arch/mvme68k/mvme68k/machdep.c:1.162 Sat Jan 13 20:18:47 2024
+++ src/sys/arch/mvme68k/mvme68k/machdep.c Tue Jan 16 01:26:34 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.162 2024/01/13 20:18:47 thorpej Exp $ */
+/* $NetBSD: machdep.c,v 1.163 2024/01/16 01:26:34 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.162 2024/01/13 20:18:47 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.163 2024/01/16 01:26:34 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_m060sp.h"
@@ -1029,17 +1029,6 @@ module_init_md(void)
}
#endif
-const uint16_t ipl2psl_table[NIPL] = {
- [IPL_NONE] = PSL_S | PSL_IPL0,
- [IPL_SOFTCLOCK] = PSL_S | PSL_IPL1,
- [IPL_SOFTBIO] = PSL_S | PSL_IPL1,
- [IPL_SOFTNET] = PSL_S | PSL_IPL1,
- [IPL_SOFTSERIAL] = PSL_S | PSL_IPL1,
- [IPL_VM] = PSL_S | PSL_IPL3,
- [IPL_SCHED] = PSL_S | PSL_IPL7,
- [IPL_HIGH] = PSL_S | PSL_IPL7,
-};
-
int
mm_md_physacc(paddr_t pa, vm_prot_t prot)
{
Index: src/sys/arch/mvme68k/mvme68k/trap.c
diff -u src/sys/arch/mvme68k/mvme68k/trap.c:1.114 src/sys/arch/mvme68k/mvme68k/trap.c:1.115
--- src/sys/arch/mvme68k/mvme68k/trap.c:1.114 Thu Oct 5 19:41:05 2023
+++ src/sys/arch/mvme68k/mvme68k/trap.c Tue Jan 16 01:26:34 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.114 2023/10/05 19:41:05 ad Exp $ */
+/* $NetBSD: trap.c,v 1.115 2024/01/16 01:26:34 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.114 2023/10/05 19:41:05 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.115 2024/01/16 01:26:34 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
@@ -564,7 +564,7 @@ trap(struct frame *fp, int type, unsigne
}
#ifdef DIAGNOSTIC
- if (interrupt_depth && !panicking) {
+ if (idepth && !panicking) {
printf("trap: calling uvm_fault() from interrupt!\n");
goto dopanic;
}