2 * Copyright (C) 1995-1999 Gary Thomas, Paul Mackerras, Cort Dougan.
4 #ifndef _ASM_POWERPC_PPC_ASM_H
5 #define _ASM_POWERPC_PPC_ASM_H
7 #include <linux/init.h>
8 #include <linux/stringify.h>
9 #include <asm/asm-compat.h>
10 #include <asm/processor.h>
11 #include <asm/ppc-opcode.h>
12 #include <asm/firmware.h>
15 #error __FILE__ should only be used in assembler files
18 #define SZL (BITS_PER_LONG/8)
21 * Stuff for accurate CPU time accounting.
22 * These macros handle transitions between user and system state
23 * in exception entry and exit and accumulate time to the
24 * user_time and system_time fields in the paca.
27 #ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
28 #define ACCOUNT_CPU_USER_ENTRY(ra, rb)
29 #define ACCOUNT_CPU_USER_EXIT(ra, rb)
30 #define ACCOUNT_STOLEN_TIME
32 #define ACCOUNT_CPU_USER_ENTRY(ra, rb) \
33 MFTB(ra); /* get timebase */ \
34 ld rb,PACA_STARTTIME_USER(r13); \
35 std ra,PACA_STARTTIME(r13); \
36 subf rb,rb,ra; /* subtract start value */ \
37 ld ra,PACA_USER_TIME(r13); \
38 add ra,ra,rb; /* add on to user time */ \
39 std ra,PACA_USER_TIME(r13); \
41 #define ACCOUNT_CPU_USER_EXIT(ra, rb) \
42 MFTB(ra); /* get timebase */ \
43 ld rb,PACA_STARTTIME(r13); \
44 std ra,PACA_STARTTIME_USER(r13); \
45 subf rb,rb,ra; /* subtract start value */ \
46 ld ra,PACA_SYSTEM_TIME(r13); \
47 add ra,ra,rb; /* add on to system time */ \
48 std ra,PACA_SYSTEM_TIME(r13)
50 #ifdef CONFIG_PPC_SPLPAR
51 #define ACCOUNT_STOLEN_TIME \
52 BEGIN_FW_FTR_SECTION; \
54 /* from user - see if there are any DTL entries to process */ \
55 ld r10,PACALPPACAPTR(r13); /* get ptr to VPA */ \
56 ld r11,PACA_DTL_RIDX(r13); /* get log read index */ \
57 addi r10,r10,LPPACA_DTLIDX; \
58 LDX_BE r10,0,r10; /* get log write index */ \
61 bl .accumulate_stolen_time; \
63 andi. r10,r12,MSR_PR; /* Restore cr0 (coming from user) */ \
65 END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR)
67 #else /* CONFIG_PPC_SPLPAR */
68 #define ACCOUNT_STOLEN_TIME
70 #endif /* CONFIG_PPC_SPLPAR */
72 #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
75 * Macros for storing registers into and loading registers from
79 #define SAVE_GPR(n, base) std n,GPR0+8*(n)(base)
80 #define REST_GPR(n, base) ld n,GPR0+8*(n)(base)
81 #define SAVE_NVGPRS(base) SAVE_8GPRS(14, base); SAVE_10GPRS(22, base)
82 #define REST_NVGPRS(base) REST_8GPRS(14, base); REST_10GPRS(22, base)
84 #define SAVE_GPR(n, base) stw n,GPR0+4*(n)(base)
85 #define REST_GPR(n, base) lwz n,GPR0+4*(n)(base)
86 #define SAVE_NVGPRS(base) SAVE_GPR(13, base); SAVE_8GPRS(14, base); \
88 #define REST_NVGPRS(base) REST_GPR(13, base); REST_8GPRS(14, base); \
92 #define SAVE_2GPRS(n, base) SAVE_GPR(n, base); SAVE_GPR(n+1, base)
93 #define SAVE_4GPRS(n, base) SAVE_2GPRS(n, base); SAVE_2GPRS(n+2, base)
94 #define SAVE_8GPRS(n, base) SAVE_4GPRS(n, base); SAVE_4GPRS(n+4, base)
95 #define SAVE_10GPRS(n, base) SAVE_8GPRS(n, base); SAVE_2GPRS(n+8, base)
96 #define REST_2GPRS(n, base) REST_GPR(n, base); REST_GPR(n+1, base)
97 #define REST_4GPRS(n, base) REST_2GPRS(n, base); REST_2GPRS(n+2, base)
98 #define REST_8GPRS(n, base) REST_4GPRS(n, base); REST_4GPRS(n+4, base)
99 #define REST_10GPRS(n, base) REST_8GPRS(n, base); REST_2GPRS(n+8, base)
101 #define SAVE_FPR(n, base) stfd n,THREAD_FPR0+8*TS_FPRWIDTH*(n)(base)
102 #define SAVE_2FPRS(n, base) SAVE_FPR(n, base); SAVE_FPR(n+1, base)
103 #define SAVE_4FPRS(n, base) SAVE_2FPRS(n, base); SAVE_2FPRS(n+2, base)
104 #define SAVE_8FPRS(n, base) SAVE_4FPRS(n, base); SAVE_4FPRS(n+4, base)
105 #define SAVE_16FPRS(n, base) SAVE_8FPRS(n, base); SAVE_8FPRS(n+8, base)
106 #define SAVE_32FPRS(n, base) SAVE_16FPRS(n, base); SAVE_16FPRS(n+16, base)
107 #define REST_FPR(n, base) lfd n,THREAD_FPR0+8*TS_FPRWIDTH*(n)(base)
108 #define REST_2FPRS(n, base) REST_FPR(n, base); REST_FPR(n+1, base)
109 #define REST_4FPRS(n, base) REST_2FPRS(n, base); REST_2FPRS(n+2, base)
110 #define REST_8FPRS(n, base) REST_4FPRS(n, base); REST_4FPRS(n+4, base)
111 #define REST_16FPRS(n, base) REST_8FPRS(n, base); REST_8FPRS(n+8, base)
112 #define REST_32FPRS(n, base) REST_16FPRS(n, base); REST_16FPRS(n+16, base)
114 #define SAVE_VR(n,b,base) li b,THREAD_VR0+(16*(n)); stvx n,base,b
115 #define SAVE_2VRS(n,b,base) SAVE_VR(n,b,base); SAVE_VR(n+1,b,base)
116 #define SAVE_4VRS(n,b,base) SAVE_2VRS(n,b,base); SAVE_2VRS(n+2,b,base)
117 #define SAVE_8VRS(n,b,base) SAVE_4VRS(n,b,base); SAVE_4VRS(n+4,b,base)
118 #define SAVE_16VRS(n,b,base) SAVE_8VRS(n,b,base); SAVE_8VRS(n+8,b,base)
119 #define SAVE_32VRS(n,b,base) SAVE_16VRS(n,b,base); SAVE_16VRS(n+16,b,base)
120 #define REST_VR(n,b,base) li b,THREAD_VR0+(16*(n)); lvx n,base,b
121 #define REST_2VRS(n,b,base) REST_VR(n,b,base); REST_VR(n+1,b,base)
122 #define REST_4VRS(n,b,base) REST_2VRS(n,b,base); REST_2VRS(n+2,b,base)
123 #define REST_8VRS(n,b,base) REST_4VRS(n,b,base); REST_4VRS(n+4,b,base)
124 #define REST_16VRS(n,b,base) REST_8VRS(n,b,base); REST_8VRS(n+8,b,base)
125 #define REST_32VRS(n,b,base) REST_16VRS(n,b,base); REST_16VRS(n+16,b,base)
127 /* Save/restore FPRs, VRs and VSRs from their checkpointed backups in
130 #define SAVE_FPR_TRANSACT(n, base) stfd n,THREAD_TRANSACT_FPR0+ \
131 8*TS_FPRWIDTH*(n)(base)
132 #define SAVE_2FPRS_TRANSACT(n, base) SAVE_FPR_TRANSACT(n, base); \
133 SAVE_FPR_TRANSACT(n+1, base)
134 #define SAVE_4FPRS_TRANSACT(n, base) SAVE_2FPRS_TRANSACT(n, base); \
135 SAVE_2FPRS_TRANSACT(n+2, base)
136 #define SAVE_8FPRS_TRANSACT(n, base) SAVE_4FPRS_TRANSACT(n, base); \
137 SAVE_4FPRS_TRANSACT(n+4, base)
138 #define SAVE_16FPRS_TRANSACT(n, base) SAVE_8FPRS_TRANSACT(n, base); \
139 SAVE_8FPRS_TRANSACT(n+8, base)
140 #define SAVE_32FPRS_TRANSACT(n, base) SAVE_16FPRS_TRANSACT(n, base); \
141 SAVE_16FPRS_TRANSACT(n+16, base)
143 #define REST_FPR_TRANSACT(n, base) lfd n,THREAD_TRANSACT_FPR0+ \
144 8*TS_FPRWIDTH*(n)(base)
145 #define REST_2FPRS_TRANSACT(n, base) REST_FPR_TRANSACT(n, base); \
146 REST_FPR_TRANSACT(n+1, base)
147 #define REST_4FPRS_TRANSACT(n, base) REST_2FPRS_TRANSACT(n, base); \
148 REST_2FPRS_TRANSACT(n+2, base)
149 #define REST_8FPRS_TRANSACT(n, base) REST_4FPRS_TRANSACT(n, base); \
150 REST_4FPRS_TRANSACT(n+4, base)
151 #define REST_16FPRS_TRANSACT(n, base) REST_8FPRS_TRANSACT(n, base); \
152 REST_8FPRS_TRANSACT(n+8, base)
153 #define REST_32FPRS_TRANSACT(n, base) REST_16FPRS_TRANSACT(n, base); \
154 REST_16FPRS_TRANSACT(n+16, base)
157 #define SAVE_VR_TRANSACT(n,b,base) li b,THREAD_TRANSACT_VR0+(16*(n)); \
159 #define SAVE_2VRS_TRANSACT(n,b,base) SAVE_VR_TRANSACT(n,b,base); \
160 SAVE_VR_TRANSACT(n+1,b,base)
161 #define SAVE_4VRS_TRANSACT(n,b,base) SAVE_2VRS_TRANSACT(n,b,base); \
162 SAVE_2VRS_TRANSACT(n+2,b,base)
163 #define SAVE_8VRS_TRANSACT(n,b,base) SAVE_4VRS_TRANSACT(n,b,base); \
164 SAVE_4VRS_TRANSACT(n+4,b,base)
165 #define SAVE_16VRS_TRANSACT(n,b,base) SAVE_8VRS_TRANSACT(n,b,base); \
166 SAVE_8VRS_TRANSACT(n+8,b,base)
167 #define SAVE_32VRS_TRANSACT(n,b,base) SAVE_16VRS_TRANSACT(n,b,base); \
168 SAVE_16VRS_TRANSACT(n+16,b,base)
170 #define REST_VR_TRANSACT(n,b,base) li b,THREAD_TRANSACT_VR0+(16*(n)); \
172 #define REST_2VRS_TRANSACT(n,b,base) REST_VR_TRANSACT(n,b,base); \
173 REST_VR_TRANSACT(n+1,b,base)
174 #define REST_4VRS_TRANSACT(n,b,base) REST_2VRS_TRANSACT(n,b,base); \
175 REST_2VRS_TRANSACT(n+2,b,base)
176 #define REST_8VRS_TRANSACT(n,b,base) REST_4VRS_TRANSACT(n,b,base); \
177 REST_4VRS_TRANSACT(n+4,b,base)
178 #define REST_16VRS_TRANSACT(n,b,base) REST_8VRS_TRANSACT(n,b,base); \
179 REST_8VRS_TRANSACT(n+8,b,base)
180 #define REST_32VRS_TRANSACT(n,b,base) REST_16VRS_TRANSACT(n,b,base); \
181 REST_16VRS_TRANSACT(n+16,b,base)
184 #define SAVE_VSR_TRANSACT(n,b,base) li b,THREAD_TRANSACT_VSR0+(16*(n)); \
185 STXVD2X(n,R##base,R##b)
186 #define SAVE_2VSRS_TRANSACT(n,b,base) SAVE_VSR_TRANSACT(n,b,base); \
187 SAVE_VSR_TRANSACT(n+1,b,base)
188 #define SAVE_4VSRS_TRANSACT(n,b,base) SAVE_2VSRS_TRANSACT(n,b,base); \
189 SAVE_2VSRS_TRANSACT(n+2,b,base)
190 #define SAVE_8VSRS_TRANSACT(n,b,base) SAVE_4VSRS_TRANSACT(n,b,base); \
191 SAVE_4VSRS_TRANSACT(n+4,b,base)
192 #define SAVE_16VSRS_TRANSACT(n,b,base) SAVE_8VSRS_TRANSACT(n,b,base); \
193 SAVE_8VSRS_TRANSACT(n+8,b,base)
194 #define SAVE_32VSRS_TRANSACT(n,b,base) SAVE_16VSRS_TRANSACT(n,b,base); \
195 SAVE_16VSRS_TRANSACT(n+16,b,base)
197 #define REST_VSR_TRANSACT(n,b,base) li b,THREAD_TRANSACT_VSR0+(16*(n)); \
198 LXVD2X(n,R##base,R##b)
199 #define REST_2VSRS_TRANSACT(n,b,base) REST_VSR_TRANSACT(n,b,base); \
200 REST_VSR_TRANSACT(n+1,b,base)
201 #define REST_4VSRS_TRANSACT(n,b,base) REST_2VSRS_TRANSACT(n,b,base); \
202 REST_2VSRS_TRANSACT(n+2,b,base)
203 #define REST_8VSRS_TRANSACT(n,b,base) REST_4VSRS_TRANSACT(n,b,base); \
204 REST_4VSRS_TRANSACT(n+4,b,base)
205 #define REST_16VSRS_TRANSACT(n,b,base) REST_8VSRS_TRANSACT(n,b,base); \
206 REST_8VSRS_TRANSACT(n+8,b,base)
207 #define REST_32VSRS_TRANSACT(n,b,base) REST_16VSRS_TRANSACT(n,b,base); \
208 REST_16VSRS_TRANSACT(n+16,b,base)
210 /* Save the lower 32 VSRs in the thread VSR region */
211 #define SAVE_VSR(n,b,base) li b,THREAD_VSR0+(16*(n)); STXVD2X(n,R##base,R##b)
212 #define SAVE_2VSRS(n,b,base) SAVE_VSR(n,b,base); SAVE_VSR(n+1,b,base)
213 #define SAVE_4VSRS(n,b,base) SAVE_2VSRS(n,b,base); SAVE_2VSRS(n+2,b,base)
214 #define SAVE_8VSRS(n,b,base) SAVE_4VSRS(n,b,base); SAVE_4VSRS(n+4,b,base)
215 #define SAVE_16VSRS(n,b,base) SAVE_8VSRS(n,b,base); SAVE_8VSRS(n+8,b,base)
216 #define SAVE_32VSRS(n,b,base) SAVE_16VSRS(n,b,base); SAVE_16VSRS(n+16,b,base)
217 #define REST_VSR(n,b,base) li b,THREAD_VSR0+(16*(n)); LXVD2X(n,R##base,R##b)
218 #define REST_2VSRS(n,b,base) REST_VSR(n,b,base); REST_VSR(n+1,b,base)
219 #define REST_4VSRS(n,b,base) REST_2VSRS(n,b,base); REST_2VSRS(n+2,b,base)
220 #define REST_8VSRS(n,b,base) REST_4VSRS(n,b,base); REST_4VSRS(n+4,b,base)
221 #define REST_16VSRS(n,b,base) REST_8VSRS(n,b,base); REST_8VSRS(n+8,b,base)
222 #define REST_32VSRS(n,b,base) REST_16VSRS(n,b,base); REST_16VSRS(n+16,b,base)
225 * b = base register for addressing, o = base offset from register of 1st EVR
226 * n = first EVR, s = scratch
228 #define SAVE_EVR(n,s,b,o) evmergehi s,s,n; stw s,o+4*(n)(b)
229 #define SAVE_2EVRS(n,s,b,o) SAVE_EVR(n,s,b,o); SAVE_EVR(n+1,s,b,o)
230 #define SAVE_4EVRS(n,s,b,o) SAVE_2EVRS(n,s,b,o); SAVE_2EVRS(n+2,s,b,o)
231 #define SAVE_8EVRS(n,s,b,o) SAVE_4EVRS(n,s,b,o); SAVE_4EVRS(n+4,s,b,o)
232 #define SAVE_16EVRS(n,s,b,o) SAVE_8EVRS(n,s,b,o); SAVE_8EVRS(n+8,s,b,o)
233 #define SAVE_32EVRS(n,s,b,o) SAVE_16EVRS(n,s,b,o); SAVE_16EVRS(n+16,s,b,o)
234 #define REST_EVR(n,s,b,o) lwz s,o+4*(n)(b); evmergelo n,s,n
235 #define REST_2EVRS(n,s,b,o) REST_EVR(n,s,b,o); REST_EVR(n+1,s,b,o)
236 #define REST_4EVRS(n,s,b,o) REST_2EVRS(n,s,b,o); REST_2EVRS(n+2,s,b,o)
237 #define REST_8EVRS(n,s,b,o) REST_4EVRS(n,s,b,o); REST_4EVRS(n+4,s,b,o)
238 #define REST_16EVRS(n,s,b,o) REST_8EVRS(n,s,b,o); REST_8EVRS(n+8,s,b,o)
239 #define REST_32EVRS(n,s,b,o) REST_16EVRS(n,s,b,o); REST_16EVRS(n+16,s,b,o)
241 /* Macros to adjust thread priority for hardware multithreading */
242 #define HMT_VERY_LOW or 31,31,31 # very low priority
243 #define HMT_LOW or 1,1,1
244 #define HMT_MEDIUM_LOW or 6,6,6 # medium low priority
245 #define HMT_MEDIUM or 2,2,2
246 #define HMT_MEDIUM_HIGH or 5,5,5 # medium high priority
247 #define HMT_HIGH or 3,3,3
248 #define HMT_EXTRA_HIGH or 7,7,7 # power7 only
255 #define __VCPU_GPR(n) (VCPU_GPRS + (n * ULONG_SIZE))
256 #define VCPU_GPR(n) __VCPU_GPR(__REG_##n)
261 #define STACKFRAMESIZE 256
262 #define __STK_REG(i) (112 + ((i)-14)*8)
263 #define STK_REG(i) __STK_REG(__REG_##i)
265 #define __STK_PARAM(i) (48 + ((i)-3)*8)
266 #define STK_PARAM(i) __STK_PARAM(__REG_##i)
268 #define XGLUE(a,b) a##b
269 #define GLUE(a,b) XGLUE(a,b)
271 #define _GLOBAL(name) \
275 .globl GLUE(.,name); \
276 .section ".opd","aw"; \
278 .quad GLUE(.,name); \
279 .quad .TOC.@tocbase; \
282 .type GLUE(.,name),@function; \
285 #define _INIT_GLOBAL(name) \
289 .globl GLUE(.,name); \
290 .section ".opd","aw"; \
292 .quad GLUE(.,name); \
293 .quad .TOC.@tocbase; \
296 .type GLUE(.,name),@function; \
299 #define _KPROBE(name) \
300 .section ".kprobes.text","a"; \
303 .globl GLUE(.,name); \
304 .section ".opd","aw"; \
306 .quad GLUE(.,name); \
307 .quad .TOC.@tocbase; \
310 .type GLUE(.,name),@function; \
313 #define _STATIC(name) \
316 .section ".opd","aw"; \
318 .quad GLUE(.,name); \
319 .quad .TOC.@tocbase; \
322 .type GLUE(.,name),@function; \
325 #define _INIT_STATIC(name) \
328 .section ".opd","aw"; \
330 .quad GLUE(.,name); \
331 .quad .TOC.@tocbase; \
334 .type GLUE(.,name),@function; \
345 .stabs __stringify(n:F-1),N_FUN,0,0,n;\
350 .section ".kprobes.text","a"; \
357 * LOAD_REG_IMMEDIATE(rn, expr)
358 * Loads the value of the constant expression 'expr' into register 'rn'
359 * using immediate instructions only. Use this when it's important not
360 * to reference other data (i.e. on ppc64 when the TOC pointer is not
361 * valid) and when 'expr' is a constant or absolute address.
363 * LOAD_REG_ADDR(rn, name)
364 * Loads the address of label 'name' into register 'rn'. Use this when
365 * you don't particularly need immediate instructions only, but you need
366 * the whole address in one register (e.g. it's a structure address and
367 * you want to access various offsets within it). On ppc32 this is
368 * identical to LOAD_REG_IMMEDIATE.
370 * LOAD_REG_ADDRBASE(rn, name)
372 * LOAD_REG_ADDRBASE loads part of the address of label 'name' into
373 * register 'rn'. ADDROFF(name) returns the remainder of the address as
374 * a constant expression. ADDROFF(name) is a signed expression < 16 bits
375 * in size, so is suitable for use directly as an offset in load and store
376 * instructions. Use this when loading/storing a single word or less as:
377 * LOAD_REG_ADDRBASE(rX, name)
378 * ld rY,ADDROFF(name)(rX)
381 #ifdef HAVE_AS_ATHIGH
382 #define __AS_ATHIGH high
384 #define __AS_ATHIGH h
386 #define LOAD_REG_IMMEDIATE(reg,expr) \
387 lis reg,(expr)@highest; \
388 ori reg,reg,(expr)@higher; \
389 rldicr reg,reg,32,31; \
390 oris reg,reg,(expr)@__AS_ATHIGH; \
391 ori reg,reg,(expr)@l;
393 #define LOAD_REG_ADDR(reg,name) \
396 #define LOAD_REG_ADDRBASE(reg,name) LOAD_REG_ADDR(reg,name)
397 #define ADDROFF(name) 0
399 /* offsets for stack frame layout */
404 #define LOAD_REG_IMMEDIATE(reg,expr) \
406 addi reg,reg,(expr)@l;
408 #define LOAD_REG_ADDR(reg,name) LOAD_REG_IMMEDIATE(reg, name)
410 #define LOAD_REG_ADDRBASE(reg, name) lis reg,name@ha
411 #define ADDROFF(name) name@l
413 /* offsets for stack frame layout */
418 /* various errata or part fixups */
419 #ifdef CONFIG_PPC601_SYNC_FIX
424 END_FTR_SECTION_IFSET(CPU_FTR_601)
428 END_FTR_SECTION_IFSET(CPU_FTR_601)
432 END_FTR_SECTION_IFSET(CPU_FTR_601)
439 #if defined(CONFIG_PPC_CELL) || defined(CONFIG_PPC_FSL_BOOK3E)
441 90: mfspr dest, SPRN_TBRL; \
442 BEGIN_FTR_SECTION_NESTED(96); \
445 END_FTR_SECTION_NESTED(CPU_FTR_CELL_TB_BUG, CPU_FTR_CELL_TB_BUG, 96)
446 #elif defined(CONFIG_8xx)
447 #define MFTB(dest) mftb dest
449 #define MFTB(dest) mfspr dest, SPRN_TBRL
454 #else /* CONFIG_SMP */
455 /* tlbsync is not implemented on 601 */
460 END_FTR_SECTION_IFCLR(CPU_FTR_601)
464 #define MTOCRF(FXM, RS) \
465 BEGIN_FTR_SECTION_NESTED(848); \
467 FTR_SECTION_ELSE_NESTED(848); \
469 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_NOEXECUTE, 848)
472 * PPR restore macros used in entry_64.S
473 * Used for P7 or later processors
475 #define HMT_MEDIUM_LOW_HAS_PPR \
476 BEGIN_FTR_SECTION_NESTED(944) \
478 END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,944)
480 #define SET_DEFAULT_THREAD_PPR(ra, rb) \
481 BEGIN_FTR_SECTION_NESTED(945) \
482 lis ra,INIT_PPR@highest; /* default ppr=3 */ \
483 ld rb,PACACURRENT(r13); \
484 sldi ra,ra,32; /* 11- 13 bits are used for ppr */ \
485 std ra,TASKTHREADPPR(rb); \
486 END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,945)
491 * This instruction is not implemented on the PPC 603 or 601; however, on
492 * the 403GCX and 405GP tlbia IS defined and tlbie is not.
493 * All of these instructions exist in the 8xx, they have magical powers,
494 * and they must be used.
497 #if !defined(CONFIG_4xx) && !defined(CONFIG_8xx)
501 lis r4,KERNELBASE@h; \
508 #ifdef CONFIG_IBM440EP_ERR42
509 #define PPC440EP_ERR42 isync
511 #define PPC440EP_ERR42
514 /* The following stops all load and store data streams associated with stream
515 * ID (ie. streams created explicitly). The embedded and server mnemonics for
516 * dcbt are different so we use machine "power4" here explicitly.
518 #define DCBT_STOP_ALL_STREAM_IDS(scratch) \
520 .machine "power4" ; \
521 lis scratch,0x60000000@h; \
522 dcbt r0,scratch,0b01010; \
526 * toreal/fromreal/tophys/tovirt macros. 32-bit BookE makes them
527 * keep the address intact to be compatible with code shared with
530 * On the other hand, I find it useful to have them behave as expected
531 * by their name (ie always do the addition) on 64-bit BookE
533 #if defined(CONFIG_BOOKE) && !defined(CONFIG_PPC64)
538 * We use addis to ensure compatibility with the "classic" ppc versions of
539 * these macros, which use rs = 0 to get the tophys offset in rd, rather than
540 * converting the address in r0, and so this version has to do that too
541 * (i.e. set register rd to 0 when rs == 0).
543 #define tophys(rd,rs) \
546 #define tovirt(rd,rs) \
549 #elif defined(CONFIG_PPC64)
550 #define toreal(rd) /* we can access c000... in real mode */
553 #define tophys(rd,rs) \
556 #define tovirt(rd,rs) \
558 ori rd,rd,((KERNELBASE>>48)&0xFFFF);\
562 * On APUS (Amiga PowerPC cpu upgrade board), we don't know the
563 * physical base address of RAM at compile time.
565 #define toreal(rd) tophys(rd,rd)
566 #define fromreal(rd) tovirt(rd,rd)
568 #define tophys(rd,rs) \
569 0: addis rd,rs,-PAGE_OFFSET@h; \
570 .section ".vtop_fixup","aw"; \
575 #define tovirt(rd,rs) \
576 0: addis rd,rs,PAGE_OFFSET@h; \
577 .section ".ptov_fixup","aw"; \
583 #ifdef CONFIG_PPC_BOOK3S_64
585 #define MTMSRD(r) mtmsrd r
586 #define MTMSR_EERI(reg) mtmsrd reg,1
588 #define FIX_SRR1(ra, rb)
592 #define RFI rfi; b . /* Prevent prefetch past rfi */
594 #define MTMSRD(r) mtmsr r
595 #define MTMSR_EERI(reg) mtmsr reg
599 #endif /* __KERNEL__ */
601 /* The boring bits... */
603 /* Condition Register Bit Fields */
616 * General Purpose Registers (GPRs)
618 * The lower case r0-r31 should be used in preference to the upper
619 * case R0-R31 as they provide more error checking in the assembler.
620 * Use R0-31 only when really nessesary.
657 /* Floating Point Registers (FPRs) */
692 /* AltiVec Registers (VPRs) */
727 /* VSX Registers (VSRs) */
794 /* SPE Registers (EVPRs) */
829 /* some stab codes */
835 #endif /* __ASSEMBLY__ */
837 #endif /* _ASM_POWERPC_PPC_ASM_H */