2016-09-03 03:37:40 +01:00
|
|
|
/*
|
uniphier: make uniphier_mmap_setup() work with PIE
BL2_BASE, BL31_BASE, and BL32_BASE are defined in platform_def.h,
that is, determined at link-time.
On the other hand, BL2_END, BL31_END, and BL32_END are derived from
the symbols produced by the linker scripts. So, they are fixed-up
at run-time if ENABLE_PIE is enabled.
To make it work in a position-indepenent manner, use BL_CODE_BASE and
BL_END, both of which are relocatable.
Change-Id: Ic179a7c60eb64c5f3024b178690b3ac7cbd7521b
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-01-17 04:46:38 +00:00
|
|
|
* Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved.
|
2016-09-03 03:37:40 +01:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <platform_def.h>
|
2018-12-14 00:18:21 +00:00
|
|
|
|
|
|
|
#include <common/debug.h>
|
|
|
|
#include <lib/xlat_tables/xlat_tables_v2.h>
|
2016-09-03 03:37:40 +01:00
|
|
|
|
2018-02-02 06:55:13 +00:00
|
|
|
#define UNIPHIER_REG_REGION_BASE 0x50000000ULL
|
|
|
|
#define UNIPHIER_REG_REGION_SIZE 0x20000000ULL
|
2016-09-03 03:37:40 +01:00
|
|
|
|
uniphier: make uniphier_mmap_setup() work with PIE
BL2_BASE, BL31_BASE, and BL32_BASE are defined in platform_def.h,
that is, determined at link-time.
On the other hand, BL2_END, BL31_END, and BL32_END are derived from
the symbols produced by the linker scripts. So, they are fixed-up
at run-time if ENABLE_PIE is enabled.
To make it work in a position-indepenent manner, use BL_CODE_BASE and
BL_END, both of which are relocatable.
Change-Id: Ic179a7c60eb64c5f3024b178690b3ac7cbd7521b
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-01-17 04:46:38 +00:00
|
|
|
void uniphier_mmap_setup(void)
|
2016-09-03 03:37:40 +01:00
|
|
|
{
|
|
|
|
VERBOSE("Trusted RAM seen by this BL image: %p - %p\n",
|
uniphier: make uniphier_mmap_setup() work with PIE
BL2_BASE, BL31_BASE, and BL32_BASE are defined in platform_def.h,
that is, determined at link-time.
On the other hand, BL2_END, BL31_END, and BL32_END are derived from
the symbols produced by the linker scripts. So, they are fixed-up
at run-time if ENABLE_PIE is enabled.
To make it work in a position-indepenent manner, use BL_CODE_BASE and
BL_END, both of which are relocatable.
Change-Id: Ic179a7c60eb64c5f3024b178690b3ac7cbd7521b
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-01-17 04:46:38 +00:00
|
|
|
(void *)BL_CODE_BASE, (void *)BL_END);
|
|
|
|
mmap_add_region(BL_CODE_BASE, BL_CODE_BASE,
|
|
|
|
round_up(BL_END, PAGE_SIZE) - BL_CODE_BASE,
|
2016-09-03 03:37:40 +01:00
|
|
|
MT_MEMORY | MT_RW | MT_SECURE);
|
|
|
|
|
|
|
|
/* remap the code section */
|
|
|
|
VERBOSE("Code region: %p - %p\n",
|
|
|
|
(void *)BL_CODE_BASE, (void *)BL_CODE_END);
|
|
|
|
mmap_add_region(BL_CODE_BASE, BL_CODE_BASE,
|
|
|
|
round_up(BL_CODE_END, PAGE_SIZE) - BL_CODE_BASE,
|
|
|
|
MT_CODE | MT_SECURE);
|
|
|
|
|
|
|
|
/* remap the coherent memory region */
|
|
|
|
VERBOSE("Coherent region: %p - %p\n",
|
|
|
|
(void *)BL_COHERENT_RAM_BASE, (void *)BL_COHERENT_RAM_END);
|
|
|
|
mmap_add_region(BL_COHERENT_RAM_BASE, BL_COHERENT_RAM_BASE,
|
|
|
|
BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE,
|
|
|
|
MT_DEVICE | MT_RW | MT_SECURE);
|
|
|
|
|
|
|
|
/* register region */
|
|
|
|
mmap_add_region(UNIPHIER_REG_REGION_BASE, UNIPHIER_REG_REGION_BASE,
|
|
|
|
UNIPHIER_REG_REGION_SIZE,
|
|
|
|
MT_DEVICE | MT_RW | MT_SECURE);
|
|
|
|
|
|
|
|
init_xlat_tables();
|
|
|
|
}
|