1
2
3
4
5
6
7#ifndef __ASM_PARISC_PROCESSOR_H
8#define __ASM_PARISC_PROCESSOR_H
9
10#ifndef __ASSEMBLY__
11#include <linux/threads.h>
12
13#include <asm/hardware.h>
14#include <asm/page.h>
15#include <asm/pdc.h>
16#include <asm/ptrace.h>
17#include <asm/types.h>
18#endif
19
20
21
22
23
24
25
26
27
28
29
30
31#define current_text_addr() ({ void *pc; __asm__("\n\tblr 0,%0\n\tnop":"=r" (pc)); pc; })
32
33#define TASK_SIZE (PAGE_OFFSET)
34#define TASK_UNMAPPED_BASE (TASK_SIZE / 3)
35
36#ifndef __ASSEMBLY__
37
38
39
40
41
42
43
44struct system_cpuinfo_parisc {
45 unsigned int cpu_count;
46 unsigned int cpu_hz;
47 unsigned int hversion;
48 unsigned int sversion;
49 enum cpu_type cpu_type;
50
51 struct {
52 struct pdc_model model;
53 struct pdc_model_cpuid versions;
54 struct pdc_model_cpuid cpuid;
55#if 0
56 struct pdc_model_caps caps;
57#endif
58 char sys_model_name[81];
59 } pdc;
60
61 char *model_name;
62 char *cpu_name;
63 char *family_name;
64};
65
66
67
68
69
70struct cpuinfo_parisc {
71 unsigned cpuid;
72
73 struct irq_region *region;
74
75 unsigned long it_value;
76 unsigned long it_delta;
77
78 unsigned long hpa;
79 unsigned long txn_addr;
80
81 unsigned long bh_count;
82 unsigned long irq_count;
83 unsigned long irq_max_cr16;
84};
85
86extern struct system_cpuinfo_parisc boot_cpu_data;
87extern struct cpuinfo_parisc cpu_data[NR_CPUS];
88#define current_cpu_data cpu_data[smp_processor_id()]
89
90extern void identify_cpu(struct cpuinfo_parisc *);
91
92#define EISA_bus 0
93#define EISA_bus__is_a_macro
94#define MCA_bus 0
95#define MCA_bus__is_a_macro
96
97typedef struct {
98 int seg;
99} mm_segment_t;
100
101struct thread_struct {
102 struct pt_regs regs;
103 unsigned long pg_tables;
104 unsigned long flags;
105};
106
107
108#define PARISC_KERNEL_DEATH (1UL << 31)
109
110#define INIT_THREAD { { \
111 { 0, 0, 0, 0, 0, 0, 0, 0, \
112 0, 0, 0, 0, 0, 0, 0, 0, \
113 0, 0, 0, 0, 0, 0, 0, 0, \
114 0, 0, 0, 0, 0, 0, 0, 0 }, \
115 { 0, 0, 0, 0, 0, 0, 0, 0, \
116 0, 0, 0, 0, 0, 0, 0, 0, \
117 0, 0, 0, 0, 0, 0, 0, 0, \
118 0, 0, 0, 0, 0, 0, 0, 0 }, \
119 { 0, 0, 0, 0, 0, 0, 0, 0 }, \
120 { 0, 0}, { 0, 0}, 0, 0, 0, 0 \
121 }, __pa((unsigned long) swapper_pg_dir) }
122
123
124
125
126
127extern inline unsigned long thread_saved_pc(struct thread_struct *t)
128{
129 return 0xabcdef;
130}
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191#define start_thread_som(regs, new_pc, new_sp) do { \
192 unsigned long *sp = (unsigned long *)new_sp; \
193 __u32 spaceid = (__u32)current->mm->context; \
194 unsigned long pc = (unsigned long)new_pc; \
195 \
196 pc |= 3; \
197 \
198 set_fs(USER_DS); \
199 regs->iasq[0] = spaceid; \
200 regs->iasq[1] = spaceid; \
201 regs->iaoq[0] = pc; \
202 regs->iaoq[1] = pc; \
203 regs->sr[2] = LINUX_GATEWAY_SPACE; \
204 regs->sr[3] = 0xffff; \
205 regs->sr[4] = spaceid; \
206 regs->sr[5] = spaceid; \
207 regs->sr[6] = spaceid; \
208 regs->sr[7] = spaceid; \
209 regs->gr[ 0] = USER_INIT_PSW; \
210 regs->gr[30] = ((new_sp)+63)&~63; \
211 regs->gr[31] = pc; \
212 \
213 get_user(regs->gr[26],&sp[0]); \
214 get_user(regs->gr[25],&sp[-1]); \
215 get_user(regs->gr[24],&sp[-2]); \
216 get_user(regs->gr[23],&sp[-3]); \
217 \
218 regs->cr30 = (u32) current; \
219} while(0)
220
221
222#define start_thread(regs, new_pc, new_sp) do { \
223 unsigned long *sp = (unsigned long *)new_sp; \
224 __u32 spaceid = (__u32)current->mm->context; \
225 unsigned long pc = (unsigned long)new_pc; \
226 \
227 pc |= 3; \
228 \
229 \
230 set_fs(USER_DS); \
231 regs->iasq[0] = spaceid; \
232 regs->iasq[1] = spaceid; \
233 regs->iaoq[0] = pc; \
234 regs->iaoq[1] = pc; \
235 regs->sr[2] = LINUX_GATEWAY_SPACE; \
236 regs->sr[3] = 0xffff; \
237 regs->sr[4] = spaceid; \
238 regs->sr[5] = spaceid; \
239 regs->sr[6] = spaceid; \
240 regs->sr[7] = spaceid; \
241 regs->gr[ 0] = USER_INIT_PSW; \
242 regs->fr[ 0] = 0LL; \
243 regs->fr[ 1] = 0LL; \
244 regs->fr[ 2] = 0LL; \
245 regs->fr[ 3] = 0LL; \
246 regs->gr[30] = ((current->mm->env_end)+63)&~63; \
247 regs->gr[31] = pc; \
248 \
249 get_user(regs->gr[25],&sp[0]); \
250 regs->gr[24] = (unsigned long) &sp[1]; \
251 regs->gr[23] = 0; \
252 \
253 regs->cr30 = (u32) current; \
254} while(0)
255
256#ifdef __LP64__
257
258
259
260
261
262
263
264
265
266
267
268
269#define start_thread32(regs, new_pc, new_sp) do { \
270 __u32 *sp = (__u32 *)new_sp; \
271 __u32 spaceid = (__u32)current->mm->context; \
272 __u32 pc = (__u32)new_pc; \
273 \
274 pc |= 3; \
275 \
276 set_fs(USER_DS); \
277 regs->iasq[0] = spaceid; \
278 regs->iasq[1] = spaceid; \
279 regs->iaoq[0] = pc; \
280 regs->iaoq[1] = pc; \
281 regs->sr[2] = LINUX_GATEWAY_SPACE; \
282 regs->sr[3] = 0xffff; \
283 regs->sr[4] = spaceid; \
284 regs->sr[5] = spaceid; \
285 regs->sr[6] = spaceid; \
286 regs->sr[7] = spaceid; \
287 regs->gr[ 0] = USER_INIT_PSW; \
288 regs->fr[ 0] = 0LL; \
289 regs->fr[ 1] = 0LL; \
290 regs->fr[ 2] = 0LL; \
291 regs->fr[ 3] = 0LL; \
292 regs->gr[30] = ((current->mm->env_end)+63)&~63; \
293 regs->gr[31] = pc; \
294 \
295 get_user(regs->gr[25],&sp[0]); \
296 regs->gr[24] = (unsigned long) &sp[1]; \
297 regs->gr[23] = 0; \
298 \
299 regs->cr30 = (u32) current; \
300} while(0)
301
302#endif
303
304struct task_struct;
305
306
307extern void release_thread(struct task_struct *);
308extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
309
310#define copy_segments(tsk, mm) do { } while (0)
311#define release_segments(mm) do { } while (0)
312
313extern inline unsigned long get_wchan(struct task_struct *p)
314{
315 return 0xdeadbeef;
316}
317
318#define KSTK_EIP(tsk) (0xdeadbeef)
319#define KSTK_ESP(tsk) (0xdeadbeef)
320
321
322
323
324#endif
325
326#define THREAD_SIZE (4*PAGE_SIZE)
327
328#define alloc_task_struct() \
329 ((struct task_struct *) __get_free_pages(GFP_KERNEL,2))
330#define free_task_struct(p) free_pages((unsigned long)(p),2)
331#define get_task_struct(tsk) atomic_inc(&virt_to_page(tsk)->count)
332
333#define init_task (init_task_union.task)
334#define init_stack (init_task_union.stack)
335
336#define cpu_relax() do { } while (0)
337
338
339#endif
340