Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 1 | /* |
Antonio Nino Diaz | 1eb64a1 | 2018-10-17 15:29:34 +0100 | [diff] [blame] | 2 | * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 5 | */ |
| 6 | #include <arch.h> |
| 7 | #include <asm_macros.S> |
| 8 | #include <assert_macros.S> |
| 9 | #include <cpu_macros.S> |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 10 | #include <cortex_a53.h> |
Isla Mitchell | e363146 | 2017-07-14 10:46:32 +0100 | [diff] [blame] | 11 | #include <cortex_a57.h> |
Varun Wadekar | 25e658e | 2016-04-26 11:38:38 -0700 | [diff] [blame] | 12 | #include <platform_def.h> |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 13 | #include <tegra_def.h> |
| 14 | |
Varun Wadekar | b24dea9 | 2015-09-22 13:33:56 +0530 | [diff] [blame] | 15 | #define MIDR_PN_CORTEX_A57 0xD07 |
| 16 | |
| 17 | /******************************************************************************* |
| 18 | * Implementation defined ACTLR_EL3 bit definitions |
| 19 | ******************************************************************************/ |
| 20 | #define ACTLR_EL3_L2ACTLR_BIT (1 << 6) |
| 21 | #define ACTLR_EL3_L2ECTLR_BIT (1 << 5) |
| 22 | #define ACTLR_EL3_L2CTLR_BIT (1 << 4) |
| 23 | #define ACTLR_EL3_CPUECTLR_BIT (1 << 1) |
| 24 | #define ACTLR_EL3_CPUACTLR_BIT (1 << 0) |
| 25 | #define ACTLR_EL3_ENABLE_ALL_ACCESS (ACTLR_EL3_L2ACTLR_BIT | \ |
| 26 | ACTLR_EL3_L2ECTLR_BIT | \ |
| 27 | ACTLR_EL3_L2CTLR_BIT | \ |
| 28 | ACTLR_EL3_CPUECTLR_BIT | \ |
| 29 | ACTLR_EL3_CPUACTLR_BIT) |
| 30 | |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 31 | /* Global functions */ |
Varun Wadekar | a78bb1b | 2015-08-07 10:03:00 +0530 | [diff] [blame] | 32 | .globl plat_is_my_cpu_primary |
| 33 | .globl plat_my_core_pos |
| 34 | .globl plat_get_my_entrypoint |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 35 | .globl plat_secondary_cold_boot_setup |
| 36 | .globl platform_mem_init |
| 37 | .globl plat_crash_console_init |
| 38 | .globl plat_crash_console_putc |
Antonio Nino Diaz | 1eb64a1 | 2018-10-17 15:29:34 +0100 | [diff] [blame] | 39 | .globl plat_crash_console_flush |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 40 | .globl tegra_secure_entrypoint |
| 41 | .globl plat_reset_handler |
| 42 | |
| 43 | /* Global variables */ |
Varun Wadekar | a78bb1b | 2015-08-07 10:03:00 +0530 | [diff] [blame] | 44 | .globl tegra_sec_entry_point |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 45 | .globl ns_image_entrypoint |
| 46 | .globl tegra_bl31_phys_base |
Varun Wadekar | d2014c6 | 2015-10-29 10:37:28 +0530 | [diff] [blame] | 47 | .globl tegra_console_base |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 48 | |
| 49 | /* --------------------- |
| 50 | * Common CPU init code |
| 51 | * --------------------- |
| 52 | */ |
| 53 | .macro cpu_init_common |
| 54 | |
Varun Wadekar | b24dea9 | 2015-09-22 13:33:56 +0530 | [diff] [blame] | 55 | /* ------------------------------------------------ |
Varun Wadekar | 69ce101 | 2016-05-12 13:43:33 -0700 | [diff] [blame] | 56 | * We enable procesor retention, L2/CPUECTLR NS |
| 57 | * access and ECC/Parity protection for A57 CPUs |
Varun Wadekar | b24dea9 | 2015-09-22 13:33:56 +0530 | [diff] [blame] | 58 | * ------------------------------------------------ |
| 59 | */ |
| 60 | mrs x0, midr_el1 |
| 61 | mov x1, #(MIDR_PN_MASK << MIDR_PN_SHIFT) |
| 62 | and x0, x0, x1 |
| 63 | lsr x0, x0, #MIDR_PN_SHIFT |
| 64 | cmp x0, #MIDR_PN_CORTEX_A57 |
| 65 | b.ne 1f |
| 66 | |
Varun Wadekar | 4e9c231 | 2015-08-21 15:56:02 +0530 | [diff] [blame] | 67 | /* --------------------------- |
| 68 | * Enable processor retention |
| 69 | * --------------------------- |
Varun Wadekar | 69ce101 | 2016-05-12 13:43:33 -0700 | [diff] [blame] | 70 | */ |
Varun Wadekar | 1384a16 | 2017-06-05 14:54:46 -0700 | [diff] [blame] | 71 | mrs x0, CORTEX_A57_L2ECTLR_EL1 |
| 72 | mov x1, #RETENTION_ENTRY_TICKS_512 |
| 73 | bic x0, x0, #CORTEX_A57_L2ECTLR_RET_CTRL_MASK |
Varun Wadekar | 4e9c231 | 2015-08-21 15:56:02 +0530 | [diff] [blame] | 74 | orr x0, x0, x1 |
Varun Wadekar | 1384a16 | 2017-06-05 14:54:46 -0700 | [diff] [blame] | 75 | msr CORTEX_A57_L2ECTLR_EL1, x0 |
Varun Wadekar | 4e9c231 | 2015-08-21 15:56:02 +0530 | [diff] [blame] | 76 | isb |
Varun Wadekar | 4e9c231 | 2015-08-21 15:56:02 +0530 | [diff] [blame] | 77 | |
Varun Wadekar | 1384a16 | 2017-06-05 14:54:46 -0700 | [diff] [blame] | 78 | mrs x0, CORTEX_A57_ECTLR_EL1 |
| 79 | mov x1, #RETENTION_ENTRY_TICKS_512 |
| 80 | bic x0, x0, #CORTEX_A57_ECTLR_CPU_RET_CTRL_MASK |
Varun Wadekar | 4e9c231 | 2015-08-21 15:56:02 +0530 | [diff] [blame] | 81 | orr x0, x0, x1 |
Varun Wadekar | 1384a16 | 2017-06-05 14:54:46 -0700 | [diff] [blame] | 82 | msr CORTEX_A57_ECTLR_EL1, x0 |
Varun Wadekar | 4e9c231 | 2015-08-21 15:56:02 +0530 | [diff] [blame] | 83 | isb |
Varun Wadekar | 4e9c231 | 2015-08-21 15:56:02 +0530 | [diff] [blame] | 84 | |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 85 | /* ------------------------------------------------------- |
| 86 | * Enable L2 and CPU ECTLR RW access from non-secure world |
| 87 | * ------------------------------------------------------- |
Varun Wadekar | 69ce101 | 2016-05-12 13:43:33 -0700 | [diff] [blame] | 88 | */ |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 89 | mov x0, #ACTLR_EL3_ENABLE_ALL_ACCESS |
| 90 | msr actlr_el3, x0 |
| 91 | msr actlr_el2, x0 |
| 92 | isb |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 93 | |
| 94 | /* -------------------------------- |
| 95 | * Enable the cycle count register |
| 96 | * -------------------------------- |
| 97 | */ |
Varun Wadekar | b24dea9 | 2015-09-22 13:33:56 +0530 | [diff] [blame] | 98 | 1: mrs x0, pmcr_el0 |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 99 | ubfx x0, x0, #11, #5 // read PMCR.N field |
| 100 | mov x1, #1 |
| 101 | lsl x0, x1, x0 |
| 102 | sub x0, x0, #1 // mask of event counters |
| 103 | orr x0, x0, #0x80000000 // disable overflow intrs |
| 104 | msr pmintenclr_el1, x0 |
| 105 | msr pmuserenr_el0, x1 // enable user mode access |
| 106 | |
| 107 | /* ---------------------------------------------------------------- |
| 108 | * Allow non-privileged access to CNTVCT: Set CNTKCTL (Kernel Count |
| 109 | * register), bit 1 (EL0VCTEN) to enable access to CNTVCT/CNTFRQ |
| 110 | * registers from EL0. |
| 111 | * ---------------------------------------------------------------- |
| 112 | */ |
| 113 | mrs x0, cntkctl_el1 |
| 114 | orr x0, x0, #EL0VCTEN_BIT |
| 115 | msr cntkctl_el1, x0 |
| 116 | .endm |
| 117 | |
| 118 | /* ----------------------------------------------------- |
Varun Wadekar | a78bb1b | 2015-08-07 10:03:00 +0530 | [diff] [blame] | 119 | * unsigned int plat_is_my_cpu_primary(void); |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 120 | * |
| 121 | * This function checks if this is the Primary CPU |
| 122 | * ----------------------------------------------------- |
| 123 | */ |
Varun Wadekar | a78bb1b | 2015-08-07 10:03:00 +0530 | [diff] [blame] | 124 | func plat_is_my_cpu_primary |
| 125 | mrs x0, mpidr_el1 |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 126 | and x0, x0, #(MPIDR_CLUSTER_MASK | MPIDR_CPU_MASK) |
| 127 | cmp x0, #TEGRA_PRIMARY_CPU |
| 128 | cset x0, eq |
| 129 | ret |
Varun Wadekar | a78bb1b | 2015-08-07 10:03:00 +0530 | [diff] [blame] | 130 | endfunc plat_is_my_cpu_primary |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 131 | |
| 132 | /* ----------------------------------------------------- |
Varun Wadekar | a78bb1b | 2015-08-07 10:03:00 +0530 | [diff] [blame] | 133 | * unsigned int plat_my_core_pos(void); |
| 134 | * |
| 135 | * result: CorePos = CoreId + (ClusterId << 2) |
| 136 | * ----------------------------------------------------- |
| 137 | */ |
| 138 | func plat_my_core_pos |
| 139 | mrs x0, mpidr_el1 |
| 140 | and x1, x0, #MPIDR_CPU_MASK |
| 141 | and x0, x0, #MPIDR_CLUSTER_MASK |
| 142 | add x0, x1, x0, LSR #6 |
| 143 | ret |
| 144 | endfunc plat_my_core_pos |
| 145 | |
| 146 | /* ----------------------------------------------------- |
| 147 | * unsigned long plat_get_my_entrypoint (void); |
| 148 | * |
| 149 | * Main job of this routine is to distinguish between |
| 150 | * a cold and warm boot. If the tegra_sec_entry_point for |
| 151 | * this CPU is present, then it's a warm boot. |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 152 | * |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 153 | * ----------------------------------------------------- |
| 154 | */ |
Varun Wadekar | a78bb1b | 2015-08-07 10:03:00 +0530 | [diff] [blame] | 155 | func plat_get_my_entrypoint |
| 156 | adr x1, tegra_sec_entry_point |
| 157 | ldr x0, [x1] |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 158 | ret |
Varun Wadekar | a78bb1b | 2015-08-07 10:03:00 +0530 | [diff] [blame] | 159 | endfunc plat_get_my_entrypoint |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 160 | |
| 161 | /* ----------------------------------------------------- |
Varun Wadekar | 39f87d1 | 2015-09-22 13:45:07 +0530 | [diff] [blame] | 162 | * int platform_get_core_pos(int mpidr); |
| 163 | * |
| 164 | * With this function: CorePos = (ClusterId * 4) + |
| 165 | * CoreId |
| 166 | * ----------------------------------------------------- |
| 167 | */ |
| 168 | func platform_get_core_pos |
| 169 | and x1, x0, #MPIDR_CPU_MASK |
| 170 | and x0, x0, #MPIDR_CLUSTER_MASK |
| 171 | add x0, x1, x0, LSR #6 |
| 172 | ret |
| 173 | endfunc platform_get_core_pos |
| 174 | |
| 175 | /* ----------------------------------------------------- |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 176 | * void plat_secondary_cold_boot_setup (void); |
| 177 | * |
| 178 | * This function performs any platform specific actions |
| 179 | * needed for a secondary cpu after a cold reset. Right |
| 180 | * now this is a stub function. |
| 181 | * ----------------------------------------------------- |
| 182 | */ |
| 183 | func plat_secondary_cold_boot_setup |
| 184 | mov x0, #0 |
| 185 | ret |
| 186 | endfunc plat_secondary_cold_boot_setup |
| 187 | |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 188 | /* -------------------------------------------------------- |
| 189 | * void platform_mem_init (void); |
| 190 | * |
| 191 | * Any memory init, relocation to be done before the |
| 192 | * platform boots. Called very early in the boot process. |
| 193 | * -------------------------------------------------------- |
| 194 | */ |
| 195 | func platform_mem_init |
| 196 | mov x0, #0 |
| 197 | ret |
| 198 | endfunc platform_mem_init |
| 199 | |
| 200 | /* --------------------------------------------- |
| 201 | * int plat_crash_console_init(void) |
| 202 | * Function to initialize the crash console |
| 203 | * without a C Runtime to print crash report. |
Juan Castillo | e7ae6db | 2015-11-26 14:52:15 +0000 | [diff] [blame] | 204 | * Clobber list : x0 - x4 |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 205 | * --------------------------------------------- |
| 206 | */ |
| 207 | func plat_crash_console_init |
Varun Wadekar | 4e6ae18 | 2017-04-04 13:40:12 -0700 | [diff] [blame] | 208 | mov x0, #0 |
| 209 | adr x1, tegra_console_base |
| 210 | ldr x1, [x1] |
| 211 | cbz x1, 1f |
| 212 | mov w0, #1 |
| 213 | 1: ret |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 214 | endfunc plat_crash_console_init |
| 215 | |
| 216 | /* --------------------------------------------- |
| 217 | * int plat_crash_console_putc(void) |
| 218 | * Function to print a character on the crash |
| 219 | * console without a C Runtime. |
| 220 | * Clobber list : x1, x2 |
| 221 | * --------------------------------------------- |
| 222 | */ |
| 223 | func plat_crash_console_putc |
Varun Wadekar | d2014c6 | 2015-10-29 10:37:28 +0530 | [diff] [blame] | 224 | adr x1, tegra_console_base |
| 225 | ldr x1, [x1] |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 226 | b console_core_putc |
| 227 | endfunc plat_crash_console_putc |
| 228 | |
Antonio Nino Diaz | 1eb64a1 | 2018-10-17 15:29:34 +0100 | [diff] [blame] | 229 | /* --------------------------------------------- |
| 230 | * int plat_crash_console_flush() |
| 231 | * Function to force a write of all buffered |
| 232 | * data that hasn't been output. |
| 233 | * Out : return -1 on error else return 0. |
| 234 | * Clobber list : x0, x1 |
| 235 | * --------------------------------------------- |
| 236 | */ |
| 237 | func plat_crash_console_flush |
| 238 | adr x0, tegra_console_base |
| 239 | ldr x0, [x0] |
| 240 | b console_core_flush |
| 241 | endfunc plat_crash_console_flush |
| 242 | |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 243 | /* --------------------------------------------------- |
| 244 | * Function to handle a platform reset and store |
| 245 | * input parameters passed by BL2. |
| 246 | * --------------------------------------------------- |
| 247 | */ |
| 248 | func plat_reset_handler |
| 249 | |
Varun Wadekar | 1ec441e | 2016-03-24 15:34:24 -0700 | [diff] [blame] | 250 | /* ---------------------------------------------------- |
| 251 | * Verify if we are running from BL31_BASE address |
| 252 | * ---------------------------------------------------- |
| 253 | */ |
| 254 | adr x18, bl31_entrypoint |
| 255 | mov x17, #BL31_BASE |
| 256 | cmp x18, x17 |
| 257 | b.eq 1f |
| 258 | |
| 259 | /* ---------------------------------------------------- |
| 260 | * Copy the entire BL31 code to BL31_BASE if we are not |
| 261 | * running from it already |
| 262 | * ---------------------------------------------------- |
| 263 | */ |
| 264 | mov x0, x17 |
| 265 | mov x1, x18 |
| 266 | mov x2, #BL31_SIZE |
| 267 | _loop16: |
| 268 | cmp x2, #16 |
Douglas Raillard | 2bb9f47 | 2017-03-20 10:38:29 +0000 | [diff] [blame] | 269 | b.lo _loop1 |
Varun Wadekar | 1ec441e | 2016-03-24 15:34:24 -0700 | [diff] [blame] | 270 | ldp x3, x4, [x1], #16 |
| 271 | stp x3, x4, [x0], #16 |
| 272 | sub x2, x2, #16 |
| 273 | b _loop16 |
| 274 | /* copy byte per byte */ |
| 275 | _loop1: |
| 276 | cbz x2, _end |
| 277 | ldrb w3, [x1], #1 |
| 278 | strb w3, [x0], #1 |
| 279 | subs x2, x2, #1 |
| 280 | b.ne _loop1 |
| 281 | |
| 282 | /* ---------------------------------------------------- |
| 283 | * Jump to BL31_BASE and start execution again |
| 284 | * ---------------------------------------------------- |
| 285 | */ |
| 286 | _end: mov x0, x20 |
| 287 | mov x1, x21 |
| 288 | br x17 |
| 289 | 1: |
| 290 | |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 291 | /* ----------------------------------- |
| 292 | * derive and save the phys_base addr |
| 293 | * ----------------------------------- |
| 294 | */ |
| 295 | adr x17, tegra_bl31_phys_base |
| 296 | ldr x18, [x17] |
| 297 | cbnz x18, 1f |
| 298 | adr x18, bl31_entrypoint |
| 299 | str x18, [x17] |
| 300 | |
| 301 | 1: cpu_init_common |
| 302 | |
| 303 | ret |
| 304 | endfunc plat_reset_handler |
| 305 | |
| 306 | /* ---------------------------------------- |
| 307 | * Secure entrypoint function for CPU boot |
| 308 | * ---------------------------------------- |
| 309 | */ |
Julius Werner | b4c75e9 | 2017-08-01 15:16:36 -0700 | [diff] [blame] | 310 | func tegra_secure_entrypoint _align=6 |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 311 | |
| 312 | #if ERRATA_TEGRA_INVALIDATE_BTB_AT_BOOT |
| 313 | |
| 314 | /* ------------------------------------------------------- |
| 315 | * Invalidate BTB along with I$ to remove any stale |
| 316 | * entries from the branch predictor array. |
| 317 | * ------------------------------------------------------- |
| 318 | */ |
Eleanor Bonnici | 91b11c3 | 2017-08-10 14:46:26 +0100 | [diff] [blame] | 319 | mrs x0, CORTEX_A57_CPUACTLR_EL1 |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 320 | orr x0, x0, #1 |
Eleanor Bonnici | 91b11c3 | 2017-08-10 14:46:26 +0100 | [diff] [blame] | 321 | msr CORTEX_A57_CPUACTLR_EL1, x0 /* invalidate BTB and I$ together */ |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 322 | dsb sy |
| 323 | isb |
| 324 | ic iallu /* actual invalidate */ |
| 325 | dsb sy |
| 326 | isb |
| 327 | |
Eleanor Bonnici | 91b11c3 | 2017-08-10 14:46:26 +0100 | [diff] [blame] | 328 | mrs x0, CORTEX_A57_CPUACTLR_EL1 |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 329 | bic x0, x0, #1 |
Eleanor Bonnici | 91b11c3 | 2017-08-10 14:46:26 +0100 | [diff] [blame] | 330 | msr CORTEX_A57_CPUACTLR_EL1, X0 /* restore original CPUACTLR_EL1 */ |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 331 | dsb sy |
| 332 | isb |
| 333 | |
| 334 | .rept 7 |
| 335 | nop /* wait */ |
| 336 | .endr |
| 337 | |
| 338 | /* ----------------------------------------------- |
| 339 | * Extract OSLK bit and check if it is '1'. This |
| 340 | * bit remains '0' for A53 on warm-resets. If '1', |
| 341 | * turn off regional clock gating and request warm |
| 342 | * reset. |
| 343 | * ----------------------------------------------- |
| 344 | */ |
| 345 | mrs x0, oslsr_el1 |
| 346 | and x0, x0, #2 |
| 347 | mrs x1, mpidr_el1 |
| 348 | bics xzr, x0, x1, lsr #7 /* 0 = slow cluster or warm reset */ |
| 349 | b.eq restore_oslock |
| 350 | mov x0, xzr |
| 351 | msr oslar_el1, x0 /* os lock stays 0 across warm reset */ |
| 352 | mov x3, #3 |
| 353 | movz x4, #0x8000, lsl #48 |
Eleanor Bonnici | 91b11c3 | 2017-08-10 14:46:26 +0100 | [diff] [blame] | 354 | msr CORTEX_A57_CPUACTLR_EL1, x4 /* turn off RCG */ |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 355 | isb |
| 356 | msr rmr_el3, x3 /* request warm reset */ |
| 357 | isb |
| 358 | dsb sy |
| 359 | 1: wfi |
| 360 | b 1b |
| 361 | |
| 362 | /* -------------------------------------------------- |
| 363 | * These nops are here so that speculative execution |
| 364 | * won't harm us before we are done with warm reset. |
| 365 | * -------------------------------------------------- |
| 366 | */ |
| 367 | .rept 65 |
| 368 | nop |
| 369 | .endr |
| 370 | |
| 371 | /* -------------------------------------------------- |
| 372 | * Do not insert instructions here |
| 373 | * -------------------------------------------------- |
| 374 | */ |
| 375 | #endif |
| 376 | |
| 377 | /* -------------------------------------------------- |
| 378 | * Restore OS Lock bit |
| 379 | * -------------------------------------------------- |
| 380 | */ |
| 381 | restore_oslock: |
| 382 | mov x0, #1 |
| 383 | msr oslar_el1, x0 |
| 384 | |
| 385 | cpu_init_common |
| 386 | |
| 387 | /* --------------------------------------------------------------------- |
| 388 | * The initial state of the Architectural feature trap register |
| 389 | * (CPTR_EL3) is unknown and it must be set to a known state. All |
| 390 | * feature traps are disabled. Some bits in this register are marked as |
| 391 | * Reserved and should not be modified. |
| 392 | * |
| 393 | * CPTR_EL3.TCPAC: This causes a direct access to the CPACR_EL1 from EL1 |
| 394 | * or the CPTR_EL2 from EL2 to trap to EL3 unless it is trapped at EL2. |
| 395 | * CPTR_EL3.TTA: This causes access to the Trace functionality to trap |
| 396 | * to EL3 when executed from EL0, EL1, EL2, or EL3. If system register |
| 397 | * access to trace functionality is not supported, this bit is RES0. |
| 398 | * CPTR_EL3.TFP: This causes instructions that access the registers |
| 399 | * associated with Floating Point and Advanced SIMD execution to trap |
| 400 | * to EL3 when executed from any exception level, unless trapped to EL1 |
| 401 | * or EL2. |
| 402 | * --------------------------------------------------------------------- |
| 403 | */ |
| 404 | mrs x1, cptr_el3 |
| 405 | bic w1, w1, #TCPAC_BIT |
| 406 | bic w1, w1, #TTA_BIT |
| 407 | bic w1, w1, #TFP_BIT |
| 408 | msr cptr_el3, x1 |
| 409 | |
| 410 | /* -------------------------------------------------- |
| 411 | * Get secure world's entry point and jump to it |
| 412 | * -------------------------------------------------- |
| 413 | */ |
Varun Wadekar | a78bb1b | 2015-08-07 10:03:00 +0530 | [diff] [blame] | 414 | bl plat_get_my_entrypoint |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 415 | br x0 |
| 416 | endfunc tegra_secure_entrypoint |
| 417 | |
| 418 | .data |
| 419 | .align 3 |
| 420 | |
| 421 | /* -------------------------------------------------- |
Varun Wadekar | a78bb1b | 2015-08-07 10:03:00 +0530 | [diff] [blame] | 422 | * CPU Secure entry point - resume from suspend |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 423 | * -------------------------------------------------- |
| 424 | */ |
Varun Wadekar | a78bb1b | 2015-08-07 10:03:00 +0530 | [diff] [blame] | 425 | tegra_sec_entry_point: |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 426 | .quad 0 |
Varun Wadekar | b316e24 | 2015-05-19 16:48:04 +0530 | [diff] [blame] | 427 | |
| 428 | /* -------------------------------------------------- |
| 429 | * NS world's cold boot entry point |
| 430 | * -------------------------------------------------- |
| 431 | */ |
| 432 | ns_image_entrypoint: |
| 433 | .quad 0 |
| 434 | |
| 435 | /* -------------------------------------------------- |
| 436 | * BL31's physical base address |
| 437 | * -------------------------------------------------- |
| 438 | */ |
| 439 | tegra_bl31_phys_base: |
| 440 | .quad 0 |
Varun Wadekar | d2014c6 | 2015-10-29 10:37:28 +0530 | [diff] [blame] | 441 | |
| 442 | /* -------------------------------------------------- |
| 443 | * UART controller base for console init |
| 444 | * -------------------------------------------------- |
| 445 | */ |
| 446 | tegra_console_base: |
| 447 | .quad 0 |