Tue Nov 24 06:36:36 2020 UTC ()
Simplify.  NFCI.


(skrll)
diff -r1.78 -r1.79 src/sys/arch/evbarm/fdt/fdt_machdep.c

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

--- src/sys/arch/evbarm/fdt/fdt_machdep.c 2020/11/07 08:28:15 1.78
+++ src/sys/arch/evbarm/fdt/fdt_machdep.c 2020/11/24 06:36:36 1.79
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: fdt_machdep.c,v 1.78 2020/11/07 08:28:15 skrll Exp $ */ 1/* $NetBSD: fdt_machdep.c,v 1.79 2020/11/24 06:36:36 skrll 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.78 2020/11/07 08:28:15 skrll Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.79 2020/11/24 06:36:36 skrll Exp $");
31 31
32#include "opt_machdep.h" 32#include "opt_machdep.h"
33#include "opt_bootconfig.h" 33#include "opt_bootconfig.h"
34#include "opt_ddb.h" 34#include "opt_ddb.h"
35#include "opt_md.h" 35#include "opt_md.h"
36#include "opt_arm_debug.h" 36#include "opt_arm_debug.h"
37#include "opt_multiprocessor.h" 37#include "opt_multiprocessor.h"
38#include "opt_cpuoptions.h" 38#include "opt_cpuoptions.h"
39#include "opt_efi.h" 39#include "opt_efi.h"
40 40
41#include "genfb.h" 41#include "genfb.h"
42#include "ukbd.h" 42#include "ukbd.h"
43#include "wsdisplay.h" 43#include "wsdisplay.h"
@@ -524,37 +524,37 @@ fdt_map_efi_runtime(const char *prop, en @@ -524,37 +524,37 @@ fdt_map_efi_runtime(const char *prop, en
524#endif 524#endif
525 525
526vaddr_t 526vaddr_t
527initarm(void *arg) 527initarm(void *arg)
528{ 528{
529 const struct arm_platform *plat; 529 const struct arm_platform *plat;
530 uint64_t memory_start, memory_end; 530 uint64_t memory_start, memory_end;
531 531
532 /* set temporally to work printf()/panic() even before consinit() */ 532 /* set temporally to work printf()/panic() even before consinit() */
533 cn_tab = &earlycons; 533 cn_tab = &earlycons;
534 534
535 /* Load FDT */ 535 /* Load FDT */
536 int error = fdt_check_header(fdt_addr_r); 536 int error = fdt_check_header(fdt_addr_r);
537 if (error == 0) { 537 if (error != 0)
538 /* If the DTB is too big, try to pack it in place first. */ 
539 if (fdt_totalsize(fdt_addr_r) > sizeof(fdt_data)) 
540 (void)fdt_pack(__UNCONST(fdt_addr_r)); 
541 error = fdt_open_into(fdt_addr_r, fdt_data, sizeof(fdt_data)); 
542 if (error != 0) 
543 panic("fdt_move failed: %s", fdt_strerror(error)); 
544 fdtbus_init(fdt_data); 
545 } else { 
546 panic("fdt_check_header failed: %s", fdt_strerror(error)); 538 panic("fdt_check_header failed: %s", fdt_strerror(error));
547 } 539
 540 /* If the DTB is too big, try to pack it in place first. */
 541 if (fdt_totalsize(fdt_addr_r) > sizeof(fdt_data))
 542 (void)fdt_pack(__UNCONST(fdt_addr_r));
 543 error = fdt_open_into(fdt_addr_r, fdt_data, sizeof(fdt_data));
 544 if (error != 0)
 545 panic("fdt_move failed: %s", fdt_strerror(error));
 546
 547 fdtbus_init(fdt_data);
548 548
549 /* Lookup platform specific backend */ 549 /* Lookup platform specific backend */
550 plat = arm_fdt_platform(); 550 plat = arm_fdt_platform();
551 if (plat == NULL) 551 if (plat == NULL)
552 panic("Kernel does not support this device"); 552 panic("Kernel does not support this device");
553 553
554 /* Early console may be available, announce ourselves. */ 554 /* Early console may be available, announce ourselves. */
555 VPRINTF("FDT<%p>\n", fdt_addr_r); 555 VPRINTF("FDT<%p>\n", fdt_addr_r);
556 556
557 const int chosen = OF_finddevice("/chosen"); 557 const int chosen = OF_finddevice("/chosen");
558 if (chosen >= 0) 558 if (chosen >= 0)
559 OF_getprop(chosen, "bootargs", bootargs, sizeof(bootargs)); 559 OF_getprop(chosen, "bootargs", bootargs, sizeof(bootargs));
560 boot_args = bootargs; 560 boot_args = bootargs;