0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <linux/bug.h>
0011 #include <linux/init.h>
0012 #include <linux/kernel.h>
0013 #include <linux/string.h>
0014
0015 #include <asm/sgialib.h>
0016 #include <asm/bootinfo.h>
0017
0018 #undef DEBUG_CMDLINE
0019
0020
0021
0022
0023
0024 #define prom_argv(index) ((char *) (long)argv[(index)])
0025
0026 static char *ignored[] = {
0027 "ConsoleIn=",
0028 "ConsoleOut=",
0029 "SystemPartition=",
0030 "OSLoader=",
0031 "OSLoadPartition=",
0032 "OSLoadFilename=",
0033 "OSLoadOptions="
0034 };
0035
0036 static char *used_arc[][2] = {
0037 { "OSLoadPartition=", "root=" },
0038 { "OSLoadOptions=", "" }
0039 };
0040
0041 static char __init *move_firmware_args(int argc, LONG *argv, char *cp)
0042 {
0043 char *s;
0044 int actr, i;
0045
0046 actr = 1;
0047
0048 while (actr < argc) {
0049 for(i = 0; i < ARRAY_SIZE(used_arc); i++) {
0050 int len = strlen(used_arc[i][0]);
0051
0052 if (!strncmp(prom_argv(actr), used_arc[i][0], len)) {
0053
0054 strcat(cp, used_arc[i][1]);
0055 cp += strlen(used_arc[i][1]);
0056
0057 s = strchr(prom_argv(actr), '=');
0058 if (s) {
0059 s++;
0060 strcpy(cp, s);
0061 cp += strlen(s);
0062 }
0063 *cp++ = ' ';
0064 break;
0065 }
0066 }
0067 actr++;
0068 }
0069
0070 return cp;
0071 }
0072
0073 void __init prom_init_cmdline(int argc, LONG *argv)
0074 {
0075 char *cp;
0076 int actr, i;
0077
0078 actr = 1;
0079
0080 cp = arcs_cmdline;
0081
0082
0083
0084
0085 cp = move_firmware_args(argc, argv, cp);
0086
0087 while (actr < argc) {
0088 for (i = 0; i < ARRAY_SIZE(ignored); i++) {
0089 int len = strlen(ignored[i]);
0090
0091 if (!strncmp(prom_argv(actr), ignored[i], len))
0092 goto pic_cont;
0093 }
0094
0095 strcpy(cp, prom_argv(actr));
0096 cp += strlen(prom_argv(actr));
0097 *cp++ = ' ';
0098
0099 pic_cont:
0100 actr++;
0101 }
0102
0103 if (cp != arcs_cmdline)
0104 --cp;
0105 *cp = '\0';
0106
0107 #ifdef DEBUG_CMDLINE
0108 printk(KERN_DEBUG "prom cmdline: %s\n", arcs_cmdline);
0109 #endif
0110 }