aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mm/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/mm/init.c')
-rw-r--r--arch/mips/mm/init.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 125a4a85ec05..2d1c2c024822 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -61,8 +61,6 @@
61 61
62DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 62DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
63 63
64unsigned long highstart_pfn, highend_pfn;
65
66/* 64/*
67 * We have up to 8 empty zeroed pages so we can map one of the right colour 65 * We have up to 8 empty zeroed pages so we can map one of the right colour
68 * when needed. This is necessary only on R4000 / R4400 SC and MC versions 66 * when needed. This is necessary only on R4000 / R4400 SC and MC versions
@@ -125,7 +123,7 @@ static void __init kmap_coherent_init(void)
125static inline void kmap_coherent_init(void) {} 123static inline void kmap_coherent_init(void) {}
126#endif 124#endif
127 125
128static inline void *kmap_coherent(struct page *page, unsigned long addr) 126void *kmap_coherent(struct page *page, unsigned long addr)
129{ 127{
130 enum fixed_addresses idx; 128 enum fixed_addresses idx;
131 unsigned long vaddr, flags, entrylo; 129 unsigned long vaddr, flags, entrylo;
@@ -179,7 +177,7 @@ static inline void *kmap_coherent(struct page *page, unsigned long addr)
179 177
180#define UNIQUE_ENTRYHI(idx) (CKSEG0 + ((idx) << (PAGE_SHIFT + 1))) 178#define UNIQUE_ENTRYHI(idx) (CKSEG0 + ((idx) << (PAGE_SHIFT + 1)))
181 179
182static inline void kunmap_coherent(struct page *page) 180void kunmap_coherent(void)
183{ 181{
184#ifndef CONFIG_MIPS_MT_SMTC 182#ifndef CONFIG_MIPS_MT_SMTC
185 unsigned int wired; 183 unsigned int wired;
@@ -212,7 +210,7 @@ void copy_user_highpage(struct page *to, struct page *from,
212 if (cpu_has_dc_aliases) { 210 if (cpu_has_dc_aliases) {
213 vfrom = kmap_coherent(from, vaddr); 211 vfrom = kmap_coherent(from, vaddr);
214 copy_page(vto, vfrom); 212 copy_page(vto, vfrom);
215 kunmap_coherent(from); 213 kunmap_coherent();
216 } else { 214 } else {
217 vfrom = kmap_atomic(from, KM_USER0); 215 vfrom = kmap_atomic(from, KM_USER0);
218 copy_page(vto, vfrom); 216 copy_page(vto, vfrom);
@@ -235,7 +233,7 @@ void copy_to_user_page(struct vm_area_struct *vma,
235 if (cpu_has_dc_aliases) { 233 if (cpu_has_dc_aliases) {
236 void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK); 234 void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
237 memcpy(vto, src, len); 235 memcpy(vto, src, len);
238 kunmap_coherent(page); 236 kunmap_coherent();
239 } else 237 } else
240 memcpy(dst, src, len); 238 memcpy(dst, src, len);
241 if ((vma->vm_flags & VM_EXEC) && !cpu_has_ic_fills_f_dc) 239 if ((vma->vm_flags & VM_EXEC) && !cpu_has_ic_fills_f_dc)
@@ -252,7 +250,7 @@ void copy_from_user_page(struct vm_area_struct *vma,
252 void *vfrom = 250 void *vfrom =
253 kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK); 251 kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
254 memcpy(dst, vfrom, len); 252 memcpy(dst, vfrom, len);
255 kunmap_coherent(page); 253 kunmap_coherent();
256 } else 254 } else
257 memcpy(dst, src, len); 255 memcpy(dst, src, len);
258} 256}
@@ -261,6 +259,8 @@ EXPORT_SYMBOL(copy_from_user_page);
261 259
262 260
263#ifdef CONFIG_HIGHMEM 261#ifdef CONFIG_HIGHMEM
262unsigned long highstart_pfn, highend_pfn;
263
264pte_t *kmap_pte; 264pte_t *kmap_pte;
265pgprot_t kmap_prot; 265pgprot_t kmap_prot;
266 266
@@ -314,8 +314,6 @@ void __init fixrange_init(unsigned long start, unsigned long end,
314} 314}
315 315
316#ifndef CONFIG_NEED_MULTIPLE_NODES 316#ifndef CONFIG_NEED_MULTIPLE_NODES
317extern void pagetable_init(void);
318
319static int __init page_is_ram(unsigned long pagenr) 317static int __init page_is_ram(unsigned long pagenr)
320{ 318{
321 int i; 319 int i;
@@ -353,18 +351,15 @@ void __init paging_init(void)
353#endif 351#endif
354 kmap_coherent_init(); 352 kmap_coherent_init();
355 353
356#ifdef CONFIG_ISA 354#ifdef CONFIG_ZONE_DMA
357 if (max_low_pfn >= MAX_DMA_PFN) 355 if (min_low_pfn < MAX_DMA_PFN && MAX_DMA_PFN <= max_low_pfn) {
358 if (min_low_pfn >= MAX_DMA_PFN) { 356 zones_size[ZONE_DMA] = MAX_DMA_PFN - min_low_pfn;
359 zones_size[ZONE_DMA] = 0; 357 zones_size[ZONE_NORMAL] = max_low_pfn - MAX_DMA_PFN;
360 zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn; 358 } else if (max_low_pfn < MAX_DMA_PFN)
361 } else { 359 zones_size[ZONE_DMA] = max_low_pfn - min_low_pfn;
362 zones_size[ZONE_DMA] = MAX_DMA_PFN - min_low_pfn;
363 zones_size[ZONE_NORMAL] = max_low_pfn - MAX_DMA_PFN;
364 }
365 else 360 else
366#endif 361#endif
367 zones_size[ZONE_DMA] = max_low_pfn - min_low_pfn; 362 zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn;
368 363
369#ifdef CONFIG_HIGHMEM 364#ifdef CONFIG_HIGHMEM
370 zones_size[ZONE_HIGHMEM] = highend_pfn - highstart_pfn; 365 zones_size[ZONE_HIGHMEM] = highend_pfn - highstart_pfn;
@@ -379,7 +374,7 @@ void __init paging_init(void)
379#ifdef CONFIG_FLATMEM 374#ifdef CONFIG_FLATMEM
380 free_area_init(zones_size); 375 free_area_init(zones_size);
381#else 376#else
382 pfn = 0; 377 pfn = min_low_pfn;
383 for (i = 0; i < MAX_NR_ZONES; i++) 378 for (i = 0; i < MAX_NR_ZONES; i++)
384 for (j = 0; j < zones_size[i]; j++, pfn++) 379 for (j = 0; j < zones_size[i]; j++, pfn++)
385 if (!page_is_ram(pfn)) 380 if (!page_is_ram(pfn))