York Sun | a84cd72 | 2014-06-23 15:15:54 -0700 | [diff] [blame] | 1 | /* |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 2 | * (C) Copyright 2014-2015 Freescale Semiconductor |
York Sun | a84cd72 | 2014-06-23 15:15:54 -0700 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | * |
| 6 | * Extracted from armv8/start.S |
| 7 | */ |
| 8 | |
| 9 | #include <config.h> |
| 10 | #include <linux/linkage.h> |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 11 | #include <asm/gic.h> |
York Sun | a84cd72 | 2014-06-23 15:15:54 -0700 | [diff] [blame] | 12 | #include <asm/macro.h> |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 13 | #ifdef CONFIG_MP |
| 14 | #include <asm/arch/mp.h> |
| 15 | #endif |
Priyanka Jain | 96b001f | 2016-11-17 12:29:51 +0530 | [diff] [blame] | 16 | #ifdef CONFIG_FSL_LSCH3 |
| 17 | #include <asm/arch-fsl-layerscape/immap_lsch3.h> |
| 18 | #endif |
York Sun | a84cd72 | 2014-06-23 15:15:54 -0700 | [diff] [blame] | 19 | |
| 20 | ENTRY(lowlevel_init) |
| 21 | mov x29, lr /* Save LR */ |
| 22 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 23 | #ifdef CONFIG_FSL_LSCH3 |
Prabhakar Kushwaha | edbbd25 | 2016-01-25 12:08:45 +0530 | [diff] [blame] | 24 | |
| 25 | /* Set Wuo bit for RN-I 20 */ |
York Sun | cbe8e1c | 2016-04-04 11:41:26 -0700 | [diff] [blame] | 26 | #ifdef CONFIG_LS2080A |
Prabhakar Kushwaha | edbbd25 | 2016-01-25 12:08:45 +0530 | [diff] [blame] | 27 | ldr x0, =CCI_AUX_CONTROL_BASE(20) |
| 28 | ldr x1, =0x00000010 |
| 29 | bl ccn504_set_aux |
| 30 | #endif |
| 31 | |
Scott Wood | a814e66 | 2015-03-20 19:28:10 -0700 | [diff] [blame] | 32 | /* Add fully-coherent masters to DVM domain */ |
Bhupesh Sharma | 8238f34 | 2015-07-01 09:58:03 +0530 | [diff] [blame] | 33 | ldr x0, =CCI_MN_BASE |
| 34 | ldr x1, =CCI_MN_RNF_NODEID_LIST |
| 35 | ldr x2, =CCI_MN_DVM_DOMAIN_CTL_SET |
| 36 | bl ccn504_add_masters_to_dvm |
| 37 | |
| 38 | /* Set all RN-I ports to QoS of 15 */ |
| 39 | ldr x0, =CCI_S0_QOS_CONTROL_BASE(0) |
| 40 | ldr x1, =0x00FF000C |
| 41 | bl ccn504_set_qos |
| 42 | ldr x0, =CCI_S1_QOS_CONTROL_BASE(0) |
| 43 | ldr x1, =0x00FF000C |
| 44 | bl ccn504_set_qos |
| 45 | ldr x0, =CCI_S2_QOS_CONTROL_BASE(0) |
| 46 | ldr x1, =0x00FF000C |
| 47 | bl ccn504_set_qos |
| 48 | |
| 49 | ldr x0, =CCI_S0_QOS_CONTROL_BASE(2) |
| 50 | ldr x1, =0x00FF000C |
| 51 | bl ccn504_set_qos |
| 52 | ldr x0, =CCI_S1_QOS_CONTROL_BASE(2) |
| 53 | ldr x1, =0x00FF000C |
| 54 | bl ccn504_set_qos |
| 55 | ldr x0, =CCI_S2_QOS_CONTROL_BASE(2) |
| 56 | ldr x1, =0x00FF000C |
| 57 | bl ccn504_set_qos |
| 58 | |
| 59 | ldr x0, =CCI_S0_QOS_CONTROL_BASE(6) |
| 60 | ldr x1, =0x00FF000C |
| 61 | bl ccn504_set_qos |
| 62 | ldr x0, =CCI_S1_QOS_CONTROL_BASE(6) |
| 63 | ldr x1, =0x00FF000C |
| 64 | bl ccn504_set_qos |
| 65 | ldr x0, =CCI_S2_QOS_CONTROL_BASE(6) |
| 66 | ldr x1, =0x00FF000C |
| 67 | bl ccn504_set_qos |
| 68 | |
| 69 | ldr x0, =CCI_S0_QOS_CONTROL_BASE(12) |
| 70 | ldr x1, =0x00FF000C |
| 71 | bl ccn504_set_qos |
| 72 | ldr x0, =CCI_S1_QOS_CONTROL_BASE(12) |
| 73 | ldr x1, =0x00FF000C |
| 74 | bl ccn504_set_qos |
| 75 | ldr x0, =CCI_S2_QOS_CONTROL_BASE(12) |
| 76 | ldr x1, =0x00FF000C |
| 77 | bl ccn504_set_qos |
| 78 | |
| 79 | ldr x0, =CCI_S0_QOS_CONTROL_BASE(16) |
| 80 | ldr x1, =0x00FF000C |
| 81 | bl ccn504_set_qos |
| 82 | ldr x0, =CCI_S1_QOS_CONTROL_BASE(16) |
| 83 | ldr x1, =0x00FF000C |
| 84 | bl ccn504_set_qos |
| 85 | ldr x0, =CCI_S2_QOS_CONTROL_BASE(16) |
| 86 | ldr x1, =0x00FF000C |
| 87 | bl ccn504_set_qos |
| 88 | |
| 89 | ldr x0, =CCI_S0_QOS_CONTROL_BASE(20) |
| 90 | ldr x1, =0x00FF000C |
| 91 | bl ccn504_set_qos |
| 92 | ldr x0, =CCI_S1_QOS_CONTROL_BASE(20) |
| 93 | ldr x1, =0x00FF000C |
| 94 | bl ccn504_set_qos |
| 95 | ldr x0, =CCI_S2_QOS_CONTROL_BASE(20) |
| 96 | ldr x1, =0x00FF000C |
| 97 | bl ccn504_set_qos |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 98 | #endif |
Scott Wood | a814e66 | 2015-03-20 19:28:10 -0700 | [diff] [blame] | 99 | |
Prabhakar Kushwaha | ae17df2 | 2016-06-03 18:41:26 +0530 | [diff] [blame] | 100 | #ifdef SMMU_BASE |
York Sun | a84cd72 | 2014-06-23 15:15:54 -0700 | [diff] [blame] | 101 | /* Set the SMMU page size in the sACR register */ |
| 102 | ldr x1, =SMMU_BASE |
| 103 | ldr w0, [x1, #0x10] |
| 104 | orr w0, w0, #1 << 16 /* set sACR.pagesize to indicate 64K page */ |
| 105 | str w0, [x1, #0x10] |
Prabhakar Kushwaha | ae17df2 | 2016-06-03 18:41:26 +0530 | [diff] [blame] | 106 | #endif |
York Sun | a84cd72 | 2014-06-23 15:15:54 -0700 | [diff] [blame] | 107 | |
| 108 | /* Initialize GIC Secure Bank Status */ |
| 109 | #if defined(CONFIG_GICV2) || defined(CONFIG_GICV3) |
| 110 | branch_if_slave x0, 1f |
| 111 | ldr x0, =GICD_BASE |
| 112 | bl gic_init_secure |
| 113 | 1: |
| 114 | #ifdef CONFIG_GICV3 |
| 115 | ldr x0, =GICR_BASE |
| 116 | bl gic_init_secure_percpu |
| 117 | #elif defined(CONFIG_GICV2) |
| 118 | ldr x0, =GICD_BASE |
| 119 | ldr x1, =GICC_BASE |
| 120 | bl gic_init_secure_percpu |
| 121 | #endif |
| 122 | #endif |
| 123 | |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 124 | branch_if_master x0, x1, 2f |
York Sun | a84cd72 | 2014-06-23 15:15:54 -0700 | [diff] [blame] | 125 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 126 | #if defined(CONFIG_MP) && defined(CONFIG_ARMV8_MULTIENTRY) |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 127 | ldr x0, =secondary_boot_func |
| 128 | blr x0 |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 129 | #endif |
Bhupesh Sharma | a0c00ff | 2015-01-06 13:11:21 -0800 | [diff] [blame] | 130 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 131 | 2: |
Bhupesh Sharma | a0c00ff | 2015-01-06 13:11:21 -0800 | [diff] [blame] | 132 | #ifdef CONFIG_FSL_TZPC_BP147 |
| 133 | /* Set Non Secure access for all devices protected via TZPC */ |
| 134 | ldr x1, =TZPCDECPROT_0_SET_BASE /* Decode Protection-0 Set Reg */ |
| 135 | orr w0, w0, #1 << 3 /* DCFG_RESET is accessible from NS world */ |
| 136 | str w0, [x1] |
| 137 | |
| 138 | isb |
| 139 | dsb sy |
| 140 | #endif |
| 141 | |
| 142 | #ifdef CONFIG_FSL_TZASC_400 |
| 143 | /* Set TZASC so that: |
| 144 | * a. We use only Region0 whose global secure write/read is EN |
| 145 | * b. We use only Region0 whose NSAID write/read is EN |
| 146 | * |
| 147 | * NOTE: As per the CCSR map doc, TZASC 3 and TZASC 4 are just |
| 148 | * placeholders. |
| 149 | */ |
| 150 | ldr x1, =TZASC_GATE_KEEPER(0) |
Priyanka Jain | 784269d | 2016-11-17 12:29:53 +0530 | [diff] [blame^] | 151 | ldr w0, [x1] /* Filter 0 Gate Keeper Register */ |
| 152 | orr w0, w0, #1 << 0 /* Set open_request for Filter 0 */ |
| 153 | str w0, [x1] |
Bhupesh Sharma | a0c00ff | 2015-01-06 13:11:21 -0800 | [diff] [blame] | 154 | |
| 155 | ldr x1, =TZASC_GATE_KEEPER(1) |
Priyanka Jain | 784269d | 2016-11-17 12:29:53 +0530 | [diff] [blame^] | 156 | ldr w0, [x1] /* Filter 0 Gate Keeper Register */ |
| 157 | orr w0, w0, #1 << 0 /* Set open_request for Filter 0 */ |
| 158 | str w0, [x1] |
Bhupesh Sharma | a0c00ff | 2015-01-06 13:11:21 -0800 | [diff] [blame] | 159 | |
| 160 | ldr x1, =TZASC_REGION_ATTRIBUTES_0(0) |
Priyanka Jain | 784269d | 2016-11-17 12:29:53 +0530 | [diff] [blame^] | 161 | ldr w0, [x1] /* Region-0 Attributes Register */ |
| 162 | orr w0, w0, #1 << 31 /* Set Sec global write en, Bit[31] */ |
| 163 | orr w0, w0, #1 << 30 /* Set Sec global read en, Bit[30] */ |
| 164 | str w0, [x1] |
Bhupesh Sharma | a0c00ff | 2015-01-06 13:11:21 -0800 | [diff] [blame] | 165 | |
| 166 | ldr x1, =TZASC_REGION_ATTRIBUTES_0(1) |
Priyanka Jain | 784269d | 2016-11-17 12:29:53 +0530 | [diff] [blame^] | 167 | ldr w0, [x1] /* Region-1 Attributes Register */ |
| 168 | orr w0, w0, #1 << 31 /* Set Sec global write en, Bit[31] */ |
| 169 | orr w0, w0, #1 << 30 /* Set Sec global read en, Bit[30] */ |
| 170 | str w0, [x1] |
Bhupesh Sharma | a0c00ff | 2015-01-06 13:11:21 -0800 | [diff] [blame] | 171 | |
| 172 | ldr x1, =TZASC_REGION_ID_ACCESS_0(0) |
| 173 | ldr w0, [x1] /* Region-0 Access Register */ |
| 174 | mov w0, #0xFFFFFFFF /* Set nsaid_wr_en and nsaid_rd_en */ |
| 175 | str w0, [x1] |
| 176 | |
| 177 | ldr x1, =TZASC_REGION_ID_ACCESS_0(1) |
| 178 | ldr w0, [x1] /* Region-1 Attributes Register */ |
| 179 | mov w0, #0xFFFFFFFF /* Set nsaid_wr_en and nsaid_rd_en */ |
| 180 | str w0, [x1] |
| 181 | |
| 182 | isb |
| 183 | dsb sy |
| 184 | #endif |
Mingkai Hu | 48ddbe8 | 2016-09-07 17:56:08 +0800 | [diff] [blame] | 185 | |
York Sun | bad4984 | 2016-09-26 08:09:24 -0700 | [diff] [blame] | 186 | #ifdef CONFIG_ARCH_LS1046A |
Mingkai Hu | 48ddbe8 | 2016-09-07 17:56:08 +0800 | [diff] [blame] | 187 | /* Initialize the L2 RAM latency */ |
| 188 | mrs x1, S3_1_c11_c0_2 |
| 189 | mov x0, #0x1C7 |
| 190 | /* Clear L2 Tag RAM latency and L2 Data RAM latency */ |
| 191 | bic x1, x1, x0 |
| 192 | /* Set L2 data ram latency bits [2:0] */ |
| 193 | orr x1, x1, #0x2 |
| 194 | /* set L2 tag ram latency bits [8:6] */ |
| 195 | orr x1, x1, #0x80 |
| 196 | msr S3_1_c11_c0_2, x1 |
| 197 | isb |
| 198 | #endif |
| 199 | |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 200 | mov lr, x29 /* Restore LR */ |
| 201 | ret |
| 202 | ENDPROC(lowlevel_init) |
| 203 | |
Prabhakar Kushwaha | d169ebe | 2016-06-03 18:41:31 +0530 | [diff] [blame] | 204 | #ifdef CONFIG_FSL_LSCH3 |
Priyanka Jain | 96b001f | 2016-11-17 12:29:51 +0530 | [diff] [blame] | 205 | .globl get_svr |
| 206 | get_svr: |
| 207 | ldr x1, =FSL_LSCH3_SVR |
| 208 | ldr w0, [x1] |
| 209 | ret |
| 210 | |
York Sun | 1ce575f | 2015-01-06 13:18:42 -0800 | [diff] [blame] | 211 | hnf_pstate_poll: |
| 212 | /* x0 has the desired status, return 0 for success, 1 for timeout |
| 213 | * clobber x1, x2, x3, x4, x6, x7 |
| 214 | */ |
| 215 | mov x1, x0 |
| 216 | mov x7, #0 /* flag for timeout */ |
| 217 | mrs x3, cntpct_el0 /* read timer */ |
| 218 | add x3, x3, #1200 /* timeout after 100 microseconds */ |
| 219 | mov x0, #0x18 |
| 220 | movk x0, #0x420, lsl #16 /* HNF0_PSTATE_STATUS */ |
| 221 | mov w6, #8 /* HN-F node count */ |
| 222 | 1: |
| 223 | ldr x2, [x0] |
| 224 | cmp x2, x1 /* check status */ |
| 225 | b.eq 2f |
| 226 | mrs x4, cntpct_el0 |
| 227 | cmp x4, x3 |
| 228 | b.ls 1b |
| 229 | mov x7, #1 /* timeout */ |
| 230 | b 3f |
| 231 | 2: |
| 232 | add x0, x0, #0x10000 /* move to next node */ |
| 233 | subs w6, w6, #1 |
| 234 | cbnz w6, 1b |
| 235 | 3: |
| 236 | mov x0, x7 |
| 237 | ret |
| 238 | |
| 239 | hnf_set_pstate: |
| 240 | /* x0 has the desired state, clobber x1, x2, x6 */ |
| 241 | mov x1, x0 |
| 242 | /* power state to SFONLY */ |
| 243 | mov w6, #8 /* HN-F node count */ |
| 244 | mov x0, #0x10 |
| 245 | movk x0, #0x420, lsl #16 /* HNF0_PSTATE_REQ */ |
| 246 | 1: /* set pstate to sfonly */ |
| 247 | ldr x2, [x0] |
| 248 | and x2, x2, #0xfffffffffffffffc /* & HNFPSTAT_MASK */ |
| 249 | orr x2, x2, x1 |
| 250 | str x2, [x0] |
| 251 | add x0, x0, #0x10000 /* move to next node */ |
| 252 | subs w6, w6, #1 |
| 253 | cbnz w6, 1b |
| 254 | |
| 255 | ret |
| 256 | |
Stephen Warren | ddb0f63 | 2016-10-19 15:18:46 -0600 | [diff] [blame] | 257 | ENTRY(__asm_flush_l3_dcache) |
York Sun | 1ce575f | 2015-01-06 13:18:42 -0800 | [diff] [blame] | 258 | /* |
| 259 | * Return status in x0 |
| 260 | * success 0 |
| 261 | * tmeout 1 for setting SFONLY, 2 for FAM, 3 for both |
| 262 | */ |
| 263 | mov x29, lr |
| 264 | mov x8, #0 |
| 265 | |
| 266 | dsb sy |
| 267 | mov x0, #0x1 /* HNFPSTAT_SFONLY */ |
| 268 | bl hnf_set_pstate |
| 269 | |
| 270 | mov x0, #0x4 /* SFONLY status */ |
| 271 | bl hnf_pstate_poll |
| 272 | cbz x0, 1f |
| 273 | mov x8, #1 /* timeout */ |
| 274 | 1: |
| 275 | dsb sy |
| 276 | mov x0, #0x3 /* HNFPSTAT_FAM */ |
| 277 | bl hnf_set_pstate |
| 278 | |
| 279 | mov x0, #0xc /* FAM status */ |
| 280 | bl hnf_pstate_poll |
| 281 | cbz x0, 1f |
| 282 | add x8, x8, #0x2 |
| 283 | 1: |
| 284 | mov x0, x8 |
| 285 | mov lr, x29 |
| 286 | ret |
Stephen Warren | ddb0f63 | 2016-10-19 15:18:46 -0600 | [diff] [blame] | 287 | ENDPROC(__asm_flush_l3_dcache) |
Prabhakar Kushwaha | d169ebe | 2016-06-03 18:41:31 +0530 | [diff] [blame] | 288 | #endif |
York Sun | 1ce575f | 2015-01-06 13:18:42 -0800 | [diff] [blame] | 289 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 290 | #ifdef CONFIG_MP |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 291 | /* Keep literals not used by the secondary boot code outside it */ |
| 292 | .ltorg |
| 293 | |
| 294 | /* Using 64 bit alignment since the spin table is accessed as data */ |
| 295 | .align 4 |
| 296 | .global secondary_boot_code |
| 297 | /* Secondary Boot Code starts here */ |
| 298 | secondary_boot_code: |
| 299 | .global __spin_table |
| 300 | __spin_table: |
| 301 | .space CONFIG_MAX_CPUS*SPIN_TABLE_ELEM_SIZE |
| 302 | |
| 303 | .align 2 |
| 304 | ENTRY(secondary_boot_func) |
York Sun | a84cd72 | 2014-06-23 15:15:54 -0700 | [diff] [blame] | 305 | /* |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 306 | * MPIDR_EL1 Fields: |
| 307 | * MPIDR[1:0] = AFF0_CPUID <- Core ID (0,1) |
| 308 | * MPIDR[7:2] = AFF0_RES |
| 309 | * MPIDR[15:8] = AFF1_CLUSTERID <- Cluster ID (0,1,2,3) |
| 310 | * MPIDR[23:16] = AFF2_CLUSTERID |
| 311 | * MPIDR[24] = MT |
| 312 | * MPIDR[29:25] = RES0 |
| 313 | * MPIDR[30] = U |
| 314 | * MPIDR[31] = ME |
| 315 | * MPIDR[39:32] = AFF3 |
| 316 | * |
| 317 | * Linear Processor ID (LPID) calculation from MPIDR_EL1: |
| 318 | * (We only use AFF0_CPUID and AFF1_CLUSTERID for now |
| 319 | * until AFF2_CLUSTERID and AFF3 have non-zero values) |
| 320 | * |
| 321 | * LPID = MPIDR[15:8] | MPIDR[1:0] |
York Sun | a84cd72 | 2014-06-23 15:15:54 -0700 | [diff] [blame] | 322 | */ |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 323 | mrs x0, mpidr_el1 |
| 324 | ubfm x1, x0, #8, #15 |
| 325 | ubfm x2, x0, #0, #1 |
| 326 | orr x10, x2, x1, lsl #2 /* x10 has LPID */ |
| 327 | ubfm x9, x0, #0, #15 /* x9 contains MPIDR[15:0] */ |
York Sun | a84cd72 | 2014-06-23 15:15:54 -0700 | [diff] [blame] | 328 | /* |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 329 | * offset of the spin table element for this core from start of spin |
| 330 | * table (each elem is padded to 64 bytes) |
York Sun | a84cd72 | 2014-06-23 15:15:54 -0700 | [diff] [blame] | 331 | */ |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 332 | lsl x1, x10, #6 |
| 333 | ldr x0, =__spin_table |
| 334 | /* physical address of this cpus spin table element */ |
| 335 | add x11, x1, x0 |
| 336 | |
York Sun | 77a1097 | 2015-03-20 19:28:08 -0700 | [diff] [blame] | 337 | ldr x0, =__real_cntfrq |
| 338 | ldr x0, [x0] |
| 339 | msr cntfrq_el0, x0 /* set with real frequency */ |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 340 | str x9, [x11, #16] /* LPID */ |
| 341 | mov x4, #1 |
| 342 | str x4, [x11, #8] /* STATUS */ |
| 343 | dsb sy |
| 344 | #if defined(CONFIG_GICV3) |
| 345 | gic_wait_for_interrupt_m x0 |
| 346 | #elif defined(CONFIG_GICV2) |
| 347 | ldr x0, =GICC_BASE |
| 348 | gic_wait_for_interrupt_m x0, w1 |
| 349 | #endif |
| 350 | |
| 351 | bl secondary_switch_to_el2 |
York Sun | a84cd72 | 2014-06-23 15:15:54 -0700 | [diff] [blame] | 352 | #ifdef CONFIG_ARMV8_SWITCH_TO_EL1 |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 353 | bl secondary_switch_to_el1 |
York Sun | a84cd72 | 2014-06-23 15:15:54 -0700 | [diff] [blame] | 354 | #endif |
York Sun | a84cd72 | 2014-06-23 15:15:54 -0700 | [diff] [blame] | 355 | |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 356 | slave_cpu: |
| 357 | wfe |
| 358 | ldr x0, [x11] |
| 359 | cbz x0, slave_cpu |
| 360 | #ifndef CONFIG_ARMV8_SWITCH_TO_EL1 |
| 361 | mrs x1, sctlr_el2 |
| 362 | #else |
| 363 | mrs x1, sctlr_el1 |
| 364 | #endif |
| 365 | tbz x1, #25, cpu_is_le |
| 366 | rev x0, x0 /* BE to LE conversion */ |
| 367 | cpu_is_le: |
| 368 | br x0 /* branch to the given address */ |
| 369 | ENDPROC(secondary_boot_func) |
| 370 | |
| 371 | ENTRY(secondary_switch_to_el2) |
| 372 | switch_el x0, 1f, 0f, 0f |
| 373 | 0: ret |
| 374 | 1: armv8_switch_to_el2_m x0 |
| 375 | ENDPROC(secondary_switch_to_el2) |
| 376 | |
| 377 | ENTRY(secondary_switch_to_el1) |
| 378 | switch_el x0, 0f, 1f, 0f |
| 379 | 0: ret |
| 380 | 1: armv8_switch_to_el1_m x0, x1 |
| 381 | ENDPROC(secondary_switch_to_el1) |
| 382 | |
| 383 | /* Ensure that the literals used by the secondary boot code are |
| 384 | * assembled within it (this is required so that we can protect |
| 385 | * this area with a single memreserve region |
| 386 | */ |
| 387 | .ltorg |
| 388 | |
| 389 | /* 64 bit alignment for elements accessed as data */ |
| 390 | .align 4 |
York Sun | 77a1097 | 2015-03-20 19:28:08 -0700 | [diff] [blame] | 391 | .global __real_cntfrq |
| 392 | __real_cntfrq: |
| 393 | .quad COUNTER_FREQUENCY |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 394 | .globl __secondary_boot_code_size |
| 395 | .type __secondary_boot_code_size, %object |
| 396 | /* Secondary Boot Code ends here */ |
| 397 | __secondary_boot_code_size: |
| 398 | .quad .-secondary_boot_code |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 399 | #endif |