MIPS: Loongson: PCI: use existing mips_io_port_base
[safe/jmp/linux-2.6] / arch / mips / lemote / lm2e / cmdline.c
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  *
12  * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology
13  * Author: Wu Zhangjin, wuzj@lemote.com
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  */
20 #include <linux/io.h>
21 #include <linux/init.h>
22
23 #include <asm/bootinfo.h>
24
25 int prom_argc;
26 /* pmon passes arguments in 32bit pointers */
27 int *_prom_argv;
28
29 void __init prom_init_cmdline(void)
30 {
31         int i;
32         long l;
33
34         /* firmware arguments are initialized in head.S */
35         prom_argc = fw_arg0;
36         _prom_argv = (int *)fw_arg1;
37
38         /* arg[0] is "g", the rest is boot parameters */
39         arcs_cmdline[0] = '\0';
40         for (i = 1; i < prom_argc; i++) {
41                 l = (long)_prom_argv[i];
42                 if (strlen(arcs_cmdline) + strlen(((char *)l) + 1)
43                     >= sizeof(arcs_cmdline))
44                         break;
45                 strcat(arcs_cmdline, ((char *)l));
46                 strcat(arcs_cmdline, " ");
47         }
48
49         if ((strstr(arcs_cmdline, "console=")) == NULL)
50                 strcat(arcs_cmdline, " console=ttyS0,115200");
51         if ((strstr(arcs_cmdline, "root=")) == NULL)
52                 strcat(arcs_cmdline, " root=/dev/hda1");
53 }