Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2013 |
| 4 | * David Feng <fenghua@phytium.com.cn> |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <asm-offsets.h> |
| 8 | #include <config.h> |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 9 | #include <linux/linkage.h> |
| 10 | #include <asm/macro.h> |
| 11 | #include <asm/armv8/mmu.h> |
| 12 | |
| 13 | /************************************************************************* |
| 14 | * |
| 15 | * Startup Code (reset vector) |
| 16 | * |
| 17 | *************************************************************************/ |
| 18 | |
| 19 | .globl _start |
| 20 | _start: |
Stephen Warren | 80a9365 | 2018-01-03 14:31:51 -0700 | [diff] [blame] | 21 | #if defined(LINUX_KERNEL_IMAGE_HEADER) |
| 22 | #include <asm/boot0-linux-kernel-header.h> |
| 23 | #elif defined(CONFIG_ENABLE_ARM_SOC_BOOT0_HOOK) |
Andre Przywara | 48321ba | 2016-05-31 10:45:06 -0700 | [diff] [blame] | 24 | /* |
| 25 | * Various SoCs need something special and SoC-specific up front in |
| 26 | * order to boot, allow them to set that in their boot0.h file and then |
| 27 | * use it here. |
| 28 | */ |
Kever Yang | b8c82e0 | 2019-03-28 11:01:22 +0800 | [diff] [blame] | 29 | #ifdef CONFIG_ARCH_ROCKCHIP |
| 30 | #include <asm/arch-rockchip/boot0.h> |
| 31 | #else |
Andre Przywara | 48321ba | 2016-05-31 10:45:06 -0700 | [diff] [blame] | 32 | #include <asm/arch/boot0.h> |
Kever Yang | b8c82e0 | 2019-03-28 11:01:22 +0800 | [diff] [blame] | 33 | #endif |
Andre Przywara | 313a578 | 2017-01-02 11:48:33 +0000 | [diff] [blame] | 34 | #else |
| 35 | b reset |
Andre Przywara | 48321ba | 2016-05-31 10:45:06 -0700 | [diff] [blame] | 36 | #endif |
| 37 | |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 38 | .align 3 |
| 39 | |
| 40 | .globl _TEXT_BASE |
| 41 | _TEXT_BASE: |
| 42 | .quad CONFIG_SYS_TEXT_BASE |
| 43 | |
| 44 | /* |
| 45 | * These are defined in the linker script. |
| 46 | */ |
| 47 | .globl _end_ofs |
| 48 | _end_ofs: |
| 49 | .quad _end - _start |
| 50 | |
| 51 | .globl _bss_start_ofs |
| 52 | _bss_start_ofs: |
| 53 | .quad __bss_start - _start |
| 54 | |
| 55 | .globl _bss_end_ofs |
| 56 | _bss_end_ofs: |
| 57 | .quad __bss_end - _start |
| 58 | |
| 59 | reset: |
Stephen Warren | 100a479 | 2016-07-18 17:01:50 -0600 | [diff] [blame] | 60 | /* Allow the board to save important registers */ |
| 61 | b save_boot_params |
| 62 | .globl save_boot_params_ret |
| 63 | save_boot_params_ret: |
| 64 | |
Stephen Warren | 81c2137 | 2017-11-02 18:11:27 -0600 | [diff] [blame] | 65 | #if CONFIG_POSITION_INDEPENDENT |
| 66 | /* |
| 67 | * Fix .rela.dyn relocations. This allows U-Boot to be loaded to and |
| 68 | * executed at a different address than it was linked at. |
| 69 | */ |
| 70 | pie_fixup: |
| 71 | adr x0, _start /* x0 <- Runtime value of _start */ |
| 72 | ldr x1, _TEXT_BASE /* x1 <- Linked value of _start */ |
| 73 | sub x9, x0, x1 /* x9 <- Run-vs-link offset */ |
| 74 | adr x2, __rel_dyn_start /* x2 <- Runtime &__rel_dyn_start */ |
| 75 | adr x3, __rel_dyn_end /* x3 <- Runtime &__rel_dyn_end */ |
| 76 | pie_fix_loop: |
| 77 | ldp x0, x1, [x2], #16 /* (x0, x1) <- (Link location, fixup) */ |
| 78 | ldr x4, [x2], #8 /* x4 <- addend */ |
| 79 | cmp w1, #1027 /* relative fixup? */ |
| 80 | bne pie_skip_reloc |
| 81 | /* relative fix: store addend plus offset at dest location */ |
| 82 | add x0, x0, x9 |
| 83 | add x4, x4, x9 |
| 84 | str x4, [x0] |
| 85 | pie_skip_reloc: |
| 86 | cmp x2, x3 |
| 87 | b.lo pie_fix_loop |
| 88 | pie_fixup_done: |
| 89 | #endif |
| 90 | |
Sergey Temerkhanov | 78eaa49 | 2015-10-14 09:55:45 -0700 | [diff] [blame] | 91 | #ifdef CONFIG_SYS_RESET_SCTRL |
| 92 | bl reset_sctrl |
| 93 | #endif |
Andre Przywara | 4eecab7 | 2018-07-25 00:57:01 +0100 | [diff] [blame] | 94 | |
Alexander Graf | b3e9dc6 | 2019-02-20 17:14:49 +0100 | [diff] [blame] | 95 | #if defined(CONFIG_ARMV8_SPL_EXCEPTION_VECTORS) || !defined(CONFIG_SPL_BUILD) |
Andre Przywara | 4eecab7 | 2018-07-25 00:57:01 +0100 | [diff] [blame] | 96 | .macro set_vbar, regname, reg |
| 97 | msr \regname, \reg |
| 98 | .endm |
| 99 | adr x0, vectors |
| 100 | #else |
| 101 | .macro set_vbar, regname, reg |
| 102 | .endm |
| 103 | #endif |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 104 | /* |
| 105 | * Could be EL3/EL2/EL1, Initial State: |
| 106 | * Little Endian, MMU Disabled, i/dCache Disabled |
| 107 | */ |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 108 | switch_el x1, 3f, 2f, 1f |
Andre Przywara | 4eecab7 | 2018-07-25 00:57:01 +0100 | [diff] [blame] | 109 | 3: set_vbar vbar_el3, x0 |
David Feng | 7c5eca7 | 2014-04-19 09:45:21 +0800 | [diff] [blame] | 110 | mrs x0, scr_el3 |
David Feng | 79bbde0 | 2014-03-14 14:26:27 +0800 | [diff] [blame] | 111 | orr x0, x0, #0xf /* SCR_EL3.NS|IRQ|FIQ|EA */ |
| 112 | msr scr_el3, x0 |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 113 | msr cptr_el3, xzr /* Enable FP/SIMD */ |
Thierry Reding | 2565792 | 2015-08-20 11:42:18 +0200 | [diff] [blame] | 114 | #ifdef COUNTER_FREQUENCY |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 115 | ldr x0, =COUNTER_FREQUENCY |
| 116 | msr cntfrq_el0, x0 /* Initialize CNTFRQ */ |
Thierry Reding | 2565792 | 2015-08-20 11:42:18 +0200 | [diff] [blame] | 117 | #endif |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 118 | b 0f |
Andre Przywara | 4eecab7 | 2018-07-25 00:57:01 +0100 | [diff] [blame] | 119 | 2: set_vbar vbar_el2, x0 |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 120 | mov x0, #0x33ff |
| 121 | msr cptr_el2, x0 /* Enable FP/SIMD */ |
| 122 | b 0f |
Andre Przywara | 4eecab7 | 2018-07-25 00:57:01 +0100 | [diff] [blame] | 123 | 1: set_vbar vbar_el1, x0 |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 124 | mov x0, #3 << 20 |
| 125 | msr cpacr_el1, x0 /* Enable FP/SIMD */ |
| 126 | 0: |
| 127 | |
Mingkai Hu | 553d405 | 2017-01-06 17:41:10 +0800 | [diff] [blame] | 128 | /* |
Dinh Nguyen | c3e970a | 2017-04-26 23:36:03 -0500 | [diff] [blame] | 129 | * Enable SMPEN bit for coherency. |
Mingkai Hu | 553d405 | 2017-01-06 17:41:10 +0800 | [diff] [blame] | 130 | * This register is not architectural but at the moment |
| 131 | * this bit should be set for A53/A57/A72. |
| 132 | */ |
| 133 | #ifdef CONFIG_ARMV8_SET_SMPEN |
York Sun | e6b871e | 2017-05-15 08:51:59 -0700 | [diff] [blame] | 134 | switch_el x1, 3f, 1f, 1f |
| 135 | 3: |
Dinh Nguyen | c3e970a | 2017-04-26 23:36:03 -0500 | [diff] [blame] | 136 | mrs x0, S3_1_c15_c2_1 /* cpuectlr_el1 */ |
Mingkai Hu | 553d405 | 2017-01-06 17:41:10 +0800 | [diff] [blame] | 137 | orr x0, x0, #0x40 |
| 138 | msr S3_1_c15_c2_1, x0 |
York Sun | e6b871e | 2017-05-15 08:51:59 -0700 | [diff] [blame] | 139 | 1: |
Mingkai Hu | 553d405 | 2017-01-06 17:41:10 +0800 | [diff] [blame] | 140 | #endif |
| 141 | |
Bhupesh Sharma | 80a7e35 | 2015-01-23 15:50:04 +0530 | [diff] [blame] | 142 | /* Apply ARM core specific erratas */ |
| 143 | bl apply_core_errata |
| 144 | |
York Sun | ef04201 | 2014-02-26 13:26:04 -0800 | [diff] [blame] | 145 | /* |
| 146 | * Cache/BPB/TLB Invalidate |
| 147 | * i-cache is invalidated before enabled in icache_enable() |
| 148 | * tlb is invalidated before mmu is enabled in dcache_enable() |
| 149 | * d-cache is invalidated before enabled in dcache_enable() |
| 150 | */ |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 151 | |
| 152 | /* Processor specific initialization */ |
| 153 | bl lowlevel_init |
| 154 | |
Oded Gabbay | 97a8d65 | 2016-12-27 11:19:43 +0200 | [diff] [blame] | 155 | #if defined(CONFIG_ARMV8_SPIN_TABLE) && !defined(CONFIG_SPL_BUILD) |
Masahiro Yamada | 2663cd6 | 2016-06-27 19:31:05 +0900 | [diff] [blame] | 156 | branch_if_master x0, x1, master_cpu |
| 157 | b spin_table_secondary_jump |
| 158 | /* never return */ |
| 159 | #elif defined(CONFIG_ARMV8_MULTIENTRY) |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 160 | branch_if_master x0, x1, master_cpu |
| 161 | |
| 162 | /* |
| 163 | * Slave CPUs |
| 164 | */ |
| 165 | slave_cpu: |
| 166 | wfe |
| 167 | ldr x1, =CPU_RELEASE_ADDR |
| 168 | ldr x0, [x1] |
| 169 | cbz x0, slave_cpu |
| 170 | br x0 /* branch to the given address */ |
Linus Walleij | 7477139 | 2015-03-09 10:53:21 +0100 | [diff] [blame] | 171 | #endif /* CONFIG_ARMV8_MULTIENTRY */ |
Masahiro Yamada | 2663cd6 | 2016-06-27 19:31:05 +0900 | [diff] [blame] | 172 | master_cpu: |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 173 | bl _main |
| 174 | |
Sergey Temerkhanov | 78eaa49 | 2015-10-14 09:55:45 -0700 | [diff] [blame] | 175 | #ifdef CONFIG_SYS_RESET_SCTRL |
| 176 | reset_sctrl: |
| 177 | switch_el x1, 3f, 2f, 1f |
| 178 | 3: |
| 179 | mrs x0, sctlr_el3 |
| 180 | b 0f |
| 181 | 2: |
| 182 | mrs x0, sctlr_el2 |
| 183 | b 0f |
| 184 | 1: |
| 185 | mrs x0, sctlr_el1 |
| 186 | |
| 187 | 0: |
| 188 | ldr x1, =0xfdfffffa |
| 189 | and x0, x0, x1 |
| 190 | |
| 191 | switch_el x1, 6f, 5f, 4f |
| 192 | 6: |
| 193 | msr sctlr_el3, x0 |
| 194 | b 7f |
| 195 | 5: |
| 196 | msr sctlr_el2, x0 |
| 197 | b 7f |
| 198 | 4: |
| 199 | msr sctlr_el1, x0 |
| 200 | |
| 201 | 7: |
| 202 | dsb sy |
| 203 | isb |
| 204 | b __asm_invalidate_tlb_all |
| 205 | ret |
| 206 | #endif |
| 207 | |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 208 | /*-----------------------------------------------------------------------*/ |
| 209 | |
Bhupesh Sharma | 80a7e35 | 2015-01-23 15:50:04 +0530 | [diff] [blame] | 210 | WEAK(apply_core_errata) |
| 211 | |
| 212 | mov x29, lr /* Save LR */ |
Alison Wang | c129387 | 2017-12-28 13:00:55 +0800 | [diff] [blame] | 213 | /* For now, we support Cortex-A53, Cortex-A57 specific errata */ |
| 214 | |
| 215 | /* Check if we are running on a Cortex-A53 core */ |
| 216 | branch_if_a53_core x0, apply_a53_core_errata |
Bhupesh Sharma | 80a7e35 | 2015-01-23 15:50:04 +0530 | [diff] [blame] | 217 | |
| 218 | /* Check if we are running on a Cortex-A57 core */ |
| 219 | branch_if_a57_core x0, apply_a57_core_errata |
| 220 | 0: |
| 221 | mov lr, x29 /* Restore LR */ |
| 222 | ret |
| 223 | |
Alison Wang | c129387 | 2017-12-28 13:00:55 +0800 | [diff] [blame] | 224 | apply_a53_core_errata: |
| 225 | |
| 226 | #ifdef CONFIG_ARM_ERRATA_855873 |
| 227 | mrs x0, midr_el1 |
| 228 | tst x0, #(0xf << 20) |
| 229 | b.ne 0b |
| 230 | |
| 231 | mrs x0, midr_el1 |
| 232 | and x0, x0, #0xf |
| 233 | cmp x0, #3 |
| 234 | b.lt 0b |
| 235 | |
| 236 | mrs x0, S3_1_c15_c2_0 /* cpuactlr_el1 */ |
| 237 | /* Enable data cache clean as data cache clean/invalidate */ |
| 238 | orr x0, x0, #1 << 44 |
| 239 | msr S3_1_c15_c2_0, x0 /* cpuactlr_el1 */ |
| 240 | #endif |
| 241 | b 0b |
| 242 | |
Bhupesh Sharma | 80a7e35 | 2015-01-23 15:50:04 +0530 | [diff] [blame] | 243 | apply_a57_core_errata: |
| 244 | |
| 245 | #ifdef CONFIG_ARM_ERRATA_828024 |
| 246 | mrs x0, S3_1_c15_c2_0 /* cpuactlr_el1 */ |
| 247 | /* Disable non-allocate hint of w-b-n-a memory type */ |
Bhupesh Sharma | 06a0f1d | 2015-05-28 14:54:13 +0530 | [diff] [blame] | 248 | orr x0, x0, #1 << 49 |
Bhupesh Sharma | 80a7e35 | 2015-01-23 15:50:04 +0530 | [diff] [blame] | 249 | /* Disable write streaming no L1-allocate threshold */ |
Bhupesh Sharma | 06a0f1d | 2015-05-28 14:54:13 +0530 | [diff] [blame] | 250 | orr x0, x0, #3 << 25 |
Bhupesh Sharma | 80a7e35 | 2015-01-23 15:50:04 +0530 | [diff] [blame] | 251 | /* Disable write streaming no-allocate threshold */ |
Bhupesh Sharma | 06a0f1d | 2015-05-28 14:54:13 +0530 | [diff] [blame] | 252 | orr x0, x0, #3 << 27 |
Bhupesh Sharma | 80a7e35 | 2015-01-23 15:50:04 +0530 | [diff] [blame] | 253 | msr S3_1_c15_c2_0, x0 /* cpuactlr_el1 */ |
| 254 | #endif |
| 255 | |
| 256 | #ifdef CONFIG_ARM_ERRATA_826974 |
| 257 | mrs x0, S3_1_c15_c2_0 /* cpuactlr_el1 */ |
| 258 | /* Disable speculative load execution ahead of a DMB */ |
Bhupesh Sharma | 06a0f1d | 2015-05-28 14:54:13 +0530 | [diff] [blame] | 259 | orr x0, x0, #1 << 59 |
Bhupesh Sharma | 80a7e35 | 2015-01-23 15:50:04 +0530 | [diff] [blame] | 260 | msr S3_1_c15_c2_0, x0 /* cpuactlr_el1 */ |
| 261 | #endif |
| 262 | |
Ashish kumar | 9c6d33c | 2016-01-27 18:09:32 +0530 | [diff] [blame] | 263 | #ifdef CONFIG_ARM_ERRATA_833471 |
| 264 | mrs x0, S3_1_c15_c2_0 /* cpuactlr_el1 */ |
| 265 | /* FPSCR write flush. |
| 266 | * Note that in some cases where a flush is unnecessary this |
| 267 | could impact performance. */ |
| 268 | orr x0, x0, #1 << 38 |
| 269 | msr S3_1_c15_c2_0, x0 /* cpuactlr_el1 */ |
| 270 | #endif |
| 271 | |
| 272 | #ifdef CONFIG_ARM_ERRATA_829520 |
| 273 | mrs x0, S3_1_c15_c2_0 /* cpuactlr_el1 */ |
| 274 | /* Disable Indirect Predictor bit will prevent this erratum |
| 275 | from occurring |
| 276 | * Note that in some cases where a flush is unnecessary this |
| 277 | could impact performance. */ |
| 278 | orr x0, x0, #1 << 4 |
| 279 | msr S3_1_c15_c2_0, x0 /* cpuactlr_el1 */ |
| 280 | #endif |
| 281 | |
Bhupesh Sharma | 80a7e35 | 2015-01-23 15:50:04 +0530 | [diff] [blame] | 282 | #ifdef CONFIG_ARM_ERRATA_833069 |
| 283 | mrs x0, S3_1_c15_c2_0 /* cpuactlr_el1 */ |
| 284 | /* Disable Enable Invalidates of BTB bit */ |
| 285 | and x0, x0, #0xE |
| 286 | msr S3_1_c15_c2_0, x0 /* cpuactlr_el1 */ |
| 287 | #endif |
| 288 | b 0b |
| 289 | ENDPROC(apply_core_errata) |
| 290 | |
| 291 | /*-----------------------------------------------------------------------*/ |
| 292 | |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 293 | WEAK(lowlevel_init) |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 294 | mov x29, lr /* Save LR */ |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 295 | |
David Feng | 79bbde0 | 2014-03-14 14:26:27 +0800 | [diff] [blame] | 296 | #if defined(CONFIG_GICV2) || defined(CONFIG_GICV3) |
| 297 | branch_if_slave x0, 1f |
| 298 | ldr x0, =GICD_BASE |
| 299 | bl gic_init_secure |
| 300 | 1: |
| 301 | #if defined(CONFIG_GICV3) |
| 302 | ldr x0, =GICR_BASE |
| 303 | bl gic_init_secure_percpu |
| 304 | #elif defined(CONFIG_GICV2) |
| 305 | ldr x0, =GICD_BASE |
| 306 | ldr x1, =GICC_BASE |
| 307 | bl gic_init_secure_percpu |
| 308 | #endif |
Stephen Warren | 73f47af | 2016-04-28 12:45:44 -0600 | [diff] [blame] | 309 | #endif |
David Feng | 79bbde0 | 2014-03-14 14:26:27 +0800 | [diff] [blame] | 310 | |
Masahiro Yamada | e4ce25f | 2016-05-20 12:13:10 +0900 | [diff] [blame] | 311 | #ifdef CONFIG_ARMV8_MULTIENTRY |
David Feng | 79bbde0 | 2014-03-14 14:26:27 +0800 | [diff] [blame] | 312 | branch_if_master x0, x1, 2f |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 313 | |
| 314 | /* |
| 315 | * Slave should wait for master clearing spin table. |
| 316 | * This sync prevent salves observing incorrect |
| 317 | * value of spin table and jumping to wrong place. |
| 318 | */ |
David Feng | 79bbde0 | 2014-03-14 14:26:27 +0800 | [diff] [blame] | 319 | #if defined(CONFIG_GICV2) || defined(CONFIG_GICV3) |
| 320 | #ifdef CONFIG_GICV2 |
| 321 | ldr x0, =GICC_BASE |
| 322 | #endif |
| 323 | bl gic_wait_for_interrupt |
| 324 | #endif |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 325 | |
| 326 | /* |
David Feng | 79bbde0 | 2014-03-14 14:26:27 +0800 | [diff] [blame] | 327 | * All slaves will enter EL2 and optionally EL1. |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 328 | */ |
Alison Wang | eb2088d | 2017-01-17 09:39:17 +0800 | [diff] [blame] | 329 | adr x4, lowlevel_in_el2 |
| 330 | ldr x5, =ES_TO_AARCH64 |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 331 | bl armv8_switch_to_el2 |
Alison Wang | 73818d5 | 2016-11-10 10:49:03 +0800 | [diff] [blame] | 332 | |
| 333 | lowlevel_in_el2: |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 334 | #ifdef CONFIG_ARMV8_SWITCH_TO_EL1 |
Alison Wang | eb2088d | 2017-01-17 09:39:17 +0800 | [diff] [blame] | 335 | adr x4, lowlevel_in_el1 |
| 336 | ldr x5, =ES_TO_AARCH64 |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 337 | bl armv8_switch_to_el1 |
Alison Wang | 73818d5 | 2016-11-10 10:49:03 +0800 | [diff] [blame] | 338 | |
| 339 | lowlevel_in_el1: |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 340 | #endif |
| 341 | |
Linus Walleij | 7477139 | 2015-03-09 10:53:21 +0100 | [diff] [blame] | 342 | #endif /* CONFIG_ARMV8_MULTIENTRY */ |
| 343 | |
David Feng | 79bbde0 | 2014-03-14 14:26:27 +0800 | [diff] [blame] | 344 | 2: |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 345 | mov lr, x29 /* Restore LR */ |
| 346 | ret |
| 347 | ENDPROC(lowlevel_init) |
| 348 | |
David Feng | 79bbde0 | 2014-03-14 14:26:27 +0800 | [diff] [blame] | 349 | WEAK(smp_kick_all_cpus) |
| 350 | /* Kick secondary cpus up by SGI 0 interrupt */ |
David Feng | 79bbde0 | 2014-03-14 14:26:27 +0800 | [diff] [blame] | 351 | #if defined(CONFIG_GICV2) || defined(CONFIG_GICV3) |
| 352 | ldr x0, =GICD_BASE |
Masahiro Yamada | b914009 | 2016-06-17 18:32:47 +0900 | [diff] [blame] | 353 | b gic_kick_secondary_cpus |
David Feng | 79bbde0 | 2014-03-14 14:26:27 +0800 | [diff] [blame] | 354 | #endif |
David Feng | 79bbde0 | 2014-03-14 14:26:27 +0800 | [diff] [blame] | 355 | ret |
| 356 | ENDPROC(smp_kick_all_cpus) |
| 357 | |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 358 | /*-----------------------------------------------------------------------*/ |
| 359 | |
| 360 | ENTRY(c_runtime_cpu_setup) |
Alexander Graf | b3e9dc6 | 2019-02-20 17:14:49 +0100 | [diff] [blame] | 361 | #if defined(CONFIG_ARMV8_SPL_EXCEPTION_VECTORS) || !defined(CONFIG_SPL_BUILD) |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 362 | /* Relocate vBAR */ |
| 363 | adr x0, vectors |
| 364 | switch_el x1, 3f, 2f, 1f |
| 365 | 3: msr vbar_el3, x0 |
| 366 | b 0f |
| 367 | 2: msr vbar_el2, x0 |
| 368 | b 0f |
| 369 | 1: msr vbar_el1, x0 |
| 370 | 0: |
Andre Przywara | 4eecab7 | 2018-07-25 00:57:01 +0100 | [diff] [blame] | 371 | #endif |
David Feng | 85fd5f1 | 2013-12-14 11:47:35 +0800 | [diff] [blame] | 372 | |
| 373 | ret |
| 374 | ENDPROC(c_runtime_cpu_setup) |
Stephen Warren | 100a479 | 2016-07-18 17:01:50 -0600 | [diff] [blame] | 375 | |
| 376 | WEAK(save_boot_params) |
| 377 | b save_boot_params_ret /* back to my caller */ |
| 378 | ENDPROC(save_boot_params) |