2 * Based on arch/mips/mm/init.c
3 * Copyright (C) 1994 - 2000 Ralf Baechle
4 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
5 * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
6 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #include <linux/bootmem.h>
23 #include <linux/init.h>
25 #include <linux/module.h>
26 #include <linux/pfn.h>
27 #include <linux/proc_fs.h>
28 #include <linux/string.h>
29 #include <linux/swap.h>
31 #include <asm/bootinfo.h>
33 #include <asm/sections.h>
35 #include <asm/mips-boards/prom.h>
37 static int __init memsize(void)
39 u32 size = (64 << 20);
40 volatile u32 *addr = (u32 *)KSEG1ADDR(0x14000000 + size - 4);
41 u32 *kernel_end = (u32 *)KSEG1ADDR(CPHYSADDR((u32)&_end));
43 while (addr > kernel_end) {
51 if (*addr != (u32)addr)
54 } while (size < (64 << 20));
59 void __init prom_meminit(void)
63 pages = memsize() >> PAGE_SHIFT;
64 add_memory_region(PHYS_OFFSET, pages << PAGE_SHIFT,
68 void __init prom_free_prom_memory(void)