aboutsummaryrefslogtreecommitdiffstats
path: root/arch/xtensa/kernel/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/xtensa/kernel/setup.c')
-rw-r--r--arch/xtensa/kernel/setup.c55
1 files changed, 14 insertions, 41 deletions
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index 946fb8d06c8b..6e2b6638122d 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -21,11 +21,8 @@
21#include <linux/screen_info.h> 21#include <linux/screen_info.h>
22#include <linux/bootmem.h> 22#include <linux/bootmem.h>
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24
25#ifdef CONFIG_OF
26#include <linux/of_fdt.h> 24#include <linux/of_fdt.h>
27#include <linux/of_platform.h> 25#include <linux/of_platform.h>
28#endif
29 26
30#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) 27#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
31# include <linux/console.h> 28# include <linux/console.h>
@@ -64,8 +61,8 @@ extern struct rtc_ops no_rtc_ops;
64struct rtc_ops *rtc_ops; 61struct rtc_ops *rtc_ops;
65 62
66#ifdef CONFIG_BLK_DEV_INITRD 63#ifdef CONFIG_BLK_DEV_INITRD
67extern void *initrd_start; 64extern unsigned long initrd_start;
68extern void *initrd_end; 65extern unsigned long initrd_end;
69int initrd_is_mapped = 0; 66int initrd_is_mapped = 0;
70extern int initrd_below_start_ok; 67extern int initrd_below_start_ok;
71#endif 68#endif
@@ -152,8 +149,8 @@ static int __init parse_tag_initrd(const bp_tag_t* tag)
152{ 149{
153 meminfo_t* mi; 150 meminfo_t* mi;
154 mi = (meminfo_t*)(tag->data); 151 mi = (meminfo_t*)(tag->data);
155 initrd_start = __va(mi->start); 152 initrd_start = (unsigned long)__va(mi->start);
156 initrd_end = __va(mi->end); 153 initrd_end = (unsigned long)__va(mi->end);
157 154
158 return 0; 155 return 0;
159} 156}
@@ -170,13 +167,6 @@ static int __init parse_tag_fdt(const bp_tag_t *tag)
170 167
171__tagtable(BP_TAG_FDT, parse_tag_fdt); 168__tagtable(BP_TAG_FDT, parse_tag_fdt);
172 169
173void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
174{
175 initrd_start = (void *)__va(start);
176 initrd_end = (void *)__va(end);
177 initrd_below_start_ok = 1;
178}
179
180#endif /* CONFIG_OF */ 170#endif /* CONFIG_OF */
181 171
182#endif /* CONFIG_BLK_DEV_INITRD */ 172#endif /* CONFIG_BLK_DEV_INITRD */
@@ -222,9 +212,13 @@ static int __init parse_bootparam(const bp_tag_t* tag)
222} 212}
223 213
224#ifdef CONFIG_OF 214#ifdef CONFIG_OF
215bool __initdata dt_memory_scan = false;
225 216
226void __init early_init_dt_add_memory_arch(u64 base, u64 size) 217void __init early_init_dt_add_memory_arch(u64 base, u64 size)
227{ 218{
219 if (!dt_memory_scan)
220 return;
221
228 size &= PAGE_MASK; 222 size &= PAGE_MASK;
229 add_sysmem_bank(MEMORY_TYPE_CONVENTIONAL, base, base + size); 223 add_sysmem_bank(MEMORY_TYPE_CONVENTIONAL, base, base + size);
230} 224}
@@ -236,31 +230,13 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
236 230
237void __init early_init_devtree(void *params) 231void __init early_init_devtree(void *params)
238{ 232{
239 /* Setup flat device-tree pointer */
240 initial_boot_params = params;
241
242 /* Retrieve various informations from the /chosen node of the
243 * device-tree, including the platform type, initrd location and
244 * size, TCE reserve, and more ...
245 */
246 if (!command_line[0])
247 of_scan_flat_dt(early_init_dt_scan_chosen, command_line);
248
249 /* Scan memory nodes and rebuild MEMBLOCKs */
250 of_scan_flat_dt(early_init_dt_scan_root, NULL);
251 if (sysmem.nr_banks == 0) 233 if (sysmem.nr_banks == 0)
252 of_scan_flat_dt(early_init_dt_scan_memory, NULL); 234 dt_memory_scan = true;
253}
254 235
255static void __init copy_devtree(void) 236 early_init_dt_scan(params);
256{ 237
257 void *alloc = early_init_dt_alloc_memory_arch( 238 if (!command_line[0])
258 be32_to_cpu(initial_boot_params->totalsize), 8); 239 strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
259 if (alloc) {
260 memcpy(alloc, initial_boot_params,
261 be32_to_cpu(initial_boot_params->totalsize));
262 initial_boot_params = alloc;
263 }
264} 240}
265 241
266static int __init xtensa_device_probe(void) 242static int __init xtensa_device_probe(void)
@@ -525,10 +501,7 @@ void __init setup_arch(char **cmdline_p)
525 501
526 bootmem_init(); 502 bootmem_init();
527 503
528#ifdef CONFIG_OF 504 unflatten_and_copy_device_tree();
529 copy_devtree();
530 unflatten_device_tree();
531#endif
532 505
533 platform_setup(cmdline_p); 506 platform_setup(cmdline_p);
534 507