David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Based on Ocelot Linux port, which is |
| 4 | * Copyright 2001 MontaVista Software Inc. |
| 5 | * Author: jsun@mvista.com or jsun@junsun.net |
| 6 | * |
| 7 | * Copyright 2003 ICT CAS |
| 8 | * Author: Michael Guo <guoyi@ict.ac.cn> |
| 9 | * |
| 10 | * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology |
| 11 | * Author: Fuxin Zhang, zhangfx@lemote.com |
| 12 | * |
| 13 | * Copyright (C) 2009 Lemote Inc. |
| 14 | * Author: Wu Zhangjin, wuzhangjin@gmail.com |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 15 | */ |
| 16 | #include <asm/bootinfo.h> |
| 17 | |
| 18 | #include <loongson.h> |
| 19 | |
| 20 | void __init prom_init_cmdline(void) |
| 21 | { |
| 22 | int prom_argc; |
| 23 | /* pmon passes arguments in 32bit pointers */ |
| 24 | int *_prom_argv; |
| 25 | int i; |
| 26 | long l; |
| 27 | |
| 28 | /* firmware arguments are initialized in head.S */ |
| 29 | prom_argc = fw_arg0; |
| 30 | _prom_argv = (int *)fw_arg1; |
| 31 | |
| 32 | /* arg[0] is "g", the rest is boot parameters */ |
| 33 | arcs_cmdline[0] = '\0'; |
| 34 | for (i = 1; i < prom_argc; i++) { |
| 35 | l = (long)_prom_argv[i]; |
| 36 | if (strlen(arcs_cmdline) + strlen(((char *)l) + 1) |
| 37 | >= sizeof(arcs_cmdline)) |
| 38 | break; |
| 39 | strcat(arcs_cmdline, ((char *)l)); |
| 40 | strcat(arcs_cmdline, " "); |
| 41 | } |
| 42 | |
| 43 | prom_init_machtype(); |
| 44 | } |