diff options
Diffstat (limited to 'arch/mips/lib')
-rw-r--r-- | arch/mips/lib/Makefile | 1 | ||||
-rw-r--r-- | arch/mips/lib/memcpy.S | 23 | ||||
-rw-r--r-- | arch/mips/lib/memset.S | 47 | ||||
-rw-r--r-- | arch/mips/lib/mips-atomic.c | 2 |
4 files changed, 72 insertions, 1 deletions
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile index eeddc58802e1..1e9e900cd3c3 100644 --- a/arch/mips/lib/Makefile +++ b/arch/mips/lib/Makefile | |||
@@ -8,6 +8,7 @@ lib-y += bitops.o csum_partial.o delay.o memcpy.o memset.o \ | |||
8 | 8 | ||
9 | obj-y += iomap.o | 9 | obj-y += iomap.o |
10 | obj-$(CONFIG_PCI) += iomap-pci.o | 10 | obj-$(CONFIG_PCI) += iomap-pci.o |
11 | lib-$(CONFIG_GENERIC_CSUM) := $(filter-out csum_partial.o, $(lib-y)) | ||
11 | 12 | ||
12 | obj-$(CONFIG_CPU_GENERIC_DUMP_TLB) += dump_tlb.o | 13 | obj-$(CONFIG_CPU_GENERIC_DUMP_TLB) += dump_tlb.o |
13 | obj-$(CONFIG_CPU_R3000) += r3k_dump_tlb.o | 14 | obj-$(CONFIG_CPU_R3000) += r3k_dump_tlb.o |
diff --git a/arch/mips/lib/memcpy.S b/arch/mips/lib/memcpy.S index 5d3238af9b5c..9245e1705e69 100644 --- a/arch/mips/lib/memcpy.S +++ b/arch/mips/lib/memcpy.S | |||
@@ -293,9 +293,14 @@ | |||
293 | and t0, src, ADDRMASK | 293 | and t0, src, ADDRMASK |
294 | PREFS( 0, 2*32(src) ) | 294 | PREFS( 0, 2*32(src) ) |
295 | PREFD( 1, 2*32(dst) ) | 295 | PREFD( 1, 2*32(dst) ) |
296 | #ifndef CONFIG_CPU_MIPSR6 | ||
296 | bnez t1, .Ldst_unaligned\@ | 297 | bnez t1, .Ldst_unaligned\@ |
297 | nop | 298 | nop |
298 | bnez t0, .Lsrc_unaligned_dst_aligned\@ | 299 | bnez t0, .Lsrc_unaligned_dst_aligned\@ |
300 | #else | ||
301 | or t0, t0, t1 | ||
302 | bnez t0, .Lcopy_unaligned_bytes\@ | ||
303 | #endif | ||
299 | /* | 304 | /* |
300 | * use delay slot for fall-through | 305 | * use delay slot for fall-through |
301 | * src and dst are aligned; need to compute rem | 306 | * src and dst are aligned; need to compute rem |
@@ -376,6 +381,7 @@ | |||
376 | bne rem, len, 1b | 381 | bne rem, len, 1b |
377 | .set noreorder | 382 | .set noreorder |
378 | 383 | ||
384 | #ifndef CONFIG_CPU_MIPSR6 | ||
379 | /* | 385 | /* |
380 | * src and dst are aligned, need to copy rem bytes (rem < NBYTES) | 386 | * src and dst are aligned, need to copy rem bytes (rem < NBYTES) |
381 | * A loop would do only a byte at a time with possible branch | 387 | * A loop would do only a byte at a time with possible branch |
@@ -477,6 +483,7 @@ | |||
477 | bne len, rem, 1b | 483 | bne len, rem, 1b |
478 | .set noreorder | 484 | .set noreorder |
479 | 485 | ||
486 | #endif /* !CONFIG_CPU_MIPSR6 */ | ||
480 | .Lcopy_bytes_checklen\@: | 487 | .Lcopy_bytes_checklen\@: |
481 | beqz len, .Ldone\@ | 488 | beqz len, .Ldone\@ |
482 | nop | 489 | nop |
@@ -504,6 +511,22 @@ | |||
504 | .Ldone\@: | 511 | .Ldone\@: |
505 | jr ra | 512 | jr ra |
506 | nop | 513 | nop |
514 | |||
515 | #ifdef CONFIG_CPU_MIPSR6 | ||
516 | .Lcopy_unaligned_bytes\@: | ||
517 | 1: | ||
518 | COPY_BYTE(0) | ||
519 | COPY_BYTE(1) | ||
520 | COPY_BYTE(2) | ||
521 | COPY_BYTE(3) | ||
522 | COPY_BYTE(4) | ||
523 | COPY_BYTE(5) | ||
524 | COPY_BYTE(6) | ||
525 | COPY_BYTE(7) | ||
526 | ADD src, src, 8 | ||
527 | b 1b | ||
528 | ADD dst, dst, 8 | ||
529 | #endif /* CONFIG_CPU_MIPSR6 */ | ||
507 | .if __memcpy == 1 | 530 | .if __memcpy == 1 |
508 | END(memcpy) | 531 | END(memcpy) |
509 | .set __memcpy, 0 | 532 | .set __memcpy, 0 |
diff --git a/arch/mips/lib/memset.S b/arch/mips/lib/memset.S index c8fe6b1968fb..b8e63fd00375 100644 --- a/arch/mips/lib/memset.S +++ b/arch/mips/lib/memset.S | |||
@@ -111,6 +111,7 @@ | |||
111 | .set at | 111 | .set at |
112 | #endif | 112 | #endif |
113 | 113 | ||
114 | #ifndef CONFIG_CPU_MIPSR6 | ||
114 | R10KCBARRIER(0(ra)) | 115 | R10KCBARRIER(0(ra)) |
115 | #ifdef __MIPSEB__ | 116 | #ifdef __MIPSEB__ |
116 | EX(LONG_S_L, a1, (a0), .Lfirst_fixup\@) /* make word/dword aligned */ | 117 | EX(LONG_S_L, a1, (a0), .Lfirst_fixup\@) /* make word/dword aligned */ |
@@ -120,6 +121,30 @@ | |||
120 | PTR_SUBU a0, t0 /* long align ptr */ | 121 | PTR_SUBU a0, t0 /* long align ptr */ |
121 | PTR_ADDU a2, t0 /* correct size */ | 122 | PTR_ADDU a2, t0 /* correct size */ |
122 | 123 | ||
124 | #else /* CONFIG_CPU_MIPSR6 */ | ||
125 | #define STORE_BYTE(N) \ | ||
126 | EX(sb, a1, N(a0), .Lbyte_fixup\@); \ | ||
127 | beqz t0, 0f; \ | ||
128 | PTR_ADDU t0, 1; | ||
129 | |||
130 | PTR_ADDU a2, t0 /* correct size */ | ||
131 | PTR_ADDU t0, 1 | ||
132 | STORE_BYTE(0) | ||
133 | STORE_BYTE(1) | ||
134 | #if LONGSIZE == 4 | ||
135 | EX(sb, a1, 2(a0), .Lbyte_fixup\@) | ||
136 | #else | ||
137 | STORE_BYTE(2) | ||
138 | STORE_BYTE(3) | ||
139 | STORE_BYTE(4) | ||
140 | STORE_BYTE(5) | ||
141 | EX(sb, a1, 6(a0), .Lbyte_fixup\@) | ||
142 | #endif | ||
143 | 0: | ||
144 | ori a0, STORMASK | ||
145 | xori a0, STORMASK | ||
146 | PTR_ADDIU a0, STORSIZE | ||
147 | #endif /* CONFIG_CPU_MIPSR6 */ | ||
123 | 1: ori t1, a2, 0x3f /* # of full blocks */ | 148 | 1: ori t1, a2, 0x3f /* # of full blocks */ |
124 | xori t1, 0x3f | 149 | xori t1, 0x3f |
125 | beqz t1, .Lmemset_partial\@ /* no block to fill */ | 150 | beqz t1, .Lmemset_partial\@ /* no block to fill */ |
@@ -159,6 +184,7 @@ | |||
159 | andi a2, STORMASK /* At most one long to go */ | 184 | andi a2, STORMASK /* At most one long to go */ |
160 | 185 | ||
161 | beqz a2, 1f | 186 | beqz a2, 1f |
187 | #ifndef CONFIG_CPU_MIPSR6 | ||
162 | PTR_ADDU a0, a2 /* What's left */ | 188 | PTR_ADDU a0, a2 /* What's left */ |
163 | R10KCBARRIER(0(ra)) | 189 | R10KCBARRIER(0(ra)) |
164 | #ifdef __MIPSEB__ | 190 | #ifdef __MIPSEB__ |
@@ -166,6 +192,22 @@ | |||
166 | #else | 192 | #else |
167 | EX(LONG_S_L, a1, -1(a0), .Llast_fixup\@) | 193 | EX(LONG_S_L, a1, -1(a0), .Llast_fixup\@) |
168 | #endif | 194 | #endif |
195 | #else | ||
196 | PTR_SUBU t0, $0, a2 | ||
197 | PTR_ADDIU t0, 1 | ||
198 | STORE_BYTE(0) | ||
199 | STORE_BYTE(1) | ||
200 | #if LONGSIZE == 4 | ||
201 | EX(sb, a1, 2(a0), .Lbyte_fixup\@) | ||
202 | #else | ||
203 | STORE_BYTE(2) | ||
204 | STORE_BYTE(3) | ||
205 | STORE_BYTE(4) | ||
206 | STORE_BYTE(5) | ||
207 | EX(sb, a1, 6(a0), .Lbyte_fixup\@) | ||
208 | #endif | ||
209 | 0: | ||
210 | #endif | ||
169 | 1: jr ra | 211 | 1: jr ra |
170 | move a2, zero | 212 | move a2, zero |
171 | 213 | ||
@@ -186,6 +228,11 @@ | |||
186 | .hidden __memset | 228 | .hidden __memset |
187 | .endif | 229 | .endif |
188 | 230 | ||
231 | .Lbyte_fixup\@: | ||
232 | PTR_SUBU a2, $0, t0 | ||
233 | jr ra | ||
234 | PTR_ADDIU a2, 1 | ||
235 | |||
189 | .Lfirst_fixup\@: | 236 | .Lfirst_fixup\@: |
190 | jr ra | 237 | jr ra |
191 | nop | 238 | nop |
diff --git a/arch/mips/lib/mips-atomic.c b/arch/mips/lib/mips-atomic.c index be777d9a3f85..272af8ac2425 100644 --- a/arch/mips/lib/mips-atomic.c +++ b/arch/mips/lib/mips-atomic.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/export.h> | 15 | #include <linux/export.h> |
16 | #include <linux/stringify.h> | 16 | #include <linux/stringify.h> |
17 | 17 | ||
18 | #ifndef CONFIG_CPU_MIPSR2 | 18 | #if !defined(CONFIG_CPU_MIPSR2) && !defined(CONFIG_CPU_MIPSR6) |
19 | 19 | ||
20 | /* | 20 | /* |
21 | * For cli() we have to insert nops to make sure that the new value | 21 | * For cli() we have to insert nops to make sure that the new value |