xref: /rk3399_ARM-atf/lib/cpus/cpu-ops.mk (revision fd7b287cbe9147ca9e07dd9f30c49c58bbdd92a8)
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 794073 workaround when disabling mmu.
57ERRATA_A9_794073	?=0
58
59# Flag to apply erratum 816470 workaround during power down. This erratum
60# applies only to revision >= r3p0 of the Cortex A15 cpu.
61ERRATA_A15_816470	?=0
62
63# Flag to apply erratum 827671 workaround during reset. This erratum applies
64# only to revision >= r3p0 of the Cortex A15 cpu.
65ERRATA_A15_827671	?=0
66
67# Flag to apply erratum 852421 workaround during reset. This erratum applies
68# only to revision <= r1p2 of the Cortex A17 cpu.
69ERRATA_A17_852421	?=0
70
71# Flag to apply erratum 852423 workaround during reset. This erratum applies
72# only to revision <= r1p2 of the Cortex A17 cpu.
73ERRATA_A17_852423	?=0
74
75# Flag to apply erratum 855472 workaround during reset. This erratum applies
76# only to revision r0p0 of the Cortex A35 cpu.
77ERRATA_A35_855472	?=0
78
79# Flag to apply erratum 819472 workaround during reset. This erratum applies
80# only to revision <= r0p1 of the Cortex A53 cpu.
81ERRATA_A53_819472	?=0
82
83# Flag to apply erratum 824069 workaround during reset. This erratum applies
84# only to revision <= r0p2 of the Cortex A53 cpu.
85ERRATA_A53_824069	?=0
86
87# Flag to apply erratum 826319 workaround during reset. This erratum applies
88# only to revision <= r0p2 of the Cortex A53 cpu.
89ERRATA_A53_826319	?=0
90
91# Flag to apply erratum 827319 workaround during reset. This erratum applies
92# only to revision <= r0p2 of the Cortex A53 cpu.
93ERRATA_A53_827319	?=0
94
95# Flag to apply erratum 835769 workaround at compile and link time.  This
96# erratum applies to revision <= r0p4 of the Cortex A53 cpu. Enabling this
97# workaround can lead the linker to create "*.stub" sections.
98ERRATA_A53_835769	?=0
99
100# Flag to apply erratum 836870 workaround during reset. This erratum applies
101# only to revision <= r0p3 of the Cortex A53 cpu. From r0p4 and onwards, this
102# erratum workaround is enabled by default in hardware.
103ERRATA_A53_836870	?=0
104
105# Flag to apply erratum 843419 workaround at link time.
106# This erratum applies to revision <= r0p4 of the Cortex A53 cpu. Enabling this
107# workaround could lead the linker to emit "*.stub" sections which are 4kB
108# aligned.
109ERRATA_A53_843419	?=0
110
111# Flag to apply errata 855873 during reset. This errata applies to all
112# revisions of the Cortex A53 CPU, but this firmware workaround only works
113# for revisions r0p3 and higher. Earlier revisions are taken care
114# of by the rich OS.
115ERRATA_A53_855873	?=0
116
117# Flag to apply erratum 768277 workaround during reset. This erratum applies
118# only to revision r0p0 of the Cortex A55 cpu.
119ERRATA_A55_768277	?=0
120
121# Flag to apply erratum 778703 workaround during reset. This erratum applies
122# only to revision r0p0 of the Cortex A55 cpu.
123ERRATA_A55_778703	?=0
124
125# Flag to apply erratum 798797 workaround during reset. This erratum applies
126# only to revision r0p0 of the Cortex A55 cpu.
127ERRATA_A55_798797	?=0
128
129# Flag to apply erratum 846532 workaround during reset. This erratum applies
130# only to revision <= r0p1 of the Cortex A55 cpu.
131ERRATA_A55_846532	?=0
132
133# Flag to apply erratum 903758 workaround during reset. This erratum applies
134# only to revision <= r0p1 of the Cortex A55 cpu.
135ERRATA_A55_903758	?=0
136
137# Flag to apply erratum 806969 workaround during reset. This erratum applies
138# only to revision r0p0 of the Cortex A57 cpu.
139ERRATA_A57_806969	?=0
140
141# Flag to apply erratum 813419 workaround during reset. This erratum applies
142# only to revision r0p0 of the Cortex A57 cpu.
143ERRATA_A57_813419	?=0
144
145# Flag to apply erratum 813420  workaround during reset. This erratum applies
146# only to revision r0p0 of the Cortex A57 cpu.
147ERRATA_A57_813420	?=0
148
149# Flag to apply erratum 814670  workaround during reset. This erratum applies
150# only to revision r0p0 of the Cortex A57 cpu.
151ERRATA_A57_814670	?=0
152
153# Flag to apply erratum 817169 workaround during power down. This erratum
154# applies only to revision <= r0p1 of the Cortex A57 cpu.
155ERRATA_A57_817169	?=0
156
157# Flag to apply erratum 826974 workaround during reset. This erratum applies
158# only to revision <= r1p1 of the Cortex A57 cpu.
159ERRATA_A57_826974	?=0
160
161# Flag to apply erratum 826977 workaround during reset. This erratum applies
162# only to revision <= r1p1 of the Cortex A57 cpu.
163ERRATA_A57_826977	?=0
164
165# Flag to apply erratum 828024 workaround during reset. This erratum applies
166# only to revision <= r1p1 of the Cortex A57 cpu.
167ERRATA_A57_828024	?=0
168
169# Flag to apply erratum 829520 workaround during reset. This erratum applies
170# only to revision <= r1p2 of the Cortex A57 cpu.
171ERRATA_A57_829520	?=0
172
173# Flag to apply erratum 833471 workaround during reset. This erratum applies
174# only to revision <= r1p2 of the Cortex A57 cpu.
175ERRATA_A57_833471	?=0
176
177# Flag to apply erratum 855972 workaround during reset. This erratum applies
178# only to revision <= r1p3 of the Cortex A57 cpu.
179ERRATA_A57_859972	?=0
180
181# Flag to apply erratum 855971 workaround during reset. This erratum applies
182# only to revision <= r0p3 of the Cortex A72 cpu.
183ERRATA_A72_859971	?=0
184
185# Flag to apply erratum 852427 workaround during reset. This erratum applies
186# only to revision r0p0 of the Cortex A73 cpu.
187ERRATA_A73_852427	?=0
188
189# Flag to apply erratum 855423 workaround during reset. This erratum applies
190# only to revision <= r0p1 of the Cortex A73 cpu.
191ERRATA_A73_855423	?=0
192
193# Flag to apply erratum 764081 workaround during reset. This erratum applies
194# only to revision <= r0p0 of the Cortex A75 cpu.
195ERRATA_A75_764081	?=0
196
197# Flag to apply erratum 790748 workaround during reset. This erratum applies
198# only to revision <= r0p0 of the Cortex A75 cpu.
199ERRATA_A75_790748	?=0
200
201# Flag to apply erratum 1073348 workaround during reset. This erratum applies
202# only to revision <= r1p0 of the Cortex A76 cpu.
203ERRATA_A76_1073348	?=0
204
205# Flag to apply erratum 1130799 workaround during reset. This erratum applies
206# only to revision <= r2p0 of the Cortex A76 cpu.
207ERRATA_A76_1130799	?=0
208
209# Flag to apply erratum 1220197 workaround during reset. This erratum applies
210# only to revision <= r2p0 of the Cortex A76 cpu.
211ERRATA_A76_1220197	?=0
212
213# Flag to apply T32 CLREX workaround during reset. This erratum applies
214# only to r0p0 and r1p0 of the Neoverse N1 cpu.
215ERRATA_N1_1043202	?=1
216
217# Flag to apply DSU erratum 798953. This erratum applies to DSUs revision r0p0.
218# Applying the workaround results in higher DSU power consumption on idle.
219ERRATA_DSU_798953	?=0
220
221# Flag to apply DSU erratum 936184. This erratum applies to DSUs containing
222# the ACP interface and revision < r2p0. Applying the workaround results in
223# higher DSU power consumption on idle.
224ERRATA_DSU_936184	?=0
225
226# Process ERRATA_A9_794073 flag
227$(eval $(call assert_boolean,ERRATA_A9_794073))
228$(eval $(call add_define,ERRATA_A9_794073))
229
230# Process ERRATA_A15_816470 flag
231$(eval $(call assert_boolean,ERRATA_A15_816470))
232$(eval $(call add_define,ERRATA_A15_816470))
233
234# Process ERRATA_A15_827671 flag
235$(eval $(call assert_boolean,ERRATA_A15_827671))
236$(eval $(call add_define,ERRATA_A15_827671))
237
238# Process ERRATA_A17_852421 flag
239$(eval $(call assert_boolean,ERRATA_A17_852421))
240$(eval $(call add_define,ERRATA_A17_852421))
241
242# Process ERRATA_A17_852423 flag
243$(eval $(call assert_boolean,ERRATA_A17_852423))
244$(eval $(call add_define,ERRATA_A17_852423))
245
246# Process ERRATA_A35_855472 flag
247$(eval $(call assert_boolean,ERRATA_A35_855472))
248$(eval $(call add_define,ERRATA_A35_855472))
249
250# Process ERRATA_A53_819472 flag
251$(eval $(call assert_boolean,ERRATA_A53_819472))
252$(eval $(call add_define,ERRATA_A53_819472))
253
254# Process ERRATA_A53_824069 flag
255$(eval $(call assert_boolean,ERRATA_A53_824069))
256$(eval $(call add_define,ERRATA_A53_824069))
257
258# Process ERRATA_A53_826319 flag
259$(eval $(call assert_boolean,ERRATA_A53_826319))
260$(eval $(call add_define,ERRATA_A53_826319))
261
262# Process ERRATA_A53_827319 flag
263$(eval $(call assert_boolean,ERRATA_A53_827319))
264$(eval $(call add_define,ERRATA_A53_827319))
265
266# Process ERRATA_A53_835769 flag
267$(eval $(call assert_boolean,ERRATA_A53_835769))
268$(eval $(call add_define,ERRATA_A53_835769))
269
270# Process ERRATA_A53_836870 flag
271$(eval $(call assert_boolean,ERRATA_A53_836870))
272$(eval $(call add_define,ERRATA_A53_836870))
273
274# Process ERRATA_A53_843419 flag
275$(eval $(call assert_boolean,ERRATA_A53_843419))
276$(eval $(call add_define,ERRATA_A53_843419))
277
278# Process ERRATA_A53_855873 flag
279$(eval $(call assert_boolean,ERRATA_A53_855873))
280$(eval $(call add_define,ERRATA_A53_855873))
281
282# Process ERRATA_A55_768277 flag
283$(eval $(call assert_boolean,ERRATA_A55_768277))
284$(eval $(call add_define,ERRATA_A55_768277))
285
286# Process ERRATA_A55_778703 flag
287$(eval $(call assert_boolean,ERRATA_A55_778703))
288$(eval $(call add_define,ERRATA_A55_778703))
289
290# Process ERRATA_A55_798797 flag
291$(eval $(call assert_boolean,ERRATA_A55_798797))
292$(eval $(call add_define,ERRATA_A55_798797))
293
294# Process ERRATA_A55_846532 flag
295$(eval $(call assert_boolean,ERRATA_A55_846532))
296$(eval $(call add_define,ERRATA_A55_846532))
297
298# Process ERRATA_A55_903758 flag
299$(eval $(call assert_boolean,ERRATA_A55_903758))
300$(eval $(call add_define,ERRATA_A55_903758))
301
302# Process ERRATA_A57_806969 flag
303$(eval $(call assert_boolean,ERRATA_A57_806969))
304$(eval $(call add_define,ERRATA_A57_806969))
305
306# Process ERRATA_A57_813419 flag
307$(eval $(call assert_boolean,ERRATA_A57_813419))
308$(eval $(call add_define,ERRATA_A57_813419))
309
310# Process ERRATA_A57_813420 flag
311$(eval $(call assert_boolean,ERRATA_A57_813420))
312$(eval $(call add_define,ERRATA_A57_813420))
313
314# Process ERRATA_A57_814670 flag
315$(eval $(call assert_boolean,ERRATA_A57_814670))
316$(eval $(call add_define,ERRATA_A57_814670))
317
318# Process ERRATA_A57_817169 flag
319$(eval $(call assert_boolean,ERRATA_A57_817169))
320$(eval $(call add_define,ERRATA_A57_817169))
321
322# Process ERRATA_A57_826974 flag
323$(eval $(call assert_boolean,ERRATA_A57_826974))
324$(eval $(call add_define,ERRATA_A57_826974))
325
326# Process ERRATA_A57_826977 flag
327$(eval $(call assert_boolean,ERRATA_A57_826977))
328$(eval $(call add_define,ERRATA_A57_826977))
329
330# Process ERRATA_A57_828024 flag
331$(eval $(call assert_boolean,ERRATA_A57_828024))
332$(eval $(call add_define,ERRATA_A57_828024))
333
334# Process ERRATA_A57_829520 flag
335$(eval $(call assert_boolean,ERRATA_A57_829520))
336$(eval $(call add_define,ERRATA_A57_829520))
337
338# Process ERRATA_A57_833471 flag
339$(eval $(call assert_boolean,ERRATA_A57_833471))
340$(eval $(call add_define,ERRATA_A57_833471))
341
342# Process ERRATA_A57_859972 flag
343$(eval $(call assert_boolean,ERRATA_A57_859972))
344$(eval $(call add_define,ERRATA_A57_859972))
345
346# Process ERRATA_A72_859971 flag
347$(eval $(call assert_boolean,ERRATA_A72_859971))
348$(eval $(call add_define,ERRATA_A72_859971))
349
350# Process ERRATA_A73_852427 flag
351$(eval $(call assert_boolean,ERRATA_A73_852427))
352$(eval $(call add_define,ERRATA_A73_852427))
353
354# Process ERRATA_A73_855423 flag
355$(eval $(call assert_boolean,ERRATA_A73_855423))
356$(eval $(call add_define,ERRATA_A73_855423))
357
358# Process ERRATA_A75_764081 flag
359$(eval $(call assert_boolean,ERRATA_A75_764081))
360$(eval $(call add_define,ERRATA_A75_764081))
361
362# Process ERRATA_A75_790748 flag
363$(eval $(call assert_boolean,ERRATA_A75_790748))
364$(eval $(call add_define,ERRATA_A75_790748))
365
366# Process ERRATA_A76_1073348 flag
367$(eval $(call assert_boolean,ERRATA_A76_1073348))
368$(eval $(call add_define,ERRATA_A76_1073348))
369
370# Process ERRATA_A76_1130799 flag
371$(eval $(call assert_boolean,ERRATA_A76_1130799))
372$(eval $(call add_define,ERRATA_A76_1130799))
373
374# Process ERRATA_A76_1220197 flag
375$(eval $(call assert_boolean,ERRATA_A76_1220197))
376$(eval $(call add_define,ERRATA_A76_1220197))
377
378# Process ERRATA_N1_1043202 flag
379$(eval $(call assert_boolean,ERRATA_N1_1043202))
380$(eval $(call add_define,ERRATA_N1_1043202))
381
382# Process ERRATA_DSU_798953 flag
383$(eval $(call assert_boolean,ERRATA_DSU_798953))
384$(eval $(call add_define,ERRATA_DSU_798953))
385
386# Process ERRATA_DSU_936184 flag
387$(eval $(call assert_boolean,ERRATA_DSU_936184))
388$(eval $(call add_define,ERRATA_DSU_936184))
389
390# Errata build flags
391ifneq (${ERRATA_A53_843419},0)
392TF_LDFLAGS_aarch64	+= --fix-cortex-a53-843419
393endif
394
395ifneq (${ERRATA_A53_835769},0)
396TF_CFLAGS_aarch64	+= -mfix-cortex-a53-835769
397TF_LDFLAGS_aarch64	+= --fix-cortex-a53-835769
398endif
399