| 
									
										
										
										
											2007-06-06 14:52:38 +08:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Based on Ocelot Linux port, which is | 
					
						
							|  |  |  |  * Copyright 2001 MontaVista Software Inc. | 
					
						
							|  |  |  |  * Author: jsun@mvista.com or jsun@junsun.net | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright 2003 ICT CAS | 
					
						
							|  |  |  |  * Author: Michael Guo <guoyi@ict.ac.cn> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology | 
					
						
							|  |  |  |  * Author: Fuxin Zhang, zhangfx@lemote.com | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2009-11-06 18:35:33 +08:00
										 |  |  |  * Copyright (C) 2009 Lemote Inc. | 
					
						
							| 
									
										
										
										
											2010-01-04 17:16:51 +08:00
										 |  |  |  * Author: Wu Zhangjin, wuzhangjin@gmail.com | 
					
						
							| 
									
										
										
										
											2009-07-02 23:22:36 +08:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2013-01-22 12:59:30 +01:00
										 |  |  |  * This program is free software; you can redistribute	it and/or modify it | 
					
						
							|  |  |  |  * under  the terms of	the GNU General	 Public License as published by the | 
					
						
							| 
									
										
										
										
											2007-06-06 14:52:38 +08:00
										 |  |  |  * Free Software Foundation;  either version 2 of the  License, or (at your | 
					
						
							|  |  |  |  * option) any later version. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2009-07-02 23:22:36 +08:00
										 |  |  | #include <asm/bootinfo.h>
 | 
					
						
							| 
									
										
										
										
											2007-06-06 14:52:38 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-02 23:23:03 +08:00
										 |  |  | #include <loongson.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-06-06 14:52:38 +08:00
										 |  |  | void __init prom_init_cmdline(void) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-04 17:16:47 +08:00
										 |  |  | 	int prom_argc; | 
					
						
							|  |  |  | 	/* pmon passes arguments in 32bit pointers */ | 
					
						
							|  |  |  | 	int *_prom_argv; | 
					
						
							| 
									
										
										
										
											2007-06-06 14:52:38 +08:00
										 |  |  | 	int i; | 
					
						
							|  |  |  | 	long l; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-02 23:22:36 +08:00
										 |  |  | 	/* firmware arguments are initialized in head.S */ | 
					
						
							|  |  |  | 	prom_argc = fw_arg0; | 
					
						
							|  |  |  | 	_prom_argv = (int *)fw_arg1; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-06-06 14:52:38 +08:00
										 |  |  | 	/* arg[0] is "g", the rest is boot parameters */ | 
					
						
							|  |  |  | 	arcs_cmdline[0] = '\0'; | 
					
						
							| 
									
										
										
										
											2009-07-02 23:22:36 +08:00
										 |  |  | 	for (i = 1; i < prom_argc; i++) { | 
					
						
							|  |  |  | 		l = (long)_prom_argv[i]; | 
					
						
							| 
									
										
										
										
											2007-06-06 14:52:38 +08:00
										 |  |  | 		if (strlen(arcs_cmdline) + strlen(((char *)l) + 1) | 
					
						
							|  |  |  | 		    >= sizeof(arcs_cmdline)) | 
					
						
							|  |  |  | 			break; | 
					
						
							|  |  |  | 		strcat(arcs_cmdline, ((char *)l)); | 
					
						
							|  |  |  | 		strcat(arcs_cmdline, " "); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-06 18:35:33 +08:00
										 |  |  | 	prom_init_machtype(); | 
					
						
							| 
									
										
										
										
											2007-06-06 14:52:38 +08:00
										 |  |  | } |