aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/txx9/generic/setup.c
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2008-08-19 09:55:06 -0400
committerRalf Baechle <ralf@linux-mips.org>2008-10-11 11:18:41 -0400
commite0dfb20c2b77c6626a24578240266ace928cd2e7 (patch)
tree67666f032698a62b00ee6d91328dd641abe1c498 /arch/mips/txx9/generic/setup.c
parentf96a3383cfede841cdf80a5927f14478981ed78c (diff)
MIPS: TXx9: Improve handling of built-in and command-line args
* Make prom_init_cmdline() static and be called from prom_init. * Append built-in args if the first character was '+'. * Drop command-line args if the first character of built-in was '-'. * Enclose args include spaces by quotes. * TX4938_NAND_BOOT is no longer needed. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/txx9/generic/setup.c')
-rw-r--r--arch/mips/txx9/generic/setup.c42
1 files changed, 31 insertions, 11 deletions
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index fe6bee09cece..33d8c9e3223d 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -127,31 +127,51 @@ extern struct txx9_board_vec rbtx4938_vec;
127struct txx9_board_vec *txx9_board_vec __initdata; 127struct txx9_board_vec *txx9_board_vec __initdata;
128static char txx9_system_type[32]; 128static char txx9_system_type[32];
129 129
130void __init prom_init_cmdline(void) 130static void __init prom_init_cmdline(void)
131{ 131{
132 int argc = (int)fw_arg0; 132 int argc = (int)fw_arg0;
133 char **argv = (char **)fw_arg1; 133 int *argv32 = (int *)fw_arg1;
134 int i; /* Always ignore the "-c" at argv[0] */ 134 int i; /* Always ignore the "-c" at argv[0] */
135#ifdef CONFIG_64BIT 135 char builtin[CL_SIZE];
136 char *fixed_argv[32];
137 for (i = 0; i < argc; i++)
138 fixed_argv[i] = (char *)(long)(*((__s32 *)argv + i));
139 argv = fixed_argv;
140#endif
141 136
142 /* ignore all built-in args if any f/w args given */ 137 /* ignore all built-in args if any f/w args given */
143 if (argc > 1) 138 /*
144 *arcs_cmdline = '\0'; 139 * But if built-in strings was started with '+', append them
140 * to command line args. If built-in was started with '-',
141 * ignore all f/w args.
142 */
143 builtin[0] = '\0';
144 if (arcs_cmdline[0] == '+')
145 strcpy(builtin, arcs_cmdline + 1);
146 else if (arcs_cmdline[0] == '-') {
147 strcpy(builtin, arcs_cmdline + 1);
148 argc = 0;
149 } else if (argc <= 1)
150 strcpy(builtin, arcs_cmdline);
151 arcs_cmdline[0] = '\0';
145 152
146 for (i = 1; i < argc; i++) { 153 for (i = 1; i < argc; i++) {
154 char *str = (char *)(long)argv32[i];
147 if (i != 1) 155 if (i != 1)
148 strcat(arcs_cmdline, " "); 156 strcat(arcs_cmdline, " ");
149 strcat(arcs_cmdline, argv[i]); 157 if (strchr(str, ' ')) {
158 strcat(arcs_cmdline, "\"");
159 strcat(arcs_cmdline, str);
160 strcat(arcs_cmdline, "\"");
161 } else
162 strcat(arcs_cmdline, str);
163 }
164 /* append saved builtin args */
165 if (builtin[0]) {
166 if (arcs_cmdline[0])
167 strcat(arcs_cmdline, " ");
168 strcat(arcs_cmdline, builtin);
150 } 169 }
151} 170}
152 171
153void __init prom_init(void) 172void __init prom_init(void)
154{ 173{
174 prom_init_cmdline();
155#ifdef CONFIG_CPU_TX39XX 175#ifdef CONFIG_CPU_TX39XX
156 txx9_board_vec = &jmr3927_vec; 176 txx9_board_vec = &jmr3927_vec;
157#endif 177#endif