aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arc/kernel/setup.c
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2014-01-16 04:31:24 -0500
committerVineet Gupta <vgupta@synopsys.com>2014-01-16 08:19:38 -0500
commit59ed9413533897823bcdb4c79fd2904718e25b0a (patch)
treef016337b77b6299e551282c642249ec9327b4784 /arch/arc/kernel/setup.c
parentd8e8c7dda11f5d5cf90495f2e89d917a83509bc0 (diff)
ARC: [cmdline] uboot cmdline handling rework
* Moved cmdline copy from asm to "C" - allows for more robust checking of pointer validity etc. * Remove the Kconfig option to do so, base it on a runtime value passed by u-boot Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch/arc/kernel/setup.c')
-rw-r--r--arch/arc/kernel/setup.c39
1 files changed, 27 insertions, 12 deletions
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index 643eae4436e0..ffb60b4f6f86 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -29,7 +29,10 @@
29 29
30int running_on_hw = 1; /* vs. on ISS */ 30int running_on_hw = 1; /* vs. on ISS */
31 31
32char __initdata command_line[COMMAND_LINE_SIZE]; 32/* Part of U-boot ABI: see head.S */
33int __initdata uboot_tag;
34char __initdata *uboot_arg;
35
33const struct machine_desc *machine_desc; 36const struct machine_desc *machine_desc;
34 37
35struct task_struct *_current_task[NR_CPUS]; /* For stack switching */ 38struct task_struct *_current_task[NR_CPUS]; /* For stack switching */
@@ -311,19 +314,31 @@ void setup_processor(void)
311 arc_chk_fpu(); 314 arc_chk_fpu();
312} 315}
313 316
317static inline int is_kernel(unsigned long addr)
318{
319 if (addr >= (unsigned long)_stext && addr <= (unsigned long)_end)
320 return 1;
321 return 0;
322}
323
314void __init setup_arch(char **cmdline_p) 324void __init setup_arch(char **cmdline_p)
315{ 325{
316 /* This also populates @boot_command_line from /bootargs */ 326 machine_desc = setup_machine_fdt(__dtb_start);
317 machine_desc = setup_machine_fdt(__dtb_start); 327 if (!machine_desc)
318 if (!machine_desc) 328 panic("Embedded DT invalid\n");
319 panic("Embedded DT invalid\n"); 329
320 330 /*
321 /* Append any u-boot provided cmdline */ 331 * Append uboot cmdline to embedded DT cmdline.
322#ifdef CONFIG_CMDLINE_UBOOT 332 * setup_machine_fdt() would have populated @boot_command_line
323 /* Add a whitespace seperator between the 2 cmdlines */ 333 */
324 strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); 334 if (uboot_tag == 1) {
325 strlcat(boot_command_line, command_line, COMMAND_LINE_SIZE); 335 BUG_ON(is_kernel(unsigned long)uboot_arg);
326#endif 336
337 /* Ensure a whitespace between the 2 cmdlines */
338 strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
339 strlcat(boot_command_line, uboot_arg,
340 COMMAND_LINE_SIZE);
341 }
327 342
328 /* Save unparsed command line copy for /proc/cmdline */ 343 /* Save unparsed command line copy for /proc/cmdline */
329 *cmdline_p = boot_command_line; 344 *cmdline_p = boot_command_line;