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

4.104.114.84.95
Last change on this file since e4d7169f was 8ef3818, checked in by Joel Sherrill <joel.sherrill@…>, on 06/12/00 at 19:57:02

Patch from John Cotton <john.cotton@…>, Charles-Antoine Gauthier
<charles.gauthier@…>, and Darlene A. Stewart
<Darlene.Stewart@…> to add support for a number of very
significant things:

+ BSPs for many variations on the Motorola MBX8xx board series
+ Cache Manager including initial support for m68040

and PowerPC

+ Rework of mpc8xx libcpu code so all mpc8xx CPUs now use

same code base.

+ Rework of eth_comm BSP to utiltize above.

John reports this works on the 821 and 860

  • Property mode set to 100644
File size: 23.1 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 *  MPC860 support code was added by Jay Monkman <jmonkman@frasca.com>
11 *
12 *  To anyone who acknowledges that this file is provided "AS IS"
13 *  without any express or implied warranty:
14 *      permission to use, copy, modify, and distribute this file
15 *      for any purpose is hereby granted without fee, provided that
16 *      the above copyright notice and this notice appears in all
17 *      copies, and that the name of i-cubed limited not be used in
18 *      advertising or publicity pertaining to distribution of the
19 *      software without specific, written prior permission.
20 *      i-cubed limited makes no representations about the suitability
21 *      of this software for any purpose.
22 *
23 *  Derived from c/src/exec/cpu/no_cpu/no_cpu.h:
24 *
25 *  COPYRIGHT (c) 1989-1997.
26 *  On-Line Applications Research Corporation (OAR).
27 *
28 *  The license and distribution terms for this file may in
29 *  the file LICENSE in this distribution or at
30 *  http://www.OARcorp.com/rtems/license.html.
31 *
32 *
33 * Note:
34 *      This file is included by both C and assembler code ( -DASM )
35 *
36 *  $Id$
37 */
38
39
40#ifndef _INCLUDE_PPC_h
41#define _INCLUDE_PPC_h
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47#include <rtems/score/ppctypes.h>
48
49/*
50 *  Define the name of the CPU family.
51 */
52
53#define CPU_NAME "PowerPC"
54
55/*
56 *  This file contains the information required to build
57 *  RTEMS for a particular member of the PowerPC family.  It does
58 *  this by setting variables to indicate which implementation
59 *  dependent features are present in a particular member
60 *  of the family.
61 *
62 *  The following architectural feature definitions are defaulted
63 *  unless specifically set by the model definition:
64 *
65 *    + PPC_DEBUG_MODEL          - PPC_DEBUG_MODEL_STANDARD
66 *    + PPC_INTERRUPT_MAX        - 16
67 *    + PPC_CACHE_ALIGNMENT      - 32
68 *    + PPC_LOW_POWER_MODE       - PPC_LOW_POWER_MODE_NONE
69 *    + PPC_HAS_EXCEPTION_PREFIX - 1
70 *    + PPC_HAS_FPU              - 1
71 *    + PPC_HAS_DOUBLE           - 1 if PPC_HAS_FPU,
72 *                               - 0 otherwise
73 *    + PPC_USE_MULTIPLE         - 0
74 */
75 
76/*
77 *  Define the debugging assistance models found in the PPC family.
78 *
79 *  Standard:         single step and branch trace
80 *  Single Step Only: single step only
81 *  IBM 4xx:          debug exception
82 */
83
84#define PPC_DEBUG_MODEL_STANDARD         1
85#define PPC_DEBUG_MODEL_SINGLE_STEP_ONLY 2
86#define PPC_DEBUG_MODEL_IBM4xx           3
87
88/*
89 *  Define the low power mode models
90 *
91 *  Standard:   as defined for 603e
92 *  Nap Mode:   nap mode only (604)
93 *  XXX 403GB, 603, 603e, 604, 821
94 */
95
96#define PPC_LOW_POWER_MODE_NONE      0
97#define PPC_LOW_POWER_MODE_STANDARD  1
98
99#if defined(rtems_multilib)
100/*
101 *  Figure out all CPU Model Feature Flags based upon compiler
102 *  predefines.
103 */
104
105#define CPU_MODEL_NAME           "rtems_multilib"
106#define PPC_ALIGNMENT            4 
107#define PPC_CACHE_ALIGNMENT      16
108#define PPC_HAS_RFCI             1
109#define PPC_HAS_FPU              0
110#define PPC_USE_MULTIPLE         1
111#define PPC_I_CACHE              2048
112#define PPC_D_CACHE              1024
113#define PPC_DEBUG_MODEL          PPC_DEBUG_MODEL_STANDARD
114#define PPC_HAS_EXCEPTION_PREFIX 0
115#define PPC_HAS_EVPR             0
116#define PPC_INTERRUPT_MAX        16
117#define PPC_LOW_POWER_MODE       PPC_LOW_POWER_MODE_STANDARD
118#define PPC_HAS_DOUBLE           0
119
120#elif defined(ppc403)
121/*
122 *  IBM 403
123 *
124 *  Developed for 403GA.  Book checked for 403GB.
125 *
126 *  Does not have user mode.
127 */
128 
129#define CPU_MODEL_NAME "PowerPC 403"
130#define PPC_ALIGNMENT           4 
131#define PPC_CACHE_ALIGNMENT     16
132#define PPC_HAS_RFCI            1
133#define PPC_HAS_FPU             0
134#define PPC_USE_MULTIPLE        1
135#define PPC_I_CACHE             2048
136#define PPC_D_CACHE             1024
137
138#define PPC_DEBUG_MODEL          PPC_DEBUG_MODEL_IBM4xx
139#define PPC_HAS_EXCEPTION_PREFIX 0
140#define PPC_HAS_EVPR             1
141
142
143#elif defined(mpc505) || defined(mpc509)
144/*
145 *  Submitted by Sergei Organov <osv@Javad.RU> as a patch against
146 *  3.6.0 long after 4.0 was released.   This is just an attempt
147 *  to get the setting correct.
148 */
149
150#define CPU_MODEL_NAME  "PowerPC 505/509"
151
152#define PPC_ALIGNMENT           4
153#define PPC_CACHE_ALIGNMENT     16
154#define PPC_I_CACHE             4096
155#define PPC_D_CACHE             0
156
157
158#elif defined(ppc601)
159
160/*
161 *  Submitted with original port -- book checked only.
162 */
163 
164#define CPU_MODEL_NAME  "PowerPC 601"
165
166#define PPC_ALIGNMENT           8
167#define PPC_USE_MULTIPLE        1
168#define PPC_I_CACHE             0
169#define PPC_D_CACHE             32768
170
171#define PPC_DEBUG_MODEL PPC_DEBUG_MODEL_SINGLE_STEP_ONLY
172
173#elif defined(ppc602)
174/*
175 *  Submitted with original port -- book checked only.
176 */
177 
178#define CPU_MODEL_NAME  "PowerPC 602"
179
180#define PPC_ALIGNMENT           4
181#define PPC_HAS_DOUBLE          0
182#define PPC_I_CACHE             4096
183#define PPC_D_CACHE             4096
184
185#elif defined(ppc603)
186/*
187 *  Submitted with original port -- book checked only.
188 */
189 
190#define CPU_MODEL_NAME  "PowerPC 603"
191
192#define PPC_ALIGNMENT           8
193#define PPC_I_CACHE             8192
194#define PPC_D_CACHE             8192
195
196#elif defined(ppc603e)
197 
198#define CPU_MODEL_NAME  "PowerPC 603e"
199/*
200 *  Submitted with original port.
201 *
202 *  Known to work on real hardware.
203 */
204
205#define PPC_ALIGNMENT           8
206#define PPC_I_CACHE             16384
207#define PPC_D_CACHE             16384
208
209#define PPC_LOW_POWER_MODE PPC_LOW_POWER_MODE_STANDARD
210
211#elif defined(mpc604)
212/*
213 *  Submitted with original port -- book checked only.
214 */
215 
216#define CPU_MODEL_NAME  "PowerPC 604"
217
218#define PPC_ALIGNMENT           8
219#define PPC_I_CACHE             16384
220#define PPC_D_CACHE             16384
221 
222#elif defined(mpc860)
223/*
224 *  Added by Jay Monkman (jmonkman@frasca.com) 6/28/98
225 *  with some changes by Darlene Stewart (Darlene.Stewart@iit.nrc.ca)
226 */
227#define CPU_MODEL_NAME  "PowerPC MPC860"
228
229#define PPC_ALIGNMENT           4
230#define PPC_I_CACHE             4096
231#define PPC_D_CACHE             4096
232#define PPC_CACHE_ALIGNMENT     16
233#define PPC_INTERRUPT_MAX       71
234#define PPC_HAS_FPU             0
235#define PPC_HAS_DOUBLE          0
236#define PPC_USE_MULTIPLE        1
237
238#define PPC_MSR_0               0x00009000
239#define PPC_MSR_1               0x00001000
240#define PPC_MSR_2               0x00001000
241#define PPC_MSR_3               0x00000000
242
243#elif defined(mpc821)
244/*
245 *  Added by Andrew Bray <andy@chaos.org.uk> 6/April/1999
246 */
247#define CPU_MODEL_NAME  "PowerPC MPC821"
248
249#define PPC_ALIGNMENT           4
250#define PPC_I_CACHE             4096
251#define PPC_D_CACHE             4096
252#define PPC_CACHE_ALIGNMENT     16
253#define PPC_INTERRUPT_MAX       71
254#define PPC_HAS_FPU             0
255#define PPC_HAS_DOUBLE          0
256
257#define PPC_MSR_0               0x00009000
258#define PPC_MSR_1               0x00001000
259#define PPC_MSR_2               0x00001000
260#define PPC_MSR_3               0x00000000
261
262#elif defined(mpc750)
263
264#define CPU_MODEL_NAME  "PowerPC 750"
265
266#define PPC_ALIGNMENT           8
267#define PPC_I_CACHE             16384
268#define PPC_D_CACHE             16384
269 
270#else
271 
272#error "Unsupported CPU Model"
273 
274#endif
275
276/*
277 *  Application binary interfaces.
278 *
279 *  PPC_ABI MUST be defined as one of these.
280 *  Only PPC_ABI_POWEROPEN is currently fully supported.
281 *  Only EABI will be supported in the end when
282 *  the tools are there.
283 *  Only big endian is currently supported.
284 */
285/*
286 *  PowerOpen ABI.  This is Andy's hack of the
287 *  PowerOpen ABI to ELF.  ELF rather than a
288 *  XCOFF assembler is used.  This may work
289 *  if PPC_ASM == PPC_ASM_XCOFF is defined.
290 */
291#define PPC_ABI_POWEROPEN       0
292/*
293 *  GCC 2.7.0 munched version of EABI, with
294 *  PowerOpen calling convention and stack frames,
295 *  but EABI style indirect function calls.
296 */
297#define PPC_ABI_GCC27           1
298/*
299 *  SVR4 ABI
300 */
301#define PPC_ABI_SVR4            2
302/*
303 *  Embedded ABI
304 */
305#define PPC_ABI_EABI            3
306
307/*
308 *  Default to the EABI used by current GNU tools
309 */
310
311#ifndef PPC_ABI
312#define PPC_ABI PPC_ABI_EABI
313#endif
314
315#if (PPC_ABI == PPC_ABI_POWEROPEN)
316#define PPC_STACK_ALIGNMENT     8
317#elif (PPC_ABI == PPC_ABI_GCC27)
318#define PPC_STACK_ALIGNMENT     8
319#elif (PPC_ABI == PPC_ABI_SVR4)
320#define PPC_STACK_ALIGNMENT     16
321#elif (PPC_ABI == PPC_ABI_EABI)
322#define PPC_STACK_ALIGNMENT     8
323#else
324#error  "PPC_ABI is not properly defined"
325#endif
326#ifndef PPC_ABI
327#error  "PPC_ABI is not properly defined"
328#endif
329
330/*
331 *  Assemblers.
332 *  PPC_ASM MUST be defined as one of these.
333 *
334 *  PPC_ASM_ELF:   ELF assembler. Currently used for all ABIs.
335 *  PPC_ASM_XCOFF: XCOFF assembler. May be needed for PowerOpen ABI.
336 *
337 *  NOTE: Only PPC_ABI_ELF is currently fully supported.
338 */
339
340#define PPC_ASM_ELF   0
341#define PPC_ASM_XCOFF 1
342
343/*
344 *  Default to the assembler format used by the current GNU tools.
345 */
346
347#ifndef PPC_ASM
348#define PPC_ASM PPC_ASM_ELF
349#endif
350
351/*
352 *  Use the default debug scheme defined in the architectural specification
353 *  if another model has not been specified.
354 */
355
356#ifndef PPC_DEBUG_MODEL
357#define PPC_DEBUG_MODEL PPC_DEBUG_MODEL_STANDARD
358#endif
359
360/*
361 *  If the maximum number of exception sources has not been defined,
362 *  then default it to 16.
363 */
364
365#ifndef PPC_INTERRUPT_MAX
366#define PPC_INTERRUPT_MAX       16
367#endif
368
369/*
370 *  Unless specified otherwise, the cache line size is defaulted to 32.
371 *
372 *  The derive the power of 2 the cache line is.
373 */
374
375#ifndef PPC_CACHE_ALIGNMENT
376#define PPC_CACHE_ALIGNMENT 32
377#endif
378
379#if (PPC_CACHE_ALIGNMENT == 16)
380#define PPC_CACHE_ALIGN_POWER 4
381#elif (PPC_CACHE_ALIGNMENT == 32)
382#define PPC_CACHE_ALIGN_POWER 5
383#else
384#error "Undefined power of 2 for PPC_CACHE_ALIGNMENT"
385#endif
386
387#ifndef ASM
388
389/*
390 * CACHE MANAGER: The following functions are CPU-specific.
391 * They provide the basic implementation for the rtems_* cache
392 * management routines. If a given function has no meaning for the CPU,
393 * it does nothing by default.
394 *
395 * FIXME: Some functions simply have not been implemented.
396 */
397 
398#if defined(ppc603)                     /* And possibly others */
399#define _CPU_DATA_CACHE_ALIGNMENT PPC_CACHE_ALIGNMENT
400#define _CPU_INST_CACHE_ALIGNMENT PPC_CACHE_ALIGNMENT
401
402/* Helpful macros */
403#define PPC_Get_HID0( _value ) \
404  do { \
405      _value = 0;        /* to avoid warnings */ \
406      asm volatile( \
407          "mfspr %0, 0x3f0;"     /* get HID0 */ \
408          "isync" \
409          : "=r" (_value) \
410          : "0" (_value) \
411      ); \
412  } while (0)
413
414#define PPC_Set_HID0( _value ) \
415  do { \
416      asm volatile( \
417          "isync;" \
418          "mtspr 0x3f0, %0;"     /* load HID0 */ \
419          "isync" \
420          : "=r" (_value) \
421          : "0" (_value) \
422      ); \
423  } while (0)
424
425static inline void _CPU_enable_data_cache (
426        void )
427{
428  unsigned32 value;
429  PPC_Get_HID0( value );
430  value |= 0x00004000;        /* set DCE bit */
431  PPC_Set_HID0( value );
432}
433
434static inline void _CPU_disable_data_cache (
435        void )
436{
437  unsigned32 value;
438  PPC_Get_HID0( value );
439  value &= 0xFFFFBFFF;        /* clear DCE bit */
440  PPC_Set_HID0( value );
441}
442
443static inline void _CPU_enable_inst_cache (
444        void )
445{
446  unsigned32 value;
447  PPC_Get_HID0( value );
448  value |= 0x00008000;       /* Set ICE bit */
449  PPC_Set_HID0( value );
450}
451
452static inline void _CPU_disable_inst_cache (
453        void )
454{
455  unsigned32 value;
456  PPC_Get_HID0( value );
457  value &= 0xFFFF7FFF;       /* Clear ICE bit */
458  PPC_Set_HID0( value );
459}
460
461#elif ( defined(mpc860) || defined(mpc821) )
462
463#define _CPU_DATA_CACHE_ALIGNMENT PPC_CACHE_ALIGNMENT
464#define _CPU_INST_CACHE_ALIGNMENT PPC_CACHE_ALIGNMENT
465
466#define mtspr(_spr,_reg)   __asm__ volatile ( "mtspr %0, %1\n" : : "i" ((_spr)), "r" ((_reg)) )
467#define isync   __asm__ volatile ("isync\n"::)
468
469static inline void _CPU_flush_1_data_cache_line(
470        const void * _address )
471{
472  register const void *__address = _address;
473  asm volatile ( "dcbf 0,%0" :: "r" (__address) );
474}
475
476static inline void _CPU_invalidate_1_data_cache_line(
477        const void * _address )
478{
479  register const void *__address = _address;
480  asm volatile ( "dcbi 0,%0" :: "r" (__address) );
481}
482
483static inline void _CPU_flush_entire_data_cache ( void ) {}
484static inline void _CPU_invalidate_entire_data_cache ( void ) {}
485static inline void _CPU_freeze_data_cache ( void ) {}
486static inline void _CPU_unfreeze_data_cache ( void ) {}
487
488static inline void _CPU_enable_data_cache (
489        void )
490{
491  unsigned32 r1;
492  r1 = (0x2<<24);
493  mtspr( 568, r1 );
494  isync;
495}
496
497static inline void _CPU_disable_data_cache (
498        void )
499{
500  unsigned32 r1;
501  r1 = (0x4<<24);
502  mtspr( 568, r1 );
503  isync;
504}
505
506static inline void _CPU_invalidate_1_inst_cache_line(
507        const void * _address )
508{
509  register const void *__address = _address;
510  asm volatile ( "icbi 0,%0" :: "r" (__address) );
511}
512
513static inline void _CPU_invalidate_entire_inst_cache ( void ) {}
514static inline void _CPU_freeze_inst_cache ( void ) {}
515static inline void _CPU_unfreeze_inst_cache ( void ) {}
516
517static inline void _CPU_enable_inst_cache (
518        void )
519{
520  unsigned32 r1;
521  r1 = (0x2<<24);
522  mtspr( 560, r1 );
523  isync;
524}
525
526static inline void _CPU_disable_inst_cache (
527        void )
528{
529  unsigned32 r1;
530  r1 = (0x4<<24);
531  mtspr( 560, r1 );
532  isync;
533}
534#endif
535
536#endif  /* !ASM */
537
538/*
539 *  Unless otherwise specified, assume the model has an IP/EP bit to
540 *  set the exception address prefix.
541 */
542
543#ifndef PPC_HAS_EXCEPTION_PREFIX
544#define PPC_HAS_EXCEPTION_PREFIX 1
545#endif
546
547/*
548 *  Unless otherwise specified, assume the model does NOT have
549 *  403 style EVPR register to set the exception address prefix.
550 */
551
552#ifndef PPC_HAS_EVPR
553#define PPC_HAS_EVPR 0
554#endif
555
556/*
557 *  If no low power mode model was specified, then assume there is none.
558 */
559
560#ifndef PPC_LOW_POWER_MODE
561#define PPC_LOW_POWER_MODE PPC_LOW_POWER_MODE_NONE
562#endif
563
564/*
565 *  Unless specified above, then assume the model has FP support.
566 */
567
568#ifndef PPC_HAS_FPU
569#define PPC_HAS_FPU 1
570#endif
571
572/*
573 *  Unless specified above, If the model has FP support, it is assumed to
574 *  support doubles (8-byte floating point numbers).
575 *
576 *  If the model does NOT have FP support, then the model does
577 *  NOT have double length FP registers.
578 */
579
580#ifndef PPC_HAS_DOUBLE
581#if (PPC_HAS_FPU)
582#define PPC_HAS_DOUBLE 1
583#else
584#define PPC_HAS_DOUBLE 0
585#endif
586#endif
587
588/*
589 *  Unless specified above, then assume the model does NOT have critical
590 *  interrupt support.
591 */
592
593#ifndef PPC_HAS_RFCI
594#define PPC_HAS_RFCI 0
595#endif
596
597/*
598 *  Unless specified above, do not use the load/store multiple instructions
599 *  in a context switch.
600 */
601
602#ifndef PPC_USE_MULTIPLE
603#define PPC_USE_MULTIPLE 0
604#endif
605
606/*
607 *  The following exceptions are not maskable, and are not
608 *  necessarily predictable, so cannot be offered to RTEMS:
609 *    Alignment exception - handled by the CPU module
610 *    Data exceptions.
611 *    Instruction exceptions.
612 */
613
614/*
615 *  Base Interrupt vectors supported on all models.
616 */
617#define PPC_IRQ_SYSTEM_RESET     0 /* 0x00100 - System reset.              */
618#define PPC_IRQ_MCHECK           1 /* 0x00200 - Machine check              */
619#define PPC_IRQ_PROTECT          2 /* 0x00300 - Protection violation       */
620#define PPC_IRQ_ISI              3 /* 0x00400 - Instruction Fetch error    */
621#define PPC_IRQ_EXTERNAL         4 /* 0x00500 - External interrupt         */
622#define PPC_IRQ_ALIGNMENT        5 /* 0X00600 - Alignment exception        */
623#define PPC_IRQ_PROGRAM          6 /* 0x00700 - Program exception          */
624#define PPC_IRQ_NOFP             7 /* 0x00800 - Floating point unavailable */
625#define PPC_IRQ_DECREMENTER      8 /* 0x00900 - Decrementer interrupt      */
626#define PPC_IRQ_RESERVED_A       9 /* 0x00a00 - Implementation Reserved    */
627#define PPC_IRQ_RESERVED_B      10 /* 0x00a00 - Implementation Reserved    */
628#define PPC_IRQ_SCALL           11 /* 0x00c00 - System call                */
629#define PPC_IRQ_TRACE           12 /* 0x00d00 - Trace Exception            */
630#define PPC_IRQ_FP_ASST         13 /* ox00e00 - Floating point assist      */
631#define PPC_STD_IRQ_LAST        PPC_IRQ_FP_ASST
632
633#define PPC_IRQ_FIRST           PPC_IRQ_SYSTEM_RESET
634
635#if defined(ppc403)
636                                 
637#define PPC_IRQ_CRIT     PPC_IRQ_SYSTEM_RESET /*0x00100- Critical int. pin */
638#define PPC_IRQ_PIT      (PPC_STD_IRQ_LAST+1) /*0x01000- Pgm interval timer*/
639#define PPC_IRQ_FIT      (PPC_STD_IRQ_LAST+2) /*0x01010- Fixed int. timer  */
640#define PPC_IRQ_WATCHDOG (PPC_STD_IRQ_LAST+3) /*0x01020- Watchdog timer    */
641#define PPC_IRQ_DEBUG    (PPC_STD_IRQ_LAST+4) /*0x02000- Debug exceptions  */
642#define PPC_IRQ_LAST     PPC_IRQ_DEBUG
643
644#elif defined(mpc505) || defined(mpc509)
645#define PPC_IRQ_SOFTEMU   (PPC_STD_IRQ_LAST+1)    /* Software emulation. */
646#define PPC_IRQ_DATA_BP   (PPC_STD_IRQ_LAST+ 2)
647#define PPC_IRQ_INST_BP   (PPC_STD_IRQ_LAST+ 3)
648#define PPC_IRQ_MEXT_BP   (PPC_STD_IRQ_LAST+ 4)
649#define PPC_IRQ_NMEXT_BP  (PPC_STD_IRQ_LAST+ 5)
650
651#elif defined(ppc601)
652#define PPC_IRQ_TRACE    (PPC_STD_IRQ_LAST+1) /*0x02000-Run/Trace Exception*/
653#define PPC_IRQ_LAST     PPC_IRQ_TRACE       
654
655#elif defined(ppc602)
656#define PPC_IRQ_LAST     (PPC_STD_IRQ_LAST)
657
658#elif defined(ppc603)
659#define PPC_IRQ_TRANS_MISS (PPC_STD_IRQ_LAST+1) /*0x1000-Ins Translation Miss*/
660#define PPC_IRQ_DATA_LOAD  (PPC_STD_IRQ_LAST+2) /*0x1100-Data Load Trans Miss*/
661#define PPC_IRQ_DATA_STORE (PPC_STD_IRQ_LAST+3) /*0x1200-Data Store Miss     */
662#define PPC_IRQ_ADDR_BRK   (PPC_STD_IRQ_LAST+4) /*0x1300-Instruction Bkpoint */
663#define PPC_IRQ_SYS_MGT    (PPC_STD_IRQ_LAST+5) /*0x1400-System Management   */
664#define PPC_IRQ_LAST       PPC_IRQ_SYS_MGT   
665
666#elif defined(ppc603e)
667#define PPC_TLB_INST_MISS  (PPC_STD_IRQ_LAST+1) /*0x1000-Instruction TLB Miss*/
668#define PPC_TLB_LOAD_MISS  (PPC_STD_IRQ_LAST+2) /*0x1100-TLB miss on load  */
669#define PPC_TLB_STORE_MISS (PPC_STD_IRQ_LAST+3) /*0x1200-TLB Miss on store */
670#define PPC_IRQ_ADDRBRK    (PPC_STD_IRQ_LAST+4) /*0x1300-Instruct addr break */
671#define PPC_IRQ_SYS_MGT    (PPC_STD_IRQ_LAST+5) /*0x1400-System Management   */
672#define PPC_IRQ_LAST       PPC_IRQ_SYS_MGT   
673
674
675#elif defined(mpc604)
676#define PPC_IRQ_ADDR_BRK (PPC_STD_IRQ_LAST+1) /*0x1300- Inst. addr break  */
677#define PPC_IRQ_SYS_MGT  (PPC_STD_IRQ_LAST+2) /*0x1400- System Management */
678#define PPC_IRQ_LAST     PPC_IRQ_SYS_MGT 
679
680#elif defined(mpc860) || defined(mpc821)
681#define PPC_IRQ_EMULATE         (PPC_STD_IRQ_LAST+1) /*0x1000-Software emulation  */
682#define PPC_IRQ_INST_MISS       (PPC_STD_IRQ_LAST+2) /*0x1100-Instruction TLB miss*/
683#define PPC_IRQ_DATA_MISS       (PPC_STD_IRQ_LAST+3) /*0x1200-Data TLB miss */
684#define PPC_IRQ_INST_ERR        (PPC_STD_IRQ_LAST+4) /*0x1300-Instruction TLB err */
685#define PPC_IRQ_DATA_ERR        (PPC_STD_IRQ_LAST+5) /*0x1400-Data TLB error */
686#define PPC_IRQ_DATA_BPNT       (PPC_STD_IRQ_LAST+6) /*0x1C00-Data breakpoint */
687#define PPC_IRQ_INST_BPNT       (PPC_STD_IRQ_LAST+7) /*0x1D00-Inst breakpoint */
688#define PPC_IRQ_IO_BPNT         (PPC_STD_IRQ_LAST+8) /*0x1E00-Peripheral breakpnt */
689#define PPC_IRQ_DEV_PORT        (PPC_STD_IRQ_LAST+9) /*0x1F00-Development port */
690#define PPC_IRQ_IRQ0            (PPC_STD_IRQ_LAST + 10)
691#define PPC_IRQ_LVL0            (PPC_STD_IRQ_LAST + 11)
692#define PPC_IRQ_IRQ1            (PPC_STD_IRQ_LAST + 12)
693#define PPC_IRQ_LVL1            (PPC_STD_IRQ_LAST + 13)
694#define PPC_IRQ_IRQ2            (PPC_STD_IRQ_LAST + 14)
695#define PPC_IRQ_LVL2            (PPC_STD_IRQ_LAST + 15)
696#define PPC_IRQ_IRQ3            (PPC_STD_IRQ_LAST + 16)
697#define PPC_IRQ_LVL3            (PPC_STD_IRQ_LAST + 17)
698#define PPC_IRQ_IRQ4            (PPC_STD_IRQ_LAST + 18)
699#define PPC_IRQ_LVL4            (PPC_STD_IRQ_LAST + 19)
700#define PPC_IRQ_IRQ5            (PPC_STD_IRQ_LAST + 20)
701#define PPC_IRQ_LVL5            (PPC_STD_IRQ_LAST + 21)
702#define PPC_IRQ_IRQ6            (PPC_STD_IRQ_LAST + 22)
703#define PPC_IRQ_LVL6            (PPC_STD_IRQ_LAST + 23)
704#define PPC_IRQ_IRQ7            (PPC_STD_IRQ_LAST + 24)
705#define PPC_IRQ_LVL7            (PPC_STD_IRQ_LAST + 25)
706#define PPC_IRQ_CPM_ERROR       (PPC_STD_IRQ_LAST + 26)
707#define PPC_IRQ_CPM_PC4         (PPC_STD_IRQ_LAST + 27)
708#define PPC_IRQ_CPM_PC5         (PPC_STD_IRQ_LAST + 28)
709#define PPC_IRQ_CPM_SMC2        (PPC_STD_IRQ_LAST + 29)
710#define PPC_IRQ_CPM_SMC1        (PPC_STD_IRQ_LAST + 30)
711#define PPC_IRQ_CPM_SPI         (PPC_STD_IRQ_LAST + 31)
712#define PPC_IRQ_CPM_PC6         (PPC_STD_IRQ_LAST + 32)
713#define PPC_IRQ_CPM_TIMER4      (PPC_STD_IRQ_LAST + 33)
714#define PPC_IRQ_CPM_RESERVED_8  (PPC_STD_IRQ_LAST + 34)
715#define PPC_IRQ_CPM_PC7         (PPC_STD_IRQ_LAST + 35)
716#define PPC_IRQ_CPM_PC8         (PPC_STD_IRQ_LAST + 36)
717#define PPC_IRQ_CPM_PC9         (PPC_STD_IRQ_LAST + 37)
718#define PPC_IRQ_CPM_TIMER3      (PPC_STD_IRQ_LAST + 38)
719#define PPC_IRQ_CPM_RESERVED_D  (PPC_STD_IRQ_LAST + 39)
720#define PPC_IRQ_CPM_PC10        (PPC_STD_IRQ_LAST + 40)
721#define PPC_IRQ_CPM_PC11        (PPC_STD_IRQ_LAST + 41)
722#define PPC_IRQ_CPM_I2C         (PPC_STD_IRQ_LAST + 42)
723#define PPC_IRQ_CPM_RISC_TIMER  (PPC_STD_IRQ_LAST + 43)
724#define PPC_IRQ_CPM_TIMER2      (PPC_STD_IRQ_LAST + 44)
725#define PPC_IRQ_CPM_RESERVED_13 (PPC_STD_IRQ_LAST + 45)
726#define PPC_IRQ_CPM_IDMA2       (PPC_STD_IRQ_LAST + 46)
727#define PPC_IRQ_CPM_IDMA1       (PPC_STD_IRQ_LAST + 47)
728#define PPC_IRQ_CPM_SDMA_ERROR  (PPC_STD_IRQ_LAST + 48)
729#define PPC_IRQ_CPM_PC12        (PPC_STD_IRQ_LAST + 49)
730#define PPC_IRQ_CPM_PC13        (PPC_STD_IRQ_LAST + 50)
731#define PPC_IRQ_CPM_TIMER1      (PPC_STD_IRQ_LAST + 51)
732#define PPC_IRQ_CPM_PC14        (PPC_STD_IRQ_LAST + 52)
733#define PPC_IRQ_CPM_SCC4        (PPC_STD_IRQ_LAST + 53)
734#define PPC_IRQ_CPM_SCC3        (PPC_STD_IRQ_LAST + 54)
735#define PPC_IRQ_CPM_SCC2        (PPC_STD_IRQ_LAST + 55)
736#define PPC_IRQ_CPM_SCC1        (PPC_STD_IRQ_LAST + 56)
737#define PPC_IRQ_CPM_PC15        (PPC_STD_IRQ_LAST + 57)
738
739#define PPC_IRQ_LAST             PPC_IRQ_CPM_PC15
740
741#endif
742
743/*
744 *  If the maximum number of exception sources is too low,
745 *  then fix it
746 */
747
748#if PPC_INTERRUPT_MAX <= PPC_IRQ_LAST
749#undef PPC_INTERRUPT_MAX
750#define PPC_INTERRUPT_MAX ((PPC_IRQ_LAST) + 1)
751#endif
752
753/*
754 *  Machine Status Register (MSR) Constants Used by RTEMS
755 */
756
757/*
758 *  Some PPC model manuals refer to the Exception Prefix (EP) bit as
759 *  IP for no apparent reason.
760 */
761
762#define PPC_MSR_RI       0x000000002 /* bit 30 - recoverable exception */
763#define PPC_MSR_DR       0x000000010 /* bit 27 - data address translation */
764#define PPC_MSR_IR       0x000000020 /* bit 26 - instruction addr translation*/
765
766#if (PPC_HAS_EXCEPTION_PREFIX)
767#define PPC_MSR_EP       0x000000040 /* bit 25 - exception prefix */
768#else
769#define PPC_MSR_EP       0x000000000 /* bit 25 - exception prefix */
770#endif
771
772#if (PPC_HAS_FPU)
773#define PPC_MSR_FP       0x000002000 /* bit 18 - floating point enable */
774#else
775#define PPC_MSR_FP       0x000000000 /* bit 18 - floating point enable */
776#endif
777
778#if (PPC_LOW_POWER_MODE == PPC_LOW_POWER_MODE_NONE)
779#define PPC_MSR_POW      0x000000000 /* bit 13 - power management enable */
780#else
781#define PPC_MSR_POW      0x000040000 /* bit 13 - power management enable */
782#endif
783
784/*
785 *  Interrupt/exception MSR bits set as defined on p. 2-20 in "The Programming
786 *  Environments" and the manuals for various PPC models.
787 */
788
789#if (PPC_DEBUG_MODEL == PPC_DEBUG_MODEL_STANDARD)
790#define PPC_MSR_DE       0x000000000 /* bit 22 - debug exception enable */
791#define PPC_MSR_BE       0x000000200 /* bit 22 - branch trace enable */
792#define PPC_MSR_SE       0x000000400 /* bit 21 - single step trace enable */
793#elif (PPC_DEBUG_MODEL == PPC_DEBUG_MODEL_SINGLE_STEP_ONLY)
794#define PPC_MSR_DE       0x000000000 /* bit 22 - debug exception enable */
795#define PPC_MSR_BE       0x000000200 /* bit 22 - branch trace enable */
796#define PPC_MSR_SE       0x000000000 /* bit 21 - single step trace enable */
797#elif (PPC_DEBUG_MODEL == PPC_DEBUG_MODEL_IBM4xx)
798#define PPC_MSR_DE       0x000000200 /* bit 22 - debug exception enable */
799#define PPC_MSR_BE       0x000000000 /* bit 22 - branch trace enable */
800#define PPC_MSR_SE       0x000000000 /* bit 21 - single step trace enable */
801#else
802#error "MSR constants -- unknown PPC_DEBUG_MODEL!!"
803#endif
804
805#define PPC_MSR_ME       0x000001000 /* bit 19 - machine check enable */
806#define PPC_MSR_EE       0x000008000 /* bit 16 - external interrupt enable */
807
808#if (PPC_HAS_RFCI)
809#define PPC_MSR_CE       0x000020000 /* bit 14 - critical interrupt enable */
810#else
811#define PPC_MSR_CE       0x000000000 /* bit 14 - critical interrupt enable */
812#endif
813
814#define PPC_MSR_DISABLE_MASK (PPC_MSR_ME|PPC_MSR_EE|PPC_MSR_CE)
815
816/*
817 *  Initial value for the FPSCR register
818 */
819
820#define PPC_INIT_FPSCR          0x000000f8
821
822#ifdef __cplusplus
823}
824#endif
825
826#endif /* ! _INCLUDE_PPC_h */
827/* end of include file */
828
829
Note: See TracBrowser for help on using the repository browser.