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