1 // SPDX-License-Identifier: GPL-2.0+
4 * David Feng <fenghua@phytium.com.cn>
8 #include <linux/compiler.h>
9 #include <efi_loader.h>
11 DECLARE_GLOBAL_DATA_PTR;
13 int interrupt_init(void)
18 void enable_interrupts(void)
23 int disable_interrupts(void)
28 static void show_efi_loaded_images(struct pt_regs *regs)
30 efi_print_image_infos((void *)regs->elr);
33 static void dump_instr(struct pt_regs *regs)
35 u32 *addr = (u32 *)(regs->elr & ~3UL);
39 for (i = -4; i < 1; i++)
40 printf(i == 0 ? "(%08x) " : "%08x ", addr[i]);
44 void show_regs(struct pt_regs *regs)
48 if (gd->flags & GD_FLG_RELOC)
49 printf("elr: %016lx lr : %016lx (reloc)\n",
50 regs->elr - gd->reloc_off,
51 regs->regs[30] - gd->reloc_off);
52 printf("elr: %016lx lr : %016lx\n", regs->elr, regs->regs[30]);
54 for (i = 0; i < 29; i += 2)
55 printf("x%-2d: %016lx x%-2d: %016lx\n",
56 i, regs->regs[i], i+1, regs->regs[i+1]);
62 * do_bad_sync handles the impossible case in the Synchronous Abort vector.
64 void do_bad_sync(struct pt_regs *pt_regs, unsigned int esr)
67 printf("Bad mode in \"Synchronous Abort\" handler, esr 0x%08x\n", esr);
69 show_efi_loaded_images(pt_regs);
70 panic("Resetting CPU ...\n");
74 * do_bad_irq handles the impossible case in the Irq vector.
76 void do_bad_irq(struct pt_regs *pt_regs, unsigned int esr)
79 printf("Bad mode in \"Irq\" handler, esr 0x%08x\n", esr);
81 show_efi_loaded_images(pt_regs);
82 panic("Resetting CPU ...\n");
86 * do_bad_fiq handles the impossible case in the Fiq vector.
88 void do_bad_fiq(struct pt_regs *pt_regs, unsigned int esr)
91 printf("Bad mode in \"Fiq\" handler, esr 0x%08x\n", esr);
93 show_efi_loaded_images(pt_regs);
94 panic("Resetting CPU ...\n");
98 * do_bad_error handles the impossible case in the Error vector.
100 void do_bad_error(struct pt_regs *pt_regs, unsigned int esr)
103 printf("Bad mode in \"Error\" handler, esr 0x%08x\n", esr);
105 show_efi_loaded_images(pt_regs);
106 panic("Resetting CPU ...\n");
110 * do_sync handles the Synchronous Abort exception.
112 void do_sync(struct pt_regs *pt_regs, unsigned int esr)
115 printf("\"Synchronous Abort\" handler, esr 0x%08x\n", esr);
117 show_efi_loaded_images(pt_regs);
118 panic("Resetting CPU ...\n");
122 * do_irq handles the Irq exception.
124 void do_irq(struct pt_regs *pt_regs, unsigned int esr)
127 printf("\"Irq\" handler, esr 0x%08x\n", esr);
129 show_efi_loaded_images(pt_regs);
130 panic("Resetting CPU ...\n");
134 * do_fiq handles the Fiq exception.
136 void do_fiq(struct pt_regs *pt_regs, unsigned int esr)
139 printf("\"Fiq\" handler, esr 0x%08x\n", esr);
141 show_efi_loaded_images(pt_regs);
142 panic("Resetting CPU ...\n");
146 * do_error handles the Error exception.
147 * Errors are more likely to be processor specific,
148 * it is defined with weak attribute and can be redefined
149 * in processor specific code.
151 void __weak do_error(struct pt_regs *pt_regs, unsigned int esr)
154 printf("\"Error\" handler, esr 0x%08x\n", esr);
156 show_efi_loaded_images(pt_regs);
157 panic("Resetting CPU ...\n");