1#ifdef __KERNEL__
2#ifndef __ASM_PPC_PROCESSOR_H
3#define __ASM_PPC_PROCESSOR_H
4
5
6
7
8
9#define current_text_addr() ({ __label__ _l; _l: &&_l;})
10
11#include <linux/config.h>
12#include <linux/stringify.h>
13
14#include <asm/ptrace.h>
15#include <asm/types.h>
16#include <asm/mpc8xx.h>
17#include <asm/reg.h>
18
19
20
21
22
23
24#define _MACH_prep 0x00000001
25#define _MACH_Pmac 0x00000002
26#define _MACH_chrp 0x00000004
27
28
29#define _PREP_Motorola 0x01
30#define _PREP_Firm 0x02
31#define _PREP_IBM 0x00
32#define _PREP_Bull 0x03
33
34
35#define _CHRP_Motorola 0x04
36#define _CHRP_IBM 0x05
37
38#define _GLOBAL(n)\
39 .stabs __stringify(n:F-1),N_FUN,0,0,n;\
40 .globl n;\
41n:
42
43
44
45
46
47
48
49#define TASK_SIZE (CONFIG_TASK_SIZE)
50
51#ifndef __ASSEMBLY__
52#ifdef CONFIG_PPC_MULTIPLATFORM
53extern int _machine;
54
55
56extern int _prep_type;
57
58
59
60
61
62extern unsigned char ucSystemType;
63extern unsigned char ucBoardRev;
64extern unsigned char ucBoardRevMaj, ucBoardRevMin;
65#else
66#define _machine 0
67#endif
68
69struct task_struct;
70void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp);
71void release_thread(struct task_struct *);
72
73
74extern void prepare_to_copy(struct task_struct *tsk);
75
76
77
78
79extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
80
81
82
83
84#define MCA_bus 0
85#define MCA_bus__is_a_macro
86
87
88extern struct task_struct *last_task_used_math;
89extern struct task_struct *last_task_used_altivec;
90extern struct task_struct *last_task_used_spe;
91
92
93
94
95#define TASK_UNMAPPED_BASE (TASK_SIZE / 8 * 3)
96
97typedef struct {
98 unsigned long seg;
99} mm_segment_t;
100
101struct thread_struct {
102 unsigned long ksp;
103 struct pt_regs *regs;
104 mm_segment_t fs;
105 void *pgdir;
106 int fpexc_mode;
107 signed long last_syscall;
108#if defined(CONFIG_4xx) || defined (CONFIG_BOOKE)
109 unsigned long dbcr0;
110 unsigned long dbcr1;
111#endif
112 double fpr[32];
113 unsigned long fpscr_pad;
114 unsigned long fpscr;
115#ifdef CONFIG_ALTIVEC
116
117 vector128 vr[32] __attribute((aligned(16)));
118
119 vector128 vscr __attribute((aligned(16)));
120 unsigned long vrsave;
121 int used_vr;
122#endif
123#ifdef CONFIG_SPE
124 unsigned long evr[32];
125 u64 acc;
126 unsigned long spefscr;
127 int used_spe;
128#endif
129};
130
131#define ARCH_MIN_TASKALIGN 16
132
133#define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack)
134
135#define INIT_THREAD { \
136 .ksp = INIT_SP, \
137 .fs = KERNEL_DS, \
138 .pgdir = swapper_pg_dir, \
139 .fpexc_mode = MSR_FE0 | MSR_FE1, \
140}
141
142
143
144
145#define thread_saved_pc(tsk) \
146 ((tsk)->thread.regs? (tsk)->thread.regs->nip: 0)
147
148unsigned long get_wchan(struct task_struct *p);
149
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)
152
153
154#define GET_FPEXC_CTL(tsk, adr) get_fpexc_mode((tsk), (adr))
155#define SET_FPEXC_CTL(tsk, val) set_fpexc_mode((tsk), (val))
156
157extern int get_fpexc_mode(struct task_struct *tsk, unsigned long adr);
158extern int set_fpexc_mode(struct task_struct *tsk, unsigned int val);
159
160static inline unsigned int __unpack_fe01(unsigned int msr_bits)
161{
162 return ((msr_bits & MSR_FE0) >> 10) | ((msr_bits & MSR_FE1) >> 8);
163}
164
165static inline unsigned int __pack_fe01(unsigned int fpmode)
166{
167 return ((fpmode << 10) & MSR_FE0) | ((fpmode << 8) & MSR_FE1);
168}
169
170
171int ll_printk(const char *, ...);
172void ll_puts(const char *);
173
174
175void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);
176
177#define have_of (_machine == _MACH_chrp || _machine == _MACH_Pmac)
178
179#define cpu_relax() barrier()
180
181
182
183
184#define ARCH_HAS_PREFETCH
185#define ARCH_HAS_PREFETCHW
186#define ARCH_HAS_SPINLOCK_PREFETCH
187
188extern inline void prefetch(const void *x)
189{
190 __asm__ __volatile__ ("dcbt 0,%0" : : "r" (x));
191}
192
193extern inline void prefetchw(const void *x)
194{
195 __asm__ __volatile__ ("dcbtst 0,%0" : : "r" (x));
196}
197
198#define spin_lock_prefetch(x) prefetchw(x)
199
200extern int emulate_altivec(struct pt_regs *regs);
201
202#endif
203
204#endif
205#endif
206