diff options
Diffstat (limited to 'arch/powerpc/kernel/prom_init.c')
-rw-r--r-- | arch/powerpc/kernel/prom_init.c | 120 |
1 files changed, 10 insertions, 110 deletions
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index f70bd090dacd..8c28eb0cbdac 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -194,19 +194,12 @@ static int __initdata of_platform; | |||
194 | 194 | ||
195 | static char __initdata prom_cmd_line[COMMAND_LINE_SIZE]; | 195 | static char __initdata prom_cmd_line[COMMAND_LINE_SIZE]; |
196 | 196 | ||
197 | static unsigned long __initdata prom_memory_limit; | ||
198 | |||
199 | static unsigned long __initdata alloc_top; | 197 | static unsigned long __initdata alloc_top; |
200 | static unsigned long __initdata alloc_top_high; | 198 | static unsigned long __initdata alloc_top_high; |
201 | static unsigned long __initdata alloc_bottom; | 199 | static unsigned long __initdata alloc_bottom; |
202 | static unsigned long __initdata rmo_top; | 200 | static unsigned long __initdata rmo_top; |
203 | static unsigned long __initdata ram_top; | 201 | static unsigned long __initdata ram_top; |
204 | 202 | ||
205 | #ifdef CONFIG_KEXEC | ||
206 | static unsigned long __initdata prom_crashk_base; | ||
207 | static unsigned long __initdata prom_crashk_size; | ||
208 | #endif | ||
209 | |||
210 | static struct mem_map_entry __initdata mem_reserve_map[MEM_RESERVE_MAP_SIZE]; | 203 | static struct mem_map_entry __initdata mem_reserve_map[MEM_RESERVE_MAP_SIZE]; |
211 | static int __initdata mem_reserve_cnt; | 204 | static int __initdata mem_reserve_cnt; |
212 | 205 | ||
@@ -574,7 +567,7 @@ static void __init early_cmdline_parse(void) | |||
574 | if ((long)_prom->chosen > 0) | 567 | if ((long)_prom->chosen > 0) |
575 | l = prom_getprop(_prom->chosen, "bootargs", p, COMMAND_LINE_SIZE-1); | 568 | l = prom_getprop(_prom->chosen, "bootargs", p, COMMAND_LINE_SIZE-1); |
576 | #ifdef CONFIG_CMDLINE | 569 | #ifdef CONFIG_CMDLINE |
577 | if (l == 0) /* dbl check */ | 570 | if (l <= 0 || p[0] == '\0') /* dbl check */ |
578 | strlcpy(RELOC(prom_cmd_line), | 571 | strlcpy(RELOC(prom_cmd_line), |
579 | RELOC(CONFIG_CMDLINE), sizeof(prom_cmd_line)); | 572 | RELOC(CONFIG_CMDLINE), sizeof(prom_cmd_line)); |
580 | #endif /* CONFIG_CMDLINE */ | 573 | #endif /* CONFIG_CMDLINE */ |
@@ -593,45 +586,6 @@ static void __init early_cmdline_parse(void) | |||
593 | RELOC(iommu_force_on) = 1; | 586 | RELOC(iommu_force_on) = 1; |
594 | } | 587 | } |
595 | #endif | 588 | #endif |
596 | |||
597 | opt = strstr(RELOC(prom_cmd_line), RELOC("mem=")); | ||
598 | if (opt) { | ||
599 | opt += 4; | ||
600 | RELOC(prom_memory_limit) = prom_memparse(opt, (const char **)&opt); | ||
601 | #ifdef CONFIG_PPC64 | ||
602 | /* Align to 16 MB == size of ppc64 large page */ | ||
603 | RELOC(prom_memory_limit) = ALIGN(RELOC(prom_memory_limit), 0x1000000); | ||
604 | #endif | ||
605 | } | ||
606 | |||
607 | #ifdef CONFIG_KEXEC | ||
608 | /* | ||
609 | * crashkernel=size@addr specifies the location to reserve for | ||
610 | * crash kernel. | ||
611 | */ | ||
612 | opt = strstr(RELOC(prom_cmd_line), RELOC("crashkernel=")); | ||
613 | if (opt) { | ||
614 | opt += 12; | ||
615 | RELOC(prom_crashk_size) = | ||
616 | prom_memparse(opt, (const char **)&opt); | ||
617 | |||
618 | if (ALIGN(RELOC(prom_crashk_size), 0x1000000) != | ||
619 | RELOC(prom_crashk_size)) { | ||
620 | prom_printf("Warning: crashkernel size is not " | ||
621 | "aligned to 16MB\n"); | ||
622 | } | ||
623 | |||
624 | /* | ||
625 | * At present, the crash kernel always run at 32MB. | ||
626 | * Just ignore whatever user passed. | ||
627 | */ | ||
628 | RELOC(prom_crashk_base) = 0x2000000; | ||
629 | if (*opt == '@') { | ||
630 | prom_printf("Warning: PPC64 kdump kernel always runs " | ||
631 | "at 32 MB\n"); | ||
632 | } | ||
633 | } | ||
634 | #endif | ||
635 | } | 589 | } |
636 | 590 | ||
637 | #ifdef CONFIG_PPC_PSERIES | 591 | #ifdef CONFIG_PPC_PSERIES |
@@ -1116,29 +1070,6 @@ static void __init prom_init_mem(void) | |||
1116 | } | 1070 | } |
1117 | 1071 | ||
1118 | /* | 1072 | /* |
1119 | * If prom_memory_limit is set we reduce the upper limits *except* for | ||
1120 | * alloc_top_high. This must be the real top of RAM so we can put | ||
1121 | * TCE's up there. | ||
1122 | */ | ||
1123 | |||
1124 | RELOC(alloc_top_high) = RELOC(ram_top); | ||
1125 | |||
1126 | if (RELOC(prom_memory_limit)) { | ||
1127 | if (RELOC(prom_memory_limit) <= RELOC(alloc_bottom)) { | ||
1128 | prom_printf("Ignoring mem=%x <= alloc_bottom.\n", | ||
1129 | RELOC(prom_memory_limit)); | ||
1130 | RELOC(prom_memory_limit) = 0; | ||
1131 | } else if (RELOC(prom_memory_limit) >= RELOC(ram_top)) { | ||
1132 | prom_printf("Ignoring mem=%x >= ram_top.\n", | ||
1133 | RELOC(prom_memory_limit)); | ||
1134 | RELOC(prom_memory_limit) = 0; | ||
1135 | } else { | ||
1136 | RELOC(ram_top) = RELOC(prom_memory_limit); | ||
1137 | RELOC(rmo_top) = min(RELOC(rmo_top), RELOC(prom_memory_limit)); | ||
1138 | } | ||
1139 | } | ||
1140 | |||
1141 | /* | ||
1142 | * Setup our top alloc point, that is top of RMO or top of | 1073 | * Setup our top alloc point, that is top of RMO or top of |
1143 | * segment 0 when running non-LPAR. | 1074 | * segment 0 when running non-LPAR. |
1144 | * Some RS64 machines have buggy firmware where claims up at | 1075 | * Some RS64 machines have buggy firmware where claims up at |
@@ -1150,20 +1081,14 @@ static void __init prom_init_mem(void) | |||
1150 | RELOC(rmo_top) = RELOC(ram_top); | 1081 | RELOC(rmo_top) = RELOC(ram_top); |
1151 | RELOC(rmo_top) = min(0x30000000ul, RELOC(rmo_top)); | 1082 | RELOC(rmo_top) = min(0x30000000ul, RELOC(rmo_top)); |
1152 | RELOC(alloc_top) = RELOC(rmo_top); | 1083 | RELOC(alloc_top) = RELOC(rmo_top); |
1084 | RELOC(alloc_top_high) = RELOC(ram_top); | ||
1153 | 1085 | ||
1154 | prom_printf("memory layout at init:\n"); | 1086 | prom_printf("memory layout at init:\n"); |
1155 | prom_printf(" memory_limit : %x (16 MB aligned)\n", RELOC(prom_memory_limit)); | ||
1156 | prom_printf(" alloc_bottom : %x\n", RELOC(alloc_bottom)); | 1087 | prom_printf(" alloc_bottom : %x\n", RELOC(alloc_bottom)); |
1157 | prom_printf(" alloc_top : %x\n", RELOC(alloc_top)); | 1088 | prom_printf(" alloc_top : %x\n", RELOC(alloc_top)); |
1158 | prom_printf(" alloc_top_hi : %x\n", RELOC(alloc_top_high)); | 1089 | prom_printf(" alloc_top_hi : %x\n", RELOC(alloc_top_high)); |
1159 | prom_printf(" rmo_top : %x\n", RELOC(rmo_top)); | 1090 | prom_printf(" rmo_top : %x\n", RELOC(rmo_top)); |
1160 | prom_printf(" ram_top : %x\n", RELOC(ram_top)); | 1091 | prom_printf(" ram_top : %x\n", RELOC(ram_top)); |
1161 | #ifdef CONFIG_KEXEC | ||
1162 | if (RELOC(prom_crashk_base)) { | ||
1163 | prom_printf(" crashk_base : %x\n", RELOC(prom_crashk_base)); | ||
1164 | prom_printf(" crashk_size : %x\n", RELOC(prom_crashk_size)); | ||
1165 | } | ||
1166 | #endif | ||
1167 | } | 1092 | } |
1168 | 1093 | ||
1169 | 1094 | ||
@@ -1349,16 +1274,10 @@ static void __init prom_initialize_tce_table(void) | |||
1349 | 1274 | ||
1350 | reserve_mem(local_alloc_bottom, local_alloc_top - local_alloc_bottom); | 1275 | reserve_mem(local_alloc_bottom, local_alloc_top - local_alloc_bottom); |
1351 | 1276 | ||
1352 | if (RELOC(prom_memory_limit)) { | 1277 | /* These are only really needed if there is a memory limit in |
1353 | /* | 1278 | * effect, but we don't know so export them always. */ |
1354 | * We align the start to a 16MB boundary so we can map | 1279 | RELOC(prom_tce_alloc_start) = local_alloc_bottom; |
1355 | * the TCE area using large pages if possible. | 1280 | RELOC(prom_tce_alloc_end) = local_alloc_top; |
1356 | * The end should be the top of RAM so no need to align it. | ||
1357 | */ | ||
1358 | RELOC(prom_tce_alloc_start) = _ALIGN_DOWN(local_alloc_bottom, | ||
1359 | 0x1000000); | ||
1360 | RELOC(prom_tce_alloc_end) = local_alloc_top; | ||
1361 | } | ||
1362 | 1281 | ||
1363 | /* Flag the first invalid entry */ | 1282 | /* Flag the first invalid entry */ |
1364 | prom_debug("ending prom_initialize_tce_table\n"); | 1283 | prom_debug("ending prom_initialize_tce_table\n"); |
@@ -2041,11 +1960,7 @@ static void __init flatten_device_tree(void) | |||
2041 | /* Version 16 is not backward compatible */ | 1960 | /* Version 16 is not backward compatible */ |
2042 | hdr->last_comp_version = 0x10; | 1961 | hdr->last_comp_version = 0x10; |
2043 | 1962 | ||
2044 | /* Reserve the whole thing and copy the reserve map in, we | 1963 | /* Copy the reserve map in */ |
2045 | * also bump mem_reserve_cnt to cause further reservations to | ||
2046 | * fail since it's too late. | ||
2047 | */ | ||
2048 | reserve_mem(RELOC(dt_header_start), hdr->totalsize); | ||
2049 | memcpy(rsvmap, RELOC(mem_reserve_map), sizeof(mem_reserve_map)); | 1964 | memcpy(rsvmap, RELOC(mem_reserve_map), sizeof(mem_reserve_map)); |
2050 | 1965 | ||
2051 | #ifdef DEBUG_PROM | 1966 | #ifdef DEBUG_PROM |
@@ -2058,6 +1973,9 @@ static void __init flatten_device_tree(void) | |||
2058 | RELOC(mem_reserve_map)[i].size); | 1973 | RELOC(mem_reserve_map)[i].size); |
2059 | } | 1974 | } |
2060 | #endif | 1975 | #endif |
1976 | /* Bump mem_reserve_cnt to cause further reservations to fail | ||
1977 | * since it's too late. | ||
1978 | */ | ||
2061 | RELOC(mem_reserve_cnt) = MEM_RESERVE_MAP_SIZE; | 1979 | RELOC(mem_reserve_cnt) = MEM_RESERVE_MAP_SIZE; |
2062 | 1980 | ||
2063 | prom_printf("Device tree strings 0x%x -> 0x%x\n", | 1981 | prom_printf("Device tree strings 0x%x -> 0x%x\n", |
@@ -2280,10 +2198,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, | |||
2280 | */ | 2198 | */ |
2281 | prom_init_mem(); | 2199 | prom_init_mem(); |
2282 | 2200 | ||
2283 | #ifdef CONFIG_KEXEC | ||
2284 | if (RELOC(prom_crashk_base)) | ||
2285 | reserve_mem(RELOC(prom_crashk_base), RELOC(prom_crashk_size)); | ||
2286 | #endif | ||
2287 | /* | 2201 | /* |
2288 | * Determine which cpu is actually running right _now_ | 2202 | * Determine which cpu is actually running right _now_ |
2289 | */ | 2203 | */ |
@@ -2317,10 +2231,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, | |||
2317 | /* | 2231 | /* |
2318 | * Fill in some infos for use by the kernel later on | 2232 | * Fill in some infos for use by the kernel later on |
2319 | */ | 2233 | */ |
2320 | if (RELOC(prom_memory_limit)) | ||
2321 | prom_setprop(_prom->chosen, "/chosen", "linux,memory-limit", | ||
2322 | &RELOC(prom_memory_limit), | ||
2323 | sizeof(prom_memory_limit)); | ||
2324 | #ifdef CONFIG_PPC64 | 2234 | #ifdef CONFIG_PPC64 |
2325 | if (RELOC(ppc64_iommu_off)) | 2235 | if (RELOC(ppc64_iommu_off)) |
2326 | prom_setprop(_prom->chosen, "/chosen", "linux,iommu-off", | 2236 | prom_setprop(_prom->chosen, "/chosen", "linux,iommu-off", |
@@ -2340,16 +2250,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, | |||
2340 | } | 2250 | } |
2341 | #endif | 2251 | #endif |
2342 | 2252 | ||
2343 | #ifdef CONFIG_KEXEC | ||
2344 | if (RELOC(prom_crashk_base)) { | ||
2345 | prom_setprop(_prom->chosen, "/chosen", "linux,crashkernel-base", | ||
2346 | PTRRELOC(&prom_crashk_base), | ||
2347 | sizeof(RELOC(prom_crashk_base))); | ||
2348 | prom_setprop(_prom->chosen, "/chosen", "linux,crashkernel-size", | ||
2349 | PTRRELOC(&prom_crashk_size), | ||
2350 | sizeof(RELOC(prom_crashk_size))); | ||
2351 | } | ||
2352 | #endif | ||
2353 | /* | 2253 | /* |
2354 | * Fixup any known bugs in the device-tree | 2254 | * Fixup any known bugs in the device-tree |
2355 | */ | 2255 | */ |