| /* | 
 |  * 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. | 
 |  * | 
 |  * Copyright (C) 2012 MIPS Technologies, Inc.  All rights reserved. | 
 |  */ | 
 | #include <linux/init.h> | 
 | #include <linux/string.h> | 
 |  | 
 | #include <asm/bootinfo.h> | 
 |  | 
 | extern int prom_argc; | 
 | extern int *_prom_argv; | 
 |  | 
 | /* | 
 |  * YAMON (32-bit PROM) pass arguments and environment as 32-bit pointer. | 
 |  * This macro take care of sign extension. | 
 |  */ | 
 | #define prom_argv(index) ((char *)(long)_prom_argv[(index)]) | 
 |  | 
 | char * __init prom_getcmdline(void) | 
 | { | 
 | 	return &(arcs_cmdline[0]); | 
 | } | 
 |  | 
 | void  __init prom_init_cmdline(void) | 
 | { | 
 | 	char *cp; | 
 | 	int actr; | 
 |  | 
 | 	actr = 1; /* Always ignore argv[0] */ | 
 |  | 
 | 	cp = &(arcs_cmdline[0]); | 
 | 	while (actr < prom_argc) { | 
 | 		strcpy(cp, prom_argv(actr)); | 
 | 		cp += strlen(prom_argv(actr)); | 
 | 		*cp++ = ' '; | 
 | 		actr++; | 
 | 	} | 
 | 	if (cp != &(arcs_cmdline[0])) { | 
 | 		/* get rid of trailing space */ | 
 | 		--cp; | 
 | 		*cp = '\0'; | 
 | 	} | 
 | } |