source: rtems/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_address.c @ 4e9d8ea

4.115
Last change on this file since 4e9d8ea was 4e9d8ea, checked in by Sebastian Huber <sebastian.huber@…>, on 12/29/10 at 10:48:08

2010-12-29 Sebastian Huber <sebastian.huber@…>

  • new-exceptions/bspsupport/ppc_exc_address.c, new-exceptions/bspsupport/ppc_exc_initialize.c: Fixed IVOR handling for e200z0 and e200z1.
  • Property mode set to 100644
File size: 2.8 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 <rtems.h>
32
33#include <bsp/vectors.h>
34
35bool bsp_exceptions_in_RAM = true;
36
37uint32_t ppc_exc_vector_base = 0;
38
39/*
40 * XXX: These values are choosen to directly generate the vector offsets for an
41 * e200z1 which has hard wired IVORs (IVOR0=0x00, IVOR1=0x10, IVOR2=0x20, ...).
42 */
43static const uint8_t ivor_values [] = {
44  [ASM_BOOKE_CRIT_VECTOR] = 0,
45  [ASM_MACH_VECTOR] = 1,
46  [ASM_PROT_VECTOR] = 2,
47  [ASM_ISI_VECTOR] = 3,
48  [ASM_EXT_VECTOR] = 4,
49  [ASM_ALIGN_VECTOR] = 5,
50  [ASM_PROG_VECTOR] = 6,
51  [ASM_FLOAT_VECTOR] = 7,
52  [ASM_SYS_VECTOR] = 8,
53  [ASM_BOOKE_APU_VECTOR] = 9,
54  [ASM_BOOKE_DEC_VECTOR] = 10,
55  [ASM_BOOKE_FIT_VECTOR] = 11,
56  [ASM_BOOKE_WDOG_VECTOR] = 12,
57  [ASM_BOOKE_DTLBMISS_VECTOR] = 13,
58  [ASM_BOOKE_ITLBMISS_VECTOR] = 14,
59  [ASM_BOOKE_DEBUG_VECTOR] = 15,
60  [ASM_E500_SPE_UNAVAILABLE_VECTOR] = 16,
61  [ASM_E500_EMB_FP_DATA_VECTOR] = 17,
62  [ASM_E500_EMB_FP_ROUND_VECTOR] = 18,
63  [ASM_E500_PERFMON_VECTOR] = 19
64};
65
66void *ppc_exc_vector_address(unsigned vector)
67{
68  uintptr_t vector_base = 0xfff00000;
69  uintptr_t vector_offset = vector << 8;
70
71  if (ppc_cpu_has_altivec()) {
72    if (vector == ASM_60X_VEC_VECTOR) {
73      vector_offset = ASM_60X_VEC_VECTOR_OFFSET;
74    }
75  }
76
77  if (ppc_cpu_is(PPC_405)) {
78    switch (vector) {
79      case ASM_BOOKE_FIT_VECTOR:
80        vector_offset = ASM_PPC405_FIT_VECTOR_OFFSET;
81        break;
82      case ASM_BOOKE_WDOG_VECTOR:
83        vector_offset = ASM_PPC405_WDOG_VECTOR_OFFSET;
84        break;
85      case ASM_TRACE_VECTOR:
86        vector_offset = ASM_PPC405_TRACE_VECTOR_OFFSET;
87        break;
88      case ASM_PPC405_APU_UNAVAIL_VECTOR:
89        vector_offset = ASM_60X_VEC_VECTOR_OFFSET;
90      default:
91        break;
92    }
93  }
94
95  if (
96    ppc_cpu_is_bookE() == PPC_BOOKE_STD
97      || ppc_cpu_is_bookE() == PPC_BOOKE_E500
98  ) {
99    if (vector < sizeof(ivor_values) / sizeof(ivor_values [0])) {
100      vector_offset = ((uintptr_t) ivor_values [vector]) << 4;
101    } else {
102      vector_offset = 0;
103    }
104  }
105
106  if (bsp_exceptions_in_RAM) {
107    vector_base = ppc_exc_vector_base;
108  }
109
110  return (void *) (vector_base + vector_offset);
111}
Note: See TracBrowser for help on using the repository browser.