Skip to content

Commit

Permalink
m68knommu: generic irq handling
Browse files Browse the repository at this point in the history
Change the m68knommu irq handling to use the generic irq framework.

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Greg Ungerer authored and Linus Torvalds committed Jul 19, 2007
1 parent f8af0bb commit 2502b66
Show file tree
Hide file tree
Showing 17 changed files with 172 additions and 779 deletions.
4 changes: 4 additions & 0 deletions arch/m68knommu/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ config GENERIC_HWEIGHT
bool
default y

config GENERIC_HARDIRQS
bool
default y

config GENERIC_CALIBRATE_DELAY
bool
default y
Expand Down
4 changes: 2 additions & 2 deletions arch/m68knommu/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 0 additions & 5 deletions arch/m68knommu/kernel/asm-offsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down Expand Up @@ -72,10 +71,6 @@ int main(void)
#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 */
Expand Down
82 changes: 82 additions & 0 deletions arch/m68knommu/kernel/irq.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* irq.c
*
* (C) Copyright 2007, Greg Ungerer <gerg@snapgear.com>
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive
* for more details.
*/

#include <linux/types.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/kernel_stat.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/seq_file.h>
#include <asm/system.h>
#include <asm/traps.h>

asmlinkage void do_IRQ(int irq, struct pt_regs *regs)
{
struct pt_regs *oldregs = set_irq_regs(regs);

irq_enter();
__do_IRQ(irq);
irq_exit();

set_irq_regs(oldregs);
}

void ack_bad_irq(unsigned int irq)
{
printk(KERN_ERR "IRQ: unexpected irq=%d\n", irq);
}

static struct irq_chip m_irq_chip = {
.name = "M68K-INTC",
.enable = enable_vector,
.disable = disable_vector,
.ack = ack_vector,
};

void __init init_IRQ(void)
{
int irq;

init_vectors();

for (irq = 0; (irq < NR_IRQS); irq++) {
irq_desc[irq].status = IRQ_DISABLED;
irq_desc[irq].action = NULL;
irq_desc[irq].depth = 1;
irq_desc[irq].chip = &m_irq_chip;
}
}

int show_interrupts(struct seq_file *p, void *v)
{
struct irqaction *ap;
int irq = *((loff_t *) v);

if (irq == 0)
seq_puts(p, " CPU0\n");

if (irq < NR_IRQS) {
ap = irq_desc[irq].action;
if (ap) {
seq_printf(p, "%3d: ", irq);
seq_printf(p, "%10u ", kstat_irqs(irq));
seq_printf(p, "%14s ", irq_desc[irq].chip->name);

seq_printf(p, "%s", ap->name);
for (ap = ap->next; ap; ap = ap->next)
seq_printf(p, ", %s", ap->name);
seq_putc(p, '\n');
}
}

return 0;
}

2 changes: 0 additions & 2 deletions arch/m68knommu/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ static char const * const vec_names[] = {

void __init trap_init(void)
{
if (mach_trap_init)
mach_trap_init();
}

void die_if_kernel(char *str, struct pt_regs *fp, int nr)
Expand Down
2 changes: 1 addition & 1 deletion arch/m68knommu/platform/5307/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ifdef CONFIG_FULLDEBUG
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
Expand Down
42 changes: 10 additions & 32 deletions arch/m68knommu/platform/5307/entry.S
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* linux/arch/m68knommu/platform/5307/entry.S
*
* Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
* Copyright (C) 1999-2007, Greg Ungerer (gerg@snapgear.com)
* Copyright (C) 1998 D. Jeff Dionne <jeff@lineo.ca>,
* Kenneth Albanowski <kjahds@kjahds.com>,
* Copyright (C) 2000 Lineo Inc. (www.lineo.com)
Expand Down Expand Up @@ -155,34 +155,21 @@ Lsignal_return:

/*
* This is the generic interrupt handler (for all hardware interrupt
* sources). It figures out the vector number and calls the appropriate
* interrupt service routine directly.
* sources). Calls upto high level code to do all the work.
*/
ENTRY(inthandler)
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 */

Expand All @@ -198,24 +185,15 @@ ENTRY(fasthandler)
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
Expand Down
Loading

0 comments on commit 2502b66

Please sign in to comment.