diff options
Diffstat (limited to 'arch/mips/mm')
-rw-r--r-- | arch/mips/mm/c-octeon.c | 6 | ||||
-rw-r--r-- | arch/mips/mm/c-r4k.c | 48 | ||||
-rw-r--r-- | arch/mips/mm/dma-default.c | 13 | ||||
-rw-r--r-- | arch/mips/mm/page.c | 1 | ||||
-rw-r--r-- | arch/mips/mm/sc-mips.c | 3 | ||||
-rw-r--r-- | arch/mips/mm/tlb-r4k.c | 1 | ||||
-rw-r--r-- | arch/mips/mm/tlbex.c | 1 |
7 files changed, 46 insertions, 27 deletions
diff --git a/arch/mips/mm/c-octeon.c b/arch/mips/mm/c-octeon.c index 729e7702b1de..c8efdb5b6ee0 100644 --- a/arch/mips/mm/c-octeon.c +++ b/arch/mips/mm/c-octeon.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <asm/bootinfo.h> | 19 | #include <asm/bootinfo.h> |
20 | #include <asm/cacheops.h> | 20 | #include <asm/cacheops.h> |
21 | #include <asm/cpu-features.h> | 21 | #include <asm/cpu-features.h> |
22 | #include <asm/cpu-type.h> | ||
22 | #include <asm/page.h> | 23 | #include <asm/page.h> |
23 | #include <asm/pgtable.h> | 24 | #include <asm/pgtable.h> |
24 | #include <asm/r4kcache.h> | 25 | #include <asm/r4kcache.h> |
@@ -186,9 +187,10 @@ static void probe_octeon(void) | |||
186 | unsigned long dcache_size; | 187 | unsigned long dcache_size; |
187 | unsigned int config1; | 188 | unsigned int config1; |
188 | struct cpuinfo_mips *c = ¤t_cpu_data; | 189 | struct cpuinfo_mips *c = ¤t_cpu_data; |
190 | int cputype = current_cpu_type(); | ||
189 | 191 | ||
190 | config1 = read_c0_config1(); | 192 | config1 = read_c0_config1(); |
191 | switch (c->cputype) { | 193 | switch (cputype) { |
192 | case CPU_CAVIUM_OCTEON: | 194 | case CPU_CAVIUM_OCTEON: |
193 | case CPU_CAVIUM_OCTEON_PLUS: | 195 | case CPU_CAVIUM_OCTEON_PLUS: |
194 | c->icache.linesz = 2 << ((config1 >> 19) & 7); | 196 | c->icache.linesz = 2 << ((config1 >> 19) & 7); |
@@ -199,7 +201,7 @@ static void probe_octeon(void) | |||
199 | c->icache.sets * c->icache.ways * c->icache.linesz; | 201 | c->icache.sets * c->icache.ways * c->icache.linesz; |
200 | c->icache.waybit = ffs(icache_size / c->icache.ways) - 1; | 202 | c->icache.waybit = ffs(icache_size / c->icache.ways) - 1; |
201 | c->dcache.linesz = 128; | 203 | c->dcache.linesz = 128; |
202 | if (c->cputype == CPU_CAVIUM_OCTEON_PLUS) | 204 | if (cputype == CPU_CAVIUM_OCTEON_PLUS) |
203 | c->dcache.sets = 2; /* CN5XXX has two Dcache sets */ | 205 | c->dcache.sets = 2; /* CN5XXX has two Dcache sets */ |
204 | else | 206 | else |
205 | c->dcache.sets = 1; /* CN3XXX has one Dcache set */ | 207 | c->dcache.sets = 1; /* CN3XXX has one Dcache set */ |
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c index f749f687ee87..627883bc6d5f 100644 --- a/arch/mips/mm/c-r4k.c +++ b/arch/mips/mm/c-r4k.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/highmem.h> | 12 | #include <linux/highmem.h> |
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/linkage.h> | 14 | #include <linux/linkage.h> |
15 | #include <linux/preempt.h> | ||
15 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
16 | #include <linux/smp.h> | 17 | #include <linux/smp.h> |
17 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
@@ -24,6 +25,7 @@ | |||
24 | #include <asm/cacheops.h> | 25 | #include <asm/cacheops.h> |
25 | #include <asm/cpu.h> | 26 | #include <asm/cpu.h> |
26 | #include <asm/cpu-features.h> | 27 | #include <asm/cpu-features.h> |
28 | #include <asm/cpu-type.h> | ||
27 | #include <asm/io.h> | 29 | #include <asm/io.h> |
28 | #include <asm/page.h> | 30 | #include <asm/page.h> |
29 | #include <asm/pgtable.h> | 31 | #include <asm/pgtable.h> |
@@ -601,6 +603,7 @@ static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size) | |||
601 | /* Catch bad driver code */ | 603 | /* Catch bad driver code */ |
602 | BUG_ON(size == 0); | 604 | BUG_ON(size == 0); |
603 | 605 | ||
606 | preempt_disable(); | ||
604 | if (cpu_has_inclusive_pcaches) { | 607 | if (cpu_has_inclusive_pcaches) { |
605 | if (size >= scache_size) | 608 | if (size >= scache_size) |
606 | r4k_blast_scache(); | 609 | r4k_blast_scache(); |
@@ -621,6 +624,7 @@ static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size) | |||
621 | R4600_HIT_CACHEOP_WAR_IMPL; | 624 | R4600_HIT_CACHEOP_WAR_IMPL; |
622 | blast_dcache_range(addr, addr + size); | 625 | blast_dcache_range(addr, addr + size); |
623 | } | 626 | } |
627 | preempt_enable(); | ||
624 | 628 | ||
625 | bc_wback_inv(addr, size); | 629 | bc_wback_inv(addr, size); |
626 | __sync(); | 630 | __sync(); |
@@ -631,6 +635,7 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size) | |||
631 | /* Catch bad driver code */ | 635 | /* Catch bad driver code */ |
632 | BUG_ON(size == 0); | 636 | BUG_ON(size == 0); |
633 | 637 | ||
638 | preempt_disable(); | ||
634 | if (cpu_has_inclusive_pcaches) { | 639 | if (cpu_has_inclusive_pcaches) { |
635 | if (size >= scache_size) | 640 | if (size >= scache_size) |
636 | r4k_blast_scache(); | 641 | r4k_blast_scache(); |
@@ -655,6 +660,7 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size) | |||
655 | R4600_HIT_CACHEOP_WAR_IMPL; | 660 | R4600_HIT_CACHEOP_WAR_IMPL; |
656 | blast_inv_dcache_range(addr, addr + size); | 661 | blast_inv_dcache_range(addr, addr + size); |
657 | } | 662 | } |
663 | preempt_enable(); | ||
658 | 664 | ||
659 | bc_inv(addr, size); | 665 | bc_inv(addr, size); |
660 | __sync(); | 666 | __sync(); |
@@ -780,20 +786,30 @@ static inline void rm7k_erratum31(void) | |||
780 | 786 | ||
781 | static inline void alias_74k_erratum(struct cpuinfo_mips *c) | 787 | static inline void alias_74k_erratum(struct cpuinfo_mips *c) |
782 | { | 788 | { |
789 | unsigned int imp = c->processor_id & PRID_IMP_MASK; | ||
790 | unsigned int rev = c->processor_id & PRID_REV_MASK; | ||
791 | |||
783 | /* | 792 | /* |
784 | * Early versions of the 74K do not update the cache tags on a | 793 | * Early versions of the 74K do not update the cache tags on a |
785 | * vtag miss/ptag hit which can occur in the case of KSEG0/KUSEG | 794 | * vtag miss/ptag hit which can occur in the case of KSEG0/KUSEG |
786 | * aliases. In this case it is better to treat the cache as always | 795 | * aliases. In this case it is better to treat the cache as always |
787 | * having aliases. | 796 | * having aliases. |
788 | */ | 797 | */ |
789 | if ((c->processor_id & 0xff) <= PRID_REV_ENCODE_332(2, 4, 0)) | 798 | switch (imp) { |
790 | c->dcache.flags |= MIPS_CACHE_VTAG; | 799 | case PRID_IMP_74K: |
791 | if ((c->processor_id & 0xff) == PRID_REV_ENCODE_332(2, 4, 0)) | 800 | if (rev <= PRID_REV_ENCODE_332(2, 4, 0)) |
792 | write_c0_config6(read_c0_config6() | MIPS_CONF6_SYND); | 801 | c->dcache.flags |= MIPS_CACHE_VTAG; |
793 | if (((c->processor_id & 0xff00) == PRID_IMP_1074K) && | 802 | if (rev == PRID_REV_ENCODE_332(2, 4, 0)) |
794 | ((c->processor_id & 0xff) <= PRID_REV_ENCODE_332(1, 1, 0))) { | 803 | write_c0_config6(read_c0_config6() | MIPS_CONF6_SYND); |
795 | c->dcache.flags |= MIPS_CACHE_VTAG; | 804 | break; |
796 | write_c0_config6(read_c0_config6() | MIPS_CONF6_SYND); | 805 | case PRID_IMP_1074K: |
806 | if (rev <= PRID_REV_ENCODE_332(1, 1, 0)) { | ||
807 | c->dcache.flags |= MIPS_CACHE_VTAG; | ||
808 | write_c0_config6(read_c0_config6() | MIPS_CONF6_SYND); | ||
809 | } | ||
810 | break; | ||
811 | default: | ||
812 | BUG(); | ||
797 | } | 813 | } |
798 | } | 814 | } |
799 | 815 | ||
@@ -809,7 +825,7 @@ static void probe_pcache(void) | |||
809 | unsigned long config1; | 825 | unsigned long config1; |
810 | unsigned int lsize; | 826 | unsigned int lsize; |
811 | 827 | ||
812 | switch (c->cputype) { | 828 | switch (current_cpu_type()) { |
813 | case CPU_R4600: /* QED style two way caches? */ | 829 | case CPU_R4600: /* QED style two way caches? */ |
814 | case CPU_R4700: | 830 | case CPU_R4700: |
815 | case CPU_R5000: | 831 | case CPU_R5000: |
@@ -1025,7 +1041,8 @@ static void probe_pcache(void) | |||
1025 | * presumably no vendor is shipping his hardware in the "bad" | 1041 | * presumably no vendor is shipping his hardware in the "bad" |
1026 | * configuration. | 1042 | * configuration. |
1027 | */ | 1043 | */ |
1028 | if ((prid & 0xff00) == PRID_IMP_R4000 && (prid & 0xff) < 0x40 && | 1044 | if ((prid & PRID_IMP_MASK) == PRID_IMP_R4000 && |
1045 | (prid & PRID_REV_MASK) < PRID_REV_R4400 && | ||
1029 | !(config & CONF_SC) && c->icache.linesz != 16 && | 1046 | !(config & CONF_SC) && c->icache.linesz != 16 && |
1030 | PAGE_SIZE <= 0x8000) | 1047 | PAGE_SIZE <= 0x8000) |
1031 | panic("Improper R4000SC processor configuration detected"); | 1048 | panic("Improper R4000SC processor configuration detected"); |
@@ -1045,7 +1062,7 @@ static void probe_pcache(void) | |||
1045 | * normally they'd suffer from aliases but magic in the hardware deals | 1062 | * normally they'd suffer from aliases but magic in the hardware deals |
1046 | * with that for us so we don't need to take care ourselves. | 1063 | * with that for us so we don't need to take care ourselves. |
1047 | */ | 1064 | */ |
1048 | switch (c->cputype) { | 1065 | switch (current_cpu_type()) { |
1049 | case CPU_20KC: | 1066 | case CPU_20KC: |
1050 | case CPU_25KF: | 1067 | case CPU_25KF: |
1051 | case CPU_SB1: | 1068 | case CPU_SB1: |
@@ -1065,7 +1082,7 @@ static void probe_pcache(void) | |||
1065 | case CPU_34K: | 1082 | case CPU_34K: |
1066 | case CPU_74K: | 1083 | case CPU_74K: |
1067 | case CPU_1004K: | 1084 | case CPU_1004K: |
1068 | if (c->cputype == CPU_74K) | 1085 | if (current_cpu_type() == CPU_74K) |
1069 | alias_74k_erratum(c); | 1086 | alias_74k_erratum(c); |
1070 | if ((read_c0_config7() & (1 << 16))) { | 1087 | if ((read_c0_config7() & (1 << 16))) { |
1071 | /* effectively physically indexed dcache, | 1088 | /* effectively physically indexed dcache, |
@@ -1078,7 +1095,7 @@ static void probe_pcache(void) | |||
1078 | c->dcache.flags |= MIPS_CACHE_ALIASES; | 1095 | c->dcache.flags |= MIPS_CACHE_ALIASES; |
1079 | } | 1096 | } |
1080 | 1097 | ||
1081 | switch (c->cputype) { | 1098 | switch (current_cpu_type()) { |
1082 | case CPU_20KC: | 1099 | case CPU_20KC: |
1083 | /* | 1100 | /* |
1084 | * Some older 20Kc chips doesn't have the 'VI' bit in | 1101 | * Some older 20Kc chips doesn't have the 'VI' bit in |
@@ -1207,7 +1224,7 @@ static void setup_scache(void) | |||
1207 | * processors don't have a S-cache that would be relevant to the | 1224 | * processors don't have a S-cache that would be relevant to the |
1208 | * Linux memory management. | 1225 | * Linux memory management. |
1209 | */ | 1226 | */ |
1210 | switch (c->cputype) { | 1227 | switch (current_cpu_type()) { |
1211 | case CPU_R4000SC: | 1228 | case CPU_R4000SC: |
1212 | case CPU_R4000MC: | 1229 | case CPU_R4000MC: |
1213 | case CPU_R4400SC: | 1230 | case CPU_R4400SC: |
@@ -1384,9 +1401,8 @@ static void r4k_cache_error_setup(void) | |||
1384 | { | 1401 | { |
1385 | extern char __weak except_vec2_generic; | 1402 | extern char __weak except_vec2_generic; |
1386 | extern char __weak except_vec2_sb1; | 1403 | extern char __weak except_vec2_sb1; |
1387 | struct cpuinfo_mips *c = ¤t_cpu_data; | ||
1388 | 1404 | ||
1389 | switch (c->cputype) { | 1405 | switch (current_cpu_type()) { |
1390 | case CPU_SB1: | 1406 | case CPU_SB1: |
1391 | case CPU_SB1A: | 1407 | case CPU_SB1A: |
1392 | set_uncached_handler(0x100, &except_vec2_sb1, 0x80); | 1408 | set_uncached_handler(0x100, &except_vec2_sb1, 0x80); |
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c index 664e523653d0..5f8b95512580 100644 --- a/arch/mips/mm/dma-default.c +++ b/arch/mips/mm/dma-default.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/highmem.h> | 18 | #include <linux/highmem.h> |
19 | 19 | ||
20 | #include <asm/cache.h> | 20 | #include <asm/cache.h> |
21 | #include <asm/cpu-type.h> | ||
21 | #include <asm/io.h> | 22 | #include <asm/io.h> |
22 | 23 | ||
23 | #include <dma-coherence.h> | 24 | #include <dma-coherence.h> |
@@ -307,12 +308,10 @@ static void mips_dma_sync_sg_for_cpu(struct device *dev, | |||
307 | { | 308 | { |
308 | int i; | 309 | int i; |
309 | 310 | ||
310 | /* Make sure that gcc doesn't leave the empty loop body. */ | 311 | if (cpu_needs_post_dma_flush(dev)) |
311 | for (i = 0; i < nelems; i++, sg++) { | 312 | for (i = 0; i < nelems; i++, sg++) |
312 | if (cpu_needs_post_dma_flush(dev)) | ||
313 | __dma_sync(sg_page(sg), sg->offset, sg->length, | 313 | __dma_sync(sg_page(sg), sg->offset, sg->length, |
314 | direction); | 314 | direction); |
315 | } | ||
316 | } | 315 | } |
317 | 316 | ||
318 | static void mips_dma_sync_sg_for_device(struct device *dev, | 317 | static void mips_dma_sync_sg_for_device(struct device *dev, |
@@ -320,12 +319,10 @@ static void mips_dma_sync_sg_for_device(struct device *dev, | |||
320 | { | 319 | { |
321 | int i; | 320 | int i; |
322 | 321 | ||
323 | /* Make sure that gcc doesn't leave the empty loop body. */ | 322 | if (!plat_device_is_coherent(dev)) |
324 | for (i = 0; i < nelems; i++, sg++) { | 323 | for (i = 0; i < nelems; i++, sg++) |
325 | if (!plat_device_is_coherent(dev)) | ||
326 | __dma_sync(sg_page(sg), sg->offset, sg->length, | 324 | __dma_sync(sg_page(sg), sg->offset, sg->length, |
327 | direction); | 325 | direction); |
328 | } | ||
329 | } | 326 | } |
330 | 327 | ||
331 | int mips_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | 328 | int mips_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) |
diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c index 218c2109a55d..cbd81d17793a 100644 --- a/arch/mips/mm/page.c +++ b/arch/mips/mm/page.c | |||
@@ -18,6 +18,7 @@ | |||
18 | 18 | ||
19 | #include <asm/bugs.h> | 19 | #include <asm/bugs.h> |
20 | #include <asm/cacheops.h> | 20 | #include <asm/cacheops.h> |
21 | #include <asm/cpu-type.h> | ||
21 | #include <asm/inst.h> | 22 | #include <asm/inst.h> |
22 | #include <asm/io.h> | 23 | #include <asm/io.h> |
23 | #include <asm/page.h> | 24 | #include <asm/page.h> |
diff --git a/arch/mips/mm/sc-mips.c b/arch/mips/mm/sc-mips.c index 5d01392e3518..08d05aee8788 100644 --- a/arch/mips/mm/sc-mips.c +++ b/arch/mips/mm/sc-mips.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/sched.h> | 6 | #include <linux/sched.h> |
7 | #include <linux/mm.h> | 7 | #include <linux/mm.h> |
8 | 8 | ||
9 | #include <asm/cpu-type.h> | ||
9 | #include <asm/mipsregs.h> | 10 | #include <asm/mipsregs.h> |
10 | #include <asm/bcache.h> | 11 | #include <asm/bcache.h> |
11 | #include <asm/cacheops.h> | 12 | #include <asm/cacheops.h> |
@@ -71,7 +72,7 @@ static inline int mips_sc_is_activated(struct cpuinfo_mips *c) | |||
71 | unsigned int tmp; | 72 | unsigned int tmp; |
72 | 73 | ||
73 | /* Check the bypass bit (L2B) */ | 74 | /* Check the bypass bit (L2B) */ |
74 | switch (c->cputype) { | 75 | switch (current_cpu_type()) { |
75 | case CPU_34K: | 76 | case CPU_34K: |
76 | case CPU_74K: | 77 | case CPU_74K: |
77 | case CPU_1004K: | 78 | case CPU_1004K: |
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c index 00b26a67a06d..bb3a5f643e97 100644 --- a/arch/mips/mm/tlb-r4k.c +++ b/arch/mips/mm/tlb-r4k.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | 17 | ||
18 | #include <asm/cpu.h> | 18 | #include <asm/cpu.h> |
19 | #include <asm/cpu-type.h> | ||
19 | #include <asm/bootinfo.h> | 20 | #include <asm/bootinfo.h> |
20 | #include <asm/mmu_context.h> | 21 | #include <asm/mmu_context.h> |
21 | #include <asm/pgtable.h> | 22 | #include <asm/pgtable.h> |
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index 821b45175dc1..9bb3a9363b06 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/cache.h> | 30 | #include <linux/cache.h> |
31 | 31 | ||
32 | #include <asm/cacheflush.h> | 32 | #include <asm/cacheflush.h> |
33 | #include <asm/cpu-type.h> | ||
33 | #include <asm/pgtable.h> | 34 | #include <asm/pgtable.h> |
34 | #include <asm/war.h> | 35 | #include <asm/war.h> |
35 | #include <asm/uasm.h> | 36 | #include <asm/uasm.h> |