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>
diff --git a/plat/socionext/uniphier/uniphier_xlat_setup.c b/plat/socionext/uniphier/uniphier_xlat_setup.c
index 0faebc9..18d2f9e 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 @@
 			UNIPHIER_REG_REGION_SIZE,
 			MT_DEVICE | MT_RW | MT_SECURE);
 
-	/* additional regions if needed */
-	if (mmap)
-		mmap_add(mmap);
-
 	init_xlat_tables();
 }