KVM: PPC: Book3S: Only report KVM_CAP_SPAPR_TCE_VFIO on powernv machines
[linux/fpc-iii.git] / arch / mips / fw / arc / cmdline.c
blobc0122a1dc58784a6304dbb76aadcff47a4904cfc
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.
6 * cmdline.c: Kernel command line creation using ARCS argc/argv.
8 * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
9 */
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>
18 #undef DEBUG_CMDLINE
20 static char *ignored[] = {
21 "ConsoleIn=",
22 "ConsoleOut=",
23 "SystemPartition=",
24 "OSLoader=",
25 "OSLoadPartition=",
26 "OSLoadFilename=",
27 "OSLoadOptions="
30 static char *used_arc[][2] = {
31 { "OSLoadPartition=", "root=" },
32 { "OSLoadOptions=", "" }
35 static char * __init move_firmware_args(char* cp)
37 char *s;
38 int actr, i;
40 actr = 1; /* Always ignore argv[0] */
42 while (actr < prom_argc) {
43 for(i = 0; i < ARRAY_SIZE(used_arc); i++) {
44 int len = strlen(used_arc[i][0]);
46 if (!strncmp(prom_argv(actr), used_arc[i][0], len)) {
47 /* Ok, we want it. First append the replacement... */
48 strcat(cp, used_arc[i][1]);
49 cp += strlen(used_arc[i][1]);
50 /* ... and now the argument */
51 s = strchr(prom_argv(actr), '=');
52 if (s) {
53 s++;
54 strcpy(cp, s);
55 cp += strlen(s);
57 *cp++ = ' ';
58 break;
61 actr++;
64 return cp;
67 void __init prom_init_cmdline(void)
69 char *cp;
70 int actr, i;
72 actr = 1; /* Always ignore argv[0] */
74 cp = arcs_cmdline;
76 * Move ARC variables to the beginning to make sure they can be
77 * overridden by later arguments.
79 cp = move_firmware_args(cp);
81 while (actr < prom_argc) {
82 for (i = 0; i < ARRAY_SIZE(ignored); i++) {
83 int len = strlen(ignored[i]);
85 if (!strncmp(prom_argv(actr), ignored[i], len))
86 goto pic_cont;
88 /* Ok, we want it. */
89 strcpy(cp, prom_argv(actr));
90 cp += strlen(prom_argv(actr));
91 *cp++ = ' ';
93 pic_cont:
94 actr++;
97 if (cp != arcs_cmdline) /* get rid of trailing space */
98 --cp;
99 *cp = '\0';
101 #ifdef DEBUG_CMDLINE
102 printk(KERN_DEBUG "prom cmdline: %s\n", arcs_cmdline);
103 #endif