diff options
Diffstat (limited to 'include/asm-m32r')
-rw-r--r-- | include/asm-m32r/a.out.h | 7 | ||||
-rw-r--r-- | include/asm-m32r/delay.h | 2 | ||||
-rw-r--r-- | include/asm-m32r/elf.h | 2 | ||||
-rw-r--r-- | include/asm-m32r/irq.h | 2 | ||||
-rw-r--r-- | include/asm-m32r/local.h | 362 | ||||
-rw-r--r-- | include/asm-m32r/m32700ut/m32700ut_pld.h | 4 | ||||
-rw-r--r-- | include/asm-m32r/page.h | 3 | ||||
-rw-r--r-- | include/asm-m32r/param.h | 2 | ||||
-rw-r--r-- | include/asm-m32r/pgalloc.h | 18 | ||||
-rw-r--r-- | include/asm-m32r/posix_types.h | 8 | ||||
-rw-r--r-- | include/asm-m32r/processor.h | 5 | ||||
-rw-r--r-- | include/asm-m32r/system.h | 115 | ||||
-rw-r--r-- | include/asm-m32r/unistd.h | 2 | ||||
-rw-r--r-- | include/asm-m32r/user.h | 2 |
14 files changed, 487 insertions, 47 deletions
diff --git a/include/asm-m32r/a.out.h b/include/asm-m32r/a.out.h index 6a1b5d42f328..ab150f5c1666 100644 --- a/include/asm-m32r/a.out.h +++ b/include/asm-m32r/a.out.h | |||
@@ -17,11 +17,4 @@ struct exec | |||
17 | #define N_DRSIZE(a) ((a).a_drsize) | 17 | #define N_DRSIZE(a) ((a).a_drsize) |
18 | #define N_SYMSIZE(a) ((a).a_syms) | 18 | #define N_SYMSIZE(a) ((a).a_syms) |
19 | 19 | ||
20 | #ifdef __KERNEL__ | ||
21 | |||
22 | #define STACK_TOP TASK_SIZE | ||
23 | #define STACK_TOP_MAX STACK_TOP | ||
24 | |||
25 | #endif | ||
26 | |||
27 | #endif /* _ASM_M32R_A_OUT_H */ | 20 | #endif /* _ASM_M32R_A_OUT_H */ |
diff --git a/include/asm-m32r/delay.h b/include/asm-m32r/delay.h index 164448d23850..9dd9e999ea69 100644 --- a/include/asm-m32r/delay.h +++ b/include/asm-m32r/delay.h | |||
@@ -12,7 +12,7 @@ extern void __bad_ndelay(void); | |||
12 | 12 | ||
13 | extern void __udelay(unsigned long usecs); | 13 | extern void __udelay(unsigned long usecs); |
14 | extern void __ndelay(unsigned long nsecs); | 14 | extern void __ndelay(unsigned long nsecs); |
15 | extern void __const_udelay(unsigned long usecs); | 15 | extern void __const_udelay(unsigned long xloops); |
16 | extern void __delay(unsigned long loops); | 16 | extern void __delay(unsigned long loops); |
17 | 17 | ||
18 | #define udelay(n) (__builtin_constant_p(n) ? \ | 18 | #define udelay(n) (__builtin_constant_p(n) ? \ |
diff --git a/include/asm-m32r/elf.h b/include/asm-m32r/elf.h index bbee8b25d175..67bcd77494a5 100644 --- a/include/asm-m32r/elf.h +++ b/include/asm-m32r/elf.h | |||
@@ -129,8 +129,6 @@ typedef elf_fpreg_t elf_fpregset_t; | |||
129 | intent than poking at uname or /proc/cpuinfo. */ | 129 | intent than poking at uname or /proc/cpuinfo. */ |
130 | #define ELF_PLATFORM (NULL) | 130 | #define ELF_PLATFORM (NULL) |
131 | 131 | ||
132 | #ifdef __KERNEL__ | ||
133 | #define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX) | 132 | #define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX) |
134 | #endif | ||
135 | 133 | ||
136 | #endif /* _ASM_M32R__ELF_H */ | 134 | #endif /* _ASM_M32R__ELF_H */ |
diff --git a/include/asm-m32r/irq.h b/include/asm-m32r/irq.h index 2f93f4743add..242028b4d86a 100644 --- a/include/asm-m32r/irq.h +++ b/include/asm-m32r/irq.h | |||
@@ -3,7 +3,7 @@ | |||
3 | #define _ASM_M32R_IRQ_H | 3 | #define _ASM_M32R_IRQ_H |
4 | 4 | ||
5 | 5 | ||
6 | #if defined(CONFIG_PLAT_M32700UT_Alpha) || defined(CONFIG_PLAT_USRV) | 6 | #if defined(CONFIG_PLAT_USRV) |
7 | /* | 7 | /* |
8 | * IRQ definitions for M32700UT | 8 | * IRQ definitions for M32700UT |
9 | * M32700 Chip: 64 interrupts | 9 | * M32700 Chip: 64 interrupts |
diff --git a/include/asm-m32r/local.h b/include/asm-m32r/local.h index def29d095740..22256d138630 100644 --- a/include/asm-m32r/local.h +++ b/include/asm-m32r/local.h | |||
@@ -1,6 +1,366 @@ | |||
1 | #ifndef __M32R_LOCAL_H | 1 | #ifndef __M32R_LOCAL_H |
2 | #define __M32R_LOCAL_H | 2 | #define __M32R_LOCAL_H |
3 | 3 | ||
4 | #include <asm-generic/local.h> | 4 | /* |
5 | * linux/include/asm-m32r/local.h | ||
6 | * | ||
7 | * M32R version: | ||
8 | * Copyright (C) 2001, 2002 Hitoshi Yamamoto | ||
9 | * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org> | ||
10 | * Copyright (C) 2007 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> | ||
11 | */ | ||
12 | |||
13 | #include <linux/percpu.h> | ||
14 | #include <asm/assembler.h> | ||
15 | #include <asm/system.h> | ||
16 | #include <asm/local.h> | ||
17 | |||
18 | /* | ||
19 | * Atomic operations that C can't guarantee us. Useful for | ||
20 | * resource counting etc.. | ||
21 | */ | ||
22 | |||
23 | /* | ||
24 | * Make sure gcc doesn't try to be clever and move things around | ||
25 | * on us. We need to use _exactly_ the address the user gave us, | ||
26 | * not some alias that contains the same information. | ||
27 | */ | ||
28 | typedef struct { volatile int counter; } local_t; | ||
29 | |||
30 | #define LOCAL_INIT(i) { (i) } | ||
31 | |||
32 | /** | ||
33 | * local_read - read local variable | ||
34 | * @l: pointer of type local_t | ||
35 | * | ||
36 | * Atomically reads the value of @l. | ||
37 | */ | ||
38 | #define local_read(l) ((l)->counter) | ||
39 | |||
40 | /** | ||
41 | * local_set - set local variable | ||
42 | * @l: pointer of type local_t | ||
43 | * @i: required value | ||
44 | * | ||
45 | * Atomically sets the value of @l to @i. | ||
46 | */ | ||
47 | #define local_set(l, i) (((l)->counter) = (i)) | ||
48 | |||
49 | /** | ||
50 | * local_add_return - add long to local variable and return it | ||
51 | * @i: long value to add | ||
52 | * @l: pointer of type local_t | ||
53 | * | ||
54 | * Atomically adds @i to @l and return (@i + @l). | ||
55 | */ | ||
56 | static inline long local_add_return(long i, local_t *l) | ||
57 | { | ||
58 | unsigned long flags; | ||
59 | long result; | ||
60 | |||
61 | local_irq_save(flags); | ||
62 | __asm__ __volatile__ ( | ||
63 | "# local_add_return \n\t" | ||
64 | DCACHE_CLEAR("%0", "r4", "%1") | ||
65 | "ld %0, @%1; \n\t" | ||
66 | "add %0, %2; \n\t" | ||
67 | "st %0, @%1; \n\t" | ||
68 | : "=&r" (result) | ||
69 | : "r" (&l->counter), "r" (i) | ||
70 | : "memory" | ||
71 | #ifdef CONFIG_CHIP_M32700_TS1 | ||
72 | , "r4" | ||
73 | #endif /* CONFIG_CHIP_M32700_TS1 */ | ||
74 | ); | ||
75 | local_irq_restore(flags); | ||
76 | |||
77 | return result; | ||
78 | } | ||
79 | |||
80 | /** | ||
81 | * local_sub_return - subtract long from local variable and return it | ||
82 | * @i: long value to subtract | ||
83 | * @l: pointer of type local_t | ||
84 | * | ||
85 | * Atomically subtracts @i from @l and return (@l - @i). | ||
86 | */ | ||
87 | static inline long local_sub_return(long i, local_t *l) | ||
88 | { | ||
89 | unsigned long flags; | ||
90 | long result; | ||
91 | |||
92 | local_irq_save(flags); | ||
93 | __asm__ __volatile__ ( | ||
94 | "# local_sub_return \n\t" | ||
95 | DCACHE_CLEAR("%0", "r4", "%1") | ||
96 | "ld %0, @%1; \n\t" | ||
97 | "sub %0, %2; \n\t" | ||
98 | "st %0, @%1; \n\t" | ||
99 | : "=&r" (result) | ||
100 | : "r" (&l->counter), "r" (i) | ||
101 | : "memory" | ||
102 | #ifdef CONFIG_CHIP_M32700_TS1 | ||
103 | , "r4" | ||
104 | #endif /* CONFIG_CHIP_M32700_TS1 */ | ||
105 | ); | ||
106 | local_irq_restore(flags); | ||
107 | |||
108 | return result; | ||
109 | } | ||
110 | |||
111 | /** | ||
112 | * local_add - add long to local variable | ||
113 | * @i: long value to add | ||
114 | * @l: pointer of type local_t | ||
115 | * | ||
116 | * Atomically adds @i to @l. | ||
117 | */ | ||
118 | #define local_add(i, l) ((void) local_add_return((i), (l))) | ||
119 | |||
120 | /** | ||
121 | * local_sub - subtract the local variable | ||
122 | * @i: long value to subtract | ||
123 | * @l: pointer of type local_t | ||
124 | * | ||
125 | * Atomically subtracts @i from @l. | ||
126 | */ | ||
127 | #define local_sub(i, l) ((void) local_sub_return((i), (l))) | ||
128 | |||
129 | /** | ||
130 | * local_sub_and_test - subtract value from variable and test result | ||
131 | * @i: integer value to subtract | ||
132 | * @l: pointer of type local_t | ||
133 | * | ||
134 | * Atomically subtracts @i from @l and returns | ||
135 | * true if the result is zero, or false for all | ||
136 | * other cases. | ||
137 | */ | ||
138 | #define local_sub_and_test(i, l) (local_sub_return((i), (l)) == 0) | ||
139 | |||
140 | /** | ||
141 | * local_inc_return - increment local variable and return it | ||
142 | * @l: pointer of type local_t | ||
143 | * | ||
144 | * Atomically increments @l by 1 and returns the result. | ||
145 | */ | ||
146 | static inline long local_inc_return(local_t *l) | ||
147 | { | ||
148 | unsigned long flags; | ||
149 | long result; | ||
150 | |||
151 | local_irq_save(flags); | ||
152 | __asm__ __volatile__ ( | ||
153 | "# local_inc_return \n\t" | ||
154 | DCACHE_CLEAR("%0", "r4", "%1") | ||
155 | "ld %0, @%1; \n\t" | ||
156 | "addi %0, #1; \n\t" | ||
157 | "st %0, @%1; \n\t" | ||
158 | : "=&r" (result) | ||
159 | : "r" (&l->counter) | ||
160 | : "memory" | ||
161 | #ifdef CONFIG_CHIP_M32700_TS1 | ||
162 | , "r4" | ||
163 | #endif /* CONFIG_CHIP_M32700_TS1 */ | ||
164 | ); | ||
165 | local_irq_restore(flags); | ||
166 | |||
167 | return result; | ||
168 | } | ||
169 | |||
170 | /** | ||
171 | * local_dec_return - decrement local variable and return it | ||
172 | * @l: pointer of type local_t | ||
173 | * | ||
174 | * Atomically decrements @l by 1 and returns the result. | ||
175 | */ | ||
176 | static inline long local_dec_return(local_t *l) | ||
177 | { | ||
178 | unsigned long flags; | ||
179 | long result; | ||
180 | |||
181 | local_irq_save(flags); | ||
182 | __asm__ __volatile__ ( | ||
183 | "# local_dec_return \n\t" | ||
184 | DCACHE_CLEAR("%0", "r4", "%1") | ||
185 | "ld %0, @%1; \n\t" | ||
186 | "addi %0, #-1; \n\t" | ||
187 | "st %0, @%1; \n\t" | ||
188 | : "=&r" (result) | ||
189 | : "r" (&l->counter) | ||
190 | : "memory" | ||
191 | #ifdef CONFIG_CHIP_M32700_TS1 | ||
192 | , "r4" | ||
193 | #endif /* CONFIG_CHIP_M32700_TS1 */ | ||
194 | ); | ||
195 | local_irq_restore(flags); | ||
196 | |||
197 | return result; | ||
198 | } | ||
199 | |||
200 | /** | ||
201 | * local_inc - increment local variable | ||
202 | * @l: pointer of type local_t | ||
203 | * | ||
204 | * Atomically increments @l by 1. | ||
205 | */ | ||
206 | #define local_inc(l) ((void)local_inc_return(l)) | ||
207 | |||
208 | /** | ||
209 | * local_dec - decrement local variable | ||
210 | * @l: pointer of type local_t | ||
211 | * | ||
212 | * Atomically decrements @l by 1. | ||
213 | */ | ||
214 | #define local_dec(l) ((void)local_dec_return(l)) | ||
215 | |||
216 | /** | ||
217 | * local_inc_and_test - increment and test | ||
218 | * @l: pointer of type local_t | ||
219 | * | ||
220 | * Atomically increments @l by 1 | ||
221 | * and returns true if the result is zero, or false for all | ||
222 | * other cases. | ||
223 | */ | ||
224 | #define local_inc_and_test(l) (local_inc_return(l) == 0) | ||
225 | |||
226 | /** | ||
227 | * local_dec_and_test - decrement and test | ||
228 | * @l: pointer of type local_t | ||
229 | * | ||
230 | * Atomically decrements @l by 1 and | ||
231 | * returns true if the result is 0, or false for all | ||
232 | * other cases. | ||
233 | */ | ||
234 | #define local_dec_and_test(l) (local_dec_return(l) == 0) | ||
235 | |||
236 | /** | ||
237 | * local_add_negative - add and test if negative | ||
238 | * @l: pointer of type local_t | ||
239 | * @i: integer value to add | ||
240 | * | ||
241 | * Atomically adds @i to @l and returns true | ||
242 | * if the result is negative, or false when | ||
243 | * result is greater than or equal to zero. | ||
244 | */ | ||
245 | #define local_add_negative(i, l) (local_add_return((i), (l)) < 0) | ||
246 | |||
247 | #define local_cmpxchg(l, o, n) (cmpxchg_local(&((l)->counter), (o), (n))) | ||
248 | #define local_xchg(v, new) (xchg_local(&((l)->counter), new)) | ||
249 | |||
250 | /** | ||
251 | * local_add_unless - add unless the number is a given value | ||
252 | * @l: pointer of type local_t | ||
253 | * @a: the amount to add to l... | ||
254 | * @u: ...unless l is equal to u. | ||
255 | * | ||
256 | * Atomically adds @a to @l, so long as it was not @u. | ||
257 | * Returns non-zero if @l was not @u, and zero otherwise. | ||
258 | */ | ||
259 | static inline int local_add_unless(local_t *l, long a, long u) | ||
260 | { | ||
261 | long c, old; | ||
262 | c = local_read(l); | ||
263 | for (;;) { | ||
264 | if (unlikely(c == (u))) | ||
265 | break; | ||
266 | old = local_cmpxchg((l), c, c + (a)); | ||
267 | if (likely(old == c)) | ||
268 | break; | ||
269 | c = old; | ||
270 | } | ||
271 | return c != (u); | ||
272 | } | ||
273 | |||
274 | #define local_inc_not_zero(l) local_add_unless((l), 1, 0) | ||
275 | |||
276 | static inline void local_clear_mask(unsigned long mask, local_t *addr) | ||
277 | { | ||
278 | unsigned long flags; | ||
279 | unsigned long tmp; | ||
280 | |||
281 | local_irq_save(flags); | ||
282 | __asm__ __volatile__ ( | ||
283 | "# local_clear_mask \n\t" | ||
284 | DCACHE_CLEAR("%0", "r5", "%1") | ||
285 | "ld %0, @%1; \n\t" | ||
286 | "and %0, %2; \n\t" | ||
287 | "st %0, @%1; \n\t" | ||
288 | : "=&r" (tmp) | ||
289 | : "r" (addr), "r" (~mask) | ||
290 | : "memory" | ||
291 | #ifdef CONFIG_CHIP_M32700_TS1 | ||
292 | , "r5" | ||
293 | #endif /* CONFIG_CHIP_M32700_TS1 */ | ||
294 | ); | ||
295 | local_irq_restore(flags); | ||
296 | } | ||
297 | |||
298 | static inline void local_set_mask(unsigned long mask, local_t *addr) | ||
299 | { | ||
300 | unsigned long flags; | ||
301 | unsigned long tmp; | ||
302 | |||
303 | local_irq_save(flags); | ||
304 | __asm__ __volatile__ ( | ||
305 | "# local_set_mask \n\t" | ||
306 | DCACHE_CLEAR("%0", "r5", "%1") | ||
307 | "ld %0, @%1; \n\t" | ||
308 | "or %0, %2; \n\t" | ||
309 | "st %0, @%1; \n\t" | ||
310 | : "=&r" (tmp) | ||
311 | : "r" (addr), "r" (mask) | ||
312 | : "memory" | ||
313 | #ifdef CONFIG_CHIP_M32700_TS1 | ||
314 | , "r5" | ||
315 | #endif /* CONFIG_CHIP_M32700_TS1 */ | ||
316 | ); | ||
317 | local_irq_restore(flags); | ||
318 | } | ||
319 | |||
320 | /* Atomic operations are already serializing on m32r */ | ||
321 | #define smp_mb__before_local_dec() barrier() | ||
322 | #define smp_mb__after_local_dec() barrier() | ||
323 | #define smp_mb__before_local_inc() barrier() | ||
324 | #define smp_mb__after_local_inc() barrier() | ||
325 | |||
326 | /* Use these for per-cpu local_t variables: on some archs they are | ||
327 | * much more efficient than these naive implementations. Note they take | ||
328 | * a variable, not an address. | ||
329 | */ | ||
330 | |||
331 | #define __local_inc(l) ((l)->a.counter++) | ||
332 | #define __local_dec(l) ((l)->a.counter++) | ||
333 | #define __local_add(i, l) ((l)->a.counter += (i)) | ||
334 | #define __local_sub(i, l) ((l)->a.counter -= (i)) | ||
335 | |||
336 | /* Use these for per-cpu local_t variables: on some archs they are | ||
337 | * much more efficient than these naive implementations. Note they take | ||
338 | * a variable, not an address. | ||
339 | */ | ||
340 | |||
341 | /* Need to disable preemption for the cpu local counters otherwise we could | ||
342 | still access a variable of a previous CPU in a non local way. */ | ||
343 | #define cpu_local_wrap_v(l) \ | ||
344 | ({ local_t res__; \ | ||
345 | preempt_disable(); \ | ||
346 | res__ = (l); \ | ||
347 | preempt_enable(); \ | ||
348 | res__; }) | ||
349 | #define cpu_local_wrap(l) \ | ||
350 | ({ preempt_disable(); \ | ||
351 | l; \ | ||
352 | preempt_enable(); }) \ | ||
353 | |||
354 | #define cpu_local_read(l) cpu_local_wrap_v(local_read(&__get_cpu_var(l))) | ||
355 | #define cpu_local_set(l, i) cpu_local_wrap(local_set(&__get_cpu_var(l), (i))) | ||
356 | #define cpu_local_inc(l) cpu_local_wrap(local_inc(&__get_cpu_var(l))) | ||
357 | #define cpu_local_dec(l) cpu_local_wrap(local_dec(&__get_cpu_var(l))) | ||
358 | #define cpu_local_add(i, l) cpu_local_wrap(local_add((i), &__get_cpu_var(l))) | ||
359 | #define cpu_local_sub(i, l) cpu_local_wrap(local_sub((i), &__get_cpu_var(l))) | ||
360 | |||
361 | #define __cpu_local_inc(l) cpu_local_inc(l) | ||
362 | #define __cpu_local_dec(l) cpu_local_dec(l) | ||
363 | #define __cpu_local_add(i, l) cpu_local_add((i), (l)) | ||
364 | #define __cpu_local_sub(i, l) cpu_local_sub((i), (l)) | ||
5 | 365 | ||
6 | #endif /* __M32R_LOCAL_H */ | 366 | #endif /* __M32R_LOCAL_H */ |
diff --git a/include/asm-m32r/m32700ut/m32700ut_pld.h b/include/asm-m32r/m32700ut/m32700ut_pld.h index d39121279a1a..57623beb44cb 100644 --- a/include/asm-m32r/m32700ut/m32700ut_pld.h +++ b/include/asm-m32r/m32700ut/m32700ut_pld.h | |||
@@ -13,9 +13,7 @@ | |||
13 | * this archive for more details. | 13 | * this archive for more details. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #if defined(CONFIG_PLAT_M32700UT_Alpha) | 16 | #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) |
17 | #define PLD_PLAT_BASE 0x08c00000 | ||
18 | #elif defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) | ||
19 | #define PLD_PLAT_BASE 0x04c00000 | 17 | #define PLD_PLAT_BASE 0x04c00000 |
20 | #else | 18 | #else |
21 | #error "no platform configuration" | 19 | #error "no platform configuration" |
diff --git a/include/asm-m32r/page.h b/include/asm-m32r/page.h index 04fd183a2c58..8a677f3fca68 100644 --- a/include/asm-m32r/page.h +++ b/include/asm-m32r/page.h | |||
@@ -6,7 +6,6 @@ | |||
6 | #define PAGE_SIZE (1UL << PAGE_SHIFT) | 6 | #define PAGE_SIZE (1UL << PAGE_SHIFT) |
7 | #define PAGE_MASK (~(PAGE_SIZE-1)) | 7 | #define PAGE_MASK (~(PAGE_SIZE-1)) |
8 | 8 | ||
9 | #ifdef __KERNEL__ | ||
10 | #ifndef __ASSEMBLY__ | 9 | #ifndef __ASSEMBLY__ |
11 | 10 | ||
12 | extern void clear_page(void *to); | 11 | extern void clear_page(void *to); |
@@ -29,6 +28,7 @@ typedef struct { unsigned long pgd; } pgd_t; | |||
29 | #define PTE_MASK PAGE_MASK | 28 | #define PTE_MASK PAGE_MASK |
30 | 29 | ||
31 | typedef struct { unsigned long pgprot; } pgprot_t; | 30 | typedef struct { unsigned long pgprot; } pgprot_t; |
31 | typedef struct page *pgtable_t; | ||
32 | 32 | ||
33 | #define pmd_val(x) ((x).pmd) | 33 | #define pmd_val(x) ((x).pmd) |
34 | #define pgd_val(x) ((x).pgd) | 34 | #define pgd_val(x) ((x).pgd) |
@@ -87,5 +87,4 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
87 | #include <asm-generic/memory_model.h> | 87 | #include <asm-generic/memory_model.h> |
88 | #include <asm-generic/page.h> | 88 | #include <asm-generic/page.h> |
89 | 89 | ||
90 | #endif /* __KERNEL__ */ | ||
91 | #endif /* _ASM_M32R_PAGE_H */ | 90 | #endif /* _ASM_M32R_PAGE_H */ |
diff --git a/include/asm-m32r/param.h b/include/asm-m32r/param.h index 3e14026e39cd..94c770196048 100644 --- a/include/asm-m32r/param.h +++ b/include/asm-m32r/param.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #define _ASM_M32R_PARAM_H | 2 | #define _ASM_M32R_PARAM_H |
3 | 3 | ||
4 | #ifdef __KERNEL__ | 4 | #ifdef __KERNEL__ |
5 | # define HZ 100 /* Internal kernel timer frequency */ | 5 | # define HZ CONFIG_HZ /* Internal kernel timer frequency */ |
6 | # define USER_HZ 100 /* .. some user interfaces are in "ticks" */ | 6 | # define USER_HZ 100 /* .. some user interfaces are in "ticks" */ |
7 | # define CLOCKS_PER_SEC (USER_HZ) /* like times() */ | 7 | # define CLOCKS_PER_SEC (USER_HZ) /* like times() */ |
8 | #endif | 8 | #endif |
diff --git a/include/asm-m32r/pgalloc.h b/include/asm-m32r/pgalloc.h index 943ba63c1ebc..f11a2b909cdb 100644 --- a/include/asm-m32r/pgalloc.h +++ b/include/asm-m32r/pgalloc.h | |||
@@ -9,10 +9,11 @@ | |||
9 | set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))) | 9 | set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))) |
10 | 10 | ||
11 | static __inline__ void pmd_populate(struct mm_struct *mm, pmd_t *pmd, | 11 | static __inline__ void pmd_populate(struct mm_struct *mm, pmd_t *pmd, |
12 | struct page *pte) | 12 | pgtable_t pte) |
13 | { | 13 | { |
14 | set_pmd(pmd, __pmd(_PAGE_TABLE + page_to_phys(pte))); | 14 | set_pmd(pmd, __pmd(_PAGE_TABLE + page_to_phys(pte))); |
15 | } | 15 | } |
16 | #define pmd_pgtable(pmd) pmd_page(pmd) | ||
16 | 17 | ||
17 | /* | 18 | /* |
18 | * Allocate and free page tables. | 19 | * Allocate and free page tables. |
@@ -24,7 +25,7 @@ static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm) | |||
24 | return pgd; | 25 | return pgd; |
25 | } | 26 | } |
26 | 27 | ||
27 | static __inline__ void pgd_free(pgd_t *pgd) | 28 | static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) |
28 | { | 29 | { |
29 | free_page((unsigned long)pgd); | 30 | free_page((unsigned long)pgd); |
30 | } | 31 | } |
@@ -37,26 +38,27 @@ static __inline__ pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | |||
37 | return pte; | 38 | return pte; |
38 | } | 39 | } |
39 | 40 | ||
40 | static __inline__ struct page *pte_alloc_one(struct mm_struct *mm, | 41 | static __inline__ pgtable_t pte_alloc_one(struct mm_struct *mm, |
41 | unsigned long address) | 42 | unsigned long address) |
42 | { | 43 | { |
43 | struct page *pte = alloc_page(GFP_KERNEL|__GFP_ZERO); | 44 | struct page *pte = alloc_page(GFP_KERNEL|__GFP_ZERO); |
44 | 45 | ||
45 | 46 | pgtable_page_ctor(pte); | |
46 | return pte; | 47 | return pte; |
47 | } | 48 | } |
48 | 49 | ||
49 | static __inline__ void pte_free_kernel(pte_t *pte) | 50 | static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) |
50 | { | 51 | { |
51 | free_page((unsigned long)pte); | 52 | free_page((unsigned long)pte); |
52 | } | 53 | } |
53 | 54 | ||
54 | static __inline__ void pte_free(struct page *pte) | 55 | static inline void pte_free(struct mm_struct *mm, pgtable_t pte) |
55 | { | 56 | { |
57 | pgtable_page_dtor(pte); | ||
56 | __free_page(pte); | 58 | __free_page(pte); |
57 | } | 59 | } |
58 | 60 | ||
59 | #define __pte_free_tlb(tlb, pte) pte_free((pte)) | 61 | #define __pte_free_tlb(tlb, pte) pte_free((tlb)->mm, (pte)) |
60 | 62 | ||
61 | /* | 63 | /* |
62 | * allocating and freeing a pmd is trivial: the 1-entry pmd is | 64 | * allocating and freeing a pmd is trivial: the 1-entry pmd is |
@@ -65,7 +67,7 @@ static __inline__ void pte_free(struct page *pte) | |||
65 | */ | 67 | */ |
66 | 68 | ||
67 | #define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); }) | 69 | #define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); }) |
68 | #define pmd_free(x) do { } while (0) | 70 | #define pmd_free(mm, x) do { } while (0) |
69 | #define __pmd_free_tlb(tlb, x) do { } while (0) | 71 | #define __pmd_free_tlb(tlb, x) do { } while (0) |
70 | #define pgd_populate(mm, pmd, pte) BUG() | 72 | #define pgd_populate(mm, pmd, pte) BUG() |
71 | 73 | ||
diff --git a/include/asm-m32r/posix_types.h b/include/asm-m32r/posix_types.h index 1caac65d208f..b309c5858637 100644 --- a/include/asm-m32r/posix_types.h +++ b/include/asm-m32r/posix_types.h | |||
@@ -39,14 +39,10 @@ typedef long long __kernel_loff_t; | |||
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | typedef struct { | 41 | typedef struct { |
42 | #if defined(__KERNEL__) || defined(__USE_ALL) | ||
43 | int val[2]; | 42 | int val[2]; |
44 | #else /* !defined(__KERNEL__) && !defined(__USE_ALL) */ | ||
45 | int __val[2]; | ||
46 | #endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */ | ||
47 | } __kernel_fsid_t; | 43 | } __kernel_fsid_t; |
48 | 44 | ||
49 | #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) | 45 | #if defined(__KERNEL__) |
50 | 46 | ||
51 | #undef __FD_SET | 47 | #undef __FD_SET |
52 | static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp) | 48 | static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp) |
@@ -117,6 +113,6 @@ static __inline__ void __FD_ZERO(__kernel_fd_set *__p) | |||
117 | } | 113 | } |
118 | } | 114 | } |
119 | 115 | ||
120 | #endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */ | 116 | #endif /* defined(__KERNEL__) */ |
121 | 117 | ||
122 | #endif /* _ASM_M32R_POSIX_TYPES_H */ | 118 | #endif /* _ASM_M32R_POSIX_TYPES_H */ |
diff --git a/include/asm-m32r/processor.h b/include/asm-m32r/processor.h index 32755bf136de..1a997fc148a2 100644 --- a/include/asm-m32r/processor.h +++ b/include/asm-m32r/processor.h | |||
@@ -60,6 +60,11 @@ extern struct cpuinfo_m32r cpu_data[]; | |||
60 | #define TASK_SIZE (0x00400000UL) | 60 | #define TASK_SIZE (0x00400000UL) |
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | #ifdef __KERNEL__ | ||
64 | #define STACK_TOP TASK_SIZE | ||
65 | #define STACK_TOP_MAX STACK_TOP | ||
66 | #endif | ||
67 | |||
63 | /* This decides where the kernel will search for a free chunk of vm | 68 | /* This decides where the kernel will search for a free chunk of vm |
64 | * space during mmap's. | 69 | * space during mmap's. |
65 | */ | 70 | */ |
diff --git a/include/asm-m32r/system.h b/include/asm-m32r/system.h index 2365de5c2955..70a57c8c002b 100644 --- a/include/asm-m32r/system.h +++ b/include/asm-m32r/system.h | |||
@@ -121,12 +121,13 @@ static inline void local_irq_disable(void) | |||
121 | 121 | ||
122 | #define nop() __asm__ __volatile__ ("nop" : : ) | 122 | #define nop() __asm__ __volatile__ ("nop" : : ) |
123 | 123 | ||
124 | #define xchg(ptr,x) \ | 124 | #define xchg(ptr, x) \ |
125 | ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) | 125 | ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))) |
126 | #define xchg_local(ptr, x) \ | ||
127 | ((__typeof__(*(ptr)))__xchg_local((unsigned long)(x), (ptr), \ | ||
128 | sizeof(*(ptr)))) | ||
126 | 129 | ||
127 | #ifdef CONFIG_SMP | ||
128 | extern void __xchg_called_with_bad_pointer(void); | 130 | extern void __xchg_called_with_bad_pointer(void); |
129 | #endif | ||
130 | 131 | ||
131 | #ifdef CONFIG_CHIP_M32700_TS1 | 132 | #ifdef CONFIG_CHIP_M32700_TS1 |
132 | #define DCACHE_CLEAR(reg0, reg1, addr) \ | 133 | #define DCACHE_CLEAR(reg0, reg1, addr) \ |
@@ -146,7 +147,7 @@ extern void __xchg_called_with_bad_pointer(void); | |||
146 | #endif /* CONFIG_CHIP_M32700_TS1 */ | 147 | #endif /* CONFIG_CHIP_M32700_TS1 */ |
147 | 148 | ||
148 | static __always_inline unsigned long | 149 | static __always_inline unsigned long |
149 | __xchg(unsigned long x, volatile void * ptr, int size) | 150 | __xchg(unsigned long x, volatile void *ptr, int size) |
150 | { | 151 | { |
151 | unsigned long flags; | 152 | unsigned long flags; |
152 | unsigned long tmp = 0; | 153 | unsigned long tmp = 0; |
@@ -186,9 +187,45 @@ __xchg(unsigned long x, volatile void * ptr, int size) | |||
186 | #endif /* CONFIG_CHIP_M32700_TS1 */ | 187 | #endif /* CONFIG_CHIP_M32700_TS1 */ |
187 | ); | 188 | ); |
188 | break; | 189 | break; |
190 | #endif /* CONFIG_SMP */ | ||
191 | default: | ||
192 | __xchg_called_with_bad_pointer(); | ||
193 | } | ||
194 | |||
195 | local_irq_restore(flags); | ||
196 | |||
197 | return (tmp); | ||
198 | } | ||
199 | |||
200 | static __always_inline unsigned long | ||
201 | __xchg_local(unsigned long x, volatile void *ptr, int size) | ||
202 | { | ||
203 | unsigned long flags; | ||
204 | unsigned long tmp = 0; | ||
205 | |||
206 | local_irq_save(flags); | ||
207 | |||
208 | switch (size) { | ||
209 | case 1: | ||
210 | __asm__ __volatile__ ( | ||
211 | "ldb %0, @%2 \n\t" | ||
212 | "stb %1, @%2 \n\t" | ||
213 | : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory"); | ||
214 | break; | ||
215 | case 2: | ||
216 | __asm__ __volatile__ ( | ||
217 | "ldh %0, @%2 \n\t" | ||
218 | "sth %1, @%2 \n\t" | ||
219 | : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory"); | ||
220 | break; | ||
221 | case 4: | ||
222 | __asm__ __volatile__ ( | ||
223 | "ld %0, @%2 \n\t" | ||
224 | "st %1, @%2 \n\t" | ||
225 | : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory"); | ||
226 | break; | ||
189 | default: | 227 | default: |
190 | __xchg_called_with_bad_pointer(); | 228 | __xchg_called_with_bad_pointer(); |
191 | #endif /* CONFIG_SMP */ | ||
192 | } | 229 | } |
193 | 230 | ||
194 | local_irq_restore(flags); | 231 | local_irq_restore(flags); |
@@ -228,6 +265,37 @@ __cmpxchg_u32(volatile unsigned int *p, unsigned int old, unsigned int new) | |||
228 | return retval; | 265 | return retval; |
229 | } | 266 | } |
230 | 267 | ||
268 | static inline unsigned long | ||
269 | __cmpxchg_local_u32(volatile unsigned int *p, unsigned int old, | ||
270 | unsigned int new) | ||
271 | { | ||
272 | unsigned long flags; | ||
273 | unsigned int retval; | ||
274 | |||
275 | local_irq_save(flags); | ||
276 | __asm__ __volatile__ ( | ||
277 | DCACHE_CLEAR("%0", "r4", "%1") | ||
278 | "ld %0, @%1; \n" | ||
279 | " bne %0, %2, 1f; \n" | ||
280 | "st %3, @%1; \n" | ||
281 | " bra 2f; \n" | ||
282 | " .fillinsn \n" | ||
283 | "1:" | ||
284 | "st %0, @%1; \n" | ||
285 | " .fillinsn \n" | ||
286 | "2:" | ||
287 | : "=&r" (retval) | ||
288 | : "r" (p), "r" (old), "r" (new) | ||
289 | : "cbit", "memory" | ||
290 | #ifdef CONFIG_CHIP_M32700_TS1 | ||
291 | , "r4" | ||
292 | #endif /* CONFIG_CHIP_M32700_TS1 */ | ||
293 | ); | ||
294 | local_irq_restore(flags); | ||
295 | |||
296 | return retval; | ||
297 | } | ||
298 | |||
231 | /* This function doesn't exist, so you'll get a linker error | 299 | /* This function doesn't exist, so you'll get a linker error |
232 | if something tries to do an invalid cmpxchg(). */ | 300 | if something tries to do an invalid cmpxchg(). */ |
233 | extern void __cmpxchg_called_with_bad_pointer(void); | 301 | extern void __cmpxchg_called_with_bad_pointer(void); |
@@ -247,13 +315,34 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) | |||
247 | return old; | 315 | return old; |
248 | } | 316 | } |
249 | 317 | ||
250 | #define cmpxchg(ptr,o,n) \ | 318 | #define cmpxchg(ptr, o, n) \ |
251 | ({ \ | 319 | ((__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)(o), \ |
252 | __typeof__(*(ptr)) _o_ = (o); \ | 320 | (unsigned long)(n), sizeof(*(ptr)))) |
253 | __typeof__(*(ptr)) _n_ = (n); \ | 321 | |
254 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ | 322 | #include <asm-generic/cmpxchg-local.h> |
255 | (unsigned long)_n_, sizeof(*(ptr))); \ | 323 | |
256 | }) | 324 | static inline unsigned long __cmpxchg_local(volatile void *ptr, |
325 | unsigned long old, | ||
326 | unsigned long new, int size) | ||
327 | { | ||
328 | switch (size) { | ||
329 | case 4: | ||
330 | return __cmpxchg_local_u32(ptr, old, new); | ||
331 | default: | ||
332 | return __cmpxchg_local_generic(ptr, old, new, size); | ||
333 | } | ||
334 | |||
335 | return old; | ||
336 | } | ||
337 | |||
338 | /* | ||
339 | * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make | ||
340 | * them available. | ||
341 | */ | ||
342 | #define cmpxchg_local(ptr, o, n) \ | ||
343 | ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \ | ||
344 | (unsigned long)(n), sizeof(*(ptr)))) | ||
345 | #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) | ||
257 | 346 | ||
258 | #endif /* __KERNEL__ */ | 347 | #endif /* __KERNEL__ */ |
259 | 348 | ||
diff --git a/include/asm-m32r/unistd.h b/include/asm-m32r/unistd.h index f467eac9ba70..cf701c933249 100644 --- a/include/asm-m32r/unistd.h +++ b/include/asm-m32r/unistd.h | |||
@@ -327,7 +327,7 @@ | |||
327 | #define __NR_epoll_pwait 319 | 327 | #define __NR_epoll_pwait 319 |
328 | #define __NR_utimensat 320 | 328 | #define __NR_utimensat 320 |
329 | #define __NR_signalfd 321 | 329 | #define __NR_signalfd 321 |
330 | #define __NR_timerfd 322 | 330 | /* #define __NR_timerfd 322 removed */ |
331 | #define __NR_eventfd 323 | 331 | #define __NR_eventfd 323 |
332 | #define __NR_fallocate 324 | 332 | #define __NR_fallocate 324 |
333 | 333 | ||
diff --git a/include/asm-m32r/user.h b/include/asm-m32r/user.h index 035258d713d0..03b3c11c2aff 100644 --- a/include/asm-m32r/user.h +++ b/include/asm-m32r/user.h | |||
@@ -38,7 +38,7 @@ struct user { | |||
38 | unsigned long start_data; /* data starting address */ | 38 | unsigned long start_data; /* data starting address */ |
39 | unsigned long start_stack; /* stack starting address */ | 39 | unsigned long start_stack; /* stack starting address */ |
40 | long int signal; /* signal causing core dump */ | 40 | long int signal; /* signal causing core dump */ |
41 | struct regs * u_ar0; /* help gdb find registers */ | 41 | unsigned long u_ar0; /* help gdb find registers */ |
42 | unsigned long magic; /* identifies a core file */ | 42 | unsigned long magic; /* identifies a core file */ |
43 | char u_comm[32]; /* user command name */ | 43 | char u_comm[32]; /* user command name */ |
44 | }; | 44 | }; |