blob: d36836dbbc0722758f9e116537c5e413a6e4871a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 *
3 * linux/arch/cris/kernel/irq.c
4 *
Jesper Nilssoneb2746d2007-11-14 17:00:52 -08005 * Copyright (c) 2000,2007 Axis Communications AB
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 *
7 * Authors: Bjorn Wesen (bjornw@axis.com)
8 *
9 * This file contains the code used by various IRQ handling routines:
Simon Arlott49b4ff32007-10-20 01:08:50 +020010 * asking for different IRQs should be done through these routines
Linus Torvalds1da177e2005-04-16 15:20:36 -070011 * instead of just grabbing them. Thus setups with different IRQ numbers
12 * shouldn't result in any weird surprises, and installing new handlers
13 * should be easier.
14 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070015 */
16
17/*
Simon Arlott49b4ff32007-10-20 01:08:50 +020018 * IRQs are in fact implemented a bit like signal handlers for the kernel.
Linus Torvalds1da177e2005-04-16 15:20:36 -070019 * Naturally it's not a 1:1 relation, but there are similarities.
20 */
21
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#include <linux/module.h>
23#include <linux/ptrace.h>
Mikael Starvik2e0cea12005-07-27 11:44:36 -070024#include <linux/irq.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070025
26#include <linux/kernel_stat.h>
27#include <linux/signal.h>
28#include <linux/sched.h>
29#include <linux/ioport.h>
30#include <linux/interrupt.h>
31#include <linux/timex.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070032#include <linux/random.h>
33#include <linux/init.h>
34#include <linux/seq_file.h>
35#include <linux/errno.h>
Mikael Starvik2e0cea12005-07-27 11:44:36 -070036#include <linux/spinlock.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070037
38#include <asm/io.h>
David Howellsb1a154d2012-03-28 18:30:02 +010039#include <arch/system.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
Linus Torvalds1da177e2005-04-16 15:20:36 -070041/* called by the assembler IRQ entry functions defined in irq.h
Simon Arlott49b4ff32007-10-20 01:08:50 +020042 * to dispatch the interrupts to registered handlers
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 * interrupts are disabled upon entry - depending on if the
Simon Arlott49b4ff32007-10-20 01:08:50 +020044 * interrupt was registered with IRQF_DISABLED or not, interrupts
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 * are re-enabled or not.
46 */
47
48asmlinkage void do_IRQ(int irq, struct pt_regs * regs)
49{
Mikael Starvik2e0cea12005-07-27 11:44:36 -070050 unsigned long sp;
Jesper Nilssoneb2746d2007-11-14 17:00:52 -080051 struct pt_regs *old_regs = set_irq_regs(regs);
Mikael Starvik2e0cea12005-07-27 11:44:36 -070052 irq_enter();
53 sp = rdsp();
54 if (unlikely((sp & (PAGE_SIZE - 1)) < (PAGE_SIZE/8))) {
55 printk("do_IRQ: stack overflow: %lX\n", sp);
56 show_stack(NULL, (unsigned long *)sp);
57 }
Thomas Gleixnerc84077a2011-01-19 13:59:01 +010058 generic_handle_irq(irq);
59 irq_exit();
Jesper Nilssoneb2746d2007-11-14 17:00:52 -080060 set_irq_regs(old_regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -070061}
62
Linus Torvalds1da177e2005-04-16 15:20:36 -070063void weird_irq(void)
64{
65 local_irq_disable();
66 printk("weird irq\n");
67 while(1);
68}
69