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