blob: d5f8dae6a7978a5b7e3c62c4c70bef756941a061 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Steven J. Hill49bffbd2013-03-25 15:05:40 -05002 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 *
6 * PROM library functions for acquiring/using memory descriptors given to
7 * us from the YAMON.
Steven J. Hill49bffbd2013-03-25 15:05:40 -05008 *
9 * Copyright (C) 1999,2000,2012 MIPS Technologies, Inc.
10 * All rights reserved.
11 * Authors: Carsten Langgaard <carstenl@mips.com>
12 * Steven J. Hill <sjhill@mips.com>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#include <linux/init.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#include <linux/bootmem.h>
Ralf Baechlee01402b2005-07-14 15:57:16 +000016#include <linux/string.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017
18#include <asm/bootinfo.h>
James Hogan296b7c62015-02-02 11:45:10 +000019#include <asm/cdmm.h>
Paul Burton3a551e22014-07-14 12:37:39 +010020#include <asm/maar.h>
Ralf Baechle9c1f1252006-04-03 10:17:21 +010021#include <asm/sections.h>
Steven J. Hillb431f092013-03-25 14:47:05 -050022#include <asm/fw/fw.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
Ralf Baechle70342282013-01-22 12:59:30 +010024/* determined physical memory size, not overridden by command line args */
Ralf Baechlee1a4e462006-07-03 17:02:35 +010025unsigned long physical_memsize = 0L;
26
Paul Burtonea050712015-09-22 11:56:37 -070027static void free_init_pages_eva_malta(void *begin, void *end)
28{
29 free_init_pages("unused kernel", __pa_symbol((unsigned long *)begin),
30 __pa_symbol((unsigned long *)end));
31}
32
33void __init fw_meminit(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070034{
Paul Burtonea050712015-09-22 11:56:37 -070035 bool eva = config_enabled(CONFIG_EVA);
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
Paul Burtonea050712015-09-22 11:56:37 -070037 free_init_pages_eva = eva ? free_init_pages_eva_malta : NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -070038}
39
Atsushi Nemotoc44e8d52006-12-30 00:43:59 +090040void __init prom_free_prom_memory(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070041{
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 unsigned long addr;
43 int i;
44
45 for (i = 0; i < boot_mem_map.nr_map; i++) {
46 if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
47 continue;
48
Atsushi Nemotoc44e8d52006-12-30 00:43:59 +090049 addr = boot_mem_map.map[i].addr;
Steven J. Hill49bffbd2013-03-25 15:05:40 -050050 free_init_pages("YAMON memory",
Atsushi Nemotoc44e8d52006-12-30 00:43:59 +090051 addr, addr + boot_mem_map.map[i].size);
Linus Torvalds1da177e2005-04-16 15:20:36 -070052 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070053}
Paul Burton3a551e22014-07-14 12:37:39 +010054
James Hogan296b7c62015-02-02 11:45:10 +000055phys_addr_t mips_cdmm_phys_base(void)
56{
57 /* This address is "typically unused" */
58 return 0x1fc10000;
59}