Sun Mar 8 08:26:54 2020 UTC ()
Fix LOCKDEBUG by calling fdtbus_intr_init as part of cpu_startup_hook, i.e.
later.


(skrll)
diff -r1.67 -r1.68 src/sys/arch/evbarm/fdt/fdt_machdep.c
diff -r1.35 -r1.36 src/sys/dev/fdt/fdt_subr.c

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

--- src/sys/arch/evbarm/fdt/fdt_machdep.c 2020/02/16 14:56:52 1.67
+++ src/sys/arch/evbarm/fdt/fdt_machdep.c 2020/03/08 08:26:54 1.68
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: fdt_machdep.c,v 1.67 2020/02/16 14:56:52 thorpej Exp $ */ 1/* $NetBSD: fdt_machdep.c,v 1.68 2020/03/08 08:26:54 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.67 2020/02/16 14:56:52 thorpej Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.68 2020/03/08 08:26:54 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 "ukbd.h" 41#include "ukbd.h"
42#include "wsdisplay.h" 42#include "wsdisplay.h"
43 43
@@ -79,26 +79,27 @@ __KERNEL_RCSID(0, "$NetBSD: fdt_machdep. @@ -79,26 +79,27 @@ __KERNEL_RCSID(0, "$NetBSD: fdt_machdep.
79#include <ddb/db_extern.h> 79#include <ddb/db_extern.h>
80 80
81#include <machine/bootconfig.h> 81#include <machine/bootconfig.h>
82#include <arm/armreg.h> 82#include <arm/armreg.h>
83 83
84#include <arm/cpufunc.h> 84#include <arm/cpufunc.h>
85 85
86#include <evbarm/include/autoconf.h> 86#include <evbarm/include/autoconf.h>
87#include <evbarm/fdt/machdep.h> 87#include <evbarm/fdt/machdep.h>
88#include <evbarm/fdt/platform.h> 88#include <evbarm/fdt/platform.h>
89#include <evbarm/fdt/fdt_memory.h> 89#include <evbarm/fdt/fdt_memory.h>
90 90
91#include <arm/fdt/arm_fdtvar.h> 91#include <arm/fdt/arm_fdtvar.h>
 92#include <dev/fdt/fdt_private.h>
92 93
93#ifdef EFI_RUNTIME 94#ifdef EFI_RUNTIME
94#include <arm/arm/efi_runtime.h> 95#include <arm/arm/efi_runtime.h>
95#endif 96#endif
96 97
97#if NUKBD > 0 98#if NUKBD > 0
98#include <dev/usb/ukbdvar.h> 99#include <dev/usb/ukbdvar.h>
99#endif 100#endif
100#if NWSDISPLAY > 0 101#if NWSDISPLAY > 0
101#include <dev/wscons/wsdisplayvar.h> 102#include <dev/wscons/wsdisplayvar.h>
102#endif 103#endif
103 104
104#ifdef MEMORY_DISK_DYNAMIC 105#ifdef MEMORY_DISK_DYNAMIC
@@ -685,26 +686,28 @@ consinit(void) @@ -685,26 +686,28 @@ consinit(void)
685 686
686 if (plat->ap_uart_freq != NULL) 687 if (plat->ap_uart_freq != NULL)
687 uart_freq = plat->ap_uart_freq(); 688 uart_freq = plat->ap_uart_freq();
688 689
689 cons->consinit(&faa, uart_freq); 690 cons->consinit(&faa, uart_freq);
690 691
691 initialized = true; 692 initialized = true;
692} 693}
693 694
694void 695void
695cpu_startup_hook(void) 696cpu_startup_hook(void)
696{ 697{
697 698
 699 fdtbus_intr_init();
 700
698 fdt_setup_rndseed(); 701 fdt_setup_rndseed();
699} 702}
700 703
701void 704void
702delay(u_int us) 705delay(u_int us)
703{ 706{
704 const struct arm_platform *plat = arm_fdt_platform(); 707 const struct arm_platform *plat = arm_fdt_platform();
705 708
706 plat->ap_delay(us); 709 plat->ap_delay(us);
707} 710}
708 711
709static void 712static void
710fdt_detect_root_device(device_t dev) 713fdt_detect_root_device(device_t dev)

cvs diff -r1.35 -r1.36 src/sys/dev/fdt/fdt_subr.c (expand / switch to unified diff)

--- src/sys/dev/fdt/fdt_subr.c 2020/02/24 12:38:57 1.35
+++ src/sys/dev/fdt/fdt_subr.c 2020/03/08 08:26:54 1.36
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: fdt_subr.c,v 1.35 2020/02/24 12:38:57 rin Exp $ */ 1/* $NetBSD: fdt_subr.c,v 1.36 2020/03/08 08:26:54 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2015 Jared D. 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,54 +17,51 @@ @@ -17,54 +17,51 @@
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_subr.c,v 1.35 2020/02/24 12:38:57 rin Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.36 2020/03/08 08:26:54 skrll Exp $");
31 31
32#include "opt_fdt.h" 32#include "opt_fdt.h"
33 33
34#include <sys/param.h> 34#include <sys/param.h>
35#include <sys/bus.h> 35#include <sys/bus.h>
36 36
37#include <libfdt.h> 37#include <libfdt.h>
38#include <dev/fdt/fdtvar.h> 38#include <dev/fdt/fdtvar.h>
39#include <dev/fdt/fdt_private.h> 39#include <dev/fdt/fdt_private.h>
40 40
41static const void *fdt_data; 41static const void *fdt_data;
42 42
43static struct fdt_conslist fdt_console_list = 43static struct fdt_conslist fdt_console_list =
44 TAILQ_HEAD_INITIALIZER(fdt_console_list); 44 TAILQ_HEAD_INITIALIZER(fdt_console_list);
45 45
46bool 46bool
47fdtbus_init(const void *data) 47fdtbus_init(const void *data)
48{ 48{
49 KASSERT(fdt_data == NULL); 49 KASSERT(fdt_data == NULL);
50 if (fdt_check_header(data) != 0) { 50 if (fdt_check_header(data) != 0) {
51 return false; 51 return false;
52 } 52 }
53 fdt_data = data; 53 fdt_data = data;
54 54
55 /* Now that we have a FDT blob, initialize other bits that need it. */ 
56 fdtbus_intr_init(); 
57 
58 return true; 55 return true;
59} 56}
60 57
61const void * 58const void *
62fdtbus_get_data(void) 59fdtbus_get_data(void)
63{ 60{
64 return fdt_data; 61 return fdt_data;
65} 62}
66 63
67int 64int
68fdtbus_offset2phandle(int offset) 65fdtbus_offset2phandle(int offset)
69{ 66{
70 if (offset < 0) 67 if (offset < 0)