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

4.11
Last change on this file since c279d0a3 was c279d0a3, checked in by Sebastian Huber <sebastian.huber@…>, on Dec 19, 2014 at 12:05:00 PM

bsps/powerpc: Use e500 exc categories for e6500

This is not correct, but works for now.

  • Property mode set to 100644
File size: 10.7 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-2011 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 the file LICENSE in this distribution or at
26 * http://www.rtems.org/license/LICENSE.
27 */
28
29#include <bsp/vectors.h>
30
31#define PPC_BASIC_VECS_WO_SYS \
32  [ASM_RESET_VECTOR] = PPC_EXC_CLASSIC, \
33  [ASM_MACH_VECTOR] = PPC_EXC_CLASSIC, \
34  [ASM_PROT_VECTOR] = PPC_EXC_CLASSIC, \
35  [ASM_ISI_VECTOR] = PPC_EXC_CLASSIC, \
36  [ASM_EXT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC, \
37  [ASM_ALIGN_VECTOR] = PPC_EXC_CLASSIC, \
38  [ASM_PROG_VECTOR] = PPC_EXC_CLASSIC, \
39  [ASM_FLOAT_VECTOR] = PPC_EXC_CLASSIC, \
40  [ASM_DEC_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC, \
41  [ASM_TRACE_VECTOR] = PPC_EXC_CLASSIC
42
43#define PPC_BASIC_VECS \
44        PPC_BASIC_VECS_WO_SYS, \
45        [ASM_SYS_VECTOR] = PPC_EXC_CLASSIC
46
47static const ppc_exc_categories ppc_405_category_table = {
48  [ASM_BOOKE_CRIT_VECTOR] = PPC_EXC_405_CRITICAL | PPC_EXC_ASYNC,
49  [ASM_MACH_VECTOR] = PPC_EXC_405_CRITICAL,
50  [ASM_PROT_VECTOR] = PPC_EXC_CLASSIC,
51  [ASM_ISI_VECTOR] = PPC_EXC_CLASSIC,
52  [ASM_EXT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
53  [ASM_ALIGN_VECTOR] = PPC_EXC_CLASSIC,
54  [ASM_PROG_VECTOR] = PPC_EXC_CLASSIC,
55  [ASM_FLOAT_VECTOR] = PPC_EXC_CLASSIC,
56
57  [ASM_SYS_VECTOR] = PPC_EXC_CLASSIC,
58
59  [ASM_PPC405_APU_UNAVAIL_VECTOR] = PPC_EXC_CLASSIC,
60
61  [ASM_BOOKE_DEC_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
62  [ASM_BOOKE_FIT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
63  [ASM_BOOKE_WDOG_VECTOR] = PPC_EXC_405_CRITICAL | PPC_EXC_ASYNC,
64  [ASM_BOOKE_DTLBMISS_VECTOR] = PPC_EXC_CLASSIC,
65  [ASM_BOOKE_ITLBMISS_VECTOR] = PPC_EXC_CLASSIC,
66  [ASM_TRACE_VECTOR] = PPC_EXC_405_CRITICAL,
67};
68
69static const ppc_exc_categories ppc_booke_category_table = {
70  [ASM_BOOKE_CRIT_VECTOR] = PPC_EXC_BOOKE_CRITICAL | PPC_EXC_ASYNC,
71  [ASM_MACH_VECTOR] = PPC_EXC_E500_MACHCHK,
72  [ASM_PROT_VECTOR] = PPC_EXC_CLASSIC,
73  [ASM_ISI_VECTOR] = PPC_EXC_CLASSIC,
74  [ASM_EXT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
75  [ASM_ALIGN_VECTOR] = PPC_EXC_CLASSIC,
76  [ASM_PROG_VECTOR] = PPC_EXC_CLASSIC,
77  [ASM_FLOAT_VECTOR] = PPC_EXC_CLASSIC,
78  [ASM_SYS_VECTOR] = PPC_EXC_CLASSIC,
79  [ASM_BOOKE_APU_VECTOR] = PPC_EXC_CLASSIC,
80  [ASM_BOOKE_DEC_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
81  [ASM_BOOKE_FIT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
82  [ASM_BOOKE_WDOG_VECTOR] = PPC_EXC_BOOKE_CRITICAL | PPC_EXC_ASYNC,
83  [ASM_BOOKE_DTLBMISS_VECTOR] = PPC_EXC_CLASSIC,
84  [ASM_BOOKE_ITLBMISS_VECTOR] = PPC_EXC_CLASSIC,
85  [ASM_BOOKE_DEBUG_VECTOR] = PPC_EXC_BOOKE_CRITICAL,
86};
87
88static const ppc_exc_categories mpc_5xx_category_table = {
89  [ASM_RESET_VECTOR] = PPC_EXC_CLASSIC,
90  [ASM_MACH_VECTOR] = PPC_EXC_CLASSIC,
91  [ASM_EXT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
92  [ASM_ALIGN_VECTOR] = PPC_EXC_CLASSIC,
93  [ASM_PROG_VECTOR] = PPC_EXC_CLASSIC,
94  [ASM_FLOAT_VECTOR] = PPC_EXC_CLASSIC,
95  [ASM_DEC_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
96  [ASM_SYS_VECTOR] = PPC_EXC_CLASSIC,
97  [ASM_TRACE_VECTOR] = PPC_EXC_CLASSIC,
98
99  [ASM_5XX_FLOATASSIST_VECTOR] = PPC_EXC_CLASSIC,
100  [ASM_5XX_SOFTEMUL_VECTOR] = PPC_EXC_CLASSIC,
101  [ASM_5XX_IPROT_VECTOR] = PPC_EXC_CLASSIC,
102  [ASM_5XX_DPROT_VECTOR] = PPC_EXC_CLASSIC,
103  [ASM_5XX_DBREAK_VECTOR] = PPC_EXC_CLASSIC,
104  [ASM_5XX_IBREAK_VECTOR] = PPC_EXC_CLASSIC,
105  [ASM_5XX_MEBREAK_VECTOR] = PPC_EXC_CLASSIC,
106  [ASM_5XX_NMEBREAK_VECTOR] = PPC_EXC_CLASSIC,
107};
108
109static const ppc_exc_categories mpc_603_category_table = {
110  PPC_BASIC_VECS,
111
112  [ASM_60X_SYSMGMT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
113  [ASM_60X_IMISS_VECTOR] = PPC_EXC_CLASSIC,
114  [ASM_60X_DLMISS_VECTOR] = PPC_EXC_CLASSIC,
115  [ASM_60X_DSMISS_VECTOR] = PPC_EXC_CLASSIC,
116  [ASM_60X_ADDR_VECTOR] = PPC_EXC_CLASSIC,
117};
118
119static const ppc_exc_categories mpc_604_category_table = {
120  PPC_BASIC_VECS,
121
122  [ASM_60X_PERFMON_VECTOR] = PPC_EXC_CLASSIC,
123  [ASM_60X_SYSMGMT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
124  [ASM_60X_ADDR_VECTOR] = PPC_EXC_CLASSIC,
125};
126
127static const ppc_exc_categories mpc_604_altivec_category_table = {
128  PPC_BASIC_VECS,
129
130  [ASM_60X_PERFMON_VECTOR] = PPC_EXC_CLASSIC,
131  [ASM_60X_SYSMGMT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
132  [ASM_60X_ADDR_VECTOR] = PPC_EXC_CLASSIC,
133  [ASM_60X_VEC_VECTOR] = PPC_EXC_CLASSIC,
134  [ASM_60X_VEC_ASSIST_VECTOR] = PPC_EXC_CLASSIC,
135};
136
137static const ppc_exc_categories mpc_750_category_table = {
138  PPC_BASIC_VECS,
139
140  [ASM_60X_SYSMGMT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
141  [ASM_60X_ADDR_VECTOR] = PPC_EXC_CLASSIC,
142  [ASM_60X_ITM_VECTOR] = PPC_EXC_CLASSIC,
143};
144
145static const ppc_exc_categories mpc_750_altivec_category_table = {
146  PPC_BASIC_VECS,
147
148  [ASM_60X_SYSMGMT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
149  [ASM_60X_ADDR_VECTOR] = PPC_EXC_CLASSIC,
150  [ASM_60X_ITM_VECTOR] = PPC_EXC_CLASSIC,
151  [ASM_60X_VEC_VECTOR] = PPC_EXC_CLASSIC,
152  [ASM_60X_VEC_ASSIST_VECTOR] = PPC_EXC_CLASSIC,
153};
154
155static const ppc_exc_categories mpc_860_category_table = {
156  PPC_BASIC_VECS,
157
158  [ASM_8XX_FLOATASSIST_VECTOR] = PPC_EXC_CLASSIC,
159  [ASM_8XX_SOFTEMUL_VECTOR] = PPC_EXC_CLASSIC,
160  [ASM_8XX_ITLBMISS_VECTOR] = PPC_EXC_CLASSIC,
161  [ASM_8XX_DTLBMISS_VECTOR] = PPC_EXC_CLASSIC,
162  [ASM_8XX_ITLBERROR_VECTOR] = PPC_EXC_CLASSIC,
163  [ASM_8XX_DTLBERROR_VECTOR] = PPC_EXC_CLASSIC,
164  [ASM_8XX_DBREAK_VECTOR] = PPC_EXC_CLASSIC,
165  [ASM_8XX_IBREAK_VECTOR] = PPC_EXC_CLASSIC,
166  [ASM_8XX_PERIFBREAK_VECTOR] = PPC_EXC_CLASSIC,
167  [ASM_8XX_DEVPORT_VECTOR] = PPC_EXC_CLASSIC,
168};
169
170static const ppc_exc_categories e300_category_table = {
171  [ASM_RESET_VECTOR] = PPC_EXC_CLASSIC,
172  [ASM_MACH_VECTOR] = PPC_EXC_CLASSIC,
173  [ASM_PROT_VECTOR] = PPC_EXC_CLASSIC,
174  [ASM_ISI_VECTOR] = PPC_EXC_CLASSIC,
175  [ASM_EXT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
176  [ASM_ALIGN_VECTOR] = PPC_EXC_CLASSIC,
177  [ASM_PROG_VECTOR] = PPC_EXC_CLASSIC,
178  [ASM_FLOAT_VECTOR] = PPC_EXC_NAKED,
179  [ASM_DEC_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
180  [ASM_SYS_VECTOR] = PPC_EXC_CLASSIC,
181  [ASM_TRACE_VECTOR] = PPC_EXC_CLASSIC,
182
183  [ASM_E300_CRIT_VECTOR] = PPC_EXC_BOOKE_CRITICAL | PPC_EXC_ASYNC,
184  [ASM_E300_PERFMON_VECTOR] = PPC_EXC_CLASSIC,
185  [ASM_E300_IMISS_VECTOR] = PPC_EXC_CLASSIC,
186  [ASM_E300_DLMISS_VECTOR] = PPC_EXC_CLASSIC,
187  [ASM_E300_DSMISS_VECTOR] = PPC_EXC_CLASSIC,
188  [ASM_E300_ADDR_VECTOR] = PPC_EXC_CLASSIC,
189  [ASM_E300_SYSMGMT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
190};
191
192static const ppc_exc_categories e200_category_table = {
193  [ASM_BOOKE_CRIT_VECTOR] = PPC_EXC_BOOKE_CRITICAL | PPC_EXC_ASYNC,
194  [ASM_MACH_VECTOR] = PPC_EXC_BOOKE_CRITICAL,
195  [ASM_PROT_VECTOR] = PPC_EXC_CLASSIC,
196  [ASM_ISI_VECTOR] = PPC_EXC_CLASSIC,
197  [ASM_EXT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
198  [ASM_ALIGN_VECTOR] = PPC_EXC_CLASSIC,
199  [ASM_PROG_VECTOR] = PPC_EXC_CLASSIC,
200  [ASM_FLOAT_VECTOR] = PPC_EXC_CLASSIC,
201  [ASM_SYS_VECTOR] = PPC_EXC_CLASSIC,
202  [ASM_BOOKE_DEC_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
203  [ASM_BOOKE_FIT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
204  [ASM_BOOKE_WDOG_VECTOR] = PPC_EXC_BOOKE_CRITICAL | PPC_EXC_ASYNC,
205  [ASM_BOOKE_DTLBMISS_VECTOR] = PPC_EXC_CLASSIC,
206  [ASM_BOOKE_ITLBMISS_VECTOR] = PPC_EXC_CLASSIC,
207
208  /* FIXME: Depending on HDI0 [DAPUEN] this is a critical or debug exception */
209  [ASM_BOOKE_DEBUG_VECTOR] = PPC_EXC_BOOKE_CRITICAL,
210
211  [ASM_E500_SPE_UNAVAILABLE_VECTOR] = PPC_EXC_CLASSIC,
212  [ASM_E500_EMB_FP_DATA_VECTOR] = PPC_EXC_CLASSIC,
213  [ASM_E500_EMB_FP_ROUND_VECTOR] = PPC_EXC_CLASSIC
214};
215
216static const ppc_exc_categories e500_category_table = {
217  [ASM_BOOKE_CRIT_VECTOR] = PPC_EXC_BOOKE_CRITICAL | PPC_EXC_ASYNC,
218  [ASM_MACH_VECTOR] = PPC_EXC_E500_MACHCHK,
219  [ASM_PROT_VECTOR] = PPC_EXC_CLASSIC,
220  [ASM_ISI_VECTOR] = PPC_EXC_CLASSIC,
221  [ASM_EXT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
222  [ASM_ALIGN_VECTOR] = PPC_EXC_CLASSIC,
223  [ASM_PROG_VECTOR] = PPC_EXC_CLASSIC,
224  [ASM_FLOAT_VECTOR] = PPC_EXC_CLASSIC,
225  [ASM_SYS_VECTOR] = PPC_EXC_CLASSIC,
226  [ASM_BOOKE_APU_VECTOR] = PPC_EXC_CLASSIC,
227  [ASM_BOOKE_DEC_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
228  [ASM_BOOKE_FIT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
229  [ASM_BOOKE_WDOG_VECTOR] = PPC_EXC_BOOKE_CRITICAL | PPC_EXC_ASYNC,
230  [ASM_BOOKE_DTLBMISS_VECTOR] = PPC_EXC_CLASSIC,
231  [ASM_BOOKE_ITLBMISS_VECTOR] = PPC_EXC_CLASSIC,
232  [ASM_BOOKE_DEBUG_VECTOR] = PPC_EXC_BOOKE_CRITICAL,
233  [ASM_E500_SPE_UNAVAILABLE_VECTOR] = PPC_EXC_CLASSIC,
234  [ASM_E500_EMB_FP_DATA_VECTOR] = PPC_EXC_CLASSIC,
235  [ASM_E500_EMB_FP_ROUND_VECTOR] = PPC_EXC_CLASSIC,
236  [ASM_E500_PERFMON_VECTOR] = PPC_EXC_CLASSIC
237};
238
239static const ppc_exc_categories psim_category_table = {
240  PPC_BASIC_VECS_WO_SYS,
241
242  [ASM_60X_SYSMGMT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
243  [ASM_60X_IMISS_VECTOR] = PPC_EXC_CLASSIC,
244  [ASM_60X_DLMISS_VECTOR] = PPC_EXC_CLASSIC,
245  [ASM_60X_DSMISS_VECTOR] = PPC_EXC_CLASSIC,
246  [ASM_60X_ADDR_VECTOR] = PPC_EXC_CLASSIC,
247  [ASM_60X_VEC_VECTOR] = PPC_EXC_CLASSIC,
248  [ASM_60X_VEC_ASSIST_VECTOR] = PPC_EXC_CLASSIC,
249};
250
251const ppc_exc_categories *ppc_exc_categories_for_cpu(ppc_cpu_id_t cpu)
252{
253  if (ppc_cpu_has_altivec()) {
254    switch (cpu) {
255      case PPC_7400:
256        return &mpc_750_altivec_category_table;
257      case PPC_7455:
258      case PPC_7457:
259        return &mpc_604_altivec_category_table;
260      default:
261        break;
262    }
263  }
264
265  switch (cpu) {
266    case PPC_7400:
267    case PPC_750:
268      return &mpc_750_category_table;
269    case PPC_7455:
270    case PPC_7457:
271    case PPC_604:
272    case PPC_604e:
273    case PPC_604r:
274      return &mpc_604_category_table;
275    case PPC_603:
276    case PPC_603e:
277    case PPC_603le:
278    case PPC_603ev:
279    /* case PPC_8240: same value as 8260 */
280    case PPC_8260:
281    case PPC_8245:
282      return &mpc_603_category_table;
283    case PPC_e300c1:
284    case PPC_e300c2:
285    case PPC_e300c3:
286      return &e300_category_table;
287    case PPC_PSIM:
288      return &psim_category_table;
289    case PPC_8540:
290    case PPC_e500v2:
291    case PPC_e6500:
292      return &e500_category_table;
293    case PPC_e200z0:
294    case PPC_e200z1:
295    case PPC_e200z4:
296    case PPC_e200z6:
297    case PPC_e200z7:
298      return &e200_category_table;
299    case PPC_5XX:
300      return &mpc_5xx_category_table;
301    case PPC_860:
302      return &mpc_860_category_table;
303    case PPC_405:
304    case PPC_405GP:
305    case PPC_405EX:
306      return &ppc_405_category_table;
307    case PPC_440:
308      return &ppc_booke_category_table;
309    default:
310      break;
311  }
312
313  return NULL;
314}
315
316ppc_exc_category ppc_exc_category_for_vector(const ppc_exc_categories *categories, unsigned vector)
317{
318  if (vector <= LAST_VALID_EXC) {
319    return (*categories) [vector];
320  } else {
321    return PPC_EXC_INVALID;
322  }
323}
Note: See TracBrowser for help on using the repository browser.