19003fa0bSYatharth Kochar /* 2*0b32628eSAntonio Nino Diaz * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved. 39003fa0bSYatharth Kochar * 49003fa0bSYatharth Kochar * Redistribution and use in source and binary forms, with or without 59003fa0bSYatharth Kochar * modification, are permitted provided that the following conditions are met: 69003fa0bSYatharth Kochar * 79003fa0bSYatharth Kochar * Redistributions of source code must retain the above copyright notice, this 89003fa0bSYatharth Kochar * list of conditions and the following disclaimer. 99003fa0bSYatharth Kochar * 109003fa0bSYatharth Kochar * Redistributions in binary form must reproduce the above copyright notice, 119003fa0bSYatharth Kochar * this list of conditions and the following disclaimer in the documentation 129003fa0bSYatharth Kochar * and/or other materials provided with the distribution. 139003fa0bSYatharth Kochar * 149003fa0bSYatharth Kochar * Neither the name of ARM nor the names of its contributors may be used 159003fa0bSYatharth Kochar * to endorse or promote products derived from this software without specific 169003fa0bSYatharth Kochar * prior written permission. 179003fa0bSYatharth Kochar * 189003fa0bSYatharth Kochar * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 199003fa0bSYatharth Kochar * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 209003fa0bSYatharth Kochar * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 219003fa0bSYatharth Kochar * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 229003fa0bSYatharth Kochar * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 239003fa0bSYatharth Kochar * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 249003fa0bSYatharth Kochar * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 259003fa0bSYatharth Kochar * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 269003fa0bSYatharth Kochar * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 279003fa0bSYatharth Kochar * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 289003fa0bSYatharth Kochar * POSSIBILITY OF SUCH DAMAGE. 299003fa0bSYatharth Kochar */ 309003fa0bSYatharth Kochar 319003fa0bSYatharth Kochar #include <arch.h> 329003fa0bSYatharth Kochar #include <arch_helpers.h> 339003fa0bSYatharth Kochar #include <assert.h> 349003fa0bSYatharth Kochar #include <auth_mod.h> 359003fa0bSYatharth Kochar #include <bl_common.h> 369003fa0bSYatharth Kochar #include <bl1.h> 37*0b32628eSAntonio Nino Diaz #include <console.h> 389003fa0bSYatharth Kochar #include <debug.h> 399003fa0bSYatharth Kochar #include <platform.h> 409003fa0bSYatharth Kochar #include <platform_def.h> 419003fa0bSYatharth Kochar #include <stdint.h> 429003fa0bSYatharth Kochar 439003fa0bSYatharth Kochar /******************************************************************************* 449003fa0bSYatharth Kochar * This function is responsible to: 459003fa0bSYatharth Kochar * Load SCP_BL2U if platform has defined SCP_BL2U_BASE 469003fa0bSYatharth Kochar * Perform platform setup. 479003fa0bSYatharth Kochar * Go back to EL3. 489003fa0bSYatharth Kochar ******************************************************************************/ 499003fa0bSYatharth Kochar void bl2u_main(void) 509003fa0bSYatharth Kochar { 519003fa0bSYatharth Kochar NOTICE("BL2U: %s\n", version_string); 529003fa0bSYatharth Kochar NOTICE("BL2U: %s\n", build_message); 539003fa0bSYatharth Kochar 549003fa0bSYatharth Kochar #if SCP_BL2U_BASE 559003fa0bSYatharth Kochar int rc; 569003fa0bSYatharth Kochar /* Load the subsequent bootloader images */ 579003fa0bSYatharth Kochar rc = bl2u_plat_handle_scp_bl2u(); 589003fa0bSYatharth Kochar if (rc) { 599003fa0bSYatharth Kochar ERROR("Failed to load SCP_BL2U (%i)\n", rc); 609003fa0bSYatharth Kochar panic(); 619003fa0bSYatharth Kochar } 629003fa0bSYatharth Kochar #endif 639003fa0bSYatharth Kochar 649003fa0bSYatharth Kochar /* Perform platform setup in BL2U after loading SCP_BL2U */ 659003fa0bSYatharth Kochar bl2u_platform_setup(); 669003fa0bSYatharth Kochar 67*0b32628eSAntonio Nino Diaz console_flush(); 68*0b32628eSAntonio Nino Diaz 699003fa0bSYatharth Kochar /* 709003fa0bSYatharth Kochar * Indicate that BL2U is done and resume back to 719003fa0bSYatharth Kochar * normal world via an SMC to BL1. 729003fa0bSYatharth Kochar * x1 could be passed to Normal world, 739003fa0bSYatharth Kochar * so DO NOT pass any secret information. 749003fa0bSYatharth Kochar */ 759003fa0bSYatharth Kochar smc(FWU_SMC_SEC_IMAGE_DONE, 0, 0, 0, 0, 0, 0, 0); 769003fa0bSYatharth Kochar wfi(); 779003fa0bSYatharth Kochar } 78