global: Migrate CONFIG_SYS_FSL* symbols to the CFG_SYS namespace
[platform/kernel/u-boot.git] / arch / arm / lib / interrupts.c
index 80869ad..6dc27d1 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2003
  * Texas Instruments <www.ti.com>
  *
  * (C) Copyright 2004
  * Philippe Robin, ARM Ltd. <philippe.robin@arm.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
+#include <cpu_func.h>
+#include <efi_loader.h>
+#include <irq_func.h>
+#include <asm/global_data.h>
 #include <asm/proc-armv/ptrace.h>
+#include <asm/ptrace.h>
 #include <asm/u-boot-arm.h>
-#include <efi_loader.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int interrupt_init (void)
+int interrupt_init(void)
 {
        /*
         * setup up stacks if necessary
         */
        IRQ_STACK_START_IN = gd->irq_sp + 8;
 
+       enable_interrupts();
+
        return 0;
 }
 
-void enable_interrupts (void)
+void enable_interrupts(void)
 {
        return;
 }
-int disable_interrupts (void)
+int disable_interrupts(void)
 {
        return 0;
 }
@@ -48,7 +53,36 @@ int disable_interrupts (void)
 void bad_mode (void)
 {
        panic ("Resetting CPU ...\n");
-       reset_cpu (0);
+       reset_cpu();
+}
+
+static void show_efi_loaded_images(struct pt_regs *regs)
+{
+       efi_print_image_infos((void *)instruction_pointer(regs));
+}
+
+static void dump_instr(struct pt_regs *regs)
+{
+       unsigned long addr = instruction_pointer(regs);
+       const int thumb = thumb_mode(regs);
+       const int width = thumb ? 4 : 8;
+       int i;
+
+       if (thumb)
+               addr &= ~1L;
+       else
+               addr &= ~3L;
+       printf("Code: ");
+       for (i = -4; i < 1 + !!thumb; i++) {
+               unsigned int val;
+
+               if (thumb)
+                       val = ((u16 *)addr)[i];
+               else
+                       val = ((u32 *)addr)[i];
+               printf(i == 0 ? "(%0*x) " : "%0*x ", width, val);
+       }
+       printf("\n");
 }
 
 void show_regs (struct pt_regs *regs)
@@ -91,6 +125,7 @@ void show_regs (struct pt_regs *regs)
                fast_interrupts_enabled (regs) ? "on" : "off",
                processor_modes[processor_mode (regs)],
                thumb_mode (regs) ? " (T)" : "");
+       dump_instr(regs);
 }
 
 /* fixup PC to point to the instruction leading to the exception */
@@ -106,6 +141,7 @@ void do_undefined_instruction (struct pt_regs *pt_regs)
        printf ("undefined instruction\n");
        fixup_pc(pt_regs, -4);
        show_regs (pt_regs);
+       show_efi_loaded_images(pt_regs);
        bad_mode ();
 }
 
@@ -115,6 +151,7 @@ void do_software_interrupt (struct pt_regs *pt_regs)
        printf ("software interrupt\n");
        fixup_pc(pt_regs, -4);
        show_regs (pt_regs);
+       show_efi_loaded_images(pt_regs);
        bad_mode ();
 }
 
@@ -124,6 +161,7 @@ void do_prefetch_abort (struct pt_regs *pt_regs)
        printf ("prefetch abort\n");
        fixup_pc(pt_regs, -8);
        show_regs (pt_regs);
+       show_efi_loaded_images(pt_regs);
        bad_mode ();
 }
 
@@ -133,6 +171,7 @@ void do_data_abort (struct pt_regs *pt_regs)
        printf ("data abort\n");
        fixup_pc(pt_regs, -8);
        show_regs (pt_regs);
+       show_efi_loaded_images(pt_regs);
        bad_mode ();
 }
 
@@ -142,6 +181,7 @@ void do_not_used (struct pt_regs *pt_regs)
        printf ("not used\n");
        fixup_pc(pt_regs, -8);
        show_regs (pt_regs);
+       show_efi_loaded_images(pt_regs);
        bad_mode ();
 }
 
@@ -151,6 +191,7 @@ void do_fiq (struct pt_regs *pt_regs)
        printf ("fast interrupt request\n");
        fixup_pc(pt_regs, -8);
        show_regs (pt_regs);
+       show_efi_loaded_images(pt_regs);
        bad_mode ();
 }
 
@@ -160,5 +201,6 @@ void do_irq (struct pt_regs *pt_regs)
        printf ("interrupt request\n");
        fixup_pc(pt_regs, -8);
        show_regs (pt_regs);
+       show_efi_loaded_images(pt_regs);
        bad_mode ();
 }