summaryrefslogtreecommitdiffstats
path: root/recipes-bsp/atf/files/0001-Clean-usage-of-void-pointers-to-access-symbols.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-bsp/atf/files/0001-Clean-usage-of-void-pointers-to-access-symbols.patch')
-rw-r--r--recipes-bsp/atf/files/0001-Clean-usage-of-void-pointers-to-access-symbols.patch709
1 files changed, 0 insertions, 709 deletions
diff --git a/recipes-bsp/atf/files/0001-Clean-usage-of-void-pointers-to-access-symbols.patch b/recipes-bsp/atf/files/0001-Clean-usage-of-void-pointers-to-access-symbols.patch
deleted file mode 100644
index e3b6f860..00000000
--- a/recipes-bsp/atf/files/0001-Clean-usage-of-void-pointers-to-access-symbols.patch
+++ /dev/null
@@ -1,709 +0,0 @@
1From 9f85f9e3796f1c351bbc4c8436dc66d83c140b71 Mon Sep 17 00:00:00 2001
2From: Joel Hutton <Joel.Hutton@Arm.com>
3Date: Wed, 21 Mar 2018 11:40:57 +0000
4Subject: [PATCH] Clean usage of void pointers to access symbols
5
6Void pointers have been used to access linker symbols, by declaring an
7extern pointer, then taking the address of it. This limits symbols
8values to aligned pointer values. To remove this restriction an
9IMPORT_SYM macro has been introduced, which declares it as a char
10pointer and casts it to the required type.
11
12Upstream-Status: Backport
13
14Change-Id: I89877fc3b13ed311817bb8ba79d4872b89bfd3b0
15Signed-off-by: Joel Hutton <Joel.Hutton@Arm.com>
16---
17 bl1/bl1_private.h | 12 +++----
18 common/runtime_svc.c | 4 +--
19 drivers/auth/img_parser_mod.c | 9 +++---
20 include/common/bl_common.h | 32 ++++++++++++-------
21 include/common/runtime_svc.h | 4 +--
22 include/lib/utils_def.h | 19 ++++++++++-
23 include/plat/common/common_def.h | 24 ++------------
24 include/services/secure_partition.h | 12 +++----
25 lib/locks/bakery/bakery_lock_normal.c | 6 ++--
26 lib/pmf/pmf_main.c | 19 +++++------
27 plat/hisilicon/hikey/hikey_bl1_setup.c | 21 ++-----------
28 plat/hisilicon/hikey960/hikey960_bl1_setup.c | 16 ++--------
29 plat/hisilicon/poplar/bl1_plat_setup.c | 13 ++------
30 plat/mediatek/mt6795/bl31_plat_setup.c | 11 +++----
31 plat/mediatek/mt8173/bl31_plat_setup.c | 28 +++--------------
32 plat/nvidia/tegra/common/tegra_bl31_setup.c | 33 +++++++-------------
33 plat/rockchip/common/bl31_plat_setup.c | 13 ++------
34 services/std_svc/spm/spm_shim_private.h | 14 +++------
35 18 files changed, 103 insertions(+), 187 deletions(-)
36
37diff --git a/bl1/bl1_private.h b/bl1/bl1_private.h
38index 6ac3b8c67..42a74d22f 100644
39--- a/bl1/bl1_private.h
40+++ b/bl1/bl1_private.h
41@@ -1,5 +1,5 @@
42 /*
43- * Copyright (c) 2013-2016, ARM Limited and Contributors. All rights reserved.
44+ * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
45 *
46 * SPDX-License-Identifier: BSD-3-Clause
47 */
48@@ -8,18 +8,16 @@
49 #define __BL1_PRIVATE_H__
50
51 #include <types.h>
52+#include <utils_def.h>
53
54 /*******************************************************************************
55 * Declarations of linker defined symbols which will tell us where BL1 lives
56 * in Trusted ROM and RAM
57 ******************************************************************************/
58-extern uintptr_t __BL1_ROM_END__;
59-#define BL1_ROM_END (uintptr_t)(&__BL1_ROM_END__)
60+IMPORT_SYM(uintptr_t, __BL1_ROM_END__, BL1_ROM_END);
61
62-extern uintptr_t __BL1_RAM_START__;
63-extern uintptr_t __BL1_RAM_END__;
64-#define BL1_RAM_BASE (uintptr_t)(&__BL1_RAM_START__)
65-#define BL1_RAM_LIMIT (uintptr_t)(&__BL1_RAM_END__)
66+IMPORT_SYM(uintptr_t, __BL1_RAM_START__, BL1_RAM_BASE);
67+IMPORT_SYM(uintptr_t, __BL1_RAM_END__, BL1_RAM_LIMIT);
68
69 /******************************************
70 * Function prototypes
71diff --git a/common/runtime_svc.c b/common/runtime_svc.c
72index 0ea4cd093..de80f30c2 100644
73--- a/common/runtime_svc.c
74+++ b/common/runtime_svc.c
75@@ -1,5 +1,5 @@
76 /*
77- * Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved.
78+ * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
79 *
80 * SPDX-License-Identifier: BSD-3-Clause
81 */
82@@ -19,8 +19,6 @@
83 * 'rt_svc_descs_indices' array. This gives the index of the descriptor in the
84 * 'rt_svc_descs' array which contains the SMC handler.
85 ******************************************************************************/
86-#define RT_SVC_DESCS_START ((uintptr_t) (&__RT_SVC_DESCS_START__))
87-#define RT_SVC_DESCS_END ((uintptr_t) (&__RT_SVC_DESCS_END__))
88 uint8_t rt_svc_descs_indices[MAX_RT_SVCS];
89 static rt_svc_desc_t *rt_svc_descs;
90
91diff --git a/drivers/auth/img_parser_mod.c b/drivers/auth/img_parser_mod.c
92index 6a0107115..63160141d 100644
93--- a/drivers/auth/img_parser_mod.c
94+++ b/drivers/auth/img_parser_mod.c
95@@ -1,5 +1,5 @@
96 /*
97- * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
98+ * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
99 *
100 * SPDX-License-Identifier: BSD-3-Clause
101 */
102@@ -12,11 +12,10 @@
103 #include <limits.h>
104 #include <stdint.h>
105 #include <string.h>
106+#include <utils_def.h>
107
108-extern uintptr_t __PARSER_LIB_DESCS_START__;
109-extern uintptr_t __PARSER_LIB_DESCS_END__;
110-#define PARSER_LIB_DESCS_START ((uintptr_t) (&__PARSER_LIB_DESCS_START__))
111-#define PARSER_LIB_DESCS_END ((uintptr_t) (&__PARSER_LIB_DESCS_END__))
112+IMPORT_SYM(uintptr_t, __PARSER_LIB_DESCS_START__, PARSER_LIB_DESCS_START);
113+IMPORT_SYM(uintptr_t, __PARSER_LIB_DESCS_END__, PARSER_LIB_DESCS_END);
114 static unsigned int parser_lib_indices[IMG_MAX_TYPES];
115 static img_parser_lib_desc_t *parser_lib_descs;
116
117diff --git a/include/common/bl_common.h b/include/common/bl_common.h
118index 4ef916f53..09a394dd1 100644
119--- a/include/common/bl_common.h
120+++ b/include/common/bl_common.h
121@@ -64,33 +64,41 @@
122 #include <types.h>
123 #include <utils_def.h> /* To retain compatibility */
124
125+
126 /*
127 * Declarations of linker defined symbols to help determine memory layout of
128 * BL images
129 */
130 #if SEPARATE_CODE_AND_RODATA
131-extern uintptr_t __TEXT_START__;
132-extern uintptr_t __TEXT_END__;
133-extern uintptr_t __RODATA_START__;
134-extern uintptr_t __RODATA_END__;
135+IMPORT_SYM(unsigned long, __TEXT_START__, BL_CODE_BASE);
136+IMPORT_SYM(unsigned long, __TEXT_END__, BL_CODE_END);
137+IMPORT_SYM(unsigned long, __RODATA_START__, BL_RO_DATA_BASE);
138+IMPORT_SYM(unsigned long, __RODATA_END__, BL_RO_DATA_END);
139 #else
140-extern uintptr_t __RO_START__;
141-extern uintptr_t __RO_END__;
142+IMPORT_SYM(unsigned long, __RO_START__, BL_CODE_BASE);
143+IMPORT_SYM(unsigned long, __RO_END__, BL_CODE_END);
144 #endif
145
146 #if defined(IMAGE_BL2)
147-extern uintptr_t __BL2_END__;
148+IMPORT_SYM(unsigned long, __BL2_END__, BL2_END);
149 #elif defined(IMAGE_BL2U)
150-extern uintptr_t __BL2U_END__;
151+IMPORT_SYM(unsigned long, __BL2U_END__, BL2U_END);
152 #elif defined(IMAGE_BL31)
153-extern uintptr_t __BL31_END__;
154+IMPORT_SYM(unsigned long, __BL31_END__, BL31_END);
155 #elif defined(IMAGE_BL32)
156-extern uintptr_t __BL32_END__;
157+IMPORT_SYM(unsigned long, __BL32_END__, BL32_END);
158 #endif /* IMAGE_BLX */
159
160+/*
161+ * The next 2 constants identify the extents of the coherent memory region.
162+ * These addresses are used by the MMU setup code and therefore they must be
163+ * page-aligned. It is the responsibility of the linker script to ensure that
164+ * __COHERENT_RAM_START__ and __COHERENT_RAM_END__ linker symbols refer to
165+ * page-aligned addresses.
166+ */
167 #if USE_COHERENT_MEM
168-extern uintptr_t __COHERENT_RAM_START__;
169-extern uintptr_t __COHERENT_RAM_END__;
170+IMPORT_SYM(unsigned long, __COHERENT_RAM_START__, BL_COHERENT_RAM_BASE);
171+IMPORT_SYM(unsigned long, __COHERENT_RAM_END__, BL_COHERENT_RAM_END);
172 #endif
173
174 /*******************************************************************************
175diff --git a/include/common/runtime_svc.h b/include/common/runtime_svc.h
176index d12af227e..5d9fa3908 100644
177--- a/include/common/runtime_svc.h
178+++ b/include/common/runtime_svc.h
179@@ -122,8 +122,8 @@ CASSERT(RT_SVC_DESC_HANDLE == __builtin_offsetof(rt_svc_desc_t, handle), \
180 void runtime_svc_init(void);
181 uintptr_t handle_runtime_svc(uint32_t smc_fid, void *cookie, void *handle,
182 unsigned int flags);
183-extern uintptr_t __RT_SVC_DESCS_START__;
184-extern uintptr_t __RT_SVC_DESCS_END__;
185+IMPORT_SYM(uintptr_t, __RT_SVC_DESCS_START__, RT_SVC_DESCS_START);
186+IMPORT_SYM(uintptr_t, __RT_SVC_DESCS_END__, RT_SVC_DESCS_END);
187 void init_crash_reporting(void);
188
189 extern uint8_t rt_svc_descs_indices[MAX_RT_SVCS];
190diff --git a/include/lib/utils_def.h b/include/lib/utils_def.h
191index 4a5c3e0bc..8abc73c09 100644
192--- a/include/lib/utils_def.h
193+++ b/include/lib/utils_def.h
194@@ -1,5 +1,5 @@
195 /*
196- * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
197+ * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
198 *
199 * SPDX-License-Identifier: BSD-3-Clause
200 */
201@@ -99,4 +99,21 @@
202 ((ARM_ARCH_MAJOR > _maj) || \
203 ((ARM_ARCH_MAJOR == _maj) && (ARM_ARCH_MINOR >= _min)))
204
205+/*
206+ * Import an assembly or linker symbol as a C expression with the specified
207+ * type
208+ */
209+#define IMPORT_SYM(type, sym, name) \
210+ extern char sym[];\
211+ static const __attribute__((unused)) type name = (type) sym;
212+
213+/*
214+ * When the symbol is used to hold a pointer, its alignment can be asserted
215+ * with this macro. For example, if there is a linker symbol that is going to
216+ * be used as a 64-bit pointer, the value of the linker symbol must also be
217+ * aligned to 64 bit. This macro makes sure this is the case.
218+ */
219+#define ASSERT_SYM_PTR_ALIGN(sym) assert(((size_t)(sym) % __alignof__(*(sym))) == 0)
220+
221+
222 #endif /* __UTILS_DEF_H__ */
223diff --git a/include/plat/common/common_def.h b/include/plat/common/common_def.h
224index a841c3dbf..84923b9a7 100644
225--- a/include/plat/common/common_def.h
226+++ b/include/plat/common/common_def.h
227@@ -1,5 +1,5 @@
228 /*
229- * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
230+ * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
231 *
232 * SPDX-License-Identifier: BSD-3-Clause
233 */
234@@ -74,33 +74,13 @@
235 * page of it with the right memory attributes.
236 */
237 #if SEPARATE_CODE_AND_RODATA
238-#define BL_CODE_BASE (unsigned long)(&__TEXT_START__)
239-#define BL_CODE_END (unsigned long)(&__TEXT_END__)
240-#define BL_RO_DATA_BASE (unsigned long)(&__RODATA_START__)
241-#define BL_RO_DATA_END (unsigned long)(&__RODATA_END__)
242
243 #define BL1_CODE_END BL_CODE_END
244-#define BL1_RO_DATA_BASE (unsigned long)(&__RODATA_START__)
245+#define BL1_RO_DATA_BASE BL_RO_DATA_BASE
246 #define BL1_RO_DATA_END round_up(BL1_ROM_END, PAGE_SIZE)
247 #else
248-#define BL_CODE_BASE (unsigned long)(&__RO_START__)
249-#define BL_CODE_END (unsigned long)(&__RO_END__)
250 #define BL_RO_DATA_BASE 0
251 #define BL_RO_DATA_END 0
252-
253 #define BL1_CODE_END round_up(BL1_ROM_END, PAGE_SIZE)
254-#define BL1_RO_DATA_BASE 0
255-#define BL1_RO_DATA_END 0
256 #endif /* SEPARATE_CODE_AND_RODATA */
257-
258-/*
259- * The next 2 constants identify the extents of the coherent memory region.
260- * These addresses are used by the MMU setup code and therefore they must be
261- * page-aligned. It is the responsibility of the linker script to ensure that
262- * __COHERENT_RAM_START__ and __COHERENT_RAM_END__ linker symbols refer to
263- * page-aligned addresses.
264- */
265-#define BL_COHERENT_RAM_BASE (unsigned long)(&__COHERENT_RAM_START__)
266-#define BL_COHERENT_RAM_END (unsigned long)(&__COHERENT_RAM_END__)
267-
268 #endif /* __COMMON_DEF_H__ */
269diff --git a/include/services/secure_partition.h b/include/services/secure_partition.h
270index 93df2a137..f68f711be 100644
271--- a/include/services/secure_partition.h
272+++ b/include/services/secure_partition.h
273@@ -1,5 +1,5 @@
274 /*
275- * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
276+ * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
277 *
278 * SPDX-License-Identifier: BSD-3-Clause
279 */
280@@ -11,15 +11,11 @@
281 #include <types.h>
282 #include <utils_def.h>
283
284-/* Linker symbols */
285-extern uintptr_t __SP_IMAGE_XLAT_TABLES_START__;
286-extern uintptr_t __SP_IMAGE_XLAT_TABLES_END__;
287+/* Import linker symbols */
288+IMPORT_SYM(uintptr_t, __SP_IMAGE_XLAT_TABLES_START__, SP_IMAGE_XLAT_TABLES_START);
289+IMPORT_SYM(uintptr_t, __SP_IMAGE_XLAT_TABLES_END__, SP_IMAGE_XLAT_TABLES_END);
290
291 /* Definitions */
292-#define SP_IMAGE_XLAT_TABLES_START \
293- (uintptr_t)(&__SP_IMAGE_XLAT_TABLES_START__)
294-#define SP_IMAGE_XLAT_TABLES_END \
295- (uintptr_t)(&__SP_IMAGE_XLAT_TABLES_END__)
296 #define SP_IMAGE_XLAT_TABLES_SIZE \
297 (SP_IMAGE_XLAT_TABLES_END - SP_IMAGE_XLAT_TABLES_START)
298
299diff --git a/lib/locks/bakery/bakery_lock_normal.c b/lib/locks/bakery/bakery_lock_normal.c
300index 8f59215e3..37697f521 100644
301--- a/lib/locks/bakery/bakery_lock_normal.c
302+++ b/lib/locks/bakery/bakery_lock_normal.c
303@@ -1,5 +1,5 @@
304 /*
305- * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
306+ * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
307 *
308 * SPDX-License-Identifier: BSD-3-Clause
309 */
310@@ -10,6 +10,7 @@
311 #include <cpu_data.h>
312 #include <platform.h>
313 #include <string.h>
314+#include <utils_def.h>
315
316 /*
317 * Functions in this file implement Bakery Algorithm for mutual exclusion with the
318@@ -49,8 +50,7 @@ CASSERT((PLAT_PERCPU_BAKERY_LOCK_SIZE & (CACHE_WRITEBACK_GRANULE - 1)) == 0, \
319 * Use the linker defined symbol which has evaluated the size reqiurement.
320 * This is not as efficient as using a platform defined constant
321 */
322-extern void *__PERCPU_BAKERY_LOCK_SIZE__;
323-#define PERCPU_BAKERY_LOCK_SIZE ((uintptr_t)&__PERCPU_BAKERY_LOCK_SIZE__)
324+IMPORT_SYM(uintptr_t, __PERCPU_BAKERY_LOCK_SIZE__, PERCPU_BAKERY_LOCK_SIZE);
325 #endif
326
327 #define get_bakery_info(cpu_ix, lock) \
328diff --git a/lib/pmf/pmf_main.c b/lib/pmf/pmf_main.c
329index 2cf260ec1..0208948fe 100644
330--- a/lib/pmf/pmf_main.c
331+++ b/lib/pmf/pmf_main.c
332@@ -1,5 +1,5 @@
333 /*
334- * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
335+ * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
336 *
337 * SPDX-License-Identifier: BSD-3-Clause
338 */
339@@ -11,6 +11,7 @@
340 #include <platform.h>
341 #include <pmf.h>
342 #include <string.h>
343+#include <utils_def.h>
344
345 /*******************************************************************************
346 * The 'pmf_svc_descs' array holds the PMF service descriptors exported by
347@@ -21,16 +22,12 @@
348 * index of the descriptor in the 'pmf_svc_descs' array which contains the
349 * service function pointers.
350 ******************************************************************************/
351-extern uintptr_t __PMF_SVC_DESCS_START__;
352-extern uintptr_t __PMF_SVC_DESCS_END__;
353-#define PMF_SVC_DESCS_START ((uintptr_t)(&__PMF_SVC_DESCS_START__))
354-#define PMF_SVC_DESCS_END ((uintptr_t)(&__PMF_SVC_DESCS_END__))
355-extern void *__PERCPU_TIMESTAMP_SIZE__;
356-#define PMF_PERCPU_TIMESTAMP_SIZE ((uintptr_t)&__PERCPU_TIMESTAMP_SIZE__)
357-extern uintptr_t __PMF_TIMESTAMP_START__;
358-#define PMF_TIMESTAMP_ARRAY_START ((uintptr_t)&__PMF_TIMESTAMP_START__)
359-extern uintptr_t __PMF_TIMESTAMP_END__;
360-#define PMF_TIMESTAMP_ARRAY_END ((uintptr_t)&__PMF_TIMESTAMP_END__)
361+
362+IMPORT_SYM(uintptr_t, __PMF_SVC_DESCS_START__, PMF_SVC_DESCS_START);
363+IMPORT_SYM(uintptr_t, __PMF_SVC_DESCS_END__, PMF_SVC_DESCS_END);
364+IMPORT_SYM(uintptr_t, __PERCPU_TIMESTAMP_SIZE__, PMF_PERCPU_TIMESTAMP_SIZE);
365+IMPORT_SYM(intptr_t, __PMF_TIMESTAMP_START__, PMF_TIMESTAMP_ARRAY_START);
366+IMPORT_SYM(uintptr_t, __PMF_TIMESTAMP_END__, PMF_TIMESTAMP_ARRAY_END);
367
368 #define PMF_SVC_DESCS_MAX 10
369
370diff --git a/plat/hisilicon/hikey/hikey_bl1_setup.c b/plat/hisilicon/hikey/hikey_bl1_setup.c
371index 69b194a53..9ede1dbc7 100644
372--- a/plat/hisilicon/hikey/hikey_bl1_setup.c
373+++ b/plat/hisilicon/hikey/hikey_bl1_setup.c
374@@ -23,23 +23,6 @@
375 #include "hikey_def.h"
376 #include "hikey_private.h"
377
378-/*
379- * Declarations of linker defined symbols which will help us find the layout
380- * of trusted RAM
381- */
382-extern unsigned long __COHERENT_RAM_START__;
383-extern unsigned long __COHERENT_RAM_END__;
384-
385-/*
386- * The next 2 constants identify the extents of the coherent memory region.
387- * These addresses are used by the MMU setup code and therefore they must be
388- * page-aligned. It is the responsibility of the linker script to ensure that
389- * __COHERENT_RAM_START__ and __COHERENT_RAM_END__ linker symbols refer to
390- * page-aligned addresses.
391- */
392-#define BL1_COHERENT_RAM_BASE (unsigned long)(&__COHERENT_RAM_START__)
393-#define BL1_COHERENT_RAM_LIMIT (unsigned long)(&__COHERENT_RAM_END__)
394-
395 /* Data structure which holds the extents of the trusted RAM for BL1 */
396 static meminfo_t bl1_tzram_layout;
397
398@@ -103,8 +86,8 @@ void bl1_plat_arch_setup(void)
399 bl1_tzram_layout.total_size,
400 BL1_RO_BASE,
401 BL1_RO_LIMIT,
402- BL1_COHERENT_RAM_BASE,
403- BL1_COHERENT_RAM_LIMIT);
404+ BL_COHERENT_RAM_BASE,
405+ BL_COHERENT_RAM_END);
406 }
407
408 /*
409diff --git a/plat/hisilicon/hikey960/hikey960_bl1_setup.c b/plat/hisilicon/hikey960/hikey960_bl1_setup.c
410index 9cadba0bb..6a07f0924 100644
411--- a/plat/hisilicon/hikey960/hikey960_bl1_setup.c
412+++ b/plat/hisilicon/hikey960/hikey960_bl1_setup.c
413@@ -37,18 +37,6 @@ enum {
414 * Declarations of linker defined symbols which will help us find the layout
415 * of trusted RAM
416 */
417-extern unsigned long __COHERENT_RAM_START__;
418-extern unsigned long __COHERENT_RAM_END__;
419-
420-/*
421- * The next 2 constants identify the extents of the coherent memory region.
422- * These addresses are used by the MMU setup code and therefore they must be
423- * page-aligned. It is the responsibility of the linker script to ensure that
424- * __COHERENT_RAM_START__ and __COHERENT_RAM_END__ linker symbols refer to
425- * page-aligned addresses.
426- */
427-#define BL1_COHERENT_RAM_BASE (unsigned long)(&__COHERENT_RAM_START__)
428-#define BL1_COHERENT_RAM_LIMIT (unsigned long)(&__COHERENT_RAM_END__)
429
430 /* Data structure which holds the extents of the trusted RAM for BL1 */
431 static meminfo_t bl1_tzram_layout;
432@@ -131,8 +119,8 @@ void bl1_plat_arch_setup(void)
433 bl1_tzram_layout.total_size,
434 BL1_RO_BASE,
435 BL1_RO_LIMIT,
436- BL1_COHERENT_RAM_BASE,
437- BL1_COHERENT_RAM_LIMIT);
438+ BL_COHERENT_RAM_BASE,
439+ BL_COHERENT_RAM_END);
440 }
441
442 static void hikey960_ufs_reset(void)
443diff --git a/plat/hisilicon/poplar/bl1_plat_setup.c b/plat/hisilicon/poplar/bl1_plat_setup.c
444index 39551135f..25eed5938 100644
445--- a/plat/hisilicon/poplar/bl1_plat_setup.c
446+++ b/plat/hisilicon/poplar/bl1_plat_setup.c
447@@ -1,5 +1,5 @@
448 /*
449- * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
450+ * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
451 *
452 * SPDX-License-Identifier: BSD-3-Clause
453 */
454@@ -23,13 +23,6 @@
455 #include "hi3798cv200.h"
456 #include "plat_private.h"
457
458-/* Symbols from link script for conherent section */
459-extern unsigned long __COHERENT_RAM_START__;
460-extern unsigned long __COHERENT_RAM_END__;
461-
462-#define BL1_COHERENT_RAM_BASE (unsigned long)(&__COHERENT_RAM_START__)
463-#define BL1_COHERENT_RAM_LIMIT (unsigned long)(&__COHERENT_RAM_END__)
464-
465 /* Data structure which holds the extents of the trusted RAM for BL1 */
466 static meminfo_t bl1_tzram_layout;
467
468@@ -92,8 +85,8 @@ void bl1_plat_arch_setup(void)
469 bl1_tzram_layout.total_size,
470 BL1_RO_BASE, /* l-loader and BL1 ROM */
471 BL1_RO_LIMIT,
472- BL1_COHERENT_RAM_BASE,
473- BL1_COHERENT_RAM_LIMIT);
474+ BL_COHERENT_RAM_BASE,
475+ BL_COHERENT_RAM_END);
476 }
477
478 void bl1_platform_setup(void)
479diff --git a/plat/mediatek/mt6795/bl31_plat_setup.c b/plat/mediatek/mt6795/bl31_plat_setup.c
480index 803f1ed85..32f015721 100644
481--- a/plat/mediatek/mt6795/bl31_plat_setup.c
482+++ b/plat/mediatek/mt6795/bl31_plat_setup.c
483@@ -1,5 +1,5 @@
484 /*
485- * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
486+ * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
487 *
488 * SPDX-License-Identifier: BSD-3-Clause
489 */
490@@ -21,22 +21,21 @@
491 #include <plat_private.h>
492 #include <platform.h>
493 #include <string.h>
494+#include <utils_def.h>
495 #include <xlat_tables.h>
496+
497 /*******************************************************************************
498 * Declarations of linker defined symbols which will help us find the layout
499 * of trusted SRAM
500 ******************************************************************************/
501-unsigned long __RO_START__;
502-unsigned long __RO_END__;
503-
504 /*
505 * The next 2 constants identify the extents of the code & RO data region.
506 * These addresses are used by the MMU setup code and therefore they must be
507 * page-aligned. It is the responsibility of the linker script to ensure that
508 * __RO_START__ and __RO_END__ linker symbols refer to page-aligned addresses.
509 */
510-#define BL31_RO_BASE (unsigned long)(&__RO_START__)
511-#define BL31_RO_LIMIT (unsigned long)(&__RO_END__)
512+IMPORT_SYM(unsigned long, __RO_START__, BL31_RO_BASE);
513+IMPORT_SYM(unsigned long, __RO_END__, BL31_RO_LIMIT);
514
515 /*
516 * Placeholder variables for copying the arguments that have been passed to
517diff --git a/plat/mediatek/mt8173/bl31_plat_setup.c b/plat/mediatek/mt8173/bl31_plat_setup.c
518index 7b2930771..e51bdbb9e 100644
519--- a/plat/mediatek/mt8173/bl31_plat_setup.c
520+++ b/plat/mediatek/mt8173/bl31_plat_setup.c
521@@ -1,5 +1,5 @@
522 /*
523- * Copyright (c) 2013-2016, ARM Limited and Contributors. All rights reserved.
524+ * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
525 *
526 * SPDX-License-Identifier: BSD-3-Clause
527 */
528@@ -17,24 +17,6 @@
529 #include <platform.h>
530 #include <spm.h>
531
532-/*******************************************************************************
533- * Declarations of linker defined symbols which will help us find the layout
534- * of trusted SRAM
535- ******************************************************************************/
536-unsigned long __RO_START__;
537-unsigned long __RO_END__;
538-
539-/*
540- * The next 3 constants identify the extents of the code, RO data region and the
541- * limit of the BL31 image. These addresses are used by the MMU setup code and
542- * therefore they must be page-aligned. It is the responsibility of the linker
543- * script to ensure that __RO_START__, __RO_END__ & __BL31_END__ linker symbols
544- * refer to page-aligned addresses.
545- */
546-#define BL31_RO_BASE (unsigned long)(&__RO_START__)
547-#define BL31_RO_LIMIT (unsigned long)(&__RO_END__)
548-#define BL31_END (unsigned long)(&__BL31_END__)
549-
550 static entry_point_info_t bl32_ep_info;
551 static entry_point_info_t bl33_ep_info;
552
553@@ -156,10 +138,10 @@ void bl31_plat_arch_setup(void)
554 plat_cci_init();
555 plat_cci_enable();
556
557- plat_configure_mmu_el3(BL31_RO_BASE,
558- BL_COHERENT_RAM_END - BL31_RO_BASE,
559- BL31_RO_BASE,
560- BL31_RO_LIMIT,
561+ plat_configure_mmu_el3(BL_CODE_BASE,
562+ BL_COHERENT_RAM_END - BL_CODE_BASE,
563+ BL_CODE_BASE,
564+ BL_CODE_END,
565 BL_COHERENT_RAM_BASE,
566 BL_COHERENT_RAM_END);
567 }
568diff --git a/plat/nvidia/tegra/common/tegra_bl31_setup.c b/plat/nvidia/tegra/common/tegra_bl31_setup.c
569index d89ad7b94..2fe4e7dbc 100644
570--- a/plat/nvidia/tegra/common/tegra_bl31_setup.c
571+++ b/plat/nvidia/tegra/common/tegra_bl31_setup.c
572@@ -1,5 +1,5 @@
573 /*
574- * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
575+ * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
576 *
577 * SPDX-License-Identifier: BSD-3-Clause
578 */
579@@ -23,6 +23,7 @@
580 #include <string.h>
581 #include <tegra_def.h>
582 #include <tegra_private.h>
583+#include <utils_def.h>
584
585 /* length of Trusty's input parameters (in bytes) */
586 #define TRUSTY_PARAMS_LEN_BYTES (4096*2)
587@@ -33,29 +34,17 @@ extern void zeromem16(void *mem, unsigned int length);
588 * Declarations of linker defined symbols which will help us find the layout
589 * of trusted SRAM
590 ******************************************************************************/
591-extern unsigned long __TEXT_START__;
592-extern unsigned long __TEXT_END__;
593-extern unsigned long __RW_START__;
594-extern unsigned long __RW_END__;
595-extern unsigned long __RODATA_START__;
596-extern unsigned long __RODATA_END__;
597-extern unsigned long __BL31_END__;
598+
599+IMPORT_SYM(unsigned long, __RW_START__, BL31_RW_START);
600+IMPORT_SYM(unsigned long, __RW_END__, BL31_RW_END);
601+IMPORT_SYM(unsigned long, __RODATA_START__, BL31_RODATA_BASE);
602+IMPORT_SYM(unsigned long, __RODATA_END__, BL31_RODATA_END);
603+IMPORT_SYM(unsigned long, __TEXT_START__, TEXT_START);
604+IMPORT_SYM(unsigned long, __TEXT_END__, TEXT_END);
605
606 extern uint64_t tegra_bl31_phys_base;
607 extern uint64_t tegra_console_base;
608
609-/*
610- * The next 3 constants identify the extents of the code, RO data region and the
611- * limit of the BL3-1 image. These addresses are used by the MMU setup code and
612- * therefore they must be page-aligned. It is the responsibility of the linker
613- * script to ensure that __RO_START__, __RO_END__ & __BL31_END__ linker symbols
614- * refer to page-aligned addresses.
615- */
616-#define BL31_RW_START (unsigned long)(&__RW_START__)
617-#define BL31_RW_END (unsigned long)(&__RW_END__)
618-#define BL31_RODATA_BASE (unsigned long)(&__RODATA_START__)
619-#define BL31_RODATA_END (unsigned long)(&__RODATA_END__)
620-#define BL31_END (unsigned long)(&__BL31_END__)
621
622 static entry_point_info_t bl33_image_ep_info, bl32_image_ep_info;
623 static plat_params_from_bl2_t plat_bl31_params_from_bl2 = {
624@@ -311,8 +300,8 @@ void bl31_plat_arch_setup(void)
625 unsigned long rw_size = BL31_RW_END - BL31_RW_START;
626 unsigned long rodata_start = BL31_RODATA_BASE;
627 unsigned long rodata_size = BL31_RODATA_END - BL31_RODATA_BASE;
628- unsigned long code_base = (unsigned long)(&__TEXT_START__);
629- unsigned long code_size = (unsigned long)(&__TEXT_END__) - code_base;
630+ unsigned long code_base = TEXT_START;
631+ unsigned long code_size = TEXT_END - TEXT_START;
632 const mmap_region_t *plat_mmio_map = NULL;
633 #if USE_COHERENT_MEM
634 unsigned long coh_start, coh_size;
635diff --git a/plat/rockchip/common/bl31_plat_setup.c b/plat/rockchip/common/bl31_plat_setup.c
636index 6199edae2..e5ee68f14 100644
637--- a/plat/rockchip/common/bl31_plat_setup.c
638+++ b/plat/rockchip/common/bl31_plat_setup.c
639@@ -1,5 +1,5 @@
640 /*
641- * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
642+ * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
643 *
644 * SPDX-License-Identifier: BSD-3-Clause
645 */
646@@ -17,21 +17,14 @@
647 #include <platform_def.h>
648 #include <uart_16550.h>
649
650-/*******************************************************************************
651- * Declarations of linker defined symbols which will help us find the layout
652- * of trusted SRAM
653- ******************************************************************************/
654-unsigned long __RO_START__;
655-unsigned long __RO_END__;
656-
657 /*
658 * The next 2 constants identify the extents of the code & RO data region.
659 * These addresses are used by the MMU setup code and therefore they must be
660 * page-aligned. It is the responsibility of the linker script to ensure that
661 * __RO_START__ and __RO_END__ linker symbols refer to page-aligned addresses.
662 */
663-#define BL31_RO_BASE (unsigned long)(&__RO_START__)
664-#define BL31_RO_LIMIT (unsigned long)(&__RO_END__)
665+IMPORT_SYM(unsigned long, __RO_START__, BL31_RO_BASE);
666+IMPORT_SYM(unsigned long, __RO_END__, BL31_RO_LIMIT);
667
668 static entry_point_info_t bl32_ep_info;
669 static entry_point_info_t bl33_ep_info;
670diff --git a/services/std_svc/spm/spm_shim_private.h b/services/std_svc/spm/spm_shim_private.h
671index ad953cde7..8408d1e04 100644
672--- a/services/std_svc/spm/spm_shim_private.h
673+++ b/services/std_svc/spm/spm_shim_private.h
674@@ -1,5 +1,5 @@
675 /*
676- * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
677+ * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
678 *
679 * SPDX-License-Identifier: BSD-3-Clause
680 */
681@@ -8,21 +8,17 @@
682 #define __SPM_SHIM_PRIVATE__
683
684 #include <types.h>
685+#include <utils_def.h>
686
687 /* Assembly source */
688-extern uintptr_t spm_shim_exceptions_ptr;
689+IMPORT_SYM(uintptr_t, spm_shim_exceptions_ptr, SPM_SHIM_EXCEPTIONS_PTR);
690
691 /* Linker symbols */
692-extern uintptr_t __SPM_SHIM_EXCEPTIONS_START__;
693-extern uintptr_t __SPM_SHIM_EXCEPTIONS_END__;
694+IMPORT_SYM(uintptr_t, __SPM_SHIM_EXCEPTIONS_START__, SPM_SHIM_EXCEPTIONS_START);
695+IMPORT_SYM(uintptr_t, __SPM_SHIM_EXCEPTIONS_END__, SPM_SHIM_EXCEPTIONS_END);
696
697 /* Definitions */
698-#define SPM_SHIM_EXCEPTIONS_PTR (uintptr_t)(&spm_shim_exceptions_ptr)
699
700-#define SPM_SHIM_EXCEPTIONS_START \
701- (uintptr_t)(&__SPM_SHIM_EXCEPTIONS_START__)
702-#define SPM_SHIM_EXCEPTIONS_END \
703- (uintptr_t)(&__SPM_SHIM_EXCEPTIONS_END__)
704 #define SPM_SHIM_EXCEPTIONS_SIZE \
705 (SPM_SHIM_EXCEPTIONS_END - SPM_SHIM_EXCEPTIONS_START)
706
707--
7082.25.1
709