RTEMS CPU Kit with SuperCore  4.11.3
registers.h
Go to the documentation of this file.
1 
9 /*
10  * COPYRIGHT (C) 1999 Eric Valette (valette@crf.canon.fr)
11  * Canon Centre Recherche France.
12  *
13  * Added MPC8260 Andy Dachs <a.dachs@sstl.co.uk>
14  * Surrey Satellite Technology Limited
15  *
16  *
17  * The license and distribution terms for this file may be
18  * found in the file LICENSE in this distribution or at
19  * http://www.rtems.org/license/LICENSE.
20  */
21 
22 #ifndef _RTEMS_POWERPC_REGISTERS_H
23 #define _RTEMS_POWERPC_REGISTERS_H
24 
25 /* Bit encodings for Machine State Register (MSR) */
26 #define MSR_UCLE (1<<26) /* User-mode cache lock enable (e500) */
27 #define MSR_VE (1<<25) /* Alti-Vec enable (7400+) */
28 #define MSR_SPE (1<<25) /* SPE enable (e500) */
29 #define MSR_AP (1<<25) /* Auxiliary processor available */
30 #define MSR_APE (1<<19) /* APU exception enable */
31 #define MSR_POW (1<<18) /* Enable Power Management */
32 #define MSR_WE (1<<18) /* Wait state enable (e500, 4xx) */
33 #define MSR_TGPR (1<<17) /* TLB Update registers in use */
34 #define MSR_CE (1<<17) /* BookE critical interrupt */
35 #define MSR_ILE (1<<16) /* Interrupt Little-Endian enable */
36 #define MSR_EE (1<<15) /* External Interrupt enable */
37 #define MSR_PR (1<<14) /* Supervisor/User privilege */
38 #define MSR_FP (1<<13) /* Floating Point enable */
39 #define MSR_ME (1<<12) /* Machine Check enable */
40 #define MSR_FE0 (1<<11) /* Floating Exception mode 0 */
41 #define MSR_SE (1<<10) /* Single Step */
42 #define MSR_UBLE (1<<10) /* User-mode BTB lock enable (e500) */
43 #define MSR_DWE (1<<10) /* Debug wait enable (4xx) */
44 #define MSR_BE (1<<9) /* Branch Trace */
45 #define MSR_DE (1<<9) /* BookE debug exception */
46 #define MSR_FE1 (1<<8) /* Floating Exception mode 1 */
47 #define MSR_E300_CE (1<<7) /* e300 critical interrupt */
48 #define MSR_IP (1<<6) /* Exception prefix 0x000/0xFFF */
49 #define MSR_IR (1<<5) /* Instruction MMU enable */
50 #define MSR_DR (1<<4) /* Data MMU enable */
51 #define MSR_IS (1<<5) /* Instruction address space */
52 #define MSR_DS (1<<4) /* Data address space */
53 #define MSR_PMM (1<<2) /* Performance monitor mark */
54 #define MSR_RI (1<<1) /* Recoverable Exception */
55 #define MSR_LE (1<<0) /* Little-Endian enable */
56 
57 /* Bit encodings for Hardware Implementation Register (HID0)
58  on PowerPC 603, 604, etc. processors (not 601). */
59 
60 /* WARNING: HID0/HID1 are *truely* implementation dependent!
61  * you *cannot* rely on the same bits to be present,
62  * at the same place or even in the same register
63  * on different CPU familys.
64  * E.g., EMCP isHID0_DOZE is HID0_HI_BAT_EN on the
65  * on the 7450s. IFFT is XBSEN on 7450 and so on...
66  */
67 #define HID0_EMCP (1<<31) /* Enable Machine Check pin */
68 #define HID0_EBA (1<<29) /* Enable Bus Address Parity */
69 #define HID0_EBD (1<<28) /* Enable Bus Data Parity */
70 #define HID0_SBCLK (1<<27)
71 #define HID0_TBEN (1<<26) /* 7455:this bit must be set
72  * and TBEN signal must be asserted
73  * to enable the time base and
74  * decrementer.
75  */
76 #define HID0_EICE (1<<26)
77 #define HID0_ECLK (1<<25)
78 #define HID0_PAR (1<<24)
79 #define HID0_DOZE (1<<23)
80 /* this HI_BAT_EN only on 7445, 7447, 7448, 7455 & 7457 !! */
81 #define HID0_7455_HIGH_BAT_EN (1<<23)
82 
83 #define HID0_NAP (1<<22)
84 #define HID0_SLEEP (1<<21)
85 #define HID0_DPM (1<<20)
86 #define HID0_ICE (1<<15) /* Instruction Cache Enable */
87 #define HID0_DCE (1<<14) /* Data Cache Enable */
88 #define HID0_ILOCK (1<<13) /* Instruction Cache Lock */
89 #define HID0_DLOCK (1<<12) /* Data Cache Lock */
90 #define HID0_ICFI (1<<11) /* Instruction Cache Flash Invalidate */
91 #define HID0_DCI (1<<10) /* Data Cache Invalidate */
92 /* this bit is XSBSEN (xtended block size enable) on 7447, 7448, 7455 and 7457 only */
93 #define HID0_7455_XBSEN (1<<8)
94 #define HID0_SIED (1<<7) /* Serial Instruction Execution [Disable] */
95 #define HID0_BTIC (1<<5) /* Branch Target Instruction Cache [Enable] */
96 /* S.K. Feng 10/03, added for MPC7455 */
97 #define HID0_LRSTK (1<<4) /* Link register stack enable (7455) */
98 #define HID0_FOLD (1<<3) /* Branch folding enable (7455) */
99 
100 #define HID0_BHTE (1<<2) /* Branch History Table Enable */
101 #define HID0_BTCD (1<<1) /* Branch target cache disable */
102 
103 /* fpscr settings */
104 #define FPSCR_FX (1<<31)
105 #define FPSCR_FEX (1<<30)
106 
107 #define _MACH_prep 1
108 #define _MACH_Pmac 2 /* pmac or pmac clone (non-chrp) */
109 #define _MACH_chrp 4 /* chrp machine */
110 #define _MACH_mbx 8 /* Motorola MBX board */
111 #define _MACH_apus 16 /* amiga with phase5 powerup */
112 #define _MACH_fads 32 /* Motorola FADS board */
113 
114 /* see residual.h for these */
115 #define _PREP_Motorola 0x01 /* motorola prep */
116 #define _PREP_Firm 0x02 /* firmworks prep */
117 #define _PREP_IBM 0x00 /* ibm prep */
118 #define _PREP_Bull 0x03 /* bull prep */
119 
120 /* these are arbitrary */
121 #define _CHRP_Motorola 0x04 /* motorola chrp, the cobra */
122 #define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */
123 
124 #define _GLOBAL(n)\
125  .globl n;\
126 n:
127 
128 #define TBRU 269 /* Time base Upper/Lower (Reading) */
129 #define TBRL 268
130 #define TBWU 285 /* Time base Upper/Lower (Writing) */
131 #define TBWL 284
132 #define PPC_XER 1
133 #define PPC_LR 8
134 #define PPC_CTR 9
135 #define HID0 1008 /* Hardware Implementation 0 */
136 #define HID1 1009 /* Hardware Implementation 1 */
137 #define HID2 1011 /* Hardware Implementation 2 */
138 #define DABR 1013 /* Data Access Breakpoint */
139 #define PPC_PVR 287 /* Processor Version */
140 #define IBAT0U 528 /* Instruction BAT #0 Upper/Lower */
141 #define IBAT0L 529
142 #define IBAT1U 530 /* Instruction BAT #1 Upper/Lower */
143 #define IBAT1L 531
144 #define IBAT2U 532 /* Instruction BAT #2 Upper/Lower */
145 #define IBAT2L 533
146 #define IBAT3U 534 /* Instruction BAT #3 Upper/Lower */
147 #define IBAT3L 535
148 
149 /* Only present on 7445, 7447, 7448, 7455 and 7457 (if HID0[HIGH_BAT_EN]) */
150 #define IBAT4U 560 /* Instruction BAT #4 Upper/Lower */
151 #define IBAT4L 561
152 #define IBAT5U 562 /* Instruction BAT #5 Upper/Lower */
153 #define IBAT5L 563
154 #define IBAT6U 564 /* Instruction BAT #6 Upper/Lower */
155 #define IBAT6L 565
156 #define IBAT7U 566 /* Instruction BAT #7 Upper/Lower */
157 #define IBAT7L 567
158 
159 #define DBAT0U 536 /* Data BAT #0 Upper/Lower */
160 #define DBAT0L 537
161 #define DBAT1U 538 /* Data BAT #1 Upper/Lower */
162 #define DBAT1L 539
163 #define DBAT2U 540 /* Data BAT #2 Upper/Lower */
164 #define DBAT2L 541
165 #define DBAT3U 542 /* Data BAT #3 Upper/Lower */
166 #define DBAT3L 543
167 
168 /* Only present on 7445, 7447, 7448, 7455 and 7457 (if HID0[HIGH_BAT_EN]) */
169 #define DBAT4U 568 /* Instruction BAT #4 Upper/Lower */
170 #define DBAT4L 569
171 #define DBAT5U 570 /* Instruction BAT #5 Upper/Lower */
172 #define DBAT5L 571
173 #define DBAT6U 572 /* Instruction BAT #6 Upper/Lower */
174 #define DBAT6L 573
175 #define DBAT7U 574 /* Instruction BAT #7 Upper/Lower */
176 #define DBAT7L 575
177 
178 #define DMISS 976 /* TLB Lookup/Refresh registers */
179 #define DCMP 977
180 #define HASH1 978
181 #define HASH2 979
182 #define IMISS 980
183 #define ICMP 981
184 #define PPC_RPA 982
185 #define SDR1 25 /* MMU hash base register */
186 #define PPC_DAR 19 /* Data Address Register */
187 #define DEAR_BOOKE 61
188 #define DEAR_405 981
189 #define SPR0 272 /* Supervisor Private Registers */
190 #define SPRG0 272
191 #define SPR1 273
192 #define SPRG1 273
193 #define SPR2 274
194 #define SPRG2 274
195 #define SPR3 275
196 #define SPRG3 275
197 #define SPRG4 276
198 #define SPRG5 277
199 #define SPRG6 278
200 #define SPRG7 279
201 #define USPRG0 256
202 #define DSISR 18
203 #define SRR0 26 /* Saved Registers (exception) */
204 #define SRR1 27
205 #define IABR 1010 /* Instruction Address Breakpoint */
206 #define PPC_DEC 22 /* Decrementer */
207 #define PPC_EAR 282 /* External Address Register */
208 
209 #define MSSCR0 1014 /* Memory Subsystem Control Register */
210 
211 #define L2CR 1017 /* PPC 750 and 74xx L2 control register */
212 
213 #define L2CR_L2E (1<<31) /* enable */
214 #define L2CR_L2I (1<<21) /* global invalidate */
215 
216 /* watch out L2IO and L2DO are different between 745x and 7400/7410 */
217 /* Oddly, the following L2CR bit defintions in 745x
218  * is different from that of 7400 and 7410.
219  * Though not used in 7400 and 7410, it is appeded with _745x just
220  * to be clarified.
221  */
222 #define L2CR_L2IO_745x 0x100000 /* (1<<20) L2 Instruction-Only */
223 #define L2CR_L2DO_745x 0x10000 /* (1<<16) L2 Data-Only */
224 #define L2CR_LOCK_745x (L2CR_L2IO_745x|L2CR_L2DO_745x)
225 #define L2CR_L3OH0 0x00080000 /* 12:L3 output hold 0 */
226 
227 #define L3CR 1018 /* PPC 7450/7455 L3 control register */
228 #define L3CR_L3IO_745x 0x400000 /* (1<<22) L3 Instruction-Only */
229 #define L3CR_L3DO_745x 0x40 /* (1<<6) L3 Data-Only */
230 
231 #define L3CR_LOCK_745x (L3CR_L3IO_745x|L3CR_L3DO_745x)
232 
233 #define L3CR_RESERVED 0x0438003a /* Reserved bits in L3CR */
234 #define L3CR_L3E 0x80000000 /* 0: L3 enable */
235 #define L3CR_L3PE 0x40000000 /* 1: L3 data parity checking enable */
236 #define L3CR_L3APE 0x20000000 /* 2: L3 address parity checking enable */
237 #define L3CR_L3SIZ 0x10000000 /* 3: L3 size (0=1MB, 1=2MB) */
238 #define L3SIZ_1M 0x00000000
239 #define L3SIZ_2M 0x10000000
240 #define L3CR_L3CLKEN 0x08000000 /* 4: Enables the L3_CLK[0:1] signals */
241 #define L3CR_L3CLK 0x03800000 /* 6-8: L3 clock ratio */
242 #define L3CLK_60 0x00000000 /* core clock / 6 */
243 #define L3CLK_20 0x01000000 /* / 2 */
244 #define L3CLK_25 0x01800000 /* / 2.5 */
245 #define L3CLK_30 0x02000000 /* / 3 */
246 #define L3CLK_35 0x02800000 /* / 3.5 */
247 #define L3CLK_40 0x03000000 /* / 4 */
248 #define L3CLK_50 0x03800000 /* / 5 */
249 #define L3CR_L3IO 0x00400000 /* 9: L3 instruction-only mode */
250 #define L3CR_L3SPO 0x00040000 /* 13: L3 sample point override */
251 #define L3CR_L3CKSP 0x00030000 /* 14-15: L3 clock sample point */
252 #define L3CKSP_2 0x00000000 /* 2 clocks */
253 #define L3CKSP_3 0x00010000 /* 3 clocks */
254 #define L3CKSP_4 0x00020000 /* 4 clocks */
255 #define L3CKSP_5 0x00030000 /* 5 clocks */
256 #define L3CR_L3PSP 0x0000e000 /* 16-18: L3 P-clock sample point */
257 #define L3PSP_0 0x00000000 /* 0 clocks */
258 #define L3PSP_1 0x00002000 /* 1 clocks */
259 #define L3PSP_2 0x00004000 /* 2 clocks */
260 #define L3PSP_3 0x00006000 /* 3 clocks */
261 #define L3PSP_4 0x00008000 /* 4 clocks */
262 #define L3PSP_5 0x0000a000 /* 5 clocks */
263 #define L3CR_L3REP 0x00001000 /* 19: L3 replacement algorithm (0=default, 1=alternate) */
264 #define L3CR_L3HWF 0x00000800 /* 20: L3 hardware flush */
265 #define L3CR_L3I 0x00000400 /* 21: L3 global invaregisters.h.orig
266 lidate */
267 #define L3CR_L3RT 0x00000300 /* 22-23: L3 SRAM type */
268 #define L3RT_MSUG2_DDR 0x00000000 /* MSUG2 DDR SRAM */
269 #define L3RT_PIPELINE_LATE 0x00000100 /* Pipelined (register-register) synchronous late-write SRAM */
270 #define L3RT_PB2_SRAM 0x00000300 /* PB2 SRAM */
271 #define L3CR_L3NIRCA 0x00000080 /* 24: L3 non-integer ratios clock adjustment for the SRAM */
272 #define L3CR_L3DO 0x00000040 /* 25: L3 data-only mode */
273 #define L3CR_PMEN 0x00000004 /* 29: Private memory enable */
274 #define L3CR_PMSIZ 0x00000004 /* 31: Private memory size (0=1MB, 1=2MB) */
275 
276 #define THRM1 1020
277 #define THRM2 1021
278 #define THRM3 1022
279 #define THRM1_TIN (1<<(31-0))
280 #define THRM1_TIV (1<<(31-1))
281 #define THRM1_THRES (0x7f<<(31-8))
282 #define THRM1_TID (1<<(31-29))
283 #define THRM1_TIE (1<<(31-30))
284 #define THRM1_V (1<<(31-31))
285 #define THRM3_SITV (0x1fff << (31-30))
286 #define THRM3_E (1<<(31-31))
287 
288 /* Segment Registers */
289 #define PPC_SR0 0
290 #define PPC_SR1 1
291 #define PPC_SR2 2
292 #define PPC_SR3 3
293 #define PPC_SR4 4
294 #define PPC_SR5 5
295 #define PPC_SR6 6
296 #define PPC_SR7 7
297 #define PPC_SR8 8
298 #define PPC_SR9 9
299 #define PPC_SR10 10
300 #define PPC_SR11 11
301 #define PPC_SR12 12
302 #define PPC_SR13 13
303 #define PPC_SR14 14
304 #define PPC_SR15 15
305 
306 #define BOOKE_DECAR 54
307 
308 #define PPC405_MCSR 0x23C
309 #define PPC405_ESR 0x3D4
310 #define PPC405_DEAR 0x3D5
311 #define BOOKE_DEAR 61
312 
313 #define PPC405_TSR 0x3D8
314 #define BOOKE_TSR 336
315 #define BOOKE_TSR_ENW (1<<31)
316 #define BOOKE_TSR_WIS (1<<30)
317 #define BOOKE_TSR_DIS (1<<27)
318 #define BOOKE_TSR_FIS (1<<26)
319 
320 #define PPC405_TCR 0x3DA
321 #define BOOKE_TCR 340
322 #define BOOKE_TCR_WP(x) (((x)&3)<<30)
323 #define BOOKE_TCR_WP_MASK (3<<30)
324 #define BOOKE_TCR_WRC(x) (((x)&3)<<28)
325 #define BOOKE_TCR_WRC_MASK (3<<28)
326 #define BOOKE_TCR_WIE (1<<27)
327 #define BOOKE_TCR_DIE (1<<26)
328 #define BOOKE_TCR_FP(x) (((x)&3)<<24)
329 #define BOOKE_TCR_FIE (1<<23)
330 #define BOOKE_TCR_ARE (1<<22)
331 #define BOOKE_TCR_WPEXT(x) (((x)&0xf)<<17)
332 #define BOOKE_TCR_WPEXT_MASK (0xf<<17)
333 #define BOOKE_TCR_FPEXT(x) (((x)&0xf)<<13)
334 #define BOOKE_TCR_FPEXT_MASK (0xf<<13)
335 
336 #define BOOKE_PID 48 /* Process ID */
337 #define BOOKE_CSRR0 58 /* Critical Save/Restore Register 0 */
338 #define BOOKE_CSRR1 59 /* Critical Save/Restore Register 1 */
339 #define BOOKE_ESR 62 /* Exception Syndrome Register */
340 #define BOOKE_IVPR 63 /* Interrupt Vector Prefix Register */
341 #define BOOKE_SPRG4_W 260 /* Special Purpose Register General 4 (WO) */
342 #define BOOKE_SPRG5_W 261 /* Special Purpose Register General 5 (WO) */
343 #define BOOKE_SPRG6_W 262 /* Special Purpose Register General 6 (WO) */
344 #define BOOKE_SPRG7_W 263 /* Special Purpose Register General 7 (WO) */
345 #define BOOKE_PIR 286 /* Processor ID Register */
346 #define BOOKE_DBSR 304 /* Debug Status Register */
347 #define BOOKE_DBCR0 308 /* Debug Control Register 0 */
348 #define BOOKE_DBCR1 309 /* Debug Control Register 1 */
349 #define BOOKE_DBCR2 310 /* Debug Control Register 2 */
350 #define BOOKE_IAC1 312 /* Instruction Address Compare 1 */
351 #define BOOKE_IAC2 313 /* Instruction Address Compare 2 */
352 #define BOOKE_IAC3 314 /* Instruction Address Compare 3 */
353 #define BOOKE_IAC4 315 /* Instruction Address Compare 4 */
354 #define BOOKE_DAC1 316 /* Data Address Compare 1 */
355 #define BOOKE_DAC2 317 /* Data Address Compare 2 */
356 #define BOOKE_DVC1 318 /* Data Value Compare 1 */
357 #define BOOKE_DVC2 319 /* Data Value Compare 2 */
358 #define BOOKE_IVOR0 400 /* Interrupt Vector Offset Register 0 */
359 #define BOOKE_IVOR1 401 /* Interrupt Vector Offset Register 1 */
360 #define BOOKE_IVOR2 402 /* Interrupt Vector Offset Register 2 */
361 #define BOOKE_IVOR3 403 /* Interrupt Vector Offset Register 3 */
362 #define BOOKE_IVOR4 404 /* Interrupt Vector Offset Register 4 */
363 #define BOOKE_IVOR5 405 /* Interrupt Vector Offset Register 5 */
364 #define BOOKE_IVOR6 406 /* Interrupt Vector Offset Register 6 */
365 #define BOOKE_IVOR7 407 /* Interrupt Vector Offset Register 7 */
366 #define BOOKE_IVOR8 408 /* Interrupt Vector Offset Register 8 */
367 #define BOOKE_IVOR9 409 /* Interrupt Vector Offset Register 9 */
368 #define BOOKE_IVOR10 410 /* Interrupt Vector Offset Register 10 */
369 #define BOOKE_IVOR11 411 /* Interrupt Vector Offset Register 11 */
370 #define BOOKE_IVOR12 412 /* Interrupt Vector Offset Register 12 */
371 #define BOOKE_IVOR13 413 /* Interrupt Vector Offset Register 13 */
372 #define BOOKE_IVOR14 414 /* Interrupt Vector Offset Register 14 */
373 #define BOOKE_IVOR15 415 /* Interrupt Vector Offset Register 15 */
374 #define BOOKE_MCSRR0 570 /* Machine Check Save/Restore Register 0 */
375 #define BOOKE_MCSRR1 571 /* Machine Check Save/Restore Register 1 */
376 #define BOOKE_MCSR 572 /* Machine Check Status Register */
377 
378 #define PPC440_INV0 880 /* Instruction Cache Normal Victim 0 */
379 #define PPC440_INV1 881 /* Instruction Cache Normal Victim 1 */
380 #define PPC440_INV2 882 /* Instruction Cache Normal Victim 2 */
381 #define PPC440_INV3 883 /* Instruction Cache Normal Victim 3 */
382 #define PPC440_ITV0 884 /* Instruction Cache Transient Victim 0 */
383 #define PPC440_ITV1 885 /* Instruction Cache Transient Victim 1 */
384 #define PPC440_ITV2 886 /* Instruction Cache Transient Victim 2 */
385 #define PPC440_ITV3 887 /* Instruction Cache Transient Victim 3 */
386 #define PPC440_CCR1 888 /* Core Configuration Register 1 */
387 #define PPC440_DNV0 912 /* Data Cache Normal Victim 0 */
388 #define PPC440_DNV1 913 /* Data Cache Normal Victim 1 */
389 #define PPC440_DNV2 914 /* Data Cache Normal Victim 2 */
390 #define PPC440_DNV3 915 /* Data Cache Normal Victim 3 */
391 #define PPC440_DTV0 916 /* Data Cache Transient Victim 0 */
392 #define PPC440_DTV1 917 /* Data Cache Transient Victim 1 */
393 #define PPC440_DTV2 918 /* Data Cache Transient Victim 2 */
394 #define PPC440_DTV3 919 /* Data Cache Transient Victim 3 */
395 #define PPC440_DVLIM 920 /* Data Cache Victim Limit */
396 #define PPC440_IVLIM 921 /* Instruction Cache Victim Limit */
397 #define PPC440_RSTCFG 923 /* Reset Configuration */
398 #define PPC440_DCDBTRL 924 /* Data Cache Debug Tag Register Low */
399 #define PPC440_DCDBTRH 925 /* Data Cache Debug Tag Register High */
400 #define PPC440_ICDBTRL 926 /* Instruction Cache Debug Tag Register Low */
401 #define PPC440_ICDBTRH 927 /* Instruction Cache Debug Tag Register High */
402 #define PPC440_MMUCR 946 /* Memory Management Unit Control Register */
403 #define PPC440_CCR0 947 /* Core Configuration Register 0 */
404 #define PPC440_ICDBDR 979 /* Instruction Cache Debug Data Register */
405 #define PPC440_DBDR 1011 /* Debug Data Register */
406 
407 #define PPC440_TLB0_EPN(n) ( (((1<<22)-1)&(n)) << (31-21)) /* Etended Page Number */
408 #define PPC440_TLB0_EPN_GET(n) ( ((n) >> (31-21)) & ((1<<22)-1))
409 #define PPC440_TLB0_V ( 1 << (31-22)) /* Entry valid */
410 #define PPC440_TLB0_TS ( 1 << (31-23)) /* Translation space */
411 #define PPC440_TLB0_TSIZE(n) ( (0xf & (n)) << (31-27)) /* Page size */
412 #define PPC440_TLB0_TSIZE_GET(n) ( ((n) >> (31-27)) & 0xf)
413 #define PPC440_TLB0_TPAR(n) ( (0xf & (n)) << (31-31)) /* Tag Parity */
414 #define PPC440_TLB0_TPAR_GET(n) ( ((n) >> (31-31)) & 0xf)
415 
416 #define PPC440_PID_TID(n) ( (0xff & (n)) << (31-31)) /* Translation ID */
417 #define PPC440_PID_TID_GET(n) ( ((n) >> (31-31)) & 0xff)
418 
419 #define PPC440_TLB1_RPN(n) ( (((1<<22)-1)&(n)) << (31-21)) /* Real Page Number */
420 #define PPC440_TLB1_RPN_GET(n) ( ((n) >> (31-21)) & ((1<<22)-1))
421 #define PPC440_TLB1_PAR1(n) ( (0x3 & (n)) << (31-23)) /* Parity for TLB word 1 */
422 #define PPC440_TLB1_PAR1_GET(n) ( ((n) >> (31-23)) & 0x3)
423 #define PPC440_TLB1_ERPN(n) ( (0xf & (n)) << (31-31)) /* Extended Real Page No. */
424 #define PPC440_TLB1_ERPN_GET(n) ( ((n) >> (31-31)) & 0xf)
425 
426 #define PPC440_TLB2_PAR2(n) ( (0x3 & (n)) << (31- 1)) /* Parity for TLB word 2 */
427 #define PPC440_TLB2_PAR2_GET(n) ( ((n) >> (31- 1)) & 0x3)
428 #define PPC440_TLB2_U0 ( 1 << (31-16)) /* User attr. 0 */
429 #define PPC440_TLB2_U1 ( 1 << (31-17)) /* User attr. 1 */
430 #define PPC440_TLB2_U2 ( 1 << (31-18)) /* User attr. 2 */
431 #define PPC440_TLB2_U3 ( 1 << (31-19)) /* User attr. 3 */
432 #define PPC440_TLB2_W ( 1 << (31-20)) /* Write-through */
433 #define PPC440_TLB2_I ( 1 << (31-21)) /* Cache-inhibited */
434 #define PPC440_TLB2_M ( 1 << (31-22)) /* Memory-coherence req. */
435 #define PPC440_TLB2_G ( 1 << (31-23)) /* Guarded */
436 #define PPC440_TLB2_E ( 1 << (31-24)) /* Little-endian */
437 #define PPC440_TLB2_UX ( 1 << (31-26)) /* User exec. */
438 #define PPC440_TLB2_UW ( 1 << (31-27)) /* User write */
439 #define PPC440_TLB2_UR ( 1 << (31-28)) /* User read */
440 #define PPC440_TLB2_SX ( 1 << (31-29)) /* Super exec. */
441 #define PPC440_TLB2_SW ( 1 << (31-30)) /* Super write */
442 #define PPC440_TLB2_SR ( 1 << (31-31)) /* Super read */
443 
444 #define PPC440_TLB2_ATTR(x) ( ((x) & 0x1ff) << 7 )
445 #define PPC440_TLB2_ATTR_GET(x) ( ((x) >> 7) & 0x1ff )
446 
447 #define PPC440_TLB2_PERM(n) ( (n) & 0x3f )
448 #define PPC440_TLB2_PERM_GET(n) ( (n) & 0x3f )
449 
450 /* Freescale Book E Implementation Standards (EIS): Branch Operations */
451 
452 #define FSL_EIS_BUCSR 1013
453 #define FSL_EIS_BUCSR_STAC_EN (1 << (63 - 39))
454 #define FSL_EIS_BUCSR_LS_EN (1 << (63 - 41))
455 #define FSL_EIS_BUCSR_BBFI (1 << (63 - 54))
456 #define FSL_EIS_BUCSR_BALLOC_ALL (0x0 << (63 - 59))
457 #define FSL_EIS_BUCSR_BALLOC_FORWARD (0x1 << (63 - 59))
458 #define FSL_EIS_BUCSR_BALLOC_BACKWARD (0x2 << (63 - 59))
459 #define FSL_EIS_BUCSR_BALLOC_NONE (0x3 << (63 - 59))
460 #define FSL_EIS_BUCSR_BPRED_TAKEN (0x0 << (63 - 61))
461 #define FSL_EIS_BUCSR_BPRED_TAKEN_ONLY_FORWARD (0x1 << (63 - 62))
462 #define FSL_EIS_BUCSR_BPRED_TAKEN_ONLY_BACKWARD (0x2 << (63 - 62))
463 #define FSL_EIS_BUCSR_BPRED_NOT_TAKEN (0x3 << (63 - 62))
464 #define FSL_EIS_BUCSR_BPEN (1 << (63 - 63))
465 
466 /* Freescale Book E Implementation Standards (EIS): Hardware Implementation-Dependent Registers */
467 
468 #define FSL_EIS_SVR 1023
469 
470 /* Freescale Book E Implementation Standards (EIS): MMU Control and Status */
471 
472 #define FSL_EIS_MAS0 624
473 #define FSL_EIS_MAS0_TLBSEL (1 << (63 - 35))
474 #define FSL_EIS_MAS0_ESEL(n) ((0xf & (n)) << (63 - 47))
475 #define FSL_EIS_MAS0_ESEL_GET(m) (((m) >> (63 - 47)) & 0xf)
476 #define FSL_EIS_MAS0_NV (1 << (63 - 63))
477 
478 #define FSL_EIS_MAS1 625
479 #define FSL_EIS_MAS1_V (1 << (63 - 32))
480 #define FSL_EIS_MAS1_IPROT (1 << (63 - 33))
481 #define FSL_EIS_MAS1_TID(n) ((0xff & (n)) << (63 - 47))
482 #define FSL_EIS_MAS1_TID_GET(n) (((n) >> (63 - 47)) & 0xfff)
483 #define FSL_EIS_MAS1_TS (1 << (63 - 51))
484 #define FSL_EIS_MAS1_TSIZE(n) ((0xf & (n)) << (63 - 55))
485 #define FSL_EIS_MAS1_TSIZE_GET(n) (((n)>>(63 - 55)) & 0xf)
486 
487 #define FSL_EIS_MAS2 626
488 #define FSL_EIS_MAS2_EPN(n) ((((1 << 21) - 1)&(n)) << (63-51))
489 #define FSL_EIS_MAS2_EPN_GET(n) (((n) >> (63 - 51)) & 0xfffff)
490 #define FSL_EIS_MAS2_EA(n) FSL_EIS_MAS2_EPN((n) >> 12)
491 #define FSL_EIS_MAS2_EA_GET(n) (FSL_EIS_MAS2_EPN_GET(n) << 12)
492 #define FSL_EIS_MAS2_X0 (1 << (63 - 57))
493 #define FSL_EIS_MAS2_X1 (1 << (63 - 58))
494 #define FSL_EIS_MAS2_W (1 << (63 - 59))
495 #define FSL_EIS_MAS2_I (1 << (63 - 60))
496 #define FSL_EIS_MAS2_M (1 << (63 - 61))
497 #define FSL_EIS_MAS2_G (1 << (63 - 62))
498 #define FSL_EIS_MAS2_E (1 << (63 - 63))
499 #define FSL_EIS_MAS2_ATTR(x) ((x) & 0x7f)
500 #define FSL_EIS_MAS2_ATTR_GET(x) ((x) & 0x7f)
501 
502 #define FSL_EIS_MAS3 627
503 #define FSL_EIS_MAS3_RPN(n) ((((1 << 21) - 1) & (n)) << (63-51))
504 #define FSL_EIS_MAS3_RPN_GET(n) (((n)>>(63 - 51)) & 0xfffff)
505 #define FSL_EIS_MAS3_RA(n) FSL_EIS_MAS3_RPN((n) >> 12)
506 #define FSL_EIS_MAS3_RA_GET(n) (FSL_EIS_MAS3_RPN_GET(n) << 12)
507 #define FSL_EIS_MAS3_U0 (1 << (63 - 54))
508 #define FSL_EIS_MAS3_U1 (1 << (63 - 55))
509 #define FSL_EIS_MAS3_U2 (1 << (63 - 56))
510 #define FSL_EIS_MAS3_U3 (1 << (63 - 57))
511 #define FSL_EIS_MAS3_UX (1 << (63 - 58))
512 #define FSL_EIS_MAS3_SX (1 << (63 - 59))
513 #define FSL_EIS_MAS3_UW (1 << (63 - 60))
514 #define FSL_EIS_MAS3_SW (1 << (63 - 61))
515 #define FSL_EIS_MAS3_UR (1 << (63 - 62))
516 #define FSL_EIS_MAS3_SR (1 << (63 - 63))
517 #define FSL_EIS_MAS3_PERM(n) ((n) & 0x3ff)
518 #define FSL_EIS_MAS3_PERM_GET(n) ((n) & 0x3ff)
519 
520 #define FSL_EIS_MAS4 628
521 #define FSL_EIS_MAS4_TLBSELD (1 << (63 - 35))
522 #define FSL_EIS_MAS4_TIDSELD(n) ((0x3 & (n)) << (63 - 47))
523 #define FSL_EIS_MAS4_TSIZED(n) ((0xf & (n)) << (63 - 55))
524 #define FSL_EIS_MAS4_X0D FSL_EIS_MAS2_X0
525 #define FSL_EIS_MAS4_X1D FSL_EIS_MAS2_X1
526 #define FSL_EIS_MAS4_WD FSL_EIS_MAS2_W
527 #define FSL_EIS_MAS4_ID FSL_EIS_MAS2_I
528 #define FSL_EIS_MAS4_MD FSL_EIS_MAS2_M
529 #define FSL_EIS_MAS4_GD FSL_EIS_MAS2_G
530 #define FSL_EIS_MAS4_ED FSL_EIS_MAS2_E
531 
532 #define FSL_EIS_MAS5 629
533 
534 #define FSL_EIS_MAS6 630
535 #define FSL_EIS_MAS6_SPID0(n) ((0xff & (n)) << (63 - 55))
536 #define FSL_EIS_MAS6_SAS (1 << (63 - 63))
537 
538 #define FSL_EIS_MAS7 944
539 
540 #define FSL_EIS_MMUCFG 1015
541 #define FSL_EIS_MMUCSR0 1012
542 #define FSL_EIS_PID0 48
543 #define FSL_EIS_PID1 633
544 #define FSL_EIS_PID2 634
545 #define FSL_EIS_TLB0CFG 688
546 #define FSL_EIS_TLB1CFG 689
547 
548 /* Freescale Book E Implementation Standards (EIS): L1 Cache */
549 
550 #define FSL_EIS_L1CFG0 515
551 #define FSL_EIS_L1CFG1 516
552 #define FSL_EIS_L1CSR0 1010
553 #define FSL_EIS_L1CSR1 1011
554 
555 /* Freescale Book E Implementation Standards (EIS): Timer */
556 
557 #define FSL_EIS_ATBL 526
558 #define FSL_EIS_ATBU 527
559 
560 /* Freescale Book E Implementation Standards (EIS): Interrupt */
561 
562 #define FSL_EIS_MCAR 573
563 #define FSL_EIS_DSRR0 574
564 #define FSL_EIS_DSRR1 575
565 
566 /* Freescale Book E Implementation Standards (EIS): Signal Processing Engine (SPE) */
567 
568 #define FSL_EIS_SPEFSCR 512
569 
570 /* Freescale Book E Implementation Standards (EIS): Software-Use SPRs */
571 
572 #define FSL_EIS_SPRG8 604
573 #define FSL_EIS_SPRG9 605
574 
575 /* Freescale Book E Implementation Standards (EIS): Debug */
576 
577 #define FSL_EIS_DBCR3 561
578 #define FSL_EIS_DBCR4 563
579 #define FSL_EIS_DBCR5 564
580 #define FSL_EIS_DBCR6 603
581 #define FSL_EIS_DBCNT 562
582 
589 #define PPC_INTERRUPT_DISABLE_MASK_DEFAULT MSR_EE
590 
591 #ifndef ASM
592 
593 #include <stdint.h>
594 
595 #ifdef __cplusplus
596 extern "C" {
597 #endif /* __cplusplus */
598 
599 #define _CPU_MSR_GET( _msr_value ) \
600  do { \
601  _msr_value = 0; \
602  __asm__ volatile ("mfmsr %0" : "=&r" ((_msr_value)) : "0" ((_msr_value))); \
603  } while (0)
604 
605 #define _CPU_MSR_SET( _msr_value ) \
606 { __asm__ volatile ("mtmsr %0" : "=&r" ((_msr_value)) : "0" ((_msr_value))); }
607 
613 extern char _PPC_INTERRUPT_DISABLE_MASK[];
614 
615 static inline uint32_t ppc_interrupt_get_disable_mask( void )
616 {
617  return (uint32_t) _PPC_INTERRUPT_DISABLE_MASK;
618 }
619 
620 static inline uint32_t ppc_interrupt_disable( void )
621 {
622  uint32_t level;
623  uint32_t mask;
624 
625  __asm__ volatile (
626  "mfmsr %0;"
627  "lis %1, _PPC_INTERRUPT_DISABLE_MASK@h;"
628  "ori %1, %1, _PPC_INTERRUPT_DISABLE_MASK@l;"
629  "andc %1, %0, %1;"
630  "mtmsr %1"
631  : "=r" (level), "=r" (mask)
632  );
633 
634  return level;
635 }
636 
637 static inline void ppc_interrupt_enable( uint32_t level )
638 {
639  __asm__ volatile (
640  "mtmsr %0"
641  :
642  : "r" (level)
643  );
644 }
645 
646 static inline void ppc_interrupt_flash( uint32_t level )
647 {
648  uint32_t current_level;
649 
650  __asm__ volatile (
651  "mfmsr %0;"
652  "mtmsr %1;"
653  "mtmsr %0"
654  : "=&r" (current_level)
655  : "r" (level)
656  );
657 }
658 
659 #define _CPU_ISR_Disable( _isr_cookie ) \
660  do { \
661  _isr_cookie = ppc_interrupt_disable(); \
662  } while (0)
663 
664 /*
665  * Enable interrupts to the previous level (returned by _CPU_ISR_Disable).
666  * This indicates the end of an RTEMS critical section. The parameter
667  * _isr_cookie is not modified.
668  */
669 
670 #define _CPU_ISR_Enable( _isr_cookie ) \
671  ppc_interrupt_enable(_isr_cookie)
672 
673 /*
674  * This temporarily restores the interrupt to _isr_cookie before immediately
675  * disabling them again. This is used to divide long RTEMS critical
676  * sections into two or more parts. The parameter _isr_cookie is not
677  * modified.
678  *
679  * NOTE: The version being used is not very optimized but it does
680  * not trip a problem in gcc where the disable mask does not
681  * get loaded. Check this for future (post 10/97 gcc versions.
682  */
683 
684 #define _CPU_ISR_Flash( _isr_cookie ) \
685  ppc_interrupt_flash(_isr_cookie)
686 
687 /* end of ISR handler macros */
688 
689 #ifdef __cplusplus
690 }
691 #endif /* __cplusplus */
692 
693 #endif /* ASM */
694 
695 #endif /* _RTEMS_POWERPC_REGISTERS_H */
char _PPC_INTERRUPT_DISABLE_MASK[]
A global symbol used to disable interrupts in the MSR.
register struct Per_CPU_Control *_SPARC_Per_CPU_current __asm__("g6")
The pointer to the current per-CPU control is available via register g6.