1 /* 2 * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * Redistributions of source code must retain the above copyright notice, this 8 * list of conditions and the following disclaimer. 9 * 10 * Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * Neither the name of ARM nor the names of its contributors may be used 15 * to endorse or promote products derived from this software without specific 16 * prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 #include <arch_helpers.h> 32 #include <arm_def.h> 33 #include <bl_common.h> 34 #include <console.h> 35 #include <platform_def.h> 36 #include <plat_arm.h> 37 #include <string.h> 38 39 /* Weak definitions may be overridden in specific ARM standard platform */ 40 #pragma weak bl2u_platform_setup 41 #pragma weak bl2u_early_platform_setup 42 #pragma weak bl2u_plat_arch_setup 43 44 /* 45 * Perform ARM standard platform setup for BL2U 46 */ 47 void arm_bl2u_platform_setup(void) 48 { 49 /* Initialize the secure environment */ 50 plat_arm_security_setup(); 51 } 52 53 void bl2u_platform_setup(void) 54 { 55 arm_bl2u_platform_setup(); 56 } 57 58 void arm_bl2u_early_platform_setup(meminfo_t *mem_layout, void *plat_info) 59 { 60 /* Initialize the console to provide early debug support */ 61 console_init(PLAT_ARM_BOOT_UART_BASE, PLAT_ARM_BOOT_UART_CLK_IN_HZ, 62 ARM_CONSOLE_BAUDRATE); 63 } 64 65 /******************************************************************************* 66 * BL1 can pass platform dependent information to BL2U in x1. 67 * In case of ARM CSS platforms x1 contains SCP_BL2U image info. 68 * In case of ARM FVP platforms x1 is not used. 69 * In both cases, x0 contains the extents of the memory available to BL2U 70 ******************************************************************************/ 71 void bl2u_early_platform_setup(meminfo_t *mem_layout, void *plat_info) 72 { 73 arm_bl2u_early_platform_setup(mem_layout, plat_info); 74 } 75 76 /******************************************************************************* 77 * Perform the very early platform specific architectural setup here. At the 78 * moment this is only initializes the mmu in a quick and dirty way. 79 * The memory that is used by BL2U is only mapped. 80 ******************************************************************************/ 81 void arm_bl2u_plat_arch_setup(void) 82 { 83 arm_setup_page_tables(BL2U_BASE, 84 BL31_LIMIT, 85 BL_CODE_BASE, 86 BL_CODE_END, 87 BL_RO_DATA_BASE, 88 BL_RO_DATA_END 89 #if USE_COHERENT_MEM 90 , 91 BL_COHERENT_RAM_BASE, 92 BL_COHERENT_RAM_END 93 #endif 94 ); 95 enable_mmu_el1(0); 96 } 97 98 void bl2u_plat_arch_setup(void) 99 { 100 arm_bl2u_plat_arch_setup(); 101 } 102