Subject: Re: anyone booted sun2 or sun3 kernels in the last 3 months?
To: None <mrg@eterna.com.au>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-sun2
Date: 08/02/2006 23:27:16
mrg@eterna.com.au wrote:

> this seems grody but seems to work..

If we can't get the real fix soon, I'll commit the attached patch
(based on yours, but a bit modified) for workaround.

> perhaps the right fix is to just
> redefine IPL_SOFT* back to the _IPL_SOFT_LEVEL_* constants?

It won't work because IPL_SOFT{CLOCK,NET,SERIAL} is refered
in <sys/spl.h> for splraiseipl() (which is defined as _splraise())
and MI softintr_establish() also takes the same IPL_* values.
---
Izumi Tsutsui


Index: sys/arch/sun68k/include/intr.h
===================================================================
RCS file: /cvsroot/src/sys/arch/sun68k/include/intr.h,v
retrieving revision 1.7
diff -u -r1.7 intr.h
--- sys/arch/sun68k/include/intr.h	29 Mar 2006 08:55:40 -0000	1.7
+++ sys/arch/sun68k/include/intr.h	2 Aug 2006 14:04:36 -0000
@@ -48,11 +48,14 @@
 #define _IPL_SOFT_LEVEL_MAX	3
 
 #define	IPL_NONE	0
-#define	IPL_SOFTCLOCK	(PSL_S|PSL_IPL1)
-#define	IPL_SOFTNET	(PSL_S|PSL_IPL1)
+#define	IPL_SOFT_LEVEL1	(PSL_S|PSL_IPL1)
+#define	IPL_SOFT_LEVEL2	(PSL_S|PSL_IPL2)
+#define	IPL_SOFT_LEVEL3	(PSL_S|PSL_IPL3)
+#define	IPL_SOFTCLOCK	IPL_SOFT_LEVEL1
+#define	IPL_SOFTNET	IPL_SOFT_LEVEL1
 #define	IPL_BIO		(PSL_S|PSL_IPL2)
 #define	IPL_NET		(PSL_S|PSL_IPL3)
-#define	IPL_SOFTSERIAL	(PSL_S|PSL_IPL3)
+#define	IPL_SOFTSERIAL	IPL_SOFT_LEVEL3
 #define	IPL_TTY		(PSL_S|PSL_IPL4)
 #define	IPL_VM		(PSL_S|PSL_IPL4)
 /* Intersil or Am9513 clock hardware interrupts (hard-wired at 5) */
Index: sys/arch/sun68k/sun68k/isr.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sun68k/sun68k/isr.c,v
retrieving revision 1.8
diff -u -r1.8 isr.c
--- sys/arch/sun68k/sun68k/isr.c	29 Mar 2006 08:55:40 -0000	1.8
+++ sys/arch/sun68k/sun68k/isr.c	2 Aug 2006 14:04:37 -0000
@@ -305,13 +305,18 @@
 {
 	struct softintr_handler *sh;
 	struct softintr_head *shd;
+	int level;
 
-	ipl &= ~PSL_S;
-	if (ipl < _IPL_SOFT_LEVEL_MIN || ipl > _IPL_SOFT_LEVEL_MAX)
+	if (ipl == IPL_SOFT_LEVEL1)
+		level = _IPL_SOFT_LEVEL1;
+	else if (ipl == IPL_SOFT_LEVEL2)
+		level = _IPL_SOFT_LEVEL2;
+	else if (ipl == IPL_SOFT_LEVEL3)
+		level = _IPL_SOFT_LEVEL3;
+	else
 		panic("softintr_establish: unsupported soft IPL");
 
-	shd = &soft_level_heads[ipl - _IPL_SOFT_LEVEL_MIN];
-
+	shd = &soft_level_heads[level - _IPL_SOFT_LEVEL_MIN];
 	sh = malloc(sizeof(*sh), M_SOFTINTR, M_NOWAIT);
 	if (sh == NULL)
 		return NULL;