blob: 29870a4d31e7b65fd3e86b6dd063af55d6a5144c [file] [log] [blame]
John Tsichritzis4daa1de2018-07-23 09:11:59 +01001/*
Louis Mayencourt254f6f02019-04-09 14:11:06 +01002 * Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
John Tsichritzis4daa1de2018-07-23 09:11:59 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <asm_macros.S>
8#include <dsu_def.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00009#include <lib/cpus/errata_report.h>
John Tsichritzis4daa1de2018-07-23 09:11:59 +010010
Louis Mayencourt254f6f02019-04-09 14:11:06 +010011 /* -----------------------------------------------------------------------
12 * DSU erratum 936184 check function
13 * Checks the DSU variant, revision and configuration to determine if
14 * the erratum applies. Erratum applies if ACP interface is present
15 * in the DSU and revision-variant < r2p0.
16 *
17 * The erratum was fixed in r2p0.
18 *
19 * This function is called from both assembly and C environment. So it
20 * follows AAPCS.
21 *
22 * Clobbers: x0-x3
23 * -----------------------------------------------------------------------
24 */
John Tsichritzis4daa1de2018-07-23 09:11:59 +010025 .globl check_errata_dsu_936184
26 .globl errata_dsu_936184_wa
27
28func check_errata_dsu_936184
29 mov x2, #ERRATA_NOT_APPLIES
30 mov x3, #ERRATA_APPLIES
31
John Tsichritzis13110b42018-08-22 10:40:33 +010032 /* Erratum applies only if DSU has the ACP interface */
John Tsichritzis4daa1de2018-07-23 09:11:59 +010033 mov x0, x2
34 mrs x1, CLUSTERCFR_EL1
35 ubfx x1, x1, #CLUSTERCFR_ACP_SHIFT, #1
36 cbz x1, 1f
37
38 /* If ACP is present, check if DSU is older than r2p0 */
39 mrs x1, CLUSTERIDR_EL1
40
41 /* DSU variant and revision bitfields in CLUSTERIDR are adjacent */
42 ubfx x0, x1, #CLUSTERIDR_REV_SHIFT,\
43 #(CLUSTERIDR_REV_BITS + CLUSTERIDR_VAR_BITS)
Louis Mayencourt254f6f02019-04-09 14:11:06 +010044 mov x1, #(0x2 << CLUSTERIDR_VAR_SHIFT)
John Tsichritzis4daa1de2018-07-23 09:11:59 +010045 cmp x0, x1
46 csel x0, x2, x3, hs
471:
48 ret
49endfunc check_errata_dsu_936184
50
Louis Mayencourt254f6f02019-04-09 14:11:06 +010051 /* --------------------------------------------------
52 * Errata Workaround for DSU erratum #936184.
53 *
54 * Can clobber only: x0-x17
55 * --------------------------------------------------
56 */
John Tsichritzis4daa1de2018-07-23 09:11:59 +010057func errata_dsu_936184_wa
John Tsichritzis13110b42018-08-22 10:40:33 +010058 mov x17, x30
John Tsichritzis4daa1de2018-07-23 09:11:59 +010059 bl check_errata_dsu_936184
60 cbz x0, 1f
61
62 /* If erratum applies, we set a mask to a DSU control register */
63 mrs x0, CLUSTERACTLR_EL1
64 ldr x1, =DSU_ERRATA_936184_MASK
65 orr x0, x0, x1
66 msr CLUSTERACTLR_EL1, x0
67 isb
681:
John Tsichritzis13110b42018-08-22 10:40:33 +010069 ret x17
John Tsichritzis4daa1de2018-07-23 09:11:59 +010070endfunc errata_dsu_936184_wa