1532ed618SSoby Mathew /* 2ef738d19SManish Pandey * Copyright (c) 2013-2025, Arm Limited and Contributors. All rights reserved. 3532ed618SSoby Mathew * 482cb2c1aSdp-arm * SPDX-License-Identifier: BSD-3-Clause 5532ed618SSoby Mathew */ 6532ed618SSoby Mathew 709d40e0eSAntonio Nino Diaz #include <assert.h> 809d40e0eSAntonio Nino Diaz #include <stddef.h> 909d40e0eSAntonio Nino Diaz 10532ed618SSoby Mathew #include <arch.h> 11532ed618SSoby Mathew #include <arch_helpers.h> 1209d40e0eSAntonio Nino Diaz #include <common/bl_common.h> 13532ed618SSoby Mathew #include <context.h> 146bb96fa6SBoyan Karatotev #include <lib/cpus/errata.h> 1509d40e0eSAntonio Nino Diaz #include <lib/el3_runtime/context_mgmt.h> 169f407e44SRohit Mathew #include <lib/per_cpu/per_cpu.h> 1709d40e0eSAntonio Nino Diaz #include <plat/common/platform.h> 1809d40e0eSAntonio Nino Diaz 19532ed618SSoby Mathew #include "psci_private.h" 20532ed618SSoby Mathew 21a86865acSGraeme Gregory /* 22a86865acSGraeme Gregory * Check that PLATFORM_CORE_COUNT fits into the number of cores 23a86865acSGraeme Gregory * that can be represented by PSCI_MAX_CPUS_INDEX. 24a86865acSGraeme Gregory */ 25a86865acSGraeme Gregory CASSERT(PLATFORM_CORE_COUNT <= (PSCI_MAX_CPUS_INDEX + 1U), assert_psci_cores_overflow); 26a86865acSGraeme Gregory 27532ed618SSoby Mathew /******************************************************************************* 28532ed618SSoby Mathew * Per cpu non-secure contexts used to program the architectural state prior 29532ed618SSoby Mathew * return to the normal world. 30532ed618SSoby Mathew * TODO: Use the memory allocator to set aside memory for the contexts instead 31532ed618SSoby Mathew * of relying on platform defined constants. 32532ed618SSoby Mathew ******************************************************************************/ 33*6d2d846fSSammit Joshi static PER_CPU_DEFINE(cpu_context_t, psci_ns_context); 34ef738d19SManish Pandey static entry_point_info_t warmboot_ep_info[PLATFORM_CORE_COUNT]; 35532ed618SSoby Mathew 36532ed618SSoby Mathew /****************************************************************************** 37532ed618SSoby Mathew * Define the psci capability variable. 38532ed618SSoby Mathew *****************************************************************************/ 39532ed618SSoby Mathew unsigned int psci_caps; 40532ed618SSoby Mathew 41532ed618SSoby Mathew /******************************************************************************* 42532ed618SSoby Mathew * Function which initializes the 'psci_non_cpu_pd_nodes' or the 43532ed618SSoby Mathew * 'psci_cpu_pd_nodes' corresponding to the power level. 44532ed618SSoby Mathew ******************************************************************************/ 45a86865acSGraeme Gregory static void __init psci_init_pwr_domain_node(uint16_t node_idx, 46532ed618SSoby Mathew unsigned int parent_idx, 476b7b0f36SAntonio Nino Diaz unsigned char level) 48532ed618SSoby Mathew { 49532ed618SSoby Mathew if (level > PSCI_CPU_PWR_LVL) { 50a86865acSGraeme Gregory assert(node_idx < PSCI_NUM_NON_CPU_PWR_DOMAINS); 51a86865acSGraeme Gregory 52532ed618SSoby Mathew psci_non_cpu_pd_nodes[node_idx].level = level; 53532ed618SSoby Mathew psci_lock_init(psci_non_cpu_pd_nodes, node_idx); 54532ed618SSoby Mathew psci_non_cpu_pd_nodes[node_idx].parent_node = parent_idx; 55532ed618SSoby Mathew psci_non_cpu_pd_nodes[node_idx].local_state = 56532ed618SSoby Mathew PLAT_MAX_OFF_STATE; 57532ed618SSoby Mathew } else { 58532ed618SSoby Mathew psci_cpu_data_t *svc_cpu_data; 59532ed618SSoby Mathew 60a86865acSGraeme Gregory assert(node_idx < PLATFORM_CORE_COUNT); 61a86865acSGraeme Gregory 629f407e44SRohit Mathew PER_CPU_BY_INDEX(psci_cpu_pd_nodes, node_idx)->parent_node = parent_idx; 63532ed618SSoby Mathew 64532ed618SSoby Mathew /* Initialize with an invalid mpidr */ 659f407e44SRohit Mathew PER_CPU_BY_INDEX(psci_cpu_pd_nodes, node_idx)->mpidr = PSCI_INVALID_MPIDR; 66532ed618SSoby Mathew 67d43b2ea6SBoyan Karatotev svc_cpu_data = &get_cpu_data_by_index(node_idx, psci_svc_cpu_data); 68532ed618SSoby Mathew 69532ed618SSoby Mathew /* Set the Affinity Info for the cores as OFF */ 70532ed618SSoby Mathew svc_cpu_data->aff_info_state = AFF_STATE_OFF; 71532ed618SSoby Mathew 720c836554SBoyan Karatotev /* Default to the highest power level when the cpu is not suspending */ 730c836554SBoyan Karatotev svc_cpu_data->target_pwrlvl = PLAT_MAX_PWR_LVL; 74532ed618SSoby Mathew 75532ed618SSoby Mathew /* Set the power state to OFF state */ 76532ed618SSoby Mathew svc_cpu_data->local_state = PLAT_MAX_OFF_STATE; 77532ed618SSoby Mathew 78a10d3632SJeenu Viswambharan psci_flush_dcache_range((uintptr_t)svc_cpu_data, 79532ed618SSoby Mathew sizeof(*svc_cpu_data)); 80532ed618SSoby Mathew 81532ed618SSoby Mathew cm_set_context_by_index(node_idx, 82*6d2d846fSSammit Joshi (void *) PER_CPU_BY_INDEX(psci_ns_context, 83*6d2d846fSSammit Joshi node_idx), 84532ed618SSoby Mathew NON_SECURE); 85532ed618SSoby Mathew } 86532ed618SSoby Mathew } 87532ed618SSoby Mathew 88532ed618SSoby Mathew /******************************************************************************* 89532ed618SSoby Mathew * This functions updates cpu_start_idx and ncpus field for each of the node in 90532ed618SSoby Mathew * psci_non_cpu_pd_nodes[]. It does so by comparing the parent nodes of each of 91532ed618SSoby Mathew * the CPUs and check whether they match with the parent of the previous 92532ed618SSoby Mathew * CPU. The basic assumption for this work is that children of the same parent 93532ed618SSoby Mathew * are allocated adjacent indices. The platform should ensure this though proper 94532ed618SSoby Mathew * mapping of the CPUs to indices via plat_core_pos_by_mpidr() and 95532ed618SSoby Mathew * plat_my_core_pos() APIs. 96532ed618SSoby Mathew *******************************************************************************/ 9787c85134SDaniel Boulby static void __init psci_update_pwrlvl_limits(void) 98532ed618SSoby Mathew { 99ab4df50cSPankaj Gupta unsigned int cpu_idx; 100ab4df50cSPankaj Gupta int j; 101532ed618SSoby Mathew unsigned int nodes_idx[PLAT_MAX_PWR_LVL] = {0}; 102df51e33bSSaivardhan Thatikonda unsigned int temp_index[PLAT_MAX_PWR_LVL] = {0}; 103532ed618SSoby Mathew 104ab4df50cSPankaj Gupta for (cpu_idx = 0; cpu_idx < psci_plat_core_count; cpu_idx++) { 105532ed618SSoby Mathew psci_get_parent_pwr_domain_nodes(cpu_idx, 1065b33ad17SDeepika Bhavnani PLAT_MAX_PWR_LVL, 107532ed618SSoby Mathew temp_index); 1086b7b0f36SAntonio Nino Diaz for (j = (int)PLAT_MAX_PWR_LVL - 1; j >= 0; j--) { 109532ed618SSoby Mathew if (temp_index[j] != nodes_idx[j]) { 110532ed618SSoby Mathew nodes_idx[j] = temp_index[j]; 111532ed618SSoby Mathew psci_non_cpu_pd_nodes[nodes_idx[j]].cpu_start_idx 112532ed618SSoby Mathew = cpu_idx; 113532ed618SSoby Mathew } 114532ed618SSoby Mathew psci_non_cpu_pd_nodes[nodes_idx[j]].ncpus++; 115532ed618SSoby Mathew } 116532ed618SSoby Mathew } 117532ed618SSoby Mathew } 118532ed618SSoby Mathew 119ef738d19SManish Pandey static void __init populate_cpu_data(void) 120ef738d19SManish Pandey { 121ef738d19SManish Pandey for (unsigned int idx = 0; idx < psci_plat_core_count; idx++) { 122ef738d19SManish Pandey set_cpu_data_by_index(idx, warmboot_ep_info, &warmboot_ep_info[idx]); 123ef738d19SManish Pandey } 124ef738d19SManish Pandey } 125ef738d19SManish Pandey 126532ed618SSoby Mathew /******************************************************************************* 127532ed618SSoby Mathew * Core routine to populate the power domain tree. The tree descriptor passed by 128532ed618SSoby Mathew * the platform is populated breadth-first and the first entry in the map 129532ed618SSoby Mathew * informs the number of root power domains. The parent nodes of the root nodes 130532ed618SSoby Mathew * will point to an invalid entry(-1). 131532ed618SSoby Mathew ******************************************************************************/ 132ab4df50cSPankaj Gupta static unsigned int __init populate_power_domain_tree(const unsigned char 133ab4df50cSPankaj Gupta *topology) 134532ed618SSoby Mathew { 1356b7b0f36SAntonio Nino Diaz unsigned int i, j = 0U, num_nodes_at_lvl = 1U, num_nodes_at_next_lvl; 1366b7b0f36SAntonio Nino Diaz unsigned int node_index = 0U, num_children; 1375b33ad17SDeepika Bhavnani unsigned int parent_node_index = 0U; 1386b7b0f36SAntonio Nino Diaz int level = (int)PLAT_MAX_PWR_LVL; 139532ed618SSoby Mathew 140532ed618SSoby Mathew /* 141532ed618SSoby Mathew * For each level the inputs are: 142532ed618SSoby Mathew * - number of nodes at this level in plat_array i.e. num_nodes_at_level 143532ed618SSoby Mathew * This is the sum of values of nodes at the parent level. 144532ed618SSoby Mathew * - Index of first entry at this level in the plat_array i.e. 145532ed618SSoby Mathew * parent_node_index. 146532ed618SSoby Mathew * - Index of first free entry in psci_non_cpu_pd_nodes[] or 147532ed618SSoby Mathew * psci_cpu_pd_nodes[] i.e. node_index depending upon the level. 148532ed618SSoby Mathew */ 1496b7b0f36SAntonio Nino Diaz while (level >= (int) PSCI_CPU_PWR_LVL) { 1506b7b0f36SAntonio Nino Diaz num_nodes_at_next_lvl = 0U; 151532ed618SSoby Mathew /* 152532ed618SSoby Mathew * For each entry (parent node) at this level in the plat_array: 153532ed618SSoby Mathew * - Find the number of children 154532ed618SSoby Mathew * - Allocate a node in a power domain array for each child 155532ed618SSoby Mathew * - Set the parent of the child to the parent_node_index - 1 156532ed618SSoby Mathew * - Increment parent_node_index to point to the next parent 157532ed618SSoby Mathew * - Accumulate the number of children at next level. 158532ed618SSoby Mathew */ 1596b7b0f36SAntonio Nino Diaz for (i = 0U; i < num_nodes_at_lvl; i++) { 160532ed618SSoby Mathew assert(parent_node_index <= 161532ed618SSoby Mathew PSCI_NUM_NON_CPU_PWR_DOMAINS); 162532ed618SSoby Mathew num_children = topology[parent_node_index]; 163532ed618SSoby Mathew 164532ed618SSoby Mathew for (j = node_index; 165bac32cc4SSaivardhan Thatikonda j < (node_index + num_children); j++) { 166a86865acSGraeme Gregory psci_init_pwr_domain_node((uint16_t)j, 1675b33ad17SDeepika Bhavnani parent_node_index - 1U, 1686b7b0f36SAntonio Nino Diaz (unsigned char)level); 169bac32cc4SSaivardhan Thatikonda } 170532ed618SSoby Mathew node_index = j; 171532ed618SSoby Mathew num_nodes_at_next_lvl += num_children; 172532ed618SSoby Mathew parent_node_index++; 173532ed618SSoby Mathew } 174532ed618SSoby Mathew 175532ed618SSoby Mathew num_nodes_at_lvl = num_nodes_at_next_lvl; 176532ed618SSoby Mathew level--; 177532ed618SSoby Mathew 178532ed618SSoby Mathew /* Reset the index for the cpu power domain array */ 179bac32cc4SSaivardhan Thatikonda if (level == (int) PSCI_CPU_PWR_LVL) { 180532ed618SSoby Mathew node_index = 0; 181532ed618SSoby Mathew } 182bac32cc4SSaivardhan Thatikonda } 183532ed618SSoby Mathew 184532ed618SSoby Mathew /* Validate the sanity of array exported by the platform */ 1855b33ad17SDeepika Bhavnani assert(j <= PLATFORM_CORE_COUNT); 186ab4df50cSPankaj Gupta return j; 187532ed618SSoby Mathew } 188532ed618SSoby Mathew 189532ed618SSoby Mathew /******************************************************************************* 190cf0b1492SSoby Mathew * This function does the architectural setup and takes the warm boot 191cf0b1492SSoby Mathew * entry-point `mailbox_ep` as an argument. The function also initializes the 192cf0b1492SSoby Mathew * power domain topology tree by querying the platform. The power domain nodes 193cf0b1492SSoby Mathew * higher than the CPU are populated in the array psci_non_cpu_pd_nodes[] and 194cf0b1492SSoby Mathew * the CPU power domains are populated in psci_cpu_pd_nodes[]. The platform 195cf0b1492SSoby Mathew * exports its static topology map through the 196532ed618SSoby Mathew * populate_power_domain_topology_tree() API. The algorithm populates the 197532ed618SSoby Mathew * psci_non_cpu_pd_nodes and psci_cpu_pd_nodes iteratively by using this 198cf0b1492SSoby Mathew * topology map. On a platform that implements two clusters of 2 cpus each, 199cf0b1492SSoby Mathew * and supporting 3 domain levels, the populated psci_non_cpu_pd_nodes would 200cf0b1492SSoby Mathew * look like this: 201532ed618SSoby Mathew * 202532ed618SSoby Mathew * --------------------------------------------------- 203532ed618SSoby Mathew * | system node | cluster 0 node | cluster 1 node | 204532ed618SSoby Mathew * --------------------------------------------------- 205532ed618SSoby Mathew * 206532ed618SSoby Mathew * And populated psci_cpu_pd_nodes would look like this : 207532ed618SSoby Mathew * <- cpus cluster0 -><- cpus cluster1 -> 208532ed618SSoby Mathew * ------------------------------------------------ 209532ed618SSoby Mathew * | CPU 0 | CPU 1 | CPU 2 | CPU 3 | 210532ed618SSoby Mathew * ------------------------------------------------ 211532ed618SSoby Mathew ******************************************************************************/ 21287c85134SDaniel Boulby int __init psci_setup(const psci_lib_args_t *lib_args) 213532ed618SSoby Mathew { 214532ed618SSoby Mathew const unsigned char *topology_tree; 2153b802105SBoyan Karatotev unsigned int cpu_idx = plat_my_core_pos(); 216532ed618SSoby Mathew 217f426fc05SSoby Mathew assert(VERIFY_PSCI_LIB_ARGS_V1(lib_args)); 218f426fc05SSoby Mathew 219cf0b1492SSoby Mathew /* Do the Architectural initialization */ 220cf0b1492SSoby Mathew psci_arch_setup(); 221cf0b1492SSoby Mathew 222532ed618SSoby Mathew /* Query the topology map from the platform */ 223532ed618SSoby Mathew topology_tree = plat_get_power_domain_tree_desc(); 224532ed618SSoby Mathew 225532ed618SSoby Mathew /* Populate the power domain arrays using the platform topology map */ 226ab4df50cSPankaj Gupta psci_plat_core_count = populate_power_domain_tree(topology_tree); 227532ed618SSoby Mathew 228532ed618SSoby Mathew /* Update the CPU limits for each node in psci_non_cpu_pd_nodes */ 229532ed618SSoby Mathew psci_update_pwrlvl_limits(); 230532ed618SSoby Mathew 231ef738d19SManish Pandey /* Initialise the warmboot entrypoints */ 232ef738d19SManish Pandey populate_cpu_data(); 233ef738d19SManish Pandey 234532ed618SSoby Mathew /* Populate the mpidr field of cpu node for this CPU */ 2359f407e44SRohit Mathew PER_CPU_BY_INDEX(psci_cpu_pd_nodes, cpu_idx)->mpidr = 236532ed618SSoby Mathew read_mpidr() & MPIDR_AFFINITY_MASK; 237532ed618SSoby Mathew 238532ed618SSoby Mathew psci_init_req_local_pwr_states(); 239532ed618SSoby Mathew 240532ed618SSoby Mathew /* 241532ed618SSoby Mathew * Set the requested and target state of this CPU and all the higher 242532ed618SSoby Mathew * power domain levels for this CPU to run. 243532ed618SSoby Mathew */ 2443b802105SBoyan Karatotev psci_set_pwr_domains_to_run(cpu_idx, PLAT_MAX_PWR_LVL); 245532ed618SSoby Mathew 2466b7b0f36SAntonio Nino Diaz (void) plat_setup_psci_ops((uintptr_t)lib_args->mailbox_ep, 2476b7b0f36SAntonio Nino Diaz &psci_plat_pm_ops); 2486b7b0f36SAntonio Nino Diaz assert(psci_plat_pm_ops != NULL); 249532ed618SSoby Mathew 2507a3d4bdeSSoby Mathew /* 2517a3d4bdeSSoby Mathew * Flush `psci_plat_pm_ops` as it will be accessed by secondary CPUs 252a10d3632SJeenu Viswambharan * during warm boot, possibly before data cache is enabled. 2537a3d4bdeSSoby Mathew */ 254a10d3632SJeenu Viswambharan psci_flush_dcache_range((uintptr_t)&psci_plat_pm_ops, 2557a3d4bdeSSoby Mathew sizeof(psci_plat_pm_ops)); 2567a3d4bdeSSoby Mathew 257532ed618SSoby Mathew /* Initialize the psci capability */ 258532ed618SSoby Mathew psci_caps = PSCI_GENERIC_CAP; 259532ed618SSoby Mathew 260c7b0a28dSMaheedhar Bollapalli if (psci_plat_pm_ops->pwr_domain_off != NULL) { 261532ed618SSoby Mathew psci_caps |= define_psci_cap(PSCI_CPU_OFF); 262c7b0a28dSMaheedhar Bollapalli } 2636b7b0f36SAntonio Nino Diaz if ((psci_plat_pm_ops->pwr_domain_on != NULL) && 264c7b0a28dSMaheedhar Bollapalli (psci_plat_pm_ops->pwr_domain_on_finish != NULL)) { 265532ed618SSoby Mathew psci_caps |= define_psci_cap(PSCI_CPU_ON_AARCH64); 266c7b0a28dSMaheedhar Bollapalli } 2676b7b0f36SAntonio Nino Diaz if ((psci_plat_pm_ops->pwr_domain_suspend != NULL) && 2686b7b0f36SAntonio Nino Diaz (psci_plat_pm_ops->pwr_domain_suspend_finish != NULL)) { 269c7b0a28dSMaheedhar Bollapalli if (psci_plat_pm_ops->validate_power_state != NULL) { 270532ed618SSoby Mathew psci_caps |= define_psci_cap(PSCI_CPU_SUSPEND_AARCH64); 271c7b0a28dSMaheedhar Bollapalli } 272c7b0a28dSMaheedhar Bollapalli if (psci_plat_pm_ops->get_sys_suspend_power_state != NULL) { 273532ed618SSoby Mathew psci_caps |= define_psci_cap(PSCI_SYSTEM_SUSPEND_AARCH64); 274c7b0a28dSMaheedhar Bollapalli } 275b88a4416SWing Li #if PSCI_OS_INIT_MODE 276b88a4416SWing Li psci_caps |= define_psci_cap(PSCI_SET_SUSPEND_MODE); 277b88a4416SWing Li #endif 278532ed618SSoby Mathew } 279c7b0a28dSMaheedhar Bollapalli if (psci_plat_pm_ops->system_off != NULL) { 280532ed618SSoby Mathew psci_caps |= define_psci_cap(PSCI_SYSTEM_OFF); 281c7b0a28dSMaheedhar Bollapalli } 282c7b0a28dSMaheedhar Bollapalli if (psci_plat_pm_ops->system_reset != NULL) { 283532ed618SSoby Mathew psci_caps |= define_psci_cap(PSCI_SYSTEM_RESET); 284c7b0a28dSMaheedhar Bollapalli } 285c7b0a28dSMaheedhar Bollapalli if (psci_plat_pm_ops->get_node_hw_state != NULL) { 28628d3d614SJeenu Viswambharan psci_caps |= define_psci_cap(PSCI_NODE_HW_STATE_AARCH64); 287c7b0a28dSMaheedhar Bollapalli } 2886b7b0f36SAntonio Nino Diaz if ((psci_plat_pm_ops->read_mem_protect != NULL) && 289c7b0a28dSMaheedhar Bollapalli (psci_plat_pm_ops->write_mem_protect != NULL)) { 290d4c596beSRoberto Vargas psci_caps |= define_psci_cap(PSCI_MEM_PROTECT); 291c7b0a28dSMaheedhar Bollapalli } 292c7b0a28dSMaheedhar Bollapalli if (psci_plat_pm_ops->mem_protect_chk != NULL) { 293d4c596beSRoberto Vargas psci_caps |= define_psci_cap(PSCI_MEM_CHK_RANGE_AARCH64); 294c7b0a28dSMaheedhar Bollapalli } 295c7b0a28dSMaheedhar Bollapalli if (psci_plat_pm_ops->system_reset2 != NULL) { 29636a8f8fdSRoberto Vargas psci_caps |= define_psci_cap(PSCI_SYSTEM_RESET2_AARCH64); 297c7b0a28dSMaheedhar Bollapalli } 298532ed618SSoby Mathew #if ENABLE_PSCI_STAT 299532ed618SSoby Mathew psci_caps |= define_psci_cap(PSCI_STAT_RESIDENCY_AARCH64); 300532ed618SSoby Mathew psci_caps |= define_psci_cap(PSCI_STAT_COUNT_AARCH64); 301532ed618SSoby Mathew #endif 302532ed618SSoby Mathew 303532ed618SSoby Mathew return 0; 304532ed618SSoby Mathew } 305cf0b1492SSoby Mathew 306cf0b1492SSoby Mathew /******************************************************************************* 307cf0b1492SSoby Mathew * This duplicates what the primary cpu did after a cold boot in BL1. The same 308cf0b1492SSoby Mathew * needs to be done when a cpu is hotplugged in. This function could also over- 309cf0b1492SSoby Mathew * ride any EL3 setup done by BL1 as this code resides in rw memory. 310cf0b1492SSoby Mathew ******************************************************************************/ 311cf0b1492SSoby Mathew void psci_arch_setup(void) 312cf0b1492SSoby Mathew { 3136b7b0f36SAntonio Nino Diaz #if (ARM_ARCH_MAJOR > 7) || defined(ARMV7_SUPPORTS_GENERIC_TIMER) 314cf0b1492SSoby Mathew /* Program the counter frequency */ 315cf0b1492SSoby Mathew write_cntfrq_el0(plat_get_syscnt_freq2()); 31686e26835SEtienne Carriere #endif 317cf0b1492SSoby Mathew 318cf0b1492SSoby Mathew /* Initialize the cpu_ops pointer. */ 319022fcb48SBoyan Karatotev cpu_data_init_cpu_ops(); 32010bcd761SJeenu Viswambharan 32110bcd761SJeenu Viswambharan /* Having initialized cpu_ops, we can now print errata status */ 32210bcd761SJeenu Viswambharan print_errata_status(); 323ed108b56SAlexei Fedorov 324cf0b1492SSoby Mathew } 325727e5238SSoby Mathew 326727e5238SSoby Mathew /****************************************************************************** 327727e5238SSoby Mathew * PSCI Library interface to initialize the cpu context for the next non 328727e5238SSoby Mathew * secure image during cold boot. The relevant registers in the cpu context 329727e5238SSoby Mathew * need to be retrieved and programmed on return from this interface. 330727e5238SSoby Mathew *****************************************************************************/ 331727e5238SSoby Mathew void psci_prepare_next_non_secure_ctx(entry_point_info_t *next_image_info) 332727e5238SSoby Mathew { 333727e5238SSoby Mathew assert(GET_SECURITY_STATE(next_image_info->h.attr) == NON_SECURE); 334727e5238SSoby Mathew cm_init_my_context(next_image_info); 335727e5238SSoby Mathew cm_prepare_el3_exit(NON_SECURE); 336727e5238SSoby Mathew } 337