diff options
author | David S. Miller <davem@davemloft.net> | 2008-12-05 21:16:48 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-05 21:16:48 -0500 |
commit | 23dc758e47aeb3cc2414c2ec69b7b3e95f447071 (patch) | |
tree | 70ba39d6f4ed24b67ef987b6fb528abcfbac28a7 /arch/sparc | |
parent | 6524036a1e5736a07466208362d83ddf31aae3ac (diff) |
sparc: Move prom_build_devicetree() into prom_common.c
To make this work we provide a dummy nop implementation
of of_fill_in_cpu_data() for sparc32.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/kernel/prom.h | 8 | ||||
-rw-r--r-- | arch/sparc/kernel/prom_32.c | 20 | ||||
-rw-r--r-- | arch/sparc/kernel/prom_64.c | 33 | ||||
-rw-r--r-- | arch/sparc/kernel/prom_common.c | 32 |
4 files changed, 39 insertions, 54 deletions
diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h index dea8b91b6960..0764b354b52c 100644 --- a/arch/sparc/kernel/prom.h +++ b/arch/sparc/kernel/prom.h | |||
@@ -24,11 +24,9 @@ static inline int is_root_node(const struct device_node *dp) | |||
24 | } | 24 | } |
25 | 25 | ||
26 | extern char *build_path_component(struct device_node *dp); | 26 | extern char *build_path_component(struct device_node *dp); |
27 | extern void of_console_init(void); | ||
28 | extern void of_fill_in_cpu_data(void); | ||
27 | 29 | ||
28 | extern struct device_node * __init prom_create_node(phandle node, | 30 | extern unsigned int prom_early_allocated; |
29 | struct device_node *parent); | ||
30 | 31 | ||
31 | extern struct device_node * __init prom_build_tree(struct device_node *parent, | ||
32 | phandle node, | ||
33 | struct device_node ***nextp); | ||
34 | #endif /* __PROM_H */ | 32 | #endif /* __PROM_H */ |
diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c index 75eb40be5e8a..5ad2012ae104 100644 --- a/arch/sparc/kernel/prom_32.c +++ b/arch/sparc/kernel/prom_32.c | |||
@@ -27,8 +27,6 @@ | |||
27 | 27 | ||
28 | #include "prom.h" | 28 | #include "prom.h" |
29 | 29 | ||
30 | static unsigned int prom_early_allocated; | ||
31 | |||
32 | void * __init prom_early_alloc(unsigned long size) | 30 | void * __init prom_early_alloc(unsigned long size) |
33 | { | 31 | { |
34 | void *ret; | 32 | void *ret; |
@@ -179,7 +177,7 @@ EXPORT_SYMBOL(of_console_options); | |||
179 | 177 | ||
180 | extern void restore_current(void); | 178 | extern void restore_current(void); |
181 | 179 | ||
182 | static void __init of_console_init(void) | 180 | void __init of_console_init(void) |
183 | { | 181 | { |
184 | char *msg = "OF stdout device is: %s\n"; | 182 | char *msg = "OF stdout device is: %s\n"; |
185 | struct device_node *dp; | 183 | struct device_node *dp; |
@@ -297,20 +295,6 @@ static void __init of_console_init(void) | |||
297 | printk(msg, of_console_path); | 295 | printk(msg, of_console_path); |
298 | } | 296 | } |
299 | 297 | ||
300 | void __init prom_build_devicetree(void) | 298 | void __init of_fill_in_cpu_data(void) |
301 | { | 299 | { |
302 | struct device_node **nextp; | ||
303 | |||
304 | allnodes = prom_create_node(prom_root_node, NULL); | ||
305 | allnodes->path_component_name = ""; | ||
306 | allnodes->full_name = "/"; | ||
307 | |||
308 | nextp = &allnodes->allnext; | ||
309 | allnodes->child = prom_build_tree(allnodes, | ||
310 | prom_getchild(allnodes->node), | ||
311 | &nextp); | ||
312 | of_console_init(); | ||
313 | |||
314 | printk("PROM: Built device tree with %u bytes of memory.\n", | ||
315 | prom_early_allocated); | ||
316 | } | 300 | } |
diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c index 0279811d17bc..3afb838a6e61 100644 --- a/arch/sparc/kernel/prom_64.c +++ b/arch/sparc/kernel/prom_64.c | |||
@@ -32,8 +32,6 @@ | |||
32 | 32 | ||
33 | #include "prom.h" | 33 | #include "prom.h" |
34 | 34 | ||
35 | static unsigned int prom_early_allocated __initdata; | ||
36 | |||
37 | void * __init prom_early_alloc(unsigned long size) | 35 | void * __init prom_early_alloc(unsigned long size) |
38 | { | 36 | { |
39 | unsigned long paddr = lmb_alloc(size, SMP_CACHE_BYTES); | 37 | unsigned long paddr = lmb_alloc(size, SMP_CACHE_BYTES); |
@@ -401,11 +399,15 @@ struct device_node *of_find_node_by_cpuid(int cpuid) | |||
401 | return NULL; | 399 | return NULL; |
402 | } | 400 | } |
403 | 401 | ||
404 | static void __init of_fill_in_cpu_data(void) | 402 | void __init of_fill_in_cpu_data(void) |
405 | { | 403 | { |
406 | struct device_node *dp; | 404 | struct device_node *dp; |
407 | const char *mid_prop = get_mid_prop(); | 405 | const char *mid_prop; |
406 | |||
407 | if (tlb_type == hypervisor) | ||
408 | return; | ||
408 | 409 | ||
410 | mid_prop = get_mid_prop(); | ||
409 | ncpus_probed = 0; | 411 | ncpus_probed = 0; |
410 | for_each_node_by_type(dp, "cpu") { | 412 | for_each_node_by_type(dp, "cpu") { |
411 | int cpuid = of_getintprop_default(dp, mid_prop, -1); | 413 | int cpuid = of_getintprop_default(dp, mid_prop, -1); |
@@ -533,7 +535,7 @@ EXPORT_SYMBOL(of_console_path); | |||
533 | char *of_console_options; | 535 | char *of_console_options; |
534 | EXPORT_SYMBOL(of_console_options); | 536 | EXPORT_SYMBOL(of_console_options); |
535 | 537 | ||
536 | static void __init of_console_init(void) | 538 | void __init of_console_init(void) |
537 | { | 539 | { |
538 | char *msg = "OF stdout device is: %s\n"; | 540 | char *msg = "OF stdout device is: %s\n"; |
539 | struct device_node *dp; | 541 | struct device_node *dp; |
@@ -576,24 +578,3 @@ static void __init of_console_init(void) | |||
576 | 578 | ||
577 | printk(msg, of_console_path); | 579 | printk(msg, of_console_path); |
578 | } | 580 | } |
579 | |||
580 | void __init prom_build_devicetree(void) | ||
581 | { | ||
582 | struct device_node **nextp; | ||
583 | |||
584 | allnodes = prom_create_node(prom_root_node, NULL); | ||
585 | allnodes->path_component_name = ""; | ||
586 | allnodes->full_name = "/"; | ||
587 | |||
588 | nextp = &allnodes->allnext; | ||
589 | allnodes->child = prom_build_tree(allnodes, | ||
590 | prom_getchild(allnodes->node), | ||
591 | &nextp); | ||
592 | of_console_init(); | ||
593 | |||
594 | printk("PROM: Built device tree with %u bytes of memory.\n", | ||
595 | prom_early_allocated); | ||
596 | |||
597 | if (tlb_type != hypervisor) | ||
598 | of_fill_in_cpu_data(); | ||
599 | } | ||
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c index 3b5de2f3fcd1..95e8e5d1b0fb 100644 --- a/arch/sparc/kernel/prom_common.c +++ b/arch/sparc/kernel/prom_common.c | |||
@@ -216,8 +216,8 @@ static char * __init get_one_property(phandle node, const char *name) | |||
216 | return buf; | 216 | return buf; |
217 | } | 217 | } |
218 | 218 | ||
219 | struct device_node * __init prom_create_node(phandle node, | 219 | static struct device_node * __init prom_create_node(phandle node, |
220 | struct device_node *parent) | 220 | struct device_node *parent) |
221 | { | 221 | { |
222 | struct device_node *dp; | 222 | struct device_node *dp; |
223 | 223 | ||
@@ -261,9 +261,9 @@ static char * __init build_full_name(struct device_node *dp) | |||
261 | return n; | 261 | return n; |
262 | } | 262 | } |
263 | 263 | ||
264 | struct device_node * __init prom_build_tree(struct device_node *parent, | 264 | static struct device_node * __init prom_build_tree(struct device_node *parent, |
265 | phandle node, | 265 | phandle node, |
266 | struct device_node ***nextp) | 266 | struct device_node ***nextp) |
267 | { | 267 | { |
268 | struct device_node *ret = NULL, *prev_sibling = NULL; | 268 | struct device_node *ret = NULL, *prev_sibling = NULL; |
269 | struct device_node *dp; | 269 | struct device_node *dp; |
@@ -293,3 +293,25 @@ struct device_node * __init prom_build_tree(struct device_node *parent, | |||
293 | 293 | ||
294 | return ret; | 294 | return ret; |
295 | } | 295 | } |
296 | |||
297 | unsigned int prom_early_allocated __initdata; | ||
298 | |||
299 | void __init prom_build_devicetree(void) | ||
300 | { | ||
301 | struct device_node **nextp; | ||
302 | |||
303 | allnodes = prom_create_node(prom_root_node, NULL); | ||
304 | allnodes->path_component_name = ""; | ||
305 | allnodes->full_name = "/"; | ||
306 | |||
307 | nextp = &allnodes->allnext; | ||
308 | allnodes->child = prom_build_tree(allnodes, | ||
309 | prom_getchild(allnodes->node), | ||
310 | &nextp); | ||
311 | of_console_init(); | ||
312 | |||
313 | printk("PROM: Built device tree with %u bytes of memory.\n", | ||
314 | prom_early_allocated); | ||
315 | |||
316 | of_fill_in_cpu_data(); | ||
317 | } | ||