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

Last change on this file since 848007c was 848007c, checked in by Phong Pham <phamp@…>, on May 7, 2017 at 9:08:17 PM

Add support for IBM PowerPC 750 chip.

Closes #3015.

  • Property mode set to 100755
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_PERFMON_VECTOR] = PPC_EXC_CLASSIC,
141  [ASM_60X_SYSMGMT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
142  [ASM_60X_ADDR_VECTOR] = PPC_EXC_CLASSIC,
143  [ASM_60X_ITM_VECTOR] = PPC_EXC_CLASSIC,
144};
145
146static const ppc_exc_categories mpc_750_altivec_category_table = {
147  PPC_BASIC_VECS,
148
149  [ASM_60X_SYSMGMT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
150  [ASM_60X_ADDR_VECTOR] = PPC_EXC_CLASSIC,
151  [ASM_60X_ITM_VECTOR] = PPC_EXC_CLASSIC,
152  [ASM_60X_VEC_VECTOR] = PPC_EXC_CLASSIC,
153  [ASM_60X_VEC_ASSIST_VECTOR] = PPC_EXC_CLASSIC,
154};
155
156static const ppc_exc_categories mpc_860_category_table = {
157  PPC_BASIC_VECS,
158
159  [ASM_8XX_FLOATASSIST_VECTOR] = PPC_EXC_CLASSIC,
160  [ASM_8XX_SOFTEMUL_VECTOR] = PPC_EXC_CLASSIC,
161  [ASM_8XX_ITLBMISS_VECTOR] = PPC_EXC_CLASSIC,
162  [ASM_8XX_DTLBMISS_VECTOR] = PPC_EXC_CLASSIC,
163  [ASM_8XX_ITLBERROR_VECTOR] = PPC_EXC_CLASSIC,
164  [ASM_8XX_DTLBERROR_VECTOR] = PPC_EXC_CLASSIC,
165  [ASM_8XX_DBREAK_VECTOR] = PPC_EXC_CLASSIC,
166  [ASM_8XX_IBREAK_VECTOR] = PPC_EXC_CLASSIC,
167  [ASM_8XX_PERIFBREAK_VECTOR] = PPC_EXC_CLASSIC,
168  [ASM_8XX_DEVPORT_VECTOR] = PPC_EXC_CLASSIC,
169};
170
171static const ppc_exc_categories e300_category_table = {
172  [ASM_RESET_VECTOR] = PPC_EXC_CLASSIC,
173  [ASM_MACH_VECTOR] = PPC_EXC_CLASSIC,
174  [ASM_PROT_VECTOR] = PPC_EXC_CLASSIC,
175  [ASM_ISI_VECTOR] = PPC_EXC_CLASSIC,
176  [ASM_EXT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
177  [ASM_ALIGN_VECTOR] = PPC_EXC_CLASSIC,
178  [ASM_PROG_VECTOR] = PPC_EXC_CLASSIC,
179  [ASM_FLOAT_VECTOR] = PPC_EXC_NAKED,
180  [ASM_DEC_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
181  [ASM_SYS_VECTOR] = PPC_EXC_CLASSIC,
182  [ASM_TRACE_VECTOR] = PPC_EXC_CLASSIC,
183
184  [ASM_E300_CRIT_VECTOR] = PPC_EXC_BOOKE_CRITICAL | PPC_EXC_ASYNC,
185  [ASM_E300_PERFMON_VECTOR] = PPC_EXC_CLASSIC,
186  [ASM_E300_IMISS_VECTOR] = PPC_EXC_CLASSIC,
187  [ASM_E300_DLMISS_VECTOR] = PPC_EXC_CLASSIC,
188  [ASM_E300_DSMISS_VECTOR] = PPC_EXC_CLASSIC,
189  [ASM_E300_ADDR_VECTOR] = PPC_EXC_CLASSIC,
190  [ASM_E300_SYSMGMT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
191};
192
193static const ppc_exc_categories e200_category_table = {
194  [ASM_BOOKE_CRIT_VECTOR] = PPC_EXC_BOOKE_CRITICAL | PPC_EXC_ASYNC,
195  [ASM_MACH_VECTOR] = PPC_EXC_BOOKE_CRITICAL,
196  [ASM_PROT_VECTOR] = PPC_EXC_CLASSIC,
197  [ASM_ISI_VECTOR] = PPC_EXC_CLASSIC,
198  [ASM_EXT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
199  [ASM_ALIGN_VECTOR] = PPC_EXC_CLASSIC,
200  [ASM_PROG_VECTOR] = PPC_EXC_CLASSIC,
201  [ASM_FLOAT_VECTOR] = PPC_EXC_CLASSIC,
202  [ASM_SYS_VECTOR] = PPC_EXC_CLASSIC,
203  [ASM_BOOKE_DEC_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
204  [ASM_BOOKE_FIT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
205  [ASM_BOOKE_WDOG_VECTOR] = PPC_EXC_BOOKE_CRITICAL | PPC_EXC_ASYNC,
206  [ASM_BOOKE_DTLBMISS_VECTOR] = PPC_EXC_CLASSIC,
207  [ASM_BOOKE_ITLBMISS_VECTOR] = PPC_EXC_CLASSIC,
208
209  /* FIXME: Depending on HDI0 [DAPUEN] this is a critical or debug exception */
210  [ASM_BOOKE_DEBUG_VECTOR] = PPC_EXC_BOOKE_CRITICAL,
211
212  [ASM_E500_SPE_UNAVAILABLE_VECTOR] = PPC_EXC_CLASSIC,
213  [ASM_E500_EMB_FP_DATA_VECTOR] = PPC_EXC_CLASSIC,
214  [ASM_E500_EMB_FP_ROUND_VECTOR] = PPC_EXC_CLASSIC
215};
216
217static const ppc_exc_categories e500_category_table = {
218  [ASM_BOOKE_CRIT_VECTOR] = PPC_EXC_BOOKE_CRITICAL | PPC_EXC_ASYNC,
219  [ASM_MACH_VECTOR] = PPC_EXC_E500_MACHCHK,
220  [ASM_PROT_VECTOR] = PPC_EXC_CLASSIC,
221  [ASM_ISI_VECTOR] = PPC_EXC_CLASSIC,
222  [ASM_EXT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
223  [ASM_ALIGN_VECTOR] = PPC_EXC_CLASSIC,
224  [ASM_PROG_VECTOR] = PPC_EXC_CLASSIC,
225  [ASM_FLOAT_VECTOR] = PPC_EXC_CLASSIC,
226  [ASM_SYS_VECTOR] = PPC_EXC_CLASSIC,
227  [ASM_BOOKE_APU_VECTOR] = PPC_EXC_CLASSIC,
228  [ASM_BOOKE_DEC_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
229  [ASM_BOOKE_FIT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
230  [ASM_BOOKE_WDOG_VECTOR] = PPC_EXC_BOOKE_CRITICAL | PPC_EXC_ASYNC,
231  [ASM_BOOKE_DTLBMISS_VECTOR] = PPC_EXC_CLASSIC,
232  [ASM_BOOKE_ITLBMISS_VECTOR] = PPC_EXC_CLASSIC,
233  [ASM_BOOKE_DEBUG_VECTOR] = PPC_EXC_BOOKE_CRITICAL,
234  [ASM_E500_SPE_UNAVAILABLE_VECTOR] = PPC_EXC_CLASSIC,
235  [ASM_E500_EMB_FP_DATA_VECTOR] = PPC_EXC_CLASSIC,
236  [ASM_E500_EMB_FP_ROUND_VECTOR] = PPC_EXC_CLASSIC,
237  [ASM_E500_PERFMON_VECTOR] = PPC_EXC_CLASSIC
238};
239
240static const ppc_exc_categories psim_category_table = {
241  PPC_BASIC_VECS_WO_SYS,
242
243  [ASM_60X_SYSMGMT_VECTOR] = PPC_EXC_CLASSIC | PPC_EXC_ASYNC,
244  [ASM_60X_IMISS_VECTOR] = PPC_EXC_CLASSIC,
245  [ASM_60X_DLMISS_VECTOR] = PPC_EXC_CLASSIC,
246  [ASM_60X_DSMISS_VECTOR] = PPC_EXC_CLASSIC,
247  [ASM_60X_ADDR_VECTOR] = PPC_EXC_CLASSIC,
248  [ASM_60X_VEC_VECTOR] = PPC_EXC_CLASSIC,
249  [ASM_60X_VEC_ASSIST_VECTOR] = PPC_EXC_CLASSIC,
250};
251
252const ppc_exc_categories *ppc_exc_categories_for_cpu(ppc_cpu_id_t cpu)
253{
254  if (ppc_cpu_has_altivec()) {
255    switch (cpu) {
256      case PPC_7400:
257        return &mpc_750_altivec_category_table;
258      case PPC_7455:
259      case PPC_7457:
260        return &mpc_604_altivec_category_table;
261      default:
262        break;
263    }
264  }
265
266  switch (cpu) {
267    case PPC_7400:
268    case PPC_750:
269    case PPC_750_IBM:
270      return &mpc_750_category_table;
271    case PPC_7455:
272    case PPC_7457:
273    case PPC_604:
274    case PPC_604e:
275    case PPC_604r:
276      return &mpc_604_category_table;
277    case PPC_603:
278    case PPC_603e:
279    case PPC_603le:
280    case PPC_603ev:
281    /* case PPC_8240: same value as 8260 */
282    case PPC_8260:
283    case PPC_8245:
284      return &mpc_603_category_table;
285    case PPC_e300c1:
286    case PPC_e300c2:
287    case PPC_e300c3:
288      return &e300_category_table;
289    case PPC_PSIM:
290      return &psim_category_table;
291    case PPC_8540:
292    case PPC_e500v2:
293    case PPC_e6500:
294      return &e500_category_table;
295    case PPC_e200z0:
296    case PPC_e200z1:
297    case PPC_e200z4:
298    case PPC_e200z6:
299    case PPC_e200z7:
300      return &e200_category_table;
301    case PPC_5XX:
302      return &mpc_5xx_category_table;
303    case PPC_860:
304      return &mpc_860_category_table;
305    case PPC_405:
306    case PPC_405GP:
307    case PPC_405EX:
308      return &ppc_405_category_table;
309    case PPC_440:
310      return &ppc_booke_category_table;
311    default:
312      break;
313  }
314
315  return NULL;
316}
317
318ppc_exc_category ppc_exc_category_for_vector(const ppc_exc_categories *categories, unsigned vector)
319{
320  if (vector <= LAST_VALID_EXC) {
321    return (*categories) [vector];
322  } else {
323    return PPC_EXC_INVALID;
324  }
325}
Note: See TracBrowser for help on using the repository browser.