MIPS: Add core files for MIPS SEAD-3 development platform.
[linux-drm-fsl-dcu.git] / arch / mips / mti-sead3 / sead3-cmdline.c
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  * Copyright (C) 2012 MIPS Technologies, Inc.  All rights reserved.
7  */
8 #include <linux/init.h>
9 #include <linux/string.h>
10
11 #include <asm/bootinfo.h>
12
13 extern int prom_argc;
14 extern int *_prom_argv;
15
16 /*
17  * YAMON (32-bit PROM) pass arguments and environment as 32-bit pointer.
18  * This macro take care of sign extension.
19  */
20 #define prom_argv(index) ((char *)(long)_prom_argv[(index)])
21
22 char * __init prom_getcmdline(void)
23 {
24         return &(arcs_cmdline[0]);
25 }
26
27 void  __init prom_init_cmdline(void)
28 {
29         char *cp;
30         int actr;
31
32         actr = 1; /* Always ignore argv[0] */
33
34         cp = &(arcs_cmdline[0]);
35         while (actr < prom_argc) {
36                 strcpy(cp, prom_argv(actr));
37                 cp += strlen(prom_argv(actr));
38                 *cp++ = ' ';
39                 actr++;
40         }
41         if (cp != &(arcs_cmdline[0])) {
42                 /* get rid of trailing space */
43                 --cp;
44                 *cp = '\0';
45         }
46 }