diff options
author | Guan Xuetao <gxt@mprc.pku.edu.cn> | 2012-03-28 13:30:03 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2012-03-28 13:30:03 -0400 |
commit | 8978bfd2288adaa24d39fa15f57eb9e24ffeca12 (patch) | |
tree | a932d224f63890b38bbf29ca1fd468949c1e544c /arch/unicore32/include | |
parent | bd119c69239322caafdb64517a806037d0d0c70a (diff) |
Disintegrate asm/system.h for Unicore32 [based on ver #3, changed by gxt]
Disintegrate asm/system.h for Unicore32. (Compilation successful)
The implementation details are not changed, but only splitted.
BTW, some codestyles are adjusted.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Diffstat (limited to 'arch/unicore32/include')
-rw-r--r-- | arch/unicore32/include/asm/Kbuild | 1 | ||||
-rw-r--r-- | arch/unicore32/include/asm/barrier.h | 28 | ||||
-rw-r--r-- | arch/unicore32/include/asm/bug.h | 27 | ||||
-rw-r--r-- | arch/unicore32/include/asm/cmpxchg.h | 61 | ||||
-rw-r--r-- | arch/unicore32/include/asm/exec.h | 15 | ||||
-rw-r--r-- | arch/unicore32/include/asm/hwdef-copro.h | 48 | ||||
-rw-r--r-- | arch/unicore32/include/asm/io.h | 1 | ||||
-rw-r--r-- | arch/unicore32/include/asm/switch_to.h | 30 | ||||
-rw-r--r-- | arch/unicore32/include/asm/system.h | 166 | ||||
-rw-r--r-- | arch/unicore32/include/asm/uaccess.h | 1 |
10 files changed, 214 insertions, 164 deletions
diff --git a/arch/unicore32/include/asm/Kbuild b/arch/unicore32/include/asm/Kbuild index ca113d6999c5..34b789b71115 100644 --- a/arch/unicore32/include/asm/Kbuild +++ b/arch/unicore32/include/asm/Kbuild | |||
@@ -3,7 +3,6 @@ include include/asm-generic/Kbuild.asm | |||
3 | generic-y += atomic.h | 3 | generic-y += atomic.h |
4 | generic-y += auxvec.h | 4 | generic-y += auxvec.h |
5 | generic-y += bitsperlong.h | 5 | generic-y += bitsperlong.h |
6 | generic-y += bug.h | ||
7 | generic-y += bugs.h | 6 | generic-y += bugs.h |
8 | generic-y += cputime.h | 7 | generic-y += cputime.h |
9 | generic-y += current.h | 8 | generic-y += current.h |
diff --git a/arch/unicore32/include/asm/barrier.h b/arch/unicore32/include/asm/barrier.h new file mode 100644 index 000000000000..a6620e5336b6 --- /dev/null +++ b/arch/unicore32/include/asm/barrier.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * Memory barrier implementations for PKUnity SoC and UniCore ISA | ||
3 | * | ||
4 | * Copyright (C) 2001-2012 GUAN Xue-tao | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #ifndef __UNICORE_BARRIER_H__ | ||
11 | #define __UNICORE_BARRIER_H__ | ||
12 | |||
13 | #define isb() __asm__ __volatile__ ("" : : : "memory") | ||
14 | #define dsb() __asm__ __volatile__ ("" : : : "memory") | ||
15 | #define dmb() __asm__ __volatile__ ("" : : : "memory") | ||
16 | |||
17 | #define mb() barrier() | ||
18 | #define rmb() barrier() | ||
19 | #define wmb() barrier() | ||
20 | #define smp_mb() barrier() | ||
21 | #define smp_rmb() barrier() | ||
22 | #define smp_wmb() barrier() | ||
23 | #define read_barrier_depends() do { } while (0) | ||
24 | #define smp_read_barrier_depends() do { } while (0) | ||
25 | |||
26 | #define set_mb(var, value) do { var = value; smp_mb(); } while (0) | ||
27 | |||
28 | #endif /* __UNICORE_BARRIER_H__ */ | ||
diff --git a/arch/unicore32/include/asm/bug.h b/arch/unicore32/include/asm/bug.h new file mode 100644 index 000000000000..b1ff8cadb086 --- /dev/null +++ b/arch/unicore32/include/asm/bug.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * Bug handling for PKUnity SoC and UniCore ISA | ||
3 | * | ||
4 | * Copyright (C) 2001-2012 GUAN Xue-tao | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #ifndef __UNICORE_BUG_H__ | ||
11 | #define __UNICORE_BUG_H__ | ||
12 | |||
13 | #include <asm-generic/bug.h> | ||
14 | |||
15 | struct pt_regs; | ||
16 | struct siginfo; | ||
17 | |||
18 | extern void die(const char *msg, struct pt_regs *regs, int err); | ||
19 | extern void uc32_notify_die(const char *str, struct pt_regs *regs, | ||
20 | struct siginfo *info, unsigned long err, unsigned long trap); | ||
21 | |||
22 | extern asmlinkage void __backtrace(void); | ||
23 | extern asmlinkage void c_backtrace(unsigned long fp, int pmode); | ||
24 | |||
25 | extern void __show_regs(struct pt_regs *); | ||
26 | |||
27 | #endif /* __UNICORE_BUG_H__ */ | ||
diff --git a/arch/unicore32/include/asm/cmpxchg.h b/arch/unicore32/include/asm/cmpxchg.h new file mode 100644 index 000000000000..df4d5acfd19f --- /dev/null +++ b/arch/unicore32/include/asm/cmpxchg.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * Atomics xchg/cmpxchg for PKUnity SoC and UniCore ISA | ||
3 | * | ||
4 | * Copyright (C) 2001-2012 GUAN Xue-tao | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #ifndef __UNICORE_CMPXCHG_H__ | ||
11 | #define __UNICORE_CMPXCHG_H__ | ||
12 | |||
13 | /* | ||
14 | * Generate a link failure on undefined symbol if the pointer points to a value | ||
15 | * of unsupported size. | ||
16 | */ | ||
17 | extern void __xchg_bad_pointer(void); | ||
18 | |||
19 | static inline unsigned long __xchg(unsigned long x, volatile void *ptr, | ||
20 | int size) | ||
21 | { | ||
22 | unsigned long ret; | ||
23 | |||
24 | switch (size) { | ||
25 | case 1: | ||
26 | asm volatile("swapb %0, %1, [%2]" | ||
27 | : "=&r" (ret) | ||
28 | : "r" (x), "r" (ptr) | ||
29 | : "memory", "cc"); | ||
30 | break; | ||
31 | case 4: | ||
32 | asm volatile("swapw %0, %1, [%2]" | ||
33 | : "=&r" (ret) | ||
34 | : "r" (x), "r" (ptr) | ||
35 | : "memory", "cc"); | ||
36 | break; | ||
37 | default: | ||
38 | ret = __xchg_bad_pointer(); | ||
39 | } | ||
40 | |||
41 | return ret; | ||
42 | } | ||
43 | |||
44 | #define xchg(ptr, x) \ | ||
45 | ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))) | ||
46 | |||
47 | #include <asm-generic/cmpxchg-local.h> | ||
48 | |||
49 | /* | ||
50 | * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make | ||
51 | * them available. | ||
52 | */ | ||
53 | #define cmpxchg_local(ptr, o, n) \ | ||
54 | ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), \ | ||
55 | (unsigned long)(o), (unsigned long)(n), sizeof(*(ptr)))) | ||
56 | #define cmpxchg64_local(ptr, o, n) \ | ||
57 | __cmpxchg64_local_generic((ptr), (o), (n)) | ||
58 | |||
59 | #include <asm-generic/cmpxchg.h> | ||
60 | |||
61 | #endif /* __UNICORE_CMPXCHG_H__ */ | ||
diff --git a/arch/unicore32/include/asm/exec.h b/arch/unicore32/include/asm/exec.h new file mode 100644 index 000000000000..06d1f0f57888 --- /dev/null +++ b/arch/unicore32/include/asm/exec.h | |||
@@ -0,0 +1,15 @@ | |||
1 | /* | ||
2 | * Process execution bits for PKUnity SoC and UniCore ISA | ||
3 | * | ||
4 | * Copyright (C) 2001-2012 GUAN Xue-tao | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #ifndef __UNICORE_EXEC_H__ | ||
11 | #define __UNICORE_EXEC_H__ | ||
12 | |||
13 | #define arch_align_stack(x) (x) | ||
14 | |||
15 | #endif /* __UNICORE_EXEC_H__ */ | ||
diff --git a/arch/unicore32/include/asm/hwdef-copro.h b/arch/unicore32/include/asm/hwdef-copro.h new file mode 100644 index 000000000000..a3292f039a68 --- /dev/null +++ b/arch/unicore32/include/asm/hwdef-copro.h | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * Co-processor register definitions for PKUnity SoC and UniCore ISA | ||
3 | * | ||
4 | * Copyright (C) 2001-2012 GUAN Xue-tao | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #ifndef __UNICORE_HWDEF_COPRO_H__ | ||
11 | #define __UNICORE_HWDEF_COPRO_H__ | ||
12 | |||
13 | /* | ||
14 | * Control Register bits (CP#0 CR1) | ||
15 | */ | ||
16 | #define CR_M (1 << 0) /* MMU enable */ | ||
17 | #define CR_A (1 << 1) /* Alignment abort enable */ | ||
18 | #define CR_D (1 << 2) /* Dcache enable */ | ||
19 | #define CR_I (1 << 3) /* Icache enable */ | ||
20 | #define CR_B (1 << 4) /* Dcache write mechanism: write back */ | ||
21 | #define CR_T (1 << 5) /* Burst enable */ | ||
22 | #define CR_V (1 << 13) /* Vectors relocated to 0xffff0000 */ | ||
23 | |||
24 | #ifndef __ASSEMBLY__ | ||
25 | |||
26 | #define vectors_high() (cr_alignment & CR_V) | ||
27 | |||
28 | extern unsigned long cr_no_alignment; /* defined in entry.S */ | ||
29 | extern unsigned long cr_alignment; /* defined in entry.S */ | ||
30 | |||
31 | static inline unsigned int get_cr(void) | ||
32 | { | ||
33 | unsigned int val; | ||
34 | asm("movc %0, p0.c1, #0" : "=r" (val) : : "cc"); | ||
35 | return val; | ||
36 | } | ||
37 | |||
38 | static inline void set_cr(unsigned int val) | ||
39 | { | ||
40 | asm volatile("movc p0.c1, %0, #0" : : "r" (val) : "cc"); | ||
41 | isb(); | ||
42 | } | ||
43 | |||
44 | extern void adjust_cr(unsigned long mask, unsigned long set); | ||
45 | |||
46 | #endif /* __ASSEMBLY__ */ | ||
47 | |||
48 | #endif /* __UNICORE_HWDEF_COPRO_H__ */ | ||
diff --git a/arch/unicore32/include/asm/io.h b/arch/unicore32/include/asm/io.h index adddf6d64077..39decb6e6f57 100644 --- a/arch/unicore32/include/asm/io.h +++ b/arch/unicore32/include/asm/io.h | |||
@@ -16,7 +16,6 @@ | |||
16 | 16 | ||
17 | #include <asm/byteorder.h> | 17 | #include <asm/byteorder.h> |
18 | #include <asm/memory.h> | 18 | #include <asm/memory.h> |
19 | #include <asm/system.h> | ||
20 | 19 | ||
21 | #define PCI_IOBASE PKUNITY_PCILIO_BASE | 20 | #define PCI_IOBASE PKUNITY_PCILIO_BASE |
22 | #include <asm-generic/io.h> | 21 | #include <asm-generic/io.h> |
diff --git a/arch/unicore32/include/asm/switch_to.h b/arch/unicore32/include/asm/switch_to.h new file mode 100644 index 000000000000..39572d2bd692 --- /dev/null +++ b/arch/unicore32/include/asm/switch_to.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * Task switching for PKUnity SoC and UniCore ISA | ||
3 | * | ||
4 | * Copyright (C) 2001-2012 GUAN Xue-tao | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #ifndef __UNICORE_SWITCH_TO_H__ | ||
11 | #define __UNICORE_SWITCH_TO_H__ | ||
12 | |||
13 | struct task_struct; | ||
14 | struct thread_info; | ||
15 | |||
16 | /* | ||
17 | * switch_to(prev, next) should switch from task `prev' to `next' | ||
18 | * `prev' will never be the same as `next'. schedule() itself | ||
19 | * contains the memory barrier to tell GCC not to cache `current'. | ||
20 | */ | ||
21 | extern struct task_struct *__switch_to(struct task_struct *, | ||
22 | struct thread_info *, struct thread_info *); | ||
23 | |||
24 | #define switch_to(prev, next, last) \ | ||
25 | do { \ | ||
26 | last = __switch_to(prev, task_thread_info(prev), \ | ||
27 | task_thread_info(next)); \ | ||
28 | } while (0) | ||
29 | |||
30 | #endif /* __UNICORE_SWITCH_TO_H__ */ | ||
diff --git a/arch/unicore32/include/asm/system.h b/arch/unicore32/include/asm/system.h index 246b71c17fda..a7f40578587c 100644 --- a/arch/unicore32/include/asm/system.h +++ b/arch/unicore32/include/asm/system.h | |||
@@ -1,161 +1,5 @@ | |||
1 | /* | 1 | /* FILE TO BE DELETED. DO NOT ADD STUFF HERE! */ |
2 | * linux/arch/unicore32/include/asm/system.h | 2 | #include <asm/barrier.h> |
3 | * | 3 | #include <asm/cmpxchg.h> |
4 | * Code specific to PKUnity SoC and UniCore ISA | 4 | #include <asm/exec.h> |
5 | * | 5 | #include <asm/switch_to.h> |
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __UNICORE_SYSTEM_H__ | ||
13 | #define __UNICORE_SYSTEM_H__ | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | |||
17 | /* | ||
18 | * CR1 bits (CP#0 CR1) | ||
19 | */ | ||
20 | #define CR_M (1 << 0) /* MMU enable */ | ||
21 | #define CR_A (1 << 1) /* Alignment abort enable */ | ||
22 | #define CR_D (1 << 2) /* Dcache enable */ | ||
23 | #define CR_I (1 << 3) /* Icache enable */ | ||
24 | #define CR_B (1 << 4) /* Dcache write mechanism: write back */ | ||
25 | #define CR_T (1 << 5) /* Burst enable */ | ||
26 | #define CR_V (1 << 13) /* Vectors relocated to 0xffff0000 */ | ||
27 | |||
28 | #ifndef __ASSEMBLY__ | ||
29 | |||
30 | #include <linux/linkage.h> | ||
31 | #include <linux/irqflags.h> | ||
32 | |||
33 | struct thread_info; | ||
34 | struct task_struct; | ||
35 | |||
36 | struct pt_regs; | ||
37 | |||
38 | void die(const char *msg, struct pt_regs *regs, int err); | ||
39 | |||
40 | struct siginfo; | ||
41 | void uc32_notify_die(const char *str, struct pt_regs *regs, | ||
42 | struct siginfo *info, unsigned long err, unsigned long trap); | ||
43 | |||
44 | void hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int, | ||
45 | struct pt_regs *), | ||
46 | int sig, int code, const char *name); | ||
47 | |||
48 | #define xchg(ptr, x) \ | ||
49 | ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))) | ||
50 | |||
51 | extern asmlinkage void __backtrace(void); | ||
52 | extern asmlinkage void c_backtrace(unsigned long fp, int pmode); | ||
53 | |||
54 | struct mm_struct; | ||
55 | extern void show_pte(struct mm_struct *mm, unsigned long addr); | ||
56 | extern void __show_regs(struct pt_regs *); | ||
57 | |||
58 | extern int cpu_architecture(void); | ||
59 | extern void cpu_init(void); | ||
60 | |||
61 | #define vectors_high() (cr_alignment & CR_V) | ||
62 | |||
63 | #define isb() __asm__ __volatile__ ("" : : : "memory") | ||
64 | #define dsb() __asm__ __volatile__ ("" : : : "memory") | ||
65 | #define dmb() __asm__ __volatile__ ("" : : : "memory") | ||
66 | |||
67 | #define mb() barrier() | ||
68 | #define rmb() barrier() | ||
69 | #define wmb() barrier() | ||
70 | #define smp_mb() barrier() | ||
71 | #define smp_rmb() barrier() | ||
72 | #define smp_wmb() barrier() | ||
73 | #define read_barrier_depends() do { } while (0) | ||
74 | #define smp_read_barrier_depends() do { } while (0) | ||
75 | |||
76 | #define set_mb(var, value) do { var = value; smp_mb(); } while (0) | ||
77 | #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t"); | ||
78 | |||
79 | extern unsigned long cr_no_alignment; /* defined in entry-unicore.S */ | ||
80 | extern unsigned long cr_alignment; /* defined in entry-unicore.S */ | ||
81 | |||
82 | static inline unsigned int get_cr(void) | ||
83 | { | ||
84 | unsigned int val; | ||
85 | asm("movc %0, p0.c1, #0" : "=r" (val) : : "cc"); | ||
86 | return val; | ||
87 | } | ||
88 | |||
89 | static inline void set_cr(unsigned int val) | ||
90 | { | ||
91 | asm volatile("movc p0.c1, %0, #0 @set CR" | ||
92 | : : "r" (val) : "cc"); | ||
93 | isb(); | ||
94 | } | ||
95 | |||
96 | extern void adjust_cr(unsigned long mask, unsigned long set); | ||
97 | |||
98 | /* | ||
99 | * switch_to(prev, next) should switch from task `prev' to `next' | ||
100 | * `prev' will never be the same as `next'. schedule() itself | ||
101 | * contains the memory barrier to tell GCC not to cache `current'. | ||
102 | */ | ||
103 | extern struct task_struct *__switch_to(struct task_struct *, | ||
104 | struct thread_info *, struct thread_info *); | ||
105 | extern void panic(const char *fmt, ...); | ||
106 | |||
107 | #define switch_to(prev, next, last) \ | ||
108 | do { \ | ||
109 | last = __switch_to(prev, \ | ||
110 | task_thread_info(prev), task_thread_info(next)); \ | ||
111 | } while (0) | ||
112 | |||
113 | static inline unsigned long | ||
114 | __xchg(unsigned long x, volatile void *ptr, int size) | ||
115 | { | ||
116 | unsigned long ret; | ||
117 | |||
118 | switch (size) { | ||
119 | case 1: | ||
120 | asm volatile("@ __xchg1\n" | ||
121 | " swapb %0, %1, [%2]" | ||
122 | : "=&r" (ret) | ||
123 | : "r" (x), "r" (ptr) | ||
124 | : "memory", "cc"); | ||
125 | break; | ||
126 | case 4: | ||
127 | asm volatile("@ __xchg4\n" | ||
128 | " swapw %0, %1, [%2]" | ||
129 | : "=&r" (ret) | ||
130 | : "r" (x), "r" (ptr) | ||
131 | : "memory", "cc"); | ||
132 | break; | ||
133 | default: | ||
134 | panic("xchg: bad data size: ptr 0x%p, size %d\n", | ||
135 | ptr, size); | ||
136 | } | ||
137 | |||
138 | return ret; | ||
139 | } | ||
140 | |||
141 | #include <asm-generic/cmpxchg-local.h> | ||
142 | |||
143 | /* | ||
144 | * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make | ||
145 | * them available. | ||
146 | */ | ||
147 | #define cmpxchg_local(ptr, o, n) \ | ||
148 | ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), \ | ||
149 | (unsigned long)(o), (unsigned long)(n), sizeof(*(ptr)))) | ||
150 | #define cmpxchg64_local(ptr, o, n) \ | ||
151 | __cmpxchg64_local_generic((ptr), (o), (n)) | ||
152 | |||
153 | #include <asm-generic/cmpxchg.h> | ||
154 | |||
155 | #endif /* __ASSEMBLY__ */ | ||
156 | |||
157 | #define arch_align_stack(x) (x) | ||
158 | |||
159 | #endif /* __KERNEL__ */ | ||
160 | |||
161 | #endif | ||
diff --git a/arch/unicore32/include/asm/uaccess.h b/arch/unicore32/include/asm/uaccess.h index 2acda503a6d9..897e11ad8124 100644 --- a/arch/unicore32/include/asm/uaccess.h +++ b/arch/unicore32/include/asm/uaccess.h | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
17 | 17 | ||
18 | #include <asm/memory.h> | 18 | #include <asm/memory.h> |
19 | #include <asm/system.h> | ||
20 | 19 | ||
21 | #define __copy_from_user __copy_from_user | 20 | #define __copy_from_user __copy_from_user |
22 | #define __copy_to_user __copy_to_user | 21 | #define __copy_to_user __copy_to_user |