summaryrefslogtreecommitdiffstats
path: root/arch/mips64
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2001-03-27 01:49:33 +0000
committerRalf Baechle <ralf@linux-mips.org>2001-03-27 01:49:33 +0000
commit12e00f34ea0db712ce70bc3eed334c81b3d6a344 (patch)
treed1da6c0d0c11642aeb1ff45bb79c69adf5ed44ff /arch/mips64
parent5e3e4ab42584e5155a776c40c30fd13c83e580ad (diff)
Interpret some ARC firmware variables correctly. Patch from Guido
with some mods by me.
Diffstat (limited to 'arch/mips64')
-rw-r--r--arch/mips64/arc/cmdline.c56
1 files changed, 50 insertions, 6 deletions
diff --git a/arch/mips64/arc/cmdline.c b/arch/mips64/arc/cmdline.c
index 8ab66fa59..2bc643d20 100644
--- a/arch/mips64/arc/cmdline.c
+++ b/arch/mips64/arc/cmdline.c
@@ -1,5 +1,4 @@
-/* $Id: cmdline.c,v 1.2 1999/10/19 20:51:44 ralf Exp $
- *
+/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
@@ -30,10 +29,49 @@ static char *ignored[] = {
"SystemPartition=",
"OSLoader=",
"OSLoadPartition=",
- "OSLoadFilename="
+ "OSLoadFilename=",
+ "OSLoadOptions="
};
#define NENTS(foo) ((sizeof((foo)) / (sizeof((foo[0])))))
+static char *used_arc[][2] = {
+ { "OSLoadPartition=", "root=" },
+ { "OSLoadOptions=", "" }
+};
+
+static char * __init move_firmware_args(char* cp)
+{
+ char *s;
+ int actr, i;
+
+ actr = 1; /* Always ignore argv[0] */
+
+ while (actr < prom_argc) {
+ for(i = 0; i < NENTS(used_arc); i++) {
+ int len = strlen(used_arc[i][0]);
+
+ if (!strncmp(prom_argv(actr), used_arc[i][0], len)) {
+ /* Ok, we want it. First append the replacement... */
+ strcat(cp, used_arc[i][1]);
+ cp += strlen(used_arc[i][1]);
+ /* ... and now the argument */
+ s = strstr(prom_argv(actr), "=");
+ if (s) {
+ s++;
+ strcpy(cp, s);
+ cp += strlen(s);
+ }
+ *cp++ = ' ';
+ break;
+ }
+ }
+ actr++;
+ }
+
+ return cp;
+}
+
+
void __init prom_init_cmdline(void)
{
char *cp;
@@ -42,11 +80,17 @@ void __init prom_init_cmdline(void)
actr = 1; /* Always ignore argv[0] */
cp = &(arcs_cmdline[0]);
- while(actr < prom_argc) {
- for(i = 0; i < NENTS(ignored); i++) {
+ /*
+ * Move ARC variables to the beginning to make sure they can be
+ * overridden by later arguments.
+ */
+ cp = move_firmware_args(cp);
+
+ while (actr < prom_argc) {
+ for (i = 0; i < NENTS(ignored); i++) {
int len = strlen(ignored[i]);
- if(!strncmp(prom_argv(actr), ignored[i], len))
+ if (!strncmp(prom_argv(actr), ignored[i], len))
goto pic_cont;
}
/* Ok, we want it. */