diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2009-11-24 05:26:58 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2009-12-10 17:18:03 -0500 |
commit | f7b3a8355ba6cad251297844a0bdd08898ea36e0 (patch) | |
tree | 018eee7bfdbf99961e929644a761354bbea12688 | |
parent | 2be09cb993826b52c9fc1d44747c20dd43a50038 (diff) |
of/flattree: Merge early_init_dt_check_for_initrd()
Merge common code between PowerPC and Microblaze
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/microblaze/kernel/prom.c | 32 | ||||
-rw-r--r-- | arch/powerpc/kernel/prom.c | 30 | ||||
-rw-r--r-- | drivers/of/fdt.c | 37 | ||||
-rw-r--r-- | include/linux/of_fdt.h | 1 |
4 files changed, 38 insertions, 62 deletions
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c index a38e3733a09c..7959495b1d00 100644 --- a/arch/microblaze/kernel/prom.c +++ b/arch/microblaze/kernel/prom.c | |||
@@ -113,38 +113,6 @@ static int __init early_init_dt_scan_cpus(unsigned long node, | |||
113 | return 0; | 113 | return 0; |
114 | } | 114 | } |
115 | 115 | ||
116 | #ifdef CONFIG_BLK_DEV_INITRD | ||
117 | static void __init early_init_dt_check_for_initrd(unsigned long node) | ||
118 | { | ||
119 | unsigned long l; | ||
120 | u32 *prop; | ||
121 | |||
122 | pr_debug("Looking for initrd properties... "); | ||
123 | |||
124 | prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l); | ||
125 | if (prop) { | ||
126 | initrd_start = (unsigned long) | ||
127 | __va((u32)of_read_ulong(prop, l/4)); | ||
128 | |||
129 | prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l); | ||
130 | if (prop) { | ||
131 | initrd_end = (unsigned long) | ||
132 | __va((u32)of_read_ulong(prop, 1/4)); | ||
133 | initrd_below_start_ok = 1; | ||
134 | } else { | ||
135 | initrd_start = 0; | ||
136 | } | ||
137 | } | ||
138 | |||
139 | pr_debug("initrd_start=0x%lx initrd_end=0x%lx\n", | ||
140 | initrd_start, initrd_end); | ||
141 | } | ||
142 | #else | ||
143 | static inline void early_init_dt_check_for_initrd(unsigned long node) | ||
144 | { | ||
145 | } | ||
146 | #endif /* CONFIG_BLK_DEV_INITRD */ | ||
147 | |||
148 | static int __init early_init_dt_scan_chosen(unsigned long node, | 116 | static int __init early_init_dt_scan_chosen(unsigned long node, |
149 | const char *uname, int depth, void *data) | 117 | const char *uname, int depth, void *data) |
150 | { | 118 | { |
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 7f8856655144..1ecd6c6ecabd 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -373,36 +373,6 @@ static int __init early_init_dt_scan_cpus(unsigned long node, | |||
373 | return 0; | 373 | return 0; |
374 | } | 374 | } |
375 | 375 | ||
376 | #ifdef CONFIG_BLK_DEV_INITRD | ||
377 | static void __init early_init_dt_check_for_initrd(unsigned long node) | ||
378 | { | ||
379 | unsigned long l; | ||
380 | u32 *prop; | ||
381 | |||
382 | DBG("Looking for initrd properties... "); | ||
383 | |||
384 | prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l); | ||
385 | if (prop) { | ||
386 | initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4)); | ||
387 | |||
388 | prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l); | ||
389 | if (prop) { | ||
390 | initrd_end = (unsigned long) | ||
391 | __va(of_read_ulong(prop, l/4)); | ||
392 | initrd_below_start_ok = 1; | ||
393 | } else { | ||
394 | initrd_start = 0; | ||
395 | } | ||
396 | } | ||
397 | |||
398 | DBG("initrd_start=0x%lx initrd_end=0x%lx\n", initrd_start, initrd_end); | ||
399 | } | ||
400 | #else | ||
401 | static inline void early_init_dt_check_for_initrd(unsigned long node) | ||
402 | { | ||
403 | } | ||
404 | #endif /* CONFIG_BLK_DEV_INITRD */ | ||
405 | |||
406 | static int __init early_init_dt_scan_chosen(unsigned long node, | 376 | static int __init early_init_dt_scan_chosen(unsigned long node, |
407 | const char *uname, int depth, void *data) | 377 | const char *uname, int depth, void *data) |
408 | { | 378 | { |
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 43d236cbc17b..6ad98e85dc93 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/lmb.h> | 13 | #include <linux/lmb.h> |
14 | #include <linux/initrd.h> | ||
14 | #include <linux/of.h> | 15 | #include <linux/of.h> |
15 | #include <linux/of_fdt.h> | 16 | #include <linux/of_fdt.h> |
16 | 17 | ||
@@ -369,6 +370,42 @@ unsigned long __init unflatten_dt_node(unsigned long mem, | |||
369 | return mem; | 370 | return mem; |
370 | } | 371 | } |
371 | 372 | ||
373 | #ifdef CONFIG_BLK_DEV_INITRD | ||
374 | /** | ||
375 | * early_init_dt_check_for_initrd - Decode initrd location from flat tree | ||
376 | * @node: reference to node containing initrd location ('chosen') | ||
377 | */ | ||
378 | void __init early_init_dt_check_for_initrd(unsigned long node) | ||
379 | { | ||
380 | unsigned long len; | ||
381 | u32 *prop; | ||
382 | |||
383 | pr_debug("Looking for initrd properties... "); | ||
384 | |||
385 | prop = of_get_flat_dt_prop(node, "linux,initrd-start", &len); | ||
386 | if (prop) { | ||
387 | initrd_start = (unsigned long) | ||
388 | __va(of_read_ulong(prop, len/4)); | ||
389 | |||
390 | prop = of_get_flat_dt_prop(node, "linux,initrd-end", &len); | ||
391 | if (prop) { | ||
392 | initrd_end = (unsigned long) | ||
393 | __va(of_read_ulong(prop, len/4)); | ||
394 | initrd_below_start_ok = 1; | ||
395 | } else { | ||
396 | initrd_start = 0; | ||
397 | } | ||
398 | } | ||
399 | |||
400 | pr_debug("initrd_start=0x%lx initrd_end=0x%lx\n", | ||
401 | initrd_start, initrd_end); | ||
402 | } | ||
403 | #else | ||
404 | inline void early_init_dt_check_for_initrd(unsigned long node) | ||
405 | { | ||
406 | } | ||
407 | #endif /* CONFIG_BLK_DEV_INITRD */ | ||
408 | |||
372 | /** | 409 | /** |
373 | * unflatten_device_tree - create tree of device_nodes from flat blob | 410 | * unflatten_device_tree - create tree of device_nodes from flat blob |
374 | * | 411 | * |
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h index 81231e04e8f3..ec2db8278c3f 100644 --- a/include/linux/of_fdt.h +++ b/include/linux/of_fdt.h | |||
@@ -69,6 +69,7 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name, | |||
69 | unsigned long *size); | 69 | unsigned long *size); |
70 | extern int of_flat_dt_is_compatible(unsigned long node, const char *name); | 70 | extern int of_flat_dt_is_compatible(unsigned long node, const char *name); |
71 | extern unsigned long of_get_flat_dt_root(void); | 71 | extern unsigned long of_get_flat_dt_root(void); |
72 | extern void early_init_dt_check_for_initrd(unsigned long node); | ||
72 | 73 | ||
73 | /* Other Prototypes */ | 74 | /* Other Prototypes */ |
74 | extern void finish_device_tree(void); | 75 | extern void finish_device_tree(void); |