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