1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * cmdline.c: read the command line passed to us by the PROM. 4 * 5 * Copyright (C) 1998 Harald Koerfgen 6 * Copyright (C) 2002, 2004 Maciej W. Rozycki 7 */ 8 #include <linux/init.h> 9 #include <linux/kernel.h> 10 #include <linux/string.h> 11 #include <linux/types.h> 12 13 #include <asm/bootinfo.h> 14 #include <asm/dec/prom.h> 15 16 #undef PROM_DEBUG 17 18 void __init prom_init_cmdline(s32 argc, s32 *argv, u32 magic) 19 { 20 char *arg; 21 int start_arg, i; 22 23 /* 24 * collect args and prepare cmd_line 25 */ 26 if (!prom_is_rex(magic)) 27 start_arg = 1; 28 else 29 start_arg = 2; 30 for (i = start_arg; i < argc; i++) { 31 arg = (void *)(long)(argv[i]); 32 strcat(arcs_cmdline, arg); 33 if (i < (argc - 1)) 34 strcat(arcs_cmdline, " "); 35 } 36 37 #ifdef PROM_DEBUG 38 printk("arcs_cmdline: %s\n", &(arcs_cmdline[0])); 39 #endif 40 } 41