Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Steven J. Hill | 49bffbd | 2013-03-25 15:05:40 -0500 | [diff] [blame] | 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. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * |
| 6 | * PROM library functions for acquiring/using memory descriptors given to |
| 7 | * us from the YAMON. |
Steven J. Hill | 49bffbd | 2013-03-25 15:05:40 -0500 | [diff] [blame] | 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> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #include <linux/init.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | #include <linux/bootmem.h> |
Ralf Baechle | e01402b | 2005-07-14 15:57:16 +0000 | [diff] [blame] | 16 | #include <linux/string.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | |
| 18 | #include <asm/bootinfo.h> |
James Hogan | 296b7c6 | 2015-02-02 11:45:10 +0000 | [diff] [blame] | 19 | #include <asm/cdmm.h> |
Paul Burton | 3a551e2 | 2014-07-14 12:37:39 +0100 | [diff] [blame] | 20 | #include <asm/maar.h> |
Ralf Baechle | 9c1f125 | 2006-04-03 10:17:21 +0100 | [diff] [blame] | 21 | #include <asm/sections.h> |
Steven J. Hill | b431f09 | 2013-03-25 14:47:05 -0500 | [diff] [blame] | 22 | #include <asm/fw/fw.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | |
Ralf Baechle | 7034228 | 2013-01-22 12:59:30 +0100 | [diff] [blame] | 24 | /* determined physical memory size, not overridden by command line args */ |
Ralf Baechle | e1a4e46 | 2006-07-03 17:02:35 +0100 | [diff] [blame] | 25 | unsigned long physical_memsize = 0L; |
| 26 | |
Paul Burton | ea05071 | 2015-09-22 11:56:37 -0700 | [diff] [blame] | 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) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | { |
Masahiro Yamada | 97f2645 | 2016-08-03 13:45:50 -0700 | [diff] [blame] | 35 | bool eva = IS_ENABLED(CONFIG_EVA); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | |
Paul Burton | ea05071 | 2015-09-22 11:56:37 -0700 | [diff] [blame] | 37 | free_init_pages_eva = eva ? free_init_pages_eva_malta : NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | } |
| 39 | |
Atsushi Nemoto | c44e8d5 | 2006-12-30 00:43:59 +0900 | [diff] [blame] | 40 | void __init prom_free_prom_memory(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Atsushi Nemoto | c44e8d5 | 2006-12-30 00:43:59 +0900 | [diff] [blame] | 49 | addr = boot_mem_map.map[i].addr; |
Steven J. Hill | 49bffbd | 2013-03-25 15:05:40 -0500 | [diff] [blame] | 50 | free_init_pages("YAMON memory", |
Atsushi Nemoto | c44e8d5 | 2006-12-30 00:43:59 +0900 | [diff] [blame] | 51 | addr, addr + boot_mem_map.map[i].size); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | } |
Paul Burton | 3a551e2 | 2014-07-14 12:37:39 +0100 | [diff] [blame] | 54 | |
James Hogan | 296b7c6 | 2015-02-02 11:45:10 +0000 | [diff] [blame] | 55 | phys_addr_t mips_cdmm_phys_base(void) |
| 56 | { |
| 57 | /* This address is "typically unused" */ |
| 58 | return 0x1fc10000; |
| 59 | } |