1 // SPDX-License-Identifier: GPL-2.0+
4 * David Feng <fenghua@phytium.com.cn>
8 #include <asm/global_data.h>
9 #include <asm/ptrace.h>
11 #include <linux/compiler.h>
12 #include <efi_loader.h>
14 DECLARE_GLOBAL_DATA_PTR;
16 int interrupt_init(void)
23 void enable_interrupts(void)
28 int disable_interrupts(void)
33 static void show_efi_loaded_images(struct pt_regs *regs)
35 efi_print_image_infos((void *)regs->elr);
38 static void dump_instr(struct pt_regs *regs)
40 u32 *addr = (u32 *)(regs->elr & ~3UL);
44 for (i = -4; i < 1; i++)
45 printf(i == 0 ? "(%08x) " : "%08x ", addr[i]);
49 void show_regs(struct pt_regs *regs)
53 if (gd->flags & GD_FLG_RELOC)
54 printf("elr: %016lx lr : %016lx (reloc)\n",
55 regs->elr - gd->reloc_off,
56 regs->regs[30] - gd->reloc_off);
57 printf("elr: %016lx lr : %016lx\n", regs->elr, regs->regs[30]);
59 for (i = 0; i < 29; i += 2)
60 printf("x%-2d: %016lx x%-2d: %016lx\n",
61 i, regs->regs[i], i+1, regs->regs[i+1]);
67 * do_bad_sync handles the impossible case in the Synchronous Abort vector.
69 void do_bad_sync(struct pt_regs *pt_regs, unsigned int esr)
72 printf("Bad mode in \"Synchronous Abort\" handler, esr 0x%08x\n", esr);
74 show_efi_loaded_images(pt_regs);
75 panic("Resetting CPU ...\n");
79 * do_bad_irq handles the impossible case in the Irq vector.
81 void do_bad_irq(struct pt_regs *pt_regs, unsigned int esr)
84 printf("Bad mode in \"Irq\" handler, esr 0x%08x\n", esr);
86 show_efi_loaded_images(pt_regs);
87 panic("Resetting CPU ...\n");
91 * do_bad_fiq handles the impossible case in the Fiq vector.
93 void do_bad_fiq(struct pt_regs *pt_regs, unsigned int esr)
96 printf("Bad mode in \"Fiq\" handler, esr 0x%08x\n", esr);
98 show_efi_loaded_images(pt_regs);
99 panic("Resetting CPU ...\n");
103 * do_bad_error handles the impossible case in the Error vector.
105 void do_bad_error(struct pt_regs *pt_regs, unsigned int esr)
108 printf("Bad mode in \"Error\" handler, esr 0x%08x\n", esr);
110 show_efi_loaded_images(pt_regs);
111 panic("Resetting CPU ...\n");
115 * do_sync handles the Synchronous Abort exception.
117 void do_sync(struct pt_regs *pt_regs, unsigned int esr)
120 printf("\"Synchronous Abort\" handler, esr 0x%08x\n", esr);
122 show_efi_loaded_images(pt_regs);
123 panic("Resetting CPU ...\n");
127 * do_irq handles the Irq exception.
129 void do_irq(struct pt_regs *pt_regs, unsigned int esr)
132 printf("\"Irq\" handler, esr 0x%08x\n", esr);
134 show_efi_loaded_images(pt_regs);
135 panic("Resetting CPU ...\n");
139 * do_fiq handles the Fiq exception.
141 void do_fiq(struct pt_regs *pt_regs, unsigned int esr)
144 printf("\"Fiq\" handler, esr 0x%08x\n", esr);
146 show_efi_loaded_images(pt_regs);
147 panic("Resetting CPU ...\n");
151 * do_error handles the Error exception.
152 * Errors are more likely to be processor specific,
153 * it is defined with weak attribute and can be redefined
154 * in processor specific code.
156 void __weak do_error(struct pt_regs *pt_regs, unsigned int esr)
159 printf("\"Error\" handler, esr 0x%08x\n", esr);
161 show_efi_loaded_images(pt_regs);
162 panic("Resetting CPU ...\n");