summaryrefslogtreecommitdiffstats
path: root/arch/arc/kernel/setup.c
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2014-01-16 15:01:24 +0530
committerVineet Gupta <vgupta@synopsys.com>2014-01-16 18:49:38 +0530
commit59ed9413533897823bcdb4c79fd2904718e25b0a (patch)
treef016337b77b6299e551282c642249ec9327b4784 /arch/arc/kernel/setup.c
parentd8e8c7dda11f5d5cf90495f2e89d917a83509bc0 (diff)
downloadtalos-obmc-linux-59ed9413533897823bcdb4c79fd2904718e25b0a.tar.gz
talos-obmc-linux-59ed9413533897823bcdb4c79fd2904718e25b0a.zip
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 @@
int running_on_hw = 1; /* vs. on ISS */
-char __initdata command_line[COMMAND_LINE_SIZE];
+/* Part of U-boot ABI: see head.S */
+int __initdata uboot_tag;
+char __initdata *uboot_arg;
+
const struct machine_desc *machine_desc;
struct task_struct *_current_task[NR_CPUS]; /* For stack switching */
@@ -311,19 +314,31 @@ void setup_processor(void)
arc_chk_fpu();
}
+static inline int is_kernel(unsigned long addr)
+{
+ if (addr >= (unsigned long)_stext && addr <= (unsigned long)_end)
+ return 1;
+ return 0;
+}
+
void __init setup_arch(char **cmdline_p)
{
- /* This also populates @boot_command_line from /bootargs */
- machine_desc = setup_machine_fdt(__dtb_start);
- if (!machine_desc)
- panic("Embedded DT invalid\n");
-
- /* Append any u-boot provided cmdline */
-#ifdef CONFIG_CMDLINE_UBOOT
- /* Add a whitespace seperator between the 2 cmdlines */
- strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
- strlcat(boot_command_line, command_line, COMMAND_LINE_SIZE);
-#endif
+ machine_desc = setup_machine_fdt(__dtb_start);
+ if (!machine_desc)
+ panic("Embedded DT invalid\n");
+
+ /*
+ * Append uboot cmdline to embedded DT cmdline.
+ * setup_machine_fdt() would have populated @boot_command_line
+ */
+ if (uboot_tag == 1) {
+ BUG_ON(is_kernel(unsigned long)uboot_arg);
+
+ /* Ensure a whitespace between the 2 cmdlines */
+ strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
+ strlcat(boot_command_line, uboot_arg,
+ COMMAND_LINE_SIZE);
+ }
/* Save unparsed command line copy for /proc/cmdline */
*cmdline_p = boot_command_line;
OpenPOWER on IntegriCloud