aboutsummaryrefslogtreecommitdiff
path: root/plat
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2020-01-17 13:46:38 +0900
committerMasahiro Yamada <yamada.masahiro@socionext.com>2020-01-24 22:34:50 +0900
commitc64873ab94cbb7cc7860ed348f0c55a9dec146e4 (patch)
tree7e1a9c1555574ca6364efbf8988c972656154435 /plat
parent577b24411accd329d11c7d918d9104498d9a4e1a (diff)
downloadarm-trusted-firmware-c64873ab94cbb7cc7860ed348f0c55a9dec146e4.tar.gz
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>
Diffstat (limited to 'plat')
-rw-r--r--plat/socionext/uniphier/tsp/uniphier_tsp_setup.c6
-rw-r--r--plat/socionext/uniphier/uniphier.h4
-rw-r--r--plat/socionext/uniphier/uniphier_bl2_setup.c4
-rw-r--r--plat/socionext/uniphier/uniphier_bl31_setup.c6
-rw-r--r--plat/socionext/uniphier/uniphier_xlat_setup.c15
5 files changed, 11 insertions, 24 deletions
diff --git a/plat/socionext/uniphier/tsp/uniphier_tsp_setup.c b/plat/socionext/uniphier/tsp/uniphier_tsp_setup.c
index 0b232e067..4f58b683c 100644
--- a/plat/socionext/uniphier/tsp/uniphier_tsp_setup.c
+++ b/plat/socionext/uniphier/tsp/uniphier_tsp_setup.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -11,8 +11,6 @@
#include "../uniphier.h"
-#define BL32_SIZE ((BL32_END) - (BL32_BASE))
-
void tsp_early_platform_setup(void)
{
uniphier_console_setup();
@@ -24,6 +22,6 @@ void tsp_platform_setup(void)
void tsp_plat_arch_setup(void)
{
- uniphier_mmap_setup(BL32_BASE, BL32_SIZE, NULL);
+ uniphier_mmap_setup();
enable_mmu_el1(0);
}
diff --git a/plat/socionext/uniphier/uniphier.h b/plat/socionext/uniphier/uniphier.h
index 698f3ebd9..bbbcf7ee3 100644
--- a/plat/socionext/uniphier/uniphier.h
+++ b/plat/socionext/uniphier/uniphier.h
@@ -53,9 +53,7 @@ void uniphier_scp_open_com(void);
void uniphier_scp_system_off(void);
void uniphier_scp_system_reset(void);
-struct mmap_region;
-void uniphier_mmap_setup(uintptr_t total_base, size_t total_size,
- const struct mmap_region *mmap);
+void uniphier_mmap_setup(void);
void uniphier_cci_init(unsigned int soc);
void uniphier_cci_enable(void);
diff --git a/plat/socionext/uniphier/uniphier_bl2_setup.c b/plat/socionext/uniphier/uniphier_bl2_setup.c
index 2132bdd0d..15022b3ea 100644
--- a/plat/socionext/uniphier/uniphier_bl2_setup.c
+++ b/plat/socionext/uniphier/uniphier_bl2_setup.c
@@ -21,8 +21,6 @@
#include "uniphier.h"
-#define BL2_SIZE ((BL2_END) - (BL2_BASE))
-
#define UNIPHIER_IMAGE_BUF_BASE 0x84300000UL
#define UNIPHIER_IMAGE_BUF_SIZE 0x00100000UL
@@ -40,7 +38,7 @@ void bl2_el3_plat_arch_setup(void)
int skip_scp = 0;
int ret;
- uniphier_mmap_setup(BL2_BASE, BL2_SIZE, NULL);
+ uniphier_mmap_setup();
enable_mmu_el3(0);
soc = uniphier_get_soc_id();
diff --git a/plat/socionext/uniphier/uniphier_bl31_setup.c b/plat/socionext/uniphier/uniphier_bl31_setup.c
index 440e6aa11..47f2378bc 100644
--- a/plat/socionext/uniphier/uniphier_bl31_setup.c
+++ b/plat/socionext/uniphier/uniphier_bl31_setup.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -19,8 +19,6 @@
#include "uniphier.h"
-#define BL31_SIZE ((BL31_END) - (BL31_BASE))
-
static entry_point_info_t bl32_image_ep_info;
static entry_point_info_t bl33_image_ep_info;
@@ -81,6 +79,6 @@ void bl31_platform_setup(void)
void bl31_plat_arch_setup(void)
{
- uniphier_mmap_setup(BL31_BASE, BL31_SIZE, NULL);
+ uniphier_mmap_setup();
enable_mmu_el3(0);
}
diff --git a/plat/socionext/uniphier/uniphier_xlat_setup.c b/plat/socionext/uniphier/uniphier_xlat_setup.c
index 0faebc993..18d2f9e93 100644
--- a/plat/socionext/uniphier/uniphier_xlat_setup.c
+++ b/plat/socionext/uniphier/uniphier_xlat_setup.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -12,13 +12,12 @@
#define UNIPHIER_REG_REGION_BASE 0x50000000ULL
#define UNIPHIER_REG_REGION_SIZE 0x20000000ULL
-void uniphier_mmap_setup(uintptr_t total_base, size_t total_size,
- const struct mmap_region *mmap)
+void uniphier_mmap_setup(void)
{
VERBOSE("Trusted RAM seen by this BL image: %p - %p\n",
- (void *)total_base, (void *)(total_base + total_size));
- mmap_add_region(total_base, total_base,
- total_size,
+ (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,
MT_MEMORY | MT_RW | MT_SECURE);
/* remap the code section */
@@ -40,9 +39,5 @@ void uniphier_mmap_setup(uintptr_t total_base, size_t total_size,
UNIPHIER_REG_REGION_SIZE,
MT_DEVICE | MT_RW | MT_SECURE);
- /* additional regions if needed */
- if (mmap)
- mmap_add(mmap);
-
init_xlat_tables();
}