2 * Contains register definitions common to the Book E PowerPC
3 * specification. Notice that while the IBM-40x series of CPUs
4 * are not true Book E PowerPCs, they borrowed a number of features
5 * before Book E was finalized, and are included here as well. Unfortunatly,
6 * they sometimes used different locations than true Book E CPUs did.
9 #ifndef __ASM_PPC_REG_BOOKE_H__
10 #define __ASM_PPC_REG_BOOKE_H__
13 /* Device Control Registers */
14 #define mfdcr(rn) mfdcr_or_dflt(rn, 0)
15 #define mfdcr_or_dflt(rn,default_rval) \
16 ({unsigned int rval; \
18 rval = default_rval; \
20 asm volatile("mfdcr %0," __stringify(rn) : "=r" (rval)); \
23 #define mtdcr(rn, v) \
26 asm volatile("mtdcr " __stringify(rn) ",%0" : : "r" (v)); \
29 /* R/W of indirect DCRs make use of standard naming conventions for DCRs */
30 #define mfdcri(base, reg) \
32 mtdcr(base ## _CFGADDR, base ## _ ## reg); \
33 mfdcr(base ## _CFGDATA); \
36 #define mtdcri(base, reg, data) \
38 mtdcr(base ## _CFGADDR, base ## _ ## reg); \
39 mtdcr(base ## _CFGDATA, data); \
41 #endif /* __ASSEMBLY__ */
44 /* Machine State Register (MSR) Fields */
45 #define MSR_DWE (1<<10) /* Debug Wait Enable */
46 #define MSR_IS MSR_IR /* Instruction Space */
47 #define MSR_DS MSR_DR /* Data Space */
49 /* Default MSR for kernel mode. */
50 #if defined (CONFIG_40x)
51 #define MSR_KERNEL (MSR_ME|MSR_RI|MSR_IR|MSR_DR|MSR_CE|MSR_DE)
52 #elif defined(CONFIG_BOOKE)
53 #define MSR_KERNEL (MSR_ME|MSR_RI|MSR_CE|MSR_DE)
56 /* Special Purpose Registers (SPRNs)*/
57 #define SPRN_DECAR 0x036 /* Decrementer Auto Reload Register */
58 #define SPRN_IVPR 0x03F /* Interrupt Vector Prefix Register */
59 #define SPRN_USPRG0 0x100 /* User Special Purpose Register General 0 */
60 #define SPRN_SPRG4R 0x104 /* Special Purpose Register General 4 Read */
61 #define SPRN_SPRG5R 0x105 /* Special Purpose Register General 5 Read */
62 #define SPRN_SPRG6R 0x106 /* Special Purpose Register General 6 Read */
63 #define SPRN_SPRG7R 0x107 /* Special Purpose Register General 7 Read */
64 #define SPRN_SPRG4W 0x114 /* Special Purpose Register General 4 Write */
65 #define SPRN_SPRG5W 0x115 /* Special Purpose Register General 5 Write */
66 #define SPRN_SPRG6W 0x116 /* Special Purpose Register General 6 Write */
67 #define SPRN_SPRG7W 0x117 /* Special Purpose Register General 7 Write */
68 #define SPRN_DBCR2 0x136 /* Debug Control Register 2 */
69 #define SPRN_IAC3 0x13A /* Instruction Address Compare 3 */
70 #define SPRN_IAC4 0x13B /* Instruction Address Compare 4 */
71 #define SPRN_DVC1 0x13E /* Data Value Compare Register 1 */
72 #define SPRN_DVC2 0x13F /* Data Value Compare Register 2 */
73 #define SPRN_IVOR0 0x190 /* Interrupt Vector Offset Register 0 */
74 #define SPRN_IVOR1 0x191 /* Interrupt Vector Offset Register 1 */
75 #define SPRN_IVOR2 0x192 /* Interrupt Vector Offset Register 2 */
76 #define SPRN_IVOR3 0x193 /* Interrupt Vector Offset Register 3 */
77 #define SPRN_IVOR4 0x194 /* Interrupt Vector Offset Register 4 */
78 #define SPRN_IVOR5 0x195 /* Interrupt Vector Offset Register 5 */
79 #define SPRN_IVOR6 0x196 /* Interrupt Vector Offset Register 6 */
80 #define SPRN_IVOR7 0x197 /* Interrupt Vector Offset Register 7 */
81 #define SPRN_IVOR8 0x198 /* Interrupt Vector Offset Register 8 */
82 #define SPRN_IVOR9 0x199 /* Interrupt Vector Offset Register 9 */
83 #define SPRN_IVOR10 0x19A /* Interrupt Vector Offset Register 10 */
84 #define SPRN_IVOR11 0x19B /* Interrupt Vector Offset Register 11 */
85 #define SPRN_IVOR12 0x19C /* Interrupt Vector Offset Register 12 */
86 #define SPRN_IVOR13 0x19D /* Interrupt Vector Offset Register 13 */
87 #define SPRN_IVOR14 0x19E /* Interrupt Vector Offset Register 14 */
88 #define SPRN_IVOR15 0x19F /* Interrupt Vector Offset Register 15 */
89 #define SPRN_ZPR 0x3B0 /* Zone Protection Register (40x) */
90 #define SPRN_MMUCR 0x3B2 /* MMU Control Register */
91 #define SPRN_CCR0 0x3B3 /* Core Configuration Register */
92 #define SPRN_SGR 0x3B9 /* Storage Guarded Register */
93 #define SPRN_DCWR 0x3BA /* Data Cache Write-thru Register */
94 #define SPRN_SLER 0x3BB /* Little-endian real mode */
95 #define SPRN_SU0R 0x3BC /* "User 0" real mode (40x) */
96 #define SPRN_DCMP 0x3D1 /* Data TLB Compare Register */
97 #define SPRN_ICDBDR 0x3D3 /* Instruction Cache Debug Data Register */
98 #define SPRN_EVPR 0x3D6 /* Exception Vector Prefix Register */
99 #define SPRN_PIT 0x3DB /* Programmable Interval Timer */
100 #define SPRN_DCCR 0x3FA /* Data Cache Cacheability Register */
101 #define SPRN_ICCR 0x3FB /* Instruction Cache Cacheability Register */
104 * SPRs which have conflicting definitions on true Book E versus classic,
108 #define SPRN_PID 0x030 /* Process ID */
109 #define SPRN_CSRR0 0x03A /* Critical Save and Restore Register 0 */
110 #define SPRN_CSRR1 0x03B /* Critical Save and Restore Register 1 */
111 #define SPRN_DEAR 0x03D /* Data Error Address Register */
112 #define SPRN_ESR 0x03E /* Exception Syndrome Register */
113 #define SPRN_PIR 0x11E /* Processor Identification Register */
114 #define SPRN_DBSR 0x130 /* Debug Status Register */
115 #define SPRN_DBCR0 0x134 /* Debug Control Register 0 */
116 #define SPRN_DBCR1 0x135 /* Debug Control Register 1 */
117 #define SPRN_IAC1 0x138 /* Instruction Address Compare 1 */
118 #define SPRN_IAC2 0x139 /* Instruction Address Compare 2 */
119 #define SPRN_DAC1 0x13C /* Data Address Compare 1 */
120 #define SPRN_DAC2 0x13D /* Data Address Compare 2 */
121 #define SPRN_TSR 0x150 /* Timer Status Register */
122 #define SPRN_TCR 0x154 /* Timer Control Register */
125 #define SPRN_PID 0x3B1 /* Process ID */
126 #define SPRN_DBCR1 0x3BD /* Debug Control Register 1 */
127 #define SPRN_ESR 0x3D4 /* Exception Syndrome Register */
128 #define SPRN_DEAR 0x3D5 /* Data Error Address Register */
129 #define SPRN_TSR 0x3D8 /* Timer Status Register */
130 #define SPRN_TCR 0x3DA /* Timer Control Register */
131 #define SPRN_SRR2 0x3DE /* Save/Restore Register 2 */
132 #define SPRN_SRR3 0x3DF /* Save/Restore Register 3 */
133 #define SPRN_DBSR 0x3F0 /* Debug Status Register */
134 #define SPRN_DBCR0 0x3F2 /* Debug Control Register 0 */
135 #define SPRN_DAC1 0x3F6 /* Data Address Compare 1 */
136 #define SPRN_DAC2 0x3F7 /* Data Address Compare 2 */
137 #define SPRN_CSRR0 SPRN_SRR2 /* Critical Save and Restore Register 0 */
138 #define SPRN_CSRR1 SPRN_SRR3 /* Critical Save and Restore Register 1 */
141 /* Bit definitions for the DBSR. */
143 * DBSR bits which have conflicting definitions on true Book E versus IBM 40x.
146 #define DBSR_IC 0x08000000 /* Instruction Completion */
147 #define DBSR_TIE 0x01000000 /* Trap Instruction Event */
150 #define DBSR_IC 0x80000000 /* Instruction Completion */
151 #define DBSR_BT 0x40000000 /* Branch taken */
152 #define DBSR_TIE 0x10000000 /* Trap Instruction debug Event */
155 /* Bit definitions related to the ESR. */
156 #define ESR_MCI 0x80000000 /* Machine Check - Instruction */
157 #define ESR_IMCP 0x80000000 /* Instr. Machine Check - Protection */
158 #define ESR_IMCN 0x40000000 /* Instr. Machine Check - Non-config */
159 #define ESR_IMCB 0x20000000 /* Instr. Machine Check - Bus error */
160 #define ESR_IMCT 0x10000000 /* Instr. Machine Check - Timeout */
161 #define ESR_PIL 0x08000000 /* Program Exception - Illegal */
162 #define ESR_PPR 0x04000000 /* Program Exception - Priveleged */
163 #define ESR_PTR 0x02000000 /* Program Exception - Trap */
164 #define ESR_DST 0x00800000 /* Storage Exception - Data miss */
165 #define ESR_DIZ 0x00400000 /* Storage Exception - Zone fault */
166 #define ESR_ST 0x00800000 /* Store Operation */
168 /* Bit definitions related to the DBCR0. */
169 #define DBCR0_EDM 0x80000000 /* External Debug Mode */
170 #define DBCR0_IDM 0x40000000 /* Internal Debug Mode */
171 #define DBCR0_RST 0x30000000 /* all the bits in the RST field */
172 #define DBCR0_RST_SYSTEM 0x30000000 /* System Reset */
173 #define DBCR0_RST_CHIP 0x20000000 /* Chip Reset */
174 #define DBCR0_RST_CORE 0x10000000 /* Core Reset */
175 #define DBCR0_RST_NONE 0x00000000 /* No Reset */
176 #define DBCR0_IC 0x08000000 /* Instruction Completion */
177 #define DBCR0_BT 0x04000000 /* Branch Taken */
178 #define DBCR0_EDE 0x02000000 /* Exception Debug Event */
179 #define DBCR0_TDE 0x01000000 /* TRAP Debug Event */
180 #define DBCR0_IA1 0x00800000 /* Instr Addr compare 1 enable */
181 #define DBCR0_IA2 0x00400000 /* Instr Addr compare 2 enable */
182 #define DBCR0_IA12 0x00200000 /* Instr Addr 1-2 range enable */
183 #define DBCR0_IA12X 0x00100000 /* Instr Addr 1-2 range eXclusive */
184 #define DBCR0_IA3 0x00080000 /* Instr Addr compare 3 enable */
185 #define DBCR0_IA4 0x00040000 /* Instr Addr compare 4 enable */
186 #define DBCR0_IA34 0x00020000 /* Instr Addr 3-4 range Enable */
187 #define DBCR0_IA34X 0x00010000 /* Instr Addr 3-4 range eXclusive */
188 #define DBCR0_IA12T 0x00008000 /* Instr Addr 1-2 range Toggle */
189 #define DBCR0_IA34T 0x00004000 /* Instr Addr 3-4 range Toggle */
190 #define DBCR0_FT 0x00000001 /* Freeze Timers on debug event */
192 /* Bit definitions related to the TCR. */
193 #define TCR_WP(x) (((x)&0x3)<<30) /* WDT Period */
194 #define TCR_WP_MASK TCR_WP(3)
195 #define WP_2_17 0 /* 2^17 clocks */
196 #define WP_2_21 1 /* 2^21 clocks */
197 #define WP_2_25 2 /* 2^25 clocks */
198 #define WP_2_29 3 /* 2^29 clocks */
199 #define TCR_WRC(x) (((x)&0x3)<<28) /* WDT Reset Control */
200 #define TCR_WRC_MASK TCR_WRC(3)
201 #define WRC_NONE 0 /* No reset will occur */
202 #define WRC_CORE 1 /* Core reset will occur */
203 #define WRC_CHIP 2 /* Chip reset will occur */
204 #define WRC_SYSTEM 3 /* System reset will occur */
205 #define TCR_WIE 0x08000000 /* WDT Interrupt Enable */
206 #define TCR_PIE 0x04000000 /* PIT Interrupt Enable */
207 #define TCR_DIE TCR_PIE /* DEC Interrupt Enable */
208 #define TCR_FP(x) (((x)&0x3)<<24) /* FIT Period */
209 #define TCR_FP_MASK TCR_FP(3)
210 #define FP_2_9 0 /* 2^9 clocks */
211 #define FP_2_13 1 /* 2^13 clocks */
212 #define FP_2_17 2 /* 2^17 clocks */
213 #define FP_2_21 3 /* 2^21 clocks */
214 #define TCR_FIE 0x00800000 /* FIT Interrupt Enable */
215 #define TCR_ARE 0x00400000 /* Auto Reload Enable */
217 /* Bit definitions for the TSR. */
218 #define TSR_ENW 0x80000000 /* Enable Next Watchdog */
219 #define TSR_WIS 0x40000000 /* WDT Interrupt Status */
220 #define TSR_WRS(x) (((x)&0x3)<<28) /* WDT Reset Status */
221 #define WRS_NONE 0 /* No WDT reset occurred */
222 #define WRS_CORE 1 /* WDT forced core reset */
223 #define WRS_CHIP 2 /* WDT forced chip reset */
224 #define WRS_SYSTEM 3 /* WDT forced system reset */
225 #define TSR_PIS 0x08000000 /* PIT Interrupt Status */
226 #define TSR_DIS TSR_PIS /* DEC Interrupt Status */
227 #define TSR_FIS 0x04000000 /* FIT Interrupt Status */
229 /* Bit definitions for the DCCR. */
230 #define DCCR_NOCACHE 0 /* Noncacheable */
231 #define DCCR_CACHE 1 /* Cacheable */
233 /* Bit definitions for DCWR. */
234 #define DCWR_COPY 0 /* Copy-back */
235 #define DCWR_WRITE 1 /* Write-through */
237 /* Bit definitions for ICCR. */
238 #define ICCR_NOCACHE 0 /* Noncacheable */
239 #define ICCR_CACHE 1 /* Cacheable */
241 /* Bit definitions for SGR. */
242 #define SGR_NORMAL 0 /* Speculative fetching allowed. */
243 #define SGR_GUARDED 1 /* Speculative fetching disallowed. */
245 /* Short-hand for various SPRs. */
247 #define CSRR0 SPRN_CSRR0 /* Critical Save and Restore Register 0 */
248 #define CSRR1 SPRN_CSRR1 /* Critical Save and Restore Register 1 */
250 #define CSRR0 SPRN_SRR2 /* Logically and functionally equivalent. */
251 #define CSRR1 SPRN_SRR3 /* Logically and functionally equivalent. */
253 #define DCMP SPRN_DCMP /* Data TLB Compare Register */
254 #define SPRG4R SPRN_SPRG4R /* Supervisor Private Registers */
255 #define SPRG5R SPRN_SPRG5R
256 #define SPRG6R SPRN_SPRG6R
257 #define SPRG7R SPRN_SPRG7R
258 #define SPRG4W SPRN_SPRG4W
259 #define SPRG5W SPRN_SPRG5W
260 #define SPRG6W SPRN_SPRG6W
261 #define SPRG7W SPRN_SPRG7W
264 * The IBM-403 is an even more odd special case, as it is much
265 * older than the IBM-405 series. We put these down here incase someone
266 * wishes to support these machines again.
269 /* Special Purpose Registers (SPRNs)*/
270 #define SPRN_TBHU 0x3CC /* Time Base High User-mode */
271 #define SPRN_TBLU 0x3CD /* Time Base Low User-mode */
272 #define SPRN_CDBCR 0x3D7 /* Cache Debug Control Register */
273 #define SPRN_TBHI 0x3DC /* Time Base High */
274 #define SPRN_TBLO 0x3DD /* Time Base Low */
275 #define SPRN_DBCR 0x3F2 /* Debug Control Regsiter */
276 #define SPRN_PBL1 0x3FC /* Protection Bound Lower 1 */
277 #define SPRN_PBL2 0x3FE /* Protection Bound Lower 2 */
278 #define SPRN_PBU1 0x3FD /* Protection Bound Upper 1 */
279 #define SPRN_PBU2 0x3FF /* Protection Bound Upper 2 */
282 /* Bit definitions for the DBCR. */
283 #define DBCR_EDM DBCR0_EDM
284 #define DBCR_IDM DBCR0_IDM
285 #define DBCR_RST(x) (((x) & 0x3) << 28)
286 #define DBCR_RST_NONE 0
287 #define DBCR_RST_CORE 1
288 #define DBCR_RST_CHIP 2
289 #define DBCR_RST_SYSTEM 3
290 #define DBCR_IC DBCR0_IC /* Instruction Completion Debug Evnt */
291 #define DBCR_BT DBCR0_BT /* Branch Taken Debug Event */
292 #define DBCR_EDE DBCR0_EDE /* Exception Debug Event */
293 #define DBCR_TDE DBCR0_TDE /* TRAP Debug Event */
294 #define DBCR_FER 0x00F80000 /* First Events Remaining Mask */
295 #define DBCR_FT 0x00040000 /* Freeze Timers on Debug Event */
296 #define DBCR_IA1 0x00020000 /* Instr. Addr. Compare 1 Enable */
297 #define DBCR_IA2 0x00010000 /* Instr. Addr. Compare 2 Enable */
298 #define DBCR_D1R 0x00008000 /* Data Addr. Compare 1 Read Enable */
299 #define DBCR_D1W 0x00004000 /* Data Addr. Compare 1 Write Enable */
300 #define DBCR_D1S(x) (((x) & 0x3) << 12) /* Data Adrr. Compare 1 Size */
305 #define DBCR_D2R 0x00000800 /* Data Addr. Compare 2 Read Enable */
306 #define DBCR_D2W 0x00000400 /* Data Addr. Compare 2 Write Enable */
307 #define DBCR_D2S(x) (((x) & 0x3) << 8) /* Data Addr. Compare 2 Size */
308 #define DBCR_SBT 0x00000040 /* Second Branch Taken Debug Event */
309 #define DBCR_SED 0x00000020 /* Second Exception Debug Event */
310 #define DBCR_STD 0x00000010 /* Second Trap Debug Event */
311 #define DBCR_SIA 0x00000008 /* Second IAC Enable */
312 #define DBCR_SDA 0x00000004 /* Second DAC Enable */
313 #define DBCR_JOI 0x00000002 /* JTAG Serial Outbound Int. Enable */
314 #define DBCR_JII 0x00000001 /* JTAG Serial Inbound Int. Enable */
316 #endif /* __ASM_PPC_REG_BOOKE_H__ */
317 #endif /* __KERNEL__ */