| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: fdt_machdep.c,v 1.57 2018/12/23 11:45:39 skrll Exp $ */ | | 1 | /* $NetBSD: fdt_machdep.c,v 1.58 2019/01/31 13:26:21 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.57 2018/12/23 11:45:39 skrll Exp $"); | | 30 | __KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.58 2019/01/31 13:26:21 skrll Exp $"); |
31 | | | 31 | |
32 | #include "opt_machdep.h" | | 32 | #include "opt_machdep.h" |
33 | #include "opt_bootconfig.h" | | 33 | #include "opt_bootconfig.h" |
34 | #include "opt_ddb.h" | | 34 | #include "opt_ddb.h" |
35 | #include "opt_md.h" | | 35 | #include "opt_md.h" |
36 | #include "opt_arm_debug.h" | | 36 | #include "opt_arm_debug.h" |
37 | #include "opt_multiprocessor.h" | | 37 | #include "opt_multiprocessor.h" |
38 | #include "opt_cpuoptions.h" | | 38 | #include "opt_cpuoptions.h" |
39 | #include "opt_efi.h" | | 39 | #include "opt_efi.h" |
40 | | | 40 | |
41 | #include "ukbd.h" | | 41 | #include "ukbd.h" |
42 | #include "wsdisplay.h" | | 42 | #include "wsdisplay.h" |
43 | | | 43 | |
| @@ -535,32 +535,35 @@ initarm(void *arg) | | | @@ -535,32 +535,35 @@ initarm(void *arg) |
535 | /* Perform PT build and VM init */ | | 535 | /* Perform PT build and VM init */ |
536 | cpu_kernel_vm_init(memory_start, memory_size); | | 536 | cpu_kernel_vm_init(memory_start, memory_size); |
537 | | | 537 | |
538 | VPRINTF("bootargs: %s\n", bootargs); | | 538 | VPRINTF("bootargs: %s\n", bootargs); |
539 | | | 539 | |
540 | parse_mi_bootargs(boot_args); | | 540 | parse_mi_bootargs(boot_args); |
541 | | | 541 | |
542 | VPRINTF("Memory regions:\n"); | | 542 | VPRINTF("Memory regions:\n"); |
543 | fdt_memory_foreach(fdt_add_boot_physmem, &memory_size); | | 543 | fdt_memory_foreach(fdt_add_boot_physmem, &memory_size); |
544 | | | 544 | |
545 | u_int sp = initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, fdt_physmem, | | 545 | u_int sp = initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, fdt_physmem, |
546 | nfdt_physmem); | | 546 | nfdt_physmem); |
547 | | | 547 | |
| | | 548 | error = 0; |
548 | if ((boothowto & RB_MD1) == 0) { | | 549 | if ((boothowto & RB_MD1) == 0) { |
549 | VPRINTF("mpstart\n"); | | 550 | VPRINTF("mpstart\n"); |
550 | if (plat->ap_mpstart) | | 551 | if (plat->ap_mpstart) |
551 | plat->ap_mpstart(); | | 552 | error = plat->ap_mpstart(); |
552 | } | | 553 | } |
553 | | | 554 | |
| | | 555 | if (error) |
| | | 556 | return sp; |
554 | /* | | 557 | /* |
555 | * Now we have APs started the pages used for stacks and L1PT can | | 558 | * Now we have APs started the pages used for stacks and L1PT can |
556 | * be given to uvm | | 559 | * be given to uvm |
557 | */ | | 560 | */ |
558 | extern char const __start__init_memory[]; | | 561 | extern char const __start__init_memory[]; |
559 | extern char const __stop__init_memory[] __weak; | | 562 | extern char const __stop__init_memory[] __weak; |
560 | | | 563 | |
561 | if (__start__init_memory != __stop__init_memory) { | | 564 | if (__start__init_memory != __stop__init_memory) { |
562 | const paddr_t spa = KERN_VTOPHYS((vaddr_t)__start__init_memory); | | 565 | const paddr_t spa = KERN_VTOPHYS((vaddr_t)__start__init_memory); |
563 | const paddr_t epa = KERN_VTOPHYS((vaddr_t)__stop__init_memory); | | 566 | const paddr_t epa = KERN_VTOPHYS((vaddr_t)__stop__init_memory); |
564 | const paddr_t spg = atop(spa); | | 567 | const paddr_t spg = atop(spa); |
565 | const paddr_t epg = atop(epa); | | 568 | const paddr_t epg = atop(epa); |
566 | | | 569 | |