Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
49bffbdc SH |
2 | * 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. | |
1da177e4 LT |
5 | * |
6 | * PROM library functions for acquiring/using memory descriptors given to | |
7 | * us from the YAMON. | |
49bffbdc SH |
8 | * |
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> | |
1da177e4 | 13 | */ |
1da177e4 | 14 | #include <linux/init.h> |
1da177e4 | 15 | #include <linux/bootmem.h> |
e01402b1 | 16 | #include <linux/string.h> |
1da177e4 LT |
17 | |
18 | #include <asm/bootinfo.h> | |
296b7c68 | 19 | #include <asm/cdmm.h> |
3a551e25 | 20 | #include <asm/maar.h> |
9c1f1257 | 21 | #include <asm/sections.h> |
b431f09d | 22 | #include <asm/fw/fw.h> |
1da177e4 | 23 | |
70342287 | 24 | /* determined physical memory size, not overridden by command line args */ |
e1a4e469 RB |
25 | unsigned long physical_memsize = 0L; |
26 | ||
ea050714 PB |
27 | static 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 | ||
33 | void __init fw_meminit(void) | |
1da177e4 | 34 | { |
97f2645f | 35 | bool eva = IS_ENABLED(CONFIG_EVA); |
1da177e4 | 36 | |
ea050714 | 37 | free_init_pages_eva = eva ? free_init_pages_eva_malta : NULL; |
1da177e4 LT |
38 | } |
39 | ||
c44e8d5e | 40 | void __init prom_free_prom_memory(void) |
1da177e4 | 41 | { |
1da177e4 LT |
42 | 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 | ||
c44e8d5e | 49 | addr = boot_mem_map.map[i].addr; |
49bffbdc | 50 | free_init_pages("YAMON memory", |
c44e8d5e | 51 | addr, addr + boot_mem_map.map[i].size); |
1da177e4 | 52 | } |
1da177e4 | 53 | } |
3a551e25 | 54 | |
296b7c68 JH |
55 | phys_addr_t mips_cdmm_phys_base(void) |
56 | { | |
57 | /* This address is "typically unused" */ | |
58 | return 0x1fc10000; | |
59 | } |