| Wu Zhangjin | bd92aa0 | 2009-07-02 23:22:36 +0800 | [diff] [blame] | 1 | /* | 
|  | 2 | * Based on Ocelot Linux port, which is | 
|  | 3 | * Copyright 2001 MontaVista Software Inc. | 
|  | 4 | * Author: jsun@mvista.com or jsun@junsun.net | 
|  | 5 | * | 
|  | 6 | * Copyright 2003 ICT CAS | 
|  | 7 | * Author: Michael Guo <guoyi@ict.ac.cn> | 
|  | 8 | * | 
|  | 9 | * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology | 
|  | 10 | * Author: Fuxin Zhang, zhangfx@lemote.com | 
|  | 11 | * | 
| Wu Zhangjin | 04cfb90 | 2009-11-06 18:35:33 +0800 | [diff] [blame] | 12 | * Copyright (C) 2009 Lemote Inc. | 
| Wu Zhangjin | f7a904d | 2010-01-04 17:16:51 +0800 | [diff] [blame] | 13 | * Author: Wu Zhangjin, wuzhangjin@gmail.com | 
| Wu Zhangjin | bd92aa0 | 2009-07-02 23:22:36 +0800 | [diff] [blame] | 14 | * | 
|  | 15 | * This program is free software; you can redistribute  it and/or modify it | 
|  | 16 | * under  the terms of  the GNU General  Public License as published by the | 
|  | 17 | * Free Software Foundation;  either version 2 of the  License, or (at your | 
|  | 18 | * option) any later version. | 
|  | 19 | */ | 
| Wu Zhangjin | bd92aa0 | 2009-07-02 23:22:36 +0800 | [diff] [blame] | 20 | #include <asm/bootinfo.h> | 
|  | 21 |  | 
| Wu Zhangjin | 5e983ff | 2009-07-02 23:23:03 +0800 | [diff] [blame] | 22 | #include <loongson.h> | 
|  | 23 |  | 
| Wu Zhangjin | bd92aa0 | 2009-07-02 23:22:36 +0800 | [diff] [blame] | 24 | void __init prom_init_cmdline(void) | 
|  | 25 | { | 
| Wu Zhangjin | 97e6a89 | 2010-01-04 17:16:47 +0800 | [diff] [blame] | 26 | int prom_argc; | 
|  | 27 | /* pmon passes arguments in 32bit pointers */ | 
|  | 28 | int *_prom_argv; | 
| Wu Zhangjin | bd92aa0 | 2009-07-02 23:22:36 +0800 | [diff] [blame] | 29 | int i; | 
|  | 30 | long l; | 
|  | 31 |  | 
|  | 32 | /* firmware arguments are initialized in head.S */ | 
|  | 33 | prom_argc = fw_arg0; | 
|  | 34 | _prom_argv = (int *)fw_arg1; | 
|  | 35 |  | 
|  | 36 | /* arg[0] is "g", the rest is boot parameters */ | 
|  | 37 | arcs_cmdline[0] = '\0'; | 
|  | 38 | for (i = 1; i < prom_argc; i++) { | 
|  | 39 | l = (long)_prom_argv[i]; | 
|  | 40 | if (strlen(arcs_cmdline) + strlen(((char *)l) + 1) | 
|  | 41 | >= sizeof(arcs_cmdline)) | 
|  | 42 | break; | 
|  | 43 | strcat(arcs_cmdline, ((char *)l)); | 
|  | 44 | strcat(arcs_cmdline, " "); | 
|  | 45 | } | 
|  | 46 |  | 
|  | 47 | if ((strstr(arcs_cmdline, "console=")) == NULL) | 
|  | 48 | strcat(arcs_cmdline, " console=ttyS0,115200"); | 
|  | 49 | if ((strstr(arcs_cmdline, "root=")) == NULL) | 
|  | 50 | strcat(arcs_cmdline, " root=/dev/hda1"); | 
| Wu Zhangjin | 04cfb90 | 2009-11-06 18:35:33 +0800 | [diff] [blame] | 51 |  | 
|  | 52 | prom_init_machtype(); | 
| Wu Zhangjin | bd92aa0 | 2009-07-02 23:22:36 +0800 | [diff] [blame] | 53 | } |