1*9003fa0bSYatharth Kochar /* 2*9003fa0bSYatharth Kochar * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. 3*9003fa0bSYatharth Kochar * 4*9003fa0bSYatharth Kochar * Redistribution and use in source and binary forms, with or without 5*9003fa0bSYatharth Kochar * modification, are permitted provided that the following conditions are met: 6*9003fa0bSYatharth Kochar * 7*9003fa0bSYatharth Kochar * Redistributions of source code must retain the above copyright notice, this 8*9003fa0bSYatharth Kochar * list of conditions and the following disclaimer. 9*9003fa0bSYatharth Kochar * 10*9003fa0bSYatharth Kochar * Redistributions in binary form must reproduce the above copyright notice, 11*9003fa0bSYatharth Kochar * this list of conditions and the following disclaimer in the documentation 12*9003fa0bSYatharth Kochar * and/or other materials provided with the distribution. 13*9003fa0bSYatharth Kochar * 14*9003fa0bSYatharth Kochar * Neither the name of ARM nor the names of its contributors may be used 15*9003fa0bSYatharth Kochar * to endorse or promote products derived from this software without specific 16*9003fa0bSYatharth Kochar * prior written permission. 17*9003fa0bSYatharth Kochar * 18*9003fa0bSYatharth Kochar * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19*9003fa0bSYatharth Kochar * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20*9003fa0bSYatharth Kochar * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21*9003fa0bSYatharth Kochar * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22*9003fa0bSYatharth Kochar * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23*9003fa0bSYatharth Kochar * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24*9003fa0bSYatharth Kochar * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25*9003fa0bSYatharth Kochar * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26*9003fa0bSYatharth Kochar * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27*9003fa0bSYatharth Kochar * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28*9003fa0bSYatharth Kochar * POSSIBILITY OF SUCH DAMAGE. 29*9003fa0bSYatharth Kochar */ 30*9003fa0bSYatharth Kochar 31*9003fa0bSYatharth Kochar #include <arch.h> 32*9003fa0bSYatharth Kochar #include <arch_helpers.h> 33*9003fa0bSYatharth Kochar #include <assert.h> 34*9003fa0bSYatharth Kochar #include <auth_mod.h> 35*9003fa0bSYatharth Kochar #include <bl_common.h> 36*9003fa0bSYatharth Kochar #include <bl1.h> 37*9003fa0bSYatharth Kochar #include <debug.h> 38*9003fa0bSYatharth Kochar #include <platform.h> 39*9003fa0bSYatharth Kochar #include <platform_def.h> 40*9003fa0bSYatharth Kochar #include <stdint.h> 41*9003fa0bSYatharth Kochar 42*9003fa0bSYatharth Kochar /******************************************************************************* 43*9003fa0bSYatharth Kochar * This function is responsible to: 44*9003fa0bSYatharth Kochar * Load SCP_BL2U if platform has defined SCP_BL2U_BASE 45*9003fa0bSYatharth Kochar * Perform platform setup. 46*9003fa0bSYatharth Kochar * Go back to EL3. 47*9003fa0bSYatharth Kochar ******************************************************************************/ 48*9003fa0bSYatharth Kochar void bl2u_main(void) 49*9003fa0bSYatharth Kochar { 50*9003fa0bSYatharth Kochar NOTICE("BL2U: %s\n", version_string); 51*9003fa0bSYatharth Kochar NOTICE("BL2U: %s\n", build_message); 52*9003fa0bSYatharth Kochar 53*9003fa0bSYatharth Kochar #if SCP_BL2U_BASE 54*9003fa0bSYatharth Kochar int rc; 55*9003fa0bSYatharth Kochar /* Load the subsequent bootloader images */ 56*9003fa0bSYatharth Kochar rc = bl2u_plat_handle_scp_bl2u(); 57*9003fa0bSYatharth Kochar if (rc) { 58*9003fa0bSYatharth Kochar ERROR("Failed to load SCP_BL2U (%i)\n", rc); 59*9003fa0bSYatharth Kochar panic(); 60*9003fa0bSYatharth Kochar } 61*9003fa0bSYatharth Kochar #endif 62*9003fa0bSYatharth Kochar 63*9003fa0bSYatharth Kochar /* Perform platform setup in BL2U after loading SCP_BL2U */ 64*9003fa0bSYatharth Kochar bl2u_platform_setup(); 65*9003fa0bSYatharth Kochar 66*9003fa0bSYatharth Kochar /* 67*9003fa0bSYatharth Kochar * Indicate that BL2U is done and resume back to 68*9003fa0bSYatharth Kochar * normal world via an SMC to BL1. 69*9003fa0bSYatharth Kochar * x1 could be passed to Normal world, 70*9003fa0bSYatharth Kochar * so DO NOT pass any secret information. 71*9003fa0bSYatharth Kochar */ 72*9003fa0bSYatharth Kochar smc(FWU_SMC_SEC_IMAGE_DONE, 0, 0, 0, 0, 0, 0, 0); 73*9003fa0bSYatharth Kochar wfi(); 74*9003fa0bSYatharth Kochar } 75