diff options
author | Dale Farnsworth <dale@farnsworth.org> | 2008-12-16 01:22:59 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-12-22 23:13:28 -0500 |
commit | 2e8e4f5b80e101da588af650de0ff6b3c475d6b3 (patch) | |
tree | 5097f654aec290e9835e882e2c2aff1e27d0c980 /arch | |
parent | b906cfa397fdef8decbd36467b1f63c830a0bf2b (diff) |
powerpc: Setup OF properties for ppc32 kexec
Refactor the setting of kexec OF properties, moving the common code
from machine_kexec_64.c to machine_kexec.c where it can be used on
both ppc64 and ppc32. This is needed for kexec to work on ppc32
platforms.
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/kernel/machine_kexec.c | 34 | ||||
-rw-r--r-- | arch/powerpc/kernel/machine_kexec_64.c | 24 |
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 | ||
19 | void machine_crash_shutdown(struct pt_regs *regs) | 21 | void 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. */ | ||
125 | static unsigned long kernel_end; | ||
126 | |||
127 | static struct property kernel_end_prop = { | ||
128 | .name = "linux,kernel-end", | ||
129 | .length = sizeof(unsigned long), | ||
130 | .value = &kernel_end, | ||
131 | }; | ||
132 | |||
133 | static 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 | } | ||
154 | late_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. */ |
292 | static unsigned long htab_base, kernel_end; | 292 | static unsigned long htab_base; |
293 | 293 | ||
294 | static struct property htab_base_prop = { | 294 | static 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 | ||
306 | static struct property kernel_end_prop = { | ||
307 | .name = "linux,kernel-end", | ||
308 | .length = sizeof(unsigned long), | ||
309 | .value = &kernel_end, | ||
310 | }; | ||
311 | |||
312 | static void __init export_htab_values(void) | 306 | static 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 | ||