Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 1 | /* |
Dimitris Papastamos | 7343505 | 2018-01-02 11:37:02 +0000 | [diff] [blame^] | 2 | * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved. |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 3 | * |
dp-arm | 82cb2c1 | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <arch.h> |
| 8 | #include <asm_macros.S> |
| 9 | #include <bl_common.h> |
| 10 | #include <context.h> |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 11 | #include <el3_common_macros.S> |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 12 | #include <runtime_svc.h> |
| 13 | #include <smcc_helpers.h> |
| 14 | #include <smcc_macros.S> |
Antonio Nino Diaz | d50ece0 | 2017-02-20 14:22:22 +0000 | [diff] [blame] | 15 | #include <xlat_tables_defs.h> |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 16 | |
| 17 | .globl sp_min_vector_table |
| 18 | .globl sp_min_entrypoint |
| 19 | .globl sp_min_warm_entrypoint |
Dimitris Papastamos | 7343505 | 2018-01-02 11:37:02 +0000 | [diff] [blame^] | 20 | .globl sp_min_handle_smc |
| 21 | .globl sp_min_handle_fiq |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 22 | |
Etienne Carriere | 7181609 | 2017-08-09 15:48:53 +0200 | [diff] [blame] | 23 | .macro route_fiq_to_sp_min reg |
| 24 | /* ----------------------------------------------------- |
| 25 | * FIQs are secure interrupts trapped by Monitor and non |
| 26 | * secure is not allowed to mask the FIQs. |
| 27 | * ----------------------------------------------------- |
| 28 | */ |
| 29 | ldcopr \reg, SCR |
| 30 | orr \reg, \reg, #SCR_FIQ_BIT |
| 31 | bic \reg, \reg, #SCR_FW_BIT |
| 32 | stcopr \reg, SCR |
| 33 | .endm |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 34 | |
Etienne Carriere | 7089627 | 2017-11-08 13:49:12 +0100 | [diff] [blame] | 35 | .macro clrex_on_monitor_entry |
| 36 | #if (ARM_ARCH_MAJOR == 7) |
| 37 | /* |
| 38 | * ARMv7 architectures need to clear the exclusive access when |
| 39 | * entering Monitor mode. |
| 40 | */ |
| 41 | clrex |
| 42 | #endif |
| 43 | .endm |
| 44 | |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 45 | vector_base sp_min_vector_table |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 46 | b sp_min_entrypoint |
| 47 | b plat_panic_handler /* Undef */ |
Dimitris Papastamos | 7343505 | 2018-01-02 11:37:02 +0000 | [diff] [blame^] | 48 | b sp_min_handle_smc /* Syscall */ |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 49 | b plat_panic_handler /* Prefetch abort */ |
| 50 | b plat_panic_handler /* Data abort */ |
| 51 | b plat_panic_handler /* Reserved */ |
| 52 | b plat_panic_handler /* IRQ */ |
Dimitris Papastamos | 7343505 | 2018-01-02 11:37:02 +0000 | [diff] [blame^] | 53 | b sp_min_handle_fiq /* FIQ */ |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 54 | |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 55 | |
| 56 | /* |
| 57 | * The Cold boot/Reset entrypoint for SP_MIN |
| 58 | */ |
| 59 | func sp_min_entrypoint |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 60 | #if !RESET_TO_SP_MIN |
| 61 | /* --------------------------------------------------------------- |
| 62 | * Preceding bootloader has populated r0 with a pointer to a |
| 63 | * 'bl_params_t' structure & r1 with a pointer to platform |
| 64 | * specific structure |
| 65 | * --------------------------------------------------------------- |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 66 | */ |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 67 | mov r11, r0 |
| 68 | mov r12, r1 |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 69 | |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 70 | /* --------------------------------------------------------------------- |
| 71 | * For !RESET_TO_SP_MIN systems, only the primary CPU ever reaches |
| 72 | * sp_min_entrypoint() during the cold boot flow, so the cold/warm boot |
| 73 | * and primary/secondary CPU logic should not be executed in this case. |
| 74 | * |
David Cunado | 18f2efd | 2017-04-13 22:38:29 +0100 | [diff] [blame] | 75 | * Also, assume that the previous bootloader has already initialised the |
| 76 | * SCTLR, including the CPU endianness, and has initialised the memory. |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 77 | * --------------------------------------------------------------------- |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 78 | */ |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 79 | el3_entrypoint_common \ |
David Cunado | 18f2efd | 2017-04-13 22:38:29 +0100 | [diff] [blame] | 80 | _init_sctlr=0 \ |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 81 | _warm_boot_mailbox=0 \ |
| 82 | _secondary_cold_boot=0 \ |
| 83 | _init_memory=0 \ |
| 84 | _init_c_runtime=1 \ |
| 85 | _exception_vectors=sp_min_vector_table |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 86 | |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 87 | /* --------------------------------------------------------------------- |
| 88 | * Relay the previous bootloader's arguments to the platform layer |
| 89 | * --------------------------------------------------------------------- |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 90 | */ |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 91 | mov r0, r11 |
| 92 | mov r1, r12 |
| 93 | #else |
| 94 | /* --------------------------------------------------------------------- |
| 95 | * For RESET_TO_SP_MIN systems which have a programmable reset address, |
| 96 | * sp_min_entrypoint() is executed only on the cold boot path so we can |
| 97 | * skip the warm boot mailbox mechanism. |
| 98 | * --------------------------------------------------------------------- |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 99 | */ |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 100 | el3_entrypoint_common \ |
David Cunado | 18f2efd | 2017-04-13 22:38:29 +0100 | [diff] [blame] | 101 | _init_sctlr=1 \ |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 102 | _warm_boot_mailbox=!PROGRAMMABLE_RESET_ADDRESS \ |
| 103 | _secondary_cold_boot=!COLD_BOOT_SINGLE_CPU \ |
| 104 | _init_memory=1 \ |
| 105 | _init_c_runtime=1 \ |
| 106 | _exception_vectors=sp_min_vector_table |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 107 | |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 108 | /* --------------------------------------------------------------------- |
| 109 | * For RESET_TO_SP_MIN systems, BL32 (SP_MIN) is the first bootloader |
| 110 | * to run so there's no argument to relay from a previous bootloader. |
| 111 | * Zero the arguments passed to the platform layer to reflect that. |
| 112 | * --------------------------------------------------------------------- |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 113 | */ |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 114 | mov r0, #0 |
| 115 | mov r1, #0 |
| 116 | #endif /* RESET_TO_SP_MIN */ |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 117 | |
Etienne Carriere | 7181609 | 2017-08-09 15:48:53 +0200 | [diff] [blame] | 118 | #if SP_MIN_WITH_SECURE_FIQ |
| 119 | route_fiq_to_sp_min r4 |
| 120 | #endif |
| 121 | |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 122 | bl sp_min_early_platform_setup |
| 123 | bl sp_min_plat_arch_setup |
| 124 | |
| 125 | /* Jump to the main function */ |
| 126 | bl sp_min_main |
| 127 | |
| 128 | /* ------------------------------------------------------------- |
| 129 | * Clean the .data & .bss sections to main memory. This ensures |
| 130 | * that any global data which was initialised by the primary CPU |
| 131 | * is visible to secondary CPUs before they enable their data |
| 132 | * caches and participate in coherency. |
| 133 | * ------------------------------------------------------------- |
| 134 | */ |
| 135 | ldr r0, =__DATA_START__ |
| 136 | ldr r1, =__DATA_END__ |
| 137 | sub r1, r1, r0 |
| 138 | bl clean_dcache_range |
| 139 | |
| 140 | ldr r0, =__BSS_START__ |
| 141 | ldr r1, =__BSS_END__ |
| 142 | sub r1, r1, r0 |
| 143 | bl clean_dcache_range |
| 144 | |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 145 | bl smc_get_next_ctx |
Soby Mathew | b6285d6 | 2017-03-30 14:42:54 +0100 | [diff] [blame] | 146 | |
| 147 | /* r0 points to `smc_ctx_t` */ |
| 148 | /* The PSCI cpu_context registers have been copied to `smc_ctx_t` */ |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 149 | b sp_min_exit |
| 150 | endfunc sp_min_entrypoint |
| 151 | |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 152 | |
| 153 | /* |
| 154 | * SMC handling function for SP_MIN. |
| 155 | */ |
Dimitris Papastamos | 7343505 | 2018-01-02 11:37:02 +0000 | [diff] [blame^] | 156 | func sp_min_handle_smc |
Soby Mathew | b6285d6 | 2017-03-30 14:42:54 +0100 | [diff] [blame] | 157 | /* On SMC entry, `sp` points to `smc_ctx_t`. Save `lr`. */ |
| 158 | str lr, [sp, #SMC_CTX_LR_MON] |
| 159 | |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 160 | smcc_save_gp_mode_regs |
| 161 | |
Etienne Carriere | 7089627 | 2017-11-08 13:49:12 +0100 | [diff] [blame] | 162 | clrex_on_monitor_entry |
| 163 | |
Soby Mathew | 9f3ee61 | 2016-12-06 12:10:51 +0000 | [diff] [blame] | 164 | /* |
Soby Mathew | b6285d6 | 2017-03-30 14:42:54 +0100 | [diff] [blame] | 165 | * `sp` still points to `smc_ctx_t`. Save it to a register |
| 166 | * and restore the C runtime stack pointer to `sp`. |
Soby Mathew | 9f3ee61 | 2016-12-06 12:10:51 +0000 | [diff] [blame] | 167 | */ |
Soby Mathew | b6285d6 | 2017-03-30 14:42:54 +0100 | [diff] [blame] | 168 | mov r2, sp /* handle */ |
| 169 | ldr sp, [r2, #SMC_CTX_SP_MON] |
| 170 | |
| 171 | ldr r0, [r2, #SMC_CTX_SCR] |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 172 | and r3, r0, #SCR_NS_BIT /* flags */ |
| 173 | |
| 174 | /* Switch to Secure Mode*/ |
| 175 | bic r0, #SCR_NS_BIT |
| 176 | stcopr r0, SCR |
| 177 | isb |
Soby Mathew | b6285d6 | 2017-03-30 14:42:54 +0100 | [diff] [blame] | 178 | |
David Cunado | 3e61b2b | 2017-10-02 17:41:39 +0100 | [diff] [blame] | 179 | /* |
| 180 | * Set PMCR.DP to 1 to prohibit cycle counting whilst in Secure Mode. |
| 181 | * Also, the PMCR.LC field has an architecturally UNKNOWN value on reset |
| 182 | * and so set to 1 as ARM has deprecated use of PMCR.LC=0. |
| 183 | */ |
| 184 | ldcopr r0, PMCR |
| 185 | orr r0, r0, #(PMCR_LC_BIT | PMCR_DP_BIT) |
| 186 | stcopr r0, PMCR |
| 187 | |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 188 | ldr r0, [r2, #SMC_CTX_GPREG_R0] /* smc_fid */ |
| 189 | /* Check whether an SMC64 is issued */ |
| 190 | tst r0, #(FUNCID_CC_MASK << FUNCID_CC_SHIFT) |
Soby Mathew | b6285d6 | 2017-03-30 14:42:54 +0100 | [diff] [blame] | 191 | beq 1f |
| 192 | /* SMC32 is not detected. Return error back to caller */ |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 193 | mov r0, #SMC_UNK |
| 194 | str r0, [r2, #SMC_CTX_GPREG_R0] |
| 195 | mov r0, r2 |
Soby Mathew | b6285d6 | 2017-03-30 14:42:54 +0100 | [diff] [blame] | 196 | b sp_min_exit |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 197 | 1: |
Soby Mathew | b6285d6 | 2017-03-30 14:42:54 +0100 | [diff] [blame] | 198 | /* SMC32 is detected */ |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 199 | mov r1, #0 /* cookie */ |
| 200 | bl handle_runtime_svc |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 201 | |
Soby Mathew | b6285d6 | 2017-03-30 14:42:54 +0100 | [diff] [blame] | 202 | /* `r0` points to `smc_ctx_t` */ |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 203 | b sp_min_exit |
Dimitris Papastamos | 7343505 | 2018-01-02 11:37:02 +0000 | [diff] [blame^] | 204 | endfunc sp_min_handle_smc |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 205 | |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 206 | /* |
Etienne Carriere | 7181609 | 2017-08-09 15:48:53 +0200 | [diff] [blame] | 207 | * Secure Interrupts handling function for SP_MIN. |
| 208 | */ |
Dimitris Papastamos | 7343505 | 2018-01-02 11:37:02 +0000 | [diff] [blame^] | 209 | func sp_min_handle_fiq |
Etienne Carriere | 7181609 | 2017-08-09 15:48:53 +0200 | [diff] [blame] | 210 | #if !SP_MIN_WITH_SECURE_FIQ |
| 211 | b plat_panic_handler |
| 212 | #else |
| 213 | /* FIQ has a +4 offset for lr compared to preferred return address */ |
| 214 | sub lr, lr, #4 |
| 215 | /* On SMC entry, `sp` points to `smc_ctx_t`. Save `lr`. */ |
| 216 | str lr, [sp, #SMC_CTX_LR_MON] |
| 217 | |
| 218 | smcc_save_gp_mode_regs |
| 219 | |
Etienne Carriere | 7089627 | 2017-11-08 13:49:12 +0100 | [diff] [blame] | 220 | clrex_on_monitor_entry |
Etienne Carriere | 7181609 | 2017-08-09 15:48:53 +0200 | [diff] [blame] | 221 | |
| 222 | /* load run-time stack */ |
| 223 | mov r2, sp |
| 224 | ldr sp, [r2, #SMC_CTX_SP_MON] |
| 225 | |
| 226 | /* Switch to Secure Mode */ |
| 227 | ldr r0, [r2, #SMC_CTX_SCR] |
| 228 | bic r0, #SCR_NS_BIT |
| 229 | stcopr r0, SCR |
| 230 | isb |
| 231 | |
David Cunado | 3e61b2b | 2017-10-02 17:41:39 +0100 | [diff] [blame] | 232 | /* |
| 233 | * Set PMCR.DP to 1 to prohibit cycle counting whilst in Secure Mode. |
| 234 | * Also, the PMCR.LC field has an architecturally UNKNOWN value on reset |
| 235 | * and so set to 1 as ARM has deprecated use of PMCR.LC=0. |
| 236 | */ |
| 237 | ldcopr r0, PMCR |
| 238 | orr r0, r0, #(PMCR_LC_BIT | PMCR_DP_BIT) |
| 239 | stcopr r0, PMCR |
| 240 | |
Etienne Carriere | 7181609 | 2017-08-09 15:48:53 +0200 | [diff] [blame] | 241 | push {r2, r3} |
| 242 | bl sp_min_fiq |
| 243 | pop {r0, r3} |
| 244 | |
| 245 | b sp_min_exit |
| 246 | #endif |
Dimitris Papastamos | 7343505 | 2018-01-02 11:37:02 +0000 | [diff] [blame^] | 247 | endfunc sp_min_handle_fiq |
Etienne Carriere | 7181609 | 2017-08-09 15:48:53 +0200 | [diff] [blame] | 248 | |
| 249 | /* |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 250 | * The Warm boot entrypoint for SP_MIN. |
| 251 | */ |
| 252 | func sp_min_warm_entrypoint |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 253 | /* |
| 254 | * On the warm boot path, most of the EL3 initialisations performed by |
| 255 | * 'el3_entrypoint_common' must be skipped: |
| 256 | * |
| 257 | * - Only when the platform bypasses the BL1/BL32 (SP_MIN) entrypoint by |
David Cunado | 18f2efd | 2017-04-13 22:38:29 +0100 | [diff] [blame] | 258 | * programming the reset address do we need to initialied the SCTLR. |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 259 | * In other cases, we assume this has been taken care by the |
| 260 | * entrypoint code. |
| 261 | * |
| 262 | * - No need to determine the type of boot, we know it is a warm boot. |
| 263 | * |
| 264 | * - Do not try to distinguish between primary and secondary CPUs, this |
| 265 | * notion only exists for a cold boot. |
| 266 | * |
| 267 | * - No need to initialise the memory or the C runtime environment, |
| 268 | * it has been done once and for all on the cold boot path. |
| 269 | */ |
| 270 | el3_entrypoint_common \ |
David Cunado | 18f2efd | 2017-04-13 22:38:29 +0100 | [diff] [blame] | 271 | _init_sctlr=PROGRAMMABLE_RESET_ADDRESS \ |
Yatharth Kochar | 3bdf0e5 | 2016-06-30 15:02:31 +0100 | [diff] [blame] | 272 | _warm_boot_mailbox=0 \ |
| 273 | _secondary_cold_boot=0 \ |
| 274 | _init_memory=0 \ |
| 275 | _init_c_runtime=0 \ |
| 276 | _exception_vectors=sp_min_vector_table |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 277 | |
Jeenu Viswambharan | 25a93f7 | 2017-01-05 10:37:21 +0000 | [diff] [blame] | 278 | /* |
| 279 | * We're about to enable MMU and participate in PSCI state coordination. |
| 280 | * |
| 281 | * The PSCI implementation invokes platform routines that enable CPUs to |
| 282 | * participate in coherency. On a system where CPUs are not |
Soby Mathew | bcc3c49 | 2017-04-10 22:35:42 +0100 | [diff] [blame] | 283 | * cache-coherent without appropriate platform specific programming, |
| 284 | * having caches enabled until such time might lead to coherency issues |
| 285 | * (resulting from stale data getting speculatively fetched, among |
| 286 | * others). Therefore we keep data caches disabled even after enabling |
| 287 | * the MMU for such platforms. |
Jeenu Viswambharan | 25a93f7 | 2017-01-05 10:37:21 +0000 | [diff] [blame] | 288 | * |
Soby Mathew | bcc3c49 | 2017-04-10 22:35:42 +0100 | [diff] [blame] | 289 | * On systems with hardware-assisted coherency, or on single cluster |
| 290 | * platforms, such platform specific programming is not required to |
| 291 | * enter coherency (as CPUs already are); and there's no reason to have |
| 292 | * caches disabled either. |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 293 | */ |
| 294 | mov r0, #DISABLE_DCACHE |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 295 | bl bl32_plat_enable_mmu |
| 296 | |
Etienne Carriere | 7181609 | 2017-08-09 15:48:53 +0200 | [diff] [blame] | 297 | #if SP_MIN_WITH_SECURE_FIQ |
| 298 | route_fiq_to_sp_min r0 |
| 299 | #endif |
| 300 | |
Soby Mathew | bcc3c49 | 2017-04-10 22:35:42 +0100 | [diff] [blame] | 301 | #if HW_ASSISTED_COHERENCY || WARMBOOT_ENABLE_DCACHE_EARLY |
| 302 | ldcopr r0, SCTLR |
| 303 | orr r0, r0, #SCTLR_C_BIT |
| 304 | stcopr r0, SCTLR |
| 305 | isb |
| 306 | #endif |
| 307 | |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 308 | bl sp_min_warm_boot |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 309 | bl smc_get_next_ctx |
Soby Mathew | b6285d6 | 2017-03-30 14:42:54 +0100 | [diff] [blame] | 310 | /* r0 points to `smc_ctx_t` */ |
| 311 | /* The PSCI cpu_context registers have been copied to `smc_ctx_t` */ |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 312 | b sp_min_exit |
| 313 | endfunc sp_min_warm_entrypoint |
| 314 | |
| 315 | /* |
| 316 | * The function to restore the registers from SMC context and return |
| 317 | * to the mode restored to SPSR. |
| 318 | * |
| 319 | * Arguments : r0 must point to the SMC context to restore from. |
| 320 | */ |
| 321 | func sp_min_exit |
Soby Mathew | b6285d6 | 2017-03-30 14:42:54 +0100 | [diff] [blame] | 322 | monitor_exit |
Soby Mathew | c11ba85 | 2016-05-05 14:32:05 +0100 | [diff] [blame] | 323 | endfunc sp_min_exit |