summaryrefslogtreecommitdiffstats
path: root/c/src/exec/score/cpu/powerpc/ppc.h
blob: 76f3129c2e0240afe792ff99bd020a59e9baad06 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
/*  ppc.h
 *
 *  This file contains definitions for the IBM/Motorola PowerPC
 *  family members.
 *
 *  Author:	Andrew Bray <andy@i-cubed.demon.co.uk>
 *
 *  COPYRIGHT (c) 1995 by i-cubed ltd.
 *
 *  To anyone who acknowledges that this file is provided "AS IS"
 *  without any express or implied warranty:
 *      permission to use, copy, modify, and distribute this file
 *      for any purpose is hereby granted without fee, provided that
 *      the above copyright notice and this notice appears in all
 *      copies, and that the name of i-cubed limited not be used in
 *      advertising or publicity pertaining to distribution of the
 *      software without specific, written prior permission.
 *      i-cubed limited makes no representations about the suitability
 *      of this software for any purpose.
 *
 *  Derived from c/src/exec/cpu/no_cpu/no_cpu.h:
 *
 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  This material may be reproduced by or for the U.S. Government pursuant
 *  to the copyright license under the clause at DFARS 252.227-7013.  This
 *  notice must appear in all copies of this file and its derivatives.
 *
 *
 * Note:
 *      This file is included by both C and assembler code ( -DASM )
 *
 */

#ifndef _INCLUDE_PPC_h
#define _INCLUDE_PPC_h

#ifdef __cplusplus
extern "C" {
#endif

/*
 *  The following define the CPU Family and Model within the family
 *
 *  NOTE: The string "REPLACE_THIS_WITH_THE_CPU_MODEL" is replaced
 *        with the name of the appropriate macro for this target CPU.
 */
 
#ifdef ppc
#undef ppc
#endif
#define ppc

#ifdef REPLACE_THIS_WITH_THE_CPU_MODEL
#undef REPLACE_THIS_WITH_THE_CPU_MODEL
#endif
#define REPLACE_THIS_WITH_THE_CPU_MODEL
 
#ifdef REPLACE_THIS_WITH_THE_BSP
#undef REPLACE_THIS_WITH_THE_BSP
#endif
#define REPLACE_THIS_WITH_THE_BSP

/*
 *  This file contains the information required to build
 *  RTEMS for a particular member of the "no cpu"
 *  family when executing in protected mode.  It does
 *  this by setting variables to indicate which implementation
 *  dependent features are present in a particular member
 *  of the family.
 */
 
#if defined(ppc403)
 
#define RTEMS_MODEL_NAME  "PowerPC 403"

#define PPC_ALIGNMENT		4
#define PPC_CACHE_ALIGNMENT	16
#define PPC_CACHE_ALIGN_POWER	4
#define PPC_INTERRUPT_MAX	16
#define PPC_HAS_FPU     	0
#define PPC_HAS_DOUBLE		0
#define PPC_HAS_RFCI		1
#define PPC_MSR_DISABLE_MASK	0x00029200
#define PPC_MSR_INITIAL		0x00000000
#define PPC_INIT_FPSCR		0x00000000
#define PPC_USE_MULTIPLE	1
#define PPC_I_CACHE		2048
#define PPC_D_CACHE		1024

#define PPC_MSR_0		0x00029200
#define PPC_MSR_1		0x00021200
#define PPC_MSR_2		0x00001000
#define PPC_MSR_3		0x00000000

#elif defined(ppc601)
 
#define RTEMS_MODEL_NAME  "PowerPC 601"

#define PPC_ALIGNMENT		8
#define PPC_CACHE_ALIGNMENT	32
#define PPC_CACHE_ALIGN_POWER	5
#define PPC_INTERRUPT_MAX	16
#define PPC_HAS_FPU     	1
#define PPC_HAS_DOUBLE		1
#define PPC_HAS_RFCI		0
#define PPC_MSR_DISABLE_MASK	0x00009900
#define PPC_MSR_INITIAL		0x00002000
#define PPC_INIT_FPSCR		0x000000f8
#define PPC_USE_MULTIPLE	1
#define PPC_I_CACHE		0
#define PPC_D_CACHE		32768

#define PPC_MSR_0		0x00009900
#define PPC_MSR_1		0x00001000
#define PPC_MSR_2		0x00001000
#define PPC_MSR_3		0x00000000
 
#elif defined(ppc602)
 
#define RTEMS_MODEL_NAME  "PowerPC 602"

#define PPC_ALIGNMENT		4
#define PPC_CACHE_ALIGNMENT	32
#define PPC_CACHE_ALIGN_POWER	5
#define PPC_INTERRUPT_MAX	16
#define PPC_HAS_FPU     	1
#define PPC_HAS_DOUBLE		0
#define PPC_HAS_RFCI		0
#define PPC_MSR_DISABLE_MASK	
#define PPC_MSR_INITIAL		
#define PPC_INIT_FPSCR		
#define PPC_USE_MULTIPLE	0
#define PPC_I_CACHE		4096
#define PPC_D_CACHE		4096

#elif defined(ppc603)
 
#define RTEMS_MODEL_NAME  "PowerPC 603"

#define PPC_ALIGNMENT		8
#define PPC_CACHE_ALIGNMENT	32
#define PPC_CACHE_ALIGN_POWER	5
#define PPC_INTERRUPT_MAX	16
#define PPC_HAS_FPU     	1
#define PPC_HAS_DOUBLE		1
#define PPC_HAS_RFCI		0
#define PPC_MSR_DISABLE_MASK	0x00009900
#define PPC_MSR_INITIAL		0x00002000
#define PPC_INIT_FPSCR		0x000000f8
#define PPC_USE_MULTIPLE	0
#define PPC_I_CACHE		8192
#define PPC_D_CACHE		8192

#define PPC_MSR_0		0x00009900
#define PPC_MSR_1		0x00001000
#define PPC_MSR_2		0x00001000
#define PPC_MSR_3		0x00000000

#elif defined(ppc603e)
 
#define RTEMS_MODEL_NAME  "PowerPC 603e"

#define PPC_ALIGNMENT		8
#define PPC_CACHE_ALIGNMENT	32
#define PPC_CACHE_ALIGN_POWER	5
#define PPC_INTERRUPT_MAX	16
#define PPC_HAS_FPU     	1
#define PPC_HAS_DOUBLE		1
#define PPC_HAS_RFCI		0
#define PPC_MSR_DISABLE_MASK	0x00009900
#define PPC_MSR_INITIAL		0x00002000
#define PPC_INIT_FPSCR		0x000000f8
#define PPC_USE_MULTIPLE	0
#define PPC_I_CACHE		16384
#define PPC_D_CACHE		16384

#define PPC_MSR_0		0x00009900
#define PPC_MSR_1		0x00001000
#define PPC_MSR_2		0x00001000
#define PPC_MSR_3		0x00000000

#elif defined(ppc604)
 
#define RTEMS_MODEL_NAME  "PowerPC 604"

#define PPC_ALIGNMENT		8
#define PPC_CACHE_ALIGNMENT	32
#define PPC_CACHE_ALIGN_POWER	5
#define PPC_INTERRUPT_MAX	16
#define PPC_HAS_FPU     	1
#define PPC_HAS_DOUBLE		1
#define PPC_HAS_RFCI		0
#define PPC_MSR_DISABLE_MASK	0x00009900
#define PPC_MSR_INITIAL		0x00002000
#define PPC_INIT_FPSCR		0x000000f8
#define PPC_USE_MULTIPLE	0
#define PPC_I_CACHE		16384
#define PPC_D_CACHE		16384
 
#define PPC_MSR_0		0x00009900
#define PPC_MSR_1		0x00001000
#define PPC_MSR_2		0x00001000
#define PPC_MSR_3		0x00000000

#else
 
#error "Unsupported CPU Model"
 
#endif

/*
 *  Application binary interfaces.
 *  PPC_ABI MUST be defined as one of these.
 *  Only PPC_ABI_POWEROPEN is currently fully supported.
 *  Only EABI will be supported in the end when
 *  the tools are there.
 *  Only big endian is currently supported.
 */
/*
 *  PowerOpen ABI.  This is Andy's hack of the
 *  PowerOpen ABI to ELF.  ELF rather than a
 *  XCOFF assembler is used.  This may work
 *  if PPC_ASM == PPC_ASM_XCOFF is defined.
 */
#define PPC_ABI_POWEROPEN	0
/*
 *  GCC 2.7.0 munched version of EABI, with
 *  PowerOpen calling convention and stack frames,
 *  but EABI style indirect function calls.
 */
#define PPC_ABI_GCC27		1
/*
 *  SVR4 ABI
 */
#define PPC_ABI_SVR4		2
/*
 *  Embedded ABI
 */
#define PPC_ABI_EABI		3

#if (PPC_ABI == PPC_ABI_POWEROPEN)
#define PPC_STACK_ALIGNMENT	8
#elif (PPC_ABI == PPC_ABI_GCC27)
#define PPC_STACK_ALIGNMENT	8
#elif (PPC_ABI == PPC_ABI_SVR4)
#define PPC_STACK_ALIGNMENT	16
#elif (PPC_ABI == PPC_ABI_EABI)
#define PPC_STACK_ALIGNMENT	8
#else
#error  "PPC_ABI is not properly defined"
#endif
#ifndef PPC_ABI
#error  "PPC_ABI is not properly defined"
#endif

/*
 *  Assemblers.
 *  PPC_ASM MUST be defined as one of these.
 *  Only PPC_ABI_ELF is currently fully supported.
 */
/*
 *  ELF assembler. Currently used for all ABIs.
 */
#define PPC_ASM_ELF		0
/*
 *  XCOFF assembler, may be needed for PowerOpen ABI.
 */
#define PPC_ASM_XCOFF		1

/*
 *  Define the name of the CPU family.
 */

#define CPU_NAME "PowerPC"

/*
 *  Interrupt vectors.
 */
/* Machine check */
#define PPC_IRQ_MCHECK		0
/* Protection violation */
#define PPC_IRQ_PROTECT		1
/* External interrupt */
#define PPC_IRQ_EXTERNAL	2
/* Program exception */
#define PPC_IRQ_PROGRAM		3
/* System call */
#define PPC_IRQ_SCALL		4
/* Floating point unavailable */
#define PPC_IRQ_NOFP		5
/* Program interval timer */
#define PPC_IRQ_PIT		6
/* Fixed interval timer */
#define PPC_IRQ_FIT		7
/* Critical interrupt pin */
#define PPC_IRQ_CRIT		8
/* Watchdog timer */
#define PPC_IRQ_WATCHDOG	9
/* Debug exceptions */
#define PPC_IRQ_DEBUG		10

/*
 *  The following exceptions are not maskable, and are not
 *  necessarily predictable, so cannot be offered to RTEMS:
 *    Alignment exception - handled by the CPU module
 *    Data exceptions.
 *    Instruction exceptions.
 */

#ifdef __cplusplus
}
#endif

#endif /* ! _INCLUDE_PPC_h */
/* end of include file */