xref: /rk3399_ARM-atf/lib/cpus/cpu-ops.mk (revision 5bd2c24f17fa24e8ee9e468c1401c809a97aae53)
15541bb3fSSoby Mathew#
2da6d75a0SJohn Tsichritzis# Copyright (c) 2014-2019, ARM Limited and Contributors. All rights reserved.
35541bb3fSSoby Mathew#
482cb2c1aSdp-arm# SPDX-License-Identifier: BSD-3-Clause
55541bb3fSSoby Mathew#
65541bb3fSSoby Mathew
75541bb3fSSoby Mathew# Cortex A57 specific optimisation to skip L1 cache flush when
85541bb3fSSoby Mathew# cluster is powered down.
95541bb3fSSoby MathewSKIP_A57_L1_FLUSH_PWR_DWN	?=0
105541bb3fSSoby Mathew
1154035fc4SSandrine Bailleux# Flag to disable the cache non-temporal hint.
1254035fc4SSandrine Bailleux# It is enabled by default.
1354035fc4SSandrine BailleuxA53_DISABLE_NON_TEMPORAL_HINT	?=1
1454035fc4SSandrine Bailleux
1554035fc4SSandrine Bailleux# Flag to disable the cache non-temporal hint.
1654035fc4SSandrine Bailleux# It is enabled by default.
1754035fc4SSandrine BailleuxA57_DISABLE_NON_TEMPORAL_HINT	?=1
1854035fc4SSandrine Bailleux
19f62ad322SDimitris PapastamosWORKAROUND_CVE_2017_5715	?=1
20b8a25bbbSDimitris PapastamosWORKAROUND_CVE_2018_3639	?=1
21fe007b2eSDimitris PapastamosDYNAMIC_WORKAROUND_CVE_2018_3639	?=0
22f62ad322SDimitris Papastamos
235541bb3fSSoby Mathew# Process SKIP_A57_L1_FLUSH_PWR_DWN flag
245541bb3fSSoby Mathew$(eval $(call assert_boolean,SKIP_A57_L1_FLUSH_PWR_DWN))
255541bb3fSSoby Mathew$(eval $(call add_define,SKIP_A57_L1_FLUSH_PWR_DWN))
265541bb3fSSoby Mathew
2754035fc4SSandrine Bailleux# Process A53_DISABLE_NON_TEMPORAL_HINT flag
2854035fc4SSandrine Bailleux$(eval $(call assert_boolean,A53_DISABLE_NON_TEMPORAL_HINT))
2954035fc4SSandrine Bailleux$(eval $(call add_define,A53_DISABLE_NON_TEMPORAL_HINT))
3054035fc4SSandrine Bailleux
3154035fc4SSandrine Bailleux# Process A57_DISABLE_NON_TEMPORAL_HINT flag
3254035fc4SSandrine Bailleux$(eval $(call assert_boolean,A57_DISABLE_NON_TEMPORAL_HINT))
3354035fc4SSandrine Bailleux$(eval $(call add_define,A57_DISABLE_NON_TEMPORAL_HINT))
3454035fc4SSandrine Bailleux
35f62ad322SDimitris Papastamos# Process WORKAROUND_CVE_2017_5715 flag
36f62ad322SDimitris Papastamos$(eval $(call assert_boolean,WORKAROUND_CVE_2017_5715))
37f62ad322SDimitris Papastamos$(eval $(call add_define,WORKAROUND_CVE_2017_5715))
385541bb3fSSoby Mathew
39b8a25bbbSDimitris Papastamos# Process WORKAROUND_CVE_2018_3639 flag
40b8a25bbbSDimitris Papastamos$(eval $(call assert_boolean,WORKAROUND_CVE_2018_3639))
41b8a25bbbSDimitris Papastamos$(eval $(call add_define,WORKAROUND_CVE_2018_3639))
42b8a25bbbSDimitris Papastamos
43fe007b2eSDimitris Papastamos$(eval $(call assert_boolean,DYNAMIC_WORKAROUND_CVE_2018_3639))
44fe007b2eSDimitris Papastamos$(eval $(call add_define,DYNAMIC_WORKAROUND_CVE_2018_3639))
45fe007b2eSDimitris Papastamos
46fe007b2eSDimitris Papastamosifneq (${DYNAMIC_WORKAROUND_CVE_2018_3639},0)
47fe007b2eSDimitris Papastamos    ifeq (${WORKAROUND_CVE_2018_3639},0)
48fe007b2eSDimitris Papastamos        $(error "Error: WORKAROUND_CVE_2018_3639 must be 1 if DYNAMIC_WORKAROUND_CVE_2018_3639 is 1")
49fe007b2eSDimitris Papastamos    endif
50fe007b2eSDimitris Papastamosendif
51fe007b2eSDimitris Papastamos
52097b787aSSandrine Bailleux# CPU Errata Build flags.
53097b787aSSandrine Bailleux# These should be enabled by the platform if the erratum workaround needs to be
54097b787aSSandrine Bailleux# applied.
555541bb3fSSoby Mathew
56097b787aSSandrine Bailleux# Flag to apply erratum 826319 workaround during reset. This erratum applies
57097b787aSSandrine Bailleux# only to revision <= r0p2 of the Cortex A53 cpu.
586b0d97b2SJimmy HuangERRATA_A53_826319	?=0
596b0d97b2SJimmy Huang
60a94cc374SDouglas Raillard# Flag to apply erratum 835769 workaround at compile and link time.  This
61a94cc374SDouglas Raillard# erratum applies to revision <= r0p4 of the Cortex A53 cpu. Enabling this
62a94cc374SDouglas Raillard# workaround can lead the linker to create "*.stub" sections.
63a94cc374SDouglas RaillardERRATA_A53_835769	?=0
64a94cc374SDouglas Raillard
65097b787aSSandrine Bailleux# Flag to apply erratum 836870 workaround during reset. This erratum applies
66097b787aSSandrine Bailleux# only to revision <= r0p3 of the Cortex A53 cpu. From r0p4 and onwards, this
673fbe46d7SDouglas Raillard# erratum workaround is enabled by default in hardware.
686b0d97b2SJimmy HuangERRATA_A53_836870	?=0
696b0d97b2SJimmy Huang
70a94cc374SDouglas Raillard# Flag to apply erratum 843419 workaround at link time.
71a94cc374SDouglas Raillard# This erratum applies to revision <= r0p4 of the Cortex A53 cpu. Enabling this
72a94cc374SDouglas Raillard# workaround could lead the linker to emit "*.stub" sections which are 4kB
73a94cc374SDouglas Raillard# aligned.
74a94cc374SDouglas RaillardERRATA_A53_843419	?=0
75a94cc374SDouglas Raillard
76b75dc0e4SAndre Przywara# Flag to apply errata 855873 during reset. This errata applies to all
77b75dc0e4SAndre Przywara# revisions of the Cortex A53 CPU, but this firmware workaround only works
78b75dc0e4SAndre Przywara# for revisions r0p3 and higher. Earlier revisions are taken care
79b75dc0e4SAndre Przywara# of by the rich OS.
80b75dc0e4SAndre PrzywaraERRATA_A53_855873	?=0
81b75dc0e4SAndre Przywara
821afeee92SAmbroise Vincent# Flag to apply erratum 768277 workaround during reset. This erratum applies
831afeee92SAmbroise Vincent# only to revision r0p0 of the Cortex A55 cpu.
841afeee92SAmbroise VincentERRATA_A55_768277	?=0
851afeee92SAmbroise Vincent
86a6cc6610SAmbroise Vincent# Flag to apply erratum 778703 workaround during reset. This erratum applies
87a6cc6610SAmbroise Vincent# only to revision r0p0 of the Cortex A55 cpu.
88a6cc6610SAmbroise VincentERRATA_A55_778703	?=0
89a6cc6610SAmbroise Vincent
906ab87d29SAmbroise Vincent# Flag to apply erratum 798797 workaround during reset. This erratum applies
916ab87d29SAmbroise Vincent# only to revision r0p0 of the Cortex A55 cpu.
926ab87d29SAmbroise VincentERRATA_A55_798797	?=0
936ab87d29SAmbroise Vincent
946e78973eSAmbroise Vincent# Flag to apply erratum 846532 workaround during reset. This erratum applies
956e78973eSAmbroise Vincent# only to revision <= r0p1 of the Cortex A55 cpu.
966e78973eSAmbroise VincentERRATA_A55_846532	?=0
976e78973eSAmbroise Vincent
9847949f3fSAmbroise Vincent# Flag to apply erratum 903758 workaround during reset. This erratum applies
9947949f3fSAmbroise Vincent# only to revision <= r0p1 of the Cortex A55 cpu.
10047949f3fSAmbroise VincentERRATA_A55_903758	?=0
10147949f3fSAmbroise Vincent
102097b787aSSandrine Bailleux# Flag to apply erratum 806969 workaround during reset. This erratum applies
103097b787aSSandrine Bailleux# only to revision r0p0 of the Cortex A57 cpu.
1045541bb3fSSoby MathewERRATA_A57_806969	?=0
1055541bb3fSSoby Mathew
106ccbec91cSAntonio Nino Diaz# Flag to apply erratum 813419 workaround during reset. This erratum applies
107ccbec91cSAntonio Nino Diaz# only to revision r0p0 of the Cortex A57 cpu.
108ccbec91cSAntonio Nino DiazERRATA_A57_813419	?=0
109ccbec91cSAntonio Nino Diaz
110097b787aSSandrine Bailleux# Flag to apply erratum 813420  workaround during reset. This erratum applies
111097b787aSSandrine Bailleux# only to revision r0p0 of the Cortex A57 cpu.
1125541bb3fSSoby MathewERRATA_A57_813420	?=0
1135541bb3fSSoby Mathew
1140f6fbbd2SAmbroise Vincent# Flag to apply erratum 814670  workaround during reset. This erratum applies
1150f6fbbd2SAmbroise Vincent# only to revision r0p0 of the Cortex A57 cpu.
1160f6fbbd2SAmbroise VincentERRATA_A57_814670	?=0
1170f6fbbd2SAmbroise Vincent
118*5bd2c24fSAmbroise Vincent# Flag to apply erratum 817169 workaround during power down. This erratum
119*5bd2c24fSAmbroise Vincent# applies only to revision <= r0p1 of the Cortex A57 cpu.
120*5bd2c24fSAmbroise VincentERRATA_A57_817169	?=0
121*5bd2c24fSAmbroise Vincent
122df22d602SSandrine Bailleux# Flag to apply erratum 826974 workaround during reset. This erratum applies
123df22d602SSandrine Bailleux# only to revision <= r1p1 of the Cortex A57 cpu.
124df22d602SSandrine BailleuxERRATA_A57_826974	?=0
125df22d602SSandrine Bailleux
12607288865SSandrine Bailleux# Flag to apply erratum 826977 workaround during reset. This erratum applies
12707288865SSandrine Bailleux# only to revision <= r1p1 of the Cortex A57 cpu.
12807288865SSandrine BailleuxERRATA_A57_826977	?=0
12907288865SSandrine Bailleux
130a8b1c769SSandrine Bailleux# Flag to apply erratum 828024 workaround during reset. This erratum applies
131a8b1c769SSandrine Bailleux# only to revision <= r1p1 of the Cortex A57 cpu.
132a8b1c769SSandrine BailleuxERRATA_A57_828024	?=0
133a8b1c769SSandrine Bailleux
1340b77197bSSandrine Bailleux# Flag to apply erratum 829520 workaround during reset. This erratum applies
1350b77197bSSandrine Bailleux# only to revision <= r1p2 of the Cortex A57 cpu.
1360b77197bSSandrine BailleuxERRATA_A57_829520	?=0
1370b77197bSSandrine Bailleux
138adeecf92SSandrine Bailleux# Flag to apply erratum 833471 workaround during reset. This erratum applies
139adeecf92SSandrine Bailleux# only to revision <= r1p2 of the Cortex A57 cpu.
140adeecf92SSandrine BailleuxERRATA_A57_833471	?=0
141adeecf92SSandrine Bailleux
14245b52c20SEleanor Bonnici# Flag to apply erratum 855972 workaround during reset. This erratum applies
14345b52c20SEleanor Bonnici# only to revision <= r1p3 of the Cortex A57 cpu.
14445b52c20SEleanor BonniciERRATA_A57_859972	?=0
14545b52c20SEleanor Bonnici
1466de9b336SEleanor Bonnici# Flag to apply erratum 855971 workaround during reset. This erratum applies
1476de9b336SEleanor Bonnici# only to revision <= r0p3 of the Cortex A72 cpu.
1486de9b336SEleanor BonniciERRATA_A72_859971	?=0
1496de9b336SEleanor Bonnici
150040b546eSDimitris Papastamos# Flag to apply T32 CLREX workaround during reset. This erratum applies
151da6d75a0SJohn Tsichritzis# only to r0p0 and r1p0 of the Neoverse N1 cpu.
152da6d75a0SJohn TsichritzisERRATA_N1_1043202	?=1
153040b546eSDimitris Papastamos
1548a677180SJohn Tsichritzis# Flag to apply DSU erratum 936184. This erratum applies to DSUs containing
1558a677180SJohn Tsichritzis# the ACP interface and revision < r2p0. Applying the workaround results in
1568a677180SJohn Tsichritzis# higher DSU power consumption on idle.
1578a677180SJohn TsichritzisERRATA_DSU_936184	?=0
1588a677180SJohn Tsichritzis
1596b0d97b2SJimmy Huang# Process ERRATA_A53_826319 flag
1606b0d97b2SJimmy Huang$(eval $(call assert_boolean,ERRATA_A53_826319))
1616b0d97b2SJimmy Huang$(eval $(call add_define,ERRATA_A53_826319))
1626b0d97b2SJimmy Huang
163a94cc374SDouglas Raillard# Process ERRATA_A53_835769 flag
164a94cc374SDouglas Raillard$(eval $(call assert_boolean,ERRATA_A53_835769))
165a94cc374SDouglas Raillard$(eval $(call add_define,ERRATA_A53_835769))
166a94cc374SDouglas Raillard
1676b0d97b2SJimmy Huang# Process ERRATA_A53_836870 flag
1686b0d97b2SJimmy Huang$(eval $(call assert_boolean,ERRATA_A53_836870))
1696b0d97b2SJimmy Huang$(eval $(call add_define,ERRATA_A53_836870))
1706b0d97b2SJimmy Huang
171a94cc374SDouglas Raillard# Process ERRATA_A53_843419 flag
172a94cc374SDouglas Raillard$(eval $(call assert_boolean,ERRATA_A53_843419))
173a94cc374SDouglas Raillard$(eval $(call add_define,ERRATA_A53_843419))
174a94cc374SDouglas Raillard
175b75dc0e4SAndre Przywara# Process ERRATA_A53_855873 flag
176b75dc0e4SAndre Przywara$(eval $(call assert_boolean,ERRATA_A53_855873))
177b75dc0e4SAndre Przywara$(eval $(call add_define,ERRATA_A53_855873))
178b75dc0e4SAndre Przywara
1791afeee92SAmbroise Vincent# Process ERRATA_A55_768277 flag
1801afeee92SAmbroise Vincent$(eval $(call assert_boolean,ERRATA_A55_768277))
1811afeee92SAmbroise Vincent$(eval $(call add_define,ERRATA_A55_768277))
1821afeee92SAmbroise Vincent
183a6cc6610SAmbroise Vincent# Process ERRATA_A55_778703 flag
184a6cc6610SAmbroise Vincent$(eval $(call assert_boolean,ERRATA_A55_778703))
185a6cc6610SAmbroise Vincent$(eval $(call add_define,ERRATA_A55_778703))
186a6cc6610SAmbroise Vincent
1876ab87d29SAmbroise Vincent# Process ERRATA_A55_798797 flag
1886ab87d29SAmbroise Vincent$(eval $(call assert_boolean,ERRATA_A55_798797))
1896ab87d29SAmbroise Vincent$(eval $(call add_define,ERRATA_A55_798797))
1906ab87d29SAmbroise Vincent
1916e78973eSAmbroise Vincent# Process ERRATA_A55_846532 flag
1926e78973eSAmbroise Vincent$(eval $(call assert_boolean,ERRATA_A55_846532))
1936e78973eSAmbroise Vincent$(eval $(call add_define,ERRATA_A55_846532))
1946e78973eSAmbroise Vincent
19547949f3fSAmbroise Vincent# Process ERRATA_A55_903758 flag
19647949f3fSAmbroise Vincent$(eval $(call assert_boolean,ERRATA_A55_903758))
19747949f3fSAmbroise Vincent$(eval $(call add_define,ERRATA_A55_903758))
19847949f3fSAmbroise Vincent
1995541bb3fSSoby Mathew# Process ERRATA_A57_806969 flag
2005541bb3fSSoby Mathew$(eval $(call assert_boolean,ERRATA_A57_806969))
2015541bb3fSSoby Mathew$(eval $(call add_define,ERRATA_A57_806969))
2025541bb3fSSoby Mathew
203ccbec91cSAntonio Nino Diaz# Process ERRATA_A57_813419 flag
204ccbec91cSAntonio Nino Diaz$(eval $(call assert_boolean,ERRATA_A57_813419))
205ccbec91cSAntonio Nino Diaz$(eval $(call add_define,ERRATA_A57_813419))
206ccbec91cSAntonio Nino Diaz
2075541bb3fSSoby Mathew# Process ERRATA_A57_813420 flag
2085541bb3fSSoby Mathew$(eval $(call assert_boolean,ERRATA_A57_813420))
2095541bb3fSSoby Mathew$(eval $(call add_define,ERRATA_A57_813420))
210df22d602SSandrine Bailleux
2110f6fbbd2SAmbroise Vincent# Process ERRATA_A57_814670 flag
2120f6fbbd2SAmbroise Vincent$(eval $(call assert_boolean,ERRATA_A57_814670))
2130f6fbbd2SAmbroise Vincent$(eval $(call add_define,ERRATA_A57_814670))
2140f6fbbd2SAmbroise Vincent
215*5bd2c24fSAmbroise Vincent# Process ERRATA_A57_817169 flag
216*5bd2c24fSAmbroise Vincent$(eval $(call assert_boolean,ERRATA_A57_817169))
217*5bd2c24fSAmbroise Vincent$(eval $(call add_define,ERRATA_A57_817169))
218*5bd2c24fSAmbroise Vincent
219df22d602SSandrine Bailleux# Process ERRATA_A57_826974 flag
220df22d602SSandrine Bailleux$(eval $(call assert_boolean,ERRATA_A57_826974))
221df22d602SSandrine Bailleux$(eval $(call add_define,ERRATA_A57_826974))
222a8b1c769SSandrine Bailleux
22307288865SSandrine Bailleux# Process ERRATA_A57_826977 flag
22407288865SSandrine Bailleux$(eval $(call assert_boolean,ERRATA_A57_826977))
22507288865SSandrine Bailleux$(eval $(call add_define,ERRATA_A57_826977))
22607288865SSandrine Bailleux
227a8b1c769SSandrine Bailleux# Process ERRATA_A57_828024 flag
228a8b1c769SSandrine Bailleux$(eval $(call assert_boolean,ERRATA_A57_828024))
229a8b1c769SSandrine Bailleux$(eval $(call add_define,ERRATA_A57_828024))
2300b77197bSSandrine Bailleux
2310b77197bSSandrine Bailleux# Process ERRATA_A57_829520 flag
2320b77197bSSandrine Bailleux$(eval $(call assert_boolean,ERRATA_A57_829520))
2330b77197bSSandrine Bailleux$(eval $(call add_define,ERRATA_A57_829520))
234adeecf92SSandrine Bailleux
235adeecf92SSandrine Bailleux# Process ERRATA_A57_833471 flag
236adeecf92SSandrine Bailleux$(eval $(call assert_boolean,ERRATA_A57_833471))
237adeecf92SSandrine Bailleux$(eval $(call add_define,ERRATA_A57_833471))
238a94cc374SDouglas Raillard
23945b52c20SEleanor Bonnici# Process ERRATA_A57_859972 flag
24045b52c20SEleanor Bonnici$(eval $(call assert_boolean,ERRATA_A57_859972))
24145b52c20SEleanor Bonnici$(eval $(call add_define,ERRATA_A57_859972))
24245b52c20SEleanor Bonnici
2436de9b336SEleanor Bonnici# Process ERRATA_A72_859971 flag
2446de9b336SEleanor Bonnici$(eval $(call assert_boolean,ERRATA_A72_859971))
2456de9b336SEleanor Bonnici$(eval $(call add_define,ERRATA_A72_859971))
2466de9b336SEleanor Bonnici
247da6d75a0SJohn Tsichritzis# Process ERRATA_N1_1043202 flag
248da6d75a0SJohn Tsichritzis$(eval $(call assert_boolean,ERRATA_N1_1043202))
249da6d75a0SJohn Tsichritzis$(eval $(call add_define,ERRATA_N1_1043202))
250040b546eSDimitris Papastamos
2518a677180SJohn Tsichritzis# Process ERRATA_DSU_936184 flag
2528a677180SJohn Tsichritzis$(eval $(call assert_boolean,ERRATA_DSU_936184))
2538a677180SJohn Tsichritzis$(eval $(call add_define,ERRATA_DSU_936184))
2548a677180SJohn Tsichritzis
255a94cc374SDouglas Raillard# Errata build flags
256a94cc374SDouglas Raillardifneq (${ERRATA_A53_843419},0)
257c2b8806fSDouglas RaillardTF_LDFLAGS_aarch64	+= --fix-cortex-a53-843419
258a94cc374SDouglas Raillardendif
259a94cc374SDouglas Raillard
260a94cc374SDouglas Raillardifneq (${ERRATA_A53_835769},0)
261a94cc374SDouglas RaillardTF_CFLAGS_aarch64	+= -mfix-cortex-a53-835769
262c2b8806fSDouglas RaillardTF_LDFLAGS_aarch64	+= --fix-cortex-a53-835769
263a94cc374SDouglas Raillardendif
264