Subject: Re: port-shark/22355 [was: Help needed to fix NetBSD/shark]
To: None <chris@dokein.co.uk>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-arm
Date: 08/08/2007 20:05:26
chris@dokein.co.uk wrote:

> > If we fix both shark/isa/isa_irq.S and arm/iomd/iomd_irq.S,
> > no other source refers the spl_mask variable (except debug printfs).
> > Should we also remove it especially from arm/arm32/spl.S?
> 
> Yes we should, it avoids anyone thinking it still works, and it's one
> less thing for spl to do.

Okay, I'll commit the following patch.
---
Izumi Tsutsui


Index: arch/acorn32/acorn32/rpc_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/acorn32/acorn32/rpc_machdep.c,v
retrieving revision 1.65
diff -u -r1.65 rpc_machdep.c
--- arch/acorn32/acorn32/rpc_machdep.c	24 Oct 2006 21:03:13 -0000	1.65
+++ arch/acorn32/acorn32/rpc_machdep.c	8 Aug 2007 10:46:08 -0000
@@ -234,7 +234,6 @@
 
 /* NOTE: These variables will be removed, well some of them */
 
-extern u_int spl_mask;
 extern u_int current_mask;
 
 void
Index: arch/acorn32/eb7500atx/eb7500atx_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/acorn32/eb7500atx/eb7500atx_machdep.c,v
retrieving revision 1.6
diff -u -r1.6 eb7500atx_machdep.c
--- arch/acorn32/eb7500atx/eb7500atx_machdep.c	24 Oct 2006 21:03:13 -0000	1.6
+++ arch/acorn32/eb7500atx/eb7500atx_machdep.c	8 Aug 2007 10:46:08 -0000
@@ -234,7 +234,6 @@
 
 /* NOTE: These variables will be removed, well some of them */
 
-extern u_int spl_mask;
 extern u_int current_mask;
 
 void
Index: arch/arm/arm32/intr.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/arm32/intr.c,v
retrieving revision 1.22
diff -u -r1.22 intr.c
--- arch/arm/arm32/intr.c	4 Aug 2007 16:31:21 -0000	1.22
+++ arch/arm/arm32/intr.c	8 Aug 2007 10:46:09 -0000
@@ -58,8 +58,6 @@
  
 extern int current_spl_level;
 
-extern unsigned spl_mask;
-
 /* Generate soft interrupt counts if IRQSTATS is defined */
 /* Prototypes */
 static void clearsoftintr(u_int); 
Index: arch/arm/arm32/spl.S
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/arm32/spl.S,v
retrieving revision 1.4
diff -u -r1.4 spl.S
--- arch/arm/arm32/spl.S	17 Aug 2002 16:36:34 -0000	1.4
+++ arch/arm/arm32/spl.S	8 Aug 2007 10:46:09 -0000
@@ -48,12 +48,6 @@
 .Lcurrent_spl_level:
 	.word	_C_LABEL(current_spl_level)
 
-.Lspl_masks:
-	.word	_C_LABEL(spl_masks)
-
-.Lspl_mask:
-	.word	_C_LABEL(spl_mask)
-
 ENTRY(raisespl)
 	mov	r3, r0			/* Save the new value */
 	ldr	r1, .Lcurrent_spl_level	/* Get the current spl level */
@@ -63,12 +57,6 @@
 
 	str	r3, [r1]		/* Store the new spl level */
 
-	ldr	r2, .Lspl_masks		/* Get the spl mask */
-	ldr	r2, [r2, r3, lsl #2]
-
-	ldr	r1, .Lspl_mask		/* Store in the current spl mask */
-	str	r2, [r1]
-
 					/* stack alignment is 8 bytes */
 	stmfd	sp!, {r0, lr}		/* Preserve registers */
 	bl	_C_LABEL(irq_setmasks)	/* Update the actual masks */
@@ -83,12 +71,6 @@
 
 	str	r3, [r1]		/* Store the new spl level */
 
-	ldr	r2, .Lspl_masks		/* Get the spl mask */
-	ldr	r2, [r2, r3, lsl #2]
-
-	ldr	r1, .Lspl_mask		/* Store in the current spl mask */
-	str	r2, [r1]
-
 					/* stack alignment is 8 bytes */
 	stmfd	sp!, {r0, lr}		/* Preserve registers */
 	bl	_C_LABEL(irq_setmasks)	/* Update the actual masks */
@@ -104,15 +86,8 @@
 
 	str	r3, [r1]		/* Store the new spl level */
 
-	ldr	r2, .Lspl_masks		/* Get the spl mask */
-
-	ldr	r1, .Lspl_mask		/* Store in the current spl mask */
-
-	ldr	r2, [r2, r3, lsl #2]	/* Use r4 so available later */
-	
 					/* stack alignment is 8 bytes */
 	stmfd	sp!, {r0, lr}		/* Preserve registers */
-	str	r2, [r1]
 
 	bl	_C_LABEL(irq_setmasks)	/* Update the actual masks */
 	bl	_C_LABEL(dosoftints)	/* Process any pending soft ints */
Index: arch/arm/iomd/iomd_irq.S
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/iomd/iomd_irq.S,v
retrieving revision 1.6
diff -u -r1.6 iomd_irq.S
--- arch/arm/iomd/iomd_irq.S	9 Mar 2007 19:21:58 -0000	1.6
+++ arch/arm/iomd/iomd_irq.S	8 Aug 2007 10:46:09 -0000
@@ -347,9 +347,6 @@
 	/* NOT REACHED */
 	b	. - 8
 
-Lspl_mask:
-	.word	_C_LABEL(spl_mask)	/* irq's allowed at current spl level */
-
 Lcurrent_mask:
 	.word	_C_LABEL(current_mask)	/* irq's that are usable */
 
@@ -361,9 +358,11 @@
 
 	/* Calculate IOMD interrupt mask */
 	ldr	r1, Lcurrent_mask	/* All the enabled interrupts */
-	ldr	r2, Lspl_mask		/* Block due to current spl level */
 	ldr	r1, [r1]
+	ldr	r0, Lspl_masks		/* Block due to current spl level */
+	ldr	r2, Lcurrent_spl_level
 	ldr	r2, [r2]
+	ldr	r2, [r0, r2, lsl #2]
 	and	r1, r1, r2
 	ldr	r2, Ldisabled_mask	/* Block due to active interrupts */
 	ldr	r2, [r2]
Index: arch/arm/iomd/iomd_irqhandler.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/iomd/iomd_irqhandler.c,v
retrieving revision 1.13
diff -u -r1.13 iomd_irqhandler.c
--- arch/arm/iomd/iomd_irqhandler.c	19 Feb 2007 21:46:32 -0000	1.13
+++ arch/arm/iomd/iomd_irqhandler.c	8 Aug 2007 10:46:09 -0000
@@ -63,7 +63,6 @@
 u_int current_mask;
 u_int actual_mask;
 u_int disabled_mask;
-u_int spl_mask;
 u_int irqmasks[IPL_LEVELS];
 
 extern char *_intrnames;
@@ -118,7 +117,6 @@
 	current_mask = 0x00000000;
 	disabled_mask = 0x00000000;
 	actual_mask = 0x00000000;
-	spl_mask = 0x00000000;
 
 	set_spl_masks();
 
Index: arch/arm/ofw/ofw_irq.S
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/ofw/ofw_irq.S,v
retrieving revision 1.7
diff -u -r1.7 ofw_irq.S
--- arch/arm/ofw/ofw_irq.S	9 Mar 2007 19:21:59 -0000	1.7
+++ arch/arm/ofw/ofw_irq.S	8 Aug 2007 10:46:09 -0000
@@ -333,9 +333,6 @@
 	PULLFRAMEFROMSVCANDEXIT
 	movs	pc, lr			/* Exit */
 
-Lspl_mask:
-	.word	_C_LABEL(spl_mask)	/* irq's allowed at current spl level */
-
 Lcurrent_mask:
 	.word	_C_LABEL(current_mask)	/* irq's that are usable */
 
Index: arch/arm/ofw/ofw_irqhandler.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/ofw/ofw_irqhandler.c,v
retrieving revision 1.10
diff -u -r1.10 ofw_irqhandler.c
--- arch/arm/ofw/ofw_irqhandler.c	8 Mar 2007 20:48:39 -0000	1.10
+++ arch/arm/ofw/ofw_irqhandler.c	8 Aug 2007 10:46:09 -0000
@@ -61,7 +61,6 @@
 u_int current_mask;
 u_int actual_mask;
 u_int disabled_mask;
-u_int spl_mask;
 u_int irqmasks[IPL_LEVELS];
 extern u_int intrcnt[];
 
@@ -100,7 +99,6 @@
 	current_mask = 0x00000000;
 	disabled_mask = 0x00000000;
 	actual_mask = 0x00000000;
-	spl_mask = 0x00000000;
 
 	set_spl_masks();
 
Index: arch/arm/sa11x0/sa11x0_irqhandler.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/sa11x0/sa11x0_irqhandler.c,v
retrieving revision 1.10
diff -u -r1.10 sa11x0_irqhandler.c
--- arch/arm/sa11x0/sa11x0_irqhandler.c	27 Jun 2006 13:58:08 -0000	1.10
+++ arch/arm/sa11x0/sa11x0_irqhandler.c	8 Aug 2007 10:46:09 -0000
@@ -101,7 +101,6 @@
 #define IPL_LEVELS (NIPL+1)
 u_int imask[NIPL];
 #else
-u_int spl_mask;
 u_int irqmasks[IPL_LEVELS];
 #endif
 
Index: arch/shark/isa/isa_irq.S
===================================================================
RCS file: /cvsroot/src/sys/arch/shark/isa/isa_irq.S,v
retrieving revision 1.7
diff -u -r1.7 isa_irq.S
--- arch/shark/isa/isa_irq.S	9 Mar 2007 19:21:59 -0000	1.7
+++ arch/shark/isa/isa_irq.S	8 Aug 2007 10:46:10 -0000
@@ -297,9 +297,6 @@
 	/* NOT REACHED */
 	b	. - 8
 
-Lspl_mask:
-	.word	_C_LABEL(spl_mask)	/* irq's allowed at current spl level */
-
 Lcurrent_mask:
 	.word	_C_LABEL(current_mask)	/* irq's that are usable */
 
@@ -318,8 +315,10 @@
 	ldr	r1, Lcurrent_mask	/* All the enabled interrupts */
 	ldrh	r1, [r1]		/* get hardware bits of mask */
 /*	.word	0xe0d110b0 */		/* hand-assembled ldrh r1, [r1] */
-	ldr	r2, Lspl_mask		/* Block due to current spl level */
+	ldr	r0, Lspl_masks
+	ldr	r2, Lcurrent_spl_level
 	ldr	r2, [r2]
+	ldr	r2, [r0, r2, lsl #2]
 	and	r1, r1, r2
 	ldr	r2, Ldisabled_mask	/* Block due to active interrupts */
 	ldr	r2, [r2]
Index: arch/shark/isa/isa_irqhandler.c
===================================================================
RCS file: /cvsroot/src/sys/arch/shark/isa/isa_irqhandler.c,v
retrieving revision 1.14
diff -u -r1.14 isa_irqhandler.c
--- arch/shark/isa/isa_irqhandler.c	9 Mar 2007 18:20:51 -0000	1.14
+++ arch/shark/isa/isa_irqhandler.c	8 Aug 2007 10:46:10 -0000
@@ -94,7 +94,6 @@
 u_int current_mask;
 u_int actual_mask;
 u_int disabled_mask;
-u_int spl_mask;
 u_int irqmasks[IPL_LEVELS];
 
 /* Prototypes */
@@ -133,7 +132,6 @@
 	current_mask = 0x00000000;
 	disabled_mask = 0x00000000;
 	actual_mask = 0x00000000;
-	spl_mask = 0x00000000;
 
 	set_spl_masks();
 
Index: arch/shark/ofw/ofw.c
===================================================================
RCS file: /cvsroot/src/sys/arch/shark/ofw/ofw.c,v
retrieving revision 1.39
diff -u -r1.39 ofw.c
--- arch/shark/ofw/ofw.c	30 Jul 2007 13:02:01 -0000	1.39
+++ arch/shark/ofw/ofw.c	8 Aug 2007 10:46:10 -0000
@@ -102,7 +102,6 @@
 
 #ifdef	DIAGNOSTIC
 /* NOTE: These variables will be removed, well some of them */
-extern u_int spl_mask;
 extern u_int current_mask;
 #endif
 
@@ -338,7 +337,7 @@
 
 #ifdef DIAGNOSTIC
 	printf("boot: howto=%08x curlwp=%p\n", howto, curlwp);
-	printf("current_mask=%08x spl_mask=%08x\n", current_mask, spl_mask);
+	printf("current_mask=%08x\n", current_mask);
 
 	printf("ipl_bio=%08x ipl_net=%08x ipl_tty=%08x ipl_vm=%08x\n",
 	    irqmasks[IPL_BIO], irqmasks[IPL_NET], irqmasks[IPL_TTY],