2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * cmdline.c: Kernel command line creation using ARCS argc/argv.
8 * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
10 #include <linux/bug.h>
11 #include <linux/init.h>
12 #include <linux/kernel.h>
13 #include <linux/string.h>
15 #include <asm/sgialib.h>
16 #include <asm/bootinfo.h>
21 * A 32-bit ARC PROM pass arguments and environment as 32-bit pointer.
22 * These macro take care of sign extension.
24 #define prom_argv(index) ((char *) (long)argv[(index)])
26 static char *ignored
[] = {
36 static char *used_arc
[][2] = {
37 { "OSLoadPartition=", "root=" },
38 { "OSLoadOptions=", "" }
41 static char __init
*move_firmware_args(int argc
, LONG
*argv
, char *cp
)
46 actr
= 1; /* Always ignore argv[0] */
49 for(i
= 0; i
< ARRAY_SIZE(used_arc
); i
++) {
50 int len
= strlen(used_arc
[i
][0]);
52 if (!strncmp(prom_argv(actr
), used_arc
[i
][0], len
)) {
53 /* Ok, we want it. First append the replacement... */
54 strcat(cp
, used_arc
[i
][1]);
55 cp
+= strlen(used_arc
[i
][1]);
56 /* ... and now the argument */
57 s
= strchr(prom_argv(actr
), '=');
73 void __init
prom_init_cmdline(int argc
, LONG
*argv
)
78 actr
= 1; /* Always ignore argv[0] */
82 * Move ARC variables to the beginning to make sure they can be
83 * overridden by later arguments.
85 cp
= move_firmware_args(argc
, argv
, cp
);
88 for (i
= 0; i
< ARRAY_SIZE(ignored
); i
++) {
89 int len
= strlen(ignored
[i
]);
91 if (!strncmp(prom_argv(actr
), ignored
[i
], len
))
95 strcpy(cp
, prom_argv(actr
));
96 cp
+= strlen(prom_argv(actr
));
103 if (cp
!= arcs_cmdline
) /* get rid of trailing space */
108 printk(KERN_DEBUG
"prom cmdline: %s\n", arcs_cmdline
);