Fri Apr 7 08:55:31 2023 UTC ()
Rename ARM_PLATFORM to FDT_PLATFORM and make it available outside arm.


(skrll)
diff -r1.66 -r1.67 src/sys/arch/aarch64/aarch64/aarch64_machdep.c
diff -r1.35 -r1.36 src/sys/arch/arm/acpi/acpi_platform.c
diff -r1.18 -r1.19 src/sys/arch/arm/altera/cycv_platform.c
diff -r1.20 -r1.21 src/sys/arch/arm/amlogic/meson_platform.c
diff -r1.5 -r1.6 src/sys/arch/arm/apple/apple_platform.c
diff -r1.145 -r1.146 src/sys/arch/arm/arm32/arm32_machdep.c
diff -r1.48 -r1.49 src/sys/arch/arm/broadcom/bcm283x_platform.c
diff -r1.20 -r1.21 src/sys/arch/arm/fdt/arm_fdt.c
diff -r1.19 -r1.20 src/sys/arch/arm/fdt/arm_fdtvar.h
diff -r1.6 -r1.7 src/sys/arch/arm/fdt/arm_platform.c
diff -r1.27 -r1.28 src/sys/arch/arm/nvidia/tegra_platform.c
diff -r1.6 -r1.7 src/sys/arch/arm/nxp/imx6_platform.c
diff -r1.16 -r1.17 src/sys/arch/arm/rockchip/rk_platform.c
diff -r1.39 -r1.40 src/sys/arch/arm/samsung/exynos_platform.c
diff -r1.46 -r1.47 src/sys/arch/arm/sunxi/sunxi_platform.c
diff -r1.3 -r1.4 src/sys/arch/arm/ti/am3_platform.c
diff -r1.7 -r1.8 src/sys/arch/arm/ti/omap3_platform.c
diff -r1.22 -r1.23 src/sys/arch/arm/vexpress/vexpress_platform.c
diff -r1.10 -r1.11 src/sys/arch/arm/xilinx/zynq_platform.c
diff -r1.2 -r1.3 src/sys/arch/evbarm/fdt/fdt_bus_machdep.c
diff -r1.101 -r1.102 src/sys/arch/evbarm/fdt/fdt_machdep.c
diff -r0 -r1.1 src/sys/dev/fdt/fdt_platform.c
diff -r1.77 -r1.78 src/sys/dev/fdt/fdtvar.h
diff -r1.66 -r1.67 src/sys/dev/fdt/files.fdt

cvs diff -r1.66 -r1.67 src/sys/arch/aarch64/aarch64/aarch64_machdep.c (expand / switch to unified diff)

--- src/sys/arch/aarch64/aarch64/aarch64_machdep.c 2022/08/19 08:17:32 1.66
+++ src/sys/arch/aarch64/aarch64/aarch64_machdep.c 2023/04/07 08:55:29 1.67
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: aarch64_machdep.c,v 1.66 2022/08/19 08:17:32 ryo Exp $ */ 1/* $NetBSD: aarch64_machdep.c,v 1.67 2023/04/07 08:55:29 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc. 4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry. 8 * by Matt Thomas of 3am Software Foundry.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.66 2022/08/19 08:17:32 ryo Exp $"); 33__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.67 2023/04/07 08:55:29 skrll Exp $");
34 34
35#include "opt_arm_debug.h" 35#include "opt_arm_debug.h"
36#include "opt_cpuoptions.h" 36#include "opt_cpuoptions.h"
37#include "opt_ddb.h" 37#include "opt_ddb.h"
38#include "opt_fdt.h" 38#include "opt_fdt.h"
39#include "opt_kernhist.h" 39#include "opt_kernhist.h"
40#include "opt_modular.h" 40#include "opt_modular.h"
41 41
42#include <sys/param.h> 42#include <sys/param.h>
43#include <sys/types.h> 43#include <sys/types.h>
44#include <sys/asan.h> 44#include <sys/asan.h>
45#include <sys/boot_flag.h> 45#include <sys/boot_flag.h>
46#include <sys/bus.h> 46#include <sys/bus.h>
@@ -64,26 +64,27 @@ __KERNEL_RCSID(1, "$NetBSD: aarch64_mach @@ -64,26 +64,27 @@ __KERNEL_RCSID(1, "$NetBSD: aarch64_mach
64 64
65#include <aarch64/armreg.h> 65#include <aarch64/armreg.h>
66#ifdef DDB 66#ifdef DDB
67#include <aarch64/db_machdep.h> 67#include <aarch64/db_machdep.h>
68#endif 68#endif
69#include <aarch64/frame.h> 69#include <aarch64/frame.h>
70#include <aarch64/machdep.h> 70#include <aarch64/machdep.h>
71#include <aarch64/pmap.h> 71#include <aarch64/pmap.h>
72#include <aarch64/pte.h> 72#include <aarch64/pte.h>
73#include <aarch64/vmparam.h> 73#include <aarch64/vmparam.h>
74#include <aarch64/kcore.h> 74#include <aarch64/kcore.h>
75 75
76#include <arm/fdt/arm_fdtvar.h> 76#include <arm/fdt/arm_fdtvar.h>
 77#include <dev/fdt/fdtvar.h>
77#include <dev/fdt/fdt_memory.h> 78#include <dev/fdt/fdt_memory.h>
78 79
79#ifdef VERBOSE_INIT_ARM 80#ifdef VERBOSE_INIT_ARM
80#define VPRINTF(...) printf(__VA_ARGS__) 81#define VPRINTF(...) printf(__VA_ARGS__)
81#else 82#else
82#define VPRINTF(...) __nothing 83#define VPRINTF(...) __nothing
83#endif 84#endif
84 85
85char cpu_model[32]; 86char cpu_model[32];
86char machine[] = MACHINE; 87char machine[] = MACHINE;
87char machine_arch[] = MACHINE_ARCH; 88char machine_arch[] = MACHINE_ARCH;
88 89
89const pcu_ops_t * const pcu_ops_md_defs[PCU_UNIT_COUNT] = { 90const pcu_ops_t * const pcu_ops_md_defs[PCU_UNIT_COUNT] = {
@@ -667,29 +668,29 @@ mm_md_kernacc(void *ptr, vm_prot_t prot, @@ -667,29 +668,29 @@ mm_md_kernacc(void *ptr, vm_prot_t prot,
667 } 668 }
668 return 0; 669 return 0;
669} 670}
670#endif 671#endif
671 672
672void 673void
673cpu_startup(void) 674cpu_startup(void)
674{ 675{
675 vaddr_t maxaddr, minaddr; 676 vaddr_t maxaddr, minaddr;
676 677
677 consinit(); 678 consinit();
678 679
679#ifdef FDT 680#ifdef FDT
680 const struct arm_platform * const plat = arm_fdt_platform(); 681 const struct fdt_platform * const plat = fdt_platform_find();
681 if (plat->ap_startup != NULL) 682 if (plat->fp_startup != NULL)
682 plat->ap_startup(); 683 plat->fp_startup();
683#endif 684#endif
684 685
685 /* 686 /*
686 * Allocate a submap for physio. 687 * Allocate a submap for physio.
687 */ 688 */
688 minaddr = 0; 689 minaddr = 0;
689 phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr, 690 phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
690 VM_PHYS_SIZE, 0, FALSE, NULL); 691 VM_PHYS_SIZE, 0, FALSE, NULL);
691 692
692#ifdef MODULAR 693#ifdef MODULAR
693 uvm_map_setup(&module_map_store, module_start, module_end, 0); 694 uvm_map_setup(&module_map_store, module_start, module_end, 0);
694 module_map_store.pmap = pmap_kernel(); 695 module_map_store.pmap = pmap_kernel();
695 module_map = &module_map_store; 696 module_map = &module_map_store;

cvs diff -r1.35 -r1.36 src/sys/arch/arm/acpi/acpi_platform.c (expand / switch to unified diff)

--- src/sys/arch/arm/acpi/acpi_platform.c 2023/01/24 06:56:40 1.35
+++ src/sys/arch/arm/acpi/acpi_platform.c 2023/04/07 08:55:29 1.36
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: acpi_platform.c,v 1.35 2023/01/24 06:56:40 mlelstv Exp $ */ 1/* $NetBSD: acpi_platform.c,v 1.36 2023/04/07 08:55:29 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2018 The NetBSD Foundation, Inc. 4 * Copyright (c) 2018 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jared McNeill <jmcneill@invisible.ca>. 8 * by Jared McNeill <jmcneill@invisible.ca>.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -25,37 +25,36 @@ @@ -25,37 +25,36 @@
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include "com.h" 32#include "com.h"
33#include "plcom.h" 33#include "plcom.h"
34#include "opt_efi.h" 34#include "opt_efi.h"
35#include "opt_multiprocessor.h" 35#include "opt_multiprocessor.h"
36 36
37#include <sys/cdefs.h> 37#include <sys/cdefs.h>
38__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.35 2023/01/24 06:56:40 mlelstv Exp $"); 38__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.36 2023/04/07 08:55:29 skrll Exp $");
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/bus.h> 41#include <sys/bus.h>
42#include <sys/cpu.h> 42#include <sys/cpu.h>
43#include <sys/device.h> 43#include <sys/device.h>
44#include <sys/termios.h> 44#include <sys/termios.h>
45#include <sys/kprintf.h> 45#include <sys/kprintf.h>
46 46
47#include <dev/fdt/fdtvar.h> 47#include <dev/fdt/fdtvar.h>
48#include <arm/fdt/arm_fdtvar.h> 
49 48
50#include <uvm/uvm_extern.h> 49#include <uvm/uvm_extern.h>
51 50
52#include <machine/bootconfig.h> 51#include <machine/bootconfig.h>
53#include <arm/cpufunc.h> 52#include <arm/cpufunc.h>
54#include <arm/locore.h> 53#include <arm/locore.h>
55 54
56#include <arm/cortex/gtmr_var.h> 55#include <arm/cortex/gtmr_var.h>
57 56
58#include <arm/arm/smccc.h> 57#include <arm/arm/smccc.h>
59#include <arm/arm/psci.h> 58#include <arm/arm/psci.h>
60#include <arm/fdt/psci_fdtvar.h> 59#include <arm/fdt/psci_fdtvar.h>
61 60
@@ -398,25 +397,25 @@ acpi_platform_reset(void) @@ -398,25 +397,25 @@ acpi_platform_reset(void)
398 if (arm_efirt_reset(EFI_RESET_COLD) == 0) 397 if (arm_efirt_reset(EFI_RESET_COLD) == 0)
399 return; 398 return;
400#endif 399#endif
401 if (psci_available()) 400 if (psci_available())
402 psci_system_reset(); 401 psci_system_reset();
403} 402}
404 403
405static u_int 404static u_int
406acpi_platform_uart_freq(void) 405acpi_platform_uart_freq(void)
407{ 406{
408 return 0; 407 return 0;
409} 408}
410 409
411static const struct arm_platform acpi_platform = { 410static const struct fdt_platform acpi_platform = {
412 .ap_devmap = acpi_platform_devmap, 411 .fp_devmap = acpi_platform_devmap,
413 .ap_bootstrap = acpi_platform_bootstrap, 412 .fp_bootstrap = acpi_platform_bootstrap,
414 .ap_startup = acpi_platform_startup, 413 .fp_startup = acpi_platform_startup,
415 .ap_init_attach_args = acpi_platform_init_attach_args, 414 .fp_init_attach_args = acpi_platform_init_attach_args,
416 .ap_device_register = acpi_platform_device_register, 415 .fp_device_register = acpi_platform_device_register,
417 .ap_reset = acpi_platform_reset, 416 .fp_reset = acpi_platform_reset,
418 .ap_delay = gtmr_delay, 417 .fp_delay = gtmr_delay,
419 .ap_uart_freq = acpi_platform_uart_freq, 418 .fp_uart_freq = acpi_platform_uart_freq,
420}; 419};
421 420
422ARM_PLATFORM(acpi, "netbsd,generic-acpi", &acpi_platform); 421FDT_PLATFORM(acpi, "netbsd,generic-acpi", &acpi_platform);

cvs diff -r1.18 -r1.19 src/sys/arch/arm/altera/cycv_platform.c (expand / switch to unified diff)

--- src/sys/arch/arm/altera/cycv_platform.c 2021/04/24 23:36:25 1.18
+++ src/sys/arch/arm/altera/cycv_platform.c 2023/04/07 08:55:29 1.19
@@ -1,45 +1,46 @@ @@ -1,45 +1,46 @@
1/* $NetBSD: cycv_platform.c,v 1.18 2021/04/24 23:36:25 thorpej Exp $ */ 1/* $NetBSD: cycv_platform.c,v 1.19 2023/04/07 08:55:29 skrll Exp $ */
2 2
3/* This file is in the public domain. */ 3/* This file is in the public domain. */
4 4
5#include "arml2cc.h" 5#include "arml2cc.h"
6#include "opt_console.h" 6#include "opt_console.h"
7#include "opt_multiprocessor.h" 7#include "opt_multiprocessor.h"
8 8
9#include <sys/cdefs.h> 9#include <sys/cdefs.h>
10__KERNEL_RCSID(0, "$NetBSD: cycv_platform.c,v 1.18 2021/04/24 23:36:25 thorpej Exp $"); 10__KERNEL_RCSID(0, "$NetBSD: cycv_platform.c,v 1.19 2023/04/07 08:55:29 skrll Exp $");
11 11
12#define _ARM32_BUS_DMA_PRIVATE 12#define _ARM32_BUS_DMA_PRIVATE
13#include <sys/param.h> 13#include <sys/param.h>
14#include <sys/bus.h> 14#include <sys/bus.h>
15#include <sys/cpu.h> 15#include <sys/cpu.h>
16#include <sys/device.h> 16#include <sys/device.h>
17 17
18#include <uvm/uvm_extern.h> 18#include <uvm/uvm_extern.h>
19 19
20#include <arm/arm32/machdep.h> 20#include <arm/arm32/machdep.h>
21 21
22#include <arm/altera/cycv_reg.h> 22#include <arm/altera/cycv_reg.h>
23#include <arm/altera/cycv_var.h> 23#include <arm/altera/cycv_var.h>
24#include <arm/cortex/a9tmr_var.h> 24#include <arm/cortex/a9tmr_var.h>
25#include <arm/cortex/pl310_var.h> 25#include <arm/cortex/pl310_var.h>
26#include <arm/cortex/scu_reg.h> 26#include <arm/cortex/scu_reg.h>
27 27
28#include <arm/bootconfig.h> 28#include <arm/bootconfig.h>
29#include <arm/cpufunc.h> 29#include <arm/cpufunc.h>
30 30
31#include <arm/fdt/arm_fdtvar.h> 
32#include <dev/fdt/fdtvar.h> 31#include <dev/fdt/fdtvar.h>
 32
 33#include <arm/fdt/arm_fdtvar.h>
33#include <dev/ic/comreg.h> 34#include <dev/ic/comreg.h>
34 35
35void cycv_platform_early_putchar(char); 36void cycv_platform_early_putchar(char);
36 37
37void __noasan 38void __noasan
38cycv_platform_early_putchar(char c) { 39cycv_platform_early_putchar(char c) {
39#ifdef CONSADDR 40#ifdef CONSADDR
40#define CONSADDR_VA (CONSADDR - CYCV_PERIPHERAL_BASE + CYCV_PERIPHERAL_VBASE) 41#define CONSADDR_VA (CONSADDR - CYCV_PERIPHERAL_BASE + CYCV_PERIPHERAL_VBASE)
41 volatile uint32_t *uartaddr = cpu_earlydevice_va_p() ? 42 volatile uint32_t *uartaddr = cpu_earlydevice_va_p() ?
42 (volatile uint32_t *) CONSADDR_VA : 43 (volatile uint32_t *) CONSADDR_VA :
43 (volatile uint32_t *) CONSADDR; 44 (volatile uint32_t *) CONSADDR;
44 45
45 while ((le32toh(uartaddr[com_lsr]) & LSR_TXRDY) == 0) 46 while ((le32toh(uartaddr[com_lsr]) & LSR_TXRDY) == 0)
@@ -154,25 +155,25 @@ cycv_platform_reset(void) { @@ -154,25 +155,25 @@ cycv_platform_reset(void) {
154 uint32_t val; 155 uint32_t val;
155 156
156 bus_space_map(bst, CYCV_RSTMGR_BASE, CYCV_RSTMGR_SIZE, 0, &bsh); 157 bus_space_map(bst, CYCV_RSTMGR_BASE, CYCV_RSTMGR_SIZE, 0, &bsh);
157 val = bus_space_read_4(bst, bsh, CYCV_RSTMGR_CTRL); 158 val = bus_space_read_4(bst, bsh, CYCV_RSTMGR_CTRL);
158 bus_space_write_4(bst, bsh, CYCV_RSTMGR_CTRL, 159 bus_space_write_4(bst, bsh, CYCV_RSTMGR_CTRL,
159 val | CYCV_RSTMGR_CTRL_SWCOLDRSTREQ); 160 val | CYCV_RSTMGR_CTRL_SWCOLDRSTREQ);
160} 161}
161 162
162static u_int 163static u_int
163cycv_platform_uart_freq(void) { 164cycv_platform_uart_freq(void) {
164 return cycv_clkmgr_early_get_l4_sp_clk(); 165 return cycv_clkmgr_early_get_l4_sp_clk();
165} 166}
166 167
167static const struct arm_platform cycv_platform = { 168static const struct fdt_platform cycv_platform = {
168 .ap_devmap = cycv_platform_devmap, 169 .fp_devmap = cycv_platform_devmap,
169 .ap_bootstrap = cycv_platform_bootstrap, 170 .fp_bootstrap = cycv_platform_bootstrap,
170 .ap_init_attach_args = cycv_platform_init_attach_args, 171 .fp_init_attach_args = cycv_platform_init_attach_args,
171 .ap_device_register = cycv_platform_device_register, 172 .fp_device_register = cycv_platform_device_register,
172 .ap_reset = cycv_platform_reset, 173 .fp_reset = cycv_platform_reset,
173 .ap_delay = a9tmr_delay, 174 .fp_delay = a9tmr_delay,
174 .ap_uart_freq = cycv_platform_uart_freq, 175 .fp_uart_freq = cycv_platform_uart_freq,
175 .ap_mpstart = cycv_mpstart, 176 .fp_mpstart = cycv_mpstart,
176}; 177};
177 178
178ARM_PLATFORM(cycv, "altr,socfpga-cyclone5", &cycv_platform); 179FDT_PLATFORM(cycv, "altr,socfpga-cyclone5", &cycv_platform);

cvs diff -r1.20 -r1.21 src/sys/arch/arm/amlogic/meson_platform.c (expand / switch to unified diff)

--- src/sys/arch/arm/amlogic/meson_platform.c 2021/04/24 23:36:26 1.20
+++ src/sys/arch/arm/amlogic/meson_platform.c 2023/04/07 08:55:29 1.21
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: meson_platform.c,v 1.20 2021/04/24 23:36:26 thorpej Exp $ */ 1/* $NetBSD: meson_platform.c,v 1.21 2023/04/07 08:55:29 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2019 Jared McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2019 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.
@@ -23,35 +23,36 @@ @@ -23,35 +23,36 @@
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 "opt_soc.h" 29#include "opt_soc.h"
30#include "opt_multiprocessor.h" 30#include "opt_multiprocessor.h"
31#include "opt_console.h" 31#include "opt_console.h"
32 32
33#include "arml2cc.h" 33#include "arml2cc.h"
34 34
35#include <sys/cdefs.h> 35#include <sys/cdefs.h>
36__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.20 2021/04/24 23:36:26 thorpej Exp $"); 36__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.21 2023/04/07 08:55:29 skrll Exp $");
37 37
38#include <sys/param.h> 38#include <sys/param.h>
39#include <sys/bus.h> 39#include <sys/bus.h>
40#include <sys/cpu.h> 40#include <sys/cpu.h>
41#include <sys/device.h> 41#include <sys/device.h>
42#include <sys/termios.h> 42#include <sys/termios.h>
43 43
44#include <dev/fdt/fdtvar.h> 44#include <dev/fdt/fdtvar.h>
 45
45#include <arm/fdt/arm_fdtvar.h> 46#include <arm/fdt/arm_fdtvar.h>
46 47
47#include <uvm/uvm_extern.h> 48#include <uvm/uvm_extern.h>
48 49
49#include <machine/bootconfig.h> 50#include <machine/bootconfig.h>
50#include <arm/cpufunc.h> 51#include <arm/cpufunc.h>
51 52
52#include <arm/cortex/a9tmr_var.h> 53#include <arm/cortex/a9tmr_var.h>
53#include <arm/cortex/gtmr_var.h> 54#include <arm/cortex/gtmr_var.h>
54#include <arm/cortex/pl310_var.h> 55#include <arm/cortex/pl310_var.h>
55#include <arm/cortex/scu_reg.h> 56#include <arm/cortex/scu_reg.h>
56 57
57#include <arm/amlogic/meson_uart.h> 58#include <arm/amlogic/meson_uart.h>
@@ -430,69 +431,69 @@ meson8b_mpstart(void) @@ -430,69 +431,69 @@ meson8b_mpstart(void)
430 */ 431 */
431 bus_space_write_4(bst, scu_bsh, SCU_INV_ALL_REG, 0xffff); 432 bus_space_write_4(bst, scu_bsh, SCU_INV_ALL_REG, 0xffff);
432 433
433 uint32_t scu_ctl = bus_space_read_4(bst, scu_bsh, SCU_CTL); 434 uint32_t scu_ctl = bus_space_read_4(bst, scu_bsh, SCU_CTL);
434 scu_ctl |= SCU_CTL_SCU_ENA; 435 scu_ctl |= SCU_CTL_SCU_ENA;
435 bus_space_write_4(bst, scu_bsh, SCU_CTL, scu_ctl); 436 bus_space_write_4(bst, scu_bsh, SCU_CTL, scu_ctl);
436 437
437 armv7_dcache_wbinv_all(); 438 armv7_dcache_wbinv_all();
438 439
439 ret = arm_fdt_cpu_mpstart(); 440 ret = arm_fdt_cpu_mpstart();
440 return ret; 441 return ret;
441} 442}
442 443
443static const struct arm_platform meson8b_platform = { 444static const struct fdt_platform meson8b_platform = {
444 .ap_devmap = meson_platform_devmap, 445 .fp_devmap = meson_platform_devmap,
445 .ap_bootstrap = meson8b_platform_bootstrap, 446 .fp_bootstrap = meson8b_platform_bootstrap,
446 .ap_init_attach_args = meson_platform_init_attach_args, 447 .fp_init_attach_args = meson_platform_init_attach_args,
447 .ap_device_register = meson8b_platform_device_register, 448 .fp_device_register = meson8b_platform_device_register,
448 .ap_reset = meson8b_platform_reset, 449 .fp_reset = meson8b_platform_reset,
449 .ap_delay = a9ptmr_delay, 450 .fp_delay = a9ptmr_delay,
450 .ap_uart_freq = meson_platform_uart_freq, 451 .fp_uart_freq = meson_platform_uart_freq,
451 .ap_mpstart = meson8b_mpstart, 452 .fp_mpstart = meson8b_mpstart,
452}; 453};
453 454
454ARM_PLATFORM(meson8b, "amlogic,meson8b", &meson8b_platform); 455FDT_PLATFORM(meson8b, "amlogic,meson8b", &meson8b_platform);
455#endif /* SOC_MESON8B */ 456#endif /* SOC_MESON8B */
456 457
457#if defined(SOC_MESONGX) 458#if defined(SOC_MESONGX)
458static void 459static void
459mesongx_platform_reset(void) 460mesongx_platform_reset(void)
460{ 461{
461 bus_space_tag_t bst = &meson_bs_tag; 462 bus_space_tag_t bst = &meson_bs_tag;
462 bus_space_handle_t bsh; 463 bus_space_handle_t bsh;
463 uint32_t val; 464 uint32_t val;
464 465
465 bus_space_map(bst, MESONGX_WATCHDOG_BASE, MESONGX_WATCHDOG_SIZE, 0, &bsh); 466 bus_space_map(bst, MESONGX_WATCHDOG_BASE, MESONGX_WATCHDOG_SIZE, 0, &bsh);
466 467
467 val = MESONGX_WATCHDOG_CNTL_SYS_RESET_N_EN | 468 val = MESONGX_WATCHDOG_CNTL_SYS_RESET_N_EN |
468 MESONGX_WATCHDOG_CNTL_WDOG_EN | 469 MESONGX_WATCHDOG_CNTL_WDOG_EN |
469 MESONGX_WATCHDOG_CNTL_CLK_EN; 470 MESONGX_WATCHDOG_CNTL_CLK_EN;
470 bus_space_write_4(bst, bsh, MESONGX_WATCHDOG_CNTL, val); 471 bus_space_write_4(bst, bsh, MESONGX_WATCHDOG_CNTL, val);
471 472
472 bus_space_write_4(bst, bsh, MESONGX_WATCHDOG_TCNT, 1); 473 bus_space_write_4(bst, bsh, MESONGX_WATCHDOG_TCNT, 1);
473 474
474 bus_space_write_4(bst, bsh, MESONGX_WATCHDOG_RESET, 0); 475 bus_space_write_4(bst, bsh, MESONGX_WATCHDOG_RESET, 0);
475 476
476 for (;;) { 477 for (;;) {
477 __asm("wfi"); 478 __asm("wfi");
478 } 479 }
479} 480}
480 481
481static const struct arm_platform mesongx_platform = { 482static const struct fdt_platform mesongx_platform = {
482 .ap_devmap = meson_platform_devmap, 483 .fp_devmap = meson_platform_devmap,
483 .ap_bootstrap = meson_platform_bootstrap, 484 .fp_bootstrap = meson_platform_bootstrap,
484 .ap_init_attach_args = meson_platform_init_attach_args, 485 .fp_init_attach_args = meson_platform_init_attach_args,
485 .ap_device_register = meson_platform_device_register, 486 .fp_device_register = meson_platform_device_register,
486 .ap_reset = mesongx_platform_reset, 487 .fp_reset = mesongx_platform_reset,
487 .ap_delay = gtmr_delay, 488 .fp_delay = gtmr_delay,
488 .ap_uart_freq = meson_platform_uart_freq, 489 .fp_uart_freq = meson_platform_uart_freq,
489 .ap_mpstart = arm_fdt_cpu_mpstart, 490 .fp_mpstart = arm_fdt_cpu_mpstart,
490}; 491};
491 492
492#if defined(SOC_MESONGXBB) 493#if defined(SOC_MESONGXBB)
493ARM_PLATFORM(mesongxbb, "amlogic,meson-gxbb", &mesongx_platform); 494FDT_PLATFORM(mesongxbb, "amlogic,meson-gxbb", &mesongx_platform);
494#endif /* SOC_MESONGXBB */ 495#endif /* SOC_MESONGXBB */
495#if defined(SOC_MESONGXL) 496#if defined(SOC_MESONGXL)
496ARM_PLATFORM(mesongxl, "amlogic,meson-gxl", &mesongx_platform); 497FDT_PLATFORM(mesongxl, "amlogic,meson-gxl", &mesongx_platform);
497#endif /* SOC_MESONGXL */ 498#endif /* SOC_MESONGXL */
498#endif /* SOC_MESONGX */ 499#endif /* SOC_MESONGX */

cvs diff -r1.5 -r1.6 src/sys/arch/arm/apple/apple_platform.c (expand / switch to unified diff)

--- src/sys/arch/arm/apple/apple_platform.c 2022/10/15 11:07:38 1.5
+++ src/sys/arch/arm/apple/apple_platform.c 2023/04/07 08:55:29 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: apple_platform.c,v 1.5 2022/10/15 11:07:38 jmcneill Exp $ */ 1/* $NetBSD: apple_platform.c,v 1.6 2023/04/07 08:55:29 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2021 Jared McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2021 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,35 +17,36 @@ @@ -17,35 +17,36 @@
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: apple_platform.c,v 1.5 2022/10/15 11:07:38 jmcneill Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: apple_platform.c,v 1.6 2023/04/07 08:55:29 skrll Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/bus.h> 33#include <sys/bus.h>
34#include <sys/cpu.h> 34#include <sys/cpu.h>
35#include <sys/device.h> 35#include <sys/device.h>
36#include <sys/termios.h> 36#include <sys/termios.h>
37 37
38#include <dev/fdt/fdtvar.h> 38#include <dev/fdt/fdtvar.h>
 39
39#include <arm/fdt/arm_fdtvar.h> 40#include <arm/fdt/arm_fdtvar.h>
40 41
41#include <uvm/uvm_extern.h> 42#include <uvm/uvm_extern.h>
42 43
43#include <machine/bootconfig.h> 44#include <machine/bootconfig.h>
44 45
45#include <net/if_ether.h> 46#include <net/if_ether.h>
46 47
47#include <dev/pci/pcivar.h> 48#include <dev/pci/pcivar.h>
48#include <machine/pci_machdep.h> 49#include <machine/pci_machdep.h>
49 50
50#include <arm/cpufunc.h> 51#include <arm/cpufunc.h>
51 52
@@ -140,27 +141,27 @@ apple_platform_devmap(void) @@ -140,27 +141,27 @@ apple_platform_devmap(void)
140 devmap[devmap_index].pd_va = DEVMAP_ALIGN(devmap_va); 141 devmap[devmap_index].pd_va = DEVMAP_ALIGN(devmap_va);
141 devmap[devmap_index].pd_size = DEVMAP_SIZE(L2_SIZE); 142 devmap[devmap_index].pd_size = DEVMAP_SIZE(L2_SIZE);
142 devmap[devmap_index].pd_prot = VM_PROT_READ | VM_PROT_WRITE; 143 devmap[devmap_index].pd_prot = VM_PROT_READ | VM_PROT_WRITE;
143 devmap[devmap_index].pd_flags = PMAP_WRITE_BACK; 144 devmap[devmap_index].pd_flags = PMAP_WRITE_BACK;
144 devmap_va = DEVMAP_SIZE(devmap[devmap_index].pd_va + 145 devmap_va = DEVMAP_SIZE(devmap[devmap_index].pd_va +
145 devmap[devmap_index].pd_size); 146 devmap[devmap_index].pd_size);
146 devmap_index++; 147 devmap_index++;
147 } 148 }
148 149
149 return devmap; 150 return devmap;
150} 151}
151 152
152static u_int 153static u_int
153arm_platform_uart_freq(void) 154apple_platform_uart_freq(void)
154{ 155{
155 return 0; 156 return 0;
156} 157}
157 158
158static int 159static int
159apple_platform_get_mac_address(pci_chipset_tag_t pc, pcitag_t tag, 160apple_platform_get_mac_address(pci_chipset_tag_t pc, pcitag_t tag,
160 uint8_t *eaddr) 161 uint8_t *eaddr)
161{ 162{
162 int b, d, f; 163 int b, d, f;
163 int bridge, len; 164 int bridge, len;
164 u_int bdf; 165 u_int bdf;
165 166
166 const int pcie = of_find_bycompat(OF_finddevice("/"), "apple,pcie"); 167 const int pcie = of_find_bycompat(OF_finddevice("/"), "apple,pcie");
@@ -225,25 +226,25 @@ apple_platform_device_register(device_t  @@ -225,25 +226,25 @@ apple_platform_device_register(device_t
225 struct pci_attach_args * const pa = aux; 226 struct pci_attach_args * const pa = aux;
226 227
227 len = apple_platform_get_mac_address(pa->pa_pc, pa->pa_tag, 228 len = apple_platform_get_mac_address(pa->pa_pc, pa->pa_tag,
228 eaddr); 229 eaddr);
229 if (len == ETHER_ADDR_LEN) { 230 if (len == ETHER_ADDR_LEN) {
230 prop_dictionary_set_bool(prop, "without-seeprom", true); 231 prop_dictionary_set_bool(prop, "without-seeprom", true);
231 prop_dictionary_set_data(prop, "mac-address", eaddr, 232 prop_dictionary_set_data(prop, "mac-address", eaddr,
232 sizeof(eaddr)); 233 sizeof(eaddr));
233 } 234 }
234 return; 235 return;
235 } 236 }
236} 237}
237 238
238static const struct arm_platform apple_arm_platform = { 239static const struct fdt_platform apple_fdt_platform = {
239 .ap_devmap = apple_platform_devmap, 240 .fp_devmap = apple_platform_devmap,
240 .ap_bootstrap = apple_platform_bootstrap, 241 .fp_bootstrap = apple_platform_bootstrap,
241 .ap_init_attach_args = apple_platform_init_attach_args, 242 .fp_init_attach_args = apple_platform_init_attach_args,
242 .ap_reset = psci_fdt_reset, 243 .fp_reset = psci_fdt_reset,
243 .ap_delay = gtmr_delay, 244 .fp_delay = gtmr_delay,
244 .ap_uart_freq = arm_platform_uart_freq, 245 .fp_uart_freq = apple_platform_uart_freq,
245 .ap_device_register = apple_platform_device_register, 246 .fp_device_register = apple_platform_device_register,
246 .ap_mpstart = arm_fdt_cpu_mpstart, 247 .fp_mpstart = arm_fdt_cpu_mpstart,
247}; 248};
248 249
249ARM_PLATFORM(apple_arm, "apple,arm-platform", &apple_arm_platform); 250FDT_PLATFORM(apple_arm, "apple,arm-platform", &apple_fdt_platform);

cvs diff -r1.145 -r1.146 src/sys/arch/arm/arm32/arm32_machdep.c (expand / switch to unified diff)

--- src/sys/arch/arm/arm32/arm32_machdep.c 2023/01/19 08:03:51 1.145
+++ src/sys/arch/arm/arm32/arm32_machdep.c 2023/04/07 08:55:30 1.146
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: arm32_machdep.c,v 1.145 2023/01/19 08:03:51 mlelstv Exp $ */ 1/* $NetBSD: arm32_machdep.c,v 1.146 2023/04/07 08:55:30 skrll Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1994-1998 Mark Brinicombe. 4 * Copyright (c) 1994-1998 Mark Brinicombe.
5 * Copyright (c) 1994 Brini. 5 * Copyright (c) 1994 Brini.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software written for Brini by Mark Brinicombe 8 * This code is derived from software written for Brini by Mark Brinicombe
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -32,27 +32,27 @@ @@ -32,27 +32,27 @@
32 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE. 36 * SUCH DAMAGE.
37 * 37 *
38 * Machine dependent functions for kernel setup 38 * Machine dependent functions for kernel setup
39 * 39 *
40 * Created : 17/09/94 40 * Created : 17/09/94
41 * Updated : 18/04/01 updated for new wscons 41 * Updated : 18/04/01 updated for new wscons
42 */ 42 */
43 43
44#include <sys/cdefs.h> 44#include <sys/cdefs.h>
45__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.145 2023/01/19 08:03:51 mlelstv Exp $"); 45__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.146 2023/04/07 08:55:30 skrll Exp $");
46 46
47#include "opt_arm_debug.h" 47#include "opt_arm_debug.h"
48#include "opt_arm_start.h" 48#include "opt_arm_start.h"
49#include "opt_fdt.h" 49#include "opt_fdt.h"
50#include "opt_modular.h" 50#include "opt_modular.h"
51#include "opt_md.h" 51#include "opt_md.h"
52#include "opt_multiprocessor.h" 52#include "opt_multiprocessor.h"
53 53
54#include <sys/param.h> 54#include <sys/param.h>
55 55
56#include <sys/atomic.h> 56#include <sys/atomic.h>
57#include <sys/buf.h> 57#include <sys/buf.h>
58#include <sys/cpu.h> 58#include <sys/cpu.h>
@@ -75,26 +75,28 @@ __KERNEL_RCSID(0, "$NetBSD: arm32_machde @@ -75,26 +75,28 @@ __KERNEL_RCSID(0, "$NetBSD: arm32_machde
75 75
76#include <dev/cons.h> 76#include <dev/cons.h>
77#include <dev/mm.h> 77#include <dev/mm.h>
78 78
79#include <arm/locore.h> 79#include <arm/locore.h>
80 80
81#include <arm/cpu_topology.h> 81#include <arm/cpu_topology.h>
82#include <arm/arm32/machdep.h> 82#include <arm/arm32/machdep.h>
83 83
84#include <machine/bootconfig.h> 84#include <machine/bootconfig.h>
85#include <machine/pcb.h> 85#include <machine/pcb.h>
86 86
87#if defined(FDT) 87#if defined(FDT)
 88#include <dev/fdt/fdtvar.h>
 89
88#include <arm/fdt/arm_fdtvar.h> 90#include <arm/fdt/arm_fdtvar.h>
89#include <arch/evbarm/fdt/platform.h> 91#include <arch/evbarm/fdt/platform.h>
90#endif 92#endif
91 93
92#ifdef VERBOSE_INIT_ARM 94#ifdef VERBOSE_INIT_ARM
93#define VPRINTF(...) printf(__VA_ARGS__) 95#define VPRINTF(...) printf(__VA_ARGS__)
94#ifdef __HAVE_GENERIC_START 96#ifdef __HAVE_GENERIC_START
95void generic_prints(const char *); 97void generic_prints(const char *);
96void generic_printx(int); 98void generic_printx(int);
97#define VPRINTS(s) generic_prints(s) 99#define VPRINTS(s) generic_prints(s)
98#define VPRINTX(x) generic_printx(x) 100#define VPRINTX(x) generic_printx(x)
99#else 101#else
100#define VPRINTS(s) __nothing 102#define VPRINTS(s) __nothing
@@ -291,29 +293,29 @@ cpu_startup(void) @@ -291,29 +293,29 @@ cpu_startup(void)
291 293
292#ifndef ARM_HAS_VBAR 294#ifndef ARM_HAS_VBAR
293 /* Lock down zero page */ 295 /* Lock down zero page */
294 vector_page_setprot(VM_PROT_READ); 296 vector_page_setprot(VM_PROT_READ);
295#endif 297#endif
296 298
297 /* 299 /*
298 * Give pmap a chance to set up a few more things now the vm 300 * Give pmap a chance to set up a few more things now the vm
299 * is initialised 301 * is initialised
300 */ 302 */
301 pmap_postinit(); 303 pmap_postinit();
302 304
303#ifdef FDT 305#ifdef FDT
304 const struct arm_platform * const plat = arm_fdt_platform(); 306 const struct fdt_platform * const plat = fdt_platform_find();
305 if (plat->ap_startup != NULL) 307 if (plat->fp_startup != NULL)
306 plat->ap_startup(); 308 plat->fp_startup();
307#endif 309#endif
308 310
309 /* 311 /*
310 * Initialize error message buffer (at end of core). 312 * Initialize error message buffer (at end of core).
311 */ 313 */
312 314
313 /* msgbufphys was setup during the secondary boot strap */ 315 /* msgbufphys was setup during the secondary boot strap */
314 if (!pmap_extract(pmap_kernel(), (vaddr_t)msgbufaddr, NULL)) { 316 if (!pmap_extract(pmap_kernel(), (vaddr_t)msgbufaddr, NULL)) {
315 for (u_int loop = 0; loop < btoc(MSGBUFSIZE); ++loop) { 317 for (u_int loop = 0; loop < btoc(MSGBUFSIZE); ++loop) {
316 pmap_kenter_pa((vaddr_t)msgbufaddr + loop * PAGE_SIZE, 318 pmap_kenter_pa((vaddr_t)msgbufaddr + loop * PAGE_SIZE,
317 msgbufphys + loop * PAGE_SIZE, 319 msgbufphys + loop * PAGE_SIZE,
318 VM_PROT_READ|VM_PROT_WRITE, 0); 320 VM_PROT_READ|VM_PROT_WRITE, 0);
319 } 321 }
@@ -883,38 +885,38 @@ mm_md_page_color(paddr_t pa, int *colorp @@ -883,38 +885,38 @@ mm_md_page_color(paddr_t pa, int *colorp
883 *colorp = 0; 885 *colorp = 0;
884 886
885 return true; 887 return true;
886#endif 888#endif
887} 889}
888 890
889#if defined(FDT) 891#if defined(FDT)
890extern char KERNEL_BASE_phys[]; 892extern char KERNEL_BASE_phys[];
891#define KERNEL_BASE_PHYS ((paddr_t)KERNEL_BASE_phys) 893#define KERNEL_BASE_PHYS ((paddr_t)KERNEL_BASE_phys)
892 894
893void 895void
894cpu_kernel_vm_init(paddr_t memory_start, psize_t memory_size) 896cpu_kernel_vm_init(paddr_t memory_start, psize_t memory_size)
895{ 897{
896 const struct arm_platform *plat = arm_fdt_platform(); 898 const struct fdt_platform *plat = fdt_platform_find();
897 899
898#ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS 900#ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
899 const bool mapallmem_p = true; 901 const bool mapallmem_p = true;
900#ifndef PMAP_NEED_ALLOC_POOLPAGE 902#ifndef PMAP_NEED_ALLOC_POOLPAGE
901 if (memory_size > KERNEL_VM_BASE - KERNEL_BASE) { 903 if (memory_size > KERNEL_VM_BASE - KERNEL_BASE) {
902 VPRINTF("%s: dropping RAM size from %luMB to %uMB\n", 904 VPRINTF("%s: dropping RAM size from %luMB to %uMB\n",
903 __func__, (unsigned long) (memory_size >> 20), 905 __func__, (unsigned long) (memory_size >> 20),
904 (KERNEL_VM_BASE - KERNEL_BASE) >> 20); 906 (KERNEL_VM_BASE - KERNEL_BASE) >> 20);
905 memory_size = KERNEL_VM_BASE - KERNEL_BASE; 907 memory_size = KERNEL_VM_BASE - KERNEL_BASE;
906 } 908 }
907#endif 909#endif
908#else 910#else
909 const bool mapallmem_p = false; 911 const bool mapallmem_p = false;
910#endif 912#endif
911 913
912 VPRINTF("%s: kernel phys start %" PRIxPADDR " end %" PRIxPADDR "\n", 914 VPRINTF("%s: kernel phys start %" PRIxPADDR " end %" PRIxPADDR "\n",
913 __func__, memory_start, memory_start + memory_size); 915 __func__, memory_start, memory_start + memory_size);
914 916
915 arm32_bootmem_init(memory_start, memory_size, KERNEL_BASE_PHYS); 917 arm32_bootmem_init(memory_start, memory_size, KERNEL_BASE_PHYS);
916 arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_HIGH, 0, 918 arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_HIGH, 0,
917 plat->ap_devmap(), mapallmem_p); 919 plat->fp_devmap(), mapallmem_p);
918} 920}
919#endif 921#endif
920 922

cvs diff -r1.48 -r1.49 src/sys/arch/arm/broadcom/bcm283x_platform.c (expand / switch to unified diff)

--- src/sys/arch/arm/broadcom/bcm283x_platform.c 2021/04/24 23:36:26 1.48
+++ src/sys/arch/arm/broadcom/bcm283x_platform.c 2023/04/07 08:55:30 1.49
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bcm283x_platform.c,v 1.48 2021/04/24 23:36:26 thorpej Exp $ */ 1/* $NetBSD: bcm283x_platform.c,v 1.49 2023/04/07 08:55:30 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2017 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2017 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,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: bcm283x_platform.c,v 1.48 2021/04/24 23:36:26 thorpej Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.49 2023/04/07 08:55:30 skrll Exp $");
31 31
32#include "opt_arm_debug.h" 32#include "opt_arm_debug.h"
33#include "opt_bcm283x.h" 33#include "opt_bcm283x.h"
34#include "opt_cpuoptions.h" 34#include "opt_cpuoptions.h"
35#include "opt_ddb.h" 35#include "opt_ddb.h"
36#include "opt_evbarm_boardtype.h" 36#include "opt_evbarm_boardtype.h"
37#include "opt_kgdb.h" 37#include "opt_kgdb.h"
38#include "opt_fdt.h" 38#include "opt_fdt.h"
39#include "opt_rpi.h" 39#include "opt_rpi.h"
40#include "opt_vcprop.h" 40#include "opt_vcprop.h"
41 41
42#include "sdhc.h" 42#include "sdhc.h"
43#include "bcmsdhost.h" 43#include "bcmsdhost.h"
@@ -1471,81 +1471,81 @@ bcm283x_platform_device_register(device_ @@ -1471,81 +1471,81 @@ bcm283x_platform_device_register(device_
1471 } else { 1471 } else {
1472 prop_dictionary_set_bool(dict, "is_console", false); 1472 prop_dictionary_set_bool(dict, "is_console", false);
1473 } 1473 }
1474 } 1474 }
1475#endif 1475#endif
1476} 1476}
1477 1477
1478static u_int 1478static u_int
1479bcm283x_platform_uart_freq(void) 1479bcm283x_platform_uart_freq(void)
1480{ 1480{
1481 1481
1482 /* 1482 /*
1483 * We are safe to access stdout phandle - consinit did before 1483 * We are safe to access stdout phandle - consinit did before
1484 * calling ap_uart_freq 1484 * calling fp_uart_freq
1485 */ 1485 */
1486 const int phandle = fdtbus_get_stdout_phandle(); 1486 const int phandle = fdtbus_get_stdout_phandle();
1487 1487
1488 static const struct device_compatible_entry aux_compat_data[] = { 1488 static const struct device_compatible_entry aux_compat_data[] = {
1489 { .compat = "brcm,bcm2835-aux-uart" }, 1489 { .compat = "brcm,bcm2835-aux-uart" },
1490 DEVICE_COMPAT_EOL 1490 DEVICE_COMPAT_EOL
1491 }; 1491 };
1492 1492
1493 if (of_compatible_match(phandle, aux_compat_data)) 1493 if (of_compatible_match(phandle, aux_compat_data))
1494 return core_clk * 2; 1494 return core_clk * 2;
1495 1495
1496 return uart_clk; 1496 return uart_clk;
1497} 1497}
1498 1498
1499#if defined(SOC_BCM2835) 1499#if defined(SOC_BCM2835)
1500static const struct arm_platform bcm2835_platform = { 1500static const struct fdt_platform bcm2835_platform = {
1501 .ap_devmap = bcm2835_platform_devmap, 1501 .fp_devmap = bcm2835_platform_devmap,
1502 .ap_bootstrap = bcm2835_platform_bootstrap, 1502 .fp_bootstrap = bcm2835_platform_bootstrap,
1503 .ap_init_attach_args = bcm2835_platform_init_attach_args, 1503 .fp_init_attach_args = bcm2835_platform_init_attach_args,
1504 .ap_device_register = bcm283x_platform_device_register, 1504 .fp_device_register = bcm283x_platform_device_register,
1505 .ap_reset = bcm2835_system_reset, 1505 .fp_reset = bcm2835_system_reset,
1506 .ap_delay = bcm2835_tmr_delay, 1506 .fp_delay = bcm2835_tmr_delay,
1507 .ap_uart_freq = bcm283x_platform_uart_freq, 1507 .fp_uart_freq = bcm283x_platform_uart_freq,
1508}; 1508};
1509 1509
1510ARM_PLATFORM(bcm2835, "brcm,bcm2835", &bcm2835_platform); 1510FDT_PLATFORM(bcm2835, "brcm,bcm2835", &bcm2835_platform);
1511#endif 1511#endif
1512 1512
1513#if defined(SOC_BCM2836) 1513#if defined(SOC_BCM2836)
1514 1514
1515static const struct arm_platform bcm2836_platform = { 1515static const struct fdt_platform bcm2836_platform = {
1516 .ap_devmap = bcm2836_platform_devmap, 1516 .fp_devmap = bcm2836_platform_devmap,
1517 .ap_bootstrap = bcm2836_platform_bootstrap, 1517 .fp_bootstrap = bcm2836_platform_bootstrap,
1518 .ap_init_attach_args = bcm2836_platform_init_attach_args, 1518 .fp_init_attach_args = bcm2836_platform_init_attach_args,
1519 .ap_device_register = bcm283x_platform_device_register, 1519 .fp_device_register = bcm283x_platform_device_register,
1520 .ap_reset = bcm2835_system_reset, 1520 .fp_reset = bcm2835_system_reset,
1521 .ap_delay = gtmr_delay, 1521 .fp_delay = gtmr_delay,
1522 .ap_uart_freq = bcm283x_platform_uart_freq, 1522 .fp_uart_freq = bcm283x_platform_uart_freq,
1523 .ap_mpstart = arm_fdt_cpu_mpstart, 1523 .fp_mpstart = arm_fdt_cpu_mpstart,
1524}; 1524};
1525 1525
1526static const struct arm_platform bcm2837_platform = { 1526static const struct fdt_platform bcm2837_platform = {
1527 .ap_devmap = bcm2836_platform_devmap, 1527 .fp_devmap = bcm2836_platform_devmap,
1528 .ap_bootstrap = bcm2836_platform_bootstrap, 1528 .fp_bootstrap = bcm2836_platform_bootstrap,
1529 .ap_init_attach_args = bcm2836_platform_init_attach_args, 1529 .fp_init_attach_args = bcm2836_platform_init_attach_args,
1530 .ap_device_register = bcm283x_platform_device_register, 1530 .fp_device_register = bcm283x_platform_device_register,
1531 .ap_reset = bcm2835_system_reset, 1531 .fp_reset = bcm2835_system_reset,
1532 .ap_delay = gtmr_delay, 1532 .fp_delay = gtmr_delay,
1533 .ap_uart_freq = bcm283x_platform_uart_freq, 1533 .fp_uart_freq = bcm283x_platform_uart_freq,
1534 .ap_mpstart = arm_fdt_cpu_mpstart, 1534 .fp_mpstart = arm_fdt_cpu_mpstart,
1535}; 1535};
1536 1536
1537static const struct arm_platform bcm2711_platform = { 1537static const struct fdt_platform bcm2711_platform = {
1538 .ap_devmap = bcm2711_platform_devmap, 1538 .fp_devmap = bcm2711_platform_devmap,
1539 .ap_bootstrap = bcm2711_platform_bootstrap, 1539 .fp_bootstrap = bcm2711_platform_bootstrap,
1540 .ap_init_attach_args = bcm2711_platform_init_attach_args, 1540 .fp_init_attach_args = bcm2711_platform_init_attach_args,
1541 .ap_device_register = bcm283x_platform_device_register, 1541 .fp_device_register = bcm283x_platform_device_register,
1542 .ap_reset = bcm2835_system_reset, 1542 .fp_reset = bcm2835_system_reset,
1543 .ap_delay = gtmr_delay, 1543 .fp_delay = gtmr_delay,
1544 .ap_uart_freq = bcm283x_platform_uart_freq, 1544 .fp_uart_freq = bcm283x_platform_uart_freq,
1545 .ap_mpstart = arm_fdt_cpu_mpstart, 1545 .fp_mpstart = arm_fdt_cpu_mpstart,
1546}; 1546};
1547 1547
1548ARM_PLATFORM(bcm2836, "brcm,bcm2836", &bcm2836_platform); 1548FDT_PLATFORM(bcm2836, "brcm,bcm2836", &bcm2836_platform);
1549ARM_PLATFORM(bcm2837, "brcm,bcm2837", &bcm2837_platform); 1549FDT_PLATFORM(bcm2837, "brcm,bcm2837", &bcm2837_platform);
1550ARM_PLATFORM(bcm2711, "brcm,bcm2711", &bcm2711_platform); 1550FDT_PLATFORM(bcm2711, "brcm,bcm2711", &bcm2711_platform);
1551#endif 1551#endif

cvs diff -r1.20 -r1.21 src/sys/arch/arm/fdt/arm_fdt.c (expand / switch to unified diff)

--- src/sys/arch/arm/fdt/arm_fdt.c 2021/10/10 13:03:09 1.20
+++ src/sys/arch/arm/fdt/arm_fdt.c 2023/04/07 08:55:30 1.21
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: arm_fdt.c,v 1.20 2021/10/10 13:03:09 jmcneill Exp $ */ 1/* $NetBSD: arm_fdt.c,v 1.21 2023/04/07 08:55:30 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2017 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2017 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.
@@ -21,39 +21,40 @@ @@ -21,39 +21,40 @@
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 "opt_arm_timer.h" 29#include "opt_arm_timer.h"
30#include "opt_efi.h" 30#include "opt_efi.h"
31#include "opt_modular.h" 31#include "opt_modular.h"
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: arm_fdt.c,v 1.20 2021/10/10 13:03:09 jmcneill Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: arm_fdt.c,v 1.21 2023/04/07 08:55:30 skrll Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/cpu.h> 38#include <sys/cpu.h>
39#include <sys/device.h> 39#include <sys/device.h>
40#include <sys/kmem.h> 40#include <sys/kmem.h>
41#include <sys/bus.h> 41#include <sys/bus.h>
42#include <sys/module.h> 42#include <sys/module.h>
43 43
44#include <uvm/uvm_extern.h> 44#include <uvm/uvm_extern.h>
45 45
46#include <dev/fdt/fdtvar.h> 46#include <dev/fdt/fdtvar.h>
 47
47#include <dev/ofw/openfirm.h> 48#include <dev/ofw/openfirm.h>
48 49
49#include <arm/fdt/arm_fdtvar.h> 50#include <arm/fdt/arm_fdtvar.h>
50 51
51#include <arm/locore.h> 52#include <arm/locore.h>
52 53
53#ifdef EFI_RUNTIME 54#ifdef EFI_RUNTIME
54#include <arm/arm/efi_runtime.h> 55#include <arm/arm/efi_runtime.h>
55#include <dev/clock_subr.h> 56#include <dev/clock_subr.h>
56#endif 57#endif
57 58
58static int arm_fdt_match(device_t, cfdata_t, void *); 59static int arm_fdt_match(device_t, cfdata_t, void *);
59static void arm_fdt_attach(device_t, device_t, void *); 60static void arm_fdt_attach(device_t, device_t, void *);
@@ -84,89 +85,44 @@ static TAILQ_HEAD(, arm_fdt_cpu_hatch_cb @@ -84,89 +85,44 @@ static TAILQ_HEAD(, arm_fdt_cpu_hatch_cb
84static void (*_arm_fdt_irq_handler)(void *) = arm_fdt_irq_default_handler; 85static void (*_arm_fdt_irq_handler)(void *) = arm_fdt_irq_default_handler;
85static void (*_arm_fdt_fiq_handler)(void *) = arm_fdt_fiq_default_handler; 86static void (*_arm_fdt_fiq_handler)(void *) = arm_fdt_fiq_default_handler;
86static void (*_arm_fdt_timer_init)(void) = NULL; 87static void (*_arm_fdt_timer_init)(void) = NULL;
87 88
88int 89int
89arm_fdt_match(device_t parent, cfdata_t cf, void *aux) 90arm_fdt_match(device_t parent, cfdata_t cf, void *aux)
90{ 91{
91 return 1; 92 return 1;
92} 93}
93 94
94void 95void
95arm_fdt_attach(device_t parent, device_t self, void *aux) 96arm_fdt_attach(device_t parent, device_t self, void *aux)
96{ 97{
97 const struct arm_platform *plat = arm_fdt_platform(); 98 const struct fdt_platform *plat = fdt_platform_find();
98 struct fdt_attach_args faa; 99 struct fdt_attach_args faa;
99 100
100 aprint_naive("\n"); 101 aprint_naive("\n");
101 aprint_normal("\n"); 102 aprint_normal("\n");
102 103
103 DISABLE_INTERRUPT(); 104 DISABLE_INTERRUPT();
104 105
105#ifdef EFI_RUNTIME 106#ifdef EFI_RUNTIME
106 arm_fdt_efi_init(self); 107 arm_fdt_efi_init(self);
107#endif 108#endif
108 109
109 plat->ap_init_attach_args(&faa); 110 plat->fp_init_attach_args(&faa);
110 faa.faa_name = ""; 111 faa.faa_name = "";
111 faa.faa_phandle = OF_peer(0); 112 faa.faa_phandle = OF_peer(0);
112 113
113 config_found(self, &faa, NULL, CFARGS_NONE); 114 config_found(self, &faa, NULL, CFARGS_NONE);
114} 115}
115 
116const struct arm_platform * 
117arm_fdt_platform(void) 
118{ 
119 static const struct arm_platform_info *booted_platform = NULL; 
120 __link_set_decl(arm_platforms, struct arm_platform_info); 
121 struct arm_platform_info * const *info; 
122 
123 if (booted_platform == NULL) { 
124 const struct arm_platform_info *best_info = NULL; 
125 const int phandle = OF_peer(0); 
126 int match, best_match = 0; 
127 
128 __link_set_foreach(info, arm_platforms) { 
129 const struct device_compatible_entry compat_data[] = { 
130 { .compat = (*info)->api_compat }, 
131 DEVICE_COMPAT_EOL 
132 }; 
133 
134 match = of_compatible_match(phandle, compat_data); 
135 if (match > best_match) { 
136 best_match = match; 
137 best_info = *info; 
138 } 
139 } 
140 
141 booted_platform = best_info; 
142 } 
143 
144 /* 
145 * No SoC specific platform was found. Try to find a generic 
146 * platform definition and use that if available. 
147 */ 
148 if (booted_platform == NULL) { 
149 __link_set_foreach(info, arm_platforms) { 
150 if (strcmp((*info)->api_compat, ARM_PLATFORM_DEFAULT) == 0) { 
151 booted_platform = *info; 
152 break; 
153 } 
154 } 
155 } 
156 
157 return booted_platform == NULL ? NULL : booted_platform->api_ops; 
158} 
159 
160void 116void
161arm_fdt_cpu_hatch_register(void *priv, void (*cb)(void *, struct cpu_info *)) 117arm_fdt_cpu_hatch_register(void *priv, void (*cb)(void *, struct cpu_info *))
162{ 118{
163 struct arm_fdt_cpu_hatch_cb *c; 119 struct arm_fdt_cpu_hatch_cb *c;
164 120
165 c = kmem_alloc(sizeof(*c), KM_SLEEP); 121 c = kmem_alloc(sizeof(*c), KM_SLEEP);
166 c->priv = priv; 122 c->priv = priv;
167 c->cb = cb; 123 c->cb = cb;
168 TAILQ_INSERT_TAIL(&arm_fdt_cpu_hatch_cbs, c, next); 124 TAILQ_INSERT_TAIL(&arm_fdt_cpu_hatch_cbs, c, next);
169} 125}
170 126
171void 127void
172arm_fdt_cpu_hatch(struct cpu_info *ci) 128arm_fdt_cpu_hatch(struct cpu_info *ci)

cvs diff -r1.19 -r1.20 src/sys/arch/arm/fdt/arm_fdtvar.h (expand / switch to unified diff)

--- src/sys/arch/arm/fdt/arm_fdtvar.h 2021/09/05 13:20:34 1.19
+++ src/sys/arch/arm/fdt/arm_fdtvar.h 2023/04/07 08:55:30 1.20
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: arm_fdtvar.h,v 1.19 2021/09/05 13:20:34 jmcneill Exp $ */ 1/* $NetBSD: arm_fdtvar.h,v 1.20 2023/04/07 08:55:30 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2017 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2017 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.
@@ -19,70 +19,33 @@ @@ -19,70 +19,33 @@
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#ifndef _ARM_ARM_FDTVAR_H 29#ifndef _ARM_ARM_FDTVAR_H
30#define _ARM_ARM_FDTVAR_H 30#define _ARM_ARM_FDTVAR_H
31 31
32struct fdt_attach_args; 
33 
34/* 
35 * Platform-specific data 
36 */ 
37 
38struct arm_platform { 
39 const struct pmap_devmap * (*ap_devmap)(void); 
40 void (*ap_bootstrap)(void); 
41 int (*ap_mpstart)(void); 
42 void (*ap_startup)(void); 
43 void (*ap_init_attach_args)(struct fdt_attach_args *); 
44 void (*ap_device_register)(device_t, void *); 
45 void (*ap_reset)(void); 
46 void (*ap_delay)(u_int); 
47 u_int (*ap_uart_freq)(void); 
48}; 
49 
50struct arm_platform_info { 
51 const char * api_compat; 
52 const struct arm_platform * api_ops; 
53}; 
54 
55#define ARM_PLATFORM_DEFAULT "" 
56 
57#define _ARM_PLATFORM_REGISTER(name) \ 
58 __link_set_add_rodata(arm_platforms, __CONCAT(name,_platinfo)); 
59 
60#define ARM_PLATFORM(_name, _compat, _ops) \ 
61static const struct arm_platform_info __CONCAT(_name,_platinfo) = { \ 
62 .api_compat = (_compat), \ 
63 .api_ops = (_ops) \ 
64}; \ 
65_ARM_PLATFORM_REGISTER(_name) 
66 
67const struct arm_platform * arm_fdt_platform(void); 
68 
69/* 32/*
70 * CPU enable methods 33 * CPU enable methods
71 */ 34 */
72 35
73struct arm_cpu_method { 36struct arm_cpu_method {
74 const char * acm_compat; 37 const char * acm_compat;
75 int (*acm_enable)(int); 38 int (*acm_enable)(int);
76}; 39};
77 40
78#define _ARM_CPU_METHOD_REGISTER(_name) \ 41#define _ARM_CPU_METHOD_REGISTER(_name) \
79 __link_set_add_rodata(arm_cpu_methods, __CONCAT(_name,_cpu_method)); 42 __link_set_add_rodata(arm_cpu_methods, __CONCAT(_name,_cpu_method));
80 43
81#define ARM_CPU_METHOD(_name, _compat, _enable) \ 44#define ARM_CPU_METHOD(_name, _compat, _enable) \
82static const struct arm_cpu_method __CONCAT(_name,_cpu_method) = { \ 45static const struct arm_cpu_method __CONCAT(_name,_cpu_method) = { \
83 .acm_compat = (_compat), \ 46 .acm_compat = (_compat), \
84 .acm_enable = (_enable) \ 47 .acm_enable = (_enable) \
85}; \ 48}; \
86_ARM_CPU_METHOD_REGISTER(_name) 49_ARM_CPU_METHOD_REGISTER(_name)
87 50
88void arm_fdt_cpu_bootstrap(void); 51void arm_fdt_cpu_bootstrap(void);

cvs diff -r1.6 -r1.7 src/sys/arch/arm/fdt/arm_platform.c (expand / switch to unified diff)

--- src/sys/arch/arm/fdt/arm_platform.c 2023/02/25 08:19:35 1.6
+++ src/sys/arch/arm/fdt/arm_platform.c 2023/04/07 08:55:30 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: arm_platform.c,v 1.6 2023/02/25 08:19:35 skrll Exp $ */ 1/* $NetBSD: arm_platform.c,v 1.7 2023/04/07 08:55:30 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2020 Jared McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2020 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.
@@ -28,46 +28,47 @@ @@ -28,46 +28,47 @@
28 28
29/* 29/*
30 * This is the default Arm FDT platform implementation. It assumes the 30 * This is the default Arm FDT platform implementation. It assumes the
31 * following: 31 * following:
32 * 32 *
33 * - Generic timer 33 * - Generic timer
34 * - PSCI support 34 * - PSCI support
35 * - Console UART is pre-configured by firmware 35 * - Console UART is pre-configured by firmware
36 */ 36 */
37 37
38#include "opt_console.h" 38#include "opt_console.h"
39 39
40#include <sys/cdefs.h> 40#include <sys/cdefs.h>
41__KERNEL_RCSID(0, "$NetBSD: arm_platform.c,v 1.6 2023/02/25 08:19:35 skrll Exp $"); 41__KERNEL_RCSID(0, "$NetBSD: arm_platform.c,v 1.7 2023/04/07 08:55:30 skrll Exp $");
42 42
43#include <sys/param.h> 43#include <sys/param.h>
44#include <sys/bus.h> 44#include <sys/bus.h>
45#include <sys/cpu.h> 45#include <sys/cpu.h>
46#include <sys/device.h> 46#include <sys/device.h>
47#include <sys/termios.h> 47#include <sys/termios.h>
48 48
49#include <dev/fdt/fdtvar.h> 49#include <dev/fdt/fdtvar.h>
50#include <arm/fdt/arm_fdtvar.h> 
51 50
52#include <uvm/uvm_extern.h> 51#include <uvm/uvm_extern.h>
53 52
54#include <machine/bootconfig.h> 53#include <machine/bootconfig.h>
55 54
56#include <arm/cpufunc.h> 55#include <arm/cpufunc.h>
57 56
58#include <arm/cortex/gtmr_var.h> 57#include <arm/cortex/gtmr_var.h>
59 58
60#include <arm/arm/psci.h> 59#include <arm/arm/psci.h>
 60
 61#include <arm/fdt/arm_fdtvar.h>
61#include <arm/fdt/psci_fdtvar.h> 62#include <arm/fdt/psci_fdtvar.h>
62 63
63#include <evbarm/dev/plcomreg.h> 64#include <evbarm/dev/plcomreg.h>
64#include <evbarm/dev/plcomvar.h> 65#include <evbarm/dev/plcomvar.h>
65 66
66#include <libfdt.h> 67#include <libfdt.h>
67 68
68#include <arch/evbarm/fdt/platform.h> 69#include <arch/evbarm/fdt/platform.h>
69 70
70extern struct arm32_bus_dma_tag arm_generic_dma_tag; 71extern struct arm32_bus_dma_tag arm_generic_dma_tag;
71extern struct bus_space arm_generic_bs_tag; 72extern struct bus_space arm_generic_bs_tag;
72 73
73void plcom_platform_early_putchar(char); 74void plcom_platform_early_putchar(char);
@@ -127,25 +128,25 @@ arm_platform_devmap(void) @@ -127,25 +128,25 @@ arm_platform_devmap(void)
127 return devmap_empty; 128 return devmap_empty;
128 129
129 devmap_uart[0].pd_pa = DEVMAP_ALIGN(uart_base); 130 devmap_uart[0].pd_pa = DEVMAP_ALIGN(uart_base);
130 131
131 return devmap_uart; 132 return devmap_uart;
132} 133}
133 134
134static u_int 135static u_int
135arm_platform_uart_freq(void) 136arm_platform_uart_freq(void)
136{ 137{
137 return 0; 138 return 0;
138} 139}
139 140
140static const struct arm_platform arm_platform = { 141static const struct fdt_platform arm_platform = {
141 .ap_devmap = arm_platform_devmap, 142 .fp_devmap = arm_platform_devmap,
142 .ap_bootstrap = arm_fdt_cpu_bootstrap, 143 .fp_bootstrap = arm_fdt_cpu_bootstrap,
143 .ap_init_attach_args = arm_platform_init_attach_args, 144 .fp_init_attach_args = arm_platform_init_attach_args,
144 .ap_device_register = arm_platform_device_register, 145 .fp_device_register = arm_platform_device_register,
145 .ap_reset = psci_fdt_reset, 146 .fp_reset = psci_fdt_reset,
146 .ap_delay = gtmr_delay, 147 .fp_delay = gtmr_delay,
147 .ap_uart_freq = arm_platform_uart_freq, 148 .fp_uart_freq = arm_platform_uart_freq,
148 .ap_mpstart = arm_fdt_cpu_mpstart, 149 .fp_mpstart = arm_fdt_cpu_mpstart,
149}; 150};
150 151
151ARM_PLATFORM(arm, ARM_PLATFORM_DEFAULT, &arm_platform); 152FDT_PLATFORM(arm, FDT_PLATFORM_DEFAULT, &arm_platform);

cvs diff -r1.27 -r1.28 src/sys/arch/arm/nvidia/tegra_platform.c (expand / switch to unified diff)

--- src/sys/arch/arm/nvidia/tegra_platform.c 2021/04/24 23:36:27 1.27
+++ src/sys/arch/arm/nvidia/tegra_platform.c 2023/04/07 08:55:30 1.28
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: tegra_platform.c,v 1.27 2021/04/24 23:36:27 thorpej Exp $ */ 1/* $NetBSD: tegra_platform.c,v 1.28 2023/04/07 08:55:30 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2017 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2017 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.
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
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 "opt_arm_debug.h" 29#include "opt_arm_debug.h"
30#include "opt_console.h" 30#include "opt_console.h"
31#include "opt_multiprocessor.h" 31#include "opt_multiprocessor.h"
32#include "opt_tegra.h" 32#include "opt_tegra.h"
33 33
34#include "ukbd.h" 34#include "ukbd.h"
35 35
36#include <sys/cdefs.h> 36#include <sys/cdefs.h>
37__KERNEL_RCSID(0, "$NetBSD: tegra_platform.c,v 1.27 2021/04/24 23:36:27 thorpej Exp $"); 37__KERNEL_RCSID(0, "$NetBSD: tegra_platform.c,v 1.28 2023/04/07 08:55:30 skrll Exp $");
38 38
39#include <sys/param.h> 39#include <sys/param.h>
40#include <sys/bus.h> 40#include <sys/bus.h>
41#include <sys/cpu.h> 41#include <sys/cpu.h>
42#include <sys/device.h> 42#include <sys/device.h>
43#include <sys/termios.h> 43#include <sys/termios.h>
44 44
45#include <dev/fdt/fdtvar.h> 45#include <dev/fdt/fdtvar.h>
46 46
47#include <uvm/uvm_extern.h> 47#include <uvm/uvm_extern.h>
48 48
49#include <machine/bootconfig.h> 49#include <machine/bootconfig.h>
50#include <arm/cpufunc.h> 50#include <arm/cpufunc.h>
@@ -207,41 +207,41 @@ static void @@ -207,41 +207,41 @@ static void
207tegra_platform_delay(u_int us) 207tegra_platform_delay(u_int us)
208{ 208{
209 tegra_timer_delay(us); 209 tegra_timer_delay(us);
210} 210}
211 211
212static u_int 212static u_int
213tegra_platform_uart_freq(void) 213tegra_platform_uart_freq(void)
214{ 214{
215 return PLLP_OUT0_FREQ; 215 return PLLP_OUT0_FREQ;
216} 216}
217#endif /* SOC_TEGRA124 || SOC_TEGRA210 */ 217#endif /* SOC_TEGRA124 || SOC_TEGRA210 */
218 218
219#if defined(SOC_TEGRA124) 219#if defined(SOC_TEGRA124)
220static const struct arm_platform tegra124_platform = { 220static const struct fdt_platform tegra124_platform = {
221 .ap_devmap = tegra_platform_devmap, 221 .fp_devmap = tegra_platform_devmap,
222 .ap_bootstrap = tegra124_platform_bootstrap, 222 .fp_bootstrap = tegra124_platform_bootstrap,
223 .ap_init_attach_args = tegra_platform_init_attach_args, 223 .fp_init_attach_args = tegra_platform_init_attach_args,
224 .ap_device_register = tegra_platform_device_register, 224 .fp_device_register = tegra_platform_device_register,
225 .ap_reset = tegra_platform_reset, 225 .fp_reset = tegra_platform_reset,
226 .ap_delay = tegra_platform_delay, 226 .fp_delay = tegra_platform_delay,
227 .ap_uart_freq = tegra_platform_uart_freq, 227 .fp_uart_freq = tegra_platform_uart_freq,
228 .ap_mpstart = tegra124_mpstart, 228 .fp_mpstart = tegra124_mpstart,
229}; 229};
230 230
231ARM_PLATFORM(tegra124, "nvidia,tegra124", &tegra124_platform); 231FDT_PLATFORM(tegra124, "nvidia,tegra124", &tegra124_platform);
232#endif 232#endif
233 233
234#if defined(SOC_TEGRA210) 234#if defined(SOC_TEGRA210)
235static const struct arm_platform tegra210_platform = { 235static const struct fdt_platform tegra210_platform = {
236 .ap_devmap = tegra_platform_devmap, 236 .fp_devmap = tegra_platform_devmap,
237 .ap_bootstrap = tegra210_platform_bootstrap, 237 .fp_bootstrap = tegra210_platform_bootstrap,
238 .ap_init_attach_args = tegra_platform_init_attach_args, 238 .fp_init_attach_args = tegra_platform_init_attach_args,
239 .ap_device_register = tegra_platform_device_register, 239 .fp_device_register = tegra_platform_device_register,
240 .ap_reset = tegra_platform_reset, 240 .fp_reset = tegra_platform_reset,
241 .ap_delay = tegra_platform_delay, 241 .fp_delay = tegra_platform_delay,
242 .ap_uart_freq = tegra_platform_uart_freq, 242 .fp_uart_freq = tegra_platform_uart_freq,
243 .ap_mpstart = arm_fdt_cpu_mpstart, 243 .fp_mpstart = arm_fdt_cpu_mpstart,
244}; 244};
245 245
246ARM_PLATFORM(tegra210, "nvidia,tegra210", &tegra210_platform); 246FDT_PLATFORM(tegra210, "nvidia,tegra210", &tegra210_platform);
247#endif 247#endif

cvs diff -r1.6 -r1.7 src/sys/arch/arm/nxp/imx6_platform.c (expand / switch to unified diff)

--- src/sys/arch/arm/nxp/imx6_platform.c 2021/04/24 23:36:28 1.6
+++ src/sys/arch/arm/nxp/imx6_platform.c 2023/04/07 08:55:30 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: imx6_platform.c,v 1.6 2021/04/24 23:36:28 thorpej Exp $ */ 1/* $NetBSD: imx6_platform.c,v 1.7 2023/04/07 08:55:30 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2019 Genetec Corporation. All rights reserved. 4 * Copyright (c) 2019 Genetec Corporation. All rights reserved.
5 * Written by Hashimoto Kenichi for Genetec Corporation. 5 * Written by Hashimoto Kenichi for Genetec Corporation.
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,41 +17,42 @@ @@ -17,41 +17,42 @@
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: imx6_platform.c,v 1.6 2021/04/24 23:36:28 thorpej Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: imx6_platform.c,v 1.7 2023/04/07 08:55:30 skrll Exp $");
31 31
32#include "arml2cc.h" 32#include "arml2cc.h"
33#include "opt_console.h" 33#include "opt_console.h"
34#include "opt_fdt.h" 34#include "opt_fdt.h"
35#include "opt_multiprocessor.h" 35#include "opt_multiprocessor.h"
36#include "opt_soc.h" 36#include "opt_soc.h"
37 37
38#include <sys/param.h> 38#include <sys/param.h>
39#include <sys/bus.h> 39#include <sys/bus.h>
40#include <sys/cpu.h> 40#include <sys/cpu.h>
41#include <sys/device.h> 41#include <sys/device.h>
42#include <sys/termios.h> 42#include <sys/termios.h>
43 43
44#include <dev/fdt/fdtvar.h> 44#include <dev/fdt/fdtvar.h>
 45
45#include <arm/fdt/arm_fdtvar.h> 46#include <arm/fdt/arm_fdtvar.h>
46 47
47#include <uvm/uvm_extern.h> 48#include <uvm/uvm_extern.h>
48 49
49#include <arm/arm32/machdep.h> 50#include <arm/arm32/machdep.h>
50 51
51#include <machine/bootconfig.h> 52#include <machine/bootconfig.h>
52#include <arm/cpufunc.h> 53#include <arm/cpufunc.h>
53 54
54#include <arm/cortex/a9tmr_var.h> 55#include <arm/cortex/a9tmr_var.h>
55#include <arm/cortex/scu_reg.h> 56#include <arm/cortex/scu_reg.h>
56#include <arm/cortex/gic_reg.h> 57#include <arm/cortex/gic_reg.h>
57#include <arm/cortex/pl310_var.h> 58#include <arm/cortex/pl310_var.h>
@@ -212,27 +213,27 @@ imx6_platform_reset(void) @@ -212,27 +213,27 @@ imx6_platform_reset(void)
212 /* software reset signal on wdog */ 213 /* software reset signal on wdog */
213 bus_space_write_2(bst, bsh, IMX_WDOG_WCR, WCR_WDE); 214 bus_space_write_2(bst, bsh, IMX_WDOG_WCR, WCR_WDE);
214 215
215 /* 216 /*
216 * write twice due to errata. 217 * write twice due to errata.
217 * Reference: ERR004346: IMX6DQCE Chip Errata for the i.MX 6Dual/6Quad 218 * Reference: ERR004346: IMX6DQCE Chip Errata for the i.MX 6Dual/6Quad
218 */ 219 */
219 bus_space_write_2(bst, bsh, IMX_WDOG_WCR, WCR_WDE); 220 bus_space_write_2(bst, bsh, IMX_WDOG_WCR, WCR_WDE);
220 221
221 for (;;) 222 for (;;)
222 __asm("wfi"); 223 __asm("wfi");
223} 224}
224 225
225const struct arm_platform imx6_platform = { 226static const struct fdt_platform imx6_platform = {
226 .ap_devmap = imx_platform_devmap, 227 .fp_devmap = imx_platform_devmap,
227 .ap_bootstrap = imx_platform_bootstrap, 228 .fp_bootstrap = imx_platform_bootstrap,
228 .ap_init_attach_args = imx_platform_init_attach_args, 229 .fp_init_attach_args = imx_platform_init_attach_args,
229 .ap_device_register = imx_platform_device_register, 230 .fp_device_register = imx_platform_device_register,
230 .ap_reset = imx6_platform_reset, 231 .fp_reset = imx6_platform_reset,
231 .ap_delay = a9ptmr_delay, 232 .fp_delay = a9ptmr_delay,
232 .ap_uart_freq = imx_platform_uart_freq, 233 .fp_uart_freq = imx_platform_uart_freq,
233 .ap_mpstart = imx_platform_mpstart, 234 .fp_mpstart = imx_platform_mpstart,
234}; 235};
235 236
236ARM_PLATFORM(imx6dl, "fsl,imx6dl", &imx6_platform); 237FDT_PLATFORM(imx6dl, "fsl,imx6dl", &imx6_platform);
237ARM_PLATFORM(imx6q, "fsl,imx6q", &imx6_platform); 238FDT_PLATFORM(imx6q, "fsl,imx6q", &imx6_platform);
238ARM_PLATFORM(imx6qp, "fsl,imx6qp", &imx6_platform); 239FDT_PLATFORM(imx6qp, "fsl,imx6qp", &imx6_platform);

cvs diff -r1.16 -r1.17 src/sys/arch/arm/rockchip/rk_platform.c (expand / switch to unified diff)

--- src/sys/arch/arm/rockchip/rk_platform.c 2022/08/23 05:39:06 1.16
+++ src/sys/arch/arm/rockchip/rk_platform.c 2023/04/07 08:55:30 1.17
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: rk_platform.c,v 1.16 2022/08/23 05:39:06 ryo Exp $ */ 1/* $NetBSD: rk_platform.c,v 1.17 2023/04/07 08:55:30 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2018,2021 Jared McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2018,2021 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.
@@ -21,36 +21,36 @@ @@ -21,36 +21,36 @@
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 "opt_soc.h" 29#include "opt_soc.h"
30#include "opt_multiprocessor.h" 30#include "opt_multiprocessor.h"
31#include "opt_console.h" 31#include "opt_console.h"
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: rk_platform.c,v 1.16 2022/08/23 05:39:06 ryo Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: rk_platform.c,v 1.17 2023/04/07 08:55:30 skrll Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/bus.h> 37#include <sys/bus.h>
38#include <sys/cpu.h> 38#include <sys/cpu.h>
39#include <sys/device.h> 39#include <sys/device.h>
40#include <sys/termios.h> 40#include <sys/termios.h>
41 41
42 
43#include <dev/fdt/fdtvar.h> 42#include <dev/fdt/fdtvar.h>
 43
44#include <arm/fdt/arm_fdtvar.h> 44#include <arm/fdt/arm_fdtvar.h>
45 45
46#include <uvm/uvm_extern.h> 46#include <uvm/uvm_extern.h>
47 47
48#include <machine/bootconfig.h> 48#include <machine/bootconfig.h>
49#include <arm/cpufunc.h> 49#include <arm/cpufunc.h>
50 50
51#include <arm/cortex/gtmr_var.h> 51#include <arm/cortex/gtmr_var.h>
52 52
53#include <dev/ic/ns16550reg.h> 53#include <dev/ic/ns16550reg.h>
54#include <dev/ic/comreg.h> 54#include <dev/ic/comreg.h>
55 55
56#include <arm/arm/psci.h> 56#include <arm/arm/psci.h>
@@ -165,38 +165,38 @@ rk3288_platform_reset(void) @@ -165,38 +165,38 @@ rk3288_platform_reset(void)
165 bus_space_write_4(bst, rk3288_wdt_bsh, RK3288_WDT_TORR, 0); 165 bus_space_write_4(bst, rk3288_wdt_bsh, RK3288_WDT_TORR, 0);
166 bus_space_write_4(bst, rk3288_wdt_bsh, RK3288_WDT_CRR, RK3288_WDT_MAGIC); 166 bus_space_write_4(bst, rk3288_wdt_bsh, RK3288_WDT_CRR, RK3288_WDT_MAGIC);
167 for (;;) { 167 for (;;) {
168 bus_space_write_4(bst, rk3288_wdt_bsh, RK3288_WDT_CR, RK3288_WDT_CR_WDT_EN); 168 bus_space_write_4(bst, rk3288_wdt_bsh, RK3288_WDT_CR, RK3288_WDT_CR_WDT_EN);
169 } 169 }
170} 170}
171 171
172static u_int 172static u_int
173rk3288_platform_uart_freq(void) 173rk3288_platform_uart_freq(void)
174{ 174{
175 return RK3288_UART_FREQ; 175 return RK3288_UART_FREQ;
176} 176}
177 177
178static const struct arm_platform rk3288_platform = { 178static const struct fdt_platform rk3288_platform = {
179 .ap_devmap = rk3288_platform_devmap, 179 .fp_devmap = rk3288_platform_devmap,
180 .ap_bootstrap = rk3288_platform_bootstrap, 180 .fp_bootstrap = rk3288_platform_bootstrap,
181 .ap_init_attach_args = rk_platform_init_attach_args, 181 .fp_init_attach_args = rk_platform_init_attach_args,
182 .ap_device_register = rk_platform_device_register, 182 .fp_device_register = rk_platform_device_register,
183 .ap_reset = rk3288_platform_reset, 183 .fp_reset = rk3288_platform_reset,
184 .ap_delay = gtmr_delay, 184 .fp_delay = gtmr_delay,
185 .ap_uart_freq = rk3288_platform_uart_freq, 185 .fp_uart_freq = rk3288_platform_uart_freq,
186 .ap_mpstart = arm_fdt_cpu_mpstart, 186 .fp_mpstart = arm_fdt_cpu_mpstart,
187}; 187};
188 188
189ARM_PLATFORM(rk3288, "rockchip,rk3288", &rk3288_platform); 189FDT_PLATFORM(rk3288, "rockchip,rk3288", &rk3288_platform);
190#endif /* SOC_RK3288 */ 190#endif /* SOC_RK3288 */
191 191
192 192
193#ifdef SOC_RK3328 193#ifdef SOC_RK3328
194 194
195#include <arm/rockchip/rk3328_platform.h> 195#include <arm/rockchip/rk3328_platform.h>
196 196
197static const struct pmap_devmap * 197static const struct pmap_devmap *
198rk3328_platform_devmap(void) 198rk3328_platform_devmap(void)
199{ 199{
200 static const struct pmap_devmap devmap[] = { 200 static const struct pmap_devmap devmap[] = {
201 DEVMAP_ENTRY(RK3328_CORE_VBASE, 201 DEVMAP_ENTRY(RK3328_CORE_VBASE,
202 RK3328_CORE_PBASE, 202 RK3328_CORE_PBASE,
@@ -222,38 +222,38 @@ rk3328_platform_early_putchar(char c) @@ -222,38 +222,38 @@ rk3328_platform_early_putchar(char c)
222 ; 222 ;
223 223
224 uartaddr[com_data] = htole32(c); 224 uartaddr[com_data] = htole32(c);
225#undef CONSADDR_VA 225#undef CONSADDR_VA
226#endif 226#endif
227} 227}
228 228
229static u_int 229static u_int
230rk3328_platform_uart_freq(void) 230rk3328_platform_uart_freq(void)
231{ 231{
232 return RK3328_UART_FREQ; 232 return RK3328_UART_FREQ;
233} 233}
234 234
235static const struct arm_platform rk3328_platform = { 235static const struct fdt_platform rk3328_platform = {
236 .ap_devmap = rk3328_platform_devmap, 236 .fp_devmap = rk3328_platform_devmap,
237 .ap_bootstrap = rk_platform_bootstrap, 237 .fp_bootstrap = rk_platform_bootstrap,
238 .ap_init_attach_args = rk_platform_init_attach_args, 238 .fp_init_attach_args = rk_platform_init_attach_args,
239 .ap_device_register = rk_platform_device_register, 239 .fp_device_register = rk_platform_device_register,
240 .ap_reset = psci_fdt_reset, 240 .fp_reset = psci_fdt_reset,
241 .ap_delay = gtmr_delay, 241 .fp_delay = gtmr_delay,
242 .ap_uart_freq = rk3328_platform_uart_freq, 242 .fp_uart_freq = rk3328_platform_uart_freq,
243 .ap_mpstart = arm_fdt_cpu_mpstart, 243 .fp_mpstart = arm_fdt_cpu_mpstart,
244}; 244};
245 245
246ARM_PLATFORM(rk3328, "rockchip,rk3328", &rk3328_platform); 246FDT_PLATFORM(rk3328, "rockchip,rk3328", &rk3328_platform);
247 247
248#endif /* SOC_RK3328 */ 248#endif /* SOC_RK3328 */
249 249
250 250
251#ifdef SOC_RK3399 251#ifdef SOC_RK3399
252 252
253#include <arm/rockchip/rk3399_platform.h> 253#include <arm/rockchip/rk3399_platform.h>
254 254
255static const struct pmap_devmap * 255static const struct pmap_devmap *
256rk3399_platform_devmap(void) 256rk3399_platform_devmap(void)
257{ 257{
258 static const struct pmap_devmap devmap[] = { 258 static const struct pmap_devmap devmap[] = {
259 DEVMAP_ENTRY(RK3399_CORE_VBASE, 259 DEVMAP_ENTRY(RK3399_CORE_VBASE,
@@ -280,38 +280,38 @@ rk3399_platform_early_putchar(char c) @@ -280,38 +280,38 @@ rk3399_platform_early_putchar(char c)
280 ; 280 ;
281 281
282 uartaddr[com_data] = htole32(c); 282 uartaddr[com_data] = htole32(c);
283#undef CONSADDR_VA 283#undef CONSADDR_VA
284#endif 284#endif
285} 285}
286 286
287static u_int 287static u_int
288rk3399_platform_uart_freq(void) 288rk3399_platform_uart_freq(void)
289{ 289{
290 return RK3399_UART_FREQ; 290 return RK3399_UART_FREQ;
291} 291}
292 292
293static const struct arm_platform rk3399_platform = { 293static const struct fdt_platform rk3399_platform = {
294 .ap_devmap = rk3399_platform_devmap, 294 .fp_devmap = rk3399_platform_devmap,
295 .ap_bootstrap = rk_platform_bootstrap, 295 .fp_bootstrap = rk_platform_bootstrap,
296 .ap_init_attach_args = rk_platform_init_attach_args, 296 .fp_init_attach_args = rk_platform_init_attach_args,
297 .ap_device_register = rk_platform_device_register, 297 .fp_device_register = rk_platform_device_register,
298 .ap_reset = psci_fdt_reset, 298 .fp_reset = psci_fdt_reset,
299 .ap_delay = gtmr_delay, 299 .fp_delay = gtmr_delay,
300 .ap_uart_freq = rk3399_platform_uart_freq, 300 .fp_uart_freq = rk3399_platform_uart_freq,
301 .ap_mpstart = arm_fdt_cpu_mpstart, 301 .fp_mpstart = arm_fdt_cpu_mpstart,
302}; 302};
303 303
304ARM_PLATFORM(rk3399, "rockchip,rk3399", &rk3399_platform); 304FDT_PLATFORM(rk3399, "rockchip,rk3399", &rk3399_platform);
305 305
306#endif /* SOC_RK3399 */ 306#endif /* SOC_RK3399 */
307 307
308 308
309#ifdef SOC_RK3588 309#ifdef SOC_RK3588
310 310
311#include <arm/rockchip/rk3588_platform.h> 311#include <arm/rockchip/rk3588_platform.h>
312 312
313static const struct pmap_devmap * 313static const struct pmap_devmap *
314rk3588_platform_devmap(void) 314rk3588_platform_devmap(void)
315{ 315{
316 static const struct pmap_devmap devmap[] = { 316 static const struct pmap_devmap devmap[] = {
317 DEVMAP_ENTRY( 317 DEVMAP_ENTRY(
@@ -339,28 +339,28 @@ rk3588_platform_early_putchar(char c) @@ -339,28 +339,28 @@ rk3588_platform_early_putchar(char c)
339 ; 339 ;
340 340
341 uartaddr[com_data] = htole32(c); 341 uartaddr[com_data] = htole32(c);
342#undef CONSADDR_VA 342#undef CONSADDR_VA
343#endif 343#endif
344} 344}
345 345
346static u_int 346static u_int
347rk3588_platform_uart_freq(void) 347rk3588_platform_uart_freq(void)
348{ 348{
349 return RK3588_UART_FREQ; 349 return RK3588_UART_FREQ;
350} 350}
351 351
352static const struct arm_platform rk3588_platform = { 352static const struct fdt_platform rk3588_platform = {
353 .ap_devmap = rk3588_platform_devmap, 353 .fp_devmap = rk3588_platform_devmap,
354 .ap_bootstrap = rk_platform_bootstrap, 354 .fp_bootstrap = rk_platform_bootstrap,
355 .ap_init_attach_args = rk_platform_init_attach_args, 355 .fp_init_attach_args = rk_platform_init_attach_args,
356 .ap_device_register = rk_platform_device_register, 356 .fp_device_register = rk_platform_device_register,
357 .ap_reset = psci_fdt_reset, 357 .fp_reset = psci_fdt_reset,
358 .ap_delay = gtmr_delay, 358 .fp_delay = gtmr_delay,
359 .ap_uart_freq = rk3588_platform_uart_freq, 359 .fp_uart_freq = rk3588_platform_uart_freq,
360 .ap_mpstart = arm_fdt_cpu_mpstart, 360 .fp_mpstart = arm_fdt_cpu_mpstart,
361}; 361};
362 362
363ARM_PLATFORM(rk3588, "rockchip,rk3588", &rk3588_platform); 363FDT_PLATFORM(rk3588, "rockchip,rk3588", &rk3588_platform);
364 364
365#endif /* SOC_RK3588 */ 365#endif /* SOC_RK3588 */
366 366

cvs diff -r1.39 -r1.40 src/sys/arch/arm/samsung/exynos_platform.c (expand / switch to unified diff)

--- src/sys/arch/arm/samsung/exynos_platform.c 2022/10/29 13:29:46 1.39
+++ src/sys/arch/arm/samsung/exynos_platform.c 2023/04/07 08:55:30 1.40
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: exynos_platform.c,v 1.39 2022/10/29 13:29:46 jmcneill Exp $ */ 1/* $NetBSD: exynos_platform.c,v 1.40 2023/04/07 08:55:30 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2017 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2017 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.
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
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 "opt_arm_debug.h" 29#include "opt_arm_debug.h"
30#include "opt_console.h" 30#include "opt_console.h"
31#include "opt_exynos.h" 31#include "opt_exynos.h"
32#include "opt_multiprocessor.h" 32#include "opt_multiprocessor.h"
33#include "opt_console.h" 33#include "opt_console.h"
34 34
35#include "ukbd.h" 35#include "ukbd.h"
36 36
37#include <sys/cdefs.h> 37#include <sys/cdefs.h>
38__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.39 2022/10/29 13:29:46 jmcneill Exp $"); 38__KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.40 2023/04/07 08:55:30 skrll Exp $");
39 39
40#define EXYNOS_CORE_VBASE KERNEL_IO_VBASE 40#define EXYNOS_CORE_VBASE KERNEL_IO_VBASE
41 41
42/* 42/*
43 * Booting a CA7 core on Exynos5422 is currently broken, disable starting CA7 secondaries. 43 * Booting a CA7 core on Exynos5422 is currently broken, disable starting CA7 secondaries.
44 */ 44 */
45#define EXYNOS5422_DISABLE_CA7_CLUSTER 45#define EXYNOS5422_DISABLE_CA7_CLUSTER
46 46
47#include <sys/param.h> 47#include <sys/param.h>
48#include <sys/bus.h> 48#include <sys/bus.h>
49#include <sys/cpu.h> 49#include <sys/cpu.h>
50#include <sys/device.h> 50#include <sys/device.h>
51#include <sys/termios.h> 51#include <sys/termios.h>
@@ -286,38 +286,38 @@ exynos4_platform_devmap(void) @@ -286,38 +286,38 @@ exynos4_platform_devmap(void)
286} 286}
287 287
288static void 288static void
289exynos4_platform_bootstrap(void) 289exynos4_platform_bootstrap(void)
290{ 290{
291 291
292 exynos_bootstrap(4); 292 exynos_bootstrap(4);
293 293
294#if defined(MULTIPROCESSOR) 294#if defined(MULTIPROCESSOR)
295 arm_cpu_max = 1 + __SHIFTOUT(armreg_l2ctrl_read(), L2CTRL_NUMCPU); 295 arm_cpu_max = 1 + __SHIFTOUT(armreg_l2ctrl_read(), L2CTRL_NUMCPU);
296#endif 296#endif
297} 297}
298 298
299static const struct arm_platform exynos4_platform = { 299static const struct fdt_platform exynos4_platform = {
300 .ap_devmap = exynos4_platform_devmap, 300 .fp_devmap = exynos4_platform_devmap,
301// .ap_mpstart = exynos4_mpstart, 301// .fp_mpstart = exynos4_mpstart,
302 .ap_bootstrap = exynos4_platform_bootstrap, 302 .fp_bootstrap = exynos4_platform_bootstrap,
303 .ap_init_attach_args = exynos_platform_init_attach_args, 303 .fp_init_attach_args = exynos_platform_init_attach_args,
304 .ap_device_register = exynos_platform_device_register, 304 .fp_device_register = exynos_platform_device_register,
305 .ap_reset = exynos5_platform_reset, 305 .fp_reset = exynos5_platform_reset,
306 .ap_delay = mct_delay, 306 .fp_delay = mct_delay,
307 .ap_uart_freq = exynos_platform_uart_freq, 307 .fp_uart_freq = exynos_platform_uart_freq,
308}; 308};
309 309
310ARM_PLATFORM(exynos4, "samsung,exynos4", &exynos4_platform); 310FDT_PLATFORM(exynos4, "samsung,exynos4", &exynos4_platform);
311#endif 311#endif
312 312
313 313
314#if defined(SOC_EXYNOS5) 314#if defined(SOC_EXYNOS5)
315static const struct pmap_devmap * 315static const struct pmap_devmap *
316exynos5_platform_devmap(void) 316exynos5_platform_devmap(void)
317{ 317{
318 static const struct pmap_devmap devmap[] = { 318 static const struct pmap_devmap devmap[] = {
319 DEVMAP_ENTRY(EXYNOS_CORE_VBASE, 319 DEVMAP_ENTRY(EXYNOS_CORE_VBASE,
320 EXYNOS_CORE_PBASE, 320 EXYNOS_CORE_PBASE,
321 EXYNOS5_CORE_SIZE), 321 EXYNOS5_CORE_SIZE),
322 DEVMAP_ENTRY(EXYNOS5_AUDIOCORE_VBASE, 322 DEVMAP_ENTRY(EXYNOS5_AUDIOCORE_VBASE,
323 EXYNOS5_AUDIOCORE_PBASE, 323 EXYNOS5_AUDIOCORE_PBASE,
@@ -352,26 +352,26 @@ exynos5_platform_bootstrap(void) @@ -352,26 +352,26 @@ exynos5_platform_bootstrap(void)
352 const void *prop = fdt_getprop(fdt_data, cpu_off, "reg", &len); 352 const void *prop = fdt_getprop(fdt_data, cpu_off, "reg", &len);
353 if (len != 4) 353 if (len != 4)
354 continue; 354 continue;
355 const uint32_t mpidr = be32dec(prop); 355 const uint32_t mpidr = be32dec(prop);
356 if (mpidr != cpu_mpidr_aff_read() && __SHIFTOUT(mpidr, MPIDR_AFF1) == 1) 356 if (mpidr != cpu_mpidr_aff_read() && __SHIFTOUT(mpidr, MPIDR_AFF1) == 1)
357 fdt_setprop_string(fdt_data, cpu_off, "status", "fail"); 357 fdt_setprop_string(fdt_data, cpu_off, "status", "fail");
358 } 358 }
359 } 359 }
360#endif 360#endif
361 361
362 arm_fdt_cpu_bootstrap(); 362 arm_fdt_cpu_bootstrap();
363} 363}
364 364
365static const struct arm_platform exynos5_platform = { 365static const struct fdt_platform exynos5_platform = {
366 .ap_devmap = exynos5_platform_devmap, 366 .fp_devmap = exynos5_platform_devmap,
367 .ap_bootstrap = exynos5_platform_bootstrap, 367 .fp_bootstrap = exynos5_platform_bootstrap,
368 .ap_mpstart = exynos_platform_mpstart, 368 .fp_mpstart = exynos_platform_mpstart,
369 .ap_init_attach_args = exynos_platform_init_attach_args, 369 .fp_init_attach_args = exynos_platform_init_attach_args,
370 .ap_device_register = exynos_platform_device_register, 370 .fp_device_register = exynos_platform_device_register,
371 .ap_reset = exynos5_platform_reset, 371 .fp_reset = exynos5_platform_reset,
372 .ap_delay = mct_delay, 372 .fp_delay = mct_delay,
373 .ap_uart_freq = exynos_platform_uart_freq, 373 .fp_uart_freq = exynos_platform_uart_freq,
374}; 374};
375 375
376ARM_PLATFORM(exynos5, "samsung,exynos5", &exynos5_platform); 376FDT_PLATFORM(exynos5, "samsung,exynos5", &exynos5_platform);
377#endif 377#endif

cvs diff -r1.46 -r1.47 src/sys/arch/arm/sunxi/sunxi_platform.c (expand / switch to unified diff)

--- src/sys/arch/arm/sunxi/sunxi_platform.c 2022/06/28 05:19:03 1.46
+++ src/sys/arch/arm/sunxi/sunxi_platform.c 2023/04/07 08:55:30 1.47
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sunxi_platform.c,v 1.46 2022/06/28 05:19:03 skrll Exp $ */ 1/* $NetBSD: sunxi_platform.c,v 1.47 2023/04/07 08:55:30 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 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.
@@ -21,35 +21,36 @@ @@ -21,35 +21,36 @@
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 "opt_soc.h" 29#include "opt_soc.h"
30#include "opt_multiprocessor.h" 30#include "opt_multiprocessor.h"
31#include "opt_console.h" 31#include "opt_console.h"
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.46 2022/06/28 05:19:03 skrll Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.47 2023/04/07 08:55:30 skrll Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/bus.h> 37#include <sys/bus.h>
38#include <sys/cpu.h> 38#include <sys/cpu.h>
39#include <sys/device.h> 39#include <sys/device.h>
40#include <sys/termios.h> 40#include <sys/termios.h>
41 41
42#include <dev/fdt/fdtvar.h> 42#include <dev/fdt/fdtvar.h>
 43
43#include <arm/fdt/arm_fdtvar.h> 44#include <arm/fdt/arm_fdtvar.h>
44 45
45#include <uvm/uvm_extern.h> 46#include <uvm/uvm_extern.h>
46 47
47#include <machine/bootconfig.h> 48#include <machine/bootconfig.h>
48#include <arm/cpufunc.h> 49#include <arm/cpufunc.h>
49 50
50#include <arm/cortex/gtmr_var.h> 51#include <arm/cortex/gtmr_var.h>
51#include <arm/cortex/gic_reg.h> 52#include <arm/cortex/gic_reg.h>
52 53
53#include <dev/ic/ns16550reg.h> 54#include <dev/ic/ns16550reg.h>
54#include <dev/ic/comreg.h> 55#include <dev/ic/comreg.h>
55 56
@@ -416,131 +417,131 @@ sun9i_platform_reset(void) @@ -416,131 +417,131 @@ sun9i_platform_reset(void)
416 bus_space_write_4(bst, reset_bsh, SUN9I_WDT_CFG, SUN9I_WDT_CFG_SYS); 417 bus_space_write_4(bst, reset_bsh, SUN9I_WDT_CFG, SUN9I_WDT_CFG_SYS);
417 bus_space_write_4(bst, reset_bsh, SUN9I_WDT_MODE, SUN9I_WDT_MODE_EN); 418 bus_space_write_4(bst, reset_bsh, SUN9I_WDT_MODE, SUN9I_WDT_MODE_EN);
418} 419}
419 420
420static void 421static void
421sun50i_h6_platform_reset(void) 422sun50i_h6_platform_reset(void)
422{ 423{
423 bus_space_tag_t bst = &sunxi_bs_tag; 424 bus_space_tag_t bst = &sunxi_bs_tag;
424 425
425 bus_space_write_4(bst, reset_bsh, SUN50I_H6_WDT_CFG, SUN50I_H6_WDT_CFG_SYS); 426 bus_space_write_4(bst, reset_bsh, SUN50I_H6_WDT_CFG, SUN50I_H6_WDT_CFG_SYS);
426 bus_space_write_4(bst, reset_bsh, SUN50I_H6_WDT_MODE, SUN50I_H6_WDT_MODE_EN); 427 bus_space_write_4(bst, reset_bsh, SUN50I_H6_WDT_MODE, SUN50I_H6_WDT_MODE_EN);
427} 428}
428 429
429static const struct arm_platform sun4i_platform = { 430static const struct fdt_platform sun4i_platform = {
430 .ap_devmap = sunxi_platform_devmap, 431 .fp_devmap = sunxi_platform_devmap,
431 .ap_bootstrap = sun4i_platform_bootstrap, 432 .fp_bootstrap = sun4i_platform_bootstrap,
432 .ap_init_attach_args = sunxi_platform_init_attach_args, 433 .fp_init_attach_args = sunxi_platform_init_attach_args,
433 .ap_device_register = sunxi_platform_device_register, 434 .fp_device_register = sunxi_platform_device_register,
434 .ap_reset = sun4i_platform_reset, 435 .fp_reset = sun4i_platform_reset,
435 .ap_delay = sun4i_platform_delay, 436 .fp_delay = sun4i_platform_delay,
436 .ap_uart_freq = sunxi_platform_uart_freq, 437 .fp_uart_freq = sunxi_platform_uart_freq,
437}; 438};
438 439
439ARM_PLATFORM(sun4i_a10, "allwinner,sun4i-a10", &sun4i_platform); 440FDT_PLATFORM(sun4i_a10, "allwinner,sun4i-a10", &sun4i_platform);
440 441
441static const struct arm_platform sun5i_platform = { 442static const struct fdt_platform sun5i_platform = {
442 .ap_devmap = sunxi_platform_devmap, 443 .fp_devmap = sunxi_platform_devmap,
443 .ap_bootstrap = sun4i_platform_bootstrap, 444 .fp_bootstrap = sun4i_platform_bootstrap,
444 .ap_init_attach_args = sunxi_platform_init_attach_args, 445 .fp_init_attach_args = sunxi_platform_init_attach_args,
445 .ap_device_register = sunxi_platform_device_register, 446 .fp_device_register = sunxi_platform_device_register,
446 .ap_reset = sun4i_platform_reset, 447 .fp_reset = sun4i_platform_reset,
447 .ap_delay = sun4i_platform_delay, 448 .fp_delay = sun4i_platform_delay,
448 .ap_uart_freq = sunxi_platform_uart_freq, 449 .fp_uart_freq = sunxi_platform_uart_freq,
449}; 450};
450 451
451ARM_PLATFORM(sun5i_a13, "allwinner,sun5i-a13", &sun5i_platform); 452FDT_PLATFORM(sun5i_a13, "allwinner,sun5i-a13", &sun5i_platform);
452ARM_PLATFORM(sun5i_gr8, "nextthing,gr8", &sun5i_platform); 453FDT_PLATFORM(sun5i_gr8, "nextthing,gr8", &sun5i_platform);
453 454
454static const struct arm_platform sun6i_platform = { 455static const struct fdt_platform sun6i_platform = {
455 .ap_devmap = sunxi_platform_devmap, 456 .fp_devmap = sunxi_platform_devmap,
456 .ap_bootstrap = sun6i_platform_bootstrap, 457 .fp_bootstrap = sun6i_platform_bootstrap,
457 .ap_init_attach_args = sunxi_platform_init_attach_args, 458 .fp_init_attach_args = sunxi_platform_init_attach_args,
458 .ap_device_register = sunxi_platform_device_register, 459 .fp_device_register = sunxi_platform_device_register,
459 .ap_reset = sun6i_platform_reset, 460 .fp_reset = sun6i_platform_reset,
460 .ap_delay = gtmr_delay, 461 .fp_delay = gtmr_delay,
461 .ap_uart_freq = sunxi_platform_uart_freq, 462 .fp_uart_freq = sunxi_platform_uart_freq,
462 .ap_mpstart = arm_fdt_cpu_mpstart, 463 .fp_mpstart = arm_fdt_cpu_mpstart,
463}; 464};
464 465
465ARM_PLATFORM(sun6i_a31, "allwinner,sun6i-a31", &sun6i_platform); 466FDT_PLATFORM(sun6i_a31, "allwinner,sun6i-a31", &sun6i_platform);
466 467
467static const struct arm_platform sun7i_platform = { 468static const struct fdt_platform sun7i_platform = {
468 .ap_devmap = sunxi_platform_devmap, 469 .fp_devmap = sunxi_platform_devmap,
469 .ap_bootstrap = sun4i_platform_bootstrap, 470 .fp_bootstrap = sun4i_platform_bootstrap,
470 .ap_init_attach_args = sunxi_platform_init_attach_args, 471 .fp_init_attach_args = sunxi_platform_init_attach_args,
471 .ap_device_register = sunxi_platform_device_register, 472 .fp_device_register = sunxi_platform_device_register,
472 .ap_reset = sun4i_platform_reset, 473 .fp_reset = sun4i_platform_reset,
473 .ap_delay = sun4i_platform_delay, 474 .fp_delay = sun4i_platform_delay,
474 .ap_uart_freq = sunxi_platform_uart_freq, 475 .fp_uart_freq = sunxi_platform_uart_freq,
475 .ap_mpstart = arm_fdt_cpu_mpstart, 476 .fp_mpstart = arm_fdt_cpu_mpstart,
476}; 477};
477 478
478ARM_PLATFORM(sun7i_a20, "allwinner,sun7i-a20", &sun7i_platform); 479FDT_PLATFORM(sun7i_a20, "allwinner,sun7i-a20", &sun7i_platform);
479 480
480static const struct arm_platform sun8i_platform = { 481static const struct fdt_platform sun8i_platform = {
481 .ap_devmap = sunxi_platform_devmap, 482 .fp_devmap = sunxi_platform_devmap,
482 .ap_bootstrap = sun6i_platform_bootstrap, 483 .fp_bootstrap = sun6i_platform_bootstrap,
483 .ap_init_attach_args = sunxi_platform_init_attach_args, 484 .fp_init_attach_args = sunxi_platform_init_attach_args,
484 .ap_device_register = sunxi_platform_device_register, 485 .fp_device_register = sunxi_platform_device_register,
485 .ap_reset = sun6i_platform_reset, 486 .fp_reset = sun6i_platform_reset,
486 .ap_delay = gtmr_delay, 487 .fp_delay = gtmr_delay,
487 .ap_uart_freq = sunxi_platform_uart_freq, 488 .fp_uart_freq = sunxi_platform_uart_freq,
488 .ap_mpstart = arm_fdt_cpu_mpstart, 489 .fp_mpstart = arm_fdt_cpu_mpstart,
489}; 490};
490 491
491ARM_PLATFORM(sun8i_h2plus, "allwinner,sun8i-h2-plus", &sun8i_platform); 492FDT_PLATFORM(sun8i_h2plus, "allwinner,sun8i-h2-plus", &sun8i_platform);
492ARM_PLATFORM(sun8i_h3, "allwinner,sun8i-h3", &sun8i_platform); 493FDT_PLATFORM(sun8i_h3, "allwinner,sun8i-h3", &sun8i_platform);
493ARM_PLATFORM(sun8i_v3s, "allwinner,sun8i-v3s", &sun8i_platform); 494FDT_PLATFORM(sun8i_v3s, "allwinner,sun8i-v3s", &sun8i_platform);
494 495
495static const struct arm_platform sun8i_a83t_platform = { 496static const struct fdt_platform sun8i_a83t_platform = {
496 .ap_devmap = sun8i_a83t_platform_devmap, 497 .fp_devmap = sun8i_a83t_platform_devmap,
497 .ap_bootstrap = sun6i_platform_bootstrap, 498 .fp_bootstrap = sun6i_platform_bootstrap,
498 .ap_init_attach_args = sunxi_platform_init_attach_args, 499 .fp_init_attach_args = sunxi_platform_init_attach_args,
499 .ap_device_register = sunxi_platform_device_register, 500 .fp_device_register = sunxi_platform_device_register,
500 .ap_reset = sun6i_platform_reset, 501 .fp_reset = sun6i_platform_reset,
501 .ap_delay = gtmr_delay, 502 .fp_delay = gtmr_delay,
502 .ap_uart_freq = sunxi_platform_uart_freq, 503 .fp_uart_freq = sunxi_platform_uart_freq,
503 .ap_mpstart = arm_fdt_cpu_mpstart, 504 .fp_mpstart = arm_fdt_cpu_mpstart,
504}; 505};
505 506
506ARM_PLATFORM(sun8i_a83t, "allwinner,sun8i-a83t", &sun8i_a83t_platform); 507FDT_PLATFORM(sun8i_a83t, "allwinner,sun8i-a83t", &sun8i_a83t_platform);
507 508
508static const struct arm_platform sun9i_platform = { 509static const struct fdt_platform sun9i_platform = {
509 .ap_devmap = sun9i_a80_platform_devmap, 510 .fp_devmap = sun9i_a80_platform_devmap,
510 .ap_bootstrap = sun9i_platform_bootstrap, 511 .fp_bootstrap = sun9i_platform_bootstrap,
511 .ap_init_attach_args = sunxi_platform_init_attach_args, 512 .fp_init_attach_args = sunxi_platform_init_attach_args,
512 .ap_device_register = sunxi_platform_device_register, 513 .fp_device_register = sunxi_platform_device_register,
513 .ap_reset = sun9i_platform_reset, 514 .fp_reset = sun9i_platform_reset,
514 .ap_delay = gtmr_delay, 515 .fp_delay = gtmr_delay,
515 .ap_uart_freq = sunxi_platform_uart_freq, 516 .fp_uart_freq = sunxi_platform_uart_freq,
516 .ap_mpstart = arm_fdt_cpu_mpstart, 517 .fp_mpstart = arm_fdt_cpu_mpstart,
517}; 518};
518 519
519ARM_PLATFORM(sun9i_a80, "allwinner,sun9i-a80", &sun9i_platform); 520FDT_PLATFORM(sun9i_a80, "allwinner,sun9i-a80", &sun9i_platform);
520 521
521static const struct arm_platform sun50i_platform = { 522static const struct fdt_platform sun50i_platform = {
522 .ap_devmap = sunxi_platform_devmap, 523 .fp_devmap = sunxi_platform_devmap,
523 .ap_bootstrap = sun6i_platform_bootstrap, 524 .fp_bootstrap = sun6i_platform_bootstrap,
524 .ap_init_attach_args = sunxi_platform_init_attach_args, 525 .fp_init_attach_args = sunxi_platform_init_attach_args,
525 .ap_device_register = sunxi_platform_device_register, 526 .fp_device_register = sunxi_platform_device_register,
526 .ap_reset = sun6i_platform_reset, 527 .fp_reset = sun6i_platform_reset,
527 .ap_delay = gtmr_delay, 528 .fp_delay = gtmr_delay,
528 .ap_uart_freq = sunxi_platform_uart_freq, 529 .fp_uart_freq = sunxi_platform_uart_freq,
529 .ap_mpstart = arm_fdt_cpu_mpstart, 530 .fp_mpstart = arm_fdt_cpu_mpstart,
530}; 531};
531 532
532ARM_PLATFORM(sun50i_a64, "allwinner,sun50i-a64", &sun50i_platform); 533FDT_PLATFORM(sun50i_a64, "allwinner,sun50i-a64", &sun50i_platform);
533ARM_PLATFORM(sun50i_h5, "allwinner,sun50i-h5", &sun50i_platform); 534FDT_PLATFORM(sun50i_h5, "allwinner,sun50i-h5", &sun50i_platform);
534 535
535static const struct arm_platform sun50i_h6_platform = { 536static const struct fdt_platform sun50i_h6_platform = {
536 .ap_devmap = sunxi_platform_devmap, 537 .fp_devmap = sunxi_platform_devmap,
537 .ap_bootstrap = sun50i_h6_platform_bootstrap, 538 .fp_bootstrap = sun50i_h6_platform_bootstrap,
538 .ap_init_attach_args = sunxi_platform_init_attach_args, 539 .fp_init_attach_args = sunxi_platform_init_attach_args,
539 .ap_device_register = sunxi_platform_device_register, 540 .fp_device_register = sunxi_platform_device_register,
540 .ap_reset = sun50i_h6_platform_reset, 541 .fp_reset = sun50i_h6_platform_reset,
541 .ap_delay = gtmr_delay, 542 .fp_delay = gtmr_delay,
542 .ap_uart_freq = sunxi_platform_uart_freq, 543 .fp_uart_freq = sunxi_platform_uart_freq,
543 .ap_mpstart = arm_fdt_cpu_mpstart, 544 .fp_mpstart = arm_fdt_cpu_mpstart,
544}; 545};
545 546
546ARM_PLATFORM(sun50i_h6, "allwinner,sun50i-h6", &sun50i_h6_platform); 547FDT_PLATFORM(sun50i_h6, "allwinner,sun50i-h6", &sun50i_h6_platform);

cvs diff -r1.3 -r1.4 src/sys/arch/arm/ti/am3_platform.c (expand / switch to unified diff)

--- src/sys/arch/arm/ti/am3_platform.c 2020/09/28 11:54:23 1.3
+++ src/sys/arch/arm/ti/am3_platform.c 2023/04/07 08:55:30 1.4
@@ -1,23 +1,24 @@ @@ -1,23 +1,24 @@
1/* $NetBSD: am3_platform.c,v 1.3 2020/09/28 11:54:23 jmcneill Exp $ */ 1/* $NetBSD: am3_platform.c,v 1.4 2023/04/07 08:55:30 skrll Exp $ */
2 2
3#include "opt_console.h" 3#include "opt_console.h"
4 4
5#include <sys/cdefs.h> 5#include <sys/cdefs.h>
6__KERNEL_RCSID(0, "$NetBSD: am3_platform.c,v 1.3 2020/09/28 11:54:23 jmcneill Exp $"); 6__KERNEL_RCSID(0, "$NetBSD: am3_platform.c,v 1.4 2023/04/07 08:55:30 skrll Exp $");
7 7
8#include <sys/param.h> 8#include <sys/param.h>
9 9
10#include <dev/fdt/fdtvar.h> 10#include <dev/fdt/fdtvar.h>
 11
11#include <arm/fdt/arm_fdtvar.h> 12#include <arm/fdt/arm_fdtvar.h>
12 13
13#include <uvm/uvm_extern.h> 14#include <uvm/uvm_extern.h>
14 15
15#include <dev/ic/comreg.h> 16#include <dev/ic/comreg.h>
16 17
17#include <machine/vmparam.h> 18#include <machine/vmparam.h>
18#include <arch/evbarm/fdt/platform.h> 19#include <arch/evbarm/fdt/platform.h>
19 20
20extern struct bus_space armv7_generic_bs_tag; 21extern struct bus_space armv7_generic_bs_tag;
21extern struct arm32_bus_dma_tag arm_generic_dma_tag; 22extern struct arm32_bus_dma_tag arm_generic_dma_tag;
22 23
23void am33xx_platform_early_putchar(char); 24void am33xx_platform_early_putchar(char);
@@ -127,23 +128,23 @@ am33xx_platform_delay(u_int n) @@ -127,23 +128,23 @@ am33xx_platform_delay(u_int n)
127 ticks -= (UINT32_MAX - cur + prev); 128 ticks -= (UINT32_MAX - cur + prev);
128 prev = cur; 129 prev = cur;
129 } 130 }
130} 131}
131 132
132static void 133static void
133am33xx_platform_reset(void) 134am33xx_platform_reset(void)
134{ 135{
135 volatile uint32_t *resetaddr = (volatile uint32_t *)(KERNEL_IO_VBASE | 0x04e00f00); 136 volatile uint32_t *resetaddr = (volatile uint32_t *)(KERNEL_IO_VBASE | 0x04e00f00);
136 137
137 *resetaddr = 1; 138 *resetaddr = 1;
138} 139}
139 140
140static const struct arm_platform am33xx_platform = { 141static const struct fdt_platform am33xx_platform = {
141 .ap_devmap = am33xx_platform_devmap, 142 .fp_devmap = am33xx_platform_devmap,
142 .ap_init_attach_args = am33xx_platform_init_attach_args, 143 .fp_init_attach_args = am33xx_platform_init_attach_args,
143 .ap_bootstrap = am33xx_platform_bootstrap, 144 .fp_bootstrap = am33xx_platform_bootstrap,
144 .ap_uart_freq = am33xx_platform_uart_freq, 145 .fp_uart_freq = am33xx_platform_uart_freq,
145 .ap_delay = am33xx_platform_delay, 146 .fp_delay = am33xx_platform_delay,
146 .ap_reset = am33xx_platform_reset, 147 .fp_reset = am33xx_platform_reset,
147}; 148};
148 149
149ARM_PLATFORM(am33xx, "ti,am33xx", &am33xx_platform); 150FDT_PLATFORM(am33xx, "ti,am33xx", &am33xx_platform);

cvs diff -r1.7 -r1.8 src/sys/arch/arm/ti/omap3_platform.c (expand / switch to unified diff)

--- src/sys/arch/arm/ti/omap3_platform.c 2021/04/24 23:36:29 1.7
+++ src/sys/arch/arm/ti/omap3_platform.c 2023/04/07 08:55:30 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: omap3_platform.c,v 1.7 2021/04/24 23:36:29 thorpej Exp $ */ 1/* $NetBSD: omap3_platform.c,v 1.8 2023/04/07 08:55:30 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2019 Jared McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2019 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.
@@ -20,35 +20,36 @@ @@ -20,35 +20,36 @@
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 "opt_soc.h" 29#include "opt_soc.h"
30#include "opt_console.h" 30#include "opt_console.h"
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: omap3_platform.c,v 1.7 2021/04/24 23:36:29 thorpej Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: omap3_platform.c,v 1.8 2023/04/07 08:55:30 skrll Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/bus.h> 36#include <sys/bus.h>
37#include <sys/cpu.h> 37#include <sys/cpu.h>
38#include <sys/device.h> 38#include <sys/device.h>
39#include <sys/termios.h> 39#include <sys/termios.h>
40 40
41#include <dev/fdt/fdtvar.h> 41#include <dev/fdt/fdtvar.h>
 42
42#include <arm/fdt/arm_fdtvar.h> 43#include <arm/fdt/arm_fdtvar.h>
43 44
44#include <uvm/uvm_extern.h> 45#include <uvm/uvm_extern.h>
45 46
46#include <machine/bootconfig.h> 47#include <machine/bootconfig.h>
47#include <arm/cpufunc.h> 48#include <arm/cpufunc.h>
48 49
49#include <dev/ic/ns16550reg.h> 50#include <dev/ic/ns16550reg.h>
50#include <dev/ic/comreg.h> 51#include <dev/ic/comreg.h>
51 52
52#include <evbarm/fdt/platform.h> 53#include <evbarm/fdt/platform.h>
53#include <evbarm/fdt/machdep.h> 54#include <evbarm/fdt/machdep.h>
54 55
@@ -175,24 +176,24 @@ omap3_platform_delay(u_int n) @@ -175,24 +176,24 @@ omap3_platform_delay(u_int n)
175 176
176 long ticks = howmany(n * 32768, 1000000); 177 long ticks = howmany(n * 32768, 1000000);
177 prev = *cr; 178 prev = *cr;
178 while (ticks > 0) { 179 while (ticks > 0) {
179 cur = *cr; 180 cur = *cr;
180 if (cur >= prev) 181 if (cur >= prev)
181 ticks -= (cur - prev); 182 ticks -= (cur - prev);
182 else 183 else
183 ticks -= (UINT32_MAX - cur + prev); 184 ticks -= (UINT32_MAX - cur + prev);
184 prev = cur; 185 prev = cur;
185 } 186 }
186} 187}
187 188
188static const struct arm_platform omap3_platform = { 189static const struct fdt_platform omap3_platform = {
189 .ap_devmap = omap3_platform_devmap, 190 .fp_devmap = omap3_platform_devmap,
190 .ap_bootstrap = arm_fdt_cpu_bootstrap, 191 .fp_bootstrap = arm_fdt_cpu_bootstrap,
191 .ap_init_attach_args = omap3_platform_init_attach_args, 192 .fp_init_attach_args = omap3_platform_init_attach_args,
192 .ap_device_register = omap3_platform_device_register, 193 .fp_device_register = omap3_platform_device_register,
193 .ap_reset = omap3_platform_reset, 194 .fp_reset = omap3_platform_reset,
194 .ap_delay = omap3_platform_delay, 195 .fp_delay = omap3_platform_delay,
195 .ap_uart_freq = omap3_platform_uart_freq, 196 .fp_uart_freq = omap3_platform_uart_freq,
196}; 197};
197 198
198ARM_PLATFORM(omap3, "ti,omap3", &omap3_platform); 199FDT_PLATFORM(omap3, "ti,omap3", &omap3_platform);

cvs diff -r1.22 -r1.23 src/sys/arch/arm/vexpress/vexpress_platform.c (expand / switch to unified diff)

--- src/sys/arch/arm/vexpress/vexpress_platform.c 2021/04/24 23:36:29 1.22
+++ src/sys/arch/arm/vexpress/vexpress_platform.c 2023/04/07 08:55:31 1.23
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: vexpress_platform.c,v 1.22 2021/04/24 23:36:29 thorpej Exp $ */ 1/* $NetBSD: vexpress_platform.c,v 1.23 2023/04/07 08:55:31 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 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.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
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 "opt_multiprocessor.h" 29#include "opt_multiprocessor.h"
30#include "opt_console.h" 30#include "opt_console.h"
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: vexpress_platform.c,v 1.22 2021/04/24 23:36:29 thorpej Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: vexpress_platform.c,v 1.23 2023/04/07 08:55:31 skrll Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/bus.h> 36#include <sys/bus.h>
37#include <sys/cpu.h> 37#include <sys/cpu.h>
38#include <sys/device.h> 38#include <sys/device.h>
39#include <sys/termios.h> 39#include <sys/termios.h>
40 40
41#include <dev/fdt/fdtvar.h> 41#include <dev/fdt/fdtvar.h>
42 42
43#include <uvm/uvm_extern.h> 43#include <uvm/uvm_extern.h>
44 44
45#include <machine/bootconfig.h> 45#include <machine/bootconfig.h>
46#include <arm/cpufunc.h> 46#include <arm/cpufunc.h>
@@ -205,25 +205,25 @@ vexpress_platform_reset(void) @@ -205,25 +205,25 @@ vexpress_platform_reset(void)
205 SYSREG_WRITE(SYS_CFGCTRL, 205 SYSREG_WRITE(SYS_CFGCTRL,
206 SYS_CFGCTRL_START | 206 SYS_CFGCTRL_START |
207 SYS_CFGCTRL_WRITE | 207 SYS_CFGCTRL_WRITE |
208 __SHIFTIN(SYS_CFGCTRL_FUNCTION_REBOOT, 208 __SHIFTIN(SYS_CFGCTRL_FUNCTION_REBOOT,
209 SYS_CFGCTRL_FUNCTION)); 209 SYS_CFGCTRL_FUNCTION));
210} 210}
211 211
212static u_int 212static u_int
213vexpress_platform_uart_freq(void) 213vexpress_platform_uart_freq(void)
214{ 214{
215 return VEXPRESS_REF_FREQ; 215 return VEXPRESS_REF_FREQ;
216} 216}
217 217
218static const struct arm_platform vexpress_platform = { 218static const struct fdt_platform vexpress_platform = {
219 .ap_devmap = vexpress_platform_devmap, 219 .fp_devmap = vexpress_platform_devmap,
220 .ap_bootstrap = vexpress_platform_bootstrap, 220 .fp_bootstrap = vexpress_platform_bootstrap,
221 .ap_mpstart = vexpress_a15_smp_init, 221 .fp_mpstart = vexpress_a15_smp_init,
222 .ap_init_attach_args = vexpress_platform_init_attach_args, 222 .fp_init_attach_args = vexpress_platform_init_attach_args,
223 .ap_device_register = vexpress_platform_device_register, 223 .fp_device_register = vexpress_platform_device_register,
224 .ap_reset = vexpress_platform_reset, 224 .fp_reset = vexpress_platform_reset,
225 .ap_delay = gtmr_delay, 225 .fp_delay = gtmr_delay,
226 .ap_uart_freq = vexpress_platform_uart_freq, 226 .fp_uart_freq = vexpress_platform_uart_freq,
227}; 227};
228 228
229ARM_PLATFORM(vexpress, "arm,vexpress", &vexpress_platform); 229FDT_PLATFORM(vexpress, "arm,vexpress", &vexpress_platform);

cvs diff -r1.10 -r1.11 src/sys/arch/arm/xilinx/zynq_platform.c (expand / switch to unified diff)

--- src/sys/arch/arm/xilinx/zynq_platform.c 2022/10/31 22:23:38 1.10
+++ src/sys/arch/arm/xilinx/zynq_platform.c 2023/04/07 08:55:31 1.11
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: zynq_platform.c,v 1.10 2022/10/31 22:23:38 jmcneill Exp $ */ 1/* $NetBSD: zynq_platform.c,v 1.11 2023/04/07 08:55:31 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2019 The NetBSD Foundation, Inc. 4 * Copyright (c) 2019 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Nick Hudson 8 * by Nick Hudson
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include "opt_console.h" 32#include "opt_console.h"
33#include "opt_soc.h" 33#include "opt_soc.h"
34 34
35#include "arml2cc.h" 35#include "arml2cc.h"
36 36
37#include <sys/cdefs.h> 37#include <sys/cdefs.h>
38__KERNEL_RCSID(0, "$NetBSD: zynq_platform.c,v 1.10 2022/10/31 22:23:38 jmcneill Exp $"); 38__KERNEL_RCSID(0, "$NetBSD: zynq_platform.c,v 1.11 2023/04/07 08:55:31 skrll Exp $");
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/bus.h> 41#include <sys/bus.h>
42#include <sys/cpu.h> 42#include <sys/cpu.h>
43#include <sys/device.h> 43#include <sys/device.h>
44 44
45#include <dev/fdt/fdtvar.h> 45#include <dev/fdt/fdtvar.h>
46#include <arm/fdt/arm_fdtvar.h> 46#include <arm/fdt/arm_fdtvar.h>
47 47
48#include <uvm/uvm_extern.h> 48#include <uvm/uvm_extern.h>
49 49
50#include <machine/bootconfig.h> 50#include <machine/bootconfig.h>
51 51
@@ -242,28 +242,28 @@ zynq_platform_bootstrap(void) @@ -242,28 +242,28 @@ zynq_platform_bootstrap(void)
242 } 242 }
243} 243}
244 244
245static void 245static void
246zynq_platform_reset(void) 246zynq_platform_reset(void)
247{ 247{
248 bus_space_tag_t bst = &arm_generic_bs_tag; 248 bus_space_tag_t bst = &arm_generic_bs_tag;
249 bus_space_handle_t bsh = ZYNQ_SLCR_VBASE; 249 bus_space_handle_t bsh = ZYNQ_SLCR_VBASE;
250 250
251 bus_space_write_4(bst, bsh, SLCR_UNLOCK, UNLOCK_KEY); 251 bus_space_write_4(bst, bsh, SLCR_UNLOCK, UNLOCK_KEY);
252 bus_space_write_4(bst, bsh, PSS_RST_CTRL, SOFT_RST); 252 bus_space_write_4(bst, bsh, PSS_RST_CTRL, SOFT_RST);
253} 253}
254 254
255static const struct arm_platform zynq_platform = { 255static const struct fdt_platform zynq_platform = {
256 .ap_devmap = zynq_platform_devmap, 256 .fp_devmap = zynq_platform_devmap,
257 .ap_bootstrap = zynq_platform_bootstrap, 257 .fp_bootstrap = zynq_platform_bootstrap,
258 .ap_init_attach_args = zynq_platform_init_attach_args, 258 .fp_init_attach_args = zynq_platform_init_attach_args,
259 .ap_device_register = zynq_platform_device_register, 259 .fp_device_register = zynq_platform_device_register,
260 .ap_reset = zynq_platform_reset, 260 .fp_reset = zynq_platform_reset,
261 .ap_delay = a9tmr_delay, 261 .fp_delay = a9tmr_delay,
262 .ap_uart_freq = zynq_platform_uart_freq, 262 .fp_uart_freq = zynq_platform_uart_freq,
263#ifdef MULTIPROCESSOR 263#ifdef MULTIPROCESSOR
264 .ap_mpstart = zynq_platform_mpstart, 264 .fp_mpstart = zynq_platform_mpstart,
265#endif 265#endif
266}; 266};
267 267
268 268
269ARM_PLATFORM(zynq, "xlnx,zynq-7000", &zynq_platform); 269FDT_PLATFORM(zynq, "xlnx,zynq-7000", &zynq_platform);

cvs diff -r1.2 -r1.3 src/sys/arch/evbarm/fdt/fdt_bus_machdep.c (expand / switch to unified diff)

--- src/sys/arch/evbarm/fdt/fdt_bus_machdep.c 2022/10/15 11:07:39 1.2
+++ src/sys/arch/evbarm/fdt/fdt_bus_machdep.c 2023/04/07 08:55:31 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: fdt_bus_machdep.c,v 1.2 2022/10/15 11:07:39 jmcneill Exp $ */ 1/* $NetBSD: fdt_bus_machdep.c,v 1.3 2023/04/07 08:55:31 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2021 Jared McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2021 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,52 +17,53 @@ @@ -17,52 +17,53 @@
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_bus_machdep.c,v 1.2 2022/10/15 11:07:39 jmcneill Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: fdt_bus_machdep.c,v 1.3 2023/04/07 08:55:31 skrll Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/bus.h> 33#include <sys/bus.h>
34#include <sys/kmem.h> 34#include <sys/kmem.h>
35 35
36#include <dev/fdt/fdtvar.h> 36#include <dev/fdt/fdtvar.h>
 37
37#include <arm/fdt/arm_fdtvar.h> 38#include <arm/fdt/arm_fdtvar.h>
38 39
39extern struct bus_space arm_generic_bs_tag; 40extern struct bus_space arm_generic_bs_tag;
40 41
41static int 42static int
42nonposted_mmio_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flag, 43nonposted_mmio_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flag,
43 bus_space_handle_t *bshp) 44 bus_space_handle_t *bshp)
44{ 45{
45 if (flag == 0) { 46 if (flag == 0) {
46 flag |= BUS_SPACE_MAP_NONPOSTED; 47 flag |= BUS_SPACE_MAP_NONPOSTED;
47 } 48 }
48 49
49 return bus_space_map(&arm_generic_bs_tag, bpa, size, flag, bshp); 50 return bus_space_map(&arm_generic_bs_tag, bpa, size, flag, bshp);
50} 51}
51 52
52bus_space_tag_t 53bus_space_tag_t
53fdtbus_bus_tag_create(int phandle, uint32_t flags) 54fdtbus_bus_tag_create(int phandle, uint32_t flags)
54{ 55{
55 const struct arm_platform *plat = arm_fdt_platform(); 56 const struct fdt_platform *plat = fdt_platform_find();
56 struct bus_space *tagp; 57 struct bus_space *tagp;
57 struct fdt_attach_args faa; 58 struct fdt_attach_args faa;
58 59
59 plat->ap_init_attach_args(&faa); 60 plat->fp_init_attach_args(&faa);
60 61
61 tagp = kmem_alloc(sizeof(*tagp), KM_SLEEP); 62 tagp = kmem_alloc(sizeof(*tagp), KM_SLEEP);
62 *tagp = *faa.faa_bst; 63 *tagp = *faa.faa_bst;
63 if ((flags & FDT_BUS_SPACE_FLAG_NONPOSTED_MMIO) != 0) { 64 if ((flags & FDT_BUS_SPACE_FLAG_NONPOSTED_MMIO) != 0) {
64 tagp->bs_map = nonposted_mmio_bs_map; 65 tagp->bs_map = nonposted_mmio_bs_map;
65 } 66 }
66 67
67 return tagp; 68 return tagp;
68} 69}

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

--- src/sys/arch/evbarm/fdt/fdt_machdep.c 2023/03/05 22:04:54 1.101
+++ src/sys/arch/evbarm/fdt/fdt_machdep.c 2023/04/07 08:55:31 1.102
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: fdt_machdep.c,v 1.101 2023/03/05 22:04:54 mlelstv Exp $ */ 1/* $NetBSD: fdt_machdep.c,v 1.102 2023/04/07 08:55:31 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.101 2023/03/05 22:04:54 mlelstv Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.102 2023/04/07 08:55:31 skrll Exp $");
31 31
32#include "opt_arm_debug.h" 32#include "opt_arm_debug.h"
33#include "opt_bootconfig.h" 33#include "opt_bootconfig.h"
34#include "opt_cpuoptions.h" 34#include "opt_cpuoptions.h"
35#include "opt_ddb.h" 35#include "opt_ddb.h"
36#include "opt_efi.h" 36#include "opt_efi.h"
37#include "opt_machdep.h" 37#include "opt_machdep.h"
38#include "opt_md.h" 38#include "opt_md.h"
39#include "opt_multiprocessor.h" 39#include "opt_multiprocessor.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"
@@ -82,26 +82,28 @@ __KERNEL_RCSID(0, "$NetBSD: fdt_machdep. @@ -82,26 +82,28 @@ __KERNEL_RCSID(0, "$NetBSD: fdt_machdep.
82#include <ddb/db_sym.h> 82#include <ddb/db_sym.h>
83#include <ddb/db_extern.h> 83#include <ddb/db_extern.h>
84 84
85#include <machine/bootconfig.h> 85#include <machine/bootconfig.h>
86#include <arm/armreg.h> 86#include <arm/armreg.h>
87 87
88#include <arm/cpufunc.h> 88#include <arm/cpufunc.h>
89 89
90#include <evbarm/include/autoconf.h> 90#include <evbarm/include/autoconf.h>
91#include <evbarm/fdt/machdep.h> 91#include <evbarm/fdt/machdep.h>
92#include <evbarm/fdt/platform.h> 92#include <evbarm/fdt/platform.h>
93 93
94#include <arm/fdt/arm_fdtvar.h> 94#include <arm/fdt/arm_fdtvar.h>
 95
 96#include <dev/fdt/fdtvar.h>
95#include <dev/fdt/fdt_private.h> 97#include <dev/fdt/fdt_private.h>
96#include <dev/fdt/fdt_memory.h> 98#include <dev/fdt/fdt_memory.h>
97 99
98#ifdef EFI_RUNTIME 100#ifdef EFI_RUNTIME
99#include <arm/arm/efi_runtime.h> 101#include <arm/arm/efi_runtime.h>
100#endif 102#endif
101 103
102#if NWSDISPLAY > 0 && NGENFB > 0 104#if NWSDISPLAY > 0 && NGENFB > 0
103#include <arm/fdt/arm_simplefb.h> 105#include <arm/fdt/arm_simplefb.h>
104#endif 106#endif
105 107
106#if NUKBD > 0 108#if NUKBD > 0
107#include <dev/usb/ukbdvar.h> 109#include <dev/usb/ukbdvar.h>
@@ -479,76 +481,76 @@ fdt_map_efi_runtime(const char *prop, en @@ -479,76 +481,76 @@ fdt_map_efi_runtime(const char *prop, en
479 VPRINTF("%s: %s %#" PRIxPADDR "-%#" PRIxVADDR " (%#" PRIxVADDR 481 VPRINTF("%s: %s %#" PRIxPADDR "-%#" PRIxVADDR " (%#" PRIxVADDR
480 "-%#" PRIxVSIZE ")\n", __func__, prop, pa, pa + sz - 1, 482 "-%#" PRIxVSIZE ")\n", __func__, prop, pa, pa + sz - 1,
481 va, va + sz - 1); 483 va, va + sz - 1);
482 arm_efirt_md_map_range(va, pa, sz, type); 484 arm_efirt_md_map_range(va, pa, sz, type);
483 map += 3; 485 map += 3;
484 len -= 24; 486 len -= 24;
485 } 487 }
486} 488}
487#endif 489#endif
488 490
489vaddr_t 491vaddr_t
490initarm(void *arg) 492initarm(void *arg)
491{ 493{
492 const struct arm_platform *plat; 494 const struct fdt_platform *plat;
493 uint64_t memory_start, memory_end; 495 uint64_t memory_start, memory_end;
494 496
495 /* set temporally to work printf()/panic() even before consinit() */ 497 /* set temporally to work printf()/panic() even before consinit() */
496 cn_tab = &earlycons; 498 cn_tab = &earlycons;
497 499
498 /* Load FDT */ 500 /* Load FDT */
499 int error = fdt_check_header(fdt_addr_r); 501 int error = fdt_check_header(fdt_addr_r);
500 if (error != 0) 502 if (error != 0)
501 panic("fdt_check_header failed: %s", fdt_strerror(error)); 503 panic("fdt_check_header failed: %s", fdt_strerror(error));
502 504
503 /* If the DTB is too big, try to pack it in place first. */ 505 /* If the DTB is too big, try to pack it in place first. */
504 if (fdt_totalsize(fdt_addr_r) > sizeof(fdt_data)) 506 if (fdt_totalsize(fdt_addr_r) > sizeof(fdt_data))
505 (void)fdt_pack(__UNCONST(fdt_addr_r)); 507 (void)fdt_pack(__UNCONST(fdt_addr_r));
506 508
507 error = fdt_open_into(fdt_addr_r, fdt_data, sizeof(fdt_data)); 509 error = fdt_open_into(fdt_addr_r, fdt_data, sizeof(fdt_data));
508 if (error != 0) 510 if (error != 0)
509 panic("fdt_move failed: %s", fdt_strerror(error)); 511 panic("fdt_move failed: %s", fdt_strerror(error));
510 512
511 fdtbus_init(fdt_data); 513 fdtbus_init(fdt_data);
512 514
513 /* Lookup platform specific backend */ 515 /* Lookup platform specific backend */
514 plat = arm_fdt_platform(); 516 plat = fdt_platform_find();
515 if (plat == NULL) 517 if (plat == NULL)
516 panic("Kernel does not support this device"); 518 panic("Kernel does not support this device");
517 519
518 /* Early console may be available, announce ourselves. */ 520 /* Early console may be available, announce ourselves. */
519 VPRINTF("FDT<%p>\n", fdt_addr_r); 521 VPRINTF("FDT<%p>\n", fdt_addr_r);
520 522
521 const int chosen = OF_finddevice("/chosen"); 523 const int chosen = OF_finddevice("/chosen");
522 if (chosen >= 0) 524 if (chosen >= 0)
523 OF_getprop(chosen, "bootargs", bootargs, sizeof(bootargs)); 525 OF_getprop(chosen, "bootargs", bootargs, sizeof(bootargs));
524 boot_args = bootargs; 526 boot_args = bootargs;
525 527
526 /* Heads up ... Setup the CPU / MMU / TLB functions. */ 528 /* Heads up ... Setup the CPU / MMU / TLB functions. */
527 VPRINTF("cpufunc\n"); 529 VPRINTF("cpufunc\n");
528 if (set_cpufuncs()) 530 if (set_cpufuncs())
529 panic("cpu not recognized!"); 531 panic("cpu not recognized!");
530 532
531 /* 533 /*
532 * Memory is still identity/flat mapped this point so using ttbr for 534 * Memory is still identity/flat mapped this point so using ttbr for
533 * l1pt VA is fine 535 * l1pt VA is fine
534 */ 536 */
535 537
536 VPRINTF("devmap %p\n", plat->ap_devmap()); 538 VPRINTF("devmap %p\n", plat->fp_devmap());
537 extern char ARM_BOOTSTRAP_LxPT[]; 539 extern char ARM_BOOTSTRAP_LxPT[];
538 pmap_devmap_bootstrap((vaddr_t)ARM_BOOTSTRAP_LxPT, plat->ap_devmap()); 540 pmap_devmap_bootstrap((vaddr_t)ARM_BOOTSTRAP_LxPT, plat->fp_devmap());
539 541
540 VPRINTF("bootstrap\n"); 542 VPRINTF("bootstrap\n");
541 plat->ap_bootstrap(); 543 plat->fp_bootstrap();
542 544
543 /* 545 /*
544 * If stdout-path is specified on the command line, override the 546 * If stdout-path is specified on the command line, override the
545 * value in /chosen/stdout-path before initializing console. 547 * value in /chosen/stdout-path before initializing console.
546 */ 548 */
547 VPRINTF("stdout\n"); 549 VPRINTF("stdout\n");
548 fdt_update_stdout_path(); 550 fdt_update_stdout_path();
549 551
550#if BYTE_ORDER == BIG_ENDIAN 552#if BYTE_ORDER == BIG_ENDIAN
551 /* 553 /*
552 * Most boards are configured to little-endian mode initially, and 554 * Most boards are configured to little-endian mode initially, and
553 * switched to big-endian mode after kernel is loaded. In this case, 555 * switched to big-endian mode after kernel is loaded. In this case,
554 * framebuffer seems byte-swapped to CPU. Override FDT to let 556 * framebuffer seems byte-swapped to CPU. Override FDT to let
@@ -627,28 +629,28 @@ initarm(void *arg) @@ -627,28 +629,28 @@ initarm(void *arg)
627 629
628 /* Populate fdt_physmem / nfdt_physmem for initarm_common */ 630 /* Populate fdt_physmem / nfdt_physmem for initarm_common */
629 fdt_memory_foreach(fdt_add_boot_physmem, &memory_size); 631 fdt_memory_foreach(fdt_add_boot_physmem, &memory_size);
630 632
631 vaddr_t sp = initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, fdt_physmem, 633 vaddr_t sp = initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, fdt_physmem,
632 nfdt_physmem); 634 nfdt_physmem);
633 635
634 /* 636 /*
635 * initarm_common flushes cache if required before AP start 637 * initarm_common flushes cache if required before AP start
636 */ 638 */
637 error = 0; 639 error = 0;
638 if ((boothowto & RB_MD1) == 0) { 640 if ((boothowto & RB_MD1) == 0) {
639 VPRINTF("mpstart\n"); 641 VPRINTF("mpstart\n");
640 if (plat->ap_mpstart) 642 if (plat->fp_mpstart)
641 error = plat->ap_mpstart(); 643 error = plat->fp_mpstart();
642 } 644 }
643 645
644 if (error) 646 if (error)
645 return sp; 647 return sp;
646 648
647 /* 649 /*
648 * Now we have APs started the pages used for stacks and L1PT can 650 * Now we have APs started the pages used for stacks and L1PT can
649 * be given to uvm 651 * be given to uvm
650 */ 652 */
651 extern char const __start__init_memory[]; 653 extern char const __start__init_memory[];
652 extern char const __stop__init_memory[] __weak; 654 extern char const __stop__init_memory[] __weak;
653 655
654 if (__start__init_memory != __stop__init_memory) { 656 if (__start__init_memory != __stop__init_memory) {
@@ -686,66 +688,66 @@ fdt_update_stdout_path(void) @@ -686,66 +688,66 @@ fdt_update_stdout_path(void)
686 if (stdout_path_len >= sizeof(buf)) 688 if (stdout_path_len >= sizeof(buf))
687 return; 689 return;
688 690
689 strncpy(buf, stdout_path, stdout_path_len); 691 strncpy(buf, stdout_path, stdout_path_len);
690 buf[stdout_path_len] = '\0'; 692 buf[stdout_path_len] = '\0';
691 fdt_setprop(fdt_data, chosen_off, "stdout-path", 693 fdt_setprop(fdt_data, chosen_off, "stdout-path",
692 buf, stdout_path_len + 1); 694 buf, stdout_path_len + 1);
693} 695}
694 696
695void 697void
696consinit(void) 698consinit(void)
697{ 699{
698 static bool initialized = false; 700 static bool initialized = false;
699 const struct arm_platform *plat = arm_fdt_platform(); 701 const struct fdt_platform *plat = fdt_platform_find();
700 const struct fdt_console *cons = fdtbus_get_console(); 702 const struct fdt_console *cons = fdtbus_get_console();
701 struct fdt_attach_args faa; 703 struct fdt_attach_args faa;
702 u_int uart_freq = 0; 704 u_int uart_freq = 0;
703 705
704 if (initialized || cons == NULL) 706 if (initialized || cons == NULL)
705 return; 707 return;
706 708
707 plat->ap_init_attach_args(&faa); 709 plat->fp_init_attach_args(&faa);
708 faa.faa_phandle = fdtbus_get_stdout_phandle(); 710 faa.faa_phandle = fdtbus_get_stdout_phandle();
709 711
710 if (plat->ap_uart_freq != NULL) 712 if (plat->fp_uart_freq != NULL)
711 uart_freq = plat->ap_uart_freq(); 713 uart_freq = plat->fp_uart_freq();
712 714
713 cons->consinit(&faa, uart_freq); 715 cons->consinit(&faa, uart_freq);
714 716
715 initialized = true; 717 initialized = true;
716} 718}
717 719
718void 720void
719cpu_startup_hook(void) 721cpu_startup_hook(void)
720{ 722{
721#ifdef EFI_RUNTIME 723#ifdef EFI_RUNTIME
722 fdt_map_efi_runtime("netbsd,uefi-runtime-code", ARM_EFIRT_MEM_CODE); 724 fdt_map_efi_runtime("netbsd,uefi-runtime-code", ARM_EFIRT_MEM_CODE);
723 fdt_map_efi_runtime("netbsd,uefi-runtime-data", ARM_EFIRT_MEM_DATA); 725 fdt_map_efi_runtime("netbsd,uefi-runtime-data", ARM_EFIRT_MEM_DATA);
724 fdt_map_efi_runtime("netbsd,uefi-runtime-mmio", ARM_EFIRT_MEM_MMIO); 726 fdt_map_efi_runtime("netbsd,uefi-runtime-mmio", ARM_EFIRT_MEM_MMIO);
725#endif 727#endif
726 728
727 fdtbus_intr_init(); 729 fdtbus_intr_init();
728 730
729 fdt_setup_rndseed(); 731 fdt_setup_rndseed();
730 fdt_setup_efirng(); 732 fdt_setup_efirng();
731} 733}
732 734
733void 735void
734delay(u_int us) 736delay(u_int us)
735{ 737{
736 const struct arm_platform *plat = arm_fdt_platform(); 738 const struct fdt_platform *plat = fdt_platform_find();
737 739
738 plat->ap_delay(us); 740 plat->fp_delay(us);
739} 741}
740 742
741static void 743static void
742fdt_detect_root_device(device_t dev) 744fdt_detect_root_device(device_t dev)
743{ 745{
744 int error, len; 746 int error, len;
745 747
746 const int chosen = OF_finddevice("/chosen"); 748 const int chosen = OF_finddevice("/chosen");
747 if (chosen < 0) 749 if (chosen < 0)
748 return; 750 return;
749 751
750 if (of_hasprop(chosen, "netbsd,mbr") && 752 if (of_hasprop(chosen, "netbsd,mbr") &&
751 of_hasprop(chosen, "netbsd,partition")) { 753 of_hasprop(chosen, "netbsd,partition")) {
@@ -839,49 +841,49 @@ fdt_detect_root_device(device_t dev) @@ -839,49 +841,49 @@ fdt_detect_root_device(device_t dev)
839 booted_device = dv; 841 booted_device = dv;
840 break; 842 break;
841 } 843 }
842 } 844 }
843 pserialize_read_exit(s); 845 pserialize_read_exit(s);
844 846
845 return; 847 return;
846 } 848 }
847} 849}
848 850
849static void 851static void
850fdt_device_register(device_t self, void *aux) 852fdt_device_register(device_t self, void *aux)
851{ 853{
852 const struct arm_platform *plat = arm_fdt_platform(); 854 const struct fdt_platform *plat = fdt_platform_find();
853 855
854 if (device_is_a(self, "armfdt")) { 856 if (device_is_a(self, "armfdt")) {
855 fdt_setup_initrd(); 857 fdt_setup_initrd();
856 858
857#if NWSDISPLAY > 0 && NGENFB > 0 859#if NWSDISPLAY > 0 && NGENFB > 0
858 /* 860 /*
859 * Setup framebuffer console, if present. 861 * Setup framebuffer console, if present.
860 */ 862 */
861 arm_simplefb_preattach(); 863 arm_simplefb_preattach();
862#endif 864#endif
863 } 865 }
864 866
865#if NWSDISPLAY > 0 && NGENFB > 0 867#if NWSDISPLAY > 0 && NGENFB > 0
866 if (device_is_a(self, "genfb")) { 868 if (device_is_a(self, "genfb")) {
867 prop_dictionary_t dict = device_properties(self); 869 prop_dictionary_t dict = device_properties(self);
868 prop_dictionary_set_uint64(dict, 870 prop_dictionary_set_uint64(dict,
869 "simplefb-physaddr", arm_simplefb_physaddr()); 871 "simplefb-physaddr", arm_simplefb_physaddr());
870 } 872 }
871#endif 873#endif
872 874
873 if (plat && plat->ap_device_register) 875 if (plat && plat->fp_device_register)
874 plat->ap_device_register(self, aux); 876 plat->fp_device_register(self, aux);
875} 877}
876 878
877static void 879static void
878fdt_device_register_post_config(device_t self, void *aux) 880fdt_device_register_post_config(device_t self, void *aux)
879{ 881{
880#if NUKBD > 0 && NWSDISPLAY > 0 882#if NUKBD > 0 && NWSDISPLAY > 0
881 if (device_is_a(self, "wsdisplay")) { 883 if (device_is_a(self, "wsdisplay")) {
882 struct wsdisplay_softc *sc = device_private(self); 884 struct wsdisplay_softc *sc = device_private(self);
883 if (wsdisplay_isconsole(sc)) 885 if (wsdisplay_isconsole(sc))
884 ukbd_cnattach(); 886 ukbd_cnattach();
885 } 887 }
886#endif 888#endif
887} 889}
@@ -900,32 +902,32 @@ fdt_cpu_rootconf(void) @@ -900,32 +902,32 @@ fdt_cpu_rootconf(void)
900 continue; 902 continue;
901 903
902 fdt_detect_root_device(dev); 904 fdt_detect_root_device(dev);
903 905
904 if (booted_device != NULL) 906 if (booted_device != NULL)
905 break; 907 break;
906 } 908 }
907 deviter_release(&di); 909 deviter_release(&di);
908} 910}
909 911
910static void 912static void
911fdt_reset(void) 913fdt_reset(void)
912{ 914{
913 const struct arm_platform *plat = arm_fdt_platform(); 915 const struct fdt_platform *plat = fdt_platform_find();
914 916
915 fdtbus_power_reset(); 917 fdtbus_power_reset();
916 918
917 if (plat && plat->ap_reset) 919 if (plat && plat->fp_reset)
918 plat->ap_reset(); 920 plat->fp_reset();
919} 921}
920 922
921static void 923static void
922fdt_powerdown(void) 924fdt_powerdown(void)
923{ 925{
924 fdtbus_power_poweroff(); 926 fdtbus_power_poweroff();
925} 927}
926 928
927#if BYTE_ORDER == BIG_ENDIAN 929#if BYTE_ORDER == BIG_ENDIAN
928static void 930static void
929fdt_update_fb_format(void) 931fdt_update_fb_format(void)
930{ 932{
931 int off, len; 933 int off, len;

File Added: src/sys/dev/fdt/fdt_platform.c
/* $NetBSD: fdt_platform.c,v 1.1 2023/04/07 08:55:31 skrll Exp $ */

/*-
 * Copyright (c) 2017 Jared D. McNeill <jmcneill@invisible.ca>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fdt_platform.c,v 1.1 2023/04/07 08:55:31 skrll Exp $");

#include <sys/param.h>

#include <dev/ofw/openfirm.h>

#include <dev/fdt/fdtvar.h>

const struct fdt_platform *
fdt_platform_find(void)
{
	static const struct fdt_platform_info *booted_platform = NULL;
	__link_set_decl(fdt_platforms, struct fdt_platform_info);
	struct fdt_platform_info * const *info;

	if (booted_platform == NULL) {
		const struct fdt_platform_info *best_info = NULL;
		const int phandle = OF_peer(0);
		int match, best_match = 0;

		__link_set_foreach(info, fdt_platforms) {
			const struct device_compatible_entry compat_data[] = {
				{ .compat = (*info)->fpi_compat },
				DEVICE_COMPAT_EOL
			};

			match = of_compatible_match(phandle, compat_data);
			if (match > best_match) {
				best_match = match;
				best_info = *info;
			}
		}

		booted_platform = best_info;
	}

	/*
	 * No SoC specific platform was found. Try to find a generic
	 * platform definition and use that if available.
	 */
	if (booted_platform == NULL) {
		__link_set_foreach(info, fdt_platforms) {
			if (strcmp((*info)->fpi_compat, FDT_PLATFORM_DEFAULT) == 0) {
				booted_platform = *info;
				break;
			}
		}
	}

	return booted_platform == NULL ? NULL : booted_platform->fpi_ops;
}

// XXXNH remove this and rely on a default
FDT_PLATFORM(dummy, NULL, NULL);

cvs diff -r1.77 -r1.78 src/sys/dev/fdt/fdtvar.h (expand / switch to unified diff)

--- src/sys/dev/fdt/fdtvar.h 2022/03/04 08:19:06 1.77
+++ src/sys/dev/fdt/fdtvar.h 2023/04/07 08:55:31 1.78
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: fdtvar.h,v 1.77 2022/03/04 08:19:06 skrll Exp $ */ 1/* $NetBSD: fdtvar.h,v 1.78 2023/04/07 08:55:31 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.
@@ -296,26 +296,64 @@ struct fdt_opp_info { @@ -296,26 +296,64 @@ struct fdt_opp_info {
296 296
297#define _FDT_OPP_REGISTER(name) \ 297#define _FDT_OPP_REGISTER(name) \
298 __link_set_add_rodata(fdt_opps, __CONCAT(name,_oppinfo)); 298 __link_set_add_rodata(fdt_opps, __CONCAT(name,_oppinfo));
299 299
300#define FDT_OPP(_name, _compat, _suppfn) \ 300#define FDT_OPP(_name, _compat, _suppfn) \
301static const struct fdt_opp_info __CONCAT(_name,_oppinfo) = { \ 301static const struct fdt_opp_info __CONCAT(_name,_oppinfo) = { \
302 .opp_compat = (_compat), \ 302 .opp_compat = (_compat), \
303 .opp_supported = (_suppfn) \ 303 .opp_supported = (_suppfn) \
304}; \ 304}; \
305_FDT_OPP_REGISTER(_name) 305_FDT_OPP_REGISTER(_name)
306 306
307TAILQ_HEAD(fdt_conslist, fdt_console_info); 307TAILQ_HEAD(fdt_conslist, fdt_console_info);
308 308
 309/*
 310 * Platform-specific data
 311 */
 312
 313struct fdt_platform {
 314 const struct pmap_devmap *
 315 (*fp_devmap)(void);
 316 void (*fp_bootstrap)(void);
 317 int (*fp_mpstart)(void);
 318 void (*fp_startup)(void);
 319 void (*fp_init_attach_args)(struct fdt_attach_args *);
 320 void (*fp_device_register)(device_t, void *);
 321 void (*fp_reset)(void);
 322 void (*fp_delay)(u_int);
 323 u_int (*fp_uart_freq)(void);
 324};
 325
 326struct fdt_platform_info {
 327 const char * fpi_compat;
 328 const struct fdt_platform * fpi_ops;
 329};
 330
 331#define FDT_PLATFORM_DEFAULT ""
 332
 333#define _FDT_PLATFORM_REGISTER(name) \
 334 __link_set_add_rodata(fdt_platforms, __CONCAT(name,_platinfo));
 335
 336#define FDT_PLATFORM(_name, _compat, _ops) \
 337static const struct fdt_platform_info __CONCAT(_name,_platinfo) = { \
 338 .fpi_compat = (_compat), \
 339 .fpi_ops = (_ops) \
 340}; \
 341_FDT_PLATFORM_REGISTER(_name)
 342
 343const struct fdt_platform *
 344 fdt_platform_find(void);
 345
 346
309struct fdt_dma_range { 347struct fdt_dma_range {
310 paddr_t dr_sysbase; 348 paddr_t dr_sysbase;
311 bus_addr_t dr_busbase; 349 bus_addr_t dr_busbase;
312 bus_size_t dr_len; 350 bus_size_t dr_len;
313}; 351};
314 352
315#define FDT_BUS_SPACE_FLAG_NONPOSTED_MMIO __BIT(0) 353#define FDT_BUS_SPACE_FLAG_NONPOSTED_MMIO __BIT(0)
316 354
317int fdtbus_register_clock_controller(device_t, int, 355int fdtbus_register_clock_controller(device_t, int,
318 const struct fdtbus_clock_controller_func *); 356 const struct fdtbus_clock_controller_func *);
319int fdtbus_register_dai_controller(device_t, int, 357int fdtbus_register_dai_controller(device_t, int,
320 const struct fdtbus_dai_controller_func *); 358 const struct fdtbus_dai_controller_func *);
321int fdtbus_register_dma_controller(device_t, int, 359int fdtbus_register_dma_controller(device_t, int,

cvs diff -r1.66 -r1.67 src/sys/dev/fdt/files.fdt (expand / switch to unified diff)

--- src/sys/dev/fdt/files.fdt 2022/11/05 17:31:37 1.66
+++ src/sys/dev/fdt/files.fdt 2023/04/07 08:55:31 1.67
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: files.fdt,v 1.66 2022/11/05 17:31:37 jmcneill Exp $ 1# $NetBSD: files.fdt,v 1.67 2023/04/07 08:55:31 skrll Exp $
2 2
3include "external/bsd/libfdt/conf/files.libfdt" 3include "external/bsd/libfdt/conf/files.libfdt"
4 4
5defflag opt_fdt.h FDTBASE : libfdt, ofw_subr 5defflag opt_fdt.h FDTBASE : libfdt, ofw_subr
6defflag opt_fdt.h FDT: FDTBASE 6defflag opt_fdt.h FDT: FDTBASE
7defparam opt_fdt.h FDT_MEMORY_RANGES 7defparam opt_fdt.h FDT_MEMORY_RANGES
8defparam opt_fdt.h FDT_DEFAULT_STDOUT_PATH 8defparam opt_fdt.h FDT_DEFAULT_STDOUT_PATH
9 9
10define fdt { [pass = 10] } : clk, pwm 10define fdt { [pass = 10] } : clk, pwm
11 11
12device simplebus: fdt 12device simplebus: fdt
13attach simplebus at fdt 13attach simplebus at fdt
14file dev/fdt/fdtbus.c fdt 14file dev/fdt/fdtbus.c fdt
@@ -58,26 +58,27 @@ file dev/fdt/fdt_panel.c panel_fdt @@ -58,26 +58,27 @@ file dev/fdt/fdt_panel.c panel_fdt
58makeoptions panel_fdt "CPPFLAGS.panel_fdt"+="${CPPFLAGS.drmkms}" 58makeoptions panel_fdt "CPPFLAGS.panel_fdt"+="${CPPFLAGS.drmkms}"
59 59
60device dispcon: fdt_port, drmkms, ddc_read_edid 60device dispcon: fdt_port, drmkms, ddc_read_edid
61attach dispcon at fdt with dispcon_hdmi 61attach dispcon at fdt with dispcon_hdmi
62file dev/fdt/hdmi_connector.c dispcon_hdmi 62file dev/fdt/hdmi_connector.c dispcon_hdmi
63makeoptions dispcon_hdmi "CPPFLAGS.dispcon_hdmi"+="${CPPFLAGS.drmkms}" 63makeoptions dispcon_hdmi "CPPFLAGS.dispcon_hdmi"+="${CPPFLAGS.drmkms}"
64 64
65device iicmux: i2cbus, i2cmux 65device iicmux: i2cbus, i2cmux
66attach iicmux at fdt with iicmux_fdt 66attach iicmux at fdt with iicmux_fdt
67file dev/fdt/i2cmux_fdt.c iicmux_fdt 67file dev/fdt/i2cmux_fdt.c iicmux_fdt
68 68
69file dev/fdt/fdt_memory.c fdtbase 69file dev/fdt/fdt_memory.c fdtbase
70file dev/fdt/fdt_openfirm.c fdtbase 70file dev/fdt/fdt_openfirm.c fdtbase
 71file dev/fdt/fdt_platform.c fdtbase
71file dev/fdt/fdt_subr.c fdtbase 72file dev/fdt/fdt_subr.c fdtbase
72 73
73file dev/fdt/fdt_clock.c fdt 74file dev/fdt/fdt_clock.c fdt
74file dev/fdt/fdt_dai.c fdt 75file dev/fdt/fdt_dai.c fdt
75file dev/fdt/fdt_dma.c fdt 76file dev/fdt/fdt_dma.c fdt
76file dev/fdt/fdt_ddb.c fdt & ddb 77file dev/fdt/fdt_ddb.c fdt & ddb
77file dev/fdt/fdt_gpio.c fdt 78file dev/fdt/fdt_gpio.c fdt
78file dev/fdt/fdt_i2c.c fdt 79file dev/fdt/fdt_i2c.c fdt
79file dev/fdt/fdt_iommu.c fdt 80file dev/fdt/fdt_iommu.c fdt
80file dev/fdt/fdt_intr.c fdt 81file dev/fdt/fdt_intr.c fdt
81file dev/fdt/fdt_mbox.c fdt 82file dev/fdt/fdt_mbox.c fdt
82file dev/fdt/fdt_mmc_pwrseq.c fdt 83file dev/fdt/fdt_mmc_pwrseq.c fdt
83file dev/fdt/fdt_phy.c fdt 84file dev/fdt/fdt_phy.c fdt