1 // SPDX-License-Identifier: GPL-2.0+
4 * David Feng <fenghua@phytium.com.cn>
9 #include <linux/compiler.h>
10 #include <efi_loader.h>
12 DECLARE_GLOBAL_DATA_PTR;
14 int interrupt_init(void)
21 void enable_interrupts(void)
26 int disable_interrupts(void)
31 static void show_efi_loaded_images(struct pt_regs *regs)
33 efi_print_image_infos((void *)regs->elr);
36 static void dump_instr(struct pt_regs *regs)
38 u32 *addr = (u32 *)(regs->elr & ~3UL);
42 for (i = -4; i < 1; i++)
43 printf(i == 0 ? "(%08x) " : "%08x ", addr[i]);
47 void show_regs(struct pt_regs *regs)
51 if (gd->flags & GD_FLG_RELOC)
52 printf("elr: %016lx lr : %016lx (reloc)\n",
53 regs->elr - gd->reloc_off,
54 regs->regs[30] - gd->reloc_off);
55 printf("elr: %016lx lr : %016lx\n", regs->elr, regs->regs[30]);
57 for (i = 0; i < 29; i += 2)
58 printf("x%-2d: %016lx x%-2d: %016lx\n",
59 i, regs->regs[i], i+1, regs->regs[i+1]);
65 * do_bad_sync handles the impossible case in the Synchronous Abort vector.
67 void do_bad_sync(struct pt_regs *pt_regs, unsigned int esr)
70 printf("Bad mode in \"Synchronous Abort\" handler, esr 0x%08x\n", esr);
72 show_efi_loaded_images(pt_regs);
73 panic("Resetting CPU ...\n");
77 * do_bad_irq handles the impossible case in the Irq vector.
79 void do_bad_irq(struct pt_regs *pt_regs, unsigned int esr)
82 printf("Bad mode in \"Irq\" handler, esr 0x%08x\n", esr);
84 show_efi_loaded_images(pt_regs);
85 panic("Resetting CPU ...\n");
89 * do_bad_fiq handles the impossible case in the Fiq vector.
91 void do_bad_fiq(struct pt_regs *pt_regs, unsigned int esr)
94 printf("Bad mode in \"Fiq\" handler, esr 0x%08x\n", esr);
96 show_efi_loaded_images(pt_regs);
97 panic("Resetting CPU ...\n");
101 * do_bad_error handles the impossible case in the Error vector.
103 void do_bad_error(struct pt_regs *pt_regs, unsigned int esr)
106 printf("Bad mode in \"Error\" handler, esr 0x%08x\n", esr);
108 show_efi_loaded_images(pt_regs);
109 panic("Resetting CPU ...\n");
113 * do_sync handles the Synchronous Abort exception.
115 void do_sync(struct pt_regs *pt_regs, unsigned int esr)
118 printf("\"Synchronous Abort\" handler, esr 0x%08x\n", esr);
120 show_efi_loaded_images(pt_regs);
121 panic("Resetting CPU ...\n");
125 * do_irq handles the Irq exception.
127 void do_irq(struct pt_regs *pt_regs, unsigned int esr)
130 printf("\"Irq\" handler, esr 0x%08x\n", esr);
132 show_efi_loaded_images(pt_regs);
133 panic("Resetting CPU ...\n");
137 * do_fiq handles the Fiq exception.
139 void do_fiq(struct pt_regs *pt_regs, unsigned int esr)
142 printf("\"Fiq\" handler, esr 0x%08x\n", esr);
144 show_efi_loaded_images(pt_regs);
145 panic("Resetting CPU ...\n");
149 * do_error handles the Error exception.
150 * Errors are more likely to be processor specific,
151 * it is defined with weak attribute and can be redefined
152 * in processor specific code.
154 void __weak do_error(struct pt_regs *pt_regs, unsigned int esr)
157 printf("\"Error\" handler, esr 0x%08x\n", esr);
159 show_efi_loaded_images(pt_regs);
160 panic("Resetting CPU ...\n");