1 #ifndef _ASM_POWERPC_PROCESSOR_H
2 #define _ASM_POWERPC_PROCESSOR_H
22 #include <linux/compiler.h>
24 #include <asm/ptrace.h>
25 #include <asm/types.h>
33 #define _PREP_Motorola 0x01
34 #define _PREP_Firm 0x02
35 #define _PREP_IBM 0x00
36 #define _PREP_Bull 0x03
39 #define _CHRP_Motorola 0x04
40 #define _CHRP_IBM 0x05
41 #define _CHRP_Pegasos 0x06
42 #define _CHRP_briq 0x07
44 #if defined(__KERNEL__) && defined(CONFIG_PPC32)
48 #ifdef CONFIG_PPC_PREP
51 extern int _prep_type;
61 #define current_text_addr() ({ __label__ _l; _l: &&_l;})
64 #define HMT_very_low() asm volatile("or 31,31,31 # very low priority")
65 #define HMT_low() asm volatile("or 1,1,1 # low priority")
66 #define HMT_medium_low() asm volatile("or 6,6,6 # medium low priority")
67 #define HMT_medium() asm volatile("or 2,2,2 # medium priority")
68 #define HMT_medium_high() asm volatile("or 5,5,5 # medium high priority")
69 #define HMT_high() asm volatile("or 3,3,3 # high priority")
85 #if CONFIG_TASK_SIZE > CONFIG_KERNEL_START
86 #error User TASK_SIZE overlaps with KERNEL_START address
88 #define TASK_SIZE (CONFIG_TASK_SIZE)
93 #define TASK_UNMAPPED_BASE (TASK_SIZE / 8 * 3)
98 #define TASK_SIZE_USER64 (0x0000400000000000UL)
104 #define TASK_SIZE_USER32 (0x0000000100000000UL - (1*PAGE_SIZE))
106 #define TASK_SIZE_OF(tsk) (test_tsk_thread_flag(tsk, TIF_32BIT) ? \
107 TASK_SIZE_USER32 : TASK_SIZE_USER64)
108 #define TASK_SIZE TASK_SIZE_OF(current)
113 #define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4))
114 #define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(TASK_SIZE_USER64 / 4))
116 #define TASK_UNMAPPED_BASE ((is_32bit_task()) ? \
117 TASK_UNMAPPED_BASE_USER32 : TASK_UNMAPPED_BASE_USER64 )
122 #define STACK_TOP_USER64 TASK_SIZE_USER64
123 #define STACK_TOP_USER32 TASK_SIZE_USER32
125 #define STACK_TOP (is_32bit_task() ? \
126 STACK_TOP_USER32 : STACK_TOP_USER64)
128 #define STACK_TOP_MAX STACK_TOP_USER64
132 #define STACK_TOP TASK_SIZE
133 #define STACK_TOP_MAX STACK_TOP
141 #define TS_FPROFFSET 0
142 #define TS_VSRLOWOFFSET 1
143 #define TS_FPR(i) fpr[i][TS_FPROFFSET]
147 unsigned long ksp_limit;
150 unsigned long ksp_vsid;
161 #ifdef CONFIG_PPC_ADV_DEBUG_REGS
186 #if CONFIG_PPC_ADV_DEBUG_IACS > 2
192 #if CONFIG_PPC_ADV_DEBUG_DVCS > 0
205 unsigned int align_ctl;
207 unsigned long start_tb;
208 unsigned long accum_tb;
209 #ifdef CONFIG_HAVE_HW_BREAKPOINT
221 #ifdef CONFIG_ALTIVEC
226 unsigned long vrsave;
234 unsigned long evr[32];
236 unsigned long spefscr;
239 #ifdef CONFIG_KVM_BOOK3S_32_HANDLER
240 void* kvm_shadow_vcpu;
242 #if defined(CONFIG_KVM) && defined(CONFIG_BOOKE)
251 #define ARCH_MIN_TASKALIGN 16
253 #define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack)
254 #define INIT_SP_LIMIT \
255 (_ALIGN_UP(sizeof(init_thread_info), 16) + (unsigned long) &init_stack)
258 #define SPEFSCR_INIT .spefscr = SPEFSCR_FINVE | SPEFSCR_FDBZE | SPEFSCR_FUNFE | SPEFSCR_FOVFE,
264 #define INIT_THREAD { \
266 .ksp_limit = INIT_SP_LIMIT, \
268 .pgdir = swapper_pg_dir, \
269 .fpexc_mode = MSR_FE0 | MSR_FE1, \
273 #define INIT_THREAD { \
275 .ksp_limit = INIT_SP_LIMIT, \
276 .regs = (struct pt_regs *)INIT_SP - 1, \
279 .fpscr = { .val = 0, }, \
287 #define thread_saved_pc(tsk) \
288 ((tsk)->thread.regs? (tsk)->thread.regs->nip: 0)
290 #define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.regs)
294 #define KSTK_EIP(tsk) ((tsk)->thread.regs? (tsk)->thread.regs->nip: 0)
295 #define KSTK_ESP(tsk) ((tsk)->thread.regs? (tsk)->thread.regs->gpr[1]: 0)
298 #define GET_FPEXC_CTL(tsk, adr) get_fpexc_mode((tsk), (adr))
299 #define SET_FPEXC_CTL(tsk, val) set_fpexc_mode((tsk), (val))
304 #define GET_ENDIAN(tsk, adr) get_endian((tsk), (adr))
305 #define SET_ENDIAN(tsk, val) set_endian((tsk), (val))
310 #define GET_UNALIGN_CTL(tsk, adr) get_unalign_ctl((tsk), (adr))
311 #define SET_UNALIGN_CTL(tsk, val) set_unalign_ctl((tsk), (val))
316 static inline unsigned int __unpack_fe01(
unsigned long msr_bits)
318 return ((msr_bits & MSR_FE0) >> 10) | ((msr_bits & MSR_FE1) >> 8);
321 static inline unsigned long __pack_fe01(
unsigned int fpmode)
323 return ((fpmode << 10) & MSR_FE0) | ((fpmode << 8) & MSR_FE1);
327 #define cpu_relax() do { HMT_low(); HMT_medium(); barrier(); } while (0)
329 #define cpu_relax() barrier()
339 #define ARCH_HAS_PREFETCH
340 #define ARCH_HAS_PREFETCHW
341 #define ARCH_HAS_SPINLOCK_PREFETCH
343 static inline void prefetch(
const void *
x)
348 __asm__ __volatile__ (
"dcbt 0,%0" : :
"r" (x));
351 static inline void prefetchw(
const void *x)
356 __asm__ __volatile__ (
"dcbtst 0,%0" : :
"r" (x));
359 #define spin_lock_prefetch(x) prefetchw(x)
362 #define HAVE_ARCH_PICK_MMAP_LAYOUT
366 static inline unsigned long get_clean_sp(
struct pt_regs *
regs,
int is_32)
371 sp = regs->
gpr[1] & 0x0ffffffff
UL;
378 static inline unsigned long get_clean_sp(
struct pt_regs *regs,
int is_32)
388 extern void power7_nap(
void);
390 #ifdef CONFIG_PSERIES_IDLE
398 extern void poweroff_now(
void);
400 extern void cvt_fd(
float *
from,
double *to);
401 extern void cvt_df(
double *
from,
float *to);
402 extern void _nmask_and_or_msr(
unsigned long nmask,
unsigned long or_val);
412 #define NET_IP_ALIGN 0