| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: rpi_machdep.c,v 1.59 2015/03/15 22:54:03 joerg Exp $ */ | | 1 | /* $NetBSD: rpi_machdep.c,v 1.60 2015/04/11 15:29:58 skrll Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2012 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2012 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. |
| @@ -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(0, "$NetBSD: rpi_machdep.c,v 1.59 2015/03/15 22:54:03 joerg Exp $"); | | 33 | __KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.60 2015/04/11 15:29:58 skrll Exp $"); |
34 | | | 34 | |
35 | #include "opt_arm_debug.h" | | 35 | #include "opt_arm_debug.h" |
36 | #include "opt_bcm283x.h" | | 36 | #include "opt_bcm283x.h" |
37 | #include "opt_cpuoptions.h" | | 37 | #include "opt_cpuoptions.h" |
38 | #include "opt_ddb.h" | | 38 | #include "opt_ddb.h" |
39 | #include "opt_evbarm_boardtype.h" | | 39 | #include "opt_evbarm_boardtype.h" |
40 | #include "opt_kgdb.h" | | 40 | #include "opt_kgdb.h" |
41 | #include "opt_rpi.h" | | 41 | #include "opt_rpi.h" |
42 | #include "opt_vcprop.h" | | 42 | #include "opt_vcprop.h" |
43 | | | 43 | |
44 | #include "sdhc.h" | | 44 | #include "sdhc.h" |
45 | #include "bcmdwctwo.h" | | 45 | #include "bcmdwctwo.h" |
46 | #include "bcmspi.h" | | 46 | #include "bcmspi.h" |
| @@ -481,37 +481,42 @@ rpi_bootparams(void) | | | @@ -481,37 +481,42 @@ rpi_bootparams(void) |
481 | if (vcprop_tag_success_p(&vb.vbt_cmdline.tag)) | | 481 | if (vcprop_tag_success_p(&vb.vbt_cmdline.tag)) |
482 | printf("%s: cmdline %s\n", __func__, | | 482 | printf("%s: cmdline %s\n", __func__, |
483 | vb.vbt_cmdline.cmdline); | | 483 | vb.vbt_cmdline.cmdline); |
484 | #endif | | 484 | #endif |
485 | } | | 485 | } |
486 | | | 486 | |
487 | | | 487 | |
488 | static void | | 488 | static void |
489 | rpi_bootstrap(void) | | 489 | rpi_bootstrap(void) |
490 | { | | 490 | { |
491 | #if defined(BCM2836) | | 491 | #if defined(BCM2836) |
492 | arm_cpu_max = 4; | | 492 | arm_cpu_max = 4; |
493 | extern int cortex_mmuinfo; | | 493 | extern int cortex_mmuinfo; |
494 | bus_space_tag_t iot = &bcm2835_bs_tag; | | | |
495 | bus_space_handle_t ioh = BCM2836_ARM_LOCAL_VBASE; | | | |
496 | | | 494 | |
497 | #ifdef VERBOSE_INIT_ARM | | 495 | #ifdef VERBOSE_INIT_ARM |
498 | printf("%s: %d cpus present\n", __func__, arm_cpu_max); | | 496 | printf("%s: %d cpus present\n", __func__, arm_cpu_max); |
499 | #endif | | 497 | #endif |
500 | | | 498 | |
501 | extern void cortex_mpstart(void); | | | |
502 | cortex_mmuinfo = armreg_ttbr_read(); | | 499 | cortex_mmuinfo = armreg_ttbr_read(); |
| | | 500 | #ifdef VERBOSE_INIT_ARM |
| | | 501 | printf("%s: cortex_mmuinfo %x\n", __func__, cortex_mmuinfo); |
| | | 502 | #endif |
| | | 503 | |
| | | 504 | extern void cortex_mpstart(void); |
503 | | | 505 | |
504 | for (size_t i = 1; i < arm_cpu_max; i++) { | | 506 | for (size_t i = 1; i < arm_cpu_max; i++) { |
| | | 507 | bus_space_tag_t iot = &bcm2835_bs_tag; |
| | | 508 | bus_space_handle_t ioh = BCM2836_ARM_LOCAL_VBASE; |
| | | 509 | |
505 | bus_space_write_4(iot, ioh, | | 510 | bus_space_write_4(iot, ioh, |
506 | BCM2836_LOCAL_MAILBOX3_SETN(i), | | 511 | BCM2836_LOCAL_MAILBOX3_SETN(i), |
507 | (uint32_t)cortex_mpstart); | | 512 | (uint32_t)cortex_mpstart); |
508 | | | 513 | |
509 | int timeout = 20; | | 514 | int timeout = 20; |
510 | while (timeout-- > 0) { | | 515 | while (timeout-- > 0) { |
511 | uint32_t val; | | 516 | uint32_t val; |
512 | | | 517 | |
513 | val = bus_space_read_4(iot, ioh, | | 518 | val = bus_space_read_4(iot, ioh, |
514 | BCM2836_LOCAL_MAILBOX3_CLRN(i)); | | 519 | BCM2836_LOCAL_MAILBOX3_CLRN(i)); |
515 | if (val == 0) | | 520 | if (val == 0) |
516 | break; | | 521 | break; |
517 | } | | 522 | } |