Tue Jun 6 09:56:00 2017 UTC ()
Initialize boot_args before bootstrap for the benefit of platform code.


(jmcneill)
diff -r1.5 -r1.6 src/sys/arch/evbarm/fdt/fdt_machdep.c

cvs diff -r1.5 -r1.6 src/sys/arch/evbarm/fdt/fdt_machdep.c (expand / switch to unified diff)

--- src/sys/arch/evbarm/fdt/fdt_machdep.c 2017/06/06 00:28:05 1.5
+++ src/sys/arch/evbarm/fdt/fdt_machdep.c 2017/06/06 09:56:00 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: fdt_machdep.c,v 1.5 2017/06/06 00:28:05 jmcneill Exp $ */ 1/* $NetBSD: fdt_machdep.c,v 1.6 2017/06/06 09:56:00 jmcneill Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2015-2017 Jared McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2015-2017 Jared McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.5 2017/06/06 00:28:05 jmcneill Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.6 2017/06/06 09:56:00 jmcneill Exp $");
31 31
32#include "opt_machdep.h" 32#include "opt_machdep.h"
33#include "opt_ddb.h" 33#include "opt_ddb.h"
34#include "opt_md.h" 34#include "opt_md.h"
35#include "opt_arm_debug.h" 35#include "opt_arm_debug.h"
36#include "opt_multiprocessor.h" 36#include "opt_multiprocessor.h"
37#include "opt_cpuoptions.h" 37#include "opt_cpuoptions.h"
38 38
39#include <sys/param.h> 39#include <sys/param.h>
40#include <sys/systm.h> 40#include <sys/systm.h>
41#include <sys/bus.h> 41#include <sys/bus.h>
42#include <sys/atomic.h> 42#include <sys/atomic.h>
43#include <sys/cpu.h> 43#include <sys/cpu.h>
@@ -158,42 +158,42 @@ initarm(void *arg) @@ -158,42 +158,42 @@ initarm(void *arg)
158 panic("fdt_check_header failed: %s", fdt_strerror(error)); 158 panic("fdt_check_header failed: %s", fdt_strerror(error));
159 } 159 }
160 160
161 /* Lookup platform specific backend */ 161 /* Lookup platform specific backend */
162 plat = arm_fdt_platform(); 162 plat = arm_fdt_platform();
163 if (plat == NULL) 163 if (plat == NULL)
164 panic("Kernel does not support this device"); 164 panic("Kernel does not support this device");
165 165
166 /* Early console may be available, announce ourselves. */ 166 /* Early console may be available, announce ourselves. */
167 DPRINT("FDT<"); 167 DPRINT("FDT<");
168 DPRINTN((uintptr_t)fdt_addr_r, 16); 168 DPRINTN((uintptr_t)fdt_addr_r, 16);
169 DPRINT(">"); 169 DPRINT(">");
170 170
 171 const int chosen = OF_finddevice("/chosen");
 172 if (chosen >= 0)
 173 OF_getprop(chosen, "bootargs", bootargs, sizeof(bootargs));
 174 boot_args = bootargs;
 175
171 DPRINT(" devmap"); 176 DPRINT(" devmap");
172 pmap_devmap_register(plat->devmap()); 177 pmap_devmap_register(plat->devmap());
173 178
174 DPRINT(" bootstrap"); 179 DPRINT(" bootstrap");
175 plat->bootstrap(); 180 plat->bootstrap();
176 181
177 /* Heads up ... Setup the CPU / MMU / TLB functions. */ 182 /* Heads up ... Setup the CPU / MMU / TLB functions. */
178 DPRINT(" cpufunc"); 183 DPRINT(" cpufunc");
179 if (set_cpufuncs()) 184 if (set_cpufuncs())
180 panic("cpu not recognized!"); 185 panic("cpu not recognized!");
181 186
182 const int chosen = OF_finddevice("/chosen"); 
183 if (chosen >= 0) 
184 OF_getprop(chosen, "bootargs", bootargs, sizeof(bootargs)); 
185 boot_args = bootargs; 
186 
187 /* 187 /*
188 * If stdout-path is specified on the command line, override the 188 * If stdout-path is specified on the command line, override the
189 * value in /chosen/stdout-path before initializing console. 189 * value in /chosen/stdout-path before initializing console.
190 */ 190 */
191 fdt_update_stdout_path(); 191 fdt_update_stdout_path();
192 192
193 DPRINT(" consinit"); 193 DPRINT(" consinit");
194 consinit(); 194 consinit();
195 195
196 DPRINTF(" ok\n"); 196 DPRINTF(" ok\n");
197 197
198 DPRINTF("uboot: args %#x, %#x, %#x, %#x\n", 198 DPRINTF("uboot: args %#x, %#x, %#x, %#x\n",
199 uboot_args[0], uboot_args[1], uboot_args[2], uboot_args[3]); 199 uboot_args[0], uboot_args[1], uboot_args[2], uboot_args[3]);