1 | /* |
---|
2 | * Score603e Spurious Trap Handler |
---|
3 | * |
---|
4 | * This is just enough of a trap handler to let us know what |
---|
5 | * the likely source of the trap was. |
---|
6 | * |
---|
7 | * Developed as part of the port of RTEMS to the ERC32 implementation |
---|
8 | * of the SPARC by On-Line Applications Research Corporation (OAR) |
---|
9 | * under contract to the European Space Agency (ESA). |
---|
10 | * |
---|
11 | * COPYRIGHT (c) 1995. European Space Agency. |
---|
12 | * |
---|
13 | * This terms of the RTEMS license apply to this file. |
---|
14 | * |
---|
15 | * $Id$ |
---|
16 | */ |
---|
17 | |
---|
18 | #include <bsp.h> |
---|
19 | |
---|
20 | #include <string.h> |
---|
21 | |
---|
22 | rtems_isr bsp_stub_handler( |
---|
23 | rtems_vector_number trap |
---|
24 | ) |
---|
25 | { |
---|
26 | } |
---|
27 | |
---|
28 | /* |
---|
29 | * bsp_spurious_handler |
---|
30 | * |
---|
31 | * Print a message on the debug console and then die |
---|
32 | */ |
---|
33 | rtems_isr bsp_spurious_handler( |
---|
34 | rtems_vector_number trap |
---|
35 | ) |
---|
36 | { |
---|
37 | |
---|
38 | switch ( trap ) { |
---|
39 | case PPC_IRQ_SYSTEM_RESET: |
---|
40 | DEBUG_puts( "\nTrap: System reset" ); |
---|
41 | break; |
---|
42 | case PPC_IRQ_MCHECK: |
---|
43 | DEBUG_puts( "\nTrap: Machine check" ); |
---|
44 | break; |
---|
45 | case PPC_IRQ_PROTECT: |
---|
46 | DEBUG_puts( "\nTrap: DSI" ); |
---|
47 | break; |
---|
48 | case PPC_IRQ_ISI: |
---|
49 | DEBUG_puts( "ISI" ); |
---|
50 | break; |
---|
51 | case PPC_IRQ_EXTERNAL: |
---|
52 | DEBUG_puts( "\nTrap: External interupt" ); |
---|
53 | break; |
---|
54 | case PPC_IRQ_ALIGNMENT: |
---|
55 | DEBUG_puts( "\nTrap: Alignment Exception" ); |
---|
56 | break; |
---|
57 | case PPC_IRQ_PROGRAM: |
---|
58 | DEBUG_puts( "\nTrap: Program" ); |
---|
59 | break; |
---|
60 | case PPC_IRQ_NOFP: |
---|
61 | DEBUG_puts( "\nTrap: Floating point unavailable" ); |
---|
62 | break; |
---|
63 | case PPC_IRQ_DECREMENTER: |
---|
64 | DEBUG_puts( "\nTrap: Decrementer" ); |
---|
65 | break; |
---|
66 | case PPC_IRQ_RESERVED_A: |
---|
67 | DEBUG_puts( "\nTrap: Reserved 0x00a00" ); |
---|
68 | break; |
---|
69 | case PPC_IRQ_RESERVED_B: |
---|
70 | DEBUG_puts( "\nTrap: Reserved 0x00b00" ); |
---|
71 | break; |
---|
72 | case PPC_IRQ_SCALL: |
---|
73 | DEBUG_puts( "\nTrap: System call" ); |
---|
74 | break; |
---|
75 | case PPC_IRQ_TRACE: |
---|
76 | DEBUG_puts( "\nTrap: Trace" ); |
---|
77 | break; |
---|
78 | case PPC_IRQ_FP_ASST: |
---|
79 | DEBUG_puts( "\nTrap: Floating point Assist" ); |
---|
80 | break; |
---|
81 | |
---|
82 | #if defined(ppc403) |
---|
83 | #error "Please fill in names. " |
---|
84 | case PPC_IRQ_CRIT : |
---|
85 | DEBUG_puts( "\nTrap: Critical Error "); |
---|
86 | break; |
---|
87 | case PPC_IRQ_PIT: |
---|
88 | DEBUG_puts( "\nTrap: 0x01000" ); |
---|
89 | break; |
---|
90 | case PPC_IRQ_FIT: |
---|
91 | DEBUG_puts( "\nTrap: 0x01010" ); |
---|
92 | break; |
---|
93 | case PPC_IRQ_WATCHDOG : |
---|
94 | DEBUG_puts( "\nTrap: 0x01020" ); |
---|
95 | break; |
---|
96 | case PPC_IRQ_DEBUG : |
---|
97 | DEBUG_puts( "\nTrap: 0x02000" ); |
---|
98 | break; |
---|
99 | |
---|
100 | #elif defined(ppc601) |
---|
101 | #error "Please fill in names. " |
---|
102 | case PPC_IRQ_TRACE : |
---|
103 | DEBUG_puts( "\nTrap: 0x02000" ); |
---|
104 | break; |
---|
105 | |
---|
106 | #elif defined(ppc603) || defined(ppc603e) |
---|
107 | case PPC_IRQ_TRANS_MISS: |
---|
108 | DEBUG_puts( "\nTrap: Instruction Translation Miss" ); |
---|
109 | break; |
---|
110 | case PPC_IRQ_DATA_LOAD: |
---|
111 | DEBUG_puts( "\nTrap: Data Load Translation Miss" ); |
---|
112 | break; |
---|
113 | case PPC_IRQ_DATA_STORE: |
---|
114 | DEBUG_puts( "\nTrap: Data store Translation Miss"); |
---|
115 | break; |
---|
116 | case PPC_IRQ_ADDR_BRK: |
---|
117 | DEBUG_puts( "\nTrap: Instruction address break point" ); |
---|
118 | break; |
---|
119 | case PPC_IRQ_SYS_MGT: |
---|
120 | DEBUG_puts( "\nTrap: System management interrupt" ); |
---|
121 | break; |
---|
122 | |
---|
123 | #elif defined(mpc604) |
---|
124 | #error "Please fill in names. " |
---|
125 | case PPC_IRQ_ADDR_BRK: |
---|
126 | DEBUG_puts( "0x1300" ); |
---|
127 | break; |
---|
128 | case PPC_IRQ_SYS_MGT: |
---|
129 | DEBUG_puts( "0x1400" ); |
---|
130 | break; |
---|
131 | #endif |
---|
132 | |
---|
133 | default: |
---|
134 | DEBUG_puts( "\nTrap: Undefined exception " ); |
---|
135 | break; |
---|
136 | } |
---|
137 | |
---|
138 | /* |
---|
139 | * What else can we do but stop ... |
---|
140 | */ |
---|
141 | /* |
---|
142 | asm volatile( "" ); |
---|
143 | */ |
---|
144 | while (1); |
---|
145 | } |
---|
146 | |
---|
147 | /* |
---|
148 | * bsp_spurious_initialize |
---|
149 | * |
---|
150 | * Install the spurious handler for most traps. |
---|
151 | */ |
---|
152 | |
---|
153 | void bsp_spurious_initialize() |
---|
154 | { |
---|
155 | uint32_t trap; |
---|
156 | |
---|
157 | for ( trap=0 ; trap < PPC_IRQ_LAST ; trap++ ) { |
---|
158 | if (trap == PPC_IRQ_DECREMENTER) |
---|
159 | ; |
---|
160 | /* set_vector( bsp_stub_handler, trap, 1 ); */ |
---|
161 | else |
---|
162 | set_vector( bsp_spurious_handler, trap, 1 ); |
---|
163 | } |
---|
164 | } |
---|
165 | |
---|
166 | void bsp_set_trap_vectors( void ) |
---|
167 | { |
---|
168 | volatile uint32_t *ptr; |
---|
169 | |
---|
170 | /* reset_vector */ |
---|
171 | ptr = (uint32_t*)0x00100 ; |
---|
172 | *ptr = 0x48000000; |
---|
173 | |
---|
174 | /* org mach_vector */ |
---|
175 | ptr = (uint32_t*)0x00200; |
---|
176 | *ptr = 0x48000000; |
---|
177 | |
---|
178 | /* org prot_vector */ |
---|
179 | ptr = (uint32_t*)0x00300; |
---|
180 | *ptr = 0x48000000; |
---|
181 | |
---|
182 | /* org isi_vector */ |
---|
183 | ptr = (uint32_t*)0x00400; |
---|
184 | *ptr = 0x48000000; |
---|
185 | |
---|
186 | /* org ext_vector */ |
---|
187 | ptr = (uint32_t*)0x0500 ; |
---|
188 | *ptr = 0x48000000; |
---|
189 | |
---|
190 | /* org align_vector */ |
---|
191 | ptr = (uint32_t*)0x00600 ; |
---|
192 | *ptr = 0x48000000; |
---|
193 | |
---|
194 | /* org prog_vector */ |
---|
195 | ptr = (uint32_t*)0x00700 ; |
---|
196 | *ptr = 0x48000000; |
---|
197 | |
---|
198 | /* org float_vector */ |
---|
199 | ptr = (uint32_t*)0x00800; |
---|
200 | *ptr = 0x48000000; |
---|
201 | |
---|
202 | /* org dec_vector - rfi */ |
---|
203 | ptr = (uint32_t*)0x900; |
---|
204 | *ptr = 0x4c000064; |
---|
205 | |
---|
206 | /* org sys_vector */ |
---|
207 | ptr = (uint32_t*)0x0c00 ; |
---|
208 | *ptr = 0x48000000; |
---|
209 | |
---|
210 | /* org trace_vector */ |
---|
211 | ptr = (uint32_t*)0x0d00 ; |
---|
212 | *ptr = 0x48000000; |
---|
213 | |
---|
214 | /* org itm_vector */ |
---|
215 | ptr = (uint32_t*)0x01000 ; |
---|
216 | *ptr = 0x48000000; |
---|
217 | |
---|
218 | /* org dltm_vector */ |
---|
219 | ptr = (uint32_t*)0x01100 ; |
---|
220 | *ptr = 0x48000000; |
---|
221 | |
---|
222 | /* org dstm_vector */ |
---|
223 | ptr = (uint32_t*)0x1200 ; |
---|
224 | *ptr = 0x48000000; |
---|
225 | |
---|
226 | /* org addr_vector */ |
---|
227 | ptr = (uint32_t*)0x1300 ; |
---|
228 | *ptr = 0x48000000; |
---|
229 | |
---|
230 | /* org sysmgmt_vector */ |
---|
231 | ptr = (uint32_t*)0x1400 ; |
---|
232 | *ptr = 0x48000000; |
---|
233 | |
---|
234 | } |
---|