1 // SPDX-License-Identifier: GPL-2.0+
8 #include <asm/ptrace.h>
10 #include <linux/compiler.h>
11 #include <efi_loader.h>
13 DECLARE_GLOBAL_DATA_PTR;
15 int interrupt_init(void)
22 void enable_interrupts(void)
27 int disable_interrupts(void)
32 static void show_efi_loaded_images(struct pt_regs *regs)
34 efi_print_image_infos((void *)regs->elr);
37 static void dump_instr(struct pt_regs *regs)
39 u32 *addr = (u32 *)(regs->elr & ~3UL);
43 for (i = -4; i < 1; i++)
44 printf(i == 0 ? "(%08x) " : "%08x ", addr[i]);
48 void show_regs(struct pt_regs *regs)
52 if (gd->flags & GD_FLG_RELOC)
53 printf("elr: %016lx lr : %016lx (reloc)\n",
54 regs->elr - gd->reloc_off,
55 regs->regs[30] - gd->reloc_off);
56 printf("elr: %016lx lr : %016lx\n", regs->elr, regs->regs[30]);
58 for (i = 0; i < 29; i += 2)
59 printf("x%-2d: %016lx x%-2d: %016lx\n",
60 i, regs->regs[i], i+1, regs->regs[i+1]);
66 * do_bad_sync handles the impossible case in the Synchronous Abort vector.
68 void do_bad_sync(struct pt_regs *pt_regs, unsigned int esr)
71 printf("Bad mode in \"Synchronous Abort\" handler, esr 0x%08x\n", esr);
73 show_efi_loaded_images(pt_regs);
74 panic("Resetting CPU ...\n");
78 * do_bad_irq handles the impossible case in the Irq vector.
80 void do_bad_irq(struct pt_regs *pt_regs, unsigned int esr)
83 printf("Bad mode in \"Irq\" handler, esr 0x%08x\n", esr);
85 show_efi_loaded_images(pt_regs);
86 panic("Resetting CPU ...\n");
90 * do_bad_fiq handles the impossible case in the Fiq vector.
92 void do_bad_fiq(struct pt_regs *pt_regs, unsigned int esr)
95 printf("Bad mode in \"Fiq\" handler, esr 0x%08x\n", esr);
97 show_efi_loaded_images(pt_regs);
98 panic("Resetting CPU ...\n");
102 * do_bad_error handles the impossible case in the Error vector.
104 void do_bad_error(struct pt_regs *pt_regs, unsigned int esr)
107 printf("Bad mode in \"Error\" handler, esr 0x%08x\n", esr);
109 show_efi_loaded_images(pt_regs);
110 panic("Resetting CPU ...\n");
114 * do_sync handles the Synchronous Abort exception.
116 void do_sync(struct pt_regs *pt_regs, unsigned int esr)
119 printf("\"Synchronous Abort\" handler, esr 0x%08x\n", esr);
121 show_efi_loaded_images(pt_regs);
122 panic("Resetting CPU ...\n");
126 * do_irq handles the Irq exception.
128 void do_irq(struct pt_regs *pt_regs, unsigned int esr)
131 printf("\"Irq\" handler, esr 0x%08x\n", esr);
133 show_efi_loaded_images(pt_regs);
134 panic("Resetting CPU ...\n");
138 * do_fiq handles the Fiq exception.
140 void do_fiq(struct pt_regs *pt_regs, unsigned int esr)
143 printf("\"Fiq\" handler, esr 0x%08x\n", esr);
145 show_efi_loaded_images(pt_regs);
146 panic("Resetting CPU ...\n");
150 * do_error handles the Error exception.
151 * Errors are more likely to be processor specific,
152 * it is defined with weak attribute and can be redefined
153 * in processor specific code.
155 void __weak do_error(struct pt_regs *pt_regs, unsigned int esr)
158 printf("\"Error\" handler, esr 0x%08x\n", esr);
160 show_efi_loaded_images(pt_regs);
161 panic("Resetting CPU ...\n");