aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/kernel/machine_kexec.c34
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c24
2 files changed, 39 insertions, 19 deletions
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index ac2a21f45c75..037ade74a99e 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -13,8 +13,10 @@
13#include <linux/reboot.h> 13#include <linux/reboot.h>
14#include <linux/threads.h> 14#include <linux/threads.h>
15#include <linux/lmb.h> 15#include <linux/lmb.h>
16#include <linux/of.h>
16#include <asm/machdep.h> 17#include <asm/machdep.h>
17#include <asm/prom.h> 18#include <asm/prom.h>
19#include <asm/sections.h>
18 20
19void machine_crash_shutdown(struct pt_regs *regs) 21void machine_crash_shutdown(struct pt_regs *regs)
20{ 22{
@@ -118,3 +120,35 @@ int overlaps_crashkernel(unsigned long start, unsigned long size)
118{ 120{
119 return (start + size) > crashk_res.start && start <= crashk_res.end; 121 return (start + size) > crashk_res.start && start <= crashk_res.end;
120} 122}
123
124/* Values we need to export to the second kernel via the device tree. */
125static unsigned long kernel_end;
126
127static struct property kernel_end_prop = {
128 .name = "linux,kernel-end",
129 .length = sizeof(unsigned long),
130 .value = &kernel_end,
131};
132
133static int __init kexec_setup(void)
134{
135 struct device_node *node;
136 struct property *prop;
137
138 node = of_find_node_by_path("/chosen");
139 if (!node)
140 return -ENOENT;
141
142 /* remove any stale properties so ours can be found */
143 prop = of_find_property(node, kernel_end_prop.name, NULL);
144 if (prop)
145 prom_remove_property(node, prop);
146
147 /* information needed by userspace when using default_machine_kexec */
148 kernel_end = __pa(_end);
149 prom_add_property(node, &kernel_end_prop);
150
151 of_node_put(node);
152 return 0;
153}
154late_initcall(kexec_setup);
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index 3c4ca046e854..a89bce834a51 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -289,7 +289,7 @@ void default_machine_kexec(struct kimage *image)
289} 289}
290 290
291/* Values we need to export to the second kernel via the device tree. */ 291/* Values we need to export to the second kernel via the device tree. */
292static unsigned long htab_base, kernel_end; 292static unsigned long htab_base;
293 293
294static struct property htab_base_prop = { 294static struct property htab_base_prop = {
295 .name = "linux,htab-base", 295 .name = "linux,htab-base",
@@ -303,25 +303,20 @@ static struct property htab_size_prop = {
303 .value = &htab_size_bytes, 303 .value = &htab_size_bytes,
304}; 304};
305 305
306static struct property kernel_end_prop = {
307 .name = "linux,kernel-end",
308 .length = sizeof(unsigned long),
309 .value = &kernel_end,
310};
311
312static void __init export_htab_values(void) 306static void __init export_htab_values(void)
313{ 307{
314 struct device_node *node; 308 struct device_node *node;
315 struct property *prop; 309 struct property *prop;
316 310
311 /* On machines with no htab htab_address is NULL */
312 if (!htab_address)
313 return;
314
317 node = of_find_node_by_path("/chosen"); 315 node = of_find_node_by_path("/chosen");
318 if (!node) 316 if (!node)
319 return; 317 return;
320 318
321 /* remove any stale propertys so ours can be found */ 319 /* remove any stale propertys so ours can be found */
322 prop = of_find_property(node, kernel_end_prop.name, NULL);
323 if (prop)
324 prom_remove_property(node, prop);
325 prop = of_find_property(node, htab_base_prop.name, NULL); 320 prop = of_find_property(node, htab_base_prop.name, NULL);
326 if (prop) 321 if (prop)
327 prom_remove_property(node, prop); 322 prom_remove_property(node, prop);
@@ -329,19 +324,10 @@ static void __init export_htab_values(void)
329 if (prop) 324 if (prop)
330 prom_remove_property(node, prop); 325 prom_remove_property(node, prop);
331 326
332 /* information needed by userspace when using default_machine_kexec */
333 kernel_end = __pa(_end);
334 prom_add_property(node, &kernel_end_prop);
335
336 /* On machines with no htab htab_address is NULL */
337 if (NULL == htab_address)
338 goto out;
339
340 htab_base = __pa(htab_address); 327 htab_base = __pa(htab_address);
341 prom_add_property(node, &htab_base_prop); 328 prom_add_property(node, &htab_base_prop);
342 prom_add_property(node, &htab_size_prop); 329 prom_add_property(node, &htab_size_prop);
343 330
344 out:
345 of_node_put(node); 331 of_node_put(node);
346} 332}
347 333