2 * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
4 * SPDX-License-Identifier: BSD-3-Clause
8 #include <asm_macros.S>
9 #include <assert_macros.S>
10 #include <common/debug.h>
11 #include <cortex_a53.h>
12 #include <cpu_macros.S>
14 #if A53_DISABLE_NON_TEMPORAL_HINT
15 #undef ERRATA_A53_836870
16 #define ERRATA_A53_836870 1
19 /* ---------------------------------------------
20 * Disable intra-cluster coherency
21 * ---------------------------------------------
23 func cortex_a53_disable_smp
24 ldcopr16 r0, r1, CORTEX_A53_ECTLR
25 bic64_imm r0, r1, CORTEX_A53_ECTLR_SMP_BIT
26 stcopr16 r0, r1, CORTEX_A53_ECTLR
30 endfunc cortex_a53_disable_smp
32 /* --------------------------------------------------
33 * Errata Workaround for Cortex A53 Errata #826319.
34 * This applies only to revision <= r0p2 of Cortex A53.
36 * r0: variant[4:7] and revision[0:3] of current cpu.
37 * Shall clobber: r0-r3
38 * --------------------------------------------------
40 func errata_a53_826319_wa
42 * Compare r0 against revision r0p2
45 bl check_errata_826319
47 cmp r0, #ERRATA_NOT_APPLIES
49 ldcopr r0, CORTEX_A53_L2ACTLR
50 bic r0, #CORTEX_A53_L2ACTLR_ENABLE_UNIQUECLEAN
51 orr r0, #CORTEX_A53_L2ACTLR_DISABLE_CLEAN_PUSH
52 stcopr r0, CORTEX_A53_L2ACTLR
55 endfunc errata_a53_826319_wa
57 func check_errata_826319
60 endfunc check_errata_826319
62 /* ---------------------------------------------------------------------
63 * Disable the cache non-temporal hint.
65 * This ignores the Transient allocation hint in the MAIR and treats
66 * allocations the same as non-transient allocation types. As a result,
67 * the LDNP and STNP instructions in AArch64 behave the same as the
68 * equivalent LDP and STP instructions.
70 * This is relevant only for revisions <= r0p3 of Cortex-A53.
71 * From r0p4 and onwards, the bit to disable the hint is enabled by
75 * r0: variant[4:7] and revision[0:3] of current cpu.
76 * Shall clobber: r0-r3
77 * ---------------------------------------------------------------------
79 func a53_disable_non_temporal_hint
81 * Compare r0 against revision r0p3
84 bl check_errata_disable_non_temporal_hint
86 cmp r0, #ERRATA_NOT_APPLIES
88 ldcopr16 r0, r1, CORTEX_A53_CPUACTLR
89 orr64_imm r0, r1, CORTEX_A53_CPUACTLR_DTAH
90 stcopr16 r0, r1, CORTEX_A53_CPUACTLR
93 endfunc a53_disable_non_temporal_hint
95 func check_errata_disable_non_temporal_hint
98 endfunc check_errata_disable_non_temporal_hint
100 /* --------------------------------------------------
101 * Errata Workaround for Cortex A53 Errata #855873.
103 * This applies only to revisions >= r0p3 of Cortex A53.
104 * Earlier revisions of the core are affected as well, but don't
105 * have the chicken bit in the CPUACTLR register. It is expected that
106 * the rich OS takes care of that, especially as the workaround is
107 * shared with other erratas in those revisions of the CPU.
109 * r0: variant[4:7] and revision[0:3] of current cpu.
110 * Shall clobber: r0-r3
111 * --------------------------------------------------
113 func errata_a53_855873_wa
115 * Compare r0 against revision r0p3 and higher
118 bl check_errata_855873
120 cmp r0, #ERRATA_NOT_APPLIES
122 ldcopr16 r0, r1, CORTEX_A53_CPUACTLR
123 orr64_imm r0, r1, CORTEX_A53_CPUACTLR_ENDCCASCI
124 stcopr16 r0, r1, CORTEX_A53_CPUACTLR
127 endfunc errata_a53_855873_wa
129 func check_errata_855873
132 endfunc check_errata_855873
134 /* -------------------------------------------------
135 * The CPU Ops reset function for Cortex-A53.
136 * Shall clobber: r0-r6
137 * -------------------------------------------------
139 func cortex_a53_reset_func
144 #if ERRATA_A53_826319
146 bl errata_a53_826319_wa
149 #if ERRATA_A53_836870
151 bl a53_disable_non_temporal_hint
154 #if ERRATA_A53_855873
156 bl errata_a53_855873_wa
159 /* ---------------------------------------------
160 * Enable the SMP bit.
161 * ---------------------------------------------
163 ldcopr16 r0, r1, CORTEX_A53_ECTLR
164 orr64_imm r0, r1, CORTEX_A53_ECTLR_SMP_BIT
165 stcopr16 r0, r1, CORTEX_A53_ECTLR
168 endfunc cortex_a53_reset_func
170 /* ----------------------------------------------------
171 * The CPU Ops core power down function for Cortex-A53.
172 * ----------------------------------------------------
174 func cortex_a53_core_pwr_dwn
177 /* Assert if cache is enabled */
178 #if ENABLE_ASSERTIONS
184 /* ---------------------------------------------
186 * ---------------------------------------------
191 /* ---------------------------------------------
192 * Come out of intra cluster coherency
193 * ---------------------------------------------
196 b cortex_a53_disable_smp
197 endfunc cortex_a53_core_pwr_dwn
199 /* -------------------------------------------------------
200 * The CPU Ops cluster power down function for Cortex-A53.
202 * -------------------------------------------------------
204 func cortex_a53_cluster_pwr_dwn
207 /* Assert if cache is enabled */
208 #if ENABLE_ASSERTIONS
214 /* ---------------------------------------------
216 * ---------------------------------------------
221 /* ---------------------------------------------
222 * Disable the optional ACP.
223 * ---------------------------------------------
227 /* ---------------------------------------------
229 * ---------------------------------------------
234 /* ---------------------------------------------
235 * Come out of intra cluster coherency
236 * ---------------------------------------------
239 b cortex_a53_disable_smp
240 endfunc cortex_a53_cluster_pwr_dwn
244 * Errata printing function for Cortex A53. Must follow AAPCS.
246 func cortex_a53_errata_report
253 * Report all errata. The revision-variant information is passed to
254 * checking functions of each errata.
256 report_errata ERRATA_A53_826319, cortex_a53, 826319
257 report_errata ERRATA_A53_836870, cortex_a53, disable_non_temporal_hint
258 report_errata ERRATA_A53_855873, cortex_a53, 855873
262 endfunc cortex_a53_errata_report
265 declare_cpu_ops cortex_a53, CORTEX_A53_MIDR, \
266 cortex_a53_reset_func, \
267 cortex_a53_core_pwr_dwn, \
268 cortex_a53_cluster_pwr_dwn