Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1 | /* |
Mark Dykes | 615ec97 | 2020-01-22 21:52:44 +0000 | [diff] [blame] | 2 | * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved. |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 7 | #include <platform_def.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 8 | |
| 9 | #include <lib/xlat_tables/xlat_tables_defs.h> |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 10 | |
| 11 | OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT) |
| 12 | OUTPUT_ARCH(PLATFORM_LINKER_ARCH) |
Jeenu Viswambharan | 2a30a75 | 2014-03-11 11:06:45 +0000 | [diff] [blame] | 13 | ENTRY(bl31_entrypoint) |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 14 | |
| 15 | |
| 16 | MEMORY { |
Juan Castillo | fd8c077 | 2014-09-16 10:40:35 +0100 | [diff] [blame] | 17 | RAM (rwx): ORIGIN = BL31_BASE, LENGTH = BL31_LIMIT - BL31_BASE |
Samuel Holland | 31a14e1 | 2018-10-17 21:40:18 -0500 | [diff] [blame] | 18 | #if SEPARATE_NOBITS_REGION |
| 19 | NOBITS (rw!a): ORIGIN = BL31_NOBITS_BASE, LENGTH = BL31_NOBITS_LIMIT - BL31_NOBITS_BASE |
| 20 | #else |
| 21 | #define NOBITS RAM |
| 22 | #endif |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 23 | } |
| 24 | |
Caesar Wang | d90f43e | 2016-10-11 09:36:00 +0800 | [diff] [blame] | 25 | #ifdef PLAT_EXTRA_LD_SCRIPT |
| 26 | #include <plat.ld.S> |
| 27 | #endif |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 28 | |
| 29 | SECTIONS |
| 30 | { |
Sandrine Bailleux | 8d69a03 | 2013-11-27 09:38:52 +0000 | [diff] [blame] | 31 | . = BL31_BASE; |
Antonio Nino Diaz | 2ce2b09 | 2017-11-15 11:45:35 +0000 | [diff] [blame] | 32 | ASSERT(. == ALIGN(PAGE_SIZE), |
Sandrine Bailleux | 8d69a03 | 2013-11-27 09:38:52 +0000 | [diff] [blame] | 33 | "BL31_BASE address is not aligned on a page boundary.") |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 34 | |
Soby Mathew | 4e28c20 | 2018-10-14 08:09:22 +0100 | [diff] [blame] | 35 | __BL31_START__ = .; |
| 36 | |
Sandrine Bailleux | f91f144 | 2016-07-08 14:37:40 +0100 | [diff] [blame] | 37 | #if SEPARATE_CODE_AND_RODATA |
| 38 | .text . : { |
| 39 | __TEXT_START__ = .; |
| 40 | *bl31_entrypoint.o(.text*) |
Samuel Holland | 23f5e54 | 2019-10-20 16:11:25 -0500 | [diff] [blame] | 41 | *(SORT_BY_ALIGNMENT(.text*)) |
Sandrine Bailleux | f91f144 | 2016-07-08 14:37:40 +0100 | [diff] [blame] | 42 | *(.vectors) |
Roberto Vargas | d93fde3 | 2018-04-11 11:53:31 +0100 | [diff] [blame] | 43 | . = ALIGN(PAGE_SIZE); |
Sandrine Bailleux | f91f144 | 2016-07-08 14:37:40 +0100 | [diff] [blame] | 44 | __TEXT_END__ = .; |
| 45 | } >RAM |
| 46 | |
| 47 | .rodata . : { |
| 48 | __RODATA_START__ = .; |
Samuel Holland | 23f5e54 | 2019-10-20 16:11:25 -0500 | [diff] [blame] | 49 | *(SORT_BY_ALIGNMENT(.rodata*)) |
Sandrine Bailleux | f91f144 | 2016-07-08 14:37:40 +0100 | [diff] [blame] | 50 | |
| 51 | /* Ensure 8-byte alignment for descriptors and ensure inclusion */ |
| 52 | . = ALIGN(8); |
| 53 | __RT_SVC_DESCS_START__ = .; |
| 54 | KEEP(*(rt_svc_descs)) |
| 55 | __RT_SVC_DESCS_END__ = .; |
| 56 | |
| 57 | #if ENABLE_PMF |
| 58 | /* Ensure 8-byte alignment for descriptors and ensure inclusion */ |
| 59 | . = ALIGN(8); |
| 60 | __PMF_SVC_DESCS_START__ = .; |
| 61 | KEEP(*(pmf_svc_descs)) |
| 62 | __PMF_SVC_DESCS_END__ = .; |
| 63 | #endif /* ENABLE_PMF */ |
| 64 | |
| 65 | /* |
| 66 | * Ensure 8-byte alignment for cpu_ops so that its fields are also |
| 67 | * aligned. Also ensure cpu_ops inclusion. |
| 68 | */ |
| 69 | . = ALIGN(8); |
| 70 | __CPU_OPS_START__ = .; |
| 71 | KEEP(*(cpu_ops)) |
| 72 | __CPU_OPS_END__ = .; |
| 73 | |
Soby Mathew | 4e28c20 | 2018-10-14 08:09:22 +0100 | [diff] [blame] | 74 | /* |
Soby Mathew | 2b3fc1d | 2018-12-12 14:33:11 +0000 | [diff] [blame] | 75 | * Keep the .got section in the RO section as it is patched |
Soby Mathew | 4e28c20 | 2018-10-14 08:09:22 +0100 | [diff] [blame] | 76 | * prior to enabling the MMU and having the .got in RO is better for |
Soby Mathew | 2b3fc1d | 2018-12-12 14:33:11 +0000 | [diff] [blame] | 77 | * security. GOT is a table of addresses so ensure 8-byte alignment. |
Soby Mathew | 4e28c20 | 2018-10-14 08:09:22 +0100 | [diff] [blame] | 78 | */ |
Soby Mathew | 2b3fc1d | 2018-12-12 14:33:11 +0000 | [diff] [blame] | 79 | . = ALIGN(8); |
Soby Mathew | 4e28c20 | 2018-10-14 08:09:22 +0100 | [diff] [blame] | 80 | __GOT_START__ = .; |
| 81 | *(.got) |
| 82 | __GOT_END__ = .; |
| 83 | |
Jeenu Viswambharan | e3f2200 | 2017-09-22 08:32:10 +0100 | [diff] [blame] | 84 | /* Place pubsub sections for events */ |
| 85 | . = ALIGN(8); |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 86 | #include <lib/el3_runtime/pubsub_events.h> |
Jeenu Viswambharan | e3f2200 | 2017-09-22 08:32:10 +0100 | [diff] [blame] | 87 | |
Roberto Vargas | d93fde3 | 2018-04-11 11:53:31 +0100 | [diff] [blame] | 88 | . = ALIGN(PAGE_SIZE); |
Sandrine Bailleux | f91f144 | 2016-07-08 14:37:40 +0100 | [diff] [blame] | 89 | __RODATA_END__ = .; |
| 90 | } >RAM |
| 91 | #else |
Sandrine Bailleux | 8d69a03 | 2013-11-27 09:38:52 +0000 | [diff] [blame] | 92 | ro . : { |
| 93 | __RO_START__ = .; |
Andrew Thoelke | e01ea34 | 2014-03-18 07:13:52 +0000 | [diff] [blame] | 94 | *bl31_entrypoint.o(.text*) |
Samuel Holland | 23f5e54 | 2019-10-20 16:11:25 -0500 | [diff] [blame] | 95 | *(SORT_BY_ALIGNMENT(.text*)) |
| 96 | *(SORT_BY_ALIGNMENT(.rodata*)) |
Achin Gupta | 7421b46 | 2014-02-01 18:53:26 +0000 | [diff] [blame] | 97 | |
Andrew Thoelke | e01ea34 | 2014-03-18 07:13:52 +0000 | [diff] [blame] | 98 | /* Ensure 8-byte alignment for descriptors and ensure inclusion */ |
Achin Gupta | 7421b46 | 2014-02-01 18:53:26 +0000 | [diff] [blame] | 99 | . = ALIGN(8); |
| 100 | __RT_SVC_DESCS_START__ = .; |
Andrew Thoelke | e01ea34 | 2014-03-18 07:13:52 +0000 | [diff] [blame] | 101 | KEEP(*(rt_svc_descs)) |
Achin Gupta | 7421b46 | 2014-02-01 18:53:26 +0000 | [diff] [blame] | 102 | __RT_SVC_DESCS_END__ = .; |
| 103 | |
Yatharth Kochar | 9518d02 | 2016-03-11 14:20:19 +0000 | [diff] [blame] | 104 | #if ENABLE_PMF |
| 105 | /* Ensure 8-byte alignment for descriptors and ensure inclusion */ |
| 106 | . = ALIGN(8); |
| 107 | __PMF_SVC_DESCS_START__ = .; |
| 108 | KEEP(*(pmf_svc_descs)) |
| 109 | __PMF_SVC_DESCS_END__ = .; |
| 110 | #endif /* ENABLE_PMF */ |
| 111 | |
Soby Mathew | c704cbc | 2014-08-14 11:33:56 +0100 | [diff] [blame] | 112 | /* |
| 113 | * Ensure 8-byte alignment for cpu_ops so that its fields are also |
| 114 | * aligned. Also ensure cpu_ops inclusion. |
| 115 | */ |
| 116 | . = ALIGN(8); |
| 117 | __CPU_OPS_START__ = .; |
| 118 | KEEP(*(cpu_ops)) |
| 119 | __CPU_OPS_END__ = .; |
| 120 | |
Soby Mathew | 2b3fc1d | 2018-12-12 14:33:11 +0000 | [diff] [blame] | 121 | /* |
| 122 | * Keep the .got section in the RO section as it is patched |
| 123 | * prior to enabling the MMU and having the .got in RO is better for |
| 124 | * security. GOT is a table of addresses so ensure 8-byte alignment. |
| 125 | */ |
| 126 | . = ALIGN(8); |
| 127 | __GOT_START__ = .; |
| 128 | *(.got) |
| 129 | __GOT_END__ = .; |
| 130 | |
Jeenu Viswambharan | e3f2200 | 2017-09-22 08:32:10 +0100 | [diff] [blame] | 131 | /* Place pubsub sections for events */ |
| 132 | . = ALIGN(8); |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 133 | #include <lib/el3_runtime/pubsub_events.h> |
Jeenu Viswambharan | e3f2200 | 2017-09-22 08:32:10 +0100 | [diff] [blame] | 134 | |
Achin Gupta | b739f22 | 2014-01-18 16:50:09 +0000 | [diff] [blame] | 135 | *(.vectors) |
Sandrine Bailleux | 8d69a03 | 2013-11-27 09:38:52 +0000 | [diff] [blame] | 136 | __RO_END_UNALIGNED__ = .; |
| 137 | /* |
| 138 | * Memory page(s) mapped to this section will be marked as read-only, |
| 139 | * executable. No RW data from the next section must creep in. |
| 140 | * Ensure the rest of the current memory page is unused. |
| 141 | */ |
Roberto Vargas | d93fde3 | 2018-04-11 11:53:31 +0100 | [diff] [blame] | 142 | . = ALIGN(PAGE_SIZE); |
Sandrine Bailleux | 8d69a03 | 2013-11-27 09:38:52 +0000 | [diff] [blame] | 143 | __RO_END__ = .; |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 144 | } >RAM |
Sandrine Bailleux | f91f144 | 2016-07-08 14:37:40 +0100 | [diff] [blame] | 145 | #endif |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 146 | |
Soby Mathew | c704cbc | 2014-08-14 11:33:56 +0100 | [diff] [blame] | 147 | ASSERT(__CPU_OPS_END__ > __CPU_OPS_START__, |
| 148 | "cpu_ops not defined for this platform.") |
| 149 | |
Paul Beesley | db4e25a | 2019-10-14 15:27:12 +0000 | [diff] [blame] | 150 | #if SPM_MM |
Ard Biesheuvel | 447d56f | 2019-01-06 10:07:24 +0100 | [diff] [blame] | 151 | #ifndef SPM_SHIM_EXCEPTIONS_VMA |
| 152 | #define SPM_SHIM_EXCEPTIONS_VMA RAM |
| 153 | #endif |
| 154 | |
Antonio Nino Diaz | c41f206 | 2017-10-24 10:07:35 +0100 | [diff] [blame] | 155 | /* |
| 156 | * Exception vectors of the SPM shim layer. They must be aligned to a 2K |
| 157 | * address, but we need to place them in a separate page so that we can set |
| 158 | * individual permissions to them, so the actual alignment needed is 4K. |
| 159 | * |
| 160 | * There's no need to include this into the RO section of BL31 because it |
| 161 | * doesn't need to be accessed by BL31. |
| 162 | */ |
Antonio Nino Diaz | 2ce2b09 | 2017-11-15 11:45:35 +0000 | [diff] [blame] | 163 | spm_shim_exceptions : ALIGN(PAGE_SIZE) { |
Antonio Nino Diaz | c41f206 | 2017-10-24 10:07:35 +0100 | [diff] [blame] | 164 | __SPM_SHIM_EXCEPTIONS_START__ = .; |
| 165 | *(.spm_shim_exceptions) |
Roberto Vargas | d93fde3 | 2018-04-11 11:53:31 +0100 | [diff] [blame] | 166 | . = ALIGN(PAGE_SIZE); |
Antonio Nino Diaz | c41f206 | 2017-10-24 10:07:35 +0100 | [diff] [blame] | 167 | __SPM_SHIM_EXCEPTIONS_END__ = .; |
Ard Biesheuvel | 447d56f | 2019-01-06 10:07:24 +0100 | [diff] [blame] | 168 | } >SPM_SHIM_EXCEPTIONS_VMA AT>RAM |
| 169 | |
| 170 | PROVIDE(__SPM_SHIM_EXCEPTIONS_LMA__ = LOADADDR(spm_shim_exceptions)); |
| 171 | . = LOADADDR(spm_shim_exceptions) + SIZEOF(spm_shim_exceptions); |
Antonio Nino Diaz | c41f206 | 2017-10-24 10:07:35 +0100 | [diff] [blame] | 172 | #endif |
| 173 | |
Achin Gupta | e9c4a64 | 2015-09-11 16:03:13 +0100 | [diff] [blame] | 174 | /* |
| 175 | * Define a linker symbol to mark start of the RW memory area for this |
| 176 | * image. |
| 177 | */ |
| 178 | __RW_START__ = . ; |
| 179 | |
Douglas Raillard | 306593d | 2017-02-24 18:14:15 +0000 | [diff] [blame] | 180 | /* |
| 181 | * .data must be placed at a lower address than the stacks if the stack |
| 182 | * protector is enabled. Alternatively, the .data.stack_protector_canary |
| 183 | * section can be placed independently of the main .data section. |
| 184 | */ |
| 185 | .data . : { |
Sandrine Bailleux | 8d69a03 | 2013-11-27 09:38:52 +0000 | [diff] [blame] | 186 | __DATA_START__ = .; |
Samuel Holland | 23f5e54 | 2019-10-20 16:11:25 -0500 | [diff] [blame] | 187 | *(SORT_BY_ALIGNMENT(.data*)) |
Sandrine Bailleux | 8d69a03 | 2013-11-27 09:38:52 +0000 | [diff] [blame] | 188 | __DATA_END__ = .; |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 189 | } >RAM |
| 190 | |
Soby Mathew | 4e28c20 | 2018-10-14 08:09:22 +0100 | [diff] [blame] | 191 | /* |
| 192 | * .rela.dyn needs to come after .data for the read-elf utility to parse |
Soby Mathew | 2b3fc1d | 2018-12-12 14:33:11 +0000 | [diff] [blame] | 193 | * this section correctly. Ensure 8-byte alignment so that the fields of |
| 194 | * RELA data structure are aligned. |
Soby Mathew | 4e28c20 | 2018-10-14 08:09:22 +0100 | [diff] [blame] | 195 | */ |
Soby Mathew | 2b3fc1d | 2018-12-12 14:33:11 +0000 | [diff] [blame] | 196 | . = ALIGN(8); |
Soby Mathew | 4e28c20 | 2018-10-14 08:09:22 +0100 | [diff] [blame] | 197 | __RELA_START__ = .; |
| 198 | .rela.dyn . : { |
| 199 | } >RAM |
| 200 | __RELA_END__ = .; |
| 201 | |
Sandrine Bailleux | e2e0c65 | 2014-06-16 16:12:27 +0100 | [diff] [blame] | 202 | #ifdef BL31_PROGBITS_LIMIT |
Juan Castillo | 7d19941 | 2015-12-14 09:35:25 +0000 | [diff] [blame] | 203 | ASSERT(. <= BL31_PROGBITS_LIMIT, "BL31 progbits has exceeded its limit.") |
Sandrine Bailleux | e2e0c65 | 2014-06-16 16:12:27 +0100 | [diff] [blame] | 204 | #endif |
| 205 | |
Samuel Holland | 31a14e1 | 2018-10-17 21:40:18 -0500 | [diff] [blame] | 206 | #if SEPARATE_NOBITS_REGION |
| 207 | /* |
| 208 | * Define a linker symbol to mark end of the RW memory area for this |
| 209 | * image. |
| 210 | */ |
| 211 | __RW_END__ = .; |
| 212 | __BL31_END__ = .; |
| 213 | |
| 214 | ASSERT(. <= BL31_LIMIT, "BL31 image has exceeded its limit.") |
| 215 | |
| 216 | . = BL31_NOBITS_BASE; |
| 217 | ASSERT(. == ALIGN(PAGE_SIZE), |
| 218 | "BL31 NOBITS base address is not aligned on a page boundary.") |
| 219 | |
| 220 | __NOBITS_START__ = .; |
| 221 | #endif |
| 222 | |
Sandrine Bailleux | 8d69a03 | 2013-11-27 09:38:52 +0000 | [diff] [blame] | 223 | stacks (NOLOAD) : { |
| 224 | __STACKS_START__ = .; |
| 225 | *(tzfw_normal_stacks) |
| 226 | __STACKS_END__ = .; |
Samuel Holland | 31a14e1 | 2018-10-17 21:40:18 -0500 | [diff] [blame] | 227 | } >NOBITS |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 228 | |
Sandrine Bailleux | 8d69a03 | 2013-11-27 09:38:52 +0000 | [diff] [blame] | 229 | /* |
| 230 | * The .bss section gets initialised to 0 at runtime. |
Douglas Raillard | 21362a9 | 2016-12-02 13:51:54 +0000 | [diff] [blame] | 231 | * Its base address should be 16-byte aligned for better performance of the |
| 232 | * zero-initialization code. |
Sandrine Bailleux | 8d69a03 | 2013-11-27 09:38:52 +0000 | [diff] [blame] | 233 | */ |
Andrew Thoelke | e466c9f | 2015-09-10 11:39:36 +0100 | [diff] [blame] | 234 | .bss (NOLOAD) : ALIGN(16) { |
Sandrine Bailleux | 8d69a03 | 2013-11-27 09:38:52 +0000 | [diff] [blame] | 235 | __BSS_START__ = .; |
Samuel Holland | 23f5e54 | 2019-10-20 16:11:25 -0500 | [diff] [blame] | 236 | *(SORT_BY_ALIGNMENT(.bss*)) |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 237 | *(COMMON) |
Andrew Thoelke | e466c9f | 2015-09-10 11:39:36 +0100 | [diff] [blame] | 238 | #if !USE_COHERENT_MEM |
| 239 | /* |
| 240 | * Bakery locks are stored in normal .bss memory |
| 241 | * |
| 242 | * Each lock's data is spread across multiple cache lines, one per CPU, |
| 243 | * but multiple locks can share the same cache line. |
| 244 | * The compiler will allocate enough memory for one CPU's bakery locks, |
| 245 | * the remaining cache lines are allocated by the linker script |
| 246 | */ |
| 247 | . = ALIGN(CACHE_WRITEBACK_GRANULE); |
| 248 | __BAKERY_LOCK_START__ = .; |
Varun Wadekar | 77c382c | 2019-01-30 08:26:20 -0800 | [diff] [blame] | 249 | __PERCPU_BAKERY_LOCK_START__ = .; |
Andrew Thoelke | e466c9f | 2015-09-10 11:39:36 +0100 | [diff] [blame] | 250 | *(bakery_lock) |
| 251 | . = ALIGN(CACHE_WRITEBACK_GRANULE); |
Varun Wadekar | 77c382c | 2019-01-30 08:26:20 -0800 | [diff] [blame] | 252 | __PERCPU_BAKERY_LOCK_END__ = .; |
| 253 | __PERCPU_BAKERY_LOCK_SIZE__ = ABSOLUTE(__PERCPU_BAKERY_LOCK_END__ - __PERCPU_BAKERY_LOCK_START__); |
Andrew Thoelke | e466c9f | 2015-09-10 11:39:36 +0100 | [diff] [blame] | 254 | . = . + (__PERCPU_BAKERY_LOCK_SIZE__ * (PLATFORM_CORE_COUNT - 1)); |
| 255 | __BAKERY_LOCK_END__ = .; |
Roberto Vargas | 0099694 | 2017-11-13 13:41:58 +0000 | [diff] [blame] | 256 | |
| 257 | /* |
| 258 | * If BL31 doesn't use any bakery lock then __PERCPU_BAKERY_LOCK_SIZE__ |
| 259 | * will be zero. For this reason, the only two valid values for |
| 260 | * __PERCPU_BAKERY_LOCK_SIZE__ are 0 or the platform defined value |
| 261 | * PLAT_PERCPU_BAKERY_LOCK_SIZE. |
| 262 | */ |
Andrew Thoelke | e466c9f | 2015-09-10 11:39:36 +0100 | [diff] [blame] | 263 | #ifdef PLAT_PERCPU_BAKERY_LOCK_SIZE |
Roberto Vargas | 0099694 | 2017-11-13 13:41:58 +0000 | [diff] [blame] | 264 | ASSERT((__PERCPU_BAKERY_LOCK_SIZE__ == 0) || (__PERCPU_BAKERY_LOCK_SIZE__ == PLAT_PERCPU_BAKERY_LOCK_SIZE), |
Andrew Thoelke | e466c9f | 2015-09-10 11:39:36 +0100 | [diff] [blame] | 265 | "PLAT_PERCPU_BAKERY_LOCK_SIZE does not match bakery lock requirements"); |
| 266 | #endif |
| 267 | #endif |
Yatharth Kochar | 9518d02 | 2016-03-11 14:20:19 +0000 | [diff] [blame] | 268 | |
| 269 | #if ENABLE_PMF |
| 270 | /* |
| 271 | * Time-stamps are stored in normal .bss memory |
| 272 | * |
| 273 | * The compiler will allocate enough memory for one CPU's time-stamps, |
Paul Beesley | 1fbc97b | 2019-01-11 18:26:51 +0000 | [diff] [blame] | 274 | * the remaining memory for other CPUs is allocated by the |
Yatharth Kochar | 9518d02 | 2016-03-11 14:20:19 +0000 | [diff] [blame] | 275 | * linker script |
| 276 | */ |
| 277 | . = ALIGN(CACHE_WRITEBACK_GRANULE); |
| 278 | __PMF_TIMESTAMP_START__ = .; |
| 279 | KEEP(*(pmf_timestamp_array)) |
| 280 | . = ALIGN(CACHE_WRITEBACK_GRANULE); |
| 281 | __PMF_PERCPU_TIMESTAMP_END__ = .; |
| 282 | __PERCPU_TIMESTAMP_SIZE__ = ABSOLUTE(. - __PMF_TIMESTAMP_START__); |
| 283 | . = . + (__PERCPU_TIMESTAMP_SIZE__ * (PLATFORM_CORE_COUNT - 1)); |
| 284 | __PMF_TIMESTAMP_END__ = .; |
| 285 | #endif /* ENABLE_PMF */ |
Sandrine Bailleux | 8d69a03 | 2013-11-27 09:38:52 +0000 | [diff] [blame] | 286 | __BSS_END__ = .; |
Samuel Holland | 31a14e1 | 2018-10-17 21:40:18 -0500 | [diff] [blame] | 287 | } >NOBITS |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 288 | |
Sandrine Bailleux | 8d69a03 | 2013-11-27 09:38:52 +0000 | [diff] [blame] | 289 | /* |
Jeenu Viswambharan | 97cc9ee | 2014-02-24 15:20:28 +0000 | [diff] [blame] | 290 | * The xlat_table section is for full, aligned page tables (4K). |
Achin Gupta | a0cd989 | 2014-02-09 13:30:38 +0000 | [diff] [blame] | 291 | * Removing them from .bss avoids forcing 4K alignment on |
Antonio Nino Diaz | 7c2a3ca | 2018-02-23 15:07:54 +0000 | [diff] [blame] | 292 | * the .bss section. The tables are initialized to zero by the translation |
| 293 | * tables library. |
Achin Gupta | a0cd989 | 2014-02-09 13:30:38 +0000 | [diff] [blame] | 294 | */ |
| 295 | xlat_table (NOLOAD) : { |
| 296 | *(xlat_table) |
Samuel Holland | 31a14e1 | 2018-10-17 21:40:18 -0500 | [diff] [blame] | 297 | } >NOBITS |
Achin Gupta | a0cd989 | 2014-02-09 13:30:38 +0000 | [diff] [blame] | 298 | |
Soby Mathew | 2ae2043 | 2015-01-08 18:02:44 +0000 | [diff] [blame] | 299 | #if USE_COHERENT_MEM |
Achin Gupta | a0cd989 | 2014-02-09 13:30:38 +0000 | [diff] [blame] | 300 | /* |
Sandrine Bailleux | 8d69a03 | 2013-11-27 09:38:52 +0000 | [diff] [blame] | 301 | * The base address of the coherent memory section must be page-aligned (4K) |
| 302 | * to guarantee that the coherent data are stored on their own pages and |
| 303 | * are not mixed with normal data. This is required to set up the correct |
| 304 | * memory attributes for the coherent data page tables. |
| 305 | */ |
Antonio Nino Diaz | 2ce2b09 | 2017-11-15 11:45:35 +0000 | [diff] [blame] | 306 | coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) { |
Sandrine Bailleux | 8d69a03 | 2013-11-27 09:38:52 +0000 | [diff] [blame] | 307 | __COHERENT_RAM_START__ = .; |
Andrew Thoelke | e466c9f | 2015-09-10 11:39:36 +0100 | [diff] [blame] | 308 | /* |
| 309 | * Bakery locks are stored in coherent memory |
| 310 | * |
| 311 | * Each lock's data is contiguous and fully allocated by the compiler |
| 312 | */ |
| 313 | *(bakery_lock) |
Sandrine Bailleux | 8d69a03 | 2013-11-27 09:38:52 +0000 | [diff] [blame] | 314 | *(tzfw_coherent_mem) |
| 315 | __COHERENT_RAM_END_UNALIGNED__ = .; |
| 316 | /* |
| 317 | * Memory page(s) mapped to this section will be marked |
| 318 | * as device memory. No other unexpected data must creep in. |
| 319 | * Ensure the rest of the current memory page is unused. |
| 320 | */ |
Roberto Vargas | d93fde3 | 2018-04-11 11:53:31 +0100 | [diff] [blame] | 321 | . = ALIGN(PAGE_SIZE); |
Sandrine Bailleux | 8d69a03 | 2013-11-27 09:38:52 +0000 | [diff] [blame] | 322 | __COHERENT_RAM_END__ = .; |
Samuel Holland | 31a14e1 | 2018-10-17 21:40:18 -0500 | [diff] [blame] | 323 | } >NOBITS |
Soby Mathew | 2ae2043 | 2015-01-08 18:02:44 +0000 | [diff] [blame] | 324 | #endif |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 325 | |
Samuel Holland | 31a14e1 | 2018-10-17 21:40:18 -0500 | [diff] [blame] | 326 | #if SEPARATE_NOBITS_REGION |
| 327 | /* |
| 328 | * Define a linker symbol to mark end of the NOBITS memory area for this |
| 329 | * image. |
| 330 | */ |
| 331 | __NOBITS_END__ = .; |
| 332 | |
| 333 | ASSERT(. <= BL31_NOBITS_LIMIT, "BL31 NOBITS region has exceeded its limit.") |
| 334 | #else |
Achin Gupta | e9c4a64 | 2015-09-11 16:03:13 +0100 | [diff] [blame] | 335 | /* |
| 336 | * Define a linker symbol to mark end of the RW memory area for this |
| 337 | * image. |
| 338 | */ |
| 339 | __RW_END__ = .; |
Sandrine Bailleux | 8d69a03 | 2013-11-27 09:38:52 +0000 | [diff] [blame] | 340 | __BL31_END__ = .; |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 341 | |
Juan Castillo | 7d19941 | 2015-12-14 09:35:25 +0000 | [diff] [blame] | 342 | ASSERT(. <= BL31_LIMIT, "BL31 image has exceeded its limit.") |
Samuel Holland | 31a14e1 | 2018-10-17 21:40:18 -0500 | [diff] [blame] | 343 | #endif |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 344 | } |