]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/avr32/kernel/traps.c
m68k: types: use <asm-generic/int-*.h> for the m68k architecture
[linux-2.6-omap-h63xx.git] / arch / avr32 / kernel / traps.c
index 4f0382d8483fe0bbc8133a5040cb6a8bf2634b49..b835c4c0136882e8320ddde56fe14d98d3f1201c 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/bug.h>
 #include <linux/init.h>
 #include <linux/kallsyms.h>
+#include <linux/kdebug.h>
 #include <linux/module.h>
 #include <linux/notifier.h>
 #include <linux/sched.h>
 #include <asm/sysreg.h>
 #include <asm/traps.h>
 
-ATOMIC_NOTIFIER_HEAD(avr32_die_chain);
-
-int register_die_notifier(struct notifier_block *nb)
-{
-       return atomic_notifier_chain_register(&avr32_die_chain, nb);
-}
-EXPORT_SYMBOL(register_die_notifier);
-
-int unregister_die_notifier(struct notifier_block *nb)
-{
-       return atomic_notifier_chain_unregister(&avr32_die_chain, nb);
-}
-EXPORT_SYMBOL(unregister_die_notifier);
-
 static DEFINE_SPINLOCK(die_lock);
 
 void NORET_TYPE die(const char *str, struct pt_regs *regs, long err)
@@ -53,7 +40,7 @@ void NORET_TYPE die(const char *str, struct pt_regs *regs, long err)
        printk("FRAME_POINTER ");
 #endif
        if (current_cpu_data.features & AVR32_FEATURE_OCD) {
-               unsigned long did = __mfdr(DBGREG_DID);
+               unsigned long did = ocd_read(DID);
                printk("chip: 0x%03lx:0x%04lx rev %lu\n",
                       (did >> 1) & 0x7ff,
                       (did >> 12) & 0x7fff,
@@ -70,6 +57,7 @@ void NORET_TYPE die(const char *str, struct pt_regs *regs, long err)
        show_regs_log_lvl(regs, KERN_EMERG);
        show_stack_log_lvl(current, regs->sp, regs, KERN_EMERG);
        bust_spinlocks(0);
+       add_taint(TAINT_DIE);
        spin_unlock_irq(&die_lock);
 
        if (in_interrupt())
@@ -102,7 +90,7 @@ void _exception(long signr, struct pt_regs *regs, int code,
         * generate the same exception over and over again and we get
         * nowhere.  Better to kill it and let the kernel panic.
         */
-       if (is_init(current)) {
+       if (is_global_init(current)) {
                __sighandler_t handler;
 
                spin_lock_irq(&current->sighand->siglock);
@@ -120,9 +108,23 @@ void _exception(long signr, struct pt_regs *regs, int code,
 
 asmlinkage void do_nmi(unsigned long ecr, struct pt_regs *regs)
 {
-       printk(KERN_ALERT "Got Non-Maskable Interrupt, dumping regs\n");
-       show_regs_log_lvl(regs, KERN_ALERT);
-       show_stack_log_lvl(current, regs->sp, regs, KERN_ALERT);
+       int ret;
+
+       nmi_enter();
+
+       ret = notify_die(DIE_NMI, "NMI", regs, 0, ecr, SIGINT);
+       switch (ret) {
+       case NOTIFY_OK:
+       case NOTIFY_STOP:
+               return;
+       case NOTIFY_BAD:
+               die("Fatal Non-Maskable Interrupt", regs, SIGINT);
+       default:
+               break;
+       }
+
+       printk(KERN_ALERT "Got NMI, but nobody cared. Disabling...\n");
+       nmi_disable();
 }
 
 asmlinkage void do_critical_exception(unsigned long ecr, struct pt_regs *regs)
@@ -137,7 +139,7 @@ asmlinkage void do_address_exception(unsigned long ecr, struct pt_regs *regs)
 
 /* This way of handling undefined instructions is stolen from ARM */
 static LIST_HEAD(undef_hook);
-static spinlock_t undef_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(undef_lock);
 
 void register_undef_hook(struct undef_hook *hook)
 {
@@ -176,6 +178,7 @@ static int do_cop_absent(u32 insn)
        return 0;
 }
 
+#ifdef CONFIG_BUG
 int is_valid_bugaddr(unsigned long pc)
 {
        unsigned short opcode;
@@ -187,6 +190,7 @@ int is_valid_bugaddr(unsigned long pc)
 
        return opcode == AVR32_BUG_OPCODE;
 }
+#endif
 
 asmlinkage void do_illegal_opcode(unsigned long ecr, struct pt_regs *regs)
 {
@@ -195,10 +199,11 @@ asmlinkage void do_illegal_opcode(unsigned long ecr, struct pt_regs *regs)
        void __user *pc;
        long code;
 
+#ifdef CONFIG_BUG
        if (!user_mode(regs) && (ecr == ECR_ILLEGAL_OPCODE)) {
                enum bug_trap_type type;
 
-               type = report_bug(regs->pc);
+               type = report_bug(regs->pc, regs);
                switch (type) {
                case BUG_TRAP_TYPE_NONE:
                        break;
@@ -209,6 +214,7 @@ asmlinkage void do_illegal_opcode(unsigned long ecr, struct pt_regs *regs)
                        die("Kernel BUG", regs, SIGKILL);
                }
        }
+#endif
 
        local_irq_enable();