Skip to contentSkip to conversation

m68knommu: use generic irq framework

PATCH In review Greg Ungerer 2 participants 3 messages May 4, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 m68knommu: use generic irq framework

Change the m68knommu irq handling to use the generic irq framework.

---

 arch/m68knommu/Kconfig                 |    4 
 arch/m68knommu/kernel/Makefile         |    4 
 arch/m68knommu/kernel/asm-offsets.c    |    5 
 arch/m68knommu/kernel/irq.c            |   82 +++++++++
 arch/m68knommu/kernel/setup.c          |    6 
 arch/m68knommu/kernel/traps.c          |    2 
 arch/m68knommu/platform/5307/Makefile  |    2 
 arch/m68knommu/platform/5307/entry.S   |   39 +---
 arch/m68knommu/platform/5307/ints.c    |  279 ---------------------------------
 arch/m68knommu/platform/5307/vectors.c |   29 ++-
 arch/m68knommu/platform/68328/entry.S  |   10 -
 arch/m68knommu/platform/68328/ints.c   |  130 ++-------------
 arch/m68knommu/platform/68360/entry.S  |    6 
 arch/m68knommu/platform/68360/ints.c   |  233 +--------------------------
 include/asm-m68knommu/irq.h            |   75 --------
 include/asm-m68knommu/irqnode.h        |   36 ----
 include/asm-m68knommu/m68360.h         |    8 
 include/asm-m68knommu/machdep.h        |   10 -
 include/asm-m68knommu/traps.h          |    4 
 19 files changed, 171 insertions(+), 793 deletions(-)
arch/m68knommu/Kconfig +4 -0
diff -Naur linux-2.6.21/arch/m68knommu/Kconfig linux-2.6.21-gt/arch/m68knommu/Kconfig
@@ -45,6 +45,10 @@
 	bool
 	default y
 
+config GENERIC_HARDIRQS
+	bool
+	default y
+
 config GENERIC_CALIBRATE_DELAY
 	bool
 	default y
arch/m68knommu/kernel/asm-offsets.c +0 -5
diff -Naur linux-2.6.21/arch/m68knommu/kernel/asm-offsets.c linux-2.6.21-gt/arch/m68knommu/kernel/asm-offsets.c
@@ -15,7 +15,6 @@
 #include <linux/hardirq.h>
 #include <asm/bootinfo.h>
 #include <asm/irq.h>
-#include <asm/irqnode.h>
 #include <asm/thread_info.h>
 
 #define DEFINE(sym, val) \
@@ -72,10 +71,6 @@
 #else
 	/* bitfields are a bit difficult */
 	DEFINE(PT_VECTOR, offsetof(struct pt_regs, pc) + 4);
-	/* offsets into the irq_handler struct */
-	DEFINE(IRQ_HANDLER, offsetof(struct irq_node, handler));
-	DEFINE(IRQ_DEVID, offsetof(struct irq_node, dev_id));
-	DEFINE(IRQ_NEXT, offsetof(struct irq_node, next));
 #endif
 
 	/* offsets into the kernel_stat struct */
arch/m68knommu/kernel/irq.c +82 -0

82 lines not on this page · raw message

arch/m68knommu/kernel/Makefile +2 -2
diff -Naur linux-2.6.21/arch/m68knommu/kernel/Makefile linux-2.6.21-gt/arch/m68knommu/kernel/Makefile
@@ -4,8 +4,8 @@
 
 extra-y := vmlinux.lds
 
-obj-y += dma.o entry.o init_task.o m68k_ksyms.o process.o ptrace.o semaphore.o \
-	 setup.o signal.o syscalltable.o sys_m68k.o time.o traps.o
+obj-y += dma.o entry.o init_task.o irq.o m68k_ksyms.o process.o ptrace.o \
+	 semaphore.o setup.o signal.o syscalltable.o sys_m68k.o time.o traps.o
 
 obj-$(CONFIG_MODULES)	+= module.o
 obj-$(CONFIG_COMEMPCI)	+= comempci.o
arch/m68knommu/kernel/setup.c +0 -6
diff -Naur linux-2.6.21/arch/m68knommu/kernel/setup.c linux-2.6.21-gt/arch/m68knommu/kernel/setup.c
@@ -57,12 +57,6 @@
 int (*mach_keyb_init) (void);
 int (*mach_kbdrate) (struct kbd_repeat *);
 void (*mach_kbd_leds) (unsigned int);
-/* machine dependent irq functions */
-void (*mach_init_IRQ) (void);
-irq_handler_t mach_default_handler;
-int (*mach_get_irq_list) (struct seq_file *, void *);
-void (*mach_process_int) (int irq, struct pt_regs *fp);
-void (*mach_trap_init) (void);
 /* machine dependent timer functions */
 unsigned long (*mach_gettimeoffset) (void);
 void (*mach_gettod) (int*, int*, int*, int*, int*, int*);
arch/m68knommu/kernel/traps.c +0 -2
diff -Naur linux-2.6.21/arch/m68knommu/kernel/traps.c linux-2.6.21-gt/arch/m68knommu/kernel/traps.c
@@ -62,8 +62,6 @@
 
 void __init trap_init(void)
 {
-	if (mach_trap_init)
-		mach_trap_init();
 }
 
 void die_if_kernel(char *str, struct pt_regs *fp, int nr)
arch/m68knommu/platform/5307/entry.S +9 -30
diff -Naur linux-2.6.21/arch/m68knommu/platform/5307/entry.S linux-2.6.21-gt/arch/m68knommu/platform/5307/entry.S
@@ -1,7 +1,7 @@
 /*
  *  linux/arch/m68knommu/platform/5307/entry.S
  *
- *  Copyright (C) 1999-2002, Greg Ungerer ([email protected])
+ *  Copyright (C) 1999-2007, Greg Ungerer ([email protected])
  *  Copyright (C) 1998  D. Jeff Dionne <[email protected]>,
  *                      Kenneth Albanowski <[email protected]>,
  *  Copyright (C) 2000  Lineo Inc. (www.lineo.com)
@@ -162,27 +162,15 @@
 	SAVE_ALL
 	moveq	#-1,%d0
 	movel	%d0,%sp@(PT_ORIG_D0)
-	addql	#1,local_irq_count
 
 	movew	%sp@(PT_FORMATVEC),%d0	/* put exception # in d0 */
 	andl	#0x03fc,%d0		/* mask out vector only */
 
-	leal	per_cpu__kstat+STAT_IRQ,%a0
-	addql	#1,%a0@(%d0)
-
+	movel	%sp,%sp@-		/* push regs arg */
 	lsrl	#2,%d0			/* calculate real vector # */
-	movel	%d0,%d1			/* calculate array offset */
-	lsll	#4,%d1
-	lea	irq_list,%a0
-	addl	%d1,%a0			/* pointer to array struct */
-
-	movel	%sp,%sp@-		/* push regs arg onto stack */
-	movel	%a0@(8),%sp@-		/* push devid arg */
-	movel	%d0,%sp@-		/* push vector # on stack */
-
-	movel	%a0@,%a0		/* get function to call */
-	jbsr	%a0@			/* call vector handler */
-	lea	%sp@(12),%sp		/* pop parameters off stack */
+	movel	%d0,%sp@-		/* push vector number */
+	jbsr	do_IRQ			/* call high level irq handler */
+	lea	%sp@(8),%sp		/* pop args off stack */
 
 	bra	ret_from_interrupt	/* this was fallthrough */
 
@@ -198,24 +186,15 @@
 	movew	%sp@(PT_FORMATVEC),%d0
 	andl	#0x03fc,%d0		/* mask out vector only */
 
-	leal	per_cpu__kstat+STAT_IRQ,%a0
-	addql	#1,%a0@(%d0)
-
-	movel	%sp,%sp@-		/* push regs arg onto stack */
-	clrl	%sp@-			/* push devid arg */
+	movel	%sp,%sp@-		/* push regs arg */
 	lsrl	#2,%d0			/* calculate real vector # */
-	movel	%d0,%sp@-		/* push vector # on stack */
-
-	lsll	#4,%d0			/* adjust for array offset */
-	lea	irq_list,%a0
-	movel	%a0@(%d0),%a0		/* get function to call */
-	jbsr	%a0@			/* call vector handler */
-	lea	%sp@(12),%sp		/* pop parameters off stack */
+	movel	%d0,%sp@-		/* push vector number */
+	jbsr	do_IRQ			/* call high level irq handler */
+	lea	%sp@(8),%sp		/* pop args off stack */
 
 	RESTORE_LOCAL
 
 ENTRY(ret_from_interrupt)
-	subql	#1,local_irq_count
 	jeq	2f
 1:
 	RESTORE_ALL
arch/m68knommu/platform/5307/ints.c +0 -279

279 lines not on this page · raw message

arch/m68knommu/platform/5307/Makefile +1 -1
diff -Naur linux-2.6.21/arch/m68knommu/platform/5307/Makefile linux-2.6.21-gt/arch/m68knommu/platform/5307/Makefile
@@ -16,7 +16,7 @@
 AFLAGS += -DDEBUGGER_COMPATIBLE_CACHE=1
 endif
 
-obj-$(CONFIG_COLDFIRE)	+= entry.o vectors.o ints.o
+obj-$(CONFIG_COLDFIRE)	+= entry.o vectors.o
 obj-$(CONFIG_M5206)	+= timers.o
 obj-$(CONFIG_M5206e)	+= timers.o
 obj-$(CONFIG_M520x)	+= pit.o
arch/m68knommu/platform/5307/vectors.c +20 -9
diff -Naur linux-2.6.21/arch/m68knommu/platform/5307/vectors.c linux-2.6.21-gt/arch/m68knommu/platform/5307/vectors.c
@@ -3,23 +3,17 @@
 /*
  *	linux/arch/m68knommu/platform/5307/vectors.c
  *
- *	Copyright (C) 1999-2003, Greg Ungerer <[email protected]>
+ *	Copyright (C) 1999-2007, Greg Ungerer <[email protected]>
  */
 
 /***************************************************************************/
 
 #include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/param.h>
 #include <linux/init.h>
-#include <linux/unistd.h>
-#include <linux/delay.h>
-#include <asm/irq.h>
-#include <asm/dma.h>
+#include <linux/irq.h>
 #include <asm/traps.h>
 #include <asm/machdep.h>
 #include <asm/coldfire.h>
-#include <asm/mcftimer.h>
 #include <asm/mcfsim.h>
 #include <asm/mcfdma.h>
 #include <asm/mcfwdebug.h>
@@ -56,7 +50,7 @@
 asmlinkage void system_call(void);
 asmlinkage void inthandler(void);
 
-void __init coldfire_trap_init(void)
+void __init init_vectors(void)
 {
 	int i;
 
@@ -86,6 +80,23 @@
 
 /***************************************************************************/
 
+void enable_vector(unsigned int irq)
+{
+	/* Currently no action on ColdFire */
+}
+
+void disable_vector(unsigned int irq)
+{
+	/* Currently no action on ColdFire */
+}
+
+void ack_vector(unsigned int irq)
+{
+	/* Currently no action on ColdFire */
+}
+
+/***************************************************************************/
+
 void coldfire_reset(void)
 {
 	HARD_RESET_NOW();
arch/m68knommu/platform/68328/entry.S +0 -10
diff -Naur linux-2.6.21/arch/m68knommu/platform/68328/entry.S linux-2.6.21-gt/arch/m68knommu/platform/68328/entry.S
@@ -133,7 +133,6 @@
  */
 inthandler1:
 	SAVE_ALL
-	addql	#1,local_irq_count	/*  put exception # in d0*/
 	movew	%sp@(PT_VECTOR), %d0
 	and	#0x3ff, %d0
 
@@ -145,7 +144,6 @@
 
 inthandler2:
 	SAVE_ALL
-	addql	#1,local_irq_count	/*  put exception # in d0*/
 	movew	%sp@(PT_VECTOR), %d0
 	and	#0x3ff, %d0
 
@@ -157,7 +155,6 @@
 
 inthandler3:
 	SAVE_ALL
-	addql	#1,local_irq_count	/*  put exception # in d0*/
 	movew	%sp@(PT_VECTOR), %d0
 	and	#0x3ff, %d0
 
@@ -169,7 +166,6 @@
 
 inthandler4:
 	SAVE_ALL
-	addql	#1,local_irq_count	/*  put exception # in d0*/
 	movew	%sp@(PT_VECTOR), %d0
 	and	#0x3ff, %d0
 
@@ -181,7 +177,6 @@
 
 inthandler5:
 	SAVE_ALL
-	addql	#1,local_irq_count	/*  put exception # in d0*/
 	movew	%sp@(PT_VECTOR), %d0
 	and	#0x3ff, %d0
 
@@ -193,7 +188,6 @@
 
 inthandler6:
 	SAVE_ALL
-	addql	#1,local_irq_count	/*  put exception # in d0*/
 	movew	%sp@(PT_VECTOR), %d0
 	and	#0x3ff, %d0
 
@@ -205,7 +199,6 @@
 
 inthandler7:
 	SAVE_ALL
-	addql	#1,local_irq_count	/*  put exception # in d0*/
 	movew	%sp@(PT_VECTOR), %d0
 	and	#0x3ff, %d0
 
@@ -217,7 +210,6 @@
 
 inthandler:
 	SAVE_ALL
-	addql	#1,local_irq_count	/*  put exception # in d0*/
 	movew	%sp@(PT_VECTOR), %d0
 	and	#0x3ff, %d0
 
@@ -228,7 +220,6 @@
 	bra	ret_from_interrupt
 
 ret_from_interrupt:
-	subql	#1,local_irq_count
 	jeq	1f
 2:
 	RESTORE_ALL
@@ -238,7 +229,6 @@
 	jhi	2b
 
 	/* check if we need to do software interrupts */
-	movel	local_irq_count,%d0
 	jeq	ret_from_exception
 
 	pea	ret_from_exception
arch/m68knommu/platform/68328/ints.c +21 -109

168 lines not on this page · raw message

arch/m68knommu/platform/68360/entry.S +2 -4
diff -Naur linux-2.6.21/arch/m68knommu/platform/68360/entry.S linux-2.6.21-gt/arch/m68knommu/platform/68360/entry.S
@@ -120,23 +120,21 @@
 	RESTORE_ALL
 
 /*
- * This is the main interrupt handler, responsible for calling process_int()
+ * This is the main interrupt handler, responsible for calling do_IRQ()
  */
 inthandler:
 	SAVE_ALL
-	addql	#1,local_irq_count	/*  put exception # in d0*/
 	movew	%sp@(PT_VECTOR), %d0
 	and.l	#0x3ff, %d0
 	lsr.l   #0x02,  %d0
 
 	movel	%sp,%sp@-
 	movel	%d0,%sp@- 		/*  put vector # on stack*/
-	jbsr	process_int		/*  process the IRQ*/
+	jbsr	do_IRQ			/*  process the IRQ*/
 3:     	addql	#8,%sp			/*  pop parameters off stack*/
 	bra	ret_from_interrupt
 
 ret_from_interrupt:
-	subql	#1,local_irq_count
 	jeq	1f
 2:
 	RESTORE_ALL
arch/m68knommu/platform/68360/ints.c +13 -220

278 lines not on this page · raw message

include/asm-m68knommu/irq.h +5 -70

87 lines not on this page · raw message

include/asm-m68knommu/irqnode.h +0 -36
diff -Naur linux-2.6.21/include/asm-m68knommu/irqnode.h linux-2.6.21-gt/include/asm-m68knommu/irqnode.h
@@ -1,36 +0,0 @@
-#ifndef _M68K_IRQNODE_H_
-#define _M68K_IRQNODE_H_
-
-#include <linux/interrupt.h>
-
-/*
- * This structure is used to chain together the ISRs for a particular
- * interrupt source (if it supports chaining).
- */
-typedef struct irq_node {
-	irq_handler_t	handler;
-	unsigned long	flags;
-	void		*dev_id;
-	const char	*devname;
-	struct irq_node *next;
-} irq_node_t;
-
-/*
- * This structure has only 4 elements for speed reasons
- */
-struct irq_entry {
-	irq_handler_t	handler;
-	unsigned long	flags;
-	void		*dev_id;
-	const char	*devname;
-};
-
-/* count of spurious interrupts */
-extern volatile unsigned int num_spurious;
-
-/*
- * This function returns a new irq_node_t
- */
-extern irq_node_t *new_irq_node(void);
-
-#endif /* _M68K_IRQNODE_H_ */
include/asm-m68knommu/m68360.h +8 -0
diff -Naur linux-2.6.21/include/asm-m68knommu/m68360.h linux-2.6.21-gt/include/asm-m68knommu/m68360.h
@@ -3,3 +3,11 @@
 #include "m68360_quicc.h"
 #include "m68360_enet.h"
 
+#ifdef CONFIG_M68360
+
+#define CPM_INTERRUPT    4
+
+/* see MC68360 User's Manual, p. 7-377  */
+#define CPM_VECTOR_BASE  0x04           /* 3 MSbits of CPM vector */
+
+#endif /* CONFIG_M68360 */
include/asm-m68knommu/machdep.h +0 -10
diff -Naur linux-2.6.21/include/asm-m68knommu/machdep.h linux-2.6.21-gt/include/asm-m68knommu/machdep.h
@@ -16,16 +16,6 @@
 extern int (*mach_keyb_init) (void);
 extern int (*mach_kbdrate) (struct kbd_repeat *);
 extern void (*mach_kbd_leds) (unsigned int);
-/* machine dependent irq functions */
-extern void (*mach_init_IRQ) (void);
-extern irq_handler_t mach_default_handler;
-extern int (*mach_request_irq) (unsigned int irq, void (*handler)(int, void *, struct pt_regs *),
-                                unsigned long flags, const char *devname, void *dev_id);
-extern void (*mach_free_irq) (unsigned int irq, void *dev_id);
-extern void (*mach_get_model) (char *model);
-extern int (*mach_get_hardware_list) (char *buffer);
-extern int (*mach_get_irq_list) (struct seq_file *p, void *v);
-extern void (*mach_process_int) (int irq, struct pt_regs *fp);
 /* machine dependent timer functions */
 extern unsigned long (*mach_gettimeoffset)(void);
 extern void (*mach_gettod)(int *year, int *mon, int *day, int *hour,
include/asm-m68knommu/traps.h +4 -0
diff -Naur linux-2.6.21/include/asm-m68knommu/traps.h linux-2.6.21-gt/include/asm-m68knommu/traps.h
@@ -16,6 +16,10 @@
 typedef void (*e_vector)(void);
 
 extern e_vector vectors[];
+extern void init_vectors(void);
+extern void enable_vector(unsigned int irq);
+extern void disable_vector(unsigned int irq);
+extern void ack_vector(unsigned int irq);
 
 #endif
 
#1 lore raw

arch/m68knommu/kernel/irq.c line 2

Quoted 5 lines
arch/m68knommu/kernel/irq.c +2 -0
@@ -0,0 +1,82 @@
+/*
+ * arch/m68knommu/kernel/irq.c

No need for top of file filename comments, they don't provide anything but easily get out of sync.

Except for that little nitpick the patch looks very good to me, thanks a lot for doing the conversion.

#2 lore raw

Hi Christoph,

Quoted 8 lines · Christoph Hellwig

arch/m68knommu/kernel/irq.c line 2

Quoted 5 lines
arch/m68knommu/kernel/irq.c +2 -0
@@ -0,0 +1,82 @@
+/*
+ * arch/m68knommu/kernel/irq.c

No need for top of file filename comments, they don't provide anything but easily get out of sync.

Ok, I'll take that.

Quoted 2 lines

Except for that little nitpick the patch looks very good to me, thanks a lot for doing the conversion.

Regards
Greg

------------------------------------------------------------------------

Greg Ungerer  --  Chief Software Dude       EMAIL:     [email protected]
SnapGear -- a Secure Computing Company      PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com