26 #include <linux/string.h>
28 #include <asm/bootinfo.h>
30 #include <asm/sections.h>
39 #define KIBIBYTE(n) ((n) * 1024)
40 #define MEBIBYTE(n) ((n) * KIBIBYTE(1024))
41 #define DEFAULT_MEMSIZE MEBIBYTE(128)
43 #define BLDR_SIZE KIBIBYTE(256)
44 #define RV_SIZE MEBIBYTE(4)
46 #define LOW_MEM_END 0x20000000
47 #define BLDR_ALIAS 0x10000000
48 #define RV_PHYS 0x1fc00000
49 #define LOW_RAM_END RV_PHYS
55 #define PHYS_TO_DMA(paddr) ((paddr) + (CONFIG_LOW_RAM_DMA - LOW_RAM_ALIAS))
110 {0x20000000, 0x10000000,
MEBIBYTE(256)},
114 {0x40000000, 0x10000000,
MEBIBYTE(256)},
115 {0x20000000, 0x20000000,
MEBIBYTE(32)},
119 {0x40000000, 0x10000000,
MEBIBYTE(256)},
120 {0x20000000, 0x20000000,
MEBIBYTE(32)},
121 {0x30000000, 0x30000000,
MEBIBYTE(32)},
125 {0x20000000, 0x10000000,
MEBIBYTE(256)},
126 {0x60000000, 0x60000000,
MEBIBYTE(128)},
144 {0x20000000, 0x10000000,
MEBIBYTE(128)},
150 static __init void register_non_ram(
void)
154 for (i = 0; i <
ARRAY_SIZE(low_mem_reserved); i++)
172 if (ptr && (ptr !=
cmdline) && (*(ptr - 1) !=
' '))
173 ptr =
strstr(ptr,
" memsize=");
181 if (memsize_str !=
NULL) {
182 pr_info(
"prom memsize = %s\n", memsize_str);
189 pr_info(
"_prom_memsize = 0x%x\n", memsize);
195 pr_info(
"Memsize not passed by bootloader, "
196 "defaulting to 0x%x\n", memsize);
222 for (i = 0; n != 0 && i <
ARRAY_SIZE(low_mem_reserved); i++) {
226 start = low_mem_reserved[
i].
start;
227 size = low_mem_reserved[
i].
size;
232 s =
min(n, start - p);
243 if (low_mem_reserved[i].is_aliased) {
274 registered = register_low_ram(alias, alias_size);
280 #ifdef CONFIG_HIGHMEM
315 for (i = 0; i <
ARRAY_SIZE(layout_list); i++) {
316 if (layout_list[i].family == family)
322 layout = default_layout;
324 n = layout_list[
i].
n;
325 layout = layout_list[
i].
layout;
328 for (i = 0; memsize != 0 && i <
n; i++) {
329 size =
min(memsize, layout[i].size);
330 register_ram(layout[i].
phys, layout[i].alias, size);