1 // SPDX-License-Identifier: GPL-2.0+
9 #include <linux/compiler.h>
10 #include <efi_loader.h>
12 DECLARE_GLOBAL_DATA_PTR;
14 int interrupt_init(void)
19 void enable_interrupts(void)
24 int disable_interrupts(void)
29 static void show_efi_loaded_images(struct pt_regs *regs)
31 efi_print_image_infos((void *)regs->elr);
34 static void dump_instr(struct pt_regs *regs)
36 u32 *addr = (u32 *)(regs->elr & ~3UL);
40 for (i = -4; i < 1; i++)
41 printf(i == 0 ? "(%08x) " : "%08x ", addr[i]);
45 void show_regs(struct pt_regs *regs)
49 if (gd->flags & GD_FLG_RELOC)
50 printf("elr: %016lx lr : %016lx (reloc)\n",
51 regs->elr - gd->reloc_off,
52 regs->regs[30] - gd->reloc_off);
53 printf("elr: %016lx lr : %016lx\n", regs->elr, regs->regs[30]);
55 for (i = 0; i < 29; i += 2)
56 printf("x%-2d: %016lx x%-2d: %016lx\n",
57 i, regs->regs[i], i+1, regs->regs[i+1]);
63 * do_bad_sync handles the impossible case in the Synchronous Abort vector.
65 void do_bad_sync(struct pt_regs *pt_regs, unsigned int esr)
68 printf("Bad mode in \"Synchronous Abort\" handler, esr 0x%08x\n", esr);
70 show_efi_loaded_images(pt_regs);
71 panic("Resetting CPU ...\n");
75 * do_bad_irq handles the impossible case in the Irq vector.
77 void do_bad_irq(struct pt_regs *pt_regs, unsigned int esr)
80 printf("Bad mode in \"Irq\" handler, esr 0x%08x\n", esr);
82 show_efi_loaded_images(pt_regs);
83 panic("Resetting CPU ...\n");
87 * do_bad_fiq handles the impossible case in the Fiq vector.
89 void do_bad_fiq(struct pt_regs *pt_regs, unsigned int esr)
92 printf("Bad mode in \"Fiq\" handler, esr 0x%08x\n", esr);
94 show_efi_loaded_images(pt_regs);
95 panic("Resetting CPU ...\n");
99 * do_bad_error handles the impossible case in the Error vector.
101 void do_bad_error(struct pt_regs *pt_regs, unsigned int esr)
104 printf("Bad mode in \"Error\" handler, esr 0x%08x\n", esr);
106 show_efi_loaded_images(pt_regs);
107 panic("Resetting CPU ...\n");
111 * do_sync handles the Synchronous Abort exception.
113 void do_sync(struct pt_regs *pt_regs, unsigned int esr)
116 printf("\"Synchronous Abort\" handler, esr 0x%08x\n", esr);
118 show_efi_loaded_images(pt_regs);
119 panic("Resetting CPU ...\n");
123 * do_irq handles the Irq exception.
125 void do_irq(struct pt_regs *pt_regs, unsigned int esr)
128 printf("\"Irq\" handler, esr 0x%08x\n", esr);
130 show_efi_loaded_images(pt_regs);
131 panic("Resetting CPU ...\n");
135 * do_fiq handles the Fiq exception.
137 void do_fiq(struct pt_regs *pt_regs, unsigned int esr)
140 printf("\"Fiq\" handler, esr 0x%08x\n", esr);
142 show_efi_loaded_images(pt_regs);
143 panic("Resetting CPU ...\n");
147 * do_error handles the Error exception.
148 * Errors are more likely to be processor specific,
149 * it is defined with weak attribute and can be redefined
150 * in processor specific code.
152 void __weak do_error(struct pt_regs *pt_regs, unsigned int esr)
155 printf("\"Error\" handler, esr 0x%08x\n", esr);
157 show_efi_loaded_images(pt_regs);
158 panic("Resetting CPU ...\n");