1c11ba852SSoby Mathew/* 2c3e8b0beSAlexei Fedorov * Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved. 3c11ba852SSoby Mathew * 482cb2c1aSdp-arm * SPDX-License-Identifier: BSD-3-Clause 5c11ba852SSoby Mathew */ 6c11ba852SSoby Mathew 7c11ba852SSoby Mathew#include <arch.h> 8c11ba852SSoby Mathew#include <asm_macros.S> 909d40e0eSAntonio Nino Diaz#include <common/bl_common.h> 1009d40e0eSAntonio Nino Diaz#include <common/runtime_svc.h> 11c11ba852SSoby Mathew#include <context.h> 123bdf0e5dSYatharth Kochar#include <el3_common_macros.S> 13*0531ada5SBence Szépkúti#include <lib/el3_runtime/cpu_data.h> 14*0531ada5SBence Szépkúti#include <lib/pmf/aarch32/pmf_asm_macros.S> 15*0531ada5SBence Szépkúti#include <lib/runtime_instr.h> 1609d40e0eSAntonio Nino Diaz#include <lib/xlat_tables/xlat_tables_defs.h> 17085e80ecSAntonio Nino Diaz#include <smccc_helpers.h> 18085e80ecSAntonio Nino Diaz#include <smccc_macros.S> 19c11ba852SSoby Mathew 20c11ba852SSoby Mathew .globl sp_min_vector_table 21c11ba852SSoby Mathew .globl sp_min_entrypoint 22c11ba852SSoby Mathew .globl sp_min_warm_entrypoint 237343505dSDimitris Papastamos .globl sp_min_handle_smc 247343505dSDimitris Papastamos .globl sp_min_handle_fiq 25c11ba852SSoby Mathew 2671816096SEtienne Carriere .macro route_fiq_to_sp_min reg 2771816096SEtienne Carriere /* ----------------------------------------------------- 2871816096SEtienne Carriere * FIQs are secure interrupts trapped by Monitor and non 2971816096SEtienne Carriere * secure is not allowed to mask the FIQs. 3071816096SEtienne Carriere * ----------------------------------------------------- 3171816096SEtienne Carriere */ 3271816096SEtienne Carriere ldcopr \reg, SCR 3371816096SEtienne Carriere orr \reg, \reg, #SCR_FIQ_BIT 3471816096SEtienne Carriere bic \reg, \reg, #SCR_FW_BIT 3571816096SEtienne Carriere stcopr \reg, SCR 3671816096SEtienne Carriere .endm 373bdf0e5dSYatharth Kochar 3870896274SEtienne Carriere .macro clrex_on_monitor_entry 3970896274SEtienne Carriere#if (ARM_ARCH_MAJOR == 7) 4070896274SEtienne Carriere /* 4170896274SEtienne Carriere * ARMv7 architectures need to clear the exclusive access when 4270896274SEtienne Carriere * entering Monitor mode. 4370896274SEtienne Carriere */ 4470896274SEtienne Carriere clrex 4570896274SEtienne Carriere#endif 4670896274SEtienne Carriere .endm 4770896274SEtienne Carriere 483bdf0e5dSYatharth Kocharvector_base sp_min_vector_table 49c11ba852SSoby Mathew b sp_min_entrypoint 50c11ba852SSoby Mathew b plat_panic_handler /* Undef */ 517343505dSDimitris Papastamos b sp_min_handle_smc /* Syscall */ 52c11ba852SSoby Mathew b plat_panic_handler /* Prefetch abort */ 53c11ba852SSoby Mathew b plat_panic_handler /* Data abort */ 54c11ba852SSoby Mathew b plat_panic_handler /* Reserved */ 55c11ba852SSoby Mathew b plat_panic_handler /* IRQ */ 567343505dSDimitris Papastamos b sp_min_handle_fiq /* FIQ */ 57c11ba852SSoby Mathew 58c11ba852SSoby Mathew 59c11ba852SSoby Mathew/* 60c11ba852SSoby Mathew * The Cold boot/Reset entrypoint for SP_MIN 61c11ba852SSoby Mathew */ 62c11ba852SSoby Mathewfunc sp_min_entrypoint 633bdf0e5dSYatharth Kochar#if !RESET_TO_SP_MIN 643bdf0e5dSYatharth Kochar /* --------------------------------------------------------------- 653bdf0e5dSYatharth Kochar * Preceding bootloader has populated r0 with a pointer to a 663bdf0e5dSYatharth Kochar * 'bl_params_t' structure & r1 with a pointer to platform 673bdf0e5dSYatharth Kochar * specific structure 683bdf0e5dSYatharth Kochar * --------------------------------------------------------------- 69c11ba852SSoby Mathew */ 70a6f340feSSoby Mathew mov r9, r0 71a6f340feSSoby Mathew mov r10, r1 72a6f340feSSoby Mathew mov r11, r2 73a6f340feSSoby Mathew mov r12, r3 74c11ba852SSoby Mathew 753bdf0e5dSYatharth Kochar /* --------------------------------------------------------------------- 763bdf0e5dSYatharth Kochar * For !RESET_TO_SP_MIN systems, only the primary CPU ever reaches 773bdf0e5dSYatharth Kochar * sp_min_entrypoint() during the cold boot flow, so the cold/warm boot 783bdf0e5dSYatharth Kochar * and primary/secondary CPU logic should not be executed in this case. 793bdf0e5dSYatharth Kochar * 8018f2efd6SDavid Cunado * Also, assume that the previous bootloader has already initialised the 8118f2efd6SDavid Cunado * SCTLR, including the CPU endianness, and has initialised the memory. 823bdf0e5dSYatharth Kochar * --------------------------------------------------------------------- 83c11ba852SSoby Mathew */ 843bdf0e5dSYatharth Kochar el3_entrypoint_common \ 8518f2efd6SDavid Cunado _init_sctlr=0 \ 863bdf0e5dSYatharth Kochar _warm_boot_mailbox=0 \ 873bdf0e5dSYatharth Kochar _secondary_cold_boot=0 \ 883bdf0e5dSYatharth Kochar _init_memory=0 \ 893bdf0e5dSYatharth Kochar _init_c_runtime=1 \ 903bdf0e5dSYatharth Kochar _exception_vectors=sp_min_vector_table 91c11ba852SSoby Mathew 923bdf0e5dSYatharth Kochar /* --------------------------------------------------------------------- 933bdf0e5dSYatharth Kochar * Relay the previous bootloader's arguments to the platform layer 943bdf0e5dSYatharth Kochar * --------------------------------------------------------------------- 95c11ba852SSoby Mathew */ 963bdf0e5dSYatharth Kochar#else 973bdf0e5dSYatharth Kochar /* --------------------------------------------------------------------- 983bdf0e5dSYatharth Kochar * For RESET_TO_SP_MIN systems which have a programmable reset address, 993bdf0e5dSYatharth Kochar * sp_min_entrypoint() is executed only on the cold boot path so we can 1003bdf0e5dSYatharth Kochar * skip the warm boot mailbox mechanism. 1013bdf0e5dSYatharth Kochar * --------------------------------------------------------------------- 102c11ba852SSoby Mathew */ 1033bdf0e5dSYatharth Kochar el3_entrypoint_common \ 10418f2efd6SDavid Cunado _init_sctlr=1 \ 1053bdf0e5dSYatharth Kochar _warm_boot_mailbox=!PROGRAMMABLE_RESET_ADDRESS \ 1063bdf0e5dSYatharth Kochar _secondary_cold_boot=!COLD_BOOT_SINGLE_CPU \ 1073bdf0e5dSYatharth Kochar _init_memory=1 \ 1083bdf0e5dSYatharth Kochar _init_c_runtime=1 \ 1093bdf0e5dSYatharth Kochar _exception_vectors=sp_min_vector_table 110c11ba852SSoby Mathew 1113bdf0e5dSYatharth Kochar /* --------------------------------------------------------------------- 1123bdf0e5dSYatharth Kochar * For RESET_TO_SP_MIN systems, BL32 (SP_MIN) is the first bootloader 1133bdf0e5dSYatharth Kochar * to run so there's no argument to relay from a previous bootloader. 1143bdf0e5dSYatharth Kochar * Zero the arguments passed to the platform layer to reflect that. 1153bdf0e5dSYatharth Kochar * --------------------------------------------------------------------- 116c11ba852SSoby Mathew */ 117a6f340feSSoby Mathew mov r9, #0 118a6f340feSSoby Mathew mov r10, #0 119a6f340feSSoby Mathew mov r11, #0 120a6f340feSSoby Mathew mov r12, #0 121a6f340feSSoby Mathew 1223bdf0e5dSYatharth Kochar#endif /* RESET_TO_SP_MIN */ 123c11ba852SSoby Mathew 12471816096SEtienne Carriere#if SP_MIN_WITH_SECURE_FIQ 12571816096SEtienne Carriere route_fiq_to_sp_min r4 12671816096SEtienne Carriere#endif 12771816096SEtienne Carriere 128a6f340feSSoby Mathew mov r0, r9 129a6f340feSSoby Mathew mov r1, r10 130a6f340feSSoby Mathew mov r2, r11 131a6f340feSSoby Mathew mov r3, r12 132a6f340feSSoby Mathew bl sp_min_early_platform_setup2 133c11ba852SSoby Mathew bl sp_min_plat_arch_setup 134c11ba852SSoby Mathew 135c11ba852SSoby Mathew /* Jump to the main function */ 136c11ba852SSoby Mathew bl sp_min_main 137c11ba852SSoby Mathew 138c11ba852SSoby Mathew /* ------------------------------------------------------------- 139c11ba852SSoby Mathew * Clean the .data & .bss sections to main memory. This ensures 140c11ba852SSoby Mathew * that any global data which was initialised by the primary CPU 141c11ba852SSoby Mathew * is visible to secondary CPUs before they enable their data 142c11ba852SSoby Mathew * caches and participate in coherency. 143c11ba852SSoby Mathew * ------------------------------------------------------------- 144c11ba852SSoby Mathew */ 145c11ba852SSoby Mathew ldr r0, =__DATA_START__ 146c11ba852SSoby Mathew ldr r1, =__DATA_END__ 147c11ba852SSoby Mathew sub r1, r1, r0 148c11ba852SSoby Mathew bl clean_dcache_range 149c11ba852SSoby Mathew 150c11ba852SSoby Mathew ldr r0, =__BSS_START__ 151c11ba852SSoby Mathew ldr r1, =__BSS_END__ 152c11ba852SSoby Mathew sub r1, r1, r0 153c11ba852SSoby Mathew bl clean_dcache_range 154c11ba852SSoby Mathew 155c11ba852SSoby Mathew bl smc_get_next_ctx 156b6285d64SSoby Mathew 157b6285d64SSoby Mathew /* r0 points to `smc_ctx_t` */ 158b6285d64SSoby Mathew /* The PSCI cpu_context registers have been copied to `smc_ctx_t` */ 159c11ba852SSoby Mathew b sp_min_exit 160c11ba852SSoby Mathewendfunc sp_min_entrypoint 161c11ba852SSoby Mathew 1623bdf0e5dSYatharth Kochar 1633bdf0e5dSYatharth Kochar/* 1643bdf0e5dSYatharth Kochar * SMC handling function for SP_MIN. 1653bdf0e5dSYatharth Kochar */ 1667343505dSDimitris Papastamosfunc sp_min_handle_smc 167b6285d64SSoby Mathew /* On SMC entry, `sp` points to `smc_ctx_t`. Save `lr`. */ 168b6285d64SSoby Mathew str lr, [sp, #SMC_CTX_LR_MON] 169b6285d64SSoby Mathew 170*0531ada5SBence Szépkúti#if ENABLE_RUNTIME_INSTRUMENTATION 171*0531ada5SBence Szépkúti /* 172*0531ada5SBence Szépkúti * Read the timestamp value and store it on top of the C runtime stack. 173*0531ada5SBence Szépkúti * The value will be saved to the per-cpu data once the C stack is 174*0531ada5SBence Szépkúti * available, as a valid stack is needed to call _cpu_data() 175*0531ada5SBence Szépkúti */ 176*0531ada5SBence Szépkúti strd r0, r1, [sp, #SMC_CTX_GPREG_R0] 177*0531ada5SBence Szépkúti ldcopr16 r0, r1, CNTPCT_64 178*0531ada5SBence Szépkúti ldr lr, [sp, #SMC_CTX_SP_MON] 179*0531ada5SBence Szépkúti strd r0, r1, [lr, #-8]! 180*0531ada5SBence Szépkúti str lr, [sp, #SMC_CTX_SP_MON] 181*0531ada5SBence Szépkúti ldrd r0, r1, [sp, #SMC_CTX_GPREG_R0] 182*0531ada5SBence Szépkúti#endif 183*0531ada5SBence Szépkúti 184085e80ecSAntonio Nino Diaz smccc_save_gp_mode_regs 1853bdf0e5dSYatharth Kochar 18670896274SEtienne Carriere clrex_on_monitor_entry 18770896274SEtienne Carriere 1889f3ee61cSSoby Mathew /* 189b6285d64SSoby Mathew * `sp` still points to `smc_ctx_t`. Save it to a register 190b6285d64SSoby Mathew * and restore the C runtime stack pointer to `sp`. 1919f3ee61cSSoby Mathew */ 192b6285d64SSoby Mathew mov r2, sp /* handle */ 193b6285d64SSoby Mathew ldr sp, [r2, #SMC_CTX_SP_MON] 194b6285d64SSoby Mathew 195*0531ada5SBence Szépkúti#if ENABLE_RUNTIME_INSTRUMENTATION 196*0531ada5SBence Szépkúti /* Save handle to a callee saved register */ 197*0531ada5SBence Szépkúti mov r6, r2 198*0531ada5SBence Szépkúti 199*0531ada5SBence Szépkúti /* 200*0531ada5SBence Szépkúti * Restore the timestamp value and store it in per-cpu data. The value 201*0531ada5SBence Szépkúti * will be extracted from per-cpu data by the C level SMC handler and 202*0531ada5SBence Szépkúti * saved to the PMF timestamp region. 203*0531ada5SBence Szépkúti */ 204*0531ada5SBence Szépkúti ldrd r4, r5, [sp], #8 205*0531ada5SBence Szépkúti bl _cpu_data 206*0531ada5SBence Szépkúti strd r4, r5, [r0, #CPU_DATA_PMF_TS0_OFFSET] 207*0531ada5SBence Szépkúti 208*0531ada5SBence Szépkúti /* Restore handle */ 209*0531ada5SBence Szépkúti mov r2, r6 210*0531ada5SBence Szépkúti#endif 211*0531ada5SBence Szépkúti 212b6285d64SSoby Mathew ldr r0, [r2, #SMC_CTX_SCR] 2133bdf0e5dSYatharth Kochar and r3, r0, #SCR_NS_BIT /* flags */ 2143bdf0e5dSYatharth Kochar 2153bdf0e5dSYatharth Kochar /* Switch to Secure Mode*/ 2163bdf0e5dSYatharth Kochar bic r0, #SCR_NS_BIT 2173bdf0e5dSYatharth Kochar stcopr r0, SCR 2183bdf0e5dSYatharth Kochar isb 219b6285d64SSoby Mathew 2203bdf0e5dSYatharth Kochar ldr r0, [r2, #SMC_CTX_GPREG_R0] /* smc_fid */ 2213bdf0e5dSYatharth Kochar /* Check whether an SMC64 is issued */ 2223bdf0e5dSYatharth Kochar tst r0, #(FUNCID_CC_MASK << FUNCID_CC_SHIFT) 223b6285d64SSoby Mathew beq 1f 224b6285d64SSoby Mathew /* SMC32 is not detected. Return error back to caller */ 2253bdf0e5dSYatharth Kochar mov r0, #SMC_UNK 2263bdf0e5dSYatharth Kochar str r0, [r2, #SMC_CTX_GPREG_R0] 2273bdf0e5dSYatharth Kochar mov r0, r2 228b6285d64SSoby Mathew b sp_min_exit 2293bdf0e5dSYatharth Kochar1: 230b6285d64SSoby Mathew /* SMC32 is detected */ 2313bdf0e5dSYatharth Kochar mov r1, #0 /* cookie */ 2323bdf0e5dSYatharth Kochar bl handle_runtime_svc 2333bdf0e5dSYatharth Kochar 234b6285d64SSoby Mathew /* `r0` points to `smc_ctx_t` */ 2353bdf0e5dSYatharth Kochar b sp_min_exit 2367343505dSDimitris Papastamosendfunc sp_min_handle_smc 2373bdf0e5dSYatharth Kochar 238c11ba852SSoby Mathew/* 23971816096SEtienne Carriere * Secure Interrupts handling function for SP_MIN. 24071816096SEtienne Carriere */ 2417343505dSDimitris Papastamosfunc sp_min_handle_fiq 24271816096SEtienne Carriere#if !SP_MIN_WITH_SECURE_FIQ 24371816096SEtienne Carriere b plat_panic_handler 24471816096SEtienne Carriere#else 24571816096SEtienne Carriere /* FIQ has a +4 offset for lr compared to preferred return address */ 24671816096SEtienne Carriere sub lr, lr, #4 24771816096SEtienne Carriere /* On SMC entry, `sp` points to `smc_ctx_t`. Save `lr`. */ 24871816096SEtienne Carriere str lr, [sp, #SMC_CTX_LR_MON] 24971816096SEtienne Carriere 250085e80ecSAntonio Nino Diaz smccc_save_gp_mode_regs 25171816096SEtienne Carriere 25270896274SEtienne Carriere clrex_on_monitor_entry 25371816096SEtienne Carriere 25471816096SEtienne Carriere /* load run-time stack */ 25571816096SEtienne Carriere mov r2, sp 25671816096SEtienne Carriere ldr sp, [r2, #SMC_CTX_SP_MON] 25771816096SEtienne Carriere 25871816096SEtienne Carriere /* Switch to Secure Mode */ 25971816096SEtienne Carriere ldr r0, [r2, #SMC_CTX_SCR] 26071816096SEtienne Carriere bic r0, #SCR_NS_BIT 26171816096SEtienne Carriere stcopr r0, SCR 26271816096SEtienne Carriere isb 26371816096SEtienne Carriere 26471816096SEtienne Carriere push {r2, r3} 26571816096SEtienne Carriere bl sp_min_fiq 26671816096SEtienne Carriere pop {r0, r3} 26771816096SEtienne Carriere 26871816096SEtienne Carriere b sp_min_exit 26971816096SEtienne Carriere#endif 2707343505dSDimitris Papastamosendfunc sp_min_handle_fiq 27171816096SEtienne Carriere 27271816096SEtienne Carriere/* 273c11ba852SSoby Mathew * The Warm boot entrypoint for SP_MIN. 274c11ba852SSoby Mathew */ 275c11ba852SSoby Mathewfunc sp_min_warm_entrypoint 276*0531ada5SBence Szépkúti#if ENABLE_RUNTIME_INSTRUMENTATION 277*0531ada5SBence Szépkúti /* 278*0531ada5SBence Szépkúti * This timestamp update happens with cache off. The next 279*0531ada5SBence Szépkúti * timestamp collection will need to do cache maintenance prior 280*0531ada5SBence Szépkúti * to timestamp update. 281*0531ada5SBence Szépkúti */ 282*0531ada5SBence Szépkúti pmf_calc_timestamp_addr rt_instr_svc, RT_INSTR_EXIT_HW_LOW_PWR 283*0531ada5SBence Szépkúti ldcopr16 r2, r3, CNTPCT_64 284*0531ada5SBence Szépkúti strd r2, r3, [r0] 285*0531ada5SBence Szépkúti#endif 2863bdf0e5dSYatharth Kochar /* 2873bdf0e5dSYatharth Kochar * On the warm boot path, most of the EL3 initialisations performed by 2883bdf0e5dSYatharth Kochar * 'el3_entrypoint_common' must be skipped: 2893bdf0e5dSYatharth Kochar * 2903bdf0e5dSYatharth Kochar * - Only when the platform bypasses the BL1/BL32 (SP_MIN) entrypoint by 29118f2efd6SDavid Cunado * programming the reset address do we need to initialied the SCTLR. 2923bdf0e5dSYatharth Kochar * In other cases, we assume this has been taken care by the 2933bdf0e5dSYatharth Kochar * entrypoint code. 2943bdf0e5dSYatharth Kochar * 2953bdf0e5dSYatharth Kochar * - No need to determine the type of boot, we know it is a warm boot. 2963bdf0e5dSYatharth Kochar * 2973bdf0e5dSYatharth Kochar * - Do not try to distinguish between primary and secondary CPUs, this 2983bdf0e5dSYatharth Kochar * notion only exists for a cold boot. 2993bdf0e5dSYatharth Kochar * 3003bdf0e5dSYatharth Kochar * - No need to initialise the memory or the C runtime environment, 3013bdf0e5dSYatharth Kochar * it has been done once and for all on the cold boot path. 3023bdf0e5dSYatharth Kochar */ 3033bdf0e5dSYatharth Kochar el3_entrypoint_common \ 30418f2efd6SDavid Cunado _init_sctlr=PROGRAMMABLE_RESET_ADDRESS \ 3053bdf0e5dSYatharth Kochar _warm_boot_mailbox=0 \ 3063bdf0e5dSYatharth Kochar _secondary_cold_boot=0 \ 3073bdf0e5dSYatharth Kochar _init_memory=0 \ 3083bdf0e5dSYatharth Kochar _init_c_runtime=0 \ 3093bdf0e5dSYatharth Kochar _exception_vectors=sp_min_vector_table 310c11ba852SSoby Mathew 31125a93f7cSJeenu Viswambharan /* 31225a93f7cSJeenu Viswambharan * We're about to enable MMU and participate in PSCI state coordination. 31325a93f7cSJeenu Viswambharan * 31425a93f7cSJeenu Viswambharan * The PSCI implementation invokes platform routines that enable CPUs to 31525a93f7cSJeenu Viswambharan * participate in coherency. On a system where CPUs are not 316bcc3c49cSSoby Mathew * cache-coherent without appropriate platform specific programming, 317bcc3c49cSSoby Mathew * having caches enabled until such time might lead to coherency issues 318bcc3c49cSSoby Mathew * (resulting from stale data getting speculatively fetched, among 319bcc3c49cSSoby Mathew * others). Therefore we keep data caches disabled even after enabling 320bcc3c49cSSoby Mathew * the MMU for such platforms. 32125a93f7cSJeenu Viswambharan * 322bcc3c49cSSoby Mathew * On systems with hardware-assisted coherency, or on single cluster 323bcc3c49cSSoby Mathew * platforms, such platform specific programming is not required to 324bcc3c49cSSoby Mathew * enter coherency (as CPUs already are); and there's no reason to have 325bcc3c49cSSoby Mathew * caches disabled either. 326c11ba852SSoby Mathew */ 32764ee263eSJeenu Viswambharan#if HW_ASSISTED_COHERENCY || WARMBOOT_ENABLE_DCACHE_EARLY 32864ee263eSJeenu Viswambharan mov r0, #0 32964ee263eSJeenu Viswambharan#else 330c11ba852SSoby Mathew mov r0, #DISABLE_DCACHE 33164ee263eSJeenu Viswambharan#endif 332c11ba852SSoby Mathew bl bl32_plat_enable_mmu 333c11ba852SSoby Mathew 33471816096SEtienne Carriere#if SP_MIN_WITH_SECURE_FIQ 33571816096SEtienne Carriere route_fiq_to_sp_min r0 33671816096SEtienne Carriere#endif 33771816096SEtienne Carriere 338c11ba852SSoby Mathew bl sp_min_warm_boot 339c11ba852SSoby Mathew bl smc_get_next_ctx 340b6285d64SSoby Mathew /* r0 points to `smc_ctx_t` */ 341b6285d64SSoby Mathew /* The PSCI cpu_context registers have been copied to `smc_ctx_t` */ 342*0531ada5SBence Szépkúti 343*0531ada5SBence Szépkúti#if ENABLE_RUNTIME_INSTRUMENTATION 344*0531ada5SBence Szépkúti /* Save smc_ctx_t */ 345*0531ada5SBence Szépkúti mov r5, r0 346*0531ada5SBence Szépkúti 347*0531ada5SBence Szépkúti pmf_calc_timestamp_addr rt_instr_svc, RT_INSTR_EXIT_PSCI 348*0531ada5SBence Szépkúti mov r4, r0 349*0531ada5SBence Szépkúti 350*0531ada5SBence Szépkúti /* 351*0531ada5SBence Szépkúti * Invalidate before updating timestamp to ensure previous timestamp 352*0531ada5SBence Szépkúti * updates on the same cache line with caches disabled are properly 353*0531ada5SBence Szépkúti * seen by the same core. Without the cache invalidate, the core might 354*0531ada5SBence Szépkúti * write into a stale cache line. 355*0531ada5SBence Szépkúti */ 356*0531ada5SBence Szépkúti mov r1, #PMF_TS_SIZE 357*0531ada5SBence Szépkúti bl inv_dcache_range 358*0531ada5SBence Szépkúti 359*0531ada5SBence Szépkúti ldcopr16 r0, r1, CNTPCT_64 360*0531ada5SBence Szépkúti strd r0, r1, [r4] 361*0531ada5SBence Szépkúti 362*0531ada5SBence Szépkúti /* Restore smc_ctx_t */ 363*0531ada5SBence Szépkúti mov r0, r5 364*0531ada5SBence Szépkúti#endif 365*0531ada5SBence Szépkúti 366c11ba852SSoby Mathew b sp_min_exit 367c11ba852SSoby Mathewendfunc sp_min_warm_entrypoint 368c11ba852SSoby Mathew 369c11ba852SSoby Mathew/* 370c11ba852SSoby Mathew * The function to restore the registers from SMC context and return 371c11ba852SSoby Mathew * to the mode restored to SPSR. 372c11ba852SSoby Mathew * 373c11ba852SSoby Mathew * Arguments : r0 must point to the SMC context to restore from. 374c11ba852SSoby Mathew */ 375c11ba852SSoby Mathewfunc sp_min_exit 376b6285d64SSoby Mathew monitor_exit 377c11ba852SSoby Mathewendfunc sp_min_exit 378