blob: 5dc9eea080d8f7eb5735b669d57ac0ff7408b1bb [file] [log] [blame]
Yatharth Kochar3a11eda2015-10-14 15:28:11 +01001/*
Sandrine Bailleux4a1267a2016-05-18 16:11:47 +01002 * Copyright (c) 2015-2016, 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>
10#include <console.h>
11#include <platform_def.h>
12#include <plat_arm.h>
13#include <string.h>
14
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010015/* Weak definitions may be overridden in specific ARM standard platform */
16#pragma weak bl2u_platform_setup
17#pragma weak bl2u_early_platform_setup
18#pragma weak bl2u_plat_arch_setup
19
20/*
21 * Perform ARM standard platform setup for BL2U
22 */
23void arm_bl2u_platform_setup(void)
24{
25 /* Initialize the secure environment */
26 plat_arm_security_setup();
27}
28
29void bl2u_platform_setup(void)
30{
31 arm_bl2u_platform_setup();
32}
33
34void arm_bl2u_early_platform_setup(meminfo_t *mem_layout, void *plat_info)
35{
36 /* Initialize the console to provide early debug support */
37 console_init(PLAT_ARM_BOOT_UART_BASE, PLAT_ARM_BOOT_UART_CLK_IN_HZ,
38 ARM_CONSOLE_BAUDRATE);
39}
40
41/*******************************************************************************
42 * BL1 can pass platform dependent information to BL2U in x1.
43 * In case of ARM CSS platforms x1 contains SCP_BL2U image info.
44 * In case of ARM FVP platforms x1 is not used.
45 * In both cases, x0 contains the extents of the memory available to BL2U
46 ******************************************************************************/
47void bl2u_early_platform_setup(meminfo_t *mem_layout, void *plat_info)
48{
49 arm_bl2u_early_platform_setup(mem_layout, plat_info);
50}
51
52/*******************************************************************************
53 * Perform the very early platform specific architectural setup here. At the
54 * moment this is only initializes the mmu in a quick and dirty way.
55 * The memory that is used by BL2U is only mapped.
56 ******************************************************************************/
57void arm_bl2u_plat_arch_setup(void)
58{
Sandrine Bailleuxa0e505e2016-06-20 10:10:40 +010059 arm_setup_page_tables(BL2U_BASE,
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010060 BL31_LIMIT,
Sandrine Bailleuxecdc4d32016-07-08 14:38:16 +010061 BL_CODE_BASE,
Masahiro Yamada51bef612017-01-18 02:10:08 +090062 BL_CODE_END,
Sandrine Bailleuxecdc4d32016-07-08 14:38:16 +010063 BL_RO_DATA_BASE,
Masahiro Yamada51bef612017-01-18 02:10:08 +090064 BL_RO_DATA_END
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010065#if USE_COHERENT_MEM
66 ,
Masahiro Yamada0fac5af2016-12-28 16:11:41 +090067 BL_COHERENT_RAM_BASE,
68 BL_COHERENT_RAM_END
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010069#endif
70 );
Yatharth Kochar18dfb302016-11-22 11:06:03 +000071#ifdef AARCH32
72 enable_mmu_secure(0);
73#else
Sandrine Bailleux4a1267a2016-05-18 16:11:47 +010074 enable_mmu_el1(0);
Yatharth Kochar18dfb302016-11-22 11:06:03 +000075#endif
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010076}
77
78void bl2u_plat_arch_setup(void)
79{
80 arm_bl2u_plat_arch_setup();
81}