blob: dce00e5bd4fb4601817dfd1f7a1d1cc6858f4630 [file] [log] [blame]
Yatharth Kochar3a11eda2015-10-14 15:28:11 +01001/*
Roberto Vargas2ca18d92018-02-12 12:36:17 +00002 * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
Yatharth Kochar3a11eda2015-10-14 15:28:11 +01003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Yatharth Kochar3a11eda2015-10-14 15:28:11 +01005 */
6
7#include <arch_helpers.h>
8#include <arm_def.h>
9#include <bl_common.h>
Soby Mathewdb141302018-03-06 15:22:55 +000010#include <generic_delay_timer.h>
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010011#include <plat_arm.h>
Isla Mitchelld2548792017-07-14 10:48:25 +010012#include <platform_def.h>
Roberto Vargas2ca18d92018-02-12 12:36:17 +000013#include <platform.h>
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010014#include <string.h>
15
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010016/* Weak definitions may be overridden in specific ARM standard platform */
17#pragma weak bl2u_platform_setup
18#pragma weak bl2u_early_platform_setup
19#pragma weak bl2u_plat_arch_setup
20
21/*
22 * Perform ARM standard platform setup for BL2U
23 */
24void arm_bl2u_platform_setup(void)
25{
26 /* Initialize the secure environment */
27 plat_arm_security_setup();
28}
29
30void bl2u_platform_setup(void)
31{
32 arm_bl2u_platform_setup();
33}
34
Sandrine Bailleuxb3b6e222018-07-11 12:44:22 +020035void arm_bl2u_early_platform_setup(struct meminfo *mem_layout, void *plat_info)
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010036{
37 /* Initialize the console to provide early debug support */
Antonio Nino Diaz23ede6a2018-06-19 09:29:36 +010038 arm_console_boot_init();
39
Soby Mathewdb141302018-03-06 15:22:55 +000040 generic_delay_timer_init();
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010041}
42
43/*******************************************************************************
44 * BL1 can pass platform dependent information to BL2U in x1.
45 * In case of ARM CSS platforms x1 contains SCP_BL2U image info.
46 * In case of ARM FVP platforms x1 is not used.
47 * In both cases, x0 contains the extents of the memory available to BL2U
48 ******************************************************************************/
Sandrine Bailleuxb3b6e222018-07-11 12:44:22 +020049void bl2u_early_platform_setup(struct meminfo *mem_layout, void *plat_info)
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010050{
51 arm_bl2u_early_platform_setup(mem_layout, plat_info);
52}
53
54/*******************************************************************************
55 * Perform the very early platform specific architectural setup here. At the
56 * moment this is only initializes the mmu in a quick and dirty way.
57 * The memory that is used by BL2U is only mapped.
58 ******************************************************************************/
59void arm_bl2u_plat_arch_setup(void)
60{
Sandrine Bailleuxa0e505e2016-06-20 10:10:40 +010061 arm_setup_page_tables(BL2U_BASE,
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010062 BL31_LIMIT,
Sandrine Bailleuxecdc4d32016-07-08 14:38:16 +010063 BL_CODE_BASE,
Masahiro Yamada51bef612017-01-18 02:10:08 +090064 BL_CODE_END,
Sandrine Bailleuxecdc4d32016-07-08 14:38:16 +010065 BL_RO_DATA_BASE,
Masahiro Yamada51bef612017-01-18 02:10:08 +090066 BL_RO_DATA_END
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010067#if USE_COHERENT_MEM
68 ,
Masahiro Yamada0fac5af2016-12-28 16:11:41 +090069 BL_COHERENT_RAM_BASE,
70 BL_COHERENT_RAM_END
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010071#endif
72 );
Yatharth Kochar18dfb302016-11-22 11:06:03 +000073#ifdef AARCH32
74 enable_mmu_secure(0);
75#else
Sandrine Bailleux4a1267a2016-05-18 16:11:47 +010076 enable_mmu_el1(0);
Yatharth Kochar18dfb302016-11-22 11:06:03 +000077#endif
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010078}
79
80void bl2u_plat_arch_setup(void)
81{
82 arm_bl2u_plat_arch_setup();
83}