2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2013-03-26 04:05:40 +08:00
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
|
|
* for more details.
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* PROM library functions for acquiring/using memory descriptors given to
|
|
|
|
* us from the YAMON.
|
2013-03-26 04:05:40 +08:00
|
|
|
*
|
|
|
|
* Copyright (C) 1999,2000,2012 MIPS Technologies, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
* Authors: Carsten Langgaard <carstenl@mips.com>
|
|
|
|
* Steven J. Hill <sjhill@mips.com>
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/bootmem.h>
|
2005-07-14 23:57:16 +08:00
|
|
|
#include <linux/string.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include <asm/bootinfo.h>
|
2015-02-02 19:45:10 +08:00
|
|
|
#include <asm/cdmm.h>
|
2014-07-14 19:37:39 +08:00
|
|
|
#include <asm/maar.h>
|
2006-04-03 17:17:21 +08:00
|
|
|
#include <asm/sections.h>
|
2013-03-26 03:47:05 +08:00
|
|
|
#include <asm/fw/fw.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2013-01-22 19:59:30 +08:00
|
|
|
/* determined physical memory size, not overridden by command line args */
|
2006-07-04 00:02:35 +08:00
|
|
|
unsigned long physical_memsize = 0L;
|
|
|
|
|
2015-09-23 02:56:37 +08:00
|
|
|
static void free_init_pages_eva_malta(void *begin, void *end)
|
|
|
|
{
|
|
|
|
free_init_pages("unused kernel", __pa_symbol((unsigned long *)begin),
|
|
|
|
__pa_symbol((unsigned long *)end));
|
|
|
|
}
|
|
|
|
|
|
|
|
void __init fw_meminit(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2016-08-04 04:45:50 +08:00
|
|
|
bool eva = IS_ENABLED(CONFIG_EVA);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2015-09-23 02:56:37 +08:00
|
|
|
free_init_pages_eva = eva ? free_init_pages_eva_malta : NULL;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2006-12-29 23:43:59 +08:00
|
|
|
void __init prom_free_prom_memory(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
unsigned long addr;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < boot_mem_map.nr_map; i++) {
|
|
|
|
if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
|
|
|
|
continue;
|
|
|
|
|
2006-12-29 23:43:59 +08:00
|
|
|
addr = boot_mem_map.map[i].addr;
|
2013-03-26 04:05:40 +08:00
|
|
|
free_init_pages("YAMON memory",
|
2006-12-29 23:43:59 +08:00
|
|
|
addr, addr + boot_mem_map.map[i].size);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
2014-07-14 19:37:39 +08:00
|
|
|
|
2015-02-02 19:45:10 +08:00
|
|
|
phys_addr_t mips_cdmm_phys_base(void)
|
|
|
|
{
|
|
|
|
/* This address is "typically unused" */
|
|
|
|
return 0x1fc10000;
|
|
|
|
}
|