blob: 86317f656c17539ba8d196f08f96a525cee5ef5d [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 *
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
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010039/* 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 */
47void arm_bl2u_platform_setup(void)
48{
49 /* Initialize the secure environment */
50 plat_arm_security_setup();
51}
52
53void bl2u_platform_setup(void)
54{
55 arm_bl2u_platform_setup();
56}
57
58void 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 ******************************************************************************/
71void 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 ******************************************************************************/
81void arm_bl2u_plat_arch_setup(void)
82{
Sandrine Bailleuxa0e505e2016-06-20 10:10:40 +010083 arm_setup_page_tables(BL2U_BASE,
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010084 BL31_LIMIT,
Sandrine Bailleuxecdc4d32016-07-08 14:38:16 +010085 BL_CODE_BASE,
Masahiro Yamada51bef612017-01-18 02:10:08 +090086 BL_CODE_END,
Sandrine Bailleuxecdc4d32016-07-08 14:38:16 +010087 BL_RO_DATA_BASE,
Masahiro Yamada51bef612017-01-18 02:10:08 +090088 BL_RO_DATA_END
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010089#if USE_COHERENT_MEM
90 ,
Masahiro Yamada0fac5af2016-12-28 16:11:41 +090091 BL_COHERENT_RAM_BASE,
92 BL_COHERENT_RAM_END
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010093#endif
94 );
Sandrine Bailleux4a1267a2016-05-18 16:11:47 +010095 enable_mmu_el1(0);
Yatharth Kochar3a11eda2015-10-14 15:28:11 +010096}
97
98void bl2u_plat_arch_setup(void)
99{
100 arm_bl2u_plat_arch_setup();
101}