2 #ifndef __ASM_PPC_PROCESSOR_H
3 #define __ASM_PPC_PROCESSOR_H
6 * Default implementation of macro that returns current
7 * instruction pointer ("program counter").
9 #define current_text_addr() ({ __label__ _l; _l: &&_l;})
11 #include <linux/config.h>
12 #include <linux/stringify.h>
14 #include <asm/ptrace.h>
15 #include <asm/types.h>
16 #include <asm/mpc8xx.h>
19 /* We only need to define a new _MACH_xxx for machines which are part of
20 * a configuration which supports more than one type of different machine.
21 * This is currently limited to CONFIG_PPC_MULTIPLATFORM and CHRP/PReP/PMac.
24 #define _MACH_prep 0x00000001
25 #define _MACH_Pmac 0x00000002 /* pmac or pmac clone (non-chrp) */
26 #define _MACH_chrp 0x00000004 /* chrp machine */
28 /* see residual.h for these */
29 #define _PREP_Motorola 0x01 /* motorola prep */
30 #define _PREP_Firm 0x02 /* firmworks prep */
31 #define _PREP_IBM 0x00 /* ibm prep */
32 #define _PREP_Bull 0x03 /* bull prep */
34 /* these are arbitrary */
35 #define _CHRP_Motorola 0x04 /* motorola chrp, the cobra */
36 #define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */
39 .stabs __stringify(n:F-1),N_FUN,0,0,n;\
44 * this is the minimum allowable io space due to the location
45 * of the io areas on prep (first one at 0x80000000) but
46 * as soon as I get around to remapping the io areas with the BATs
47 * to match the mac we can raise this. -- Cort
49 #define TASK_SIZE (CONFIG_TASK_SIZE)
52 #ifdef CONFIG_PPC_MULTIPLATFORM
55 /* what kind of prep workstation we are */
56 extern int _prep_type;
59 * This is used to identify the board type from a given PReP board
60 * vendor. Board revision is also made available.
62 extern unsigned char ucSystemType;
63 extern unsigned char ucBoardRev;
64 extern unsigned char ucBoardRevMaj, ucBoardRevMin;
67 #endif /* CONFIG_PPC_MULTIPLATFORM */
70 void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp);
71 void release_thread(struct task_struct *);
73 /* Prepare to copy thread state - unlazy all lazy status */
74 extern void prepare_to_copy(struct task_struct *tsk);
77 * Create a new kernel thread.
79 extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
85 #define MCA_bus__is_a_macro
87 /* Lazy FPU handling on uni-processor */
88 extern struct task_struct *last_task_used_math;
89 extern struct task_struct *last_task_used_altivec;
90 extern struct task_struct *last_task_used_spe;
92 /* This decides where the kernel will search for a free chunk of vm
93 * space during mmap's.
95 #define TASK_UNMAPPED_BASE (TASK_SIZE / 8 * 3)
101 struct thread_struct {
102 unsigned long ksp; /* Kernel stack pointer */
103 struct pt_regs *regs; /* Pointer to saved register state */
104 mm_segment_t fs; /* for get_fs() validation */
105 void *pgdir; /* root of page-table tree */
106 int fpexc_mode; /* floating-point exception mode */
107 signed long last_syscall;
108 #if defined(CONFIG_4xx) || defined (CONFIG_BOOKE)
109 unsigned long dbcr0; /* debug control register values */
112 double fpr[32]; /* Complete floating point set */
113 unsigned long fpscr_pad; /* fpr ... fpscr must be contiguous */
114 unsigned long fpscr; /* Floating point status */
115 #ifdef CONFIG_ALTIVEC
116 /* Complete AltiVec register set */
117 vector128 vr[32] __attribute((aligned(16)));
119 vector128 vscr __attribute((aligned(16)));
120 unsigned long vrsave;
121 int used_vr; /* set if process has used altivec */
122 #endif /* CONFIG_ALTIVEC */
124 unsigned long evr[32]; /* upper 32-bits of SPE regs */
125 u64 acc; /* Accumulator */
126 unsigned long spefscr; /* SPE & eFP status */
127 int used_spe; /* set if process has used spe */
128 #endif /* CONFIG_SPE */
131 #define ARCH_MIN_TASKALIGN 16
133 #define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack)
135 #define INIT_THREAD { \
138 .pgdir = swapper_pg_dir, \
139 .fpexc_mode = MSR_FE0 | MSR_FE1, \
143 * Return saved PC of a blocked thread. For now, this is the "user" PC
145 #define thread_saved_pc(tsk) \
146 ((tsk)->thread.regs? (tsk)->thread.regs->nip: 0)
148 unsigned long get_wchan(struct task_struct *p);
150 #define KSTK_EIP(tsk) ((tsk)->thread.regs? (tsk)->thread.regs->nip: 0)
151 #define KSTK_ESP(tsk) ((tsk)->thread.regs? (tsk)->thread.regs->gpr[1]: 0)
153 /* Get/set floating-point exception mode */
154 #define GET_FPEXC_CTL(tsk, adr) get_fpexc_mode((tsk), (adr))
155 #define SET_FPEXC_CTL(tsk, val) set_fpexc_mode((tsk), (val))
157 extern int get_fpexc_mode(struct task_struct *tsk, unsigned long adr);
158 extern int set_fpexc_mode(struct task_struct *tsk, unsigned int val);
160 static inline unsigned int __unpack_fe01(unsigned int msr_bits)
162 return ((msr_bits & MSR_FE0) >> 10) | ((msr_bits & MSR_FE1) >> 8);
165 static inline unsigned int __pack_fe01(unsigned int fpmode)
167 return ((fpmode << 10) & MSR_FE0) | ((fpmode << 8) & MSR_FE1);
170 /* in process.c - for early bootup debug -- Cort */
171 int ll_printk(const char *, ...);
172 void ll_puts(const char *);
175 void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);
177 #define have_of (_machine == _MACH_chrp || _machine == _MACH_Pmac)
179 #define cpu_relax() barrier()
184 #define ARCH_HAS_PREFETCH
185 #define ARCH_HAS_PREFETCHW
186 #define ARCH_HAS_SPINLOCK_PREFETCH
188 extern inline void prefetch(const void *x)
190 __asm__ __volatile__ ("dcbt 0,%0" : : "r" (x));
193 extern inline void prefetchw(const void *x)
195 __asm__ __volatile__ ("dcbtst 0,%0" : : "r" (x));
198 #define spin_lock_prefetch(x) prefetchw(x)
200 extern int emulate_altivec(struct pt_regs *regs);
202 #endif /* !__ASSEMBLY__ */
204 #endif /* __ASM_PPC_PROCESSOR_H */
205 #endif /* __KERNEL__ */