aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/fw/arc/cmdline.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-11 22:21:23 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-11 22:21:23 -0400
commitdd6d1844af33acb4edd0a40b1770d091a22c94be (patch)
treee6bd3549919773a13b770324a4dddb51b194b452 /arch/mips/fw/arc/cmdline.c
parent19f71153b9be219756c6b2757921433a69b7975c (diff)
parentaaf76a3245c02faba51c96b9a340c14d6bb0dcc0 (diff)
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus: (80 commits) [MIPS] tlbex.c: Cleanup __init usage. [MIPS] WRPPMC serial support move to platform device [MIPS] R1: Fix hazard barriers to make kernels work on R2 also. [MIPS] VPE: reimplement ELF loader. [MIPS] cleanup WRPPMC include files [MIPS] Add BUG_ON assertion for attempt to run kernel on the wrong CPU type. [MIPS] SMP: Use ISO C struct initializer for local structs. [MIPS] SMP: Kill useless casts. [MIPS] Kill num_online_cpus() loops. [MIPS] SMP: Implement smp_call_function_mask(). [MIPS] Make facility to convert CPU types to strings generally available. [MIPS] Convert list of CPU types from #define to enum. [MIPS] Optimize get_unaligned / put_unaligned implementations. [MIPS] checkfiles: Fix "need space after that ','" errors. [MIPS] Fix "no space between function name and open parenthesis" warnings. [MIPS] Allow hardwiring of the CPU type to a single type for optimization. [MIPS] tlbex: Size optimize code by declaring a few functions inline. [MIPS] pg-r4k.c: Dump the generated code [MIPS] Cobalt: Remove cobalt_machine_power_off() [MIPS] Cobalt: Move reset port definition to arch/mips/cobalt/reset.c ...
Diffstat (limited to 'arch/mips/fw/arc/cmdline.c')
-rw-r--r--arch/mips/fw/arc/cmdline.c108
1 files changed, 108 insertions, 0 deletions
diff --git a/arch/mips/fw/arc/cmdline.c b/arch/mips/fw/arc/cmdline.c
new file mode 100644
index 000000000000..fd604ef28823
--- /dev/null
+++ b/arch/mips/fw/arc/cmdline.c
@@ -0,0 +1,108 @@
1/*
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
4 * for more details.
5 *
6 * cmdline.c: Kernel command line creation using ARCS argc/argv.
7 *
8 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
9 */
10#include <linux/init.h>
11#include <linux/kernel.h>
12#include <linux/string.h>
13
14#include <asm/sgialib.h>
15#include <asm/bootinfo.h>
16
17#undef DEBUG_CMDLINE
18
19char * __init prom_getcmdline(void)
20{
21 return arcs_cmdline;
22}
23
24static char *ignored[] = {
25 "ConsoleIn=",
26 "ConsoleOut=",
27 "SystemPartition=",
28 "OSLoader=",
29 "OSLoadPartition=",
30 "OSLoadFilename=",
31 "OSLoadOptions="
32};
33
34static char *used_arc[][2] = {
35 { "OSLoadPartition=", "root=" },
36 { "OSLoadOptions=", "" }
37};
38
39static char * __init move_firmware_args(char* cp)
40{
41 char *s;
42 int actr, i;
43
44 actr = 1; /* Always ignore argv[0] */
45
46 while (actr < prom_argc) {
47 for(i = 0; i < ARRAY_SIZE(used_arc); i++) {
48 int len = strlen(used_arc[i][0]);
49
50 if (!strncmp(prom_argv(actr), used_arc[i][0], len)) {
51 /* Ok, we want it. First append the replacement... */
52 strcat(cp, used_arc[i][1]);
53 cp += strlen(used_arc[i][1]);
54 /* ... and now the argument */
55 s = strstr(prom_argv(actr), "=");
56 if (s) {
57 s++;
58 strcpy(cp, s);
59 cp += strlen(s);
60 }
61 *cp++ = ' ';
62 break;
63 }
64 }
65 actr++;
66 }
67
68 return cp;
69}
70
71void __init prom_init_cmdline(void)
72{
73 char *cp;
74 int actr, i;
75
76 actr = 1; /* Always ignore argv[0] */
77
78 cp = arcs_cmdline;
79 /*
80 * Move ARC variables to the beginning to make sure they can be
81 * overridden by later arguments.
82 */
83 cp = move_firmware_args(cp);
84
85 while (actr < prom_argc) {
86 for (i = 0; i < ARRAY_SIZE(ignored); i++) {
87 int len = strlen(ignored[i]);
88
89 if (!strncmp(prom_argv(actr), ignored[i], len))
90 goto pic_cont;
91 }
92 /* Ok, we want it. */
93 strcpy(cp, prom_argv(actr));
94 cp += strlen(prom_argv(actr));
95 *cp++ = ' ';
96
97 pic_cont:
98 actr++;
99 }
100
101 if (cp != arcs_cmdline) /* get rid of trailing space */
102 --cp;
103 *cp = '\0';
104
105#ifdef DEBUG_CMDLINE
106 printk(KERN_DEBUG "prom cmdline: %s\n", arcs_cmdline);
107#endif
108}