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 #ifdef CONFIG_PPC_MULTIPLATFORM
47 /* what kind of prep workstation we are */
48 extern int _prep_type;
51 * This is used to identify the board type from a given PReP board
52 * vendor. Board revision is also made available.
54 extern unsigned char ucSystemType;
55 extern unsigned char ucBoardRev;
56 extern unsigned char ucBoardRevMaj, ucBoardRevMin;
59 #endif /* CONFIG_PPC_MULTIPLATFORM */
62 void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp);
63 void release_thread(struct task_struct *);
65 /* Prepare to copy thread state - unlazy all lazy status */
66 extern void prepare_to_copy(struct task_struct *tsk);
69 * Create a new kernel thread.
71 extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
77 #define MCA_bus__is_a_macro
79 /* Lazy FPU handling on uni-processor */
80 extern struct task_struct *last_task_used_math;
81 extern struct task_struct *last_task_used_altivec;
84 * this is the minimum allowable io space due to the location
85 * of the io areas on prep (first one at 0x80000000) but
86 * as soon as I get around to remapping the io areas with the BATs
87 * to match the mac we can raise this. -- Cort
89 #define TASK_SIZE (CONFIG_TASK_SIZE)
91 /* This decides where the kernel will search for a free chunk of vm
92 * space during mmap's.
94 #define TASK_UNMAPPED_BASE (TASK_SIZE / 8 * 3)
100 struct thread_struct {
101 unsigned long ksp; /* Kernel stack pointer */
102 struct pt_regs *regs; /* Pointer to saved register state */
103 mm_segment_t fs; /* for get_fs() validation */
104 void *pgdir; /* root of page-table tree */
105 int fpexc_mode; /* floating-point exception mode */
106 signed long last_syscall;
108 unsigned long dbcr0; /* debug control register values */
111 double fpr[32]; /* Complete floating point set */
112 unsigned long fpscr_pad; /* fpr ... fpscr must be contiguous */
113 unsigned long fpscr; /* Floating point status */
114 #ifdef CONFIG_ALTIVEC
115 /* Complete AltiVec register set */
116 vector128 vr[32] __attribute((aligned(16)));
118 vector128 vscr __attribute((aligned(16)));
119 unsigned long vrsave;
120 int used_vr; /* set if process has used altivec */
121 #endif /* CONFIG_ALTIVEC */
124 #define ARCH_MIN_TASKALIGN 16
126 #define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack)
128 #define INIT_THREAD { \
131 .pgdir = swapper_pg_dir, \
132 .fpexc_mode = MSR_FE0 | MSR_FE1, \
136 * Return saved PC of a blocked thread. For now, this is the "user" PC
138 #define thread_saved_pc(tsk) \
139 ((tsk)->thread.regs? (tsk)->thread.regs->nip: 0)
141 unsigned long get_wchan(struct task_struct *p);
143 #define KSTK_EIP(tsk) ((tsk)->thread.regs? (tsk)->thread.regs->nip: 0)
144 #define KSTK_ESP(tsk) ((tsk)->thread.regs? (tsk)->thread.regs->gpr[1]: 0)
146 /* Get/set floating-point exception mode */
147 #define GET_FPEXC_CTL(tsk, adr) get_fpexc_mode((tsk), (adr))
148 #define SET_FPEXC_CTL(tsk, val) set_fpexc_mode((tsk), (val))
150 extern int get_fpexc_mode(struct task_struct *tsk, unsigned long adr);
151 extern int set_fpexc_mode(struct task_struct *tsk, unsigned int val);
153 static inline unsigned int __unpack_fe01(unsigned int msr_bits)
155 return ((msr_bits & MSR_FE0) >> 10) | ((msr_bits & MSR_FE1) >> 8);
158 static inline unsigned int __pack_fe01(unsigned int fpmode)
160 return ((fpmode << 10) & MSR_FE0) | ((fpmode << 8) & MSR_FE1);
163 /* in process.c - for early bootup debug -- Cort */
164 int ll_printk(const char *, ...);
165 void ll_puts(const char *);
168 void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);
170 #define have_of (_machine == _MACH_chrp || _machine == _MACH_Pmac)
172 #define cpu_relax() barrier()
177 #define ARCH_HAS_PREFETCH
178 #define ARCH_HAS_PREFETCHW
179 #define ARCH_HAS_SPINLOCK_PREFETCH
181 extern inline void prefetch(const void *x)
183 __asm__ __volatile__ ("dcbt 0,%0" : : "r" (x));
186 extern inline void prefetchw(const void *x)
188 __asm__ __volatile__ ("dcbtst 0,%0" : : "r" (x));
191 #define spin_lock_prefetch(x) prefetchw(x)
193 #endif /* !__ASSEMBLY__ */
195 #endif /* __ASM_PPC_PROCESSOR_H */
196 #endif /* __KERNEL__ */