| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: aarch64_machdep.c,v 1.68 2023/04/16 14:01:51 skrll Exp $ */ | | 1 | /* $NetBSD: aarch64_machdep.c,v 1.69 2023/04/18 07:53:31 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.68 2023/04/16 14:01:51 skrll Exp $"); | | 33 | __KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.69 2023/04/18 07:53:31 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> |
| @@ -279,27 +279,26 @@ initarm_common(vaddr_t kvm_base, vsize_t | | | @@ -279,27 +279,26 @@ initarm_common(vaddr_t kvm_base, vsize_t |
279 | if (module_end >= kernstart_l2 + MODULE_RESERVED_MAX) | | 279 | if (module_end >= kernstart_l2 + MODULE_RESERVED_MAX) |
280 | module_end = kernstart_l2 + MODULE_RESERVED_MAX; | | 280 | module_end = kernstart_l2 + MODULE_RESERVED_MAX; |
281 | KASSERT(module_end > kernend_l2); | | 281 | KASSERT(module_end > kernend_l2); |
282 | kernelvmstart = module_end; | | 282 | kernelvmstart = module_end; |
283 | #endif /* MODULAR */ | | 283 | #endif /* MODULAR */ |
284 | | | 284 | |
285 | KASSERT(kernelvmstart < VM_KERNEL_VM_BASE); | | 285 | KASSERT(kernelvmstart < VM_KERNEL_VM_BASE); |
286 | | | 286 | |
287 | kernelvmstart = VM_KERNEL_VM_BASE; | | 287 | kernelvmstart = VM_KERNEL_VM_BASE; |
288 | | | 288 | |
289 | paddr_t kernstart_phys __unused = KERN_VTOPHYS(kernstart); | | 289 | paddr_t kernstart_phys __unused = KERN_VTOPHYS(kernstart); |
290 | paddr_t kernend_phys __unused = KERN_VTOPHYS(kernend); | | 290 | paddr_t kernend_phys __unused = KERN_VTOPHYS(kernend); |
291 | | | 291 | |
292 | /* XXX: arm/arm32/bus_dma.c refers physical_{start,end} */ | | | |
293 | physical_start = bootconfig.dram[0].address; | | 292 | physical_start = bootconfig.dram[0].address; |
294 | physical_end = bootconfig.dram[bootconfig.dramblocks - 1].address + | | 293 | physical_end = bootconfig.dram[bootconfig.dramblocks - 1].address + |
295 | ptoa(bootconfig.dram[bootconfig.dramblocks - 1].pages); | | 294 | ptoa(bootconfig.dram[bootconfig.dramblocks - 1].pages); |
296 | | | 295 | |
297 | /* | | 296 | /* |
298 | * msgbuf is allocated from the bottom of any one of memory blocks | | 297 | * msgbuf is allocated from the bottom of any one of memory blocks |
299 | * to avoid corruption due to bootloader or changing kernel layout. | | 298 | * to avoid corruption due to bootloader or changing kernel layout. |
300 | */ | | 299 | */ |
301 | paddr_t msgbufaddr = 0; | | 300 | paddr_t msgbufaddr = 0; |
302 | for (i = 0; i < bootconfig.dramblocks; i++) { | | 301 | for (i = 0; i < bootconfig.dramblocks; i++) { |
303 | /* this block has enough space for msgbuf? */ | | 302 | /* this block has enough space for msgbuf? */ |
304 | if (bootconfig.dram[i].pages < atop(round_page(MSGBUFSIZE))) | | 303 | if (bootconfig.dram[i].pages < atop(round_page(MSGBUFSIZE))) |
305 | continue; | | 304 | continue; |