2007-03-19 19:34:37 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* Carsten Langgaard, carstenl@mips.com
|
|
|
|
* Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
|
|
|
|
* Copyright (C) 2003 ADMtek Incorporated.
|
|
|
|
* daniell@admtek.com.tw
|
|
|
|
* Copyright (C) 2005 Jeroen Vreeken (pe1rxq@amsat.org)
|
|
|
|
*
|
|
|
|
* ########################################################################
|
|
|
|
*
|
|
|
|
* This program is free software; you can distribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License (Version 2) as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* ########################################################################
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#include <linux/autoconf.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/mm.h>
|
|
|
|
#include <linux/bootmem.h>
|
|
|
|
#include <linux/pfn.h>
|
|
|
|
#include <linux/string.h>
|
|
|
|
|
|
|
|
#include <asm/bootinfo.h>
|
|
|
|
#include <asm/page.h>
|
|
|
|
#include <asm/sections.h>
|
|
|
|
|
2007-06-14 14:59:31 +03:00
|
|
|
#include <asm/mach-adm5120/adm5120_info.h>
|
2007-03-19 19:34:37 +02:00
|
|
|
#include <asm-mips/mips-boards/prom.h>
|
|
|
|
|
|
|
|
#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
|
|
|
|
|
|
|
|
struct prom_pmemblock mdesc[PROM_MAX_PMEMBLOCKS];
|
|
|
|
|
|
|
|
struct prom_pmemblock * __init prom_getmdesc(void)
|
|
|
|
{
|
|
|
|
unsigned int memsize;
|
|
|
|
char cmdline[CL_SIZE], *ptr;
|
|
|
|
|
2007-06-14 14:59:31 +03:00
|
|
|
memsize = adm5120_memsize;
|
2007-03-19 19:34:37 +02:00
|
|
|
/* Check the command line for a memsize directive that overrides
|
|
|
|
* the physical/default amount */
|
|
|
|
strcpy(cmdline, arcs_cmdline);
|
|
|
|
ptr = strstr(cmdline, "memsize=");
|
|
|
|
if (ptr && (ptr != cmdline) && (*(ptr - 1) != ' '))
|
|
|
|
ptr = strstr(ptr, " memsize=");
|
2007-03-30 01:18:50 +03:00
|
|
|
|
2007-03-19 19:34:37 +02:00
|
|
|
if (ptr)
|
|
|
|
memsize = memparse(ptr + 8, &ptr);
|
2007-06-14 14:59:31 +03:00
|
|
|
|
|
|
|
memset(mdesc, 0, sizeof(mdesc));
|
|
|
|
mdesc[0].type = BOOT_MEM_RAM;
|
|
|
|
mdesc[0].base = CPHYSADDR(PFN_ALIGN(&_end));
|
|
|
|
mdesc[0].size = memsize - mdesc[0].base;
|
2007-03-19 19:34:37 +02:00
|
|
|
|
2007-06-14 14:59:31 +03:00
|
|
|
return &mdesc[0];
|
2007-03-19 19:34:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void __init prom_meminit(void)
|
|
|
|
{
|
|
|
|
struct prom_pmemblock *p;
|
|
|
|
|
|
|
|
p = prom_getmdesc();
|
|
|
|
|
|
|
|
while (p->size)
|
|
|
|
{
|
|
|
|
long type;
|
|
|
|
unsigned long base, size;
|
|
|
|
base = p->base;
|
|
|
|
type = p->type,
|
|
|
|
size = p->size;
|
|
|
|
add_memory_region(base, size, type);
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-05-29 16:44:46 +03:00
|
|
|
void __init prom_free_prom_memory(void)
|
2007-03-19 19:34:37 +02:00
|
|
|
{
|
2007-03-20 11:23:43 +02:00
|
|
|
/* We do not have to prom memory to free */
|
2007-03-19 19:34:37 +02:00
|
|
|
}
|