xref: /openbmc/u-boot/arch/arm/lib/interrupts_64.c (revision 8a23fc9c)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * (C) Copyright 2013
4  * David Feng <fenghua@phytium.com.cn>
5  */
6 
7 #include <common.h>
8 #include <linux/compiler.h>
9 #include <efi_loader.h>
10 
11 DECLARE_GLOBAL_DATA_PTR;
12 
13 int interrupt_init(void)
14 {
15 	return 0;
16 }
17 
18 void enable_interrupts(void)
19 {
20 	return;
21 }
22 
23 int disable_interrupts(void)
24 {
25 	return 0;
26 }
27 
28 void show_regs(struct pt_regs *regs)
29 {
30 	int i;
31 
32 	if (gd->flags & GD_FLG_RELOC)
33 		printf("elr: %016lx lr : %016lx (reloc)\n",
34 		       regs->elr - gd->reloc_off,
35 		       regs->regs[30] - gd->reloc_off);
36 	printf("elr: %016lx lr : %016lx\n", regs->elr, regs->regs[30]);
37 
38 	for (i = 0; i < 29; i += 2)
39 		printf("x%-2d: %016lx x%-2d: %016lx\n",
40 		       i, regs->regs[i], i+1, regs->regs[i+1]);
41 	printf("\n");
42 }
43 
44 /*
45  * do_bad_sync handles the impossible case in the Synchronous Abort vector.
46  */
47 void do_bad_sync(struct pt_regs *pt_regs, unsigned int esr)
48 {
49 	efi_restore_gd();
50 	printf("Bad mode in \"Synchronous Abort\" handler, esr 0x%08x\n", esr);
51 	show_regs(pt_regs);
52 	panic("Resetting CPU ...\n");
53 }
54 
55 /*
56  * do_bad_irq handles the impossible case in the Irq vector.
57  */
58 void do_bad_irq(struct pt_regs *pt_regs, unsigned int esr)
59 {
60 	efi_restore_gd();
61 	printf("Bad mode in \"Irq\" handler, esr 0x%08x\n", esr);
62 	show_regs(pt_regs);
63 	panic("Resetting CPU ...\n");
64 }
65 
66 /*
67  * do_bad_fiq handles the impossible case in the Fiq vector.
68  */
69 void do_bad_fiq(struct pt_regs *pt_regs, unsigned int esr)
70 {
71 	efi_restore_gd();
72 	printf("Bad mode in \"Fiq\" handler, esr 0x%08x\n", esr);
73 	show_regs(pt_regs);
74 	panic("Resetting CPU ...\n");
75 }
76 
77 /*
78  * do_bad_error handles the impossible case in the Error vector.
79  */
80 void do_bad_error(struct pt_regs *pt_regs, unsigned int esr)
81 {
82 	efi_restore_gd();
83 	printf("Bad mode in \"Error\" handler, esr 0x%08x\n", esr);
84 	show_regs(pt_regs);
85 	panic("Resetting CPU ...\n");
86 }
87 
88 /*
89  * do_sync handles the Synchronous Abort exception.
90  */
91 void do_sync(struct pt_regs *pt_regs, unsigned int esr)
92 {
93 	efi_restore_gd();
94 	printf("\"Synchronous Abort\" handler, esr 0x%08x\n", esr);
95 	show_regs(pt_regs);
96 	panic("Resetting CPU ...\n");
97 }
98 
99 /*
100  * do_irq handles the Irq exception.
101  */
102 void do_irq(struct pt_regs *pt_regs, unsigned int esr)
103 {
104 	efi_restore_gd();
105 	printf("\"Irq\" handler, esr 0x%08x\n", esr);
106 	show_regs(pt_regs);
107 	panic("Resetting CPU ...\n");
108 }
109 
110 /*
111  * do_fiq handles the Fiq exception.
112  */
113 void do_fiq(struct pt_regs *pt_regs, unsigned int esr)
114 {
115 	efi_restore_gd();
116 	printf("\"Fiq\" handler, esr 0x%08x\n", esr);
117 	show_regs(pt_regs);
118 	panic("Resetting CPU ...\n");
119 }
120 
121 /*
122  * do_error handles the Error exception.
123  * Errors are more likely to be processor specific,
124  * it is defined with weak attribute and can be redefined
125  * in processor specific code.
126  */
127 void __weak do_error(struct pt_regs *pt_regs, unsigned int esr)
128 {
129 	efi_restore_gd();
130 	printf("\"Error\" handler, esr 0x%08x\n", esr);
131 	show_regs(pt_regs);
132 	panic("Resetting CPU ...\n");
133 }
134