/* * Limit the memory size that was specified via FDT. */ static int __init early_mem(char *p) { phys_addr_t limit; if (!p) return 1; limit = memparse(p, &p) & PAGE_MASK; pr_notice("Memory limited to %lldMB\n", limit >> 20); memblock_enforce_memory_limit(limit); return 0; }
/* * MMU_init sets up the basic memory mappings for the kernel, * including both RAM and possibly some I/O regions, * and sets up the page tables and the MMU hardware ready to go. */ void __init MMU_init(void) { if (ppc_md.progress) ppc_md.progress("MMU:enter", 0x111); /* parse args from command line */ MMU_setup(); /* * Reserve gigantic pages for hugetlb. This MUST occur before * lowmem_end_addr is initialized below. */ reserve_hugetlb_gpages(); if (memblock.memory.cnt > 1) { #ifndef CONFIG_WII memblock_enforce_memory_limit(memblock.memory.regions[0].size); printk(KERN_WARNING "Only using first contiguous memory region"); #else wii_memory_fixups(); #endif } total_lowmem = total_memory = memblock_end_of_DRAM() - memstart_addr; lowmem_end_addr = memstart_addr + total_lowmem; #ifdef CONFIG_FSL_BOOKE /* Freescale Book-E parts expect lowmem to be mapped by fixed TLB * entries, so we need to adjust lowmem to match the amount we can map * in the fixed entries */ adjust_total_lowmem(); #endif /* CONFIG_FSL_BOOKE */ if (total_lowmem > __max_low_memory) { total_lowmem = __max_low_memory; lowmem_end_addr = memstart_addr + total_lowmem; #ifndef CONFIG_HIGHMEM total_memory = total_lowmem; memblock_enforce_memory_limit(total_lowmem); #endif /* CONFIG_HIGHMEM */ } /* Initialize the MMU hardware */ if (ppc_md.progress) ppc_md.progress("MMU:hw init", 0x300); MMU_init_hw(); /* Map in all of RAM starting at KERNELBASE */ if (ppc_md.progress) ppc_md.progress("MMU:mapin", 0x301); mapin_ram(); /* Initialize early top-down ioremap allocator */ ioremap_bot = IOREMAP_TOP; /* Map in I/O resources */ if (ppc_md.progress) ppc_md.progress("MMU:setio", 0x302); if (ppc_md.progress) ppc_md.progress("MMU:exit", 0x211); /* From now on, btext is no longer BAT mapped if it was at all */ #ifdef CONFIG_BOOTX_TEXT btext_unmap(); #endif /* Shortly after that, the entire linear mapping will be available */ memblock_set_current_limit(lowmem_end_addr); }