diff options
author | Chen Liqin <liqin.chen@sunplusct.com> | 2009-06-12 10:01:00 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2009-06-19 05:38:47 -0400 |
commit | 6bc9a3966f0395419b09b2ec90f89f7f00341b37 (patch) | |
tree | 9c0d9d5376020266f5602501c8376d4a4f13142d /arch/score/include/asm | |
parent | 0732f87761dbe417cb6e084b712d07e879e876ef (diff) |
score: Add support for Sunplus S+core architecture
This is the complete set of new arch Score's files for linux.
Score instruction set support 16bits, 32bits and 64bits instruction,
Score SOC had been used in game machine and LCD TV.
Signed-off-by: Chen Liqin <liqin.chen@sunplusct.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/score/include/asm')
88 files changed, 2501 insertions, 0 deletions
diff --git a/arch/score/include/asm/Kbuild b/arch/score/include/asm/Kbuild new file mode 100644 index 000000000000..b367abd4620f --- /dev/null +++ b/arch/score/include/asm/Kbuild | |||
@@ -0,0 +1,3 @@ | |||
1 | include include/asm-generic/Kbuild.asm | ||
2 | |||
3 | header-y += | ||
diff --git a/arch/score/include/asm/asmmacro.h b/arch/score/include/asm/asmmacro.h new file mode 100644 index 000000000000..a04a54cea25d --- /dev/null +++ b/arch/score/include/asm/asmmacro.h | |||
@@ -0,0 +1,161 @@ | |||
1 | #ifndef _ASM_SCORE_ASMMACRO_H | ||
2 | #define _ASM_SCORE_ASMMACRO_H | ||
3 | |||
4 | #include <asm/asm-offsets.h> | ||
5 | |||
6 | #ifdef __ASSEMBLY__ | ||
7 | |||
8 | .macro SAVE_ALL | ||
9 | mfcr r30, cr0 | ||
10 | mv r31, r0 | ||
11 | nop | ||
12 | /* if UMs == 1, change stack. */ | ||
13 | slli.c r30, r30, 28 | ||
14 | bpl 1f | ||
15 | la r31, kernelsp | ||
16 | lw r31, [r31] | ||
17 | 1: | ||
18 | mv r30, r0 | ||
19 | addri r0, r31, -PT_SIZE | ||
20 | |||
21 | sw r30, [r0, PT_R0] | ||
22 | .set r1 | ||
23 | sw r1, [r0, PT_R1] | ||
24 | .set nor1 | ||
25 | sw r2, [r0, PT_R2] | ||
26 | sw r3, [r0, PT_R3] | ||
27 | sw r4, [r0, PT_R4] | ||
28 | sw r5, [r0, PT_R5] | ||
29 | sw r6, [r0, PT_R6] | ||
30 | sw r7, [r0, PT_R7] | ||
31 | |||
32 | sw r8, [r0, PT_R8] | ||
33 | sw r9, [r0, PT_R9] | ||
34 | sw r10, [r0, PT_R10] | ||
35 | sw r11, [r0, PT_R11] | ||
36 | sw r12, [r0, PT_R12] | ||
37 | sw r13, [r0, PT_R13] | ||
38 | sw r14, [r0, PT_R14] | ||
39 | sw r15, [r0, PT_R15] | ||
40 | |||
41 | sw r16, [r0, PT_R16] | ||
42 | sw r17, [r0, PT_R17] | ||
43 | sw r18, [r0, PT_R18] | ||
44 | sw r19, [r0, PT_R19] | ||
45 | sw r20, [r0, PT_R20] | ||
46 | sw r21, [r0, PT_R21] | ||
47 | sw r22, [r0, PT_R22] | ||
48 | sw r23, [r0, PT_R23] | ||
49 | |||
50 | sw r24, [r0, PT_R24] | ||
51 | sw r25, [r0, PT_R25] | ||
52 | sw r25, [r0, PT_R25] | ||
53 | sw r26, [r0, PT_R26] | ||
54 | sw r27, [r0, PT_R27] | ||
55 | |||
56 | sw r28, [r0, PT_R28] | ||
57 | sw r29, [r0, PT_R29] | ||
58 | orri r28, r0, 0x1fff | ||
59 | li r31, 0x00001fff | ||
60 | xor r28, r28, r31 | ||
61 | |||
62 | mfcehl r30, r31 | ||
63 | sw r30, [r0, PT_CEH] | ||
64 | sw r31, [r0, PT_CEL] | ||
65 | |||
66 | mfcr r31, cr0 | ||
67 | sw r31, [r0, PT_PSR] | ||
68 | |||
69 | mfcr r31, cr1 | ||
70 | sw r31, [r0, PT_CONDITION] | ||
71 | |||
72 | mfcr r31, cr2 | ||
73 | sw r31, [r0, PT_ECR] | ||
74 | |||
75 | mfcr r31, cr5 | ||
76 | srli r31, r31, 1 | ||
77 | slli r31, r31, 1 | ||
78 | sw r31, [r0, PT_EPC] | ||
79 | .endm | ||
80 | |||
81 | .macro RESTORE_ALL_AND_RET | ||
82 | mfcr r30, cr0 | ||
83 | srli r30, r30, 1 | ||
84 | slli r30, r30, 1 | ||
85 | mtcr r30, cr0 | ||
86 | nop | ||
87 | nop | ||
88 | nop | ||
89 | nop | ||
90 | nop | ||
91 | |||
92 | .set r1 | ||
93 | ldis r1, 0x00ff | ||
94 | and r30, r30, r1 | ||
95 | not r1, r1 | ||
96 | lw r31, [r0, PT_PSR] | ||
97 | and r31, r31, r1 | ||
98 | .set nor1 | ||
99 | or r31, r31, r30 | ||
100 | mtcr r31, cr0 | ||
101 | nop | ||
102 | nop | ||
103 | nop | ||
104 | nop | ||
105 | nop | ||
106 | |||
107 | lw r30, [r0, PT_CONDITION] | ||
108 | mtcr r30, cr1 | ||
109 | nop | ||
110 | nop | ||
111 | nop | ||
112 | nop | ||
113 | nop | ||
114 | |||
115 | lw r30, [r0, PT_CEH] | ||
116 | lw r31, [r0, PT_CEL] | ||
117 | mtcehl r30, r31 | ||
118 | |||
119 | .set r1 | ||
120 | lw r1, [r0, PT_R1] | ||
121 | .set nor1 | ||
122 | lw r2, [r0, PT_R2] | ||
123 | lw r3, [r0, PT_R3] | ||
124 | lw r4, [r0, PT_R4] | ||
125 | lw r5, [r0, PT_R5] | ||
126 | lw r6, [r0, PT_R6] | ||
127 | lw r7, [r0, PT_R7] | ||
128 | |||
129 | lw r8, [r0, PT_R8] | ||
130 | lw r9, [r0, PT_R9] | ||
131 | lw r10, [r0, PT_R10] | ||
132 | lw r11, [r0, PT_R11] | ||
133 | lw r12, [r0, PT_R12] | ||
134 | lw r13, [r0, PT_R13] | ||
135 | lw r14, [r0, PT_R14] | ||
136 | lw r15, [r0, PT_R15] | ||
137 | |||
138 | lw r16, [r0, PT_R16] | ||
139 | lw r17, [r0, PT_R17] | ||
140 | lw r18, [r0, PT_R18] | ||
141 | lw r19, [r0, PT_R19] | ||
142 | lw r20, [r0, PT_R20] | ||
143 | lw r21, [r0, PT_R21] | ||
144 | lw r22, [r0, PT_R22] | ||
145 | lw r23, [r0, PT_R23] | ||
146 | |||
147 | lw r24, [r0, PT_R24] | ||
148 | lw r25, [r0, PT_R25] | ||
149 | lw r26, [r0, PT_R26] | ||
150 | lw r27, [r0, PT_R27] | ||
151 | lw r28, [r0, PT_R28] | ||
152 | lw r29, [r0, PT_R29] | ||
153 | |||
154 | lw r30, [r0, PT_EPC] | ||
155 | lw r0, [r0, PT_R0] | ||
156 | mtcr r30, cr5 | ||
157 | rte | ||
158 | .endm | ||
159 | |||
160 | #endif /* __ASSEMBLY__ */ | ||
161 | #endif /* _ASM_SCORE_ASMMACRO_H */ | ||
diff --git a/arch/score/include/asm/atomic.h b/arch/score/include/asm/atomic.h new file mode 100644 index 000000000000..84eb8ddf9f3f --- /dev/null +++ b/arch/score/include/asm/atomic.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_ATOMIC_H | ||
2 | #define _ASM_SCORE_ATOMIC_H | ||
3 | |||
4 | #include <asm-generic/atomic.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_ATOMIC_H */ | ||
diff --git a/arch/score/include/asm/auxvec.h b/arch/score/include/asm/auxvec.h new file mode 100644 index 000000000000..f69151565aee --- /dev/null +++ b/arch/score/include/asm/auxvec.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef _ASM_SCORE_AUXVEC_H | ||
2 | #define _ASM_SCORE_AUXVEC_H | ||
3 | |||
4 | #endif /* _ASM_SCORE_AUXVEC_H */ | ||
diff --git a/arch/score/include/asm/bitops.h b/arch/score/include/asm/bitops.h new file mode 100644 index 000000000000..2763b050fca8 --- /dev/null +++ b/arch/score/include/asm/bitops.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _ASM_SCORE_BITOPS_H | ||
2 | #define _ASM_SCORE_BITOPS_H | ||
3 | |||
4 | #include <asm/byteorder.h> /* swab32 */ | ||
5 | #include <asm/system.h> /* save_flags */ | ||
6 | |||
7 | /* | ||
8 | * clear_bit() doesn't provide any barrier for the compiler. | ||
9 | */ | ||
10 | #define smp_mb__before_clear_bit() barrier() | ||
11 | #define smp_mb__after_clear_bit() barrier() | ||
12 | |||
13 | #include <asm-generic/bitops.h> | ||
14 | #include <asm-generic/bitops/__fls.h> | ||
15 | |||
16 | #endif /* _ASM_SCORE_BITOPS_H */ | ||
diff --git a/arch/score/include/asm/bitsperlong.h b/arch/score/include/asm/bitsperlong.h new file mode 100644 index 000000000000..86ff337aa459 --- /dev/null +++ b/arch/score/include/asm/bitsperlong.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_BITSPERLONG_H | ||
2 | #define _ASM_SCORE_BITSPERLONG_H | ||
3 | |||
4 | #include <asm-generic/bitsperlong.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_BITSPERLONG_H */ | ||
diff --git a/arch/score/include/asm/bug.h b/arch/score/include/asm/bug.h new file mode 100644 index 000000000000..bb76a330bcf1 --- /dev/null +++ b/arch/score/include/asm/bug.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_BUG_H | ||
2 | #define _ASM_SCORE_BUG_H | ||
3 | |||
4 | #include <asm-generic/bug.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_BUG_H */ | ||
diff --git a/arch/score/include/asm/bugs.h b/arch/score/include/asm/bugs.h new file mode 100644 index 000000000000..a062e1056bb3 --- /dev/null +++ b/arch/score/include/asm/bugs.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_BUGS_H | ||
2 | #define _ASM_SCORE_BUGS_H | ||
3 | |||
4 | #include <asm-generic/bugs.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_BUGS_H */ | ||
diff --git a/arch/score/include/asm/byteorder.h b/arch/score/include/asm/byteorder.h new file mode 100644 index 000000000000..88cbebc79212 --- /dev/null +++ b/arch/score/include/asm/byteorder.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_BYTEORDER_H | ||
2 | #define _ASM_SCORE_BYTEORDER_H | ||
3 | |||
4 | #include <linux/byteorder/little_endian.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_BYTEORDER_H */ | ||
diff --git a/arch/score/include/asm/cache.h b/arch/score/include/asm/cache.h new file mode 100644 index 000000000000..ae3d59f2d2c4 --- /dev/null +++ b/arch/score/include/asm/cache.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef _ASM_SCORE_CACHE_H | ||
2 | #define _ASM_SCORE_CACHE_H | ||
3 | |||
4 | #define L1_CACHE_SHIFT 4 | ||
5 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) | ||
6 | |||
7 | #endif /* _ASM_SCORE_CACHE_H */ | ||
diff --git a/arch/score/include/asm/cacheflush.h b/arch/score/include/asm/cacheflush.h new file mode 100644 index 000000000000..1c74628caf71 --- /dev/null +++ b/arch/score/include/asm/cacheflush.h | |||
@@ -0,0 +1,47 @@ | |||
1 | #ifndef _ASM_SCORE_CACHEFLUSH_H | ||
2 | #define _ASM_SCORE_CACHEFLUSH_H | ||
3 | |||
4 | /* Keep includes the same across arches. */ | ||
5 | #include <linux/mm.h> | ||
6 | |||
7 | extern void (*flush_cache_all)(void); | ||
8 | extern void (*flush_cache_mm)(struct mm_struct *mm); | ||
9 | extern void (*flush_cache_range)(struct vm_area_struct *vma, | ||
10 | unsigned long start, unsigned long end); | ||
11 | extern void (*flush_cache_page)(struct vm_area_struct *vma, | ||
12 | unsigned long page, unsigned long pfn); | ||
13 | extern void (*flush_cache_sigtramp)(unsigned long addr); | ||
14 | extern void (*flush_icache_all)(void); | ||
15 | extern void (*flush_icache_range)(unsigned long start, unsigned long end); | ||
16 | extern void (*flush_data_cache_page)(unsigned long addr); | ||
17 | |||
18 | extern void s7_flush_cache_all(void); | ||
19 | |||
20 | #define flush_cache_dup_mm(mm) do {} while (0) | ||
21 | #define flush_dcache_page(page) do {} while (0) | ||
22 | #define flush_dcache_mmap_lock(mapping) do {} while (0) | ||
23 | #define flush_dcache_mmap_unlock(mapping) do {} while (0) | ||
24 | #define flush_cache_vmap(start, end) do {} while (0) | ||
25 | #define flush_cache_vunmap(start, end) do {} while (0) | ||
26 | |||
27 | static inline void flush_icache_page(struct vm_area_struct *vma, | ||
28 | struct page *page) | ||
29 | { | ||
30 | if (vma->vm_flags & VM_EXEC) { | ||
31 | void *v = page_address(page); | ||
32 | flush_icache_range((unsigned long) v, | ||
33 | (unsigned long) v + PAGE_SIZE); | ||
34 | } | ||
35 | } | ||
36 | |||
37 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ | ||
38 | memcpy(dst, src, len) | ||
39 | |||
40 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ | ||
41 | do { \ | ||
42 | memcpy(dst, src, len); \ | ||
43 | if ((vma->vm_flags & VM_EXEC)) \ | ||
44 | flush_cache_page(vma, vaddr, page_to_pfn(page));\ | ||
45 | } while (0) | ||
46 | |||
47 | #endif /* _ASM_SCORE_CACHEFLUSH_H */ | ||
diff --git a/arch/score/include/asm/checksum.h b/arch/score/include/asm/checksum.h new file mode 100644 index 000000000000..f909ac3144a4 --- /dev/null +++ b/arch/score/include/asm/checksum.h | |||
@@ -0,0 +1,235 @@ | |||
1 | #ifndef _ASM_SCORE_CHECKSUM_H | ||
2 | #define _ASM_SCORE_CHECKSUM_H | ||
3 | |||
4 | #include <linux/in6.h> | ||
5 | #include <asm/uaccess.h> | ||
6 | |||
7 | /* | ||
8 | * computes the checksum of a memory block at buff, length len, | ||
9 | * and adds in "sum" (32-bit) | ||
10 | * | ||
11 | * returns a 32-bit number suitable for feeding into itself | ||
12 | * or csum_tcpudp_magic | ||
13 | * | ||
14 | * this function must be called with even lengths, except | ||
15 | * for the last fragment, which may be odd | ||
16 | * | ||
17 | * it's best to have buff aligned on a 32-bit boundary | ||
18 | */ | ||
19 | unsigned int csum_partial(const void *buff, int len, __wsum sum); | ||
20 | unsigned int csum_partial_copy_from_user(const char *src, char *dst, int len, | ||
21 | unsigned int sum, int *csum_err); | ||
22 | unsigned int csum_partial_copy(const char *src, char *dst, | ||
23 | int len, unsigned int sum); | ||
24 | |||
25 | /* | ||
26 | * this is a new version of the above that records errors it finds in *errp, | ||
27 | * but continues and zeros the rest of the buffer. | ||
28 | */ | ||
29 | |||
30 | /* | ||
31 | * Copy and checksum to user | ||
32 | */ | ||
33 | #define HAVE_CSUM_COPY_USER | ||
34 | static inline | ||
35 | __wsum csum_and_copy_to_user(const void *src, void __user *dst, int len, | ||
36 | __wsum sum, int *err_ptr) | ||
37 | { | ||
38 | sum = csum_partial(src, len, sum); | ||
39 | if (copy_to_user(dst, src, len)) { | ||
40 | *err_ptr = -EFAULT; | ||
41 | return (__force __wsum) -1; /* invalid checksum */ | ||
42 | } | ||
43 | return sum; | ||
44 | } | ||
45 | |||
46 | |||
47 | #define csum_partial_copy_nocheck csum_partial_copy | ||
48 | /* | ||
49 | * Fold a partial checksum without adding pseudo headers | ||
50 | */ | ||
51 | |||
52 | static inline __sum16 csum_fold(__wsum sum) | ||
53 | { | ||
54 | /* the while loop is unnecessary really, it's always enough with two | ||
55 | iterations */ | ||
56 | __asm__ __volatile__( | ||
57 | ".set volatile\n\t" | ||
58 | ".set\tr1\n\t" | ||
59 | "slli\tr1,%0, 16\n\t" | ||
60 | "add\t%0,%0, r1\n\t" | ||
61 | "cmp.c\tr1, %0\n\t" | ||
62 | "srli\t%0, %0, 16\n\t" | ||
63 | "bleu\t1f\n\t" | ||
64 | "addi\t%0, 0x1\n\t" | ||
65 | "1:ldi\tr30, 0xffff\n\t" | ||
66 | "xor\t%0, %0, r30\n\t" | ||
67 | "slli\t%0, %0, 16\n\t" | ||
68 | "srli\t%0, %0, 16\n\t" | ||
69 | ".set\tnor1\n\t" | ||
70 | ".set optimize\n\t" | ||
71 | : "=r" (sum) | ||
72 | : "0" (sum)); | ||
73 | return sum; | ||
74 | } | ||
75 | |||
76 | /* | ||
77 | * This is a version of ip_compute_csum() optimized for IP headers, | ||
78 | * which always checksum on 4 octet boundaries. | ||
79 | * | ||
80 | * By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by | ||
81 | * Arnt Gulbrandsen. | ||
82 | */ | ||
83 | static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl) | ||
84 | { | ||
85 | unsigned int sum; | ||
86 | unsigned long dummy; | ||
87 | |||
88 | __asm__ __volatile__( | ||
89 | ".set volatile\n\t" | ||
90 | ".set\tnor1\n\t" | ||
91 | "lw\t%0, [%1]\n\t" | ||
92 | "subri\t%2, %2, 4\n\t" | ||
93 | "slli\t%2, %2, 2\n\t" | ||
94 | "lw\t%3, [%1, 4]\n\t" | ||
95 | "add\t%2, %2, %1\n\t" | ||
96 | "add\t%0, %0, %3\n\t" | ||
97 | "cmp.c\t%3, %0\n\t" | ||
98 | "lw\t%3, [%1, 8]\n\t" | ||
99 | "bleu\t1f\n\t" | ||
100 | "addi\t%0, 0x1\n\t" | ||
101 | "1:\n\t" | ||
102 | "add\t%0, %0, %3\n\t" | ||
103 | "cmp.c\t%3, %0\n\t" | ||
104 | "lw\t%3, [%1, 12]\n\t" | ||
105 | "bleu\t1f\n\t" | ||
106 | "addi\t%0, 0x1\n\t" | ||
107 | "1:add\t%0, %0, %3\n\t" | ||
108 | "cmp.c\t%3, %0\n\t" | ||
109 | "bleu\t1f\n\t" | ||
110 | "addi\t%0, 0x1\n" | ||
111 | |||
112 | "1:\tlw\t%3, [%1, 16]\n\t" | ||
113 | "addi\t%1, 4\n\t" | ||
114 | "add\t%0, %0, %3\n\t" | ||
115 | "cmp.c\t%3, %0\n\t" | ||
116 | "bleu\t2f\n\t" | ||
117 | "addi\t%0, 0x1\n" | ||
118 | "2:cmp.c\t%2, %1\n\t" | ||
119 | "bne\t1b\n\t" | ||
120 | |||
121 | ".set\tr1\n\t" | ||
122 | ".set optimize\n\t" | ||
123 | : "=&r" (sum), "=&r" (iph), "=&r" (ihl), "=&r" (dummy) | ||
124 | : "1" (iph), "2" (ihl)); | ||
125 | |||
126 | return csum_fold(sum); | ||
127 | } | ||
128 | |||
129 | static inline __wsum | ||
130 | csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, | ||
131 | unsigned short proto, __wsum sum) | ||
132 | { | ||
133 | unsigned long tmp = (ntohs(len) << 16) + proto * 256; | ||
134 | __asm__ __volatile__( | ||
135 | ".set volatile\n\t" | ||
136 | "add\t%0, %0, %2\n\t" | ||
137 | "cmp.c\t%2, %0\n\t" | ||
138 | "bleu\t1f\n\t" | ||
139 | "addi\t%0, 0x1\n\t" | ||
140 | "1:\n\t" | ||
141 | "add\t%0, %0, %3\n\t" | ||
142 | "cmp.c\t%3, %0\n\t" | ||
143 | "bleu\t1f\n\t" | ||
144 | "addi\t%0, 0x1\n\t" | ||
145 | "1:\n\t" | ||
146 | "add\t%0, %0, %4\n\t" | ||
147 | "cmp.c\t%4, %0\n\t" | ||
148 | "bleu\t1f\n\t" | ||
149 | "addi\t%0, 0x1\n\t" | ||
150 | "1:\n\t" | ||
151 | ".set optimize\n\t" | ||
152 | : "=r" (sum) | ||
153 | : "0" (daddr), "r"(saddr), | ||
154 | "r" (tmp), | ||
155 | "r" (sum)); | ||
156 | return sum; | ||
157 | } | ||
158 | |||
159 | /* | ||
160 | * computes the checksum of the TCP/UDP pseudo-header | ||
161 | * returns a 16-bit checksum, already complemented | ||
162 | */ | ||
163 | static inline __sum16 | ||
164 | csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, | ||
165 | unsigned short proto, __wsum sum) | ||
166 | { | ||
167 | return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); | ||
168 | } | ||
169 | |||
170 | /* | ||
171 | * this routine is used for miscellaneous IP-like checksums, mainly | ||
172 | * in icmp.c | ||
173 | */ | ||
174 | |||
175 | static inline unsigned short ip_compute_csum(const void *buff, int len) | ||
176 | { | ||
177 | return csum_fold(csum_partial(buff, len, 0)); | ||
178 | } | ||
179 | |||
180 | #define _HAVE_ARCH_IPV6_CSUM | ||
181 | static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr, | ||
182 | const struct in6_addr *daddr, | ||
183 | __u32 len, unsigned short proto, | ||
184 | __wsum sum) | ||
185 | { | ||
186 | __asm__ __volatile__( | ||
187 | ".set\tnoreorder\t\t\t# csum_ipv6_magic\n\t" | ||
188 | ".set\tnoat\n\t" | ||
189 | "addu\t%0, %5\t\t\t# proto (long in network byte order)\n\t" | ||
190 | "sltu\t$1, %0, %5\n\t" | ||
191 | "addu\t%0, $1\n\t" | ||
192 | "addu\t%0, %6\t\t\t# csum\n\t" | ||
193 | "sltu\t$1, %0, %6\n\t" | ||
194 | "lw\t%1, 0(%2)\t\t\t# four words source address\n\t" | ||
195 | "addu\t%0, $1\n\t" | ||
196 | "addu\t%0, %1\n\t" | ||
197 | "sltu\t$1, %0, %1\n\t" | ||
198 | "lw\t%1, 4(%2)\n\t" | ||
199 | "addu\t%0, $1\n\t" | ||
200 | "addu\t%0, %1\n\t" | ||
201 | "sltu\t$1, %0, %1\n\t" | ||
202 | "lw\t%1, 8(%2)\n\t" | ||
203 | "addu\t%0, $1\n\t" | ||
204 | "addu\t%0, %1\n\t" | ||
205 | "sltu\t$1, %0, %1\n\t" | ||
206 | "lw\t%1, 12(%2)\n\t" | ||
207 | "addu\t%0, $1\n\t" | ||
208 | "addu\t%0, %1\n\t" | ||
209 | "sltu\t$1, %0, %1\n\t" | ||
210 | "lw\t%1, 0(%3)\n\t" | ||
211 | "addu\t%0, $1\n\t" | ||
212 | "addu\t%0, %1\n\t" | ||
213 | "sltu\t$1, %0, %1\n\t" | ||
214 | "lw\t%1, 4(%3)\n\t" | ||
215 | "addu\t%0, $1\n\t" | ||
216 | "addu\t%0, %1\n\t" | ||
217 | "sltu\t$1, %0, %1\n\t" | ||
218 | "lw\t%1, 8(%3)\n\t" | ||
219 | "addu\t%0, $1\n\t" | ||
220 | "addu\t%0, %1\n\t" | ||
221 | "sltu\t$1, %0, %1\n\t" | ||
222 | "lw\t%1, 12(%3)\n\t" | ||
223 | "addu\t%0, $1\n\t" | ||
224 | "addu\t%0, %1\n\t" | ||
225 | "sltu\t$1, %0, %1\n\t" | ||
226 | "addu\t%0, $1\t\t\t# Add final carry\n\t" | ||
227 | ".set\tnoat\n\t" | ||
228 | ".set\tnoreorder" | ||
229 | : "=r" (sum), "=r" (proto) | ||
230 | : "r" (saddr), "r" (daddr), | ||
231 | "0" (htonl(len)), "1" (htonl(proto)), "r" (sum)); | ||
232 | |||
233 | return csum_fold(sum); | ||
234 | } | ||
235 | #endif /* _ASM_SCORE_CHECKSUM_H */ | ||
diff --git a/arch/score/include/asm/cputime.h b/arch/score/include/asm/cputime.h new file mode 100644 index 000000000000..1fced99f0d67 --- /dev/null +++ b/arch/score/include/asm/cputime.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_CPUTIME_H | ||
2 | #define _ASM_SCORE_CPUTIME_H | ||
3 | |||
4 | #include <asm-generic/cputime.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_CPUTIME_H */ | ||
diff --git a/arch/score/include/asm/current.h b/arch/score/include/asm/current.h new file mode 100644 index 000000000000..16eae9cbaf1a --- /dev/null +++ b/arch/score/include/asm/current.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_CURRENT_H | ||
2 | #define _ASM_SCORE_CURRENT_H | ||
3 | |||
4 | #include <asm-generic/current.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_CURRENT_H */ | ||
diff --git a/arch/score/include/asm/delay.h b/arch/score/include/asm/delay.h new file mode 100644 index 000000000000..ad716f6d922d --- /dev/null +++ b/arch/score/include/asm/delay.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef _ASM_SCORE_DELAY_H | ||
2 | #define _ASM_SCORE_DELAY_H | ||
3 | |||
4 | static inline void __delay(unsigned long loops) | ||
5 | { | ||
6 | __asm__ __volatile__ ( | ||
7 | "1:\tsubi\t%0,1\n\t" | ||
8 | "cmpz.c\t%0\n\t" | ||
9 | "bne\t1b\n\t" | ||
10 | : "=r" (loops) | ||
11 | : "0" (loops)); | ||
12 | } | ||
13 | |||
14 | static inline void __udelay(unsigned long usecs) | ||
15 | { | ||
16 | __delay(usecs); | ||
17 | } | ||
18 | |||
19 | #define udelay(usecs) __udelay(usecs) | ||
20 | |||
21 | #endif /* _ASM_SCORE_DELAY_H */ | ||
diff --git a/arch/score/include/asm/device.h b/arch/score/include/asm/device.h new file mode 100644 index 000000000000..2dc7cc5d5ef9 --- /dev/null +++ b/arch/score/include/asm/device.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_DEVICE_H | ||
2 | #define _ASM_SCORE_DEVICE_H | ||
3 | |||
4 | #include <asm-generic/device.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_DEVICE_H */ | ||
diff --git a/arch/score/include/asm/div64.h b/arch/score/include/asm/div64.h new file mode 100644 index 000000000000..75fae19824eb --- /dev/null +++ b/arch/score/include/asm/div64.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_DIV64_H | ||
2 | #define _ASM_SCORE_DIV64_H | ||
3 | |||
4 | #include <asm-generic/div64.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_DIV64_H */ | ||
diff --git a/arch/score/include/asm/dma-mapping.h b/arch/score/include/asm/dma-mapping.h new file mode 100644 index 000000000000..f9c0193c7a53 --- /dev/null +++ b/arch/score/include/asm/dma-mapping.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_DMA_MAPPING_H | ||
2 | #define _ASM_SCORE_DMA_MAPPING_H | ||
3 | |||
4 | #include <asm-generic/dma-mapping-broken.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_DMA_MAPPING_H */ | ||
diff --git a/arch/score/include/asm/dma.h b/arch/score/include/asm/dma.h new file mode 100644 index 000000000000..9f44185298bf --- /dev/null +++ b/arch/score/include/asm/dma.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _ASM_SCORE_DMA_H | ||
2 | #define _ASM_SCORE_DMA_H | ||
3 | |||
4 | #include <asm/io.h> | ||
5 | |||
6 | #define MAX_DMA_ADDRESS (0) | ||
7 | |||
8 | #endif /* _ASM_SCORE_DMA_H */ | ||
diff --git a/arch/score/include/asm/elf.h b/arch/score/include/asm/elf.h new file mode 100644 index 000000000000..832436375ac3 --- /dev/null +++ b/arch/score/include/asm/elf.h | |||
@@ -0,0 +1,99 @@ | |||
1 | #ifndef _ASM_SCORE_ELF_H | ||
2 | #define _ASM_SCORE_ELF_H | ||
3 | |||
4 | /* ELF register definitions */ | ||
5 | #define ELF_NGREG 45 | ||
6 | #define ELF_NFPREG 33 | ||
7 | #define EM_SCORE7 135 | ||
8 | |||
9 | /* Relocation types. */ | ||
10 | #define R_SCORE_NONE 0 | ||
11 | #define R_SCORE_HI16 1 | ||
12 | #define R_SCORE_LO16 2 | ||
13 | #define R_SCORE_BCMP 3 | ||
14 | #define R_SCORE_24 4 | ||
15 | #define R_SCORE_PC19 5 | ||
16 | #define R_SCORE16_11 6 | ||
17 | #define R_SCORE16_PC8 7 | ||
18 | #define R_SCORE_ABS32 8 | ||
19 | #define R_SCORE_ABS16 9 | ||
20 | #define R_SCORE_DUMMY2 10 | ||
21 | #define R_SCORE_GP15 11 | ||
22 | #define R_SCORE_GNU_VTINHERIT 12 | ||
23 | #define R_SCORE_GNU_VTENTRY 13 | ||
24 | #define R_SCORE_GOT15 14 | ||
25 | #define R_SCORE_GOT_LO16 15 | ||
26 | #define R_SCORE_CALL15 16 | ||
27 | #define R_SCORE_GPREL32 17 | ||
28 | #define R_SCORE_REL32 18 | ||
29 | #define R_SCORE_DUMMY_HI16 19 | ||
30 | #define R_SCORE_IMM30 20 | ||
31 | #define R_SCORE_IMM32 21 | ||
32 | |||
33 | typedef unsigned long elf_greg_t; | ||
34 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | ||
35 | |||
36 | typedef double elf_fpreg_t; | ||
37 | typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; | ||
38 | |||
39 | #define elf_check_arch(x) ((x)->e_machine == EM_SCORE7) | ||
40 | |||
41 | /* | ||
42 | * These are used to set parameters in the core dumps. | ||
43 | */ | ||
44 | #define ELF_CLASS ELFCLASS32 | ||
45 | |||
46 | /* | ||
47 | * These are used to set parameters in the core dumps. | ||
48 | */ | ||
49 | #define ELF_DATA ELFDATA2LSB | ||
50 | #define ELF_ARCH EM_SCORE7 | ||
51 | |||
52 | #define SET_PERSONALITY(ex) \ | ||
53 | do { \ | ||
54 | set_personality(PER_LINUX); \ | ||
55 | } while (0) | ||
56 | |||
57 | struct task_struct; | ||
58 | struct pt_regs; | ||
59 | |||
60 | #define USE_ELF_CORE_DUMP | ||
61 | #define ELF_EXEC_PAGESIZE PAGE_SIZE | ||
62 | |||
63 | /* This yields a mask that user programs can use to figure out what | ||
64 | instruction set this cpu supports. This could be done in userspace, | ||
65 | but it's not easy, and we've already done it here. */ | ||
66 | |||
67 | #define ELF_HWCAP (0) | ||
68 | |||
69 | /* This yields a string that ld.so will use to load implementation | ||
70 | specific libraries for optimization. This is more specific in | ||
71 | intent than poking at uname or /proc/cpuinfo. | ||
72 | |||
73 | For the moment, we have only optimizations for the Intel generations, | ||
74 | but that could change... */ | ||
75 | |||
76 | #define ELF_PLATFORM (NULL) | ||
77 | |||
78 | #define ELF_PLAT_INIT(_r, load_addr) \ | ||
79 | do { \ | ||
80 | _r->regs[1] = _r->regs[2] = _r->regs[3] = _r->regs[4] = 0; \ | ||
81 | _r->regs[5] = _r->regs[6] = _r->regs[7] = _r->regs[8] = 0; \ | ||
82 | _r->regs[9] = _r->regs[10] = _r->regs[11] = _r->regs[12] = 0; \ | ||
83 | _r->regs[13] = _r->regs[14] = _r->regs[15] = _r->regs[16] = 0; \ | ||
84 | _r->regs[17] = _r->regs[18] = _r->regs[19] = _r->regs[20] = 0; \ | ||
85 | _r->regs[21] = _r->regs[22] = _r->regs[23] = _r->regs[24] = 0; \ | ||
86 | _r->regs[25] = _r->regs[26] = _r->regs[27] = _r->regs[28] = 0; \ | ||
87 | _r->regs[30] = _r->regs[31] = 0; \ | ||
88 | } while (0) | ||
89 | |||
90 | /* This is the location that an ET_DYN program is loaded if exec'ed. Typical | ||
91 | use of this is to invoke "./ld.so someprog" to test out a new version of | ||
92 | the loader. We need to make sure that it is out of the way of the program | ||
93 | that it will "exec", and that there is sufficient room for the brk. */ | ||
94 | |||
95 | #ifndef ELF_ET_DYN_BASE | ||
96 | #define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2) | ||
97 | #endif | ||
98 | |||
99 | #endif /* _ASM_SCORE_ELF_H */ | ||
diff --git a/arch/score/include/asm/emergency-restart.h b/arch/score/include/asm/emergency-restart.h new file mode 100644 index 000000000000..ca31e9803a8a --- /dev/null +++ b/arch/score/include/asm/emergency-restart.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_EMERGENCY_RESTART_H | ||
2 | #define _ASM_SCORE_EMERGENCY_RESTART_H | ||
3 | |||
4 | #include <asm-generic/emergency-restart.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_EMERGENCY_RESTART_H */ | ||
diff --git a/arch/score/include/asm/errno.h b/arch/score/include/asm/errno.h new file mode 100644 index 000000000000..7cd3e1f07c0b --- /dev/null +++ b/arch/score/include/asm/errno.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef _ASM_SCORE_ERRNO_H | ||
2 | #define _ASM_SCORE_ERRNO_H | ||
3 | |||
4 | #include <asm-generic/errno.h> | ||
5 | #define EMAXERRNO 1024 | ||
6 | |||
7 | #endif /* _ASM_SCORE_ERRNO_H */ | ||
diff --git a/arch/score/include/asm/fcntl.h b/arch/score/include/asm/fcntl.h new file mode 100644 index 000000000000..03968a3103a4 --- /dev/null +++ b/arch/score/include/asm/fcntl.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_FCNTL_H | ||
2 | #define _ASM_SCORE_FCNTL_H | ||
3 | |||
4 | #include <asm-generic/fcntl.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_FCNTL_H */ | ||
diff --git a/arch/score/include/asm/fixmap.h b/arch/score/include/asm/fixmap.h new file mode 100644 index 000000000000..ee1676694024 --- /dev/null +++ b/arch/score/include/asm/fixmap.h | |||
@@ -0,0 +1,82 @@ | |||
1 | #ifndef _ASM_SCORE_FIXMAP_H | ||
2 | #define _ASM_SCORE_FIXMAP_H | ||
3 | |||
4 | #include <asm/page.h> | ||
5 | |||
6 | #define PHY_RAM_BASE 0x00000000 | ||
7 | #define PHY_IO_BASE 0x10000000 | ||
8 | |||
9 | #define VIRTUAL_RAM_BASE 0xa0000000 | ||
10 | #define VIRTUAL_IO_BASE 0xb0000000 | ||
11 | |||
12 | #define RAM_SPACE_SIZE 0x10000000 | ||
13 | #define IO_SPACE_SIZE 0x10000000 | ||
14 | |||
15 | /* Kernel unmapped, cached 512MB */ | ||
16 | #define KSEG1 0xa0000000 | ||
17 | |||
18 | /* | ||
19 | * Here we define all the compile-time 'special' virtual | ||
20 | * addresses. The point is to have a constant address at | ||
21 | * compile time, but to set the physical address only | ||
22 | * in the boot process. We allocate these special addresses | ||
23 | * from the end of virtual memory (0xfffff000) backwards. | ||
24 | * Also this lets us do fail-safe vmalloc(), we | ||
25 | * can guarantee that these special addresses and | ||
26 | * vmalloc()-ed addresses never overlap. | ||
27 | * | ||
28 | * these 'compile-time allocated' memory buffers are | ||
29 | * fixed-size 4k pages. (or larger if used with an increment | ||
30 | * highger than 1) use fixmap_set(idx,phys) to associate | ||
31 | * physical memory with fixmap indices. | ||
32 | * | ||
33 | * TLB entries of such buffers will not be flushed across | ||
34 | * task switches. | ||
35 | */ | ||
36 | |||
37 | /* | ||
38 | * on UP currently we will have no trace of the fixmap mechanizm, | ||
39 | * no page table allocations, etc. This might change in the | ||
40 | * future, say framebuffers for the console driver(s) could be | ||
41 | * fix-mapped? | ||
42 | */ | ||
43 | enum fixed_addresses { | ||
44 | #define FIX_N_COLOURS 8 | ||
45 | FIX_CMAP_BEGIN, | ||
46 | FIX_CMAP_END = FIX_CMAP_BEGIN + FIX_N_COLOURS, | ||
47 | __end_of_fixed_addresses | ||
48 | }; | ||
49 | |||
50 | /* | ||
51 | * used by vmalloc.c. | ||
52 | * | ||
53 | * Leave one empty page between vmalloc'ed areas and | ||
54 | * the start of the fixmap, and leave one page empty | ||
55 | * at the top of mem.. | ||
56 | */ | ||
57 | #define FIXADDR_TOP ((unsigned long)(long)(int)0xfefe0000) | ||
58 | #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) | ||
59 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) | ||
60 | |||
61 | #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) | ||
62 | #define __virt_to_fix(x) \ | ||
63 | ((FIXADDR_TOP - ((x) & PAGE_MASK)) >> PAGE_SHIFT) | ||
64 | |||
65 | extern void __this_fixmap_does_not_exist(void); | ||
66 | |||
67 | /* | ||
68 | * 'index to address' translation. If anyone tries to use the idx | ||
69 | * directly without tranlation, we catch the bug with a NULL-deference | ||
70 | * kernel oops. Illegal ranges of incoming indices are caught too. | ||
71 | */ | ||
72 | static inline unsigned long fix_to_virt(const unsigned int idx) | ||
73 | { | ||
74 | return __fix_to_virt(idx); | ||
75 | } | ||
76 | |||
77 | static inline unsigned long virt_to_fix(const unsigned long vaddr) | ||
78 | { | ||
79 | return __virt_to_fix(vaddr); | ||
80 | } | ||
81 | |||
82 | #endif /* _ASM_SCORE_FIXMAP_H */ | ||
diff --git a/arch/score/include/asm/ftrace.h b/arch/score/include/asm/ftrace.h new file mode 100644 index 000000000000..79d6f10e1f5b --- /dev/null +++ b/arch/score/include/asm/ftrace.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef _ASM_SCORE_FTRACE_H | ||
2 | #define _ASM_SCORE_FTRACE_H | ||
3 | |||
4 | #endif /* _ASM_SCORE_FTRACE_H */ | ||
diff --git a/arch/score/include/asm/futex.h b/arch/score/include/asm/futex.h new file mode 100644 index 000000000000..1dca2420f8db --- /dev/null +++ b/arch/score/include/asm/futex.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_FUTEX_H | ||
2 | #define _ASM_SCORE_FUTEX_H | ||
3 | |||
4 | #include <asm-generic/futex.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_FUTEX_H */ | ||
diff --git a/arch/score/include/asm/hardirq.h b/arch/score/include/asm/hardirq.h new file mode 100644 index 000000000000..dc932c50d3ee --- /dev/null +++ b/arch/score/include/asm/hardirq.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_HARDIRQ_H | ||
2 | #define _ASM_SCORE_HARDIRQ_H | ||
3 | |||
4 | #include <asm-generic/hardirq.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_HARDIRQ_H */ | ||
diff --git a/arch/score/include/asm/hw_irq.h b/arch/score/include/asm/hw_irq.h new file mode 100644 index 000000000000..4caafb2b509a --- /dev/null +++ b/arch/score/include/asm/hw_irq.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef _ASM_SCORE_HW_IRQ_H | ||
2 | #define _ASM_SCORE_HW_IRQ_H | ||
3 | |||
4 | #endif /* _ASM_SCORE_HW_IRQ_H */ | ||
diff --git a/arch/score/include/asm/io.h b/arch/score/include/asm/io.h new file mode 100644 index 000000000000..fbbfd7132e3b --- /dev/null +++ b/arch/score/include/asm/io.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef _ASM_SCORE_IO_H | ||
2 | #define _ASM_SCORE_IO_H | ||
3 | |||
4 | #include <asm-generic/io.h> | ||
5 | |||
6 | #define virt_to_bus virt_to_phys | ||
7 | #define bus_to_virt phys_to_virt | ||
8 | |||
9 | #endif /* _ASM_SCORE_IO_H */ | ||
diff --git a/arch/score/include/asm/ioctl.h b/arch/score/include/asm/ioctl.h new file mode 100644 index 000000000000..a351d2194bfd --- /dev/null +++ b/arch/score/include/asm/ioctl.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_IOCTL_H | ||
2 | #define _ASM_SCORE_IOCTL_H | ||
3 | |||
4 | #include <asm-generic/ioctl.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_IOCTL_H */ | ||
diff --git a/arch/score/include/asm/ioctls.h b/arch/score/include/asm/ioctls.h new file mode 100644 index 000000000000..ed01d2b9aeab --- /dev/null +++ b/arch/score/include/asm/ioctls.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_IOCTLS_H | ||
2 | #define _ASM_SCORE_IOCTLS_H | ||
3 | |||
4 | #include <asm-generic/ioctls.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_IOCTLS_H */ | ||
diff --git a/arch/score/include/asm/ipcbuf.h b/arch/score/include/asm/ipcbuf.h new file mode 100644 index 000000000000..e082ceff1818 --- /dev/null +++ b/arch/score/include/asm/ipcbuf.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_IPCBUF_H | ||
2 | #define _ASM_SCORE_IPCBUF_H | ||
3 | |||
4 | #include <asm-generic/ipcbuf.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_IPCBUF_H */ | ||
diff --git a/arch/score/include/asm/irq.h b/arch/score/include/asm/irq.h new file mode 100644 index 000000000000..401f6704848c --- /dev/null +++ b/arch/score/include/asm/irq.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef _ASM_SCORE_IRQ_H | ||
2 | #define _ASM_SCORE_IRQ_H | ||
3 | |||
4 | #define EXCEPTION_VECTOR_BASE_ADDR 0xa0000000 | ||
5 | #define VECTOR_ADDRESS_OFFSET_MODE4 0 | ||
6 | #define VECTOR_ADDRESS_OFFSET_MODE16 1 | ||
7 | |||
8 | #define DEBUG_VECTOR_SIZE (0x4) | ||
9 | #define DEBUG_VECTOR_BASE_ADDR ((EXCEPTION_VECTOR_BASE_ADDR) + 0x1fc) | ||
10 | |||
11 | #define GENERAL_VECTOR_SIZE (0x10) | ||
12 | #define GENERAL_VECTOR_BASE_ADDR ((EXCEPTION_VECTOR_BASE_ADDR) + 0x200) | ||
13 | |||
14 | #define NR_IRQS 64 | ||
15 | #define IRQ_VECTOR_SIZE (0x10) | ||
16 | #define IRQ_VECTOR_BASE_ADDR ((EXCEPTION_VECTOR_BASE_ADDR) + 0x210) | ||
17 | #define IRQ_VECTOR_END_ADDR ((EXCEPTION_VECTOR_BASE_ADDR) + 0x5f0) | ||
18 | |||
19 | #define irq_canonicalize(irq) (irq) | ||
20 | |||
21 | #define P_INT_PNDL 0x95F50000 | ||
22 | #define P_INT_PNDH 0x95F50004 | ||
23 | #define P_INT_PRIORITY_M 0x95F50008 | ||
24 | #define P_INT_PRIORITY_SG0 0x95F50010 | ||
25 | #define P_INT_PRIORITY_SG1 0x95F50014 | ||
26 | #define P_INT_PRIORITY_SG2 0x95F50018 | ||
27 | #define P_INT_PRIORITY_SG3 0x95F5001C | ||
28 | #define P_INT_MASKL 0x95F50020 | ||
29 | #define P_INT_MASKH 0x95F50024 | ||
30 | |||
31 | #define IRQ_TIMER (7) /* Timer IRQ number of SPCT6600 */ | ||
32 | |||
33 | #endif /* _ASM_SCORE_IRQ_H */ | ||
diff --git a/arch/score/include/asm/irq_regs.h b/arch/score/include/asm/irq_regs.h new file mode 100644 index 000000000000..905b7b078bae --- /dev/null +++ b/arch/score/include/asm/irq_regs.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_IRQ_REGS_H | ||
2 | #define _ASM_SCORE_IRQ_REGS_H | ||
3 | |||
4 | #include <asm-generic/irq_regs.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_IRQ_REGS_H */ | ||
diff --git a/arch/score/include/asm/irqflags.h b/arch/score/include/asm/irqflags.h new file mode 100644 index 000000000000..92eeb33dd72b --- /dev/null +++ b/arch/score/include/asm/irqflags.h | |||
@@ -0,0 +1,111 @@ | |||
1 | #ifndef _ASM_SCORE_IRQFLAGS_H | ||
2 | #define _ASM_SCORE_IRQFLAGS_H | ||
3 | |||
4 | #ifndef __ASSEMBLY__ | ||
5 | |||
6 | #define raw_local_irq_save(x) \ | ||
7 | { \ | ||
8 | __asm__ __volatile__( \ | ||
9 | "mfcr r8, cr0;" \ | ||
10 | "li r9, 0xfffffffe;" \ | ||
11 | "nop;" \ | ||
12 | "mv %0, r8;" \ | ||
13 | "and r8, r8, r9;" \ | ||
14 | "mtcr r8, cr0;" \ | ||
15 | "nop;" \ | ||
16 | "nop;" \ | ||
17 | "nop;" \ | ||
18 | "nop;" \ | ||
19 | "nop;" \ | ||
20 | "ldi r9, 0x1;" \ | ||
21 | "and %0, %0, r9;" \ | ||
22 | : "=r" (x) \ | ||
23 | : \ | ||
24 | : "r8", "r9" \ | ||
25 | ); \ | ||
26 | } | ||
27 | |||
28 | #define raw_local_irq_restore(x) \ | ||
29 | { \ | ||
30 | __asm__ __volatile__( \ | ||
31 | "mfcr r8, cr0;" \ | ||
32 | "ldi r9, 0x1;" \ | ||
33 | "and %0, %0, r9;" \ | ||
34 | "or r8, r8, %0;" \ | ||
35 | "mtcr r8, cr0;" \ | ||
36 | "nop;" \ | ||
37 | "nop;" \ | ||
38 | "nop;" \ | ||
39 | "nop;" \ | ||
40 | "nop;" \ | ||
41 | : \ | ||
42 | : "r"(x) \ | ||
43 | : "r8", "r9" \ | ||
44 | ); \ | ||
45 | } | ||
46 | |||
47 | #define raw_local_irq_enable(void) \ | ||
48 | { \ | ||
49 | __asm__ __volatile__( \ | ||
50 | "mfcr\tr8,cr0;" \ | ||
51 | "nop;" \ | ||
52 | "nop;" \ | ||
53 | "ori\tr8,0x1;" \ | ||
54 | "mtcr\tr8,cr0;" \ | ||
55 | "nop;" \ | ||
56 | "nop;" \ | ||
57 | "nop;" \ | ||
58 | "nop;" \ | ||
59 | "nop;" \ | ||
60 | : \ | ||
61 | : \ | ||
62 | : "r8"); \ | ||
63 | } | ||
64 | |||
65 | #define raw_local_irq_disable(void) \ | ||
66 | { \ | ||
67 | __asm__ __volatile__( \ | ||
68 | "mfcr\tr8,cr0;" \ | ||
69 | "nop;" \ | ||
70 | "nop;" \ | ||
71 | "srli\tr8,r8,1;" \ | ||
72 | "slli\tr8,r8,1;" \ | ||
73 | "mtcr\tr8,cr0;" \ | ||
74 | "nop;" \ | ||
75 | "nop;" \ | ||
76 | "nop;" \ | ||
77 | "nop;" \ | ||
78 | "nop;" \ | ||
79 | : \ | ||
80 | : \ | ||
81 | : "r8"); \ | ||
82 | } | ||
83 | |||
84 | #define raw_local_save_flags(x) \ | ||
85 | { \ | ||
86 | __asm__ __volatile__( \ | ||
87 | "mfcr r8, cr0;" \ | ||
88 | "nop;" \ | ||
89 | "nop;" \ | ||
90 | "mv %0, r8;" \ | ||
91 | "nop;" \ | ||
92 | "nop;" \ | ||
93 | "nop;" \ | ||
94 | "nop;" \ | ||
95 | "nop;" \ | ||
96 | "ldi r9, 0x1;" \ | ||
97 | "and %0, %0, r9;" \ | ||
98 | : "=r" (x) \ | ||
99 | : \ | ||
100 | : "r8", "r9" \ | ||
101 | ); \ | ||
102 | } | ||
103 | |||
104 | static inline int raw_irqs_disabled_flags(unsigned long flags) | ||
105 | { | ||
106 | return !(flags & 1); | ||
107 | } | ||
108 | |||
109 | #endif | ||
110 | |||
111 | #endif /* _ASM_SCORE_IRQFLAGS_H */ | ||
diff --git a/arch/score/include/asm/kdebug.h b/arch/score/include/asm/kdebug.h new file mode 100644 index 000000000000..a666e513f747 --- /dev/null +++ b/arch/score/include/asm/kdebug.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_KDEBUG_H | ||
2 | #define _ASM_SCORE_KDEBUG_H | ||
3 | |||
4 | #include <asm-generic/kdebug.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_KDEBUG_H */ | ||
diff --git a/arch/score/include/asm/kmap_types.h b/arch/score/include/asm/kmap_types.h new file mode 100644 index 000000000000..6c46eb5077d3 --- /dev/null +++ b/arch/score/include/asm/kmap_types.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_KMAP_TYPES_H | ||
2 | #define _ASM_SCORE_KMAP_TYPES_H | ||
3 | |||
4 | #include <asm-generic/kmap_types.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_KMAP_TYPES_H */ | ||
diff --git a/arch/score/include/asm/linkage.h b/arch/score/include/asm/linkage.h new file mode 100644 index 000000000000..2580fbbfe946 --- /dev/null +++ b/arch/score/include/asm/linkage.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef _ASM_SCORE_LINKAGE_H | ||
2 | #define _ASM_SCORE_LINKAGE_H | ||
3 | |||
4 | #endif /* _ASM_SCORE_LINKAGE_H */ | ||
diff --git a/arch/score/include/asm/local.h b/arch/score/include/asm/local.h new file mode 100644 index 000000000000..7e02f13dbba8 --- /dev/null +++ b/arch/score/include/asm/local.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_LOCAL_H | ||
2 | #define _ASM_SCORE_LOCAL_H | ||
3 | |||
4 | #include <asm-generic/local.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_LOCAL_H */ | ||
diff --git a/arch/score/include/asm/mman.h b/arch/score/include/asm/mman.h new file mode 100644 index 000000000000..84d85ddfed8d --- /dev/null +++ b/arch/score/include/asm/mman.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_MMAN_H | ||
2 | #define _ASM_SCORE_MMAN_H | ||
3 | |||
4 | #include <asm-generic/mman.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_MMAN_H */ | ||
diff --git a/arch/score/include/asm/mmu.h b/arch/score/include/asm/mmu.h new file mode 100644 index 000000000000..676828e4c10a --- /dev/null +++ b/arch/score/include/asm/mmu.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_MMU_H | ||
2 | #define _ASM_SCORE_MMU_H | ||
3 | |||
4 | typedef unsigned long mm_context_t; | ||
5 | |||
6 | #endif /* _ASM_SCORE_MMU_H */ | ||
diff --git a/arch/score/include/asm/mmu_context.h b/arch/score/include/asm/mmu_context.h new file mode 100644 index 000000000000..2644577c96e8 --- /dev/null +++ b/arch/score/include/asm/mmu_context.h | |||
@@ -0,0 +1,113 @@ | |||
1 | #ifndef _ASM_SCORE_MMU_CONTEXT_H | ||
2 | #define _ASM_SCORE_MMU_CONTEXT_H | ||
3 | |||
4 | #include <linux/errno.h> | ||
5 | #include <linux/sched.h> | ||
6 | #include <linux/slab.h> | ||
7 | #include <asm-generic/mm_hooks.h> | ||
8 | |||
9 | #include <asm/cacheflush.h> | ||
10 | #include <asm/tlbflush.h> | ||
11 | #include <asm/scoreregs.h> | ||
12 | |||
13 | /* | ||
14 | * For the fast tlb miss handlers, we keep a per cpu array of pointers | ||
15 | * to the current pgd for each processor. Also, the proc. id is stuffed | ||
16 | * into the context register. | ||
17 | */ | ||
18 | extern unsigned long asid_cache; | ||
19 | extern unsigned long pgd_current; | ||
20 | |||
21 | #define TLBMISS_HANDLER_SETUP_PGD(pgd) (pgd_current = (unsigned long)(pgd)) | ||
22 | |||
23 | #define TLBMISS_HANDLER_SETUP() \ | ||
24 | do { \ | ||
25 | write_c0_context(0); \ | ||
26 | TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir) \ | ||
27 | } while (0) | ||
28 | |||
29 | /* | ||
30 | * All unused by hardware upper bits will be considered | ||
31 | * as a software asid extension. | ||
32 | */ | ||
33 | #define ASID_VERSION_MASK 0xfffff000 | ||
34 | #define ASID_FIRST_VERSION 0x1000 | ||
35 | |||
36 | /* PEVN --------- VPN ---------- --ASID--- -NA- */ | ||
37 | /* binary: 0000 0000 0000 0000 0000 0000 0001 0000 */ | ||
38 | /* binary: 0000 0000 0000 0000 0000 1111 1111 0000 */ | ||
39 | #define ASID_INC 0x10 | ||
40 | #define ASID_MASK 0xff0 | ||
41 | |||
42 | static inline void enter_lazy_tlb(struct mm_struct *mm, | ||
43 | struct task_struct *tsk) | ||
44 | {} | ||
45 | |||
46 | static inline void | ||
47 | get_new_mmu_context(struct mm_struct *mm) | ||
48 | { | ||
49 | unsigned long asid = asid_cache + ASID_INC; | ||
50 | |||
51 | if (!(asid & ASID_MASK)) { | ||
52 | local_flush_tlb_all(); /* start new asid cycle */ | ||
53 | if (!asid) /* fix version if needed */ | ||
54 | asid = ASID_FIRST_VERSION; | ||
55 | } | ||
56 | |||
57 | mm->context = asid; | ||
58 | asid_cache = asid; | ||
59 | } | ||
60 | |||
61 | /* | ||
62 | * Initialize the context related info for a new mm_struct | ||
63 | * instance. | ||
64 | */ | ||
65 | static inline int | ||
66 | init_new_context(struct task_struct *tsk, struct mm_struct *mm) | ||
67 | { | ||
68 | mm->context = 0; | ||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | ||
73 | struct task_struct *tsk) | ||
74 | { | ||
75 | unsigned long flags; | ||
76 | |||
77 | local_irq_save(flags); | ||
78 | if ((next->context ^ asid_cache) & ASID_VERSION_MASK) | ||
79 | get_new_mmu_context(next); | ||
80 | |||
81 | pevn_set(next->context); | ||
82 | TLBMISS_HANDLER_SETUP_PGD(next->pgd); | ||
83 | local_irq_restore(flags); | ||
84 | } | ||
85 | |||
86 | /* | ||
87 | * Destroy context related info for an mm_struct that is about | ||
88 | * to be put to rest. | ||
89 | */ | ||
90 | static inline void destroy_context(struct mm_struct *mm) | ||
91 | {} | ||
92 | |||
93 | static inline void | ||
94 | deactivate_mm(struct task_struct *task, struct mm_struct *mm) | ||
95 | {} | ||
96 | |||
97 | /* | ||
98 | * After we have set current->mm to a new value, this activates | ||
99 | * the context for the new mm so we see the new mappings. | ||
100 | */ | ||
101 | static inline void | ||
102 | activate_mm(struct mm_struct *prev, struct mm_struct *next) | ||
103 | { | ||
104 | unsigned long flags; | ||
105 | |||
106 | local_irq_save(flags); | ||
107 | get_new_mmu_context(next); | ||
108 | pevn_set(next->context); | ||
109 | TLBMISS_HANDLER_SETUP_PGD(next->pgd); | ||
110 | local_irq_restore(flags); | ||
111 | } | ||
112 | |||
113 | #endif /* _ASM_SCORE_MMU_CONTEXT_H */ | ||
diff --git a/arch/score/include/asm/module.h b/arch/score/include/asm/module.h new file mode 100644 index 000000000000..f0b5dc0bd023 --- /dev/null +++ b/arch/score/include/asm/module.h | |||
@@ -0,0 +1,39 @@ | |||
1 | #ifndef _ASM_SCORE_MODULE_H | ||
2 | #define _ASM_SCORE_MODULE_H | ||
3 | |||
4 | #include <linux/list.h> | ||
5 | #include <asm/uaccess.h> | ||
6 | |||
7 | struct mod_arch_specific { | ||
8 | /* Data Bus Error exception tables */ | ||
9 | struct list_head dbe_list; | ||
10 | const struct exception_table_entry *dbe_start; | ||
11 | const struct exception_table_entry *dbe_end; | ||
12 | }; | ||
13 | |||
14 | typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */ | ||
15 | |||
16 | #define Elf_Shdr Elf32_Shdr | ||
17 | #define Elf_Sym Elf32_Sym | ||
18 | #define Elf_Ehdr Elf32_Ehdr | ||
19 | #define Elf_Addr Elf32_Addr | ||
20 | |||
21 | /* Given an address, look for it in the exception tables. */ | ||
22 | #ifdef CONFIG_MODULES | ||
23 | const struct exception_table_entry *search_module_dbetables(unsigned long addr); | ||
24 | #else | ||
25 | static inline const struct exception_table_entry | ||
26 | *search_module_dbetables(unsigned long addr) | ||
27 | { | ||
28 | return NULL; | ||
29 | } | ||
30 | #endif | ||
31 | |||
32 | #define MODULE_PROC_FAMILY "SCORE7" | ||
33 | #define MODULE_KERNEL_TYPE "32BIT " | ||
34 | #define MODULE_KERNEL_SMTC "" | ||
35 | |||
36 | #define MODULE_ARCH_VERMAGIC \ | ||
37 | MODULE_PROC_FAMILY MODULE_KERNEL_TYPE MODULE_KERNEL_SMTC | ||
38 | |||
39 | #endif /* _ASM_SCORE_MODULE_H */ | ||
diff --git a/arch/score/include/asm/msgbuf.h b/arch/score/include/asm/msgbuf.h new file mode 100644 index 000000000000..7506721e29fa --- /dev/null +++ b/arch/score/include/asm/msgbuf.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_MSGBUF_H | ||
2 | #define _ASM_SCORE_MSGBUF_H | ||
3 | |||
4 | #include <asm-generic/msgbuf.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_MSGBUF_H */ | ||
diff --git a/arch/score/include/asm/mutex.h b/arch/score/include/asm/mutex.h new file mode 100644 index 000000000000..10d48fe4db97 --- /dev/null +++ b/arch/score/include/asm/mutex.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_MUTEX_H | ||
2 | #define _ASM_SCORE_MUTEX_H | ||
3 | |||
4 | #include <asm-generic/mutex-dec.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_MUTEX_H */ | ||
diff --git a/arch/score/include/asm/page.h b/arch/score/include/asm/page.h new file mode 100644 index 000000000000..67e98206be6a --- /dev/null +++ b/arch/score/include/asm/page.h | |||
@@ -0,0 +1,92 @@ | |||
1 | #ifndef _ASM_SCORE_PAGE_H | ||
2 | #define _ASM_SCORE_PAGE_H | ||
3 | |||
4 | #include <linux/pfn.h> | ||
5 | |||
6 | /* PAGE_SHIFT determines the page size */ | ||
7 | #define PAGE_SHIFT (12) | ||
8 | #define PAGE_SIZE (1UL << PAGE_SHIFT) | ||
9 | #define PAGE_MASK (~(PAGE_SIZE-1)) | ||
10 | |||
11 | #ifdef __KERNEL__ | ||
12 | |||
13 | #ifndef __ASSEMBLY__ | ||
14 | |||
15 | #define PAGE_UP(addr) (((addr)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1))) | ||
16 | #define PAGE_DOWN(addr) ((addr)&(~((PAGE_SIZE)-1))) | ||
17 | |||
18 | /* align addr on a size boundary - adjust address up/down if needed */ | ||
19 | #define _ALIGN_UP(addr, size) (((addr)+((size)-1))&(~((size)-1))) | ||
20 | #define _ALIGN_DOWN(addr, size) ((addr)&(~((size)-1))) | ||
21 | |||
22 | /* align addr on a size boundary - adjust address up if needed */ | ||
23 | #define _ALIGN(addr, size) _ALIGN_UP(addr, size) | ||
24 | |||
25 | /* | ||
26 | * PAGE_OFFSET -- the first address of the first page of memory. When not | ||
27 | * using MMU this corresponds to the first free page in physical memory (aligned | ||
28 | * on a page boundary). | ||
29 | */ | ||
30 | #define PAGE_OFFSET (0xA0000000UL) | ||
31 | |||
32 | #define clear_page(pgaddr) memset((pgaddr), 0, PAGE_SIZE) | ||
33 | #define copy_page(to, from) memcpy((to), (from), PAGE_SIZE) | ||
34 | |||
35 | #define clear_user_page(pgaddr, vaddr, page) memset((pgaddr), 0, PAGE_SIZE) | ||
36 | #define copy_user_page(vto, vfrom, vaddr, topg) \ | ||
37 | memcpy((vto), (vfrom), PAGE_SIZE) | ||
38 | |||
39 | /* | ||
40 | * These are used to make use of C type-checking.. | ||
41 | */ | ||
42 | |||
43 | typedef struct { unsigned long pte; } pte_t; /* page table entry */ | ||
44 | typedef struct { unsigned long pgd; } pgd_t; /* PGD table entry */ | ||
45 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
46 | typedef struct page *pgtable_t; | ||
47 | |||
48 | #define pte_val(x) ((x).pte) | ||
49 | #define pgd_val(x) ((x).pgd) | ||
50 | #define pgprot_val(x) ((x).pgprot) | ||
51 | |||
52 | #define __pte(x) ((pte_t) { (x) }) | ||
53 | #define __pgd(x) ((pgd_t) { (x) }) | ||
54 | #define __pgprot(x) ((pgprot_t) { (x) }) | ||
55 | |||
56 | extern unsigned long max_low_pfn; | ||
57 | extern unsigned long min_low_pfn; | ||
58 | extern unsigned long max_pfn; | ||
59 | |||
60 | #define __pa(vaddr) ((unsigned long) (vaddr)) | ||
61 | #define __va(paddr) ((void *) (paddr)) | ||
62 | |||
63 | #define phys_to_pfn(phys) (PFN_DOWN(phys)) | ||
64 | #define pfn_to_phys(pfn) (PFN_PHYS(pfn)) | ||
65 | |||
66 | #define virt_to_pfn(vaddr) (phys_to_pfn((__pa(vaddr)))) | ||
67 | #define pfn_to_virt(pfn) __va(pfn_to_phys((pfn))) | ||
68 | |||
69 | #define virt_to_page(vaddr) (pfn_to_page(virt_to_pfn(vaddr))) | ||
70 | #define page_to_virt(page) (pfn_to_virt(page_to_pfn(page))) | ||
71 | |||
72 | #define page_to_phys(page) (pfn_to_phys(page_to_pfn(page))) | ||
73 | #define page_to_bus(page) (page_to_phys(page)) | ||
74 | #define phys_to_page(paddr) (pfn_to_page(phys_to_pfn(paddr))) | ||
75 | |||
76 | #define pfn_valid(pfn) ((pfn) >= min_low_pfn && (pfn) < max_mapnr) | ||
77 | |||
78 | #define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT) | ||
79 | |||
80 | #endif /* __ASSEMBLY__ */ | ||
81 | |||
82 | #define virt_addr_valid(vaddr) (pfn_valid(virt_to_pfn(vaddr))) | ||
83 | |||
84 | #endif /* __KERNEL__ */ | ||
85 | |||
86 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | ||
87 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
88 | |||
89 | #include <asm-generic/memory_model.h> | ||
90 | #include <asm-generic/getorder.h> | ||
91 | |||
92 | #endif /* _ASM_SCORE_PAGE_H */ | ||
diff --git a/arch/score/include/asm/param.h b/arch/score/include/asm/param.h new file mode 100644 index 000000000000..916b8690b6aa --- /dev/null +++ b/arch/score/include/asm/param.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_PARAM_H | ||
2 | #define _ASM_SCORE_PARAM_H | ||
3 | |||
4 | #include <asm-generic/param.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_PARAM_H */ | ||
diff --git a/arch/score/include/asm/pci.h b/arch/score/include/asm/pci.h new file mode 100644 index 000000000000..3f3cfd82549c --- /dev/null +++ b/arch/score/include/asm/pci.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef _ASM_SCORE_PCI_H | ||
2 | #define _ASM_SCORE_PCI_H | ||
3 | |||
4 | #endif /* _ASM_SCORE_PCI_H */ | ||
diff --git a/arch/score/include/asm/percpu.h b/arch/score/include/asm/percpu.h new file mode 100644 index 000000000000..e7bd4e05b475 --- /dev/null +++ b/arch/score/include/asm/percpu.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_PERCPU_H | ||
2 | #define _ASM_SCORE_PERCPU_H | ||
3 | |||
4 | #include <asm-generic/percpu.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_PERCPU_H */ | ||
diff --git a/arch/score/include/asm/pgalloc.h b/arch/score/include/asm/pgalloc.h new file mode 100644 index 000000000000..28dacc1cbbab --- /dev/null +++ b/arch/score/include/asm/pgalloc.h | |||
@@ -0,0 +1,83 @@ | |||
1 | #ifndef _ASM_SCORE_PGALLOC_H | ||
2 | #define _ASM_SCORE_PGALLOC_H | ||
3 | |||
4 | #include <linux/mm.h> | ||
5 | |||
6 | static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, | ||
7 | pte_t *pte) | ||
8 | { | ||
9 | set_pmd(pmd, __pmd((unsigned long)pte)); | ||
10 | } | ||
11 | |||
12 | static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, | ||
13 | pgtable_t pte) | ||
14 | { | ||
15 | set_pmd(pmd, __pmd((unsigned long)page_address(pte))); | ||
16 | } | ||
17 | |||
18 | #define pmd_pgtable(pmd) pmd_page(pmd) | ||
19 | |||
20 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) | ||
21 | { | ||
22 | pgd_t *ret, *init; | ||
23 | |||
24 | ret = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_ORDER); | ||
25 | if (ret) { | ||
26 | init = pgd_offset(&init_mm, 0UL); | ||
27 | pgd_init((unsigned long)ret); | ||
28 | memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, | ||
29 | (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); | ||
30 | } | ||
31 | |||
32 | return ret; | ||
33 | } | ||
34 | |||
35 | static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) | ||
36 | { | ||
37 | free_pages((unsigned long)pgd, PGD_ORDER); | ||
38 | } | ||
39 | |||
40 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | ||
41 | unsigned long address) | ||
42 | { | ||
43 | pte_t *pte; | ||
44 | |||
45 | pte = (pte_t *) __get_free_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, | ||
46 | PTE_ORDER); | ||
47 | |||
48 | return pte; | ||
49 | } | ||
50 | |||
51 | static inline struct page *pte_alloc_one(struct mm_struct *mm, | ||
52 | unsigned long address) | ||
53 | { | ||
54 | struct page *pte; | ||
55 | |||
56 | pte = alloc_pages(GFP_KERNEL | __GFP_REPEAT, PTE_ORDER); | ||
57 | if (pte) { | ||
58 | clear_highpage(pte); | ||
59 | pgtable_page_ctor(pte); | ||
60 | } | ||
61 | return pte; | ||
62 | } | ||
63 | |||
64 | static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) | ||
65 | { | ||
66 | free_pages((unsigned long)pte, PTE_ORDER); | ||
67 | } | ||
68 | |||
69 | static inline void pte_free(struct mm_struct *mm, pgtable_t pte) | ||
70 | { | ||
71 | pgtable_page_dtor(pte); | ||
72 | __free_pages(pte, PTE_ORDER); | ||
73 | } | ||
74 | |||
75 | #define __pte_free_tlb(tlb, pte) \ | ||
76 | do { \ | ||
77 | pgtable_page_dtor(pte); \ | ||
78 | tlb_remove_page((tlb), pte); \ | ||
79 | } while (0) | ||
80 | |||
81 | #define check_pgt_cache() do {} while (0) | ||
82 | |||
83 | #endif /* _ASM_SCORE_PGALLOC_H */ | ||
diff --git a/arch/score/include/asm/pgtable-bits.h b/arch/score/include/asm/pgtable-bits.h new file mode 100644 index 000000000000..ca16d357a644 --- /dev/null +++ b/arch/score/include/asm/pgtable-bits.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef _ASM_SCORE_PGTABLE_BITS_H | ||
2 | #define _ASM_SCORE_PGTABLE_BITS_H | ||
3 | |||
4 | #define _PAGE_ACCESSED (1<<5) /* implemented in software */ | ||
5 | #define _PAGE_READ (1<<6) /* implemented in software */ | ||
6 | #define _PAGE_WRITE (1<<7) /* implemented in software */ | ||
7 | #define _PAGE_PRESENT (1<<9) /* implemented in software */ | ||
8 | #define _PAGE_MODIFIED (1<<10) /* implemented in software */ | ||
9 | #define _PAGE_FILE (1<<10) | ||
10 | |||
11 | #define _PAGE_GLOBAL (1<<0) | ||
12 | #define _PAGE_VALID (1<<1) | ||
13 | #define _PAGE_SILENT_READ (1<<1) /* synonym */ | ||
14 | #define _PAGE_DIRTY (1<<2) /* Write bit */ | ||
15 | #define _PAGE_SILENT_WRITE (1<<2) | ||
16 | #define _PAGE_CACHE (1<<3) /* cache */ | ||
17 | #define _CACHE_MASK (1<<3) | ||
18 | #define _PAGE_BUFFERABLE (1<<4) /*Fallow Spec. */ | ||
19 | |||
20 | #define _PAGE_CHG_MASK \ | ||
21 | (PAGE_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED | _PAGE_CACHE) | ||
22 | |||
23 | #endif /* _ASM_SCORE_PGTABLE_BITS_H */ | ||
diff --git a/arch/score/include/asm/pgtable.h b/arch/score/include/asm/pgtable.h new file mode 100644 index 000000000000..0f7177a42205 --- /dev/null +++ b/arch/score/include/asm/pgtable.h | |||
@@ -0,0 +1,267 @@ | |||
1 | #ifndef _ASM_SCORE_PGTABLE_H | ||
2 | #define _ASM_SCORE_PGTABLE_H | ||
3 | |||
4 | #include <linux/const.h> | ||
5 | #include <asm-generic/pgtable-nopmd.h> | ||
6 | |||
7 | #include <asm/fixmap.h> | ||
8 | #include <asm/setup.h> | ||
9 | #include <asm/pgtable-bits.h> | ||
10 | |||
11 | extern void load_pgd(unsigned long pg_dir); | ||
12 | extern pte_t invalid_pte_table[PAGE_SIZE/sizeof(pte_t)]; | ||
13 | |||
14 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ | ||
15 | #define PGDIR_SHIFT 22 | ||
16 | #define PGDIR_SIZE (_AC(1, UL) << PGDIR_SHIFT) | ||
17 | #define PGDIR_MASK (~(PGDIR_SIZE - 1)) | ||
18 | |||
19 | /* | ||
20 | * Entries per page directory level: we use two-level, so | ||
21 | * we don't really have any PUD/PMD directory physically. | ||
22 | */ | ||
23 | #define PGD_ORDER 0 | ||
24 | #define PTE_ORDER 0 | ||
25 | |||
26 | #define PTRS_PER_PGD 1024 | ||
27 | #define PTRS_PER_PTE 1024 | ||
28 | |||
29 | #define USER_PTRS_PER_PGD (0x80000000UL/PGDIR_SIZE) | ||
30 | #define FIRST_USER_ADDRESS 0 | ||
31 | |||
32 | #define VMALLOC_START (0xc0000000UL) | ||
33 | |||
34 | #define PKMAP_BASE (0xfd000000UL) | ||
35 | |||
36 | #define VMALLOC_END (FIXADDR_START - 2*PAGE_SIZE) | ||
37 | |||
38 | #define pte_ERROR(e) \ | ||
39 | printk(KERN_ERR "%s:%d: bad pte %08lx.\n", \ | ||
40 | __FILE__, __LINE__, pte_val(e)) | ||
41 | #define pgd_ERROR(e) \ | ||
42 | printk(KERN_ERR "%s:%d: bad pgd %08lx.\n", \ | ||
43 | __FILE__, __LINE__, pgd_val(e)) | ||
44 | |||
45 | /* | ||
46 | * Empty pgd/pmd entries point to the invalid_pte_table. | ||
47 | */ | ||
48 | static inline int pmd_none(pmd_t pmd) | ||
49 | { | ||
50 | return pmd_val(pmd) == (unsigned long) invalid_pte_table; | ||
51 | } | ||
52 | |||
53 | #define pmd_bad(pmd) (pmd_val(pmd) & ~PAGE_MASK) | ||
54 | |||
55 | static inline int pmd_present(pmd_t pmd) | ||
56 | { | ||
57 | return pmd_val(pmd) != (unsigned long) invalid_pte_table; | ||
58 | } | ||
59 | |||
60 | static inline void pmd_clear(pmd_t *pmdp) | ||
61 | { | ||
62 | pmd_val(*pmdp) = ((unsigned long) invalid_pte_table); | ||
63 | } | ||
64 | |||
65 | #define pte_page(x) pfn_to_page(pte_pfn(x)) | ||
66 | #define pte_pfn(x) ((unsigned long)((x).pte >> PAGE_SHIFT)) | ||
67 | #define pfn_pte(pfn, prot) \ | ||
68 | __pte(((unsigned long long)(pfn) << PAGE_SHIFT) | pgprot_val(prot)) | ||
69 | |||
70 | #define __pgd_offset(address) pgd_index(address) | ||
71 | #define __pud_offset(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1)) | ||
72 | #define __pmd_offset(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) | ||
73 | |||
74 | /* to find an entry in a kernel page-table-directory */ | ||
75 | #define pgd_offset_k(address) pgd_offset(&init_mm, address) | ||
76 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) | ||
77 | |||
78 | /* to find an entry in a page-table-directory */ | ||
79 | #define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr)) | ||
80 | |||
81 | /* Find an entry in the third-level page table.. */ | ||
82 | #define __pte_offset(address) \ | ||
83 | (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | ||
84 | #define pte_offset(dir, address) \ | ||
85 | ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) | ||
86 | #define pte_offset_kernel(dir, address) \ | ||
87 | ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) | ||
88 | |||
89 | #define pte_offset_map(dir, address) \ | ||
90 | ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) | ||
91 | #define pte_offset_map_nested(dir, address) \ | ||
92 | ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) | ||
93 | #define pte_unmap(pte) ((void)(pte)) | ||
94 | #define pte_unmap_nested(pte) ((void)(pte)) | ||
95 | |||
96 | /* | ||
97 | * Bits 9(_PAGE_PRESENT) and 10(_PAGE_FILE)are taken, | ||
98 | * split up 30 bits of offset into this range: | ||
99 | */ | ||
100 | #define PTE_FILE_MAX_BITS 30 | ||
101 | #define pte_to_pgoff(_pte) \ | ||
102 | (((_pte).pte & 0x1ff) | (((_pte).pte >> 11) << 9)) | ||
103 | #define pgoff_to_pte(off) \ | ||
104 | ((pte_t) {((off) & 0x1ff) | (((off) >> 9) << 11) | _PAGE_FILE}) | ||
105 | #define __pte_to_swp_entry(pte) \ | ||
106 | ((swp_entry_t) { pte_val(pte)}) | ||
107 | #define __swp_entry_to_pte(x) ((pte_t) {(x).val}) | ||
108 | |||
109 | #define __P000 __pgprot(0) | ||
110 | #define __P001 __pgprot(0) | ||
111 | #define __P010 __pgprot(0) | ||
112 | #define __P011 __pgprot(0) | ||
113 | #define __P100 __pgprot(0) | ||
114 | #define __P101 __pgprot(0) | ||
115 | #define __P110 __pgprot(0) | ||
116 | #define __P111 __pgprot(0) | ||
117 | |||
118 | #define __S000 __pgprot(0) | ||
119 | #define __S001 __pgprot(0) | ||
120 | #define __S010 __pgprot(0) | ||
121 | #define __S011 __pgprot(0) | ||
122 | #define __S100 __pgprot(0) | ||
123 | #define __S101 __pgprot(0) | ||
124 | #define __S110 __pgprot(0) | ||
125 | #define __S111 __pgprot(0) | ||
126 | |||
127 | #define pmd_page(pmd) virt_to_page(__va(pmd_val(pmd))) | ||
128 | #define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot) | ||
129 | static inline pte_t pte_mkspecial(pte_t pte) { return pte; } | ||
130 | |||
131 | #define set_pte(pteptr, pteval) (*(pteptr) = pteval) | ||
132 | #define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval) | ||
133 | #define pte_clear(mm, addr, xp) \ | ||
134 | do { set_pte_at(mm, addr, xp, __pte(0)); } while (0) | ||
135 | |||
136 | #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ | ||
137 | remap_pfn_range(vma, vaddr, pfn, size, prot) | ||
138 | |||
139 | #define pgd_present(pgd) (1) /* pages are always present on non MMU */ | ||
140 | #define pgd_none(pgd) (0) | ||
141 | #define pgd_bad(pgd) (0) | ||
142 | #define pgd_clear(pgdp) | ||
143 | |||
144 | #define kern_addr_valid(addr) (1) | ||
145 | #define pmd_offset(a, b) ((void *) 0) | ||
146 | #define pmd_page_vaddr(pmd) pmd_val(pmd) | ||
147 | |||
148 | #define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL)) | ||
149 | #define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT) | ||
150 | |||
151 | #define pud_offset(pgd, address) ((pud_t *) pgd) | ||
152 | |||
153 | #define PAGE_NONE __pgprot(0) /* these mean nothing to non MMU */ | ||
154 | #define PAGE_SHARED __pgprot(0) /* these mean nothing to non MMU */ | ||
155 | #define PAGE_COPY __pgprot(0) /* these mean nothing to non MMU */ | ||
156 | #define PAGE_READONLY __pgprot(0) /* these mean nothing to non MMU */ | ||
157 | #define PAGE_KERNEL __pgprot(0) /* these mean nothing to non MMU */ | ||
158 | |||
159 | #define pgprot_noncached(x) (x) | ||
160 | |||
161 | #define __swp_type(x) (0) | ||
162 | #define __swp_offset(x) (0) | ||
163 | #define __swp_entry(typ, off) ((swp_entry_t) { ((typ) | ((off) << 7)) }) | ||
164 | |||
165 | #define ZERO_PAGE(vaddr) ({ BUG(); NULL; }) | ||
166 | |||
167 | #define swapper_pg_dir ((pgd_t *) NULL) | ||
168 | |||
169 | #define pgtable_cache_init() do {} while (0) | ||
170 | |||
171 | #define arch_enter_lazy_cpu_mode() do {} while (0) | ||
172 | |||
173 | static inline int pte_write(pte_t pte) | ||
174 | { | ||
175 | return pte_val(pte) & _PAGE_WRITE; | ||
176 | } | ||
177 | |||
178 | static inline int pte_dirty(pte_t pte) | ||
179 | { | ||
180 | return pte_val(pte) & _PAGE_MODIFIED; | ||
181 | } | ||
182 | |||
183 | static inline int pte_young(pte_t pte) | ||
184 | { | ||
185 | return pte_val(pte) & _PAGE_ACCESSED; | ||
186 | } | ||
187 | |||
188 | static inline int pte_file(pte_t pte) | ||
189 | { | ||
190 | return pte_val(pte) & _PAGE_FILE; | ||
191 | } | ||
192 | |||
193 | #define pte_special(pte) (0) | ||
194 | |||
195 | static inline pte_t pte_wrprotect(pte_t pte) | ||
196 | { | ||
197 | pte_val(pte) &= ~(_PAGE_WRITE | _PAGE_SILENT_WRITE); | ||
198 | return pte; | ||
199 | } | ||
200 | |||
201 | static inline pte_t pte_mkclean(pte_t pte) | ||
202 | { | ||
203 | pte_val(pte) &= ~(_PAGE_MODIFIED|_PAGE_SILENT_WRITE); | ||
204 | return pte; | ||
205 | } | ||
206 | |||
207 | static inline pte_t pte_mkold(pte_t pte) | ||
208 | { | ||
209 | pte_val(pte) &= ~(_PAGE_ACCESSED|_PAGE_SILENT_READ); | ||
210 | return pte; | ||
211 | } | ||
212 | |||
213 | static inline pte_t pte_mkwrite(pte_t pte) | ||
214 | { | ||
215 | pte_val(pte) |= _PAGE_WRITE; | ||
216 | if (pte_val(pte) & _PAGE_MODIFIED) | ||
217 | pte_val(pte) |= _PAGE_SILENT_WRITE; | ||
218 | return pte; | ||
219 | } | ||
220 | |||
221 | static inline pte_t pte_mkdirty(pte_t pte) | ||
222 | { | ||
223 | pte_val(pte) |= _PAGE_MODIFIED; | ||
224 | if (pte_val(pte) & _PAGE_WRITE) | ||
225 | pte_val(pte) |= _PAGE_SILENT_WRITE; | ||
226 | return pte; | ||
227 | } | ||
228 | |||
229 | static inline pte_t pte_mkyoung(pte_t pte) | ||
230 | { | ||
231 | pte_val(pte) |= _PAGE_ACCESSED; | ||
232 | if (pte_val(pte) & _PAGE_READ) | ||
233 | pte_val(pte) |= _PAGE_SILENT_READ; | ||
234 | return pte; | ||
235 | } | ||
236 | |||
237 | #define set_pmd(pmdptr, pmdval) \ | ||
238 | do { *(pmdptr) = (pmdval); } while (0) | ||
239 | #define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT) | ||
240 | |||
241 | extern unsigned long pgd_current; | ||
242 | extern void paging_init(void); | ||
243 | |||
244 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | ||
245 | { | ||
246 | return __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot)); | ||
247 | } | ||
248 | |||
249 | extern void __update_tlb(struct vm_area_struct *vma, | ||
250 | unsigned long address, pte_t pte); | ||
251 | extern void __update_cache(struct vm_area_struct *vma, | ||
252 | unsigned long address, pte_t pte); | ||
253 | |||
254 | static inline void update_mmu_cache(struct vm_area_struct *vma, | ||
255 | unsigned long address, pte_t pte) | ||
256 | { | ||
257 | __update_tlb(vma, address, pte); | ||
258 | __update_cache(vma, address, pte); | ||
259 | } | ||
260 | |||
261 | #ifndef __ASSEMBLY__ | ||
262 | #include <asm-generic/pgtable.h> | ||
263 | |||
264 | void setup_memory(void); | ||
265 | #endif /* __ASSEMBLY__ */ | ||
266 | |||
267 | #endif /* _ASM_SCORE_PGTABLE_H */ | ||
diff --git a/arch/score/include/asm/poll.h b/arch/score/include/asm/poll.h new file mode 100644 index 000000000000..18532db02861 --- /dev/null +++ b/arch/score/include/asm/poll.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_POLL_H | ||
2 | #define _ASM_SCORE_POLL_H | ||
3 | |||
4 | #include <asm-generic/poll.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_POLL_H */ | ||
diff --git a/arch/score/include/asm/posix_types.h b/arch/score/include/asm/posix_types.h new file mode 100644 index 000000000000..b88acf80048a --- /dev/null +++ b/arch/score/include/asm/posix_types.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_POSIX_TYPES_H | ||
2 | #define _ASM_SCORE_POSIX_TYPES_H | ||
3 | |||
4 | #include <asm-generic/posix_types.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_POSIX_TYPES_H */ | ||
diff --git a/arch/score/include/asm/processor.h b/arch/score/include/asm/processor.h new file mode 100644 index 000000000000..7e22f216d771 --- /dev/null +++ b/arch/score/include/asm/processor.h | |||
@@ -0,0 +1,106 @@ | |||
1 | #ifndef _ASM_SCORE_PROCESSOR_H | ||
2 | #define _ASM_SCORE_PROCESSOR_H | ||
3 | |||
4 | #include <linux/cpumask.h> | ||
5 | #include <linux/threads.h> | ||
6 | |||
7 | #include <asm/segment.h> | ||
8 | |||
9 | struct task_struct; | ||
10 | |||
11 | /* | ||
12 | * System setup and hardware flags.. | ||
13 | */ | ||
14 | extern void (*cpu_wait)(void); | ||
15 | |||
16 | extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); | ||
17 | extern unsigned long thread_saved_pc(struct task_struct *tsk); | ||
18 | extern void start_thread(struct pt_regs *regs, | ||
19 | unsigned long pc, unsigned long sp); | ||
20 | extern unsigned long get_wchan(struct task_struct *p); | ||
21 | |||
22 | /* | ||
23 | * Return current * instruction pointer ("program counter"). | ||
24 | */ | ||
25 | #define current_text_addr() ({ __label__ _l; _l: &&_l; }) | ||
26 | |||
27 | #define cpu_relax() barrier() | ||
28 | #define release_thread(thread) do {} while (0) | ||
29 | #define prepare_to_copy(tsk) do {} while (0) | ||
30 | |||
31 | /* | ||
32 | * User space process size: 2GB. This is hardcoded into a few places, | ||
33 | * so don't change it unless you know what you are doing. | ||
34 | */ | ||
35 | #define TASK_SIZE 0x7fff8000UL | ||
36 | |||
37 | /* | ||
38 | * This decides where the kernel will search for a free chunk of vm | ||
39 | * space during mmap's. | ||
40 | */ | ||
41 | #define TASK_UNMAPPED_BASE ((TASK_SIZE / 3) & ~(PAGE_SIZE)) | ||
42 | |||
43 | #ifdef __KERNEL__ | ||
44 | #define STACK_TOP TASK_SIZE | ||
45 | #define STACK_TOP_MAX TASK_SIZE | ||
46 | #endif | ||
47 | |||
48 | /* | ||
49 | * If you change thread_struct remember to change the #defines below too! | ||
50 | */ | ||
51 | struct thread_struct { | ||
52 | unsigned long reg0, reg2, reg3; | ||
53 | unsigned long reg12, reg13, reg14, reg15, reg16; | ||
54 | unsigned long reg17, reg18, reg19, reg20, reg21; | ||
55 | |||
56 | unsigned long cp0_psr; | ||
57 | unsigned long cp0_ema; /* Last user fault */ | ||
58 | unsigned long cp0_badvaddr; /* Last user fault */ | ||
59 | unsigned long cp0_baduaddr; /* Last kernel fault accessing USEG */ | ||
60 | unsigned long error_code; | ||
61 | unsigned long trap_no; | ||
62 | |||
63 | unsigned long mflags; | ||
64 | unsigned long reg29; | ||
65 | |||
66 | unsigned long single_step; | ||
67 | unsigned long ss_nextcnt; | ||
68 | |||
69 | unsigned long insn1_type; | ||
70 | unsigned long addr1; | ||
71 | unsigned long insn1; | ||
72 | |||
73 | unsigned long insn2_type; | ||
74 | unsigned long addr2; | ||
75 | unsigned long insn2; | ||
76 | |||
77 | mm_segment_t current_ds; | ||
78 | }; | ||
79 | |||
80 | #define INIT_THREAD { \ | ||
81 | .reg0 = 0, \ | ||
82 | .reg2 = 0, \ | ||
83 | .reg3 = 0, \ | ||
84 | .reg12 = 0, \ | ||
85 | .reg13 = 0, \ | ||
86 | .reg14 = 0, \ | ||
87 | .reg15 = 0, \ | ||
88 | .reg16 = 0, \ | ||
89 | .reg17 = 0, \ | ||
90 | .reg18 = 0, \ | ||
91 | .reg19 = 0, \ | ||
92 | .reg20 = 0, \ | ||
93 | .reg21 = 0, \ | ||
94 | .cp0_psr = 0, \ | ||
95 | .error_code = 0, \ | ||
96 | .trap_no = 0, \ | ||
97 | } | ||
98 | |||
99 | #define kstk_tos(tsk) \ | ||
100 | ((unsigned long)task_stack_page(tsk) + THREAD_SIZE - 32) | ||
101 | #define task_pt_regs(tsk) ((struct pt_regs *)kstk_tos(tsk) - 1) | ||
102 | |||
103 | #define KSTK_EIP(tsk) (task_pt_regs(tsk)->cp0_epc) | ||
104 | #define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29]) | ||
105 | |||
106 | #endif /* _ASM_SCORE_PROCESSOR_H */ | ||
diff --git a/arch/score/include/asm/ptrace.h b/arch/score/include/asm/ptrace.h new file mode 100644 index 000000000000..1a4900ac49f3 --- /dev/null +++ b/arch/score/include/asm/ptrace.h | |||
@@ -0,0 +1,87 @@ | |||
1 | #ifndef _ASM_SCORE_PTRACE_H | ||
2 | #define _ASM_SCORE_PTRACE_H | ||
3 | |||
4 | #define PC 32 | ||
5 | #define CONDITION 33 | ||
6 | #define ECR 34 | ||
7 | #define EMA 35 | ||
8 | #define CEH 36 | ||
9 | #define CEL 37 | ||
10 | #define COUNTER 38 | ||
11 | #define LDCR 39 | ||
12 | #define STCR 40 | ||
13 | #define PSR 41 | ||
14 | |||
15 | #define SINGLESTEP16_INSN 0x7006 | ||
16 | #define SINGLESTEP32_INSN 0x840C8000 | ||
17 | #define BREAKPOINT16_INSN 0x7002 /* work on SPG300 */ | ||
18 | #define BREAKPOINT32_INSN 0x84048000 /* work on SPG300 */ | ||
19 | |||
20 | /* Define instruction mask */ | ||
21 | #define INSN32_MASK 0x80008000 | ||
22 | |||
23 | #define J32 0x88008000 /* 1_00010_0000000000_1_000000000000000 */ | ||
24 | #define J32M 0xFC008000 /* 1_11111_0000000000_1_000000000000000 */ | ||
25 | |||
26 | #define B32 0x90008000 /* 1_00100_0000000000_1_000000000000000 */ | ||
27 | #define B32M 0xFC008000 | ||
28 | #define BL32 0x90008001 /* 1_00100_0000000000_1_000000000000001 */ | ||
29 | #define BL32M B32 | ||
30 | #define BR32 0x80008008 /* 1_00000_0000000000_1_00000000_000100_0 */ | ||
31 | #define BR32M 0xFFE0807E | ||
32 | #define BRL32 0x80008009 /* 1_00000_0000000000_1_00000000_000100_1 */ | ||
33 | #define BRL32M BR32M | ||
34 | |||
35 | #define B32_SET (J32 | B32 | BL32 | BR32 | BRL32) | ||
36 | |||
37 | #define J16 0x3000 /* 0_011_....... */ | ||
38 | #define J16M 0xF000 | ||
39 | #define B16 0x4000 /* 0_100_....... */ | ||
40 | #define B16M 0xF000 | ||
41 | #define BR16 0x0004 /* 0_000.......0100 */ | ||
42 | #define BR16M 0xF00F | ||
43 | #define B16_SET (J16 | B16 | BR16) | ||
44 | |||
45 | |||
46 | /* | ||
47 | * This struct defines the way the registers are stored on the stack during a | ||
48 | * system call/exception. As usual the registers k0/k1 aren't being saved. | ||
49 | */ | ||
50 | struct pt_regs { | ||
51 | unsigned long pad0[6]; | ||
52 | unsigned long orig_r4; | ||
53 | unsigned long orig_r7; | ||
54 | unsigned long regs[32]; | ||
55 | |||
56 | unsigned long cel; | ||
57 | unsigned long ceh; | ||
58 | |||
59 | unsigned long sr0; /* cnt */ | ||
60 | unsigned long sr1; /* lcr */ | ||
61 | unsigned long sr2; /* scr */ | ||
62 | |||
63 | unsigned long cp0_epc; | ||
64 | unsigned long cp0_ema; | ||
65 | unsigned long cp0_psr; | ||
66 | unsigned long cp0_ecr; | ||
67 | unsigned long cp0_condition; | ||
68 | |||
69 | long is_syscall; | ||
70 | }; | ||
71 | |||
72 | #ifdef __KERNEL__ | ||
73 | |||
74 | /* | ||
75 | * Does the process account for user or for system time? | ||
76 | */ | ||
77 | #define user_mode(regs) ((regs->cp0_psr & 8) == 8) | ||
78 | |||
79 | #define instruction_pointer(regs) (0) | ||
80 | #define profile_pc(regs) instruction_pointer(regs) | ||
81 | |||
82 | extern asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit); | ||
83 | extern int read_tsk_long(struct task_struct *, unsigned long, unsigned long *); | ||
84 | extern void clear_single_step(struct task_struct *); | ||
85 | #endif | ||
86 | |||
87 | #endif /* _ASM_SCORE_PTRACE_H */ | ||
diff --git a/arch/score/include/asm/resource.h b/arch/score/include/asm/resource.h new file mode 100644 index 000000000000..9ce22bc7b475 --- /dev/null +++ b/arch/score/include/asm/resource.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_RESOURCE_H | ||
2 | #define _ASM_SCORE_RESOURCE_H | ||
3 | |||
4 | #include <asm-generic/resource.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_RESOURCE_H */ | ||
diff --git a/arch/score/include/asm/scatterlist.h b/arch/score/include/asm/scatterlist.h new file mode 100644 index 000000000000..9f533b8362c7 --- /dev/null +++ b/arch/score/include/asm/scatterlist.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_SCATTERLIST_H | ||
2 | #define _ASM_SCORE_SCATTERLIST_H | ||
3 | |||
4 | #include <asm-generic/scatterlist.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_SCATTERLIST_H */ | ||
diff --git a/arch/score/include/asm/scoreregs.h b/arch/score/include/asm/scoreregs.h new file mode 100644 index 000000000000..d0ad29204518 --- /dev/null +++ b/arch/score/include/asm/scoreregs.h | |||
@@ -0,0 +1,51 @@ | |||
1 | #ifndef _ASM_SCORE_SCOREREGS_H | ||
2 | #define _ASM_SCORE_SCOREREGS_H | ||
3 | |||
4 | #include <linux/linkage.h> | ||
5 | |||
6 | /* TIMER register */ | ||
7 | #define TIME0BASE 0x96080000 | ||
8 | #define P_TIMER0_CTRL (TIME0BASE + 0x00) | ||
9 | #define P_TIMER0_CPP_CTRL (TIME0BASE + 0x04) | ||
10 | #define P_TIMER0_PRELOAD (TIME0BASE + 0x08) | ||
11 | #define P_TIMER0_CPP_REG (TIME0BASE + 0x0C) | ||
12 | #define P_TIMER0_UPCNT (TIME0BASE + 0x10) | ||
13 | |||
14 | /* Timer Controller Register */ | ||
15 | /* bit 0 Timer enable */ | ||
16 | #define TMR_DISABLE 0x0000 | ||
17 | #define TMR_ENABLE 0x0001 | ||
18 | |||
19 | /* bit 1 Interrupt enable */ | ||
20 | #define TMR_IE_DISABLE 0x0000 | ||
21 | #define TMR_IE_ENABLE 0x0002 | ||
22 | |||
23 | /* bit 2 Output enable */ | ||
24 | #define TMR_OE_DISABLE 0x0004 | ||
25 | #define TMR_OE_ENABLE 0x0000 | ||
26 | |||
27 | /* bit4 Up/Down counting selection */ | ||
28 | #define TMR_UD_DOWN 0x0000 | ||
29 | #define TMR_UD_UP 0x0010 | ||
30 | |||
31 | /* bit5 Up/Down counting control selection */ | ||
32 | #define TMR_UDS_UD 0x0000 | ||
33 | #define TMR_UDS_EXTUD 0x0020 | ||
34 | |||
35 | /* bit6 Time output mode */ | ||
36 | #define TMR_OM_TOGGLE 0x0000 | ||
37 | #define TMR_OM_PILSE 0x0040 | ||
38 | |||
39 | /* bit 8..9 External input active edge selection */ | ||
40 | #define TMR_ES_PE 0x0000 | ||
41 | #define TMR_ES_NE 0x0100 | ||
42 | #define TMR_ES_BOTH 0x0200 | ||
43 | |||
44 | /* bit 10..11 Operating mode */ | ||
45 | #define TMR_M_FREE 0x0000 /* free running timer mode */ | ||
46 | #define TMR_M_PERIODIC 0x0400 /* periodic timer mode */ | ||
47 | #define TMR_M_FC 0x0800 /* free running counter mode */ | ||
48 | #define TMR_M_PC 0x0c00 /* periodic counter mode */ | ||
49 | |||
50 | #define SYSTEM_CLOCK (27*1000000/4) /* 27 MHz */ | ||
51 | #endif /* _ASM_SCORE_SCOREREGS_H */ | ||
diff --git a/arch/score/include/asm/sections.h b/arch/score/include/asm/sections.h new file mode 100644 index 000000000000..9441d23af005 --- /dev/null +++ b/arch/score/include/asm/sections.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_SECTIONS_H | ||
2 | #define _ASM_SCORE_SECTIONS_H | ||
3 | |||
4 | #include <asm-generic/sections.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_SECTIONS_H */ | ||
diff --git a/arch/score/include/asm/segment.h b/arch/score/include/asm/segment.h new file mode 100644 index 000000000000..e16cf6afb495 --- /dev/null +++ b/arch/score/include/asm/segment.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef _ASM_SCORE_SEGMENT_H | ||
2 | #define _ASM_SCORE_SEGMENT_H | ||
3 | |||
4 | #ifndef __ASSEMBLY__ | ||
5 | |||
6 | typedef struct { | ||
7 | unsigned long seg; | ||
8 | } mm_segment_t; | ||
9 | |||
10 | #define KERNEL_DS ((mm_segment_t){0}) | ||
11 | #define USER_DS KERNEL_DS | ||
12 | |||
13 | # define get_ds() (KERNEL_DS) | ||
14 | # define get_fs() (current_thread_info()->addr_limit) | ||
15 | # define set_fs(x) \ | ||
16 | do { current_thread_info()->addr_limit = (x); } while (0) | ||
17 | |||
18 | # define segment_eq(a, b) ((a).seg == (b).seg) | ||
19 | |||
20 | # endif /* __ASSEMBLY__ */ | ||
21 | #endif /* _ASM_SCORE_SEGMENT_H */ | ||
diff --git a/arch/score/include/asm/sembuf.h b/arch/score/include/asm/sembuf.h new file mode 100644 index 000000000000..dae5e835ce9e --- /dev/null +++ b/arch/score/include/asm/sembuf.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_SEMBUF_H | ||
2 | #define _ASM_SCORE_SEMBUF_H | ||
3 | |||
4 | #include <asm-generic/sembuf.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_SEMBUF_H */ | ||
diff --git a/arch/score/include/asm/setup.h b/arch/score/include/asm/setup.h new file mode 100644 index 000000000000..de89eff98dae --- /dev/null +++ b/arch/score/include/asm/setup.h | |||
@@ -0,0 +1,40 @@ | |||
1 | #ifndef _ASM_SCORE_SETUP_H | ||
2 | #define _ASM_SCORE_SETUP_H | ||
3 | |||
4 | #define COMMAND_LINE_SIZE 256 | ||
5 | #define MEM_SIZE 0x2000000 | ||
6 | |||
7 | #ifdef __KERNEL__ | ||
8 | |||
9 | extern void pagetable_init(void); | ||
10 | extern void pgd_init(unsigned long page); | ||
11 | |||
12 | extern void setup_early_printk(void); | ||
13 | extern void cpu_cache_init(void); | ||
14 | extern void tlb_init(void); | ||
15 | |||
16 | extern void handle_nmi(void); | ||
17 | extern void handle_adelinsn(void); | ||
18 | extern void handle_adedata(void); | ||
19 | extern void handle_ibe(void); | ||
20 | extern void handle_pel(void); | ||
21 | extern void handle_sys(void); | ||
22 | extern void handle_ccu(void); | ||
23 | extern void handle_ri(void); | ||
24 | extern void handle_tr(void); | ||
25 | extern void handle_ades(void); | ||
26 | extern void handle_cee(void); | ||
27 | extern void handle_cpe(void); | ||
28 | extern void handle_dve(void); | ||
29 | extern void handle_dbe(void); | ||
30 | extern void handle_reserved(void); | ||
31 | extern void handle_tlb_refill(void); | ||
32 | extern void handle_tlb_invaild(void); | ||
33 | extern void handle_mod(void); | ||
34 | extern void debug_exception_vector(void); | ||
35 | extern void general_exception_vector(void); | ||
36 | extern void interrupt_exception_vector(void); | ||
37 | |||
38 | #endif /* __KERNEL__ */ | ||
39 | |||
40 | #endif /* _ASM_SCORE_SETUP_H */ | ||
diff --git a/arch/score/include/asm/shmbuf.h b/arch/score/include/asm/shmbuf.h new file mode 100644 index 000000000000..c85b2429ba21 --- /dev/null +++ b/arch/score/include/asm/shmbuf.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_SHMBUF_H | ||
2 | #define _ASM_SCORE_SHMBUF_H | ||
3 | |||
4 | #include <asm-generic/shmbuf.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_SHMBUF_H */ | ||
diff --git a/arch/score/include/asm/shmparam.h b/arch/score/include/asm/shmparam.h new file mode 100644 index 000000000000..1d60813141b6 --- /dev/null +++ b/arch/score/include/asm/shmparam.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_SHMPARAM_H | ||
2 | #define _ASM_SCORE_SHMPARAM_H | ||
3 | |||
4 | #include <asm-generic/shmparam.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_SHMPARAM_H */ | ||
diff --git a/arch/score/include/asm/sigcontext.h b/arch/score/include/asm/sigcontext.h new file mode 100644 index 000000000000..5ffda39ddb90 --- /dev/null +++ b/arch/score/include/asm/sigcontext.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef _ASM_SCORE_SIGCONTEXT_H | ||
2 | #define _ASM_SCORE_SIGCONTEXT_H | ||
3 | |||
4 | /* | ||
5 | * Keep this struct definition in sync with the sigcontext fragment | ||
6 | * in arch/score/tools/offset.c | ||
7 | */ | ||
8 | struct sigcontext { | ||
9 | unsigned int sc_regmask; | ||
10 | unsigned int sc_psr; | ||
11 | unsigned int sc_condition; | ||
12 | unsigned long sc_pc; | ||
13 | unsigned long sc_regs[32]; | ||
14 | unsigned int sc_ssflags; | ||
15 | unsigned int sc_mdceh; | ||
16 | unsigned int sc_mdcel; | ||
17 | unsigned int sc_ecr; | ||
18 | unsigned long sc_ema; | ||
19 | unsigned long sc_sigset[4]; | ||
20 | }; | ||
21 | |||
22 | #endif /* _ASM_SCORE_SIGCONTEXT_H */ | ||
diff --git a/arch/score/include/asm/siginfo.h b/arch/score/include/asm/siginfo.h new file mode 100644 index 000000000000..87ca35607a28 --- /dev/null +++ b/arch/score/include/asm/siginfo.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_SIGINFO_H | ||
2 | #define _ASM_SCORE_SIGINFO_H | ||
3 | |||
4 | #include <asm-generic/siginfo.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_SIGINFO_H */ | ||
diff --git a/arch/score/include/asm/signal.h b/arch/score/include/asm/signal.h new file mode 100644 index 000000000000..2605bc06b64f --- /dev/null +++ b/arch/score/include/asm/signal.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_SIGNAL_H | ||
2 | #define _ASM_SCORE_SIGNAL_H | ||
3 | |||
4 | #include <asm-generic/signal.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_SIGNAL_H */ | ||
diff --git a/arch/score/include/asm/socket.h b/arch/score/include/asm/socket.h new file mode 100644 index 000000000000..612a70e385ba --- /dev/null +++ b/arch/score/include/asm/socket.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_SOCKET_H | ||
2 | #define _ASM_SCORE_SOCKET_H | ||
3 | |||
4 | #include <asm-generic/socket.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_SOCKET_H */ | ||
diff --git a/arch/score/include/asm/sockios.h b/arch/score/include/asm/sockios.h new file mode 100644 index 000000000000..ba8256480189 --- /dev/null +++ b/arch/score/include/asm/sockios.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_SOCKIOS_H | ||
2 | #define _ASM_SCORE_SOCKIOS_H | ||
3 | |||
4 | #include <asm-generic/sockios.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_SOCKIOS_H */ | ||
diff --git a/arch/score/include/asm/stat.h b/arch/score/include/asm/stat.h new file mode 100644 index 000000000000..5037055500a2 --- /dev/null +++ b/arch/score/include/asm/stat.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_STAT_H | ||
2 | #define _ASM_SCORE_STAT_H | ||
3 | |||
4 | #include <asm-generic/stat.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_STAT_H */ | ||
diff --git a/arch/score/include/asm/statfs.h b/arch/score/include/asm/statfs.h new file mode 100644 index 000000000000..36e41004e996 --- /dev/null +++ b/arch/score/include/asm/statfs.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_STATFS_H | ||
2 | #define _ASM_SCORE_STATFS_H | ||
3 | |||
4 | #include <asm-generic/statfs.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_STATFS_H */ | ||
diff --git a/arch/score/include/asm/string.h b/arch/score/include/asm/string.h new file mode 100644 index 000000000000..8a6bf5063aa5 --- /dev/null +++ b/arch/score/include/asm/string.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _ASM_SCORE_STRING_H | ||
2 | #define _ASM_SCORE_STRING_H | ||
3 | |||
4 | extern void *memset(void *__s, int __c, size_t __count); | ||
5 | extern void *memcpy(void *__to, __const__ void *__from, size_t __n); | ||
6 | extern void *memmove(void *__dest, __const__ void *__src, size_t __n); | ||
7 | |||
8 | #endif /* _ASM_SCORE_STRING_H */ | ||
diff --git a/arch/score/include/asm/swab.h b/arch/score/include/asm/swab.h new file mode 100644 index 000000000000..fadc3cc6d8a2 --- /dev/null +++ b/arch/score/include/asm/swab.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_SWAB_H | ||
2 | #define _ASM_SCORE_SWAB_H | ||
3 | |||
4 | #include <asm-generic/swab.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_SWAB_H */ | ||
diff --git a/arch/score/include/asm/syscalls.h b/arch/score/include/asm/syscalls.h new file mode 100644 index 000000000000..00c28e04fdfc --- /dev/null +++ b/arch/score/include/asm/syscalls.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef _ASM_SCORE_SYSCALLS_H | ||
2 | #define _ASM_SCORE_SYSCALLS_H | ||
3 | |||
4 | asmlinkage long sys_clone(int flags, unsigned long stack, struct pt_regs *regs); | ||
5 | #define sys_clone sys_clone | ||
6 | |||
7 | #include <asm-generic/syscalls.h> | ||
8 | |||
9 | #endif /* _ASM_SCORE_SYSCALLS_H */ | ||
diff --git a/arch/score/include/asm/system.h b/arch/score/include/asm/system.h new file mode 100644 index 000000000000..589d5c7e171c --- /dev/null +++ b/arch/score/include/asm/system.h | |||
@@ -0,0 +1,90 @@ | |||
1 | #ifndef _ASM_SCORE_SYSTEM_H | ||
2 | #define _ASM_SCORE_SYSTEM_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/irqflags.h> | ||
6 | |||
7 | struct pt_regs; | ||
8 | struct task_struct; | ||
9 | |||
10 | extern void *resume(void *last, void *next, void *next_ti); | ||
11 | |||
12 | #define switch_to(prev, next, last) \ | ||
13 | do { \ | ||
14 | (last) = resume(prev, next, task_thread_info(next)); \ | ||
15 | } while (0) | ||
16 | |||
17 | #define finish_arch_switch(prev) do {} while (0) | ||
18 | |||
19 | typedef void (*vi_handler_t)(void); | ||
20 | extern unsigned long arch_align_stack(unsigned long sp); | ||
21 | |||
22 | #define mb() barrier() | ||
23 | #define rmb() barrier() | ||
24 | #define wmb() barrier() | ||
25 | #define smp_mb() barrier() | ||
26 | #define smp_rmb() barrier() | ||
27 | #define smp_wmb() barrier() | ||
28 | |||
29 | #define read_barrier_depends() do {} while (0) | ||
30 | #define smp_read_barrier_depends() do {} while (0) | ||
31 | |||
32 | #define set_mb(var, value) do {var = value; wmb(); } while (0) | ||
33 | |||
34 | #define __HAVE_ARCH_CMPXCHG 1 | ||
35 | |||
36 | #include <asm-generic/cmpxchg-local.h> | ||
37 | |||
38 | #ifndef __ASSEMBLY__ | ||
39 | |||
40 | struct __xchg_dummy { unsigned long a[100]; }; | ||
41 | #define __xg(x) ((struct __xchg_dummy *)(x)) | ||
42 | |||
43 | static inline | ||
44 | unsigned long __xchg(volatile unsigned long *m, unsigned long val) | ||
45 | { | ||
46 | unsigned long retval; | ||
47 | unsigned long flags; | ||
48 | |||
49 | local_irq_save(flags); | ||
50 | retval = *m; | ||
51 | *m = val; | ||
52 | local_irq_restore(flags); | ||
53 | return retval; | ||
54 | } | ||
55 | |||
56 | #define xchg(ptr, v) \ | ||
57 | ((__typeof__(*(ptr))) __xchg((unsigned long *)(ptr), \ | ||
58 | (unsigned long)(v))) | ||
59 | |||
60 | static inline unsigned long __cmpxchg(volatile unsigned long *m, | ||
61 | unsigned long old, unsigned long new) | ||
62 | { | ||
63 | unsigned long retval; | ||
64 | unsigned long flags; | ||
65 | |||
66 | local_irq_save(flags); | ||
67 | retval = *m; | ||
68 | if (retval == old) | ||
69 | *m = new; | ||
70 | local_irq_restore(flags); | ||
71 | return retval; | ||
72 | } | ||
73 | |||
74 | #define cmpxchg(ptr, o, n) \ | ||
75 | ((__typeof__(*(ptr))) __cmpxchg((unsigned long *)(ptr), \ | ||
76 | (unsigned long)(o), \ | ||
77 | (unsigned long)(n))) | ||
78 | |||
79 | extern void __die(const char *, struct pt_regs *, const char *, | ||
80 | const char *, unsigned long) __attribute__((noreturn)); | ||
81 | extern void __die_if_kernel(const char *, struct pt_regs *, const char *, | ||
82 | const char *, unsigned long); | ||
83 | |||
84 | #define die(msg, regs) \ | ||
85 | __die(msg, regs, __FILE__ ":", __func__, __LINE__) | ||
86 | #define die_if_kernel(msg, regs) \ | ||
87 | __die_if_kernel(msg, regs, __FILE__ ":", __func__, __LINE__) | ||
88 | |||
89 | #endif /* !__ASSEMBLY__ */ | ||
90 | #endif /* _ASM_SCORE_SYSTEM_H */ | ||
diff --git a/arch/score/include/asm/termbits.h b/arch/score/include/asm/termbits.h new file mode 100644 index 000000000000..9a95c1412437 --- /dev/null +++ b/arch/score/include/asm/termbits.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_TERMBITS_H | ||
2 | #define _ASM_SCORE_TERMBITS_H | ||
3 | |||
4 | #include <asm-generic/termbits.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_TERMBITS_H */ | ||
diff --git a/arch/score/include/asm/termios.h b/arch/score/include/asm/termios.h new file mode 100644 index 000000000000..40984e811ad6 --- /dev/null +++ b/arch/score/include/asm/termios.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_TERMIOS_H | ||
2 | #define _ASM_SCORE_TERMIOS_H | ||
3 | |||
4 | #include <asm-generic/termios.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_TERMIOS_H */ | ||
diff --git a/arch/score/include/asm/thread_info.h b/arch/score/include/asm/thread_info.h new file mode 100644 index 000000000000..0af8ca074c8d --- /dev/null +++ b/arch/score/include/asm/thread_info.h | |||
@@ -0,0 +1,103 @@ | |||
1 | #ifndef _ASM_SCORE_THREAD_INFO_H | ||
2 | #define _ASM_SCORE_THREAD_INFO_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | #define KU_MASK 0x08 | ||
7 | #define KU_USER 0x08 | ||
8 | #define KU_KERN 0x00 | ||
9 | |||
10 | #ifndef __ASSEMBLY__ | ||
11 | |||
12 | #include <asm/processor.h> | ||
13 | |||
14 | /* | ||
15 | * low level task data that entry.S needs immediate access to | ||
16 | * - this struct should fit entirely inside of one cache line | ||
17 | * - this struct shares the supervisor stack pages | ||
18 | * - if the contents of this structure are changed, the assembly constants | ||
19 | * must also be changed | ||
20 | */ | ||
21 | struct thread_info { | ||
22 | struct task_struct *task; /* main task structure */ | ||
23 | struct exec_domain *exec_domain; /* execution domain */ | ||
24 | unsigned long flags; /* low level flags */ | ||
25 | unsigned long tp_value; /* thread pointer */ | ||
26 | __u32 cpu; /* current CPU */ | ||
27 | |||
28 | /* 0 => preemptable, < 0 => BUG */ | ||
29 | int preempt_count; | ||
30 | |||
31 | /* | ||
32 | * thread address space: | ||
33 | * 0-0xBFFFFFFF for user-thead | ||
34 | * 0-0xFFFFFFFF for kernel-thread | ||
35 | */ | ||
36 | mm_segment_t addr_limit; | ||
37 | struct restart_block restart_block; | ||
38 | struct pt_regs *regs; | ||
39 | }; | ||
40 | |||
41 | /* | ||
42 | * macros/functions for gaining access to the thread information structure | ||
43 | * | ||
44 | * preempt_count needs to be 1 initially, until the scheduler is functional. | ||
45 | */ | ||
46 | #define INIT_THREAD_INFO(tsk) \ | ||
47 | { \ | ||
48 | .task = &tsk, \ | ||
49 | .exec_domain = &default_exec_domain, \ | ||
50 | .cpu = 0, \ | ||
51 | .preempt_count = 1, \ | ||
52 | .addr_limit = KERNEL_DS, \ | ||
53 | .restart_block = { \ | ||
54 | .fn = do_no_restart_syscall, \ | ||
55 | }, \ | ||
56 | } | ||
57 | |||
58 | #define init_thread_info (init_thread_union.thread_info) | ||
59 | #define init_stack (init_thread_union.stack) | ||
60 | |||
61 | /* How to get the thread information struct from C. */ | ||
62 | register struct thread_info *__current_thread_info __asm__("r28"); | ||
63 | #define current_thread_info() __current_thread_info | ||
64 | |||
65 | /* thread information allocation */ | ||
66 | #define THREAD_SIZE_ORDER (1) | ||
67 | #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) | ||
68 | #define THREAD_MASK (THREAD_SIZE - 1UL) | ||
69 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
70 | |||
71 | #define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL) | ||
72 | #define free_thread_info(info) kfree(info) | ||
73 | |||
74 | #endif /* !__ASSEMBLY__ */ | ||
75 | |||
76 | #define PREEMPT_ACTIVE 0x10000000 | ||
77 | |||
78 | /* | ||
79 | * thread information flags | ||
80 | * - these are process state flags that various assembly files may need to | ||
81 | * access | ||
82 | * - pending work-to-be-done flags are in LSW | ||
83 | * - other flags in MSW | ||
84 | */ | ||
85 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | ||
86 | #define TIF_SIGPENDING 1 /* signal pending */ | ||
87 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ | ||
88 | #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */ | ||
89 | #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling | ||
90 | TIF_NEED_RESCHED */ | ||
91 | #define TIF_MEMDIE 18 | ||
92 | |||
93 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | ||
94 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | ||
95 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | ||
96 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
97 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
98 | |||
99 | #define _TIF_WORK_MASK (0x0000ffff) | ||
100 | |||
101 | #endif /* __KERNEL__ */ | ||
102 | |||
103 | #endif /* _ASM_SCORE_THREAD_INFO_H */ | ||
diff --git a/arch/score/include/asm/timex.h b/arch/score/include/asm/timex.h new file mode 100644 index 000000000000..a524ae0c5e7b --- /dev/null +++ b/arch/score/include/asm/timex.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _ASM_SCORE_TIMEX_H | ||
2 | #define _ASM_SCORE_TIMEX_H | ||
3 | |||
4 | #define CLOCK_TICK_RATE 27000000 /* Timer input freq. */ | ||
5 | |||
6 | #include <asm-generic/timex.h> | ||
7 | |||
8 | #endif /* _ASM_SCORE_TIMEX_H */ | ||
diff --git a/arch/score/include/asm/tlb.h b/arch/score/include/asm/tlb.h new file mode 100644 index 000000000000..46882ed524e6 --- /dev/null +++ b/arch/score/include/asm/tlb.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #ifndef _ASM_SCORE_TLB_H | ||
2 | #define _ASM_SCORE_TLB_H | ||
3 | |||
4 | /* | ||
5 | * SCORE doesn't need any special per-pte or per-vma handling, except | ||
6 | * we need to flush cache for area to be unmapped. | ||
7 | */ | ||
8 | #define tlb_start_vma(tlb, vma) do {} while (0) | ||
9 | #define tlb_end_vma(tlb, vma) do {} while (0) | ||
10 | #define __tlb_remove_tlb_entry(tlb, ptep, address) do {} while (0) | ||
11 | #define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) | ||
12 | |||
13 | extern void score7_FTLB_refill_Handler(void); | ||
14 | |||
15 | #include <asm-generic/tlb.h> | ||
16 | |||
17 | #endif /* _ASM_SCORE_TLB_H */ | ||
diff --git a/arch/score/include/asm/tlbflush.h b/arch/score/include/asm/tlbflush.h new file mode 100644 index 000000000000..9cce978367d5 --- /dev/null +++ b/arch/score/include/asm/tlbflush.h | |||
@@ -0,0 +1,142 @@ | |||
1 | #ifndef _ASM_SCORE_TLBFLUSH_H | ||
2 | #define _ASM_SCORE_TLBFLUSH_H | ||
3 | |||
4 | #include <linux/mm.h> | ||
5 | |||
6 | /* | ||
7 | * TLB flushing: | ||
8 | * | ||
9 | * - flush_tlb_all() flushes all processes TLB entries | ||
10 | * - flush_tlb_mm(mm) flushes the specified mm context TLB entries | ||
11 | * - flush_tlb_page(vma, vmaddr) flushes one page | ||
12 | * - flush_tlb_range(vma, start, end) flushes a range of pages | ||
13 | * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages | ||
14 | */ | ||
15 | extern void local_flush_tlb_all(void); | ||
16 | extern void local_flush_tlb_mm(struct mm_struct *mm); | ||
17 | extern void local_flush_tlb_range(struct vm_area_struct *vma, | ||
18 | unsigned long start, unsigned long end); | ||
19 | extern void local_flush_tlb_kernel_range(unsigned long start, | ||
20 | unsigned long end); | ||
21 | extern void local_flush_tlb_page(struct vm_area_struct *vma, | ||
22 | unsigned long page); | ||
23 | extern void local_flush_tlb_one(unsigned long vaddr); | ||
24 | |||
25 | #define flush_tlb_all() local_flush_tlb_all() | ||
26 | #define flush_tlb_mm(mm) local_flush_tlb_mm(mm) | ||
27 | #define flush_tlb_range(vma, vmaddr, end) \ | ||
28 | local_flush_tlb_range(vma, vmaddr, end) | ||
29 | #define flush_tlb_kernel_range(vmaddr, end) \ | ||
30 | local_flush_tlb_kernel_range(vmaddr, end) | ||
31 | #define flush_tlb_page(vma, page) local_flush_tlb_page(vma, page) | ||
32 | #define flush_tlb_one(vaddr) local_flush_tlb_one(vaddr) | ||
33 | |||
34 | #ifndef __ASSEMBLY__ | ||
35 | |||
36 | static inline unsigned long pevn_get(void) | ||
37 | { | ||
38 | unsigned long val; | ||
39 | |||
40 | __asm__ __volatile__( | ||
41 | "mfcr %0, cr11\n" | ||
42 | "nop\nnop\n" | ||
43 | : "=r" (val)); | ||
44 | |||
45 | return val; | ||
46 | } | ||
47 | |||
48 | static inline void pevn_set(unsigned long val) | ||
49 | { | ||
50 | __asm__ __volatile__( | ||
51 | "mtcr %0, cr11\n" | ||
52 | "nop\nnop\nnop\nnop\nnop\n" | ||
53 | : : "r" (val)); | ||
54 | } | ||
55 | |||
56 | static inline void pectx_set(unsigned long val) | ||
57 | { | ||
58 | __asm__ __volatile__( | ||
59 | "mtcr %0, cr12\n" | ||
60 | "nop\nnop\nnop\nnop\nnop\n" | ||
61 | : : "r" (val)); | ||
62 | } | ||
63 | |||
64 | static inline unsigned long pectx_get(void) | ||
65 | { | ||
66 | unsigned long val; | ||
67 | __asm__ __volatile__( | ||
68 | "mfcr %0, cr12\n" | ||
69 | "nop\nnop\n" | ||
70 | : "=r" (val)); | ||
71 | return val; | ||
72 | } | ||
73 | static inline unsigned long tlblock_get(void) | ||
74 | { | ||
75 | unsigned long val; | ||
76 | |||
77 | __asm__ __volatile__( | ||
78 | "mfcr %0, cr7\n" | ||
79 | "nop\nnop\n" | ||
80 | : "=r" (val)); | ||
81 | return val; | ||
82 | } | ||
83 | static inline void tlblock_set(unsigned long val) | ||
84 | { | ||
85 | __asm__ __volatile__( | ||
86 | "mtcr %0, cr7\n" | ||
87 | "nop\nnop\nnop\nnop\nnop\n" | ||
88 | : : "r" (val)); | ||
89 | } | ||
90 | |||
91 | static inline void tlbpt_set(unsigned long val) | ||
92 | { | ||
93 | __asm__ __volatile__( | ||
94 | "mtcr %0, cr8\n" | ||
95 | "nop\nnop\nnop\nnop\nnop\n" | ||
96 | : : "r" (val)); | ||
97 | } | ||
98 | |||
99 | static inline long tlbpt_get(void) | ||
100 | { | ||
101 | long val; | ||
102 | |||
103 | __asm__ __volatile__( | ||
104 | "mfcr %0, cr8\n" | ||
105 | "nop\nnop\n" | ||
106 | : "=r" (val)); | ||
107 | |||
108 | return val; | ||
109 | } | ||
110 | |||
111 | static inline void peaddr_set(unsigned long val) | ||
112 | { | ||
113 | __asm__ __volatile__( | ||
114 | "mtcr %0, cr9\n" | ||
115 | "nop\nnop\nnop\nnop\nnop\n" | ||
116 | : : "r" (val)); | ||
117 | } | ||
118 | |||
119 | /* TLB operations. */ | ||
120 | static inline void tlb_probe(void) | ||
121 | { | ||
122 | __asm__ __volatile__("stlb;nop;nop;nop;nop;nop"); | ||
123 | } | ||
124 | |||
125 | static inline void tlb_read(void) | ||
126 | { | ||
127 | __asm__ __volatile__("mftlb;nop;nop;nop;nop;nop"); | ||
128 | } | ||
129 | |||
130 | static inline void tlb_write_indexed(void) | ||
131 | { | ||
132 | __asm__ __volatile__("mtptlb;nop;nop;nop;nop;nop"); | ||
133 | } | ||
134 | |||
135 | static inline void tlb_write_random(void) | ||
136 | { | ||
137 | __asm__ __volatile__("mtrtlb;nop;nop;nop;nop;nop"); | ||
138 | } | ||
139 | |||
140 | #endif /* Not __ASSEMBLY__ */ | ||
141 | |||
142 | #endif /* _ASM_SCORE_TLBFLUSH_H */ | ||
diff --git a/arch/score/include/asm/topology.h b/arch/score/include/asm/topology.h new file mode 100644 index 000000000000..425fba381f88 --- /dev/null +++ b/arch/score/include/asm/topology.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_TOPOLOGY_H | ||
2 | #define _ASM_SCORE_TOPOLOGY_H | ||
3 | |||
4 | #include <asm-generic/topology.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_TOPOLOGY_H */ | ||
diff --git a/arch/score/include/asm/types.h b/arch/score/include/asm/types.h new file mode 100644 index 000000000000..2140032778ee --- /dev/null +++ b/arch/score/include/asm/types.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_TYPES_H | ||
2 | #define _ASM_SCORE_TYPES_H | ||
3 | |||
4 | #include <asm-generic/types.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_TYPES_H */ | ||
diff --git a/arch/score/include/asm/uaccess.h b/arch/score/include/asm/uaccess.h new file mode 100644 index 000000000000..43ce28a1d0fc --- /dev/null +++ b/arch/score/include/asm/uaccess.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef _ASM_SCORE_UACCESS_H | ||
2 | #define _ASM_SCORE_UACCESS_H | ||
3 | /* | ||
4 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | struct pt_regs; | ||
11 | extern int fixup_exception(struct pt_regs *regs); | ||
12 | |||
13 | #ifndef __ASSEMBLY__ | ||
14 | |||
15 | #define __range_ok(addr, size) \ | ||
16 | ((((unsigned long)(addr) >= 0x80000000) \ | ||
17 | || ((unsigned long)(size) > 0x80000000) \ | ||
18 | || (((unsigned long)(addr) + (unsigned long)(size)) > 0x80000000))) | ||
19 | |||
20 | #define __access_ok(addr, size) \ | ||
21 | (__range_ok((addr), (size)) == 0) | ||
22 | |||
23 | #include <asm-generic/uaccess.h> | ||
24 | |||
25 | #endif /* __ASSEMBLY__ */ | ||
26 | |||
27 | #endif /* _ASM_SCORE_UACCESS_H */ | ||
diff --git a/arch/score/include/asm/unaligned.h b/arch/score/include/asm/unaligned.h new file mode 100644 index 000000000000..2fc06de51c62 --- /dev/null +++ b/arch/score/include/asm/unaligned.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_SCORE_UNALIGNED_H | ||
2 | #define _ASM_SCORE_UNALIGNED_H | ||
3 | |||
4 | #include <asm-generic/unaligned.h> | ||
5 | |||
6 | #endif /* _ASM_SCORE_UNALIGNED_H */ | ||
diff --git a/arch/score/include/asm/unistd.h b/arch/score/include/asm/unistd.h new file mode 100644 index 000000000000..9aa3a159bbf6 --- /dev/null +++ b/arch/score/include/asm/unistd.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _ASM_SCORE_UNISTD_H | ||
2 | #define _ASM_SCORE_UNISTD_H | ||
3 | |||
4 | #define __ARCH_HAVE_MMU | ||
5 | |||
6 | #include <asm-generic/unistd.h> | ||
7 | |||
8 | #endif /* _ASM_SCORE_UNISTD_H */ | ||
diff --git a/arch/score/include/asm/user.h b/arch/score/include/asm/user.h new file mode 100644 index 000000000000..3cf75720fe08 --- /dev/null +++ b/arch/score/include/asm/user.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef _ASM_SCORE_USER_H | ||
2 | #define _ASM_SCORE_USER_H | ||
3 | |||
4 | #endif /* _ASM_SCORE_USER_H */ | ||