1315806cbSRalf Baechle /* 249bffbdcSSteven J. Hill * This file is subject to the terms and conditions of the GNU General Public 349bffbdcSSteven J. Hill * License. See the file "COPYING" in the main directory of this archive 4315806cbSRalf Baechle * for more details. 5315806cbSRalf Baechle * 6315806cbSRalf Baechle * PROM library functions for acquiring/using memory descriptors given to 7315806cbSRalf Baechle * us from the YAMON. 849bffbdcSSteven J. Hill * 949bffbdcSSteven J. Hill * Copyright (C) 1999,2000,2012 MIPS Technologies, Inc. 1049bffbdcSSteven J. Hill * All rights reserved. 1149bffbdcSSteven J. Hill * Authors: Carsten Langgaard <carstenl@mips.com> 1249bffbdcSSteven J. Hill * Steven J. Hill <sjhill@mips.com> 13315806cbSRalf Baechle */ 14315806cbSRalf Baechle #include <linux/init.h> 15315806cbSRalf Baechle #include <linux/bootmem.h> 16315806cbSRalf Baechle #include <linux/string.h> 17315806cbSRalf Baechle 18315806cbSRalf Baechle #include <asm/bootinfo.h> 19296b7c68SJames Hogan #include <asm/cdmm.h> 203a551e25SPaul Burton #include <asm/maar.h> 21315806cbSRalf Baechle #include <asm/sections.h> 22b431f09dSSteven J. Hill #include <asm/fw/fw.h> 23315806cbSRalf Baechle 24315806cbSRalf Baechle /* determined physical memory size, not overridden by command line args */ 25315806cbSRalf Baechle unsigned long physical_memsize = 0L; 26315806cbSRalf Baechle 27ea050714SPaul Burton static void free_init_pages_eva_malta(void *begin, void *end) 28ea050714SPaul Burton { 29ea050714SPaul Burton free_init_pages("unused kernel", __pa_symbol((unsigned long *)begin), 30ea050714SPaul Burton __pa_symbol((unsigned long *)end)); 31ea050714SPaul Burton } 32ea050714SPaul Burton 33ea050714SPaul Burton void __init fw_meminit(void) 34315806cbSRalf Baechle { 3597f2645fSMasahiro Yamada bool eva = IS_ENABLED(CONFIG_EVA); 36315806cbSRalf Baechle 37ea050714SPaul Burton free_init_pages_eva = eva ? free_init_pages_eva_malta : NULL; 38315806cbSRalf Baechle } 39315806cbSRalf Baechle 40315806cbSRalf Baechle void __init prom_free_prom_memory(void) 41315806cbSRalf Baechle { 42315806cbSRalf Baechle unsigned long addr; 43315806cbSRalf Baechle int i; 44315806cbSRalf Baechle 45315806cbSRalf Baechle for (i = 0; i < boot_mem_map.nr_map; i++) { 46315806cbSRalf Baechle if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA) 47315806cbSRalf Baechle continue; 48315806cbSRalf Baechle 49315806cbSRalf Baechle addr = boot_mem_map.map[i].addr; 5049bffbdcSSteven J. Hill free_init_pages("YAMON memory", 51315806cbSRalf Baechle addr, addr + boot_mem_map.map[i].size); 52315806cbSRalf Baechle } 53315806cbSRalf Baechle } 543a551e25SPaul Burton 55296b7c68SJames Hogan phys_addr_t mips_cdmm_phys_base(void) 56296b7c68SJames Hogan { 57296b7c68SJames Hogan /* This address is "typically unused" */ 58296b7c68SJames Hogan return 0x1fc10000; 59296b7c68SJames Hogan } 60