Module Name:    src
Committed By:   thorpej
Date:           Sat Jan 13 18:51:39 UTC 2024

Modified Files:
        src/sys/arch/sun2/sun2: locore2.c promlib.c
        src/sys/arch/sun3/sun3: locore2.c sunmon.c
        src/sys/arch/sun3/sun3x: locore2.c
        src/sys/arch/sun68k/conf: files.sun68k
        src/sys/arch/sun68k/sun68k: isr.c
Added Files:
        src/sys/arch/sun2/include: vectors.h
        src/sys/arch/sun3/include: vectors.h
        src/sys/arch/sun68k/include: vectors.h
Removed Files:
        src/sys/arch/sun68k/sun68k: vector.c vector.h

Log Message:
Switch the sun68k platforms over to the common m68k vector table.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/sun2/include/vectors.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/sun2/sun2/locore2.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sun2/sun2/promlib.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/sun3/include/vectors.h
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/sun3/sun3/locore2.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/sun3/sun3/sunmon.c
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/sun3/sun3x/locore2.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sun68k/conf/files.sun68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/sun68k/include/vectors.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/sun68k/sun68k/isr.c
cvs rdiff -u -r1.7 -r0 src/sys/arch/sun68k/sun68k/vector.c
cvs rdiff -u -r1.4 -r0 src/sys/arch/sun68k/sun68k/vector.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/sun2/sun2/locore2.c
diff -u src/sys/arch/sun2/sun2/locore2.c:1.28 src/sys/arch/sun2/sun2/locore2.c:1.29
--- src/sys/arch/sun2/sun2/locore2.c:1.28	Sat Jul 11 13:07:01 2020
+++ src/sys/arch/sun2/sun2/locore2.c	Sat Jan 13 18:51:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore2.c,v 1.28 2020/07/11 13:07:01 nia Exp $	*/
+/*	$NetBSD: locore2.c,v 1.29 2024/01/13 18:51:38 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: locore2.c,v 1.28 2020/07/11 13:07:01 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore2.c,v 1.29 2024/01/13 18:51:38 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_modular.h"
@@ -54,10 +54,10 @@ __KERNEL_RCSID(0, "$NetBSD: locore2.c,v 
 #include <machine/promlib.h>
 #include <machine/pmap.h>
 #include <machine/pte.h>
+#include <machine/vectors.h>
 
 #include <sun2/sun2/control.h>
 #include <sun2/sun2/machdep.h>
-#include <sun68k/sun68k/vector.h>
 
 #include "ksyms.h"
 
@@ -285,7 +285,7 @@ _bootstrap(void)
 	 * Point interrupts/exceptions to our vector table.
 	 * (Until now, we use the one setup by the PROM.)
 	 */
-	setvbr((void **)vector_table);
+	vec_init();
 	/* Interrupts are enabled later, after autoconfig. */
 
 	/*

Index: src/sys/arch/sun2/sun2/promlib.c
diff -u src/sys/arch/sun2/sun2/promlib.c:1.19 src/sys/arch/sun2/sun2/promlib.c:1.20
--- src/sys/arch/sun2/sun2/promlib.c:1.19	Thu Sep 10 02:03:44 2020
+++ src/sys/arch/sun2/sun2/promlib.c	Sat Jan 13 18:51:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: promlib.c,v 1.19 2020/09/10 02:03:44 rin Exp $	*/
+/*	$NetBSD: promlib.c,v 1.20 2024/01/13 18:51:38 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: promlib.c,v 1.19 2020/09/10 02:03:44 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: promlib.c,v 1.20 2024/01/13 18:51:38 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -41,10 +41,10 @@ __KERNEL_RCSID(0, "$NetBSD: promlib.c,v 
 
 #define _SUN2_PROMLIB_PRIVATE
 #include <machine/promlib.h>
+#include <machine/vectors.h>
 
 #include <sun2/sun2/machdep.h>
 #include <sun2/sun2/control.h>
-#include <sun68k/sun68k/vector.h>
 #include <machine/pte.h>
 
 /*
@@ -131,7 +131,7 @@ _mode_kernel(struct kernel_state *state,
 	 */
 	if (full) {
 		set_clk_mode(1, 0);
-		setvbr(vector_table);
+		setvbr(vectab);
 		set_clk_mode(0, 1);
 		splx(state->saved_spl);
 	}

Index: src/sys/arch/sun3/sun3/locore2.c
diff -u src/sys/arch/sun3/sun3/locore2.c:1.103 src/sys/arch/sun3/sun3/locore2.c:1.104
--- src/sys/arch/sun3/sun3/locore2.c:1.103	Sat Jul 11 13:07:01 2020
+++ src/sys/arch/sun3/sun3/locore2.c	Sat Jan 13 18:51:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore2.c,v 1.103 2020/07/11 13:07:01 nia Exp $	*/
+/*	$NetBSD: locore2.c,v 1.104 2024/01/13 18:51:38 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: locore2.c,v 1.103 2020/07/11 13:07:01 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore2.c,v 1.104 2024/01/13 18:51:38 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_modular.h"
@@ -54,12 +54,12 @@ __KERNEL_RCSID(0, "$NetBSD: locore2.c,v 
 #include <machine/mon.h>
 #include <machine/pmap.h>
 #include <machine/pte.h>
+#include <machine/vectors.h>
 
 #include <sun3/sun3/control.h>
 #include <sun3/sun3/interreg.h>
 #include <sun3/sun3/machdep.h>
 #include <sun3/sun3/obmem.h>
-#include <sun68k/sun68k/vector.h>
 
 #include "ksyms.h"
 
@@ -344,7 +344,7 @@ _bootstrap(void)
 	 * it will not cause "spurrious level 7" complaints.
 	 * Done after _vm_init so the PROM can debug that.
 	 */
-	setvbr((void **)vector_table);
+	vec_init();
 	/* Interrupts are enabled later, after autoconfig. */
 
 	/*

Index: src/sys/arch/sun3/sun3/sunmon.c
diff -u src/sys/arch/sun3/sun3/sunmon.c:1.23 src/sys/arch/sun3/sun3/sunmon.c:1.24
--- src/sys/arch/sun3/sun3/sunmon.c:1.23	Fri Jan 12 23:46:53 2024
+++ src/sys/arch/sun3/sun3/sunmon.c	Sat Jan 13 18:51:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sunmon.c,v 1.23 2024/01/12 23:46:53 thorpej Exp $	*/
+/*	$NetBSD: sunmon.c,v 1.24 2024/01/13 18:51:38 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunmon.c,v 1.23 2024/01/12 23:46:53 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunmon.c,v 1.24 2024/01/13 18:51:38 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -39,12 +39,12 @@ __KERNEL_RCSID(0, "$NetBSD: sunmon.c,v 1
 
 #include <machine/mon.h>
 #include <machine/mc68851.h>
+#include <machine/vectors.h>
 
 #include <m68k/frame.h>
 
 #include <sun3/sun3/machdep.h>
 #include <sun3/sun3/interreg.h>
-#include <sun68k/sun68k/vector.h>
 
 static void **sunmon_vbr;
 static void *sunmon_vcmd;	/* XXX: always 0? */
@@ -76,7 +76,7 @@ _mode_kernel(void)
 	/* Disable the PROM NMI clock. */
 	set_clk_mode(0, IREG_CLOCK_ENAB_7, 0);
 	/* Restore our own vector table */
-	setvbr(vector_table);
+	setvbr(vectab);
 	/* Enable our level-5 clock. */
 	set_clk_mode(IREG_CLOCK_ENAB_5, 0, 1);
 }

Index: src/sys/arch/sun3/sun3x/locore2.c
diff -u src/sys/arch/sun3/sun3x/locore2.c:1.42 src/sys/arch/sun3/sun3x/locore2.c:1.43
--- src/sys/arch/sun3/sun3x/locore2.c:1.42	Sat Jul 11 13:07:01 2020
+++ src/sys/arch/sun3/sun3x/locore2.c	Sat Jan 13 18:51:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore2.c,v 1.42 2020/07/11 13:07:01 nia Exp $	*/
+/*	$NetBSD: locore2.c,v 1.43 2024/01/13 18:51:38 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: locore2.c,v 1.42 2020/07/11 13:07:01 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore2.c,v 1.43 2024/01/13 18:51:38 thorpej Exp $");
 
 #include "opt_ddb.h"
 
@@ -53,10 +53,10 @@ __KERNEL_RCSID(0, "$NetBSD: locore2.c,v 
 #include <machine/mon.h>
 #include <machine/pmap.h>
 #include <machine/pte.h>
+#include <machine/vectors.h>
 
 #include <sun3/sun3/interreg.h>
 #include <sun3/sun3/machdep.h>
-#include <sun68k/sun68k/vector.h>
 
 /* This is defined in locore.s */
 extern char kernel_text[];
@@ -226,7 +226,7 @@ _bootstrap(void)
 	 * it will not cause "spurrious level 7" complaints.
 	 * Done after _vm_init so the PROM can debug that.
 	 */
-	setvbr((void **)vector_table);
+	vec_init();
 	/* Interrupts are enabled later, after autoconfig. */
 
 	/*

Index: src/sys/arch/sun68k/conf/files.sun68k
diff -u src/sys/arch/sun68k/conf/files.sun68k:1.5 src/sys/arch/sun68k/conf/files.sun68k:1.6
--- src/sys/arch/sun68k/conf/files.sun68k:1.5	Thu Oct  5 14:46:12 2006
+++ src/sys/arch/sun68k/conf/files.sun68k	Sat Jan 13 18:51:38 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sun68k,v 1.5 2006/10/05 14:46:12 tsutsui Exp $
+#	$NetBSD: files.sun68k,v 1.6 2024/01/13 18:51:38 thorpej Exp $
 
 #
 # common sun68k configuration info
@@ -10,10 +10,10 @@ file arch/sun68k/sun68k/bus.c
 file arch/sun68k/sun68k/ctrlsp.S		!_sun3x_
 file arch/sun68k/sun68k/isr.c
 file arch/sun68k/sun68k/stub.c
-file arch/sun68k/sun68k/vector.c
 
 file arch/m68k/m68k/kgdb_machdep.c 		kgdb
 file arch/m68k/m68k/procfs_machdep.c		procfs
+file arch/m68k/m68k/vectors.c
 file arch/m68k/m68k/vm_machdep.c
 
 file dev/sun/disksubr.c

Index: src/sys/arch/sun68k/sun68k/isr.c
diff -u src/sys/arch/sun68k/sun68k/isr.c:1.28 src/sys/arch/sun68k/sun68k/isr.c:1.29
--- src/sys/arch/sun68k/sun68k/isr.c:1.28	Fri Jan 12 23:36:30 2024
+++ src/sys/arch/sun68k/sun68k/isr.c	Sat Jan 13 18:51:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: isr.c,v 1.28 2024/01/12 23:36:30 thorpej Exp $	*/
+/*	$NetBSD: isr.c,v 1.29 2024/01/13 18:51:38 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.28 2024/01/12 23:36:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.29 2024/01/13 18:51:38 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -48,8 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.28
 
 #include <machine/autoconf.h>
 #include <machine/mon.h>
-
-#include <sun68k/sun68k/vector.h>
+#include <machine/vectors.h>
 
 extern int intrcnt[];	/* statistics */
 
@@ -68,9 +67,6 @@ struct isr {
 
 int idepth;
 
-void set_vector_entry(int, void *);
-void *get_vector_entry(int);
-
 /*
  * These are called from locore.  The "struct clockframe" arg
  * is really just the normal H/W interrupt frame format.
@@ -83,7 +79,7 @@ void 
 isr_add_custom(int level, void *handler)
 {
 
-	set_vector_entry(AUTOVEC_BASE + level, handler);
+	vec_set_entry(VECI_INTRAV0 + level, handler);
 }
 
 
@@ -101,12 +97,9 @@ isr_autovec(struct clockframe cf)
 
 	idepth++;
 
-	vec = (cf.cf_vo & 0xFFF) >> 2;
-#ifdef DIAGNOSTIC
-	if ((vec < AUTOVEC_BASE) || (vec >= (AUTOVEC_BASE + NUM_LEVELS)))
-		panic("isr_autovec: bad vec");
-#endif
-	ipl = vec - AUTOVEC_BASE;
+	vec = VECO_TO_VECI(cf.cf_vo & 0xFFF);
+	KASSERT(vec >= VECI_INTRAV0 && vec <= VECI_INTRAV7);
+	ipl = vec - VECI_INTRAV0;
 
 	n = intrcnt[ipl];
 	intrcnt[ipl] = n + 1;
@@ -166,12 +159,13 @@ static struct vector_handler isr_vector_
 void
 isr_vectored(struct clockframe cf)
 {
+	extern char badtrap[];
 	struct vector_handler *vh;
 	int ipl, vec;
 
 	idepth++;
 
-	vec = (cf.cf_vo & 0xFFF) >> 2;
+	vec = VECO_TO_VECI(cf.cf_vo & 0xFFF);
 	ipl = getsr();
 	ipl = (ipl >> 8) & 7;
 
@@ -179,15 +173,15 @@ isr_vectored(struct clockframe cf)
 	curcpu()->ci_data.cpu_nintr++;
 
 #ifdef DIAGNOSTIC
-	if (vec < 64 || vec >= 256) {
+	if (vec < VECI_USRVEC_START || vec >= NVECTORS) {
 		printf("isr_vectored: vector=0x%x (invalid)\n", vec);
 		goto out;
 	}
 #endif
-	vh = &isr_vector_handlers[vec - 64];
+	vh = &isr_vector_handlers[vec - VECI_USRVEC_START];
 	if (vh->func == NULL) {
 		printf("isr_vectored: vector=0x%x (nul func)\n", vec);
-		set_vector_entry(vec, (void *)badtrap);
+		vec_set_entry(vec, badtrap);
 		goto out;
 	}
 
@@ -211,39 +205,18 @@ isr_add_vectored(isr_func_t func, void *
 {
 	struct vector_handler *vh;
 
-	if (vec < 64 || vec >= 256) {
+	if (vec < VECI_USRVEC_START || vec >= NVECTORS) {
 		printf("isr_add_vectored: vect=0x%x (invalid)\n", vec);
 		return;
 	}
-	vh = &isr_vector_handlers[vec - 64];
+	vh = &isr_vector_handlers[vec - VECI_USRVEC_START];
 	if (vh->func) {
 		printf("isr_add_vectored: vect=0x%x (in use)\n", vec);
 		return;
 	}
 	vh->func = func;
 	vh->arg = arg;
-	set_vector_entry(vec, (void *)_isr_vectored);
-}
-
-/*
- * XXX - could just kill these...
- */
-void 
-set_vector_entry(int entry, void *handler)
-{
-
-	if ((entry < 0) || (entry >= NVECTORS))
-	panic("set_vector_entry: setting vector too high or low");
-	vector_table[entry] = handler;
-}
-
-void *
-get_vector_entry(int entry)
-{
-
-	if ((entry < 0) || (entry >= NVECTORS))
-	panic("get_vector_entry: setting vector too high or low");
-	return (void *)vector_table[entry];
+	vec_set_entry(vec, _isr_vectored);
 }
 
 const uint16_t ipl2psl_table[NIPL] = {

Added files:

Index: src/sys/arch/sun2/include/vectors.h
diff -u /dev/null src/sys/arch/sun2/include/vectors.h:1.1
--- /dev/null	Sat Jan 13 18:51:39 2024
+++ src/sys/arch/sun2/include/vectors.h	Sat Jan 13 18:51:37 2024
@@ -0,0 +1,3 @@
+/*	$NetBSD: vectors.h,v 1.1 2024/01/13 18:51:37 thorpej Exp $	*/
+
+#include <sun68k/vectors.h>

Index: src/sys/arch/sun3/include/vectors.h
diff -u /dev/null src/sys/arch/sun3/include/vectors.h:1.1
--- /dev/null	Sat Jan 13 18:51:39 2024
+++ src/sys/arch/sun3/include/vectors.h	Sat Jan 13 18:51:38 2024
@@ -0,0 +1,3 @@
+/*	$NetBSD: vectors.h,v 1.1 2024/01/13 18:51:38 thorpej Exp $	*/
+
+#include <sun68k/vectors.h>

Index: src/sys/arch/sun68k/include/vectors.h
diff -u /dev/null src/sys/arch/sun68k/include/vectors.h:1.1
--- /dev/null	Sat Jan 13 18:51:39 2024
+++ src/sys/arch/sun68k/include/vectors.h	Sat Jan 13 18:51:38 2024
@@ -0,0 +1,56 @@
+/*	$NetBSD: vectors.h,v 1.1 2024/01/13 18:51:38 thorpej Exp $	*/
+
+/*-
+ * Copyright (c) 1996, 2024 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Adam Glass and Gordon W. Ross, and 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 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.
+ *
+ * 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 _SUN68K_VECTORS_H_
+#define	_SUN68K_VECTORS_H_
+
+#ifdef _KERNEL
+
+#include <m68k/vectors.h>
+
+#define	MACHINE_RESET_SP	(void *)0xfffe000
+#define	MACHINE_RESET_PC	(void *)0xfef0000
+
+#define	MACHINE_BUSERR_HANDLER	buserr
+#define	MACHINE_ADDRERR_HANDLER	addrerr
+
+#define	MACHINE_AV0_HANDLER	_isr_autovec
+#define	MACHINE_AV1_HANDLER	_isr_autovec
+#define	MACHINE_AV2_HANDLER	_isr_autovec
+#define	MACHINE_AV3_HANDLER	_isr_autovec
+#define	MACHINE_AV4_HANDLER	_isr_autovec
+#define	MACHINE_AV5_HANDLER	_isr_autovec
+#define	MACHINE_AV6_HANDLER	_isr_autovec
+#define	MACHINE_AV7_HANDLER	_isr_autovec
+
+#endif /* _KERNEL */
+
+#endif /* _SUN68K_VECTORS_H_ */

Reply via email to