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