107570d59SYatharth Kochar /* 2cc47e1adSDimitris Papastamos * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved. 307570d59SYatharth Kochar * 482cb2c1aSdp-arm * SPDX-License-Identifier: BSD-3-Clause 507570d59SYatharth Kochar */ 607570d59SYatharth Kochar 707570d59SYatharth Kochar #include <assert.h> 809d40e0eSAntonio Nino Diaz 909d40e0eSAntonio Nino Diaz #include <common/bl_common.h> 1009d40e0eSAntonio Nino Diaz #include <common/desc_image_load.h> 11*bd9344f6SAntonio Nino Diaz #include <plat/arm/common/plat_arm.h> 1207570d59SYatharth Kochar 1307570d59SYatharth Kochar #if JUNO_AARCH32_EL3_RUNTIME 1407570d59SYatharth Kochar /******************************************************************************* 1507570d59SYatharth Kochar * This function changes the spsr for BL32 image to bypass 1607570d59SYatharth Kochar * the check in BL1 AArch64 exception handler. This is needed in the aarch32 1707570d59SYatharth Kochar * boot flow as the core comes up in aarch64 and to enter the BL32 image a warm 1807570d59SYatharth Kochar * reset in aarch32 state is required. 1907570d59SYatharth Kochar ******************************************************************************/ 20490eeb04SDaniel Boulby int arm_bl2_plat_handle_post_image_load(unsigned int image_id) 2107570d59SYatharth Kochar { 2207570d59SYatharth Kochar int err = arm_bl2_handle_post_image_load(image_id); 2307570d59SYatharth Kochar 2407570d59SYatharth Kochar if (!err && (image_id == BL32_IMAGE_ID)) { 2507570d59SYatharth Kochar bl_mem_params_node_t *bl_mem_params = get_bl_mem_params_node(image_id); 2607570d59SYatharth Kochar assert(bl_mem_params); 2707570d59SYatharth Kochar bl_mem_params->ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX, 2807570d59SYatharth Kochar DISABLE_ALL_EXCEPTIONS); 2907570d59SYatharth Kochar } 3007570d59SYatharth Kochar 3107570d59SYatharth Kochar return err; 3207570d59SYatharth Kochar } 3307570d59SYatharth Kochar #endif /* JUNO_AARCH32_EL3_RUNTIME */ 34