- char *memsize_str;
- unsigned int result;
- char cmdline[CL_SIZE], *ptr;
-
- /* Check the command line first for a memsize directive */
- strcpy(cmdline, arcs_cmdline);
- ptr = strstr(cmdline, "memsize=");
- if (ptr && (ptr != cmdline) && (*(ptr - 1) != ' '))
- ptr = strstr(ptr, " memsize=");
-
- if (ptr) {
- result = memparse(ptr + 8, &ptr);
- } else {
- /* otherwise look in the environment */
- memsize_str = prom_getenv("memsize");
- if (!memsize_str) {
- prom_printf("memsize not set in boot prom, set to default (8Mb)\n");
- result = 0x00800000;
- } else {
- result = simple_strtol(memsize_str, NULL, 0);
- }
- }
-
- return result;
-}
-
-extern unsigned long __initramfs_start, __initramfs_end;
-
-#ifdef CONFIG_NEED_MULTIPLE_NODES
-static bootmem_data_t node_bootmem_data;
-pg_data_t __node_data[1] = {
- {
- .bdata = &node_bootmem_data
- },
-};
-EXPORT_SYMBOL(__node_data);
-
-unsigned long max_mapnr;
-struct page *mem_map;
-EXPORT_SYMBOL(max_mapnr);
-EXPORT_SYMBOL(mem_map);
-
-static unsigned long setup_zero_pages(void)
-{
- unsigned int order = 3;
- unsigned long size;
- struct page *page;
-
- empty_zero_page = __get_free_pages(GFP_KERNEL | __GFP_ZERO, order);
- if (!empty_zero_page)
- panic("Oh boy, that early out of memory?");
-
- page = virt_to_page(empty_zero_page);
- split_page(page, order);
- while (page < virt_to_page(empty_zero_page + (PAGE_SIZE << order))) {
- SetPageReserved(page);
- page++;
- }
-
- size = PAGE_SIZE << order;
- zero_page_mask = (size - 1) & PAGE_MASK;
-
- return 1UL << order;
-}
-
-extern void pagetable_init(void);
-
-void __init paging_init(void)
-{
- unsigned long zones_size[MAX_NR_ZONES] = { 0, };
-
- pagetable_init();
-
- zones_size[ZONE_DMA] = max_low_pfn - min_low_pfn;
-
- free_area_init_node(0, NODE_DATA(0), zones_size, ARCH_PFN_OFFSET, NULL);
-}
-
-static struct kcore_list kcore_mem, kcore_vmalloc;
-
-void __init mem_init(void)
-{
- unsigned long codesize, reservedpages, datasize, initsize;
- unsigned long tmp, ram;
- unsigned long kernel_start, kernel_end;
-
- kernel_start = PFN_DOWN(CPHYSADDR((unsigned long)&_text));
- kernel_end = PFN_UP(CPHYSADDR((unsigned long)&_end));
- for (tmp = min_low_pfn + 1; tmp < kernel_start; tmp++) {
- ClearPageReserved(pfn_to_page(tmp));
- init_page_count(pfn_to_page(tmp));
- free_page((unsigned long)__va(tmp << PAGE_SHIFT));
- }
-
- totalram_pages += free_all_bootmem();
- totalram_pages -= setup_zero_pages(); /* Setup zeroed pages. */
-
- reservedpages = ram = 0;
- for (tmp = min_low_pfn; tmp <= max_low_pfn; tmp++) {
- ram++;
- if (PageReserved(pfn_to_page(tmp)))
- if ((tmp < kernel_start) || (tmp > kernel_end))
- reservedpages++;