blob: ffdc9309e5b5337e6ce4cdfaf4567299cbcf12b2 [file] [log] [blame]
Achin Gupta4f6ad662013-10-25 09:08:21 +01001/*
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +00002 * Copyright (c) 2014-2017, ARM Limited and Contributors. All rights reserved.
Achin Gupta4f6ad662013-10-25 09:08:21 +01003 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
9 *
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 *
14 * Neither the name of ARM nor the names of its contributors may be used
15 * to endorse or promote products derived from this software without specific
16 * prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
Achin Gupta4f6ad662013-10-25 09:08:21 +010030#include <arch.h>
Andrew Thoelke38bde412014-03-18 13:46:55 +000031#include <asm_macros.S>
Soby Mathew802f8652014-08-14 16:19:29 +010032#include <assert_macros.S>
Yatharth Kochar36433d12014-11-20 18:09:41 +000033#include <bl_common.h>
Soby Mathew8e2f2872014-08-14 12:49:05 +010034#include <cortex_a57.h>
Soby Mathewc704cbc2014-08-14 11:33:56 +010035#include <cpu_macros.S>
Soby Mathew6b28c572016-03-21 10:36:47 +000036#include <debug.h>
Soby Mathewc704cbc2014-08-14 11:33:56 +010037#include <plat_macros.S>
Achin Gupta4f6ad662013-10-25 09:08:21 +010038
Soby Mathew8e2f2872014-08-14 12:49:05 +010039 /* ---------------------------------------------
40 * Disable L1 data cache and unified L2 cache
41 * ---------------------------------------------
42 */
43func cortex_a57_disable_dcache
44 mrs x1, sctlr_el3
45 bic x1, x1, #SCTLR_C_BIT
46 msr sctlr_el3, x1
47 isb
48 ret
Kévin Petita877c252015-03-24 14:03:57 +000049endfunc cortex_a57_disable_dcache
Soby Mathew8e2f2872014-08-14 12:49:05 +010050
51 /* ---------------------------------------------
52 * Disable all types of L2 prefetches.
53 * ---------------------------------------------
54 */
55func cortex_a57_disable_l2_prefetch
56 mrs x0, CPUECTLR_EL1
57 orr x0, x0, #CPUECTLR_DIS_TWD_ACC_PFTCH_BIT
58 mov x1, #CPUECTLR_L2_IPFTCH_DIST_MASK
59 orr x1, x1, #CPUECTLR_L2_DPFTCH_DIST_MASK
60 bic x0, x0, x1
61 msr CPUECTLR_EL1, x0
62 isb
Soby Mathew1604fa02014-09-22 12:15:26 +010063 dsb ish
Soby Mathew8e2f2872014-08-14 12:49:05 +010064 ret
Kévin Petita877c252015-03-24 14:03:57 +000065endfunc cortex_a57_disable_l2_prefetch
Soby Mathew8e2f2872014-08-14 12:49:05 +010066
67 /* ---------------------------------------------
68 * Disable intra-cluster coherency
69 * ---------------------------------------------
70 */
71func cortex_a57_disable_smp
72 mrs x0, CPUECTLR_EL1
73 bic x0, x0, #CPUECTLR_SMP_BIT
74 msr CPUECTLR_EL1, x0
75 ret
Kévin Petita877c252015-03-24 14:03:57 +000076endfunc cortex_a57_disable_smp
Soby Mathew8e2f2872014-08-14 12:49:05 +010077
78 /* ---------------------------------------------
79 * Disable debug interfaces
80 * ---------------------------------------------
81 */
82func cortex_a57_disable_ext_debug
83 mov x0, #1
84 msr osdlr_el1, x0
85 isb
86 dsb sy
87 ret
Kévin Petita877c252015-03-24 14:03:57 +000088endfunc cortex_a57_disable_ext_debug
Achin Gupta4f6ad662013-10-25 09:08:21 +010089
Soby Mathewc0884332014-09-22 12:11:36 +010090 /* --------------------------------------------------
91 * Errata Workaround for Cortex A57 Errata #806969.
92 * This applies only to revision r0p0 of Cortex A57.
93 * Inputs:
94 * x0: variant[4:7] and revision[0:3] of current cpu.
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +000095 * Shall clobber: x0-x17
Soby Mathewc0884332014-09-22 12:11:36 +010096 * --------------------------------------------------
Soby Mathew802f8652014-08-14 16:19:29 +010097 */
Soby Mathewc0884332014-09-22 12:11:36 +010098func errata_a57_806969_wa
99 /*
100 * Compare x0 against revision r0p0
101 */
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000102 mov x17, x30
103 bl check_errata_806969
104 cbz x0, 1f
Soby Mathewc0884332014-09-22 12:11:36 +0100105 mrs x1, CPUACTLR_EL1
Soby Mathew802f8652014-08-14 16:19:29 +0100106 orr x1, x1, #CPUACTLR_NO_ALLOC_WBWA
Soby Mathewc0884332014-09-22 12:11:36 +0100107 msr CPUACTLR_EL1, x1
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +00001081:
109 ret x17
Kévin Petita877c252015-03-24 14:03:57 +0000110endfunc errata_a57_806969_wa
Soby Mathewc0884332014-09-22 12:11:36 +0100111
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000112func check_errata_806969
113 mov x1, #0x00
114 b cpu_rev_var_ls
115endfunc check_errata_806969
Soby Mathewc0884332014-09-22 12:11:36 +0100116
117 /* ---------------------------------------------------
118 * Errata Workaround for Cortex A57 Errata #813420.
119 * This applies only to revision r0p0 of Cortex A57.
120 * Inputs:
121 * x0: variant[4:7] and revision[0:3] of current cpu.
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000122 * Shall clobber: x0-x17
Soby Mathewc0884332014-09-22 12:11:36 +0100123 * ---------------------------------------------------
124 */
125func errata_a57_813420_wa
126 /*
127 * Compare x0 against revision r0p0
128 */
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000129 mov x17, x30
130 bl check_errata_813420
131 cbz x0, 1f
Soby Mathewc0884332014-09-22 12:11:36 +0100132 mrs x1, CPUACTLR_EL1
Soby Mathew802f8652014-08-14 16:19:29 +0100133 orr x1, x1, #CPUACTLR_DCC_AS_DCCI
Soby Mathewc0884332014-09-22 12:11:36 +0100134 msr CPUACTLR_EL1, x1
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +00001351:
136 ret x17
Kévin Petita877c252015-03-24 14:03:57 +0000137endfunc errata_a57_813420_wa
Soby Mathewc0884332014-09-22 12:11:36 +0100138
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000139func check_errata_813420
140 mov x1, #0x00
141 b cpu_rev_var_ls
142endfunc check_errata_813420
143
Sandrine Bailleuxd4817592016-01-13 14:57:38 +0000144 /* --------------------------------------------------------------------
145 * Disable the over-read from the LDNP instruction.
146 *
147 * This applies to all revisions <= r1p2. The performance degradation
148 * observed with LDNP/STNP has been fixed on r1p3 and onwards.
149 *
150 * Inputs:
151 * x0: variant[4:7] and revision[0:3] of current cpu.
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000152 * Shall clobber: x0-x17
Sandrine Bailleuxd4817592016-01-13 14:57:38 +0000153 * ---------------------------------------------------------------------
154 */
155func a57_disable_ldnp_overread
156 /*
157 * Compare x0 against revision r1p2
158 */
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000159 mov x17, x30
160 bl check_errata_disable_ldnp_overread
161 cbz x0, 1f
Sandrine Bailleuxd4817592016-01-13 14:57:38 +0000162 mrs x1, CPUACTLR_EL1
163 orr x1, x1, #CPUACTLR_DIS_OVERREAD
164 msr CPUACTLR_EL1, x1
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +00001651:
166 ret x17
Sandrine Bailleuxd4817592016-01-13 14:57:38 +0000167endfunc a57_disable_ldnp_overread
168
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000169func check_errata_disable_ldnp_overread
170 mov x1, #0x12
171 b cpu_rev_var_ls
172endfunc check_errata_disable_ldnp_overread
173
Sandrine Bailleuxa7e0c532016-04-14 13:32:31 +0100174 /* ---------------------------------------------------
175 * Errata Workaround for Cortex A57 Errata #826974.
176 * This applies only to revision <= r1p1 of Cortex A57.
177 * Inputs:
178 * x0: variant[4:7] and revision[0:3] of current cpu.
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000179 * Shall clobber: x0-x17
Sandrine Bailleuxa7e0c532016-04-14 13:32:31 +0100180 * ---------------------------------------------------
181 */
182func errata_a57_826974_wa
183 /*
184 * Compare x0 against revision r1p1
185 */
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000186 mov x17, x30
187 bl check_errata_826974
188 cbz x0, 1f
Sandrine Bailleuxa7e0c532016-04-14 13:32:31 +0100189 mrs x1, CPUACTLR_EL1
190 orr x1, x1, #CPUACTLR_DIS_LOAD_PASS_DMB
191 msr CPUACTLR_EL1, x1
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +00001921:
193 ret x17
Sandrine Bailleuxa7e0c532016-04-14 13:32:31 +0100194endfunc errata_a57_826974_wa
195
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000196func check_errata_826974
197 mov x1, #0x11
198 b cpu_rev_var_ls
199endfunc check_errata_826974
200
Sandrine Bailleuxc11116f2016-04-14 14:04:48 +0100201 /* ---------------------------------------------------
Sandrine Bailleuxadcbd552016-04-14 14:24:13 +0100202 * Errata Workaround for Cortex A57 Errata #826977.
203 * This applies only to revision <= r1p1 of Cortex A57.
204 * Inputs:
205 * x0: variant[4:7] and revision[0:3] of current cpu.
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000206 * Shall clobber: x0-x17
Sandrine Bailleuxadcbd552016-04-14 14:24:13 +0100207 * ---------------------------------------------------
208 */
209func errata_a57_826977_wa
210 /*
211 * Compare x0 against revision r1p1
212 */
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000213 mov x17, x30
214 bl check_errata_826977
215 cbz x0, 1f
Sandrine Bailleuxadcbd552016-04-14 14:24:13 +0100216 mrs x1, CPUACTLR_EL1
217 orr x1, x1, #CPUACTLR_GRE_NGRE_AS_NGNRE
218 msr CPUACTLR_EL1, x1
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +00002191:
220 ret x17
Sandrine Bailleuxadcbd552016-04-14 14:24:13 +0100221endfunc errata_a57_826977_wa
222
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000223func check_errata_826977
224 mov x1, #0x11
225 b cpu_rev_var_ls
226endfunc check_errata_826977
227
Sandrine Bailleuxadcbd552016-04-14 14:24:13 +0100228 /* ---------------------------------------------------
Sandrine Bailleuxc11116f2016-04-14 14:04:48 +0100229 * Errata Workaround for Cortex A57 Errata #828024.
230 * This applies only to revision <= r1p1 of Cortex A57.
231 * Inputs:
232 * x0: variant[4:7] and revision[0:3] of current cpu.
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000233 * Shall clobber: x0-x17
Sandrine Bailleuxc11116f2016-04-14 14:04:48 +0100234 * ---------------------------------------------------
235 */
236func errata_a57_828024_wa
237 /*
238 * Compare x0 against revision r1p1
239 */
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000240 mov x17, x30
241 bl check_errata_828024
242 cbz x0, 1f
Sandrine Bailleuxc11116f2016-04-14 14:04:48 +0100243 mrs x1, CPUACTLR_EL1
244 /*
245 * Setting the relevant bits in CPUACTLR_EL1 has to be done in 2
246 * instructions here because the resulting bitmask doesn't fit in a
247 * 16-bit value so it cannot be encoded in a single instruction.
248 */
249 orr x1, x1, #CPUACTLR_NO_ALLOC_WBWA
250 orr x1, x1, #(CPUACTLR_DIS_L1_STREAMING | CPUACTLR_DIS_STREAMING)
251 msr CPUACTLR_EL1, x1
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +00002521:
253 ret x17
Sandrine Bailleuxc11116f2016-04-14 14:04:48 +0100254endfunc errata_a57_828024_wa
Sandrine Bailleuxa7e0c532016-04-14 13:32:31 +0100255
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000256func check_errata_828024
257 mov x1, #0x11
258 b cpu_rev_var_ls
259endfunc check_errata_828024
260
Sandrine Bailleux48cbe852016-04-14 14:18:07 +0100261 /* ---------------------------------------------------
262 * Errata Workaround for Cortex A57 Errata #829520.
263 * This applies only to revision <= r1p2 of Cortex A57.
264 * Inputs:
265 * x0: variant[4:7] and revision[0:3] of current cpu.
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000266 * Shall clobber: x0-x17
Sandrine Bailleux48cbe852016-04-14 14:18:07 +0100267 * ---------------------------------------------------
268 */
269func errata_a57_829520_wa
270 /*
271 * Compare x0 against revision r1p2
272 */
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000273 mov x17, x30
274 bl check_errata_829520
275 cbz x0, 1f
Sandrine Bailleux48cbe852016-04-14 14:18:07 +0100276 mrs x1, CPUACTLR_EL1
277 orr x1, x1, #CPUACTLR_DIS_INDIRECT_PREDICTOR
278 msr CPUACTLR_EL1, x1
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +00002791:
280 ret x17
Sandrine Bailleux48cbe852016-04-14 14:18:07 +0100281endfunc errata_a57_829520_wa
282
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000283func check_errata_829520
284 mov x1, #0x12
285 b cpu_rev_var_ls
286endfunc check_errata_829520
287
Sandrine Bailleux143ef1a2016-04-21 11:10:52 +0100288 /* ---------------------------------------------------
289 * Errata Workaround for Cortex A57 Errata #833471.
290 * This applies only to revision <= r1p2 of Cortex A57.
291 * Inputs:
292 * x0: variant[4:7] and revision[0:3] of current cpu.
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000293 * Shall clobber: x0-x17
Sandrine Bailleux143ef1a2016-04-21 11:10:52 +0100294 * ---------------------------------------------------
295 */
296func errata_a57_833471_wa
297 /*
298 * Compare x0 against revision r1p2
299 */
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000300 mov x17, x30
301 bl check_errata_833471
302 cbz x0, 1f
Sandrine Bailleux143ef1a2016-04-21 11:10:52 +0100303 mrs x1, CPUACTLR_EL1
304 orr x1, x1, #CPUACTLR_FORCE_FPSCR_FLUSH
305 msr CPUACTLR_EL1, x1
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +00003061:
307 ret x17
Sandrine Bailleux143ef1a2016-04-21 11:10:52 +0100308endfunc errata_a57_833471_wa
309
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000310func check_errata_833471
311 mov x1, #0x12
312 b cpu_rev_var_ls
313endfunc check_errata_833471
314
Soby Mathewc0884332014-09-22 12:11:36 +0100315 /* -------------------------------------------------
316 * The CPU Ops reset function for Cortex-A57.
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000317 * Shall clobber: x0-x19
Soby Mathewc0884332014-09-22 12:11:36 +0100318 * -------------------------------------------------
319 */
320func cortex_a57_reset_func
321 mov x19, x30
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000322 bl cpu_get_rev_var
323 mov x18, x0
Soby Mathewc0884332014-09-22 12:11:36 +0100324
325#if ERRATA_A57_806969
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000326 mov x0, x18
Soby Mathewc0884332014-09-22 12:11:36 +0100327 bl errata_a57_806969_wa
Soby Mathew802f8652014-08-14 16:19:29 +0100328#endif
329
Soby Mathewc0884332014-09-22 12:11:36 +0100330#if ERRATA_A57_813420
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000331 mov x0, x18
Soby Mathewc0884332014-09-22 12:11:36 +0100332 bl errata_a57_813420_wa
333#endif
Yatharth Kochar36433d12014-11-20 18:09:41 +0000334
Sandrine Bailleuxd4817592016-01-13 14:57:38 +0000335#if A57_DISABLE_NON_TEMPORAL_HINT
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000336 mov x0, x18
Sandrine Bailleuxd4817592016-01-13 14:57:38 +0000337 bl a57_disable_ldnp_overread
338#endif
339
Sandrine Bailleuxa7e0c532016-04-14 13:32:31 +0100340#if ERRATA_A57_826974
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000341 mov x0, x18
Sandrine Bailleuxa7e0c532016-04-14 13:32:31 +0100342 bl errata_a57_826974_wa
343#endif
344
Sandrine Bailleuxadcbd552016-04-14 14:24:13 +0100345#if ERRATA_A57_826977
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000346 mov x0, x18
Sandrine Bailleuxadcbd552016-04-14 14:24:13 +0100347 bl errata_a57_826977_wa
348#endif
349
Sandrine Bailleuxc11116f2016-04-14 14:04:48 +0100350#if ERRATA_A57_828024
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000351 mov x0, x18
Sandrine Bailleuxc11116f2016-04-14 14:04:48 +0100352 bl errata_a57_828024_wa
353#endif
Sandrine Bailleux48cbe852016-04-14 14:18:07 +0100354
355#if ERRATA_A57_829520
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000356 mov x0, x18
Sandrine Bailleux48cbe852016-04-14 14:18:07 +0100357 bl errata_a57_829520_wa
358#endif
359
Sandrine Bailleux143ef1a2016-04-21 11:10:52 +0100360#if ERRATA_A57_833471
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000361 mov x0, x18
Sandrine Bailleux143ef1a2016-04-21 11:10:52 +0100362 bl errata_a57_833471_wa
363#endif
364
Achin Gupta4f6ad662013-10-25 09:08:21 +0100365 /* ---------------------------------------------
Sandrine Bailleuxf12a31d2016-01-29 14:37:58 +0000366 * Enable the SMP bit.
Achin Gupta4f6ad662013-10-25 09:08:21 +0100367 * ---------------------------------------------
368 */
Andrew Thoelkef977ed82014-04-28 12:32:02 +0100369 mrs x0, CPUECTLR_EL1
Achin Gupta4f6ad662013-10-25 09:08:21 +0100370 orr x0, x0, #CPUECTLR_SMP_BIT
Andrew Thoelkef977ed82014-04-28 12:32:02 +0100371 msr CPUECTLR_EL1, x0
Andrew Thoelke42e75a72014-04-28 12:28:39 +0100372 isb
Soby Mathewc0884332014-09-22 12:11:36 +0100373 ret x19
Kévin Petita877c252015-03-24 14:03:57 +0000374endfunc cortex_a57_reset_func
Soby Mathewc704cbc2014-08-14 11:33:56 +0100375
Soby Mathewc0884332014-09-22 12:11:36 +0100376 /* ----------------------------------------------------
377 * The CPU Ops core power down function for Cortex-A57.
378 * ----------------------------------------------------
379 */
Soby Mathew8e2f2872014-08-14 12:49:05 +0100380func cortex_a57_core_pwr_dwn
381 mov x18, x30
382
383 /* ---------------------------------------------
384 * Turn off caches.
385 * ---------------------------------------------
386 */
387 bl cortex_a57_disable_dcache
388
389 /* ---------------------------------------------
390 * Disable the L2 prefetches.
391 * ---------------------------------------------
392 */
393 bl cortex_a57_disable_l2_prefetch
394
395 /* ---------------------------------------------
Soby Mathew42aa5eb2014-09-02 10:47:33 +0100396 * Flush L1 caches.
Soby Mathew8e2f2872014-08-14 12:49:05 +0100397 * ---------------------------------------------
398 */
399 mov x0, #DCCISW
Soby Mathew42aa5eb2014-09-02 10:47:33 +0100400 bl dcsw_op_level1
Soby Mathew8e2f2872014-08-14 12:49:05 +0100401
402 /* ---------------------------------------------
403 * Come out of intra cluster coherency
404 * ---------------------------------------------
405 */
406 bl cortex_a57_disable_smp
407
408 /* ---------------------------------------------
409 * Force the debug interfaces to be quiescent
410 * ---------------------------------------------
411 */
412 mov x30, x18
413 b cortex_a57_disable_ext_debug
Kévin Petita877c252015-03-24 14:03:57 +0000414endfunc cortex_a57_core_pwr_dwn
Soby Mathew8e2f2872014-08-14 12:49:05 +0100415
Soby Mathewc0884332014-09-22 12:11:36 +0100416 /* -------------------------------------------------------
417 * The CPU Ops cluster power down function for Cortex-A57.
418 * -------------------------------------------------------
419 */
Soby Mathew8e2f2872014-08-14 12:49:05 +0100420func cortex_a57_cluster_pwr_dwn
421 mov x18, x30
422
423 /* ---------------------------------------------
424 * Turn off caches.
425 * ---------------------------------------------
426 */
427 bl cortex_a57_disable_dcache
428
429 /* ---------------------------------------------
430 * Disable the L2 prefetches.
431 * ---------------------------------------------
432 */
433 bl cortex_a57_disable_l2_prefetch
434
Soby Mathew937488b2014-09-22 14:13:34 +0100435#if !SKIP_A57_L1_FLUSH_PWR_DWN
Soby Mathew42aa5eb2014-09-02 10:47:33 +0100436 /* -------------------------------------------------
437 * Flush the L1 caches.
438 * -------------------------------------------------
439 */
440 mov x0, #DCCISW
441 bl dcsw_op_level1
Soby Mathew937488b2014-09-22 14:13:34 +0100442#endif
Soby Mathew8e2f2872014-08-14 12:49:05 +0100443 /* ---------------------------------------------
444 * Disable the optional ACP.
445 * ---------------------------------------------
446 */
447 bl plat_disable_acp
448
Soby Mathew42aa5eb2014-09-02 10:47:33 +0100449 /* -------------------------------------------------
450 * Flush the L2 caches.
451 * -------------------------------------------------
Soby Mathew8e2f2872014-08-14 12:49:05 +0100452 */
453 mov x0, #DCCISW
Soby Mathew42aa5eb2014-09-02 10:47:33 +0100454 bl dcsw_op_level2
Soby Mathew8e2f2872014-08-14 12:49:05 +0100455
456 /* ---------------------------------------------
457 * Come out of intra cluster coherency
458 * ---------------------------------------------
459 */
460 bl cortex_a57_disable_smp
461
462 /* ---------------------------------------------
463 * Force the debug interfaces to be quiescent
464 * ---------------------------------------------
465 */
466 mov x30, x18
467 b cortex_a57_disable_ext_debug
Kévin Petita877c252015-03-24 14:03:57 +0000468endfunc cortex_a57_cluster_pwr_dwn
Soby Mathew8e2f2872014-08-14 12:49:05 +0100469
Jeenu Viswambharand5ec3672017-01-03 11:01:51 +0000470#if REPORT_ERRATA
471/*
472 * Errata printing function for Cortex A57. Must follow AAPCS.
473 */
474func cortex_a57_errata_report
475 stp x8, x30, [sp, #-16]!
476
477 bl cpu_get_rev_var
478 mov x8, x0
479
480 /*
481 * Report all errata. The revision-variant information is passed to
482 * checking functions of each errata.
483 */
484 report_errata ERRATA_A57_806969, cortex_a57, 806969
485 report_errata ERRATA_A57_813420, cortex_a57, 813420
486 report_errata A57_DISABLE_NON_TEMPORAL_HINT, cortex_a57, \
487 disable_ldnp_overread
488 report_errata ERRATA_A57_826974, cortex_a57, 826974
489 report_errata ERRATA_A57_826977, cortex_a57, 826977
490 report_errata ERRATA_A57_828024, cortex_a57, 828024
491 report_errata ERRATA_A57_829520, cortex_a57, 829520
492 report_errata ERRATA_A57_833471, cortex_a57, 833471
493
494 ldp x8, x30, [sp], #16
495 ret
496endfunc cortex_a57_errata_report
497#endif
498
Soby Mathew38b4bc92014-08-14 13:36:41 +0100499 /* ---------------------------------------------
500 * This function provides cortex_a57 specific
501 * register information for crash reporting.
502 * It needs to return with x6 pointing to
503 * a list of register names in ascii and
504 * x8 - x15 having values of registers to be
505 * reported.
506 * ---------------------------------------------
507 */
508.section .rodata.cortex_a57_regs, "aS"
509cortex_a57_regs: /* The ascii list of register names to be reported */
Naga Sureshkumar Relli6a72a912016-07-01 12:52:41 +0530510 .asciz "cpuectlr_el1", "cpumerrsr_el1", "l2merrsr_el1", ""
Soby Mathew38b4bc92014-08-14 13:36:41 +0100511
512func cortex_a57_cpu_reg_dump
513 adr x6, cortex_a57_regs
514 mrs x8, CPUECTLR_EL1
Naga Sureshkumar Relli6a72a912016-07-01 12:52:41 +0530515 mrs x9, CPUMERRSR_EL1
516 mrs x10, L2MERRSR_EL1
Soby Mathew38b4bc92014-08-14 13:36:41 +0100517 ret
Kévin Petita877c252015-03-24 14:03:57 +0000518endfunc cortex_a57_cpu_reg_dump
Soby Mathew38b4bc92014-08-14 13:36:41 +0100519
520
Jeenu Viswambharanee5eb802016-11-18 12:58:28 +0000521declare_cpu_ops cortex_a57, CORTEX_A57_MIDR, \
522 cortex_a57_reset_func, \
523 cortex_a57_core_pwr_dwn, \
524 cortex_a57_cluster_pwr_dwn