aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/mm')
-rw-r--r--arch/mips/mm/c-r4k.c2
-rw-r--r--arch/mips/mm/dma-default.c19
-rw-r--r--arch/mips/mm/highmem.c25
-rw-r--r--arch/mips/mm/init.c26
-rw-r--r--arch/mips/mm/sc-rm7k.c4
5 files changed, 23 insertions, 53 deletions
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 58d9075e86fe..171951d2305b 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -1041,7 +1041,7 @@ static void __cpuinit probe_pcache(void)
1041 1041
1042 printk("Primary instruction cache %ldkB, %s, %s, linesize %d bytes.\n", 1042 printk("Primary instruction cache %ldkB, %s, %s, linesize %d bytes.\n",
1043 icache_size >> 10, 1043 icache_size >> 10,
1044 cpu_has_vtag_icache ? "VIVT" : "VIPT", 1044 c->icache.flags & MIPS_CACHE_VTAG ? "VIVT" : "VIPT",
1045 way_string[c->icache.ways], c->icache.linesz); 1045 way_string[c->icache.ways], c->icache.linesz);
1046 1046
1047 printk("Primary data cache %ldkB, %s, %s, %s, linesize %d bytes\n", 1047 printk("Primary data cache %ldkB, %s, %s, %s, linesize %d bytes\n",
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index bed56f1ac837..4fdb7f5216b9 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -209,7 +209,7 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page,
209 unsigned long addr; 209 unsigned long addr;
210 210
211 addr = (unsigned long) page_address(page) + offset; 211 addr = (unsigned long) page_address(page) + offset;
212 dma_cache_wback_inv(addr, size); 212 __dma_sync(addr, size, direction);
213 } 213 }
214 214
215 return plat_map_dma_mem_page(dev, page) + offset; 215 return plat_map_dma_mem_page(dev, page) + offset;
@@ -217,23 +217,6 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page,
217 217
218EXPORT_SYMBOL(dma_map_page); 218EXPORT_SYMBOL(dma_map_page);
219 219
220void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
221 enum dma_data_direction direction)
222{
223 BUG_ON(direction == DMA_NONE);
224
225 if (!plat_device_is_coherent(dev) && direction != DMA_TO_DEVICE) {
226 unsigned long addr;
227
228 addr = dma_addr_to_virt(dma_address);
229 dma_cache_wback_inv(addr, size);
230 }
231
232 plat_unmap_dma_mem(dev, dma_address);
233}
234
235EXPORT_SYMBOL(dma_unmap_page);
236
237void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, 220void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
238 enum dma_data_direction direction) 221 enum dma_data_direction direction)
239{ 222{
diff --git a/arch/mips/mm/highmem.c b/arch/mips/mm/highmem.c
index 4481656d1065..2b1309b2580a 100644
--- a/arch/mips/mm/highmem.c
+++ b/arch/mips/mm/highmem.c
@@ -1,7 +1,12 @@
1#include <linux/module.h> 1#include <linux/module.h>
2#include <linux/highmem.h> 2#include <linux/highmem.h>
3#include <asm/fixmap.h>
3#include <asm/tlbflush.h> 4#include <asm/tlbflush.h>
4 5
6static pte_t *kmap_pte;
7
8unsigned long highstart_pfn, highend_pfn;
9
5void *__kmap(struct page *page) 10void *__kmap(struct page *page)
6{ 11{
7 void *addr; 12 void *addr;
@@ -14,6 +19,7 @@ void *__kmap(struct page *page)
14 19
15 return addr; 20 return addr;
16} 21}
22EXPORT_SYMBOL(__kmap);
17 23
18void __kunmap(struct page *page) 24void __kunmap(struct page *page)
19{ 25{
@@ -22,6 +28,7 @@ void __kunmap(struct page *page)
22 return; 28 return;
23 kunmap_high(page); 29 kunmap_high(page);
24} 30}
31EXPORT_SYMBOL(__kunmap);
25 32
26/* 33/*
27 * kmap_atomic/kunmap_atomic is significantly faster than kmap/kunmap because 34 * kmap_atomic/kunmap_atomic is significantly faster than kmap/kunmap because
@@ -48,11 +55,12 @@ void *__kmap_atomic(struct page *page, enum km_type type)
48#ifdef CONFIG_DEBUG_HIGHMEM 55#ifdef CONFIG_DEBUG_HIGHMEM
49 BUG_ON(!pte_none(*(kmap_pte - idx))); 56 BUG_ON(!pte_none(*(kmap_pte - idx)));
50#endif 57#endif
51 set_pte(kmap_pte-idx, mk_pte(page, kmap_prot)); 58 set_pte(kmap_pte-idx, mk_pte(page, PAGE_KERNEL));
52 local_flush_tlb_one((unsigned long)vaddr); 59 local_flush_tlb_one((unsigned long)vaddr);
53 60
54 return (void*) vaddr; 61 return (void*) vaddr;
55} 62}
63EXPORT_SYMBOL(__kmap_atomic);
56 64
57void __kunmap_atomic(void *kvaddr, enum km_type type) 65void __kunmap_atomic(void *kvaddr, enum km_type type)
58{ 66{
@@ -77,6 +85,7 @@ void __kunmap_atomic(void *kvaddr, enum km_type type)
77 85
78 pagefault_enable(); 86 pagefault_enable();
79} 87}
88EXPORT_SYMBOL(__kunmap_atomic);
80 89
81/* 90/*
82 * This is the same as kmap_atomic() but can map memory that doesn't 91 * This is the same as kmap_atomic() but can map memory that doesn't
@@ -92,7 +101,7 @@ void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
92 debug_kmap_atomic(type); 101 debug_kmap_atomic(type);
93 idx = type + KM_TYPE_NR*smp_processor_id(); 102 idx = type + KM_TYPE_NR*smp_processor_id();
94 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); 103 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
95 set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot)); 104 set_pte(kmap_pte-idx, pfn_pte(pfn, PAGE_KERNEL));
96 flush_tlb_one(vaddr); 105 flush_tlb_one(vaddr);
97 106
98 return (void*) vaddr; 107 return (void*) vaddr;
@@ -111,7 +120,11 @@ struct page *__kmap_atomic_to_page(void *ptr)
111 return pte_page(*pte); 120 return pte_page(*pte);
112} 121}
113 122
114EXPORT_SYMBOL(__kmap); 123void __init kmap_init(void)
115EXPORT_SYMBOL(__kunmap); 124{
116EXPORT_SYMBOL(__kmap_atomic); 125 unsigned long kmap_vstart;
117EXPORT_SYMBOL(__kunmap_atomic); 126
127 /* cache the first kmap pte */
128 kmap_vstart = __fix_to_virt(FIX_KMAP_BEGIN);
129 kmap_pte = kmap_get_fixmap_pte(kmap_vstart);
130}
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index d9348946a19e..c5511294a9ee 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -104,14 +104,6 @@ unsigned long setup_zero_pages(void)
104 return 1UL << order; 104 return 1UL << order;
105} 105}
106 106
107/*
108 * These are almost like kmap_atomic / kunmap_atmic except they take an
109 * additional address argument as the hint.
110 */
111
112#define kmap_get_fixmap_pte(vaddr) \
113 pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), (vaddr)), (vaddr)), (vaddr))
114
115#ifdef CONFIG_MIPS_MT_SMTC 107#ifdef CONFIG_MIPS_MT_SMTC
116static pte_t *kmap_coherent_pte; 108static pte_t *kmap_coherent_pte;
117static void __init kmap_coherent_init(void) 109static void __init kmap_coherent_init(void)
@@ -264,24 +256,6 @@ void copy_from_user_page(struct vm_area_struct *vma,
264 } 256 }
265} 257}
266 258
267#ifdef CONFIG_HIGHMEM
268unsigned long highstart_pfn, highend_pfn;
269
270pte_t *kmap_pte;
271pgprot_t kmap_prot;
272
273static void __init kmap_init(void)
274{
275 unsigned long kmap_vstart;
276
277 /* cache the first kmap pte */
278 kmap_vstart = __fix_to_virt(FIX_KMAP_BEGIN);
279 kmap_pte = kmap_get_fixmap_pte(kmap_vstart);
280
281 kmap_prot = PAGE_KERNEL;
282}
283#endif /* CONFIG_HIGHMEM */
284
285void __init fixrange_init(unsigned long start, unsigned long end, 259void __init fixrange_init(unsigned long start, unsigned long end,
286 pgd_t *pgd_base) 260 pgd_t *pgd_base)
287{ 261{
diff --git a/arch/mips/mm/sc-rm7k.c b/arch/mips/mm/sc-rm7k.c
index e3abfb2d7e86..de69bfbf506e 100644
--- a/arch/mips/mm/sc-rm7k.c
+++ b/arch/mips/mm/sc-rm7k.c
@@ -29,7 +29,7 @@ extern unsigned long icache_way_size, dcache_way_size;
29 29
30#include <asm/r4kcache.h> 30#include <asm/r4kcache.h>
31 31
32int rm7k_tcache_enabled; 32static int rm7k_tcache_enabled;
33 33
34/* 34/*
35 * Writeback and invalidate the primary cache dcache before DMA. 35 * Writeback and invalidate the primary cache dcache before DMA.
@@ -121,7 +121,7 @@ static void rm7k_sc_disable(void)
121 clear_c0_config(RM7K_CONF_SE); 121 clear_c0_config(RM7K_CONF_SE);
122} 122}
123 123
124struct bcache_ops rm7k_sc_ops = { 124static struct bcache_ops rm7k_sc_ops = {
125 .bc_enable = rm7k_sc_enable, 125 .bc_enable = rm7k_sc_enable,
126 .bc_disable = rm7k_sc_disable, 126 .bc_disable = rm7k_sc_disable,
127 .bc_wback_inv = rm7k_sc_wback_inv, 127 .bc_wback_inv = rm7k_sc_wback_inv,