1 /* 2 * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <arch_helpers.h> 8 #include <arm_def.h> 9 #include <bl_common.h> 10 #include <console.h> 11 #include <generic_delay_timer.h> 12 #include <plat_arm.h> 13 #include <platform_def.h> 14 #include <platform.h> 15 #include <string.h> 16 17 /* Weak definitions may be overridden in specific ARM standard platform */ 18 #pragma weak bl2u_platform_setup 19 #pragma weak bl2u_early_platform_setup 20 #pragma weak bl2u_plat_arch_setup 21 22 /* 23 * Perform ARM standard platform setup for BL2U 24 */ 25 void arm_bl2u_platform_setup(void) 26 { 27 /* Initialize the secure environment */ 28 plat_arm_security_setup(); 29 } 30 31 void bl2u_platform_setup(void) 32 { 33 arm_bl2u_platform_setup(); 34 } 35 36 void arm_bl2u_early_platform_setup(meminfo_t *mem_layout, void *plat_info) 37 { 38 /* Initialize the console to provide early debug support */ 39 console_init(PLAT_ARM_BOOT_UART_BASE, PLAT_ARM_BOOT_UART_CLK_IN_HZ, 40 ARM_CONSOLE_BAUDRATE); 41 generic_delay_timer_init(); 42 } 43 44 /******************************************************************************* 45 * BL1 can pass platform dependent information to BL2U in x1. 46 * In case of ARM CSS platforms x1 contains SCP_BL2U image info. 47 * In case of ARM FVP platforms x1 is not used. 48 * In both cases, x0 contains the extents of the memory available to BL2U 49 ******************************************************************************/ 50 void bl2u_early_platform_setup(meminfo_t *mem_layout, void *plat_info) 51 { 52 arm_bl2u_early_platform_setup(mem_layout, plat_info); 53 } 54 55 /******************************************************************************* 56 * Perform the very early platform specific architectural setup here. At the 57 * moment this is only initializes the mmu in a quick and dirty way. 58 * The memory that is used by BL2U is only mapped. 59 ******************************************************************************/ 60 void arm_bl2u_plat_arch_setup(void) 61 { 62 arm_setup_page_tables(BL2U_BASE, 63 BL31_LIMIT, 64 BL_CODE_BASE, 65 BL_CODE_END, 66 BL_RO_DATA_BASE, 67 BL_RO_DATA_END 68 #if USE_COHERENT_MEM 69 , 70 BL_COHERENT_RAM_BASE, 71 BL_COHERENT_RAM_END 72 #endif 73 ); 74 #ifdef AARCH32 75 enable_mmu_secure(0); 76 #else 77 enable_mmu_el1(0); 78 #endif 79 } 80 81 void bl2u_plat_arch_setup(void) 82 { 83 arm_bl2u_plat_arch_setup(); 84 } 85