diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2001-03-27 01:49:33 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2001-03-27 01:49:33 +0000 |
commit | 12e00f34ea0db712ce70bc3eed334c81b3d6a344 (patch) | |
tree | d1da6c0d0c11642aeb1ff45bb79c69adf5ed44ff | |
parent | 5e3e4ab42584e5155a776c40c30fd13c83e580ad (diff) |
Interpret some ARC firmware variables correctly. Patch from Guido
with some mods by me.
-rw-r--r-- | arch/mips/arc/cmdline.c | 51 | ||||
-rw-r--r-- | arch/mips64/arc/cmdline.c | 56 |
2 files changed, 98 insertions, 9 deletions
diff --git a/arch/mips/arc/cmdline.c b/arch/mips/arc/cmdline.c index e6f348384..54943c3d4 100644 --- a/arch/mips/arc/cmdline.c +++ b/arch/mips/arc/cmdline.c @@ -25,10 +25,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; @@ -37,8 +76,14 @@ 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)) 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. */ |