Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2004-2008 Texas Instruments |
| 4 | * |
| 5 | * (C) Copyright 2002 |
| 6 | * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de> |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 9 | #include <config.h> |
Chen-Yu Tsai | a00f85d | 2016-06-19 12:38:36 +0800 | [diff] [blame] | 10 | #include <asm/psci.h> |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 11 | |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 12 | OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") |
| 13 | OUTPUT_ARCH(arm) |
| 14 | ENTRY(_start) |
| 15 | SECTIONS |
| 16 | { |
Simon Glass | 3e2c91c | 2016-03-13 19:07:29 -0600 | [diff] [blame] | 17 | #ifndef CONFIG_CMDLINE |
| 18 | /DISCARD/ : { *(.u_boot_list_2_cmd_*) } |
| 19 | #endif |
Wang Dongsheng | 7eab3a6 | 2016-01-18 11:02:40 +0800 | [diff] [blame] | 20 | #if defined(CONFIG_ARMV7_SECURE_BASE) && defined(CONFIG_ARMV7_NONSEC) |
Peng Fan | 2e9e9a8 | 2015-10-23 10:13:03 +0800 | [diff] [blame] | 21 | /* |
Wang Dongsheng | 7eab3a6 | 2016-01-18 11:02:40 +0800 | [diff] [blame] | 22 | * If CONFIG_ARMV7_SECURE_BASE is true, secure code will not |
| 23 | * bundle with u-boot, and code offsets are fixed. Secure zone |
| 24 | * only needs to be copied from the loading address to |
| 25 | * CONFIG_ARMV7_SECURE_BASE, which is the linking and running |
| 26 | * address for secure code. |
Peng Fan | 2e9e9a8 | 2015-10-23 10:13:03 +0800 | [diff] [blame] | 27 | * |
Wang Dongsheng | 7eab3a6 | 2016-01-18 11:02:40 +0800 | [diff] [blame] | 28 | * If CONFIG_ARMV7_SECURE_BASE is undefined, the secure zone will |
| 29 | * be included in u-boot address space, and some absolute address |
| 30 | * were used in secure code. The absolute addresses of the secure |
| 31 | * code also needs to be relocated along with the accompanying u-boot |
| 32 | * code. |
| 33 | * |
| 34 | * So DISCARD is only for CONFIG_ARMV7_SECURE_BASE. |
Peng Fan | 2e9e9a8 | 2015-10-23 10:13:03 +0800 | [diff] [blame] | 35 | */ |
| 36 | /DISCARD/ : { *(.rel._secure*) } |
Wang Dongsheng | 7eab3a6 | 2016-01-18 11:02:40 +0800 | [diff] [blame] | 37 | #endif |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 38 | . = 0x00000000; |
| 39 | |
| 40 | . = ALIGN(4); |
| 41 | .text : |
| 42 | { |
Albert ARIBAUD | c53687e | 2013-06-11 14:17:33 +0200 | [diff] [blame] | 43 | *(.__image_copy_start) |
Albert ARIBAUD | 9852cc6 | 2014-04-15 16:13:51 +0200 | [diff] [blame] | 44 | *(.vectors) |
Stephen Warren | adddf45 | 2012-10-22 06:19:32 +0000 | [diff] [blame] | 45 | CPUDIR/start.o (.text*) |
| 46 | *(.text*) |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 47 | } |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 48 | |
Jan Kiszka | ac31b5a | 2015-04-21 07:18:24 +0200 | [diff] [blame] | 49 | #ifdef CONFIG_ARMV7_NONSEC |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 50 | |
Chen-Yu Tsai | 277a8f6 | 2016-06-19 12:38:34 +0800 | [diff] [blame] | 51 | /* Align the secure section only if we're going to use it in situ */ |
| 52 | .__secure_start : |
| 53 | #ifndef CONFIG_ARMV7_SECURE_BASE |
| 54 | ALIGN(CONSTANT(COMMONPAGESIZE)) |
| 55 | #endif |
| 56 | { |
| 57 | KEEP(*(.__secure_start)) |
| 58 | } |
| 59 | |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 60 | #ifndef CONFIG_ARMV7_SECURE_BASE |
| 61 | #define CONFIG_ARMV7_SECURE_BASE |
Chen-Yu Tsai | 72a4800 | 2016-06-07 10:54:27 +0800 | [diff] [blame] | 62 | #define __ARMV7_PSCI_STACK_IN_RAM |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 63 | #endif |
| 64 | |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 65 | .secure_text CONFIG_ARMV7_SECURE_BASE : |
| 66 | AT(ADDR(.__secure_start) + SIZEOF(.__secure_start)) |
| 67 | { |
| 68 | *(._secure.text) |
| 69 | } |
| 70 | |
Chen-Yu Tsai | 5ed0387 | 2016-07-05 21:45:06 +0800 | [diff] [blame] | 71 | .secure_data : AT(LOADADDR(.secure_text) + SIZEOF(.secure_text)) |
| 72 | { |
| 73 | *(._secure.data) |
| 74 | } |
| 75 | |
Masahiro Yamada | 2aa46c0 | 2016-09-26 14:21:30 +0900 | [diff] [blame] | 76 | #ifdef CONFIG_ARMV7_PSCI |
Chen-Yu Tsai | 5ed0387 | 2016-07-05 21:45:06 +0800 | [diff] [blame] | 77 | .secure_stack ALIGN(ADDR(.secure_data) + SIZEOF(.secure_data), |
Chen-Yu Tsai | a00f85d | 2016-06-19 12:38:36 +0800 | [diff] [blame] | 78 | CONSTANT(COMMONPAGESIZE)) (NOLOAD) : |
Chen-Yu Tsai | 72a4800 | 2016-06-07 10:54:27 +0800 | [diff] [blame] | 79 | #ifdef __ARMV7_PSCI_STACK_IN_RAM |
Chen-Yu Tsai | a00f85d | 2016-06-19 12:38:36 +0800 | [diff] [blame] | 80 | AT(ADDR(.secure_stack)) |
| 81 | #else |
Chen-Yu Tsai | 5ed0387 | 2016-07-05 21:45:06 +0800 | [diff] [blame] | 82 | AT(LOADADDR(.secure_data) + SIZEOF(.secure_data)) |
Chen-Yu Tsai | a00f85d | 2016-06-19 12:38:36 +0800 | [diff] [blame] | 83 | #endif |
| 84 | { |
| 85 | KEEP(*(.__secure_stack_start)) |
Masahiro Yamada | 2aa46c0 | 2016-09-26 14:21:30 +0900 | [diff] [blame] | 86 | |
Chen-Yu Tsai | a00f85d | 2016-06-19 12:38:36 +0800 | [diff] [blame] | 87 | /* Skip addreses for stack */ |
| 88 | . = . + CONFIG_ARMV7_PSCI_NR_CPUS * ARM_PSCI_STACK_SIZE; |
Masahiro Yamada | 2aa46c0 | 2016-09-26 14:21:30 +0900 | [diff] [blame] | 89 | |
Chen-Yu Tsai | a00f85d | 2016-06-19 12:38:36 +0800 | [diff] [blame] | 90 | /* Align end of stack section to page boundary */ |
| 91 | . = ALIGN(CONSTANT(COMMONPAGESIZE)); |
| 92 | |
| 93 | KEEP(*(.__secure_stack_end)) |
Chen-Yu Tsai | 3de210c | 2016-06-19 12:38:39 +0800 | [diff] [blame] | 94 | |
| 95 | #ifdef CONFIG_ARMV7_SECURE_MAX_SIZE |
| 96 | /* |
| 97 | * We are not checking (__secure_end - __secure_start) here, |
| 98 | * as these are the load addresses, and do not include the |
| 99 | * stack section. Instead, use the end of the stack section |
| 100 | * and the start of the text section. |
| 101 | */ |
| 102 | ASSERT((. - ADDR(.secure_text)) <= CONFIG_ARMV7_SECURE_MAX_SIZE, |
| 103 | "Error: secure section exceeds secure memory size"); |
| 104 | #endif |
Chen-Yu Tsai | a00f85d | 2016-06-19 12:38:36 +0800 | [diff] [blame] | 105 | } |
| 106 | |
| 107 | #ifndef __ARMV7_PSCI_STACK_IN_RAM |
| 108 | /* Reset VMA but don't allocate space if we have secure SRAM */ |
| 109 | . = LOADADDR(.secure_stack); |
Chen-Yu Tsai | 72a4800 | 2016-06-07 10:54:27 +0800 | [diff] [blame] | 110 | #endif |
| 111 | |
Masahiro Yamada | 2aa46c0 | 2016-09-26 14:21:30 +0900 | [diff] [blame] | 112 | #endif |
| 113 | |
Chen-Yu Tsai | a00f85d | 2016-06-19 12:38:36 +0800 | [diff] [blame] | 114 | .__secure_end : AT(ADDR(.__secure_end)) { |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 115 | *(.__secure_end) |
| 116 | LONG(0x1d1071c); /* Must output something to reset LMA */ |
| 117 | } |
| 118 | #endif |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 119 | |
| 120 | . = ALIGN(4); |
| 121 | .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } |
| 122 | |
| 123 | . = ALIGN(4); |
| 124 | .data : { |
Stephen Warren | adddf45 | 2012-10-22 06:19:32 +0000 | [diff] [blame] | 125 | *(.data*) |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 126 | } |
| 127 | |
| 128 | . = ALIGN(4); |
| 129 | |
| 130 | . = .; |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 131 | |
| 132 | . = ALIGN(4); |
Marek Vasut | 607092a | 2012-10-12 10:27:03 +0000 | [diff] [blame] | 133 | .u_boot_list : { |
Albert ARIBAUD | c24895e | 2013-02-25 00:59:00 +0000 | [diff] [blame] | 134 | KEEP(*(SORT(.u_boot_list*))); |
Marek Vasut | 607092a | 2012-10-12 10:27:03 +0000 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | . = ALIGN(4); |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 138 | |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 139 | .__efi_runtime_start : { |
| 140 | *(.__efi_runtime_start) |
| 141 | } |
| 142 | |
| 143 | .efi_runtime : { |
| 144 | *(efi_runtime_text) |
| 145 | *(efi_runtime_data) |
| 146 | } |
| 147 | |
| 148 | .__efi_runtime_stop : { |
| 149 | *(.__efi_runtime_stop) |
| 150 | } |
| 151 | |
| 152 | .efi_runtime_rel_start : |
| 153 | { |
| 154 | *(.__efi_runtime_rel_start) |
| 155 | } |
| 156 | |
| 157 | .efi_runtime_rel : { |
| 158 | *(.relefi_runtime_text) |
| 159 | *(.relefi_runtime_data) |
| 160 | } |
| 161 | |
| 162 | .efi_runtime_rel_stop : |
| 163 | { |
| 164 | *(.__efi_runtime_rel_stop) |
| 165 | } |
| 166 | |
Tom Rini | 06ca0cf | 2017-06-14 09:13:21 -0400 | [diff] [blame] | 167 | . = ALIGN(4); |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 168 | |
Albert ARIBAUD | c53687e | 2013-06-11 14:17:33 +0200 | [diff] [blame] | 169 | .image_copy_end : |
| 170 | { |
| 171 | *(.__image_copy_end) |
| 172 | } |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 173 | |
Albert ARIBAUD | af3ff16 | 2013-06-11 14:17:34 +0200 | [diff] [blame] | 174 | .rel_dyn_start : |
| 175 | { |
| 176 | *(.__rel_dyn_start) |
| 177 | } |
| 178 | |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 179 | .rel.dyn : { |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 180 | *(.rel*) |
Albert ARIBAUD | af3ff16 | 2013-06-11 14:17:34 +0200 | [diff] [blame] | 181 | } |
| 182 | |
| 183 | .rel_dyn_end : |
| 184 | { |
| 185 | *(.__rel_dyn_end) |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 186 | } |
| 187 | |
Albert ARIBAUD | 9d25fa4 | 2014-02-22 17:53:42 +0100 | [diff] [blame] | 188 | .end : |
| 189 | { |
| 190 | *(.__end) |
| 191 | } |
| 192 | |
| 193 | _image_binary_end = .; |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 194 | |
| 195 | /* |
| 196 | * Deprecated: this MMU section is used by pxa at present but |
| 197 | * should not be used by new boards/CPUs. |
| 198 | */ |
| 199 | . = ALIGN(4096); |
| 200 | .mmutable : { |
| 201 | *(.mmutable) |
| 202 | } |
| 203 | |
Albert ARIBAUD | ba5662d | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 204 | /* |
| 205 | * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c |
| 206 | * __bss_base and __bss_limit are for linker only (overlay ordering) |
| 207 | */ |
| 208 | |
Albert ARIBAUD | 436f632 | 2013-02-25 00:58:59 +0000 | [diff] [blame] | 209 | .bss_start __rel_dyn_start (OVERLAY) : { |
| 210 | KEEP(*(.__bss_start)); |
Albert ARIBAUD | ba5662d | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 211 | __bss_base = .; |
Albert ARIBAUD | 436f632 | 2013-02-25 00:58:59 +0000 | [diff] [blame] | 212 | } |
| 213 | |
Albert ARIBAUD | ba5662d | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 214 | .bss __bss_base (OVERLAY) : { |
Stephen Warren | adddf45 | 2012-10-22 06:19:32 +0000 | [diff] [blame] | 215 | *(.bss*) |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 216 | . = ALIGN(4); |
Albert ARIBAUD | ba5662d | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 217 | __bss_limit = .; |
Albert ARIBAUD | 436f632 | 2013-02-25 00:58:59 +0000 | [diff] [blame] | 218 | } |
Tom Rini | 19aac97 | 2013-03-18 12:31:00 -0400 | [diff] [blame] | 219 | |
Albert ARIBAUD | ba5662d | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 220 | .bss_end __bss_limit (OVERLAY) : { |
| 221 | KEEP(*(.__bss_end)); |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 222 | } |
| 223 | |
Albert ARIBAUD | 9d25fa4 | 2014-02-22 17:53:42 +0100 | [diff] [blame] | 224 | .dynsym _image_binary_end : { *(.dynsym) } |
Albert ARIBAUD | 95fc6d6 | 2013-11-07 14:21:46 +0100 | [diff] [blame] | 225 | .dynbss : { *(.dynbss) } |
| 226 | .dynstr : { *(.dynstr*) } |
| 227 | .dynamic : { *(.dynamic*) } |
| 228 | .plt : { *(.plt*) } |
| 229 | .interp : { *(.interp*) } |
Andreas Färber | 438a167 | 2014-01-27 05:48:11 +0100 | [diff] [blame] | 230 | .gnu.hash : { *(.gnu.hash) } |
Albert ARIBAUD | 95fc6d6 | 2013-11-07 14:21:46 +0100 | [diff] [blame] | 231 | .gnu : { *(.gnu*) } |
| 232 | .ARM.exidx : { *(.ARM.exidx*) } |
Albert ARIBAUD | ddadbed | 2014-01-13 14:57:05 +0100 | [diff] [blame] | 233 | .gnu.linkonce.armexidx : { *(.gnu.linkonce.armexidx.*) } |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 234 | } |