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

4.104.115
Last change on this file since f70c86ea was f70c86ea, checked in by Till Straumann <strauman@…>, on Nov 17, 2009 at 11:42:53 AM

2009-11-17 Till Straumann <strauman@…>

  • new-exceptions/bspsupport/ppc_exc_categories.c: PSIM *must*not* hook SYS vector which is used e.g., for firmware I/O.

Added entries for AltiVec? on PSIM.

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