2015-10-14 15:28:11 +01:00
|
|
|
/*
|
2018-02-12 12:36:17 +00:00
|
|
|
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
|
2015-10-14 15:28:11 +01:00
|
|
|
*
|
2017-05-03 09:38:09 +01:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2015-10-14 15:28:11 +01:00
|
|
|
*/
|
|
|
|
|
2018-12-14 00:18:21 +00:00
|
|
|
#include <assert.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <platform_def.h>
|
|
|
|
|
2015-10-14 15:28:11 +01:00
|
|
|
#include <arch_helpers.h>
|
2018-12-14 00:18:21 +00:00
|
|
|
#include <common/bl_common.h>
|
|
|
|
#include <drivers/generic_delay_timer.h>
|
2019-01-25 14:30:04 +00:00
|
|
|
#include <plat/arm/common/plat_arm.h>
|
2018-12-14 00:18:21 +00:00
|
|
|
#include <plat/common/platform.h>
|
|
|
|
|
2015-10-14 15:28:11 +01:00
|
|
|
/* Weak definitions may be overridden in specific ARM standard platform */
|
|
|
|
#pragma weak bl2u_platform_setup
|
|
|
|
#pragma weak bl2u_early_platform_setup
|
|
|
|
#pragma weak bl2u_plat_arch_setup
|
|
|
|
|
2018-07-06 16:54:44 +01:00
|
|
|
#define MAP_BL2U_TOTAL MAP_REGION_FLAT( \
|
|
|
|
BL2U_BASE, \
|
|
|
|
BL2U_LIMIT - BL2U_BASE, \
|
|
|
|
MT_MEMORY | MT_RW | MT_SECURE)
|
|
|
|
|
2015-10-14 15:28:11 +01:00
|
|
|
/*
|
|
|
|
* Perform ARM standard platform setup for BL2U
|
|
|
|
*/
|
|
|
|
void arm_bl2u_platform_setup(void)
|
|
|
|
{
|
|
|
|
/* Initialize the secure environment */
|
|
|
|
plat_arm_security_setup();
|
|
|
|
}
|
|
|
|
|
|
|
|
void bl2u_platform_setup(void)
|
|
|
|
{
|
|
|
|
arm_bl2u_platform_setup();
|
|
|
|
}
|
|
|
|
|
2018-07-11 11:44:22 +01:00
|
|
|
void arm_bl2u_early_platform_setup(struct meminfo *mem_layout, void *plat_info)
|
2015-10-14 15:28:11 +01:00
|
|
|
{
|
|
|
|
/* Initialize the console to provide early debug support */
|
2018-06-19 09:29:36 +01:00
|
|
|
arm_console_boot_init();
|
|
|
|
|
2018-03-06 15:22:55 +00:00
|
|
|
generic_delay_timer_init();
|
2015-10-14 15:28:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* BL1 can pass platform dependent information to BL2U in x1.
|
|
|
|
* In case of ARM CSS platforms x1 contains SCP_BL2U image info.
|
|
|
|
* In case of ARM FVP platforms x1 is not used.
|
|
|
|
* In both cases, x0 contains the extents of the memory available to BL2U
|
|
|
|
******************************************************************************/
|
2018-07-11 11:44:22 +01:00
|
|
|
void bl2u_early_platform_setup(struct meminfo *mem_layout, void *plat_info)
|
2015-10-14 15:28:11 +01:00
|
|
|
{
|
|
|
|
arm_bl2u_early_platform_setup(mem_layout, plat_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* Perform the very early platform specific architectural setup here. At the
|
|
|
|
* moment this is only initializes the mmu in a quick and dirty way.
|
|
|
|
* The memory that is used by BL2U is only mapped.
|
|
|
|
******************************************************************************/
|
|
|
|
void arm_bl2u_plat_arch_setup(void)
|
|
|
|
{
|
2018-07-06 16:54:44 +01:00
|
|
|
|
2015-10-14 15:28:11 +01:00
|
|
|
#if USE_COHERENT_MEM
|
2018-07-06 16:54:44 +01:00
|
|
|
/* Ensure ARM platforms dont use coherent memory in BL2U */
|
|
|
|
assert((BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE) == 0U);
|
2015-10-14 15:28:11 +01:00
|
|
|
#endif
|
2018-07-06 16:54:44 +01:00
|
|
|
|
|
|
|
const mmap_region_t bl_regions[] = {
|
|
|
|
MAP_BL2U_TOTAL,
|
2018-07-16 14:09:15 +01:00
|
|
|
ARM_MAP_BL_RO,
|
2018-05-23 09:27:06 +01:00
|
|
|
#if USE_ROMLIB
|
|
|
|
ARM_MAP_ROMLIB_CODE,
|
|
|
|
ARM_MAP_ROMLIB_DATA,
|
|
|
|
#endif
|
2018-07-06 16:54:44 +01:00
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
2018-10-19 16:44:18 +01:00
|
|
|
setup_page_tables(bl_regions, plat_arm_get_mmap());
|
2018-07-06 16:54:44 +01:00
|
|
|
|
2016-11-22 11:06:03 +00:00
|
|
|
#ifdef AARCH32
|
2018-08-07 16:35:19 +01:00
|
|
|
enable_mmu_svc_mon(0);
|
2016-11-22 11:06:03 +00:00
|
|
|
#else
|
2016-05-18 16:11:47 +01:00
|
|
|
enable_mmu_el1(0);
|
2016-11-22 11:06:03 +00:00
|
|
|
#endif
|
2018-05-23 09:27:06 +01:00
|
|
|
arm_setup_romlib();
|
2015-10-14 15:28:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void bl2u_plat_arch_setup(void)
|
|
|
|
{
|
|
|
|
arm_bl2u_plat_arch_setup();
|
|
|
|
}
|