source: rtems/c/src/exec/score/cpu/powerpc/ppc.h @ 086836e1

4.104.114.84.95
Last change on this file since 086836e1 was 086836e1, checked in by Joel Sherrill <joel.sherrill@…>, on 10/01/98 at 18:50:43

Patch from Thomas Doerfler <td@…> to improve 403 support.

  • c/src/exec/score/cpu/powerpc/ppc.h: some small changes (added ppc403 characteristics like a exception vector prefix register, some special register definitions). I am quite sure, they are compatible with the existing sources, although I did not check
  • c/src/exec/score/cpu/powerpc/cpu.c: There is one severe limitation in the exception entries: Due to the current code arrangement, the "branch absolute" to the ISR handler may only jump to the first 128MByte or the last 128MByte of the 4GByte address range. When the ppc403 is running out of ROM, the ROM functions are located in the last 128MByte (0xFFF00000 and up). These addresses were not handled correctly (sign reduced) in "install_raw_handler". The change I added should work on existing ppc BSPs aswell...
  • Property mode set to 100644
File size: 13.6 KB
Line 
1/*  ppc.h
2 *
3 *  This file contains definitions for the IBM/Motorola PowerPC
4 *  family members.
5 *
6 *  Author:     Andrew Bray <andy@i-cubed.co.uk>
7 *
8 *  COPYRIGHT (c) 1995 by i-cubed ltd.
9 *
10 *  To anyone who acknowledges that this file is provided "AS IS"
11 *  without any express or implied warranty:
12 *      permission to use, copy, modify, and distribute this file
13 *      for any purpose is hereby granted without fee, provided that
14 *      the above copyright notice and this notice appears in all
15 *      copies, and that the name of i-cubed limited not be used in
16 *      advertising or publicity pertaining to distribution of the
17 *      software without specific, written prior permission.
18 *      i-cubed limited makes no representations about the suitability
19 *      of this software for any purpose.
20 *
21 *  Derived from c/src/exec/cpu/no_cpu/no_cpu.h:
22 *
23 *  COPYRIGHT (c) 1989-1997.
24 *  On-Line Applications Research Corporation (OAR).
25 *
26 *  The license and distribution terms for this file may in
27 *  the file LICENSE in this distribution or at
28 *  http://www.OARcorp.com/rtems/license.html.
29 *
30 *
31 * Note:
32 *      This file is included by both C and assembler code ( -DASM )
33 *
34 *  $Id$
35 */
36
37
38#ifndef _INCLUDE_PPC_h
39#define _INCLUDE_PPC_h
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45/*
46 *  Define the name of the CPU family.
47 */
48
49#define CPU_NAME "PowerPC"
50
51/*
52 *  This file contains the information required to build
53 *  RTEMS for a particular member of the PowerPC family.  It does
54 *  this by setting variables to indicate which implementation
55 *  dependent features are present in a particular member
56 *  of the family.
57 *
58 *  The following architectural feature definitions are defaulted
59 *  unless specifically set by the model definition:
60 *
61 *    + PPC_DEBUG_MODEL          - PPC_DEBUG_MODEL_STANDARD
62 *    + PPC_INTERRUPT_MAX        - 16
63 *    + PPC_CACHE_ALIGNMENT      - 32
64 *    + PPC_LOW_POWER_MODE       - PPC_LOW_POWER_MODE_NONE
65 *    + PPC_HAS_EXCEPTION_PREFIX - 1
66 *    + PPC_HAS_FPU              - 1
67 *    + PPC_HAS_DOUBLE           - 1 if PPC_HAS_FPU,
68 *                               - 0 otherwise
69 *    + PPC_USE_MULTIPLE         - 0
70 */
71 
72/*
73 *  Define the debugging assistance models found in the PPC family.
74 *
75 *  Standard:         single step and branch trace
76 *  Single Step Only: single step only
77 *  IBM 4xx:          debug exception
78 */
79
80#define PPC_DEBUG_MODEL_STANDARD         1
81#define PPC_DEBUG_MODEL_SINGLE_STEP_ONLY 2
82#define PPC_DEBUG_MODEL_IBM4xx           3
83
84/*
85 *  Define the low power mode models
86 *
87 *  Standard:   as defined for 603e
88 *  Nap Mode:   nap mode only (604)
89 *  XXX 403GB, 603, 603e, 604, 821
90 */
91
92#define PPC_LOW_POWER_MODE_NONE      0
93#define PPC_LOW_POWER_MODE_STANDARD  1
94
95#if defined(ppc403)
96/*
97 *  IBM 403
98 *
99 *  Developed for 403GA.  Book checked for 403GB.
100 *
101 *  Does not have user mode.
102 */
103 
104#define CPU_MODEL_NAME "PowerPC 403"
105#define PPC_ALIGNMENT           4 
106#define PPC_CACHE_ALIGNMENT     16
107#define PPC_HAS_RFCI            1
108#define PPC_HAS_FPU             0
109#define PPC_USE_MULTIPLE        1
110#define PPC_I_CACHE             2048
111#define PPC_D_CACHE             1024
112
113#define PPC_DEBUG_MODEL          PPC_DEBUG_MODEL_IBM4xx
114#define PPC_HAS_EXCEPTION_PREFIX 0
115#define PPC_HAS_EVPR             1
116
117#elif defined(ppc601)
118/*
119 *  Submitted with original port -- book checked only.
120 */
121 
122#define CPU_MODEL_NAME  "PowerPC 601"
123
124#define PPC_ALIGNMENT           8
125#define PPC_USE_MULTIPLE        1
126#define PPC_I_CACHE             0
127#define PPC_D_CACHE             32768
128
129#define PPC_DEBUG_MODEL PPC_DEBUG_MODEL_SINGLE_STEP_ONLY
130
131#elif defined(ppc602)
132/*
133 *  Submitted with original port -- book checked only.
134 */
135 
136#define CPU_MODEL_NAME  "PowerPC 602"
137
138#define PPC_ALIGNMENT           4
139#define PPC_HAS_DOUBLE          0
140#define PPC_I_CACHE             4096
141#define PPC_D_CACHE             4096
142
143#elif defined(ppc603)
144/*
145 *  Submitted with original port -- book checked only.
146 */
147 
148#define CPU_MODEL_NAME  "PowerPC 603"
149
150#define PPC_ALIGNMENT           8
151#define PPC_I_CACHE             8192
152#define PPC_D_CACHE             8192
153
154#elif defined(ppc603e)
155 
156#define CPU_MODEL_NAME  "PowerPC 603e"
157/*
158 *  Submitted with original port.
159 *
160 *  Known to work on real hardware.
161 */
162
163#define PPC_ALIGNMENT           8
164#define PPC_I_CACHE             16384
165#define PPC_D_CACHE             16384
166
167#define PPC_LOW_POWER_MODE PPC_LOW_POWER_MODE_STANDARD
168
169#elif defined(ppc604)
170/*
171 *  Submitted with original port -- book checked only.
172 */
173 
174#define CPU_MODEL_NAME  "PowerPC 604"
175
176#define PPC_ALIGNMENT           8
177#define PPC_I_CACHE             16384
178#define PPC_D_CACHE             16384
179 
180#else
181 
182#error "Unsupported CPU Model"
183 
184#endif
185
186/*
187 *  Application binary interfaces.
188 *
189 *  PPC_ABI MUST be defined as one of these.
190 *  Only PPC_ABI_POWEROPEN is currently fully supported.
191 *  Only EABI will be supported in the end when
192 *  the tools are there.
193 *  Only big endian is currently supported.
194 */
195/*
196 *  PowerOpen ABI.  This is Andy's hack of the
197 *  PowerOpen ABI to ELF.  ELF rather than a
198 *  XCOFF assembler is used.  This may work
199 *  if PPC_ASM == PPC_ASM_XCOFF is defined.
200 */
201#define PPC_ABI_POWEROPEN       0
202/*
203 *  GCC 2.7.0 munched version of EABI, with
204 *  PowerOpen calling convention and stack frames,
205 *  but EABI style indirect function calls.
206 */
207#define PPC_ABI_GCC27           1
208/*
209 *  SVR4 ABI
210 */
211#define PPC_ABI_SVR4            2
212/*
213 *  Embedded ABI
214 */
215#define PPC_ABI_EABI            3
216
217#if (PPC_ABI == PPC_ABI_POWEROPEN)
218#define PPC_STACK_ALIGNMENT     8
219#elif (PPC_ABI == PPC_ABI_GCC27)
220#define PPC_STACK_ALIGNMENT     8
221#elif (PPC_ABI == PPC_ABI_SVR4)
222#define PPC_STACK_ALIGNMENT     16
223#elif (PPC_ABI == PPC_ABI_EABI)
224#define PPC_STACK_ALIGNMENT     8
225#else
226#error  "PPC_ABI is not properly defined"
227#endif
228#ifndef PPC_ABI
229#error  "PPC_ABI is not properly defined"
230#endif
231
232/*
233 *  Assemblers.
234 *  PPC_ASM MUST be defined as one of these.
235 *
236 *  PPC_ASM_ELF:   ELF assembler. Currently used for all ABIs.
237 *  PPC_ASM_XCOFF: XCOFF assembler. May be needed for PowerOpen ABI.
238 *
239 *  NOTE: Only PPC_ABI_ELF is currently fully supported.
240 */
241
242#define PPC_ASM_ELF   0
243#define PPC_ASM_XCOFF 1
244
245/*
246 *  Use the default debug scheme defined in the architectural specification
247 *  if another model has not been specified.
248 */
249
250#ifndef PPC_DEBUG_MODEL
251#define PPC_DEBUG_MODEL PPC_DEBUG_MODEL_STANDARD
252#endif
253
254/*
255 *  If the maximum number of exception sources has not been defined,
256 *  then default it to 16.
257 */
258
259#ifndef PPC_INTERRUPT_MAX
260#define PPC_INTERRUPT_MAX       16
261#endif
262
263/*
264 *  Unless specified otherwise, the cache line size is defaulted to 32.
265 *
266 *  The derive the power of 2 the cache line is.
267 */
268
269#ifndef PPC_CACHE_ALIGNMENT
270#define PPC_CACHE_ALIGNMENT 32
271#endif
272
273#if (PPC_CACHE_ALIGNMENT == 16)
274#define PPC_CACHE_ALIGN_POWER 4
275#elif (PPC_CACHE_ALIGNMENT == 32)
276#define PPC_CACHE_ALIGN_POWER 5
277#else
278#error "Undefined power of 2 for PPC_CACHE_ALIGNMENT"
279#endif
280
281/*
282 *  Unless otherwise specified, assume the model has an IP/EP bit to
283 *  set the exception address prefix.
284 */
285
286#ifndef PPC_HAS_EXCEPTION_PREFIX
287#define PPC_HAS_EXCEPTION_PREFIX 1
288#endif
289
290/*
291 *  Unless otherwise specified, assume the model does NOT have
292 *  403 style EVPR register to set the exception address prefix.
293 */
294
295#ifndef PPC_HAS_EVPR
296#define PPC_HAS_EVPR 0
297#endif
298
299/*
300 *  If no low power mode model was specified, then assume there is none.
301 */
302
303#ifndef PPC_LOW_POWER_MODE
304#define PPC_LOW_POWER_MODE PPC_LOW_POWER_MODE_NONE
305#endif
306
307/*
308 *  Unless specified above, then assume the model has FP support.
309 */
310
311#ifndef PPC_HAS_FPU
312#define PPC_HAS_FPU 1
313#endif
314
315/*
316 *  Unless specified above, If the model has FP support, it is assumed to
317 *  support doubles (8-byte floating point numbers).
318 *
319 *  If the model does NOT have FP support, then the model does
320 *  NOT have double length FP registers.
321 */
322
323#ifndef PPC_HAS_DOUBLE
324#if (PPC_HAS_FPU)
325#define PPC_HAS_DOUBLE 1
326#else
327#define PPC_HAS_DOUBLE 0
328#endif
329#endif
330
331/*
332 *  Unless specified above, then assume the model does NOT have critical
333 *  interrupt support.
334 */
335
336#ifndef PPC_HAS_RFCI
337#define PPC_HAS_RFCI 0
338#endif
339
340/*
341 *  Unless specified above, do not use the load/store multiple instructions
342 *  in a context switch.
343 */
344
345#ifndef PPC_USE_MULTIPLE
346#define PPC_USE_MULTIPLE 0
347#endif
348
349/*
350 *  The following exceptions are not maskable, and are not
351 *  necessarily predictable, so cannot be offered to RTEMS:
352 *    Alignment exception - handled by the CPU module
353 *    Data exceptions.
354 *    Instruction exceptions.
355 */
356
357/*
358 *  Base Interrupt vectors supported on all models.
359 */
360#define PPC_IRQ_SYSTEM_RESET     0 /* 0x00100 - System reset.              */
361#define PPC_IRQ_MCHECK           1 /* 0x00200 - Machine check              */
362#define PPC_IRQ_PROTECT          2 /* 0x00300 - Protection violation       */
363#define PPC_IRQ_ISI              3 /* 0x00400 - Instruction Fetch error    */
364#define PPC_IRQ_EXTERNAL         4 /* 0x00500 - External interrupt         */
365#define PPC_IRQ_ALIGNMENT        5 /* 0X00600 - Alignment exception        */
366#define PPC_IRQ_PROGRAM          6 /* 0x00700 - Program exception          */
367#define PPC_IRQ_NOFP             7 /* 0x00800 - Floating point unavailable */
368#define PPC_IRQ_DECREMENTER      8 /* 0x00900 - Decrementer interrupt      */
369#define PPC_IRQ_RESERVED_A       9 /* 0x00a00 - Implementation Reserved    */
370#define PPC_IRQ_RESERVED_B      10 /* 0x00a00 - Implementation Reserved    */
371#define PPC_IRQ_SCALL           11 /* 0x00c00 - System call                */
372#define PPC_IRQ_TRACE           12 /* 0x00d00 - Trace Exception            */
373#define PPC_IRQ_FP_ASST         13 /* ox00e00 - Floating point assist      */
374#define PPC_STD_IRQ_LAST        PPC_IRQ_FP_ASST
375
376#define PPC_IRQ_FIRST           PPC_IRQ_SYSTEM_RESET
377
378#if defined(ppc403)
379                                 
380#define PPC_IRQ_CRIT     PPC_IRQ_SYSTEM_RESET /*0x00100- Critical int. pin */
381#define PPC_IRQ_PIT      (PPC_STD_IRQ_LAST+1) /*0x01000- Pgm interval timer*/
382#define PPC_IRQ_FIT      (PPC_STD_IRQ_LAST+2) /*0x01010- Fixed int. timer  */
383#define PPC_IRQ_WATCHDOG (PPC_STD_IRQ_LAST+3) /*0x01020- Watchdog timer    */
384#define PPC_IRQ_DEBUG    (PPC_STD_IRQ_LAST+4) /*0x02000- Debug exceptions  */
385#define PPC_IRQ_LAST     PPC_IRQ_DEBUG   
386
387#elif defined(ppc601)
388#define PPC_IRQ_TRACE    (PPC_STD_IRQ_LAST+1) /*0x02000-Run/Trace Exception*/
389#define PPC_IRQ_LAST     PPC_IRQ_TRACE       
390
391#elif defined(ppc602)
392#define PPC_IRQ_LAST     (PPC_STD_IRQ_LAST)
393
394#elif defined(ppc603)
395#define PPC_IRQ_TRANS_MISS (PPC_STD_IRQ_LAST+1) /*0x1000-Ins Translation Miss*/
396#define PPC_IRQ_DATA_LOAD  (PPC_STD_IRQ_LAST+2) /*0x1100-Data Load Trans Miss*/
397#define PPC_IRQ_DATA_STORE (PPC_STD_IRQ_LAST+3) /*0x1200-Data Store Miss     */
398#define PPC_IRQ_ADDR_BRK   (PPC_STD_IRQ_LAST+4) /*0x1300-Instruction Bkpoint */
399#define PPC_IRQ_SYS_MGT    (PPC_STD_IRQ_LAST+5) /*0x1400-System Management   */
400#define PPC_IRQ_LAST       PPC_IRQ_SYS_MGT   
401
402#elif defined(ppc603e)
403#define PPC_TLB_INST_MISS  (PPC_STD_IRQ_LAST+1) /*0x1000-Instruction TLB Miss*/
404#define PPC_TLB_LOAD_MISS  (PPC_STD_IRQ_LAST+2) /*0x1100-TLB miss on load  */
405#define PPC_TLB_STORE_MISS (PPC_STD_IRQ_LAST+3) /*0x1200-TLB Miss on store */
406#define PPC_IRQ_ADDRBRK    (PPC_STD_IRQ_LAST+4) /*0x1300-Instruct addr break */
407#define PPC_IRQ_SYS_MGT    (PPC_STD_IRQ_LAST+5) /*0x1400-System Management   */
408#define PPC_IRQ_LAST       PPC_IRQ_SYS_MGT   
409
410
411#elif defined(ppc604)
412#define PPC_IRQ_ADDR_BRK (PPC_STD_IRQ_LAST+1) /*0x1300- Inst. addr break  */
413#define PPC_IRQ_SYS_MGT  (PPC_STD_IRQ_LAST+2) /*0x1400- System Management */
414#define PPC_IRQ_LAST     PPC604_IRQ_SYS_MGT 
415
416#endif
417
418/*
419 *  Machine Status Register (MSR) Constants Used by RTEMS
420 */
421
422/*
423 *  Some PPC model manuals refer to the Exception Prefix (EP) bit as
424 *  IP for no apparent reason.
425 */
426
427#define PPC_MSR_RI       0x000000002 /* bit 30 - recoverable exception */
428#define PPC_MSR_DR       0x000000010 /* bit 27 - data address translation */
429#define PPC_MSR_IR       0x000000020 /* bit 26 - instruction addr translation*/
430
431#if (PPC_HAS_EXCEPTION_PREFIX)
432#define PPC_MSR_EP       0x000000040 /* bit 25 - exception prefix */
433#else
434#define PPC_MSR_EP       0x000000000 /* bit 25 - exception prefix */
435#endif
436
437#if (PPC_HAS_FPU)
438#define PPC_MSR_FP       0x000002000 /* bit 18 - floating point enable */
439#else
440#define PPC_MSR_FP       0x000000000 /* bit 18 - floating point enable */
441#endif
442
443#if (PPC_LOW_POWER_MODE == PPC_LOW_POWER_MODE_NONE)
444#define PPC_MSR_POW      0x000000000 /* bit 13 - power management enable */
445#else
446#define PPC_MSR_POW      0x000040000 /* bit 13 - power management enable */
447#endif
448
449/*
450 *  Interrupt/exception MSR bits set as defined on p. 2-20 in "The Programming
451 *  Environments" and the manuals for various PPC models.
452 */
453
454#if (PPC_DEBUG_MODEL == PPC_DEBUG_MODEL_STANDARD)
455#define PPC_MSR_DE       0x000000000 /* bit 22 - debug exception enable */
456#define PPC_MSR_BE       0x000000200 /* bit 22 - branch trace enable */
457#define PPC_MSR_SE       0x000000400 /* bit 21 - single step trace enable */
458#elif (PPC_DEBUG_MODEL == PPC_DEBUG_MODEL_SINGLE_STEP_ONLY)
459#define PPC_MSR_DE       0x000000000 /* bit 22 - debug exception enable */
460#define PPC_MSR_BE       0x000000200 /* bit 22 - branch trace enable */
461#define PPC_MSR_SE       0x000000000 /* bit 21 - single step trace enable */
462#elif (PPC_DEBUG_MODEL == PPC_DEBUG_MODEL_IBM4xx)
463#define PPC_MSR_DE       0x000000200 /* bit 22 - debug exception enable */
464#define PPC_MSR_BE       0x000000000 /* bit 22 - branch trace enable */
465#define PPC_MSR_SE       0x000000000 /* bit 21 - single step trace enable */
466#else
467#error "MSR constants -- unknown PPC_DEBUG_MODEL!!"
468#endif
469
470#define PPC_MSR_ME       0x000001000 /* bit 19 - machine check enable */
471#define PPC_MSR_EE       0x000008000 /* bit 16 - external interrupt enable */
472
473#if (PPC_HAS_RFCI)
474#define PPC_MSR_CE       0x000020000 /* bit 14 - critical interrupt enable */
475#else
476#define PPC_MSR_CE       0x000000000 /* bit 14 - critical interrupt enable */
477#endif
478
479#define PPC_MSR_DISABLE_MASK (PPC_MSR_ME|PPC_MSR_EE|PPC_MSR_CE)
480
481/*
482 *  Initial value for the FPSCR register
483 */
484
485#define PPC_INIT_FPSCR          0x000000f8
486
487#ifdef __cplusplus
488}
489#endif
490
491#endif /* ! _INCLUDE_PPC_h */
492/* end of include file */
493
494
Note: See TracBrowser for help on using the repository browser.