source: rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_categories.c @ 856cce50

4.104.115
Last change on this file since 856cce50 was 856cce50, checked in by Thomas Doerfler <Thomas.Doerfler@…>, on Oct 23, 2009 at 9:51:03 AM

add new files for exception handler

  • Property mode set to 100644
File size: 9.5 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ppc_exc
5 *
6 * @brief PowerPC Exceptions implementation.
7 */
8
9/*
10 * Copyright (C) 1999 Eric Valette (valette@crf.canon.fr)
11 *                    Canon Centre Recherche France.
12 *
13 * Copyright (C) 2009 embedded brains GmbH.
14 *
15 * Enhanced by Jay Kulpinski <jskulpin@eng01.gdds.com>
16 * to support 603, 603e, 604, 604e exceptions
17 *
18 * Moved to "libcpu/powerpc/new-exceptions" and consolidated
19 * by Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
20 * to be common for all PPCs with new exceptions.
21 *
22 * Derived from file "libcpu/powerpc/new-exceptions/raw_exception.c".
23 *
24 * The license and distribution terms for this file may be
25 * found in found in the file LICENSE in this distribution or at
26 * http://www.rtems.com/license/LICENSE.
27 *
28 * $Id$
29 */
30
31#include <bsp/vectors.h>
32
33#define PPC_BASIC_VECS \
34  [ASM_RESET_VECTOR] = PPC_EXC_CLASSIC, \
35  [ASM_MACH_VECTOR] = PPC_EXC_CLASSIC, \
36  [ASM_PROT_VECTOR] = PPC_EXC_CLASSIC, \
37  [ASM_ISI_VECTOR] = PPC_EXC_CLASSIC, \
38  [ASM_EXT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC, \
39  [ASM_ALIGN_VECTOR] = PPC_EXC_CLASSIC, \
40  [ASM_PROG_VECTOR] = PPC_EXC_CLASSIC, \
41  [ASM_FLOAT_VECTOR] = PPC_EXC_CLASSIC, \
42  [ASM_DEC_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC, \
43  [ASM_SYS_VECTOR] = PPC_EXC_CLASSIC, \
44  [ASM_TRACE_VECTOR] = PPC_EXC_CLASSIC
45
46static const ppc_exc_categories ppc_405_category_table = {
47  [ASM_BOOKE_CRIT_VECTOR] = PPC_EXC_405_CRITICAL | PPC_EXC_ASYNC,
48  [ASM_MACH_VECTOR] = PPC_EXC_405_CRITICAL,
49  [ASM_PROT_VECTOR] = PPC_EXC_CLASSIC,
50  [ASM_ISI_VECTOR] = PPC_EXC_CLASSIC,
51  [ASM_EXT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
52  [ASM_ALIGN_VECTOR] = PPC_EXC_CLASSIC,
53  [ASM_PROG_VECTOR] = PPC_EXC_CLASSIC,
54  [ASM_FLOAT_VECTOR] = PPC_EXC_CLASSIC,
55
56  [ASM_PPC405_APU_UNAVAIL_VECTOR] = PPC_EXC_CLASSIC,
57
58  [ASM_SYS_VECTOR] = PPC_EXC_CLASSIC,
59
60  [ASM_BOOKE_DEC_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
61  [ASM_BOOKE_FIT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
62  [ASM_BOOKE_WDOG_VECTOR] = PPC_EXC_405_CRITICAL | PPC_EXC_ASYNC,
63  [ASM_BOOKE_DTLBMISS_VECTOR] = PPC_EXC_CLASSIC,
64  [ASM_BOOKE_ITLBMISS_VECTOR] = PPC_EXC_CLASSIC,
65  [ASM_TRACE_VECTOR] = PPC_EXC_405_CRITICAL,
66};
67
68static const ppc_exc_categories mpc_5xx_category_table = {
69  [ASM_RESET_VECTOR] = PPC_EXC_CLASSIC,
70  [ASM_MACH_VECTOR] = PPC_EXC_CLASSIC,
71  [ASM_EXT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
72  [ASM_ALIGN_VECTOR] = PPC_EXC_CLASSIC,
73  [ASM_PROG_VECTOR] = PPC_EXC_CLASSIC,
74  [ASM_FLOAT_VECTOR] = PPC_EXC_CLASSIC,
75  [ASM_DEC_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
76  [ASM_SYS_VECTOR] = PPC_EXC_CLASSIC,
77  [ASM_TRACE_VECTOR] = PPC_EXC_CLASSIC,
78
79  [ASM_5XX_FLOATASSIST_VECTOR] = PPC_EXC_CLASSIC,
80  [ASM_5XX_SOFTEMUL_VECTOR] = PPC_EXC_CLASSIC,
81  [ASM_5XX_IPROT_VECTOR] = PPC_EXC_CLASSIC,
82  [ASM_5XX_DPROT_VECTOR] = PPC_EXC_CLASSIC,
83  [ASM_5XX_DBREAK_VECTOR] = PPC_EXC_CLASSIC,
84  [ASM_5XX_IBREAK_VECTOR] = PPC_EXC_CLASSIC,
85  [ASM_5XX_MEBREAK_VECTOR] = PPC_EXC_CLASSIC,
86  [ASM_5XX_NMEBREAK_VECTOR] = PPC_EXC_CLASSIC,
87};
88
89static const ppc_exc_categories mpc_603_category_table = {
90  PPC_BASIC_VECS,
91
92  [ASM_60X_SYSMGMT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
93  [ASM_60X_IMISS_VECTOR] = PPC_EXC_CLASSIC,
94  [ASM_60X_DLMISS_VECTOR] = PPC_EXC_CLASSIC,
95  [ASM_60X_DSMISS_VECTOR] = PPC_EXC_CLASSIC,
96  [ASM_60X_ADDR_VECTOR] = PPC_EXC_CLASSIC,
97};
98
99static const ppc_exc_categories mpc_604_category_table = {
100  PPC_BASIC_VECS,
101
102  [ASM_60X_PERFMON_VECTOR] = PPC_EXC_CLASSIC,
103  [ASM_60X_SYSMGMT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
104  [ASM_60X_ADDR_VECTOR] = PPC_EXC_CLASSIC,
105};
106
107static const ppc_exc_categories mpc_604_altivec_category_table = {
108  PPC_BASIC_VECS,
109
110  [ASM_60X_PERFMON_VECTOR] = PPC_EXC_CLASSIC,
111  [ASM_60X_SYSMGMT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
112  [ASM_60X_ADDR_VECTOR] = PPC_EXC_CLASSIC,
113  [ASM_60X_VEC_VECTOR] = PPC_EXC_CLASSIC,
114  [ASM_60X_VEC_ASSIST_VECTOR] = PPC_EXC_CLASSIC,
115};
116
117static const ppc_exc_categories mpc_750_category_table = {
118  PPC_BASIC_VECS,
119
120  [ASM_60X_SYSMGMT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
121  [ASM_60X_ADDR_VECTOR] = PPC_EXC_CLASSIC,
122  [ASM_60X_ITM_VECTOR] = PPC_EXC_CLASSIC,
123};
124
125static const ppc_exc_categories mpc_750_altivec_category_table = {
126  PPC_BASIC_VECS,
127
128  [ASM_60X_SYSMGMT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
129  [ASM_60X_ADDR_VECTOR] = PPC_EXC_CLASSIC,
130  [ASM_60X_ITM_VECTOR] = PPC_EXC_CLASSIC,
131  [ASM_60X_VEC_VECTOR] = PPC_EXC_CLASSIC,
132  [ASM_60X_VEC_ASSIST_VECTOR] = PPC_EXC_CLASSIC,
133};
134
135static const ppc_exc_categories mpc_860_category_table = {
136  PPC_BASIC_VECS,
137
138  [ASM_8XX_FLOATASSIST_VECTOR] = PPC_EXC_CLASSIC,
139  [ASM_8XX_SOFTEMUL_VECTOR] = PPC_EXC_CLASSIC,
140  [ASM_8XX_ITLBMISS_VECTOR] = PPC_EXC_CLASSIC,
141  [ASM_8XX_DTLBMISS_VECTOR] = PPC_EXC_CLASSIC,
142  [ASM_8XX_ITLBERROR_VECTOR] = PPC_EXC_CLASSIC,
143  [ASM_8XX_DTLBERROR_VECTOR] = PPC_EXC_CLASSIC,
144  [ASM_8XX_DBREAK_VECTOR] = PPC_EXC_CLASSIC,
145  [ASM_8XX_IBREAK_VECTOR] = PPC_EXC_CLASSIC,
146  [ASM_8XX_PERIFBREAK_VECTOR] = PPC_EXC_CLASSIC,
147  [ASM_8XX_DEVPORT_VECTOR] = PPC_EXC_CLASSIC,
148};
149
150static const ppc_exc_categories e200_category_table = {
151  [ASM_MACH_VECTOR] = PPC_EXC_BOOKE_CRITICAL | PPC_EXC_ASYNC,
152  [ASM_PROT_VECTOR] = PPC_EXC_CLASSIC,
153  [ASM_ISI_VECTOR] = PPC_EXC_CLASSIC,
154  [ASM_EXT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
155  [ASM_ALIGN_VECTOR] = PPC_EXC_CLASSIC,
156  [ASM_PROG_VECTOR] = PPC_EXC_CLASSIC,
157  [ASM_FLOAT_VECTOR] = PPC_EXC_CLASSIC,
158  [ASM_SYS_VECTOR] = PPC_EXC_CLASSIC,
159  [ASM_BOOKE_DEC_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
160  [ASM_BOOKE_FIT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
161  [ASM_BOOKE_WDOG_VECTOR] = PPC_EXC_BOOKE_CRITICAL | PPC_EXC_ASYNC,
162  [ASM_BOOKE_ITLBMISS_VECTOR] = PPC_EXC_CLASSIC,
163  [ASM_BOOKE_DTLBMISS_VECTOR] = PPC_EXC_CLASSIC,
164
165  /* FIXME: Depending on HDI0 [DAPUEN] this is a critical or debug exception */
166  [ASM_TRACE_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_BOOKE_CRITICAL,
167
168  [ASM_E200_SPE_UNAVAILABLE_VECTOR] = PPC_EXC_CLASSIC,
169  [ASM_E200_SPE_DATA_VECTOR] = PPC_EXC_CLASSIC,
170  [ASM_E200_SPE_ROUND_VECTOR] = PPC_EXC_CLASSIC,
171};
172
173static const ppc_exc_categories e300_category_table = {
174  [ASM_RESET_VECTOR] = PPC_EXC_CLASSIC,
175  [ASM_MACH_VECTOR] = PPC_EXC_CLASSIC,
176  [ASM_PROT_VECTOR] = PPC_EXC_CLASSIC,
177  [ASM_ISI_VECTOR] = PPC_EXC_CLASSIC,
178  [ASM_EXT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
179  [ASM_ALIGN_VECTOR] = PPC_EXC_CLASSIC,
180  [ASM_PROG_VECTOR] = PPC_EXC_CLASSIC,
181  [ASM_FLOAT_VECTOR] = PPC_EXC_NAKED,
182  [ASM_DEC_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
183  [ASM_SYS_VECTOR] = PPC_EXC_CLASSIC,
184  [ASM_TRACE_VECTOR] = PPC_EXC_CLASSIC,
185
186  [ASM_E300_CRIT_VECTOR] = PPC_EXC_BOOKE_CRITICAL | PPC_EXC_ASYNC,
187  [ASM_E300_PERFMON_VECTOR] = PPC_EXC_CLASSIC,
188  [ASM_E300_IMISS_VECTOR] = PPC_EXC_CLASSIC,
189  [ASM_E300_DLMISS_VECTOR] = PPC_EXC_CLASSIC,
190  [ASM_E300_DSMISS_VECTOR] = PPC_EXC_CLASSIC,
191  [ASM_E300_ADDR_VECTOR] = PPC_EXC_CLASSIC,
192  [ASM_E300_SYSMGMT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
193};
194
195static const ppc_exc_categories e500_category_table = {
196  [ASM_MACH_VECTOR] = PPC_EXC_E500_MACHCHK,
197
198  [ASM_BOOKE_CRIT_VECTOR] = PPC_EXC_BOOKE_CRITICAL | PPC_EXC_ASYNC,
199  [ASM_BOOKE_WDOG_VECTOR] = PPC_EXC_BOOKE_CRITICAL | PPC_EXC_ASYNC,
200  [ASM_TRACE_VECTOR] = PPC_EXC_BOOKE_CRITICAL,
201
202  [ASM_EXT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
203  [ASM_BOOKE_DEC_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
204  [ASM_BOOKE_FIT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
205
206  [ASM_PROT_VECTOR] = PPC_EXC_CLASSIC,
207  [ASM_ISI_VECTOR] = PPC_EXC_CLASSIC,
208  [ASM_ALIGN_VECTOR] = PPC_EXC_CLASSIC,
209  [ASM_PROG_VECTOR] = PPC_EXC_CLASSIC,
210  [ASM_FLOAT_VECTOR] = PPC_EXC_CLASSIC,
211  [ASM_SYS_VECTOR] = PPC_EXC_CLASSIC,
212  [ /* APU unavailable      */ 0x0b] = PPC_EXC_CLASSIC,
213
214  [ASM_60X_DLMISS_VECTOR] = PPC_EXC_CLASSIC,
215  [ASM_60X_DSMISS_VECTOR] = PPC_EXC_CLASSIC,
216  [ASM_60X_VEC_VECTOR] = PPC_EXC_CLASSIC,
217  [ASM_60X_PERFMON_VECTOR] = PPC_EXC_CLASSIC,
218
219  [ /* emb FP data          */ 0x15] = PPC_EXC_CLASSIC,
220  [ /* emb FP round         */ 0x16] = PPC_EXC_CLASSIC,
221};
222
223static const ppc_exc_categories psim_category_table = {
224  PPC_BASIC_VECS,
225
226  [ASM_60X_SYSMGMT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
227  [ASM_60X_IMISS_VECTOR] = PPC_EXC_CLASSIC,
228  [ASM_60X_DLMISS_VECTOR] = PPC_EXC_CLASSIC,
229  [ASM_60X_DSMISS_VECTOR] = PPC_EXC_CLASSIC,
230  [ASM_60X_ADDR_VECTOR] = PPC_EXC_CLASSIC,
231};
232
233const ppc_exc_categories *ppc_exc_categories_for_cpu(ppc_cpu_id_t cpu)
234{
235  if (ppc_cpu_has_altivec()) {
236    switch (cpu) {
237      case PPC_7400:
238        return &mpc_750_altivec_category_table;
239      case PPC_7455:
240      case PPC_7457:
241        return &mpc_604_altivec_category_table;
242      default:
243        break;
244    }
245  }
246
247  switch (cpu) {
248    case PPC_7400:
249    case PPC_750:
250      return &mpc_750_category_table;
251    case PPC_7455:
252    case PPC_7457:
253    case PPC_604:
254    case PPC_604e:
255    case PPC_604r:
256      return &mpc_604_category_table;
257    case PPC_603:
258    case PPC_603e:
259    case PPC_603le:
260    case PPC_603ev:
261    /* case PPC_8240: same value as 8260 */
262    case PPC_8260:
263    case PPC_8245:
264      return &mpc_603_category_table;
265    case PPC_e300c1:
266    case PPC_e300c2:
267    case PPC_e300c3:
268      return &e300_category_table;
269    case PPC_PSIM:
270      return &psim_category_table;
271    case PPC_8540:
272      return &e500_category_table;
273    case PPC_e200z6:
274      return &e200_category_table;
275    case PPC_5XX:
276      return &mpc_5xx_category_table;
277    case PPC_860:
278      return &mpc_860_category_table;
279    case PPC_405:
280    case PPC_405GP:
281    case PPC_405EX:
282      return &ppc_405_category_table;
283    default:
284      break;
285  }
286
287  return NULL;
288}
289
290ppc_exc_category ppc_exc_category_for_vector(const ppc_exc_categories *categories, unsigned vector)
291{
292  if (vector <= LAST_VALID_EXC) {
293    return (*categories) [vector];
294  } else {
295    return PPC_EXC_INVALID;
296  }
297}
Note: See TracBrowser for help on using the repository browser.