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