xref: /rk3399_ARM-atf/lib/cpus/cpu-ops.mk (revision cf6c30e08ba54a22a0ce8abd6eac8b1d1ccad324)
1#
2# Copyright (c) 2014-2019, ARM Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7# Cortex A57 specific optimisation to skip L1 cache flush when
8# cluster is powered down.
9SKIP_A57_L1_FLUSH_PWR_DWN	?=0
10
11# Flag to disable the cache non-temporal hint.
12# It is enabled by default.
13A53_DISABLE_NON_TEMPORAL_HINT	?=1
14
15# Flag to disable the cache non-temporal hint.
16# It is enabled by default.
17A57_DISABLE_NON_TEMPORAL_HINT	?=1
18
19WORKAROUND_CVE_2017_5715	?=1
20WORKAROUND_CVE_2018_3639	?=1
21DYNAMIC_WORKAROUND_CVE_2018_3639	?=0
22
23# Process SKIP_A57_L1_FLUSH_PWR_DWN flag
24$(eval $(call assert_boolean,SKIP_A57_L1_FLUSH_PWR_DWN))
25$(eval $(call add_define,SKIP_A57_L1_FLUSH_PWR_DWN))
26
27# Process A53_DISABLE_NON_TEMPORAL_HINT flag
28$(eval $(call assert_boolean,A53_DISABLE_NON_TEMPORAL_HINT))
29$(eval $(call add_define,A53_DISABLE_NON_TEMPORAL_HINT))
30
31# Process A57_DISABLE_NON_TEMPORAL_HINT flag
32$(eval $(call assert_boolean,A57_DISABLE_NON_TEMPORAL_HINT))
33$(eval $(call add_define,A57_DISABLE_NON_TEMPORAL_HINT))
34
35# Process WORKAROUND_CVE_2017_5715 flag
36$(eval $(call assert_boolean,WORKAROUND_CVE_2017_5715))
37$(eval $(call add_define,WORKAROUND_CVE_2017_5715))
38
39# Process WORKAROUND_CVE_2018_3639 flag
40$(eval $(call assert_boolean,WORKAROUND_CVE_2018_3639))
41$(eval $(call add_define,WORKAROUND_CVE_2018_3639))
42
43$(eval $(call assert_boolean,DYNAMIC_WORKAROUND_CVE_2018_3639))
44$(eval $(call add_define,DYNAMIC_WORKAROUND_CVE_2018_3639))
45
46ifneq (${DYNAMIC_WORKAROUND_CVE_2018_3639},0)
47    ifeq (${WORKAROUND_CVE_2018_3639},0)
48        $(error "Error: WORKAROUND_CVE_2018_3639 must be 1 if DYNAMIC_WORKAROUND_CVE_2018_3639 is 1")
49    endif
50endif
51
52# CPU Errata Build flags.
53# These should be enabled by the platform if the erratum workaround needs to be
54# applied.
55
56# Flag to apply erratum 819472 workaround during reset. This erratum applies
57# only to revision <= r0p1 of the Cortex A53 cpu.
58ERRATA_A53_819472	?=0
59
60# Flag to apply erratum 824069 workaround during reset. This erratum applies
61# only to revision <= r0p2 of the Cortex A53 cpu.
62ERRATA_A53_824069	?=0
63
64# Flag to apply erratum 826319 workaround during reset. This erratum applies
65# only to revision <= r0p2 of the Cortex A53 cpu.
66ERRATA_A53_826319	?=0
67
68# Flag to apply erratum 827319 workaround during reset. This erratum applies
69# only to revision <= r0p2 of the Cortex A53 cpu.
70ERRATA_A53_827319	?=0
71
72# Flag to apply erratum 835769 workaround at compile and link time.  This
73# erratum applies to revision <= r0p4 of the Cortex A53 cpu. Enabling this
74# workaround can lead the linker to create "*.stub" sections.
75ERRATA_A53_835769	?=0
76
77# Flag to apply erratum 836870 workaround during reset. This erratum applies
78# only to revision <= r0p3 of the Cortex A53 cpu. From r0p4 and onwards, this
79# erratum workaround is enabled by default in hardware.
80ERRATA_A53_836870	?=0
81
82# Flag to apply erratum 843419 workaround at link time.
83# This erratum applies to revision <= r0p4 of the Cortex A53 cpu. Enabling this
84# workaround could lead the linker to emit "*.stub" sections which are 4kB
85# aligned.
86ERRATA_A53_843419	?=0
87
88# Flag to apply errata 855873 during reset. This errata applies to all
89# revisions of the Cortex A53 CPU, but this firmware workaround only works
90# for revisions r0p3 and higher. Earlier revisions are taken care
91# of by the rich OS.
92ERRATA_A53_855873	?=0
93
94# Flag to apply erratum 768277 workaround during reset. This erratum applies
95# only to revision r0p0 of the Cortex A55 cpu.
96ERRATA_A55_768277	?=0
97
98# Flag to apply erratum 778703 workaround during reset. This erratum applies
99# only to revision r0p0 of the Cortex A55 cpu.
100ERRATA_A55_778703	?=0
101
102# Flag to apply erratum 798797 workaround during reset. This erratum applies
103# only to revision r0p0 of the Cortex A55 cpu.
104ERRATA_A55_798797	?=0
105
106# Flag to apply erratum 846532 workaround during reset. This erratum applies
107# only to revision <= r0p1 of the Cortex A55 cpu.
108ERRATA_A55_846532	?=0
109
110# Flag to apply erratum 903758 workaround during reset. This erratum applies
111# only to revision <= r0p1 of the Cortex A55 cpu.
112ERRATA_A55_903758	?=0
113
114# Flag to apply erratum 806969 workaround during reset. This erratum applies
115# only to revision r0p0 of the Cortex A57 cpu.
116ERRATA_A57_806969	?=0
117
118# Flag to apply erratum 813419 workaround during reset. This erratum applies
119# only to revision r0p0 of the Cortex A57 cpu.
120ERRATA_A57_813419	?=0
121
122# Flag to apply erratum 813420  workaround during reset. This erratum applies
123# only to revision r0p0 of the Cortex A57 cpu.
124ERRATA_A57_813420	?=0
125
126# Flag to apply erratum 814670  workaround during reset. This erratum applies
127# only to revision r0p0 of the Cortex A57 cpu.
128ERRATA_A57_814670	?=0
129
130# Flag to apply erratum 817169 workaround during power down. This erratum
131# applies only to revision <= r0p1 of the Cortex A57 cpu.
132ERRATA_A57_817169	?=0
133
134# Flag to apply erratum 826974 workaround during reset. This erratum applies
135# only to revision <= r1p1 of the Cortex A57 cpu.
136ERRATA_A57_826974	?=0
137
138# Flag to apply erratum 826977 workaround during reset. This erratum applies
139# only to revision <= r1p1 of the Cortex A57 cpu.
140ERRATA_A57_826977	?=0
141
142# Flag to apply erratum 828024 workaround during reset. This erratum applies
143# only to revision <= r1p1 of the Cortex A57 cpu.
144ERRATA_A57_828024	?=0
145
146# Flag to apply erratum 829520 workaround during reset. This erratum applies
147# only to revision <= r1p2 of the Cortex A57 cpu.
148ERRATA_A57_829520	?=0
149
150# Flag to apply erratum 833471 workaround during reset. This erratum applies
151# only to revision <= r1p2 of the Cortex A57 cpu.
152ERRATA_A57_833471	?=0
153
154# Flag to apply erratum 855972 workaround during reset. This erratum applies
155# only to revision <= r1p3 of the Cortex A57 cpu.
156ERRATA_A57_859972	?=0
157
158# Flag to apply erratum 855971 workaround during reset. This erratum applies
159# only to revision <= r0p3 of the Cortex A72 cpu.
160ERRATA_A72_859971	?=0
161
162# Flag to apply erratum 852427 workaround during reset. This erratum applies
163# only to revision r0p0 of the Cortex A73 cpu.
164ERRATA_A73_852427	?=0
165
166# Flag to apply erratum 855423 workaround during reset. This erratum applies
167# only to revision <= r0p1 of the Cortex A73 cpu.
168ERRATA_A73_855423	?=0
169
170# Flag to apply erratum 764081 workaround during reset. This erratum applies
171# only to revision <= r0p0 of the Cortex A75 cpu.
172ERRATA_A75_764081	?=0
173
174# Flag to apply erratum 790748 workaround during reset. This erratum applies
175# only to revision <= r0p0 of the Cortex A75 cpu.
176ERRATA_A75_790748	?=0
177
178# Flag to apply erratum 1073348 workaround during reset. This erratum applies
179# only to revision <= r1p0 of the Cortex A76 cpu.
180ERRATA_A76_1073348	?=0
181
182# Flag to apply erratum 1130799 workaround during reset. This erratum applies
183# only to revision <= r2p0 of the Cortex A76 cpu.
184ERRATA_A76_1130799	?=0
185
186# Flag to apply erratum 1220197 workaround during reset. This erratum applies
187# only to revision <= r2p0 of the Cortex A76 cpu.
188ERRATA_A76_1220197	?=0
189
190# Flag to apply T32 CLREX workaround during reset. This erratum applies
191# only to r0p0 and r1p0 of the Neoverse N1 cpu.
192ERRATA_N1_1043202	?=1
193
194# Flag to apply DSU erratum 936184. This erratum applies to DSUs containing
195# the ACP interface and revision < r2p0. Applying the workaround results in
196# higher DSU power consumption on idle.
197ERRATA_DSU_936184	?=0
198
199# Process ERRATA_A53_819472 flag
200$(eval $(call assert_boolean,ERRATA_A53_819472))
201$(eval $(call add_define,ERRATA_A53_819472))
202
203# Process ERRATA_A53_824069 flag
204$(eval $(call assert_boolean,ERRATA_A53_824069))
205$(eval $(call add_define,ERRATA_A53_824069))
206
207# Process ERRATA_A53_826319 flag
208$(eval $(call assert_boolean,ERRATA_A53_826319))
209$(eval $(call add_define,ERRATA_A53_826319))
210
211# Process ERRATA_A53_827319 flag
212$(eval $(call assert_boolean,ERRATA_A53_827319))
213$(eval $(call add_define,ERRATA_A53_827319))
214
215# Process ERRATA_A53_835769 flag
216$(eval $(call assert_boolean,ERRATA_A53_835769))
217$(eval $(call add_define,ERRATA_A53_835769))
218
219# Process ERRATA_A53_836870 flag
220$(eval $(call assert_boolean,ERRATA_A53_836870))
221$(eval $(call add_define,ERRATA_A53_836870))
222
223# Process ERRATA_A53_843419 flag
224$(eval $(call assert_boolean,ERRATA_A53_843419))
225$(eval $(call add_define,ERRATA_A53_843419))
226
227# Process ERRATA_A53_855873 flag
228$(eval $(call assert_boolean,ERRATA_A53_855873))
229$(eval $(call add_define,ERRATA_A53_855873))
230
231# Process ERRATA_A55_768277 flag
232$(eval $(call assert_boolean,ERRATA_A55_768277))
233$(eval $(call add_define,ERRATA_A55_768277))
234
235# Process ERRATA_A55_778703 flag
236$(eval $(call assert_boolean,ERRATA_A55_778703))
237$(eval $(call add_define,ERRATA_A55_778703))
238
239# Process ERRATA_A55_798797 flag
240$(eval $(call assert_boolean,ERRATA_A55_798797))
241$(eval $(call add_define,ERRATA_A55_798797))
242
243# Process ERRATA_A55_846532 flag
244$(eval $(call assert_boolean,ERRATA_A55_846532))
245$(eval $(call add_define,ERRATA_A55_846532))
246
247# Process ERRATA_A55_903758 flag
248$(eval $(call assert_boolean,ERRATA_A55_903758))
249$(eval $(call add_define,ERRATA_A55_903758))
250
251# Process ERRATA_A57_806969 flag
252$(eval $(call assert_boolean,ERRATA_A57_806969))
253$(eval $(call add_define,ERRATA_A57_806969))
254
255# Process ERRATA_A57_813419 flag
256$(eval $(call assert_boolean,ERRATA_A57_813419))
257$(eval $(call add_define,ERRATA_A57_813419))
258
259# Process ERRATA_A57_813420 flag
260$(eval $(call assert_boolean,ERRATA_A57_813420))
261$(eval $(call add_define,ERRATA_A57_813420))
262
263# Process ERRATA_A57_814670 flag
264$(eval $(call assert_boolean,ERRATA_A57_814670))
265$(eval $(call add_define,ERRATA_A57_814670))
266
267# Process ERRATA_A57_817169 flag
268$(eval $(call assert_boolean,ERRATA_A57_817169))
269$(eval $(call add_define,ERRATA_A57_817169))
270
271# Process ERRATA_A57_826974 flag
272$(eval $(call assert_boolean,ERRATA_A57_826974))
273$(eval $(call add_define,ERRATA_A57_826974))
274
275# Process ERRATA_A57_826977 flag
276$(eval $(call assert_boolean,ERRATA_A57_826977))
277$(eval $(call add_define,ERRATA_A57_826977))
278
279# Process ERRATA_A57_828024 flag
280$(eval $(call assert_boolean,ERRATA_A57_828024))
281$(eval $(call add_define,ERRATA_A57_828024))
282
283# Process ERRATA_A57_829520 flag
284$(eval $(call assert_boolean,ERRATA_A57_829520))
285$(eval $(call add_define,ERRATA_A57_829520))
286
287# Process ERRATA_A57_833471 flag
288$(eval $(call assert_boolean,ERRATA_A57_833471))
289$(eval $(call add_define,ERRATA_A57_833471))
290
291# Process ERRATA_A57_859972 flag
292$(eval $(call assert_boolean,ERRATA_A57_859972))
293$(eval $(call add_define,ERRATA_A57_859972))
294
295# Process ERRATA_A72_859971 flag
296$(eval $(call assert_boolean,ERRATA_A72_859971))
297$(eval $(call add_define,ERRATA_A72_859971))
298
299# Process ERRATA_A73_852427 flag
300$(eval $(call assert_boolean,ERRATA_A73_852427))
301$(eval $(call add_define,ERRATA_A73_852427))
302
303# Process ERRATA_A73_855423 flag
304$(eval $(call assert_boolean,ERRATA_A73_855423))
305$(eval $(call add_define,ERRATA_A73_855423))
306
307# Process ERRATA_A75_764081 flag
308$(eval $(call assert_boolean,ERRATA_A75_764081))
309$(eval $(call add_define,ERRATA_A75_764081))
310
311# Process ERRATA_A75_790748 flag
312$(eval $(call assert_boolean,ERRATA_A75_790748))
313$(eval $(call add_define,ERRATA_A75_790748))
314
315# Process ERRATA_A76_1073348 flag
316$(eval $(call assert_boolean,ERRATA_A76_1073348))
317$(eval $(call add_define,ERRATA_A76_1073348))
318
319# Process ERRATA_A76_1130799 flag
320$(eval $(call assert_boolean,ERRATA_A76_1130799))
321$(eval $(call add_define,ERRATA_A76_1130799))
322
323# Process ERRATA_A76_1220197 flag
324$(eval $(call assert_boolean,ERRATA_A76_1220197))
325$(eval $(call add_define,ERRATA_A76_1220197))
326
327# Process ERRATA_N1_1043202 flag
328$(eval $(call assert_boolean,ERRATA_N1_1043202))
329$(eval $(call add_define,ERRATA_N1_1043202))
330
331# Process ERRATA_DSU_936184 flag
332$(eval $(call assert_boolean,ERRATA_DSU_936184))
333$(eval $(call add_define,ERRATA_DSU_936184))
334
335# Errata build flags
336ifneq (${ERRATA_A53_843419},0)
337TF_LDFLAGS_aarch64	+= --fix-cortex-a53-843419
338endif
339
340ifneq (${ERRATA_A53_835769},0)
341TF_CFLAGS_aarch64	+= -mfix-cortex-a53-835769
342TF_LDFLAGS_aarch64	+= --fix-cortex-a53-835769
343endif
344