Mon Jun 17 20:30:49 2013 UTC ()
a9_cpuinit -> arm_cpuinit


(matt)
diff -r1.4 -r1.5 src/sys/arch/evbarm/bcm53xx/bcm53xx_start.S

cvs diff -r1.4 -r1.5 src/sys/arch/evbarm/bcm53xx/Attic/bcm53xx_start.S (switch to unified diff)

--- src/sys/arch/evbarm/bcm53xx/Attic/bcm53xx_start.S 2012/09/27 00:22:39 1.4
+++ src/sys/arch/evbarm/bcm53xx/Attic/bcm53xx_start.S 2013/06/17 20:30:49 1.5
@@ -1,178 +1,178 @@ @@ -1,178 +1,178 @@
1/* $NetBSD: bcm53xx_start.S,v 1.4 2012/09/27 00:22:39 matt Exp $ */ 1/* $NetBSD: bcm53xx_start.S,v 1.5 2013/06/17 20:30:49 matt Exp $ */
2/*- 2/*-
3 * Copyright (c) 2012 The NetBSD Foundation, Inc. 3 * Copyright (c) 2012 The NetBSD Foundation, Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This code is derived from software contributed to The NetBSD Foundation 6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Matt Thomas of 3am Software Foundry. 7 * by Matt Thomas of 3am Software Foundry.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the 15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution. 16 * documentation and/or other materials provided with the distribution.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE. 28 * POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31//#define GXEMUL 31//#define GXEMUL
32 32
33#include "opt_broadcom.h" 33#include "opt_broadcom.h"
34#include "opt_cpuoptions.h" 34#include "opt_cpuoptions.h"
35#include "opt_cputypes.h" 35#include "opt_cputypes.h"
36#include "opt_multiprocessor.h" 36#include "opt_multiprocessor.h"
37 37
38#include <arm/asm.h> 38#include <arm/asm.h>
39#include <arm/armreg.h> 39#include <arm/armreg.h>
40#include "assym.h" 40#include "assym.h"
41 41
42#include <arm/cortex/a9tmr_reg.h> 42#include <arm/cortex/a9tmr_reg.h>
43 43
44#ifndef CONADDR 44#ifndef CONADDR
45#define CONADDR 0x18000300 45#define CONADDR 0x18000300
46#endif 46#endif
47 47
48RCSID("$NetBSD: bcm53xx_start.S,v 1.4 2012/09/27 00:22:39 matt Exp $") 48RCSID("$NetBSD: bcm53xx_start.S,v 1.5 2013/06/17 20:30:49 matt Exp $")
49 49
50#undef VERBOSE_INIT_ARM 50#undef VERBOSE_INIT_ARM
51#define VERBOSE_INIT_ARM 51#define VERBOSE_INIT_ARM
52 52
53#if defined(VERBOSE_INIT_ARM) 53#if defined(VERBOSE_INIT_ARM)
54#define XPUTC(n) mov r0, n; bl xputc 54#define XPUTC(n) mov r0, n; bl xputc
55#define XPUTC_COM 1 55#define XPUTC_COM 1
56#else 56#else
57#define XPUTC(n) 57#define XPUTC(n)
58#endif 58#endif
59 59
60/* 60/*
61 * Kernel start routine for BCM5301X boards. 61 * Kernel start routine for BCM5301X boards.
62 * At this point, this code has been loaded into SDRAM 62 * At this point, this code has been loaded into SDRAM
63 * and the MMU is off 63 * and the MMU is off
64 */ 64 */
65 .text 65 .text
66 66
67 .global _C_LABEL(bcm53xx_start) 67 .global _C_LABEL(bcm53xx_start)
68_C_LABEL(bcm53xx_start): 68_C_LABEL(bcm53xx_start):
69 /* 69 /*
70 * Save any arguments u-boot passed us. 70 * Save any arguments u-boot passed us.
71 */ 71 */
72 ldr r4, .Luboot_args 72 ldr r4, .Luboot_args
73 stmia r4, {r0-r3} 73 stmia r4, {r0-r3}
74 74
75 /* 75 /*
76 * Let's turn on the CCA watchdog in case something goes horribly wrong. 76 * Let's turn on the CCA watchdog in case something goes horribly wrong.
77 */ 77 */
78 ldr r0, .Lcca_wdog 78 ldr r0, .Lcca_wdog
79 ldr r1, .Lcca_wdog + 4 79 ldr r1, .Lcca_wdog + 4
80 str r1, [r0] 80 str r1, [r0]
81 81
82 /* 82 /*
83 * Cal the initial start code for the a9 83 * Cal the initial start code for the a9
84 */ 84 */
85 bl a9_start 85 bl a9_start
86 86
87 /* 87 /*
88 * Set up a preliminary mapping in the MMU to allow us to run 88 * Set up a preliminary mapping in the MMU to allow us to run
89 * at KERNEL_BASE with caches on. 89 * at KERNEL_BASE with caches on.
90 */ 90 */
91 ldr r0, .Ltemp_l1_table /* The L1PT address - entered into TTB later */ 91 ldr r0, .Ltemp_l1_table /* The L1PT address - entered into TTB later */
92 adr r1, mmu_init_table 92 adr r1, mmu_init_table
93 bl arm_boot_l1pt_init 93 bl arm_boot_l1pt_init
94 94
95 XPUTC(#68) 95 XPUTC(#68)
96 /* 96 /*
97 * Before we turn on the MMU, let's the other process out of the 97 * Before we turn on the MMU, let's the other process out of the
98 * SKU ROM but setting the magic LUT address to our own mp_start 98 * SKU ROM but setting the magic LUT address to our own mp_start
99 * routine.  99 * routine.
100 */ 100 */
101 ldr r1, .Lsku_rom_lut 101 ldr r1, .Lsku_rom_lut
102 adr r2, a9_mpstart 102 adr r2, a9_mpstart
103 str r2, [r1] 103 str r2, [r1]
104 sev /* wake up the others */ 104 sev /* wake up the others */
105 105
106 /* 106 /*
107 * init the CPU TLB, Cache, MMU. 107 * init the CPU TLB, Cache, MMU.
108 */ 108 */
109 XPUTC(#69) 109 XPUTC(#69)
110 110
111 ldr r0, .Ltemp_l1_table /* The page table address */ 111 ldr r0, .Ltemp_l1_table /* The page table address */
112 bl a9_cpuinit 112 bl arm_cpuinit
113 113
114 XPUTC(#33) 114 XPUTC(#33)
115 XPUTC(#10) 115 XPUTC(#10)
116 XPUTC(#13) 116 XPUTC(#13)
117 117
118 /* 118 /*
119 * Let's turn off the CCA watchdog since nothing went horribly wrong. 119 * Let's turn off the CCA watchdog since nothing went horribly wrong.
120 */ 120 */
121 ldr r0, .Lcca_wdog 121 ldr r0, .Lcca_wdog
122 mov r1, #0 122 mov r1, #0
123 str r1, [r0] 123 str r1, [r0]
124 124
125 /* 125 /*
126 * Jump to start in locore.S, which in turn will call initarm and main. 126 * Jump to start in locore.S, which in turn will call initarm and main.
127 */ 127 */
128 b start 128 b start
129 nop 129 nop
130 nop 130 nop
131 nop 131 nop
132 nop 132 nop
133 133
134 /* NOTREACHED */ 134 /* NOTREACHED */
135 135
136.Luboot_args: 136.Luboot_args:
137 .word uboot_args 137 .word uboot_args
138 138
139.Lsku_rom_lut: 139.Lsku_rom_lut:
140 .word 0xffff0400 140 .word 0xffff0400
141 141
142.Lcca_wdog: 142.Lcca_wdog:
143 .word 0x18000080 143 .word 0x18000080
144 .word 0x0fffffff /* maximum watchdog time out, about 10 seconds */ 144 .word 0x0fffffff /* maximum watchdog time out, about 10 seconds */
145 145
146.Ltemp_l1_table: 146.Ltemp_l1_table:
147 /* Put the temporary L1 translation table far enough away. */ 147 /* Put the temporary L1 translation table far enough away. */
148 .word KERNEL_BASE_phys + 31 * 0x100000 - L1_TABLE_SIZE 148 .word KERNEL_BASE_phys + 31 * 0x100000 - L1_TABLE_SIZE
149 149
150#include <arm/cortex/a9_mpsubr.S> 150#include <arm/cortex/a9_mpsubr.S>
151 151
152mmu_init_table: 152mmu_init_table:
153 /* Add 32MB of VA==PA at 0x80000000 so we can keep the kernel going */ 153 /* Add 32MB of VA==PA at 0x80000000 so we can keep the kernel going */
154 MMU_INIT(KERNEL_BASE, 0x80000000, 154 MMU_INIT(KERNEL_BASE, 0x80000000,
155 (128 * L1_S_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, 155 (128 * L1_S_SIZE + L1_S_SIZE - 1) / L1_S_SIZE,
156 L1_S_PROTO | L1_S_APv7_KRW | L1_S_B | L1_S_C) 156 L1_S_PROTO | L1_S_APv7_KRW | L1_S_B | L1_S_C)
157 157
158 MMU_INIT(0, 0x00000000, 158 MMU_INIT(0, 0x00000000,
159 (16 * L1_S_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, 159 (16 * L1_S_SIZE + L1_S_SIZE - 1) / L1_S_SIZE,
160 L1_S_PROTO | L1_S_APv7_KRW | L1_S_B | L1_S_C) 160 L1_S_PROTO | L1_S_APv7_KRW | L1_S_B | L1_S_C)
161 161
162 /* Map the 2MB of primary peripherals */ 162 /* Map the 2MB of primary peripherals */
163 MMU_INIT(KERNEL_IO_IOREG_VBASE, BCM53XX_IOREG_PBASE, 163 MMU_INIT(KERNEL_IO_IOREG_VBASE, BCM53XX_IOREG_PBASE,
164 (BCM53XX_IOREG_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, 164 (BCM53XX_IOREG_SIZE + L1_S_SIZE - 1) / L1_S_SIZE,
165 L1_S_PROTO | L1_S_APv7_KRW) 165 L1_S_PROTO | L1_S_APv7_KRW)
166 166
167 /* Map the 2MB of primary peripherals at PA:VA 1:1 */ 167 /* Map the 2MB of primary peripherals at PA:VA 1:1 */
168 MMU_INIT(BCM53XX_IOREG_PBASE, BCM53XX_IOREG_PBASE, 168 MMU_INIT(BCM53XX_IOREG_PBASE, BCM53XX_IOREG_PBASE,
169 (BCM53XX_IOREG_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, 169 (BCM53XX_IOREG_SIZE + L1_S_SIZE - 1) / L1_S_SIZE,
170 L1_S_PROTO | L1_S_APv7_KRW) 170 L1_S_PROTO | L1_S_APv7_KRW)
171 171
172 /* Map the 1MB of armcore peripherals */ 172 /* Map the 1MB of armcore peripherals */
173 MMU_INIT(KERNEL_IO_ARMCORE_VBASE, BCM53XX_ARMCORE_PBASE, 173 MMU_INIT(KERNEL_IO_ARMCORE_VBASE, BCM53XX_ARMCORE_PBASE,
174 (BCM53XX_ARMCORE_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, 174 (BCM53XX_ARMCORE_SIZE + L1_S_SIZE - 1) / L1_S_SIZE,
175 L1_S_PROTO | L1_S_APv7_KRW) 175 L1_S_PROTO | L1_S_APv7_KRW)
176 176
177 /* end of table */ 177 /* end of table */
178 MMU_INIT(0, 0, 0, 0) 178 MMU_INIT(0, 0, 0, 0)