12 #include <linux/kernel.h>
18 #include <linux/slab.h>
20 #include <linux/export.h>
23 #include <asm/mmu_context.h>
24 #include <asm/pgalloc.h>
25 #include <asm/sections.h>
27 #include <asm/fixmap.h>
58 static inline pte_t *virt_to_kpte(
unsigned long vaddr)
64 static void __init highmem_init(
void)
74 static unsigned long highmem_setup(
void)
77 unsigned long reservedpages = 0;
85 ClearPageReserved(page);
86 init_page_count(page);
104 unsigned long zones_size[MAX_NR_ZONES];
114 memset(zones_size, 0,
sizeof(zones_size));
116 #ifdef CONFIG_HIGHMEM
120 zones_size[ZONE_HIGHMEM] =
max_pfn;
122 zones_size[ZONE_DMA] =
max_pfn;
126 free_area_init_nodes(zones_size);
131 unsigned long map_size;
132 struct memblock_region *
reg;
135 u32 kernel_align_start, kernel_align_size;
138 for_each_memblock(
memory, reg) {
153 panic(
"%s: Missing memory setting 0x%08x, size=0x%08x\n",
158 kernel_align_start = PAGE_DOWN((
u32)
_text);
160 kernel_align_size = PAGE_UP((
u32)
klimit) - kernel_align_start;
162 __func__, kernel_align_start, kernel_align_start
163 + kernel_align_size, kernel_align_size);
201 for_each_memblock(
memory, reg) {
202 unsigned long start_pfn, end_pfn;
204 start_pfn = memblock_region_memory_base_pfn(reg);
205 end_pfn = memblock_region_memory_end_pfn(reg);
206 memblock_set_node(start_pfn << PAGE_SHIFT,
207 (end_pfn - start_pfn) << PAGE_SHIFT, 0);
215 unsigned long top = reg->base + reg->size - 1;
217 pr_debug(
"reserved - 0x%08x-0x%08x, %lx, %lx\n",
218 (
u32) reg->base, (
u32) reg->size, top,
231 sparse_memory_present_with_active_regions(0);
249 printk(
KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
252 #ifdef CONFIG_BLK_DEV_INITRD
278 unsigned long reservedpages = 0, codesize, initsize, datasize, bsssize;
293 if (PageReserved(page))
298 #ifdef CONFIG_HIGHMEM
299 reservedpages -= highmem_setup();
307 pr_info(
"Memory: %luk/%luk available (%luk kernel code, "
308 "%luk reserved, %luk data, %luk bss, %luk init)\n",
318 pr_info(
"Kernel virtual memory layout:\n");
320 #ifdef CONFIG_HIGHMEM
321 pr_info(
" * 0x%08lx..0x%08lx : highmem PTEs\n",
324 pr_info(
" * 0x%08lx..0x%08lx : early ioremap\n",
326 pr_info(
" * 0x%08lx..0x%08lx : vmalloc & ioremap\n",
346 static void mm_cmdline_setup(
void)
348 unsigned long maxmem = 0;
352 p =
strstr(cmd_line,
"mem=");
366 static void __init mmu_init_hw(
void)
380 __asm__ __volatile__ (
"ori r11, r0, 0x10000000;" \
394 unsigned int kstart,
ksize;
396 if (!memblock.reserved.cnt) {
401 if ((
u32) memblock.memory.regions[0].size < 0x400000) {
417 #ifndef CONFIG_HIGHMEM
428 kstart =
__pa(CONFIG_KERNEL_START);
433 #if defined(CONFIG_BLK_DEV_INITRD)
448 #ifdef CONFIG_HIGHMEM
495 p = kzalloc(size, mask);