diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2017-03-13 10:34:36 -0700 |
---|---|---|
committer | Max Filippov <jcmvbkbc@gmail.com> | 2017-03-13 13:47:20 -0700 |
commit | fbe22d280014e783fe2454db2a0ba44fc4f68a5a (patch) | |
tree | 6210fb99a4704fd52fd3af840fa8e1f7c48a167b /arch/xtensa | |
parent | e8cd8da934f29a0aca2c4bd96310a0b6ba6e31a7 (diff) |
xtensa: ISS: update kernel command line in platform_setup
Move platform_setup call higher in initialization sequence so that it
could change kernel command line.
Check command line passed to simulator in ISS platform_stup and update
kernel command line if there's anything.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'arch/xtensa')
-rw-r--r-- | arch/xtensa/kernel/setup.c | 5 | ||||
-rw-r--r-- | arch/xtensa/platforms/iss/setup.c | 21 |
2 files changed, 23 insertions, 3 deletions
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c index 8fd4be610607..48ffc58ca38a 100644 --- a/arch/xtensa/kernel/setup.c +++ b/arch/xtensa/kernel/setup.c @@ -317,8 +317,9 @@ static inline int mem_reserve(unsigned long start, unsigned long end) void __init setup_arch(char **cmdline_p) { - strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); *cmdline_p = command_line; + platform_setup(cmdline_p); + strlcpy(boot_command_line, *cmdline_p, COMMAND_LINE_SIZE); /* Reserve some memory regions */ @@ -379,8 +380,6 @@ void __init setup_arch(char **cmdline_p) unflatten_and_copy_device_tree(); - platform_setup(cmdline_p); - #ifdef CONFIG_SMP smp_init_cpus(); #endif diff --git a/arch/xtensa/platforms/iss/setup.c b/arch/xtensa/platforms/iss/setup.c index 3742ee63282f..f4bbb28026f8 100644 --- a/arch/xtensa/platforms/iss/setup.c +++ b/arch/xtensa/platforms/iss/setup.c @@ -8,6 +8,7 @@ * Joe Taylor <joe@tensilica.com> * * Copyright 2001 - 2005 Tensilica Inc. + * Copyright 2017 Cadence Design Systems Inc. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -15,6 +16,7 @@ * option) any later version. * */ +#include <linux/bootmem.h> #include <linux/stddef.h> #include <linux/kernel.h> #include <linux/init.h> @@ -76,5 +78,24 @@ static struct notifier_block iss_panic_block = { void __init platform_setup(char **p_cmdline) { + int argc = simc_argc(); + int argv_size = simc_argv_size(); + + if (argc > 1) { + void **argv = alloc_bootmem(argv_size); + char *cmdline = alloc_bootmem(argv_size); + int i; + + cmdline[0] = 0; + simc_argv((void *)argv); + + for (i = 1; i < argc; ++i) { + if (i > 1) + strcat(cmdline, " "); + strcat(cmdline, argv[i]); + } + *p_cmdline = cmdline; + } + atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block); } |