aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm/pgtable_32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/mm/pgtable_32.c')
-rw-r--r--arch/powerpc/mm/pgtable_32.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index cb96cb2e17cc..b9243e7557ae 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -26,6 +26,8 @@
26#include <linux/vmalloc.h> 26#include <linux/vmalloc.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/highmem.h> 28#include <linux/highmem.h>
29#include <linux/lmb.h>
30#include <linux/slab.h>
29 31
30#include <asm/pgtable.h> 32#include <asm/pgtable.h>
31#include <asm/pgalloc.h> 33#include <asm/pgalloc.h>
@@ -191,7 +193,8 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, unsigned long flags,
191 * Don't allow anybody to remap normal RAM that we're using. 193 * Don't allow anybody to remap normal RAM that we're using.
192 * mem_init() sets high_memory so only do the check after that. 194 * mem_init() sets high_memory so only do the check after that.
193 */ 195 */
194 if (mem_init_done && (p < virt_to_phys(high_memory))) { 196 if (mem_init_done && (p < virt_to_phys(high_memory)) &&
197 !(__allow_ioremap_reserved && lmb_is_region_reserved(p, size))) {
195 printk("__ioremap(): phys addr 0x%llx is RAM lr %p\n", 198 printk("__ioremap(): phys addr 0x%llx is RAM lr %p\n",
196 (unsigned long long)p, __builtin_return_address(0)); 199 (unsigned long long)p, __builtin_return_address(0));
197 return NULL; 200 return NULL;
@@ -283,18 +286,18 @@ int map_page(unsigned long va, phys_addr_t pa, int flags)
283} 286}
284 287
285/* 288/*
286 * Map in a big chunk of physical memory starting at PAGE_OFFSET. 289 * Map in a chunk of physical memory starting at start.
287 */ 290 */
288void __init mapin_ram(void) 291void __init __mapin_ram_chunk(unsigned long offset, unsigned long top)
289{ 292{
290 unsigned long v, s, f; 293 unsigned long v, s, f;
291 phys_addr_t p; 294 phys_addr_t p;
292 int ktext; 295 int ktext;
293 296
294 s = mmu_mapin_ram(); 297 s = offset;
295 v = PAGE_OFFSET + s; 298 v = PAGE_OFFSET + s;
296 p = memstart_addr + s; 299 p = memstart_addr + s;
297 for (; s < total_lowmem; s += PAGE_SIZE) { 300 for (; s < top; s += PAGE_SIZE) {
298 ktext = ((char *) v >= _stext && (char *) v < etext); 301 ktext = ((char *) v >= _stext && (char *) v < etext);
299 f = ktext ? PAGE_KERNEL_TEXT : PAGE_KERNEL; 302 f = ktext ? PAGE_KERNEL_TEXT : PAGE_KERNEL;
300 map_page(v, p, f); 303 map_page(v, p, f);
@@ -307,6 +310,30 @@ void __init mapin_ram(void)
307 } 310 }
308} 311}
309 312
313void __init mapin_ram(void)
314{
315 unsigned long s, top;
316
317#ifndef CONFIG_WII
318 top = total_lowmem;
319 s = mmu_mapin_ram(top);
320 __mapin_ram_chunk(s, top);
321#else
322 if (!wii_hole_size) {
323 s = mmu_mapin_ram(total_lowmem);
324 __mapin_ram_chunk(s, total_lowmem);
325 } else {
326 top = wii_hole_start;
327 s = mmu_mapin_ram(top);
328 __mapin_ram_chunk(s, top);
329
330 top = lmb_end_of_DRAM();
331 s = wii_mmu_mapin_mem2(top);
332 __mapin_ram_chunk(s, top);
333 }
334#endif
335}
336
310/* Scan the real Linux page tables and return a PTE pointer for 337/* Scan the real Linux page tables and return a PTE pointer for
311 * a virtual address in a context. 338 * a virtual address in a context.
312 * Returns true (1) if PTE was found, zero otherwise. The pointer to 339 * Returns true (1) if PTE was found, zero otherwise. The pointer to
@@ -356,7 +383,7 @@ static int __change_page_attr(struct page *page, pgprot_t prot)
356 return 0; 383 return 0;
357 if (!get_pteptr(&init_mm, address, &kpte, &kpmd)) 384 if (!get_pteptr(&init_mm, address, &kpte, &kpmd))
358 return -EINVAL; 385 return -EINVAL;
359 set_pte_at(&init_mm, address, kpte, mk_pte(page, prot)); 386 __set_pte_at(&init_mm, address, kpte, mk_pte(page, prot), 0);
360 wmb(); 387 wmb();
361#ifdef CONFIG_PPC_STD_MMU 388#ifdef CONFIG_PPC_STD_MMU
362 flush_hash_pages(0, address, pmd_val(*kpmd), 1); 389 flush_hash_pages(0, address, pmd_val(*kpmd), 1);