Module Name:    src
Committed By:   thorpej
Date:           Thu Jan 18 13:46:14 UTC 2024

Modified Files:
        src/sys/arch/next68k/conf: files.next68k
        src/sys/arch/next68k/include: cpu.h intr.h types.h vectors.h

Log Message:
Switch next68k over to common interrupt dispatch and G/C __HAVE_LEGACY_INTRCNT.
Also included is G/C of the old ssir stuff that's no longer used.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/next68k/conf/files.next68k
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/next68k/include/cpu.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/next68k/include/intr.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/next68k/include/types.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/next68k/include/vectors.h

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/next68k/conf/files.next68k
diff -u src/sys/arch/next68k/conf/files.next68k:1.44 src/sys/arch/next68k/conf/files.next68k:1.45
--- src/sys/arch/next68k/conf/files.next68k:1.44	Sat Jan 13 21:40:53 2024
+++ src/sys/arch/next68k/conf/files.next68k	Thu Jan 18 13:46:14 2024
@@ -1,4 +1,4 @@
-# $NetBSD: files.next68k,v 1.44 2024/01/13 21:40:53 thorpej Exp $
+# $NetBSD: files.next68k,v 1.45 2024/01/18 13:46:14 thorpej Exp $
 
 # next68k-specific configuration info
 
@@ -35,6 +35,8 @@ file	arch/next68k/dev/zs_kgdb.c	kgdb
 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
@@ -50,7 +52,6 @@ file	arch/next68k/next68k/pmap_bootstrap
 file	arch/next68k/next68k/machdep.c
 file	arch/next68k/next68k/clock.c
 file	arch/next68k/next68k/conf.c
-file	arch/next68k/next68k/isr.c
 file	arch/next68k/next68k/autoconf.c
 file	arch/next68k/next68k/mainbus.c
 file	arch/next68k/next68k/nextrom.c

Index: src/sys/arch/next68k/include/cpu.h
diff -u src/sys/arch/next68k/include/cpu.h:1.54 src/sys/arch/next68k/include/cpu.h:1.55
--- src/sys/arch/next68k/include/cpu.h:1.54	Sat Jan 13 21:40:54 2024
+++ src/sys/arch/next68k/include/cpu.h	Thu Jan 18 13:46:14 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.54 2024/01/13 21:40:54 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.55 2024/01/18 13:46:14 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -65,17 +65,17 @@
 /*
  * Arguments to hardclock and gatherstats encapsulate the previous
  * machine state in an opaque clockframe.  On the next68k, 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
@@ -83,8 +83,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)
 
 /*
  * Preempt the current process if in interrupt from user mode,

Index: src/sys/arch/next68k/include/intr.h
diff -u src/sys/arch/next68k/include/intr.h:1.23 src/sys/arch/next68k/include/intr.h:1.24
--- src/sys/arch/next68k/include/intr.h:1.23	Tue Jul 11 11:13:32 2023
+++ src/sys/arch/next68k/include/intr.h	Thu Jan 18 13:46:14 2024
@@ -1,10 +1,12 @@
-/*	$NetBSD: intr.h,v 1.23 2023/07/11 11:13:32 riastradh Exp $	*/
+/*	$NetBSD: intr.h,v 1.24 2024/01/18 13:46:14 thorpej Exp $	*/
 
-/*
- * Copyright (C) 1997 Scott Reynolds
- * Copyright (C) 1998 Darrin Jewell
+/*-
+ * 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.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -13,93 +15,45 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef _NEXT68K_INTR_H_
 #define _NEXT68K_INTR_H_
 
-#include <machine/psl.h>
-
-/* Probably want to dealwith IPL's here @@@ */
-
-#if defined(_KERNEL) || defined(_KMEMUSER)
-typedef struct {
-	uint16_t _psl;
-} ipl_cookie_t;
-#endif
-
-#ifdef _KERNEL
-
-/* spl0 requires checking for software interrupts */
-
-/* watch out for side effects */
-#define splx(s)         ((s) & PSL_IPL ? _spl(s) : spl0())
-
-#define splsoftbio()	splraise1()
-#define splsoftnet()    splraise1()
-#define splsoftclock()	splraise1()
-#define splsoftserial()	splraise1()
-#define splvm()         splraise6()
-#define splhigh()       spl7()
-#define splsched()      spl7()
+#include <m68k/psl.h>
 
-#define spldma()        splraise6()
+#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_IPL6
+#define	MACHINE_PSL_IPL_SCHED		PSL_IPL7
 
-/****************************************************************/
+#include <m68k/intr.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
+#define	spldma()	splraise6()
 
-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);
-}
-
-/****************************************************************/
-
-/* locore.s */
-int	spl0(void);
+#ifdef _KERNEL
 
 extern volatile u_long *intrstat;
 extern volatile u_long *intrmask;
-#define INTR_SETMASK(x)		(*intrmask = (x))
-#define INTR_ENABLE(x)		(*intrmask |= NEXT_I_BIT(x))
-#define INTR_DISABLE(x)		(*intrmask &= (~NEXT_I_BIT(x)))
-#define INTR_OCCURRED(x)	(*intrstat & NEXT_I_BIT(x))
+#define	INTR_SETMASK(x)		(*intrmask = (x))
+#define	INTR_ENABLE(x)		(*intrmask |= NEXT_I_BIT(x))
+#define	INTR_DISABLE(x)		(*intrmask &= (~NEXT_I_BIT(x)))
+#define	INTR_OCCURRED(x)	(*intrstat & NEXT_I_BIT(x))
 
 #endif /* _KERNEL */
 
-#endif /* _NEXT68K_INTR_H_ */
+#endif	/* _NEXT68K_INTR_H */

Index: src/sys/arch/next68k/include/types.h
diff -u src/sys/arch/next68k/include/types.h:1.7 src/sys/arch/next68k/include/types.h:1.8
--- src/sys/arch/next68k/include/types.h:1.7	Thu Apr  1 04:43:00 2021
+++ src/sys/arch/next68k/include/types.h	Thu Jan 18 13:46:14 2024
@@ -1,5 +1,3 @@
-/*	$NetBSD: types.h,v 1.7 2021/04/01 04:43:00 simonb Exp $	*/
+/*	$NetBSD: types.h,v 1.8 2024/01/18 13:46:14 thorpej Exp $	*/
 
 #include <m68k/types.h>
-
-#define	__HAVE_LEGACY_INTRCNT

Index: src/sys/arch/next68k/include/vectors.h
diff -u src/sys/arch/next68k/include/vectors.h:1.1 src/sys/arch/next68k/include/vectors.h:1.2
--- src/sys/arch/next68k/include/vectors.h:1.1	Sat Jan 13 21:40:54 2024
+++ src/sys/arch/next68k/include/vectors.h	Thu Jan 18 13:46:14 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vectors.h,v 1.1 2024/01/13 21:40:54 thorpej Exp $	*/
+/*	$NetBSD: vectors.h,v 1.2 2024/01/18 13:46:14 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -36,13 +36,13 @@
 
 #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_AV5_HANDLER	intrhand_autovec
-#define	MACHINE_AV6_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	lev7intr
 
 #endif /* _KERNEL */

Reply via email to