blob: 152a3da2633f03c413864beee16a36e98c366f96 [file] [log] [blame]
John Tsichritzis4daa1de2018-07-23 09:11:59 +01001/*
2 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <asm_macros.S>
8#include <dsu_def.h>
9#include <errata_report.h>
10
John Tsichritzis13110b42018-08-22 10:40:33 +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.
John Tsichritzis4daa1de2018-07-23 09:11:59 +010018 *
19 * This function is called from both assembly and C environment. So it
20 * follows AAPCS.
21 *
22 * Clobbers: x0-x3
John Tsichritzis13110b42018-08-22 10:40:33 +010023 * -----------------------------------------------------------------------
John Tsichritzis4daa1de2018-07-23 09:11:59 +010024 */
25 .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)
44 mov x1, #(0x2 << CLUSTERIDR_REV_BITS)
45 cmp x0, x1
46 csel x0, x2, x3, hs
471:
48 ret
49endfunc check_errata_dsu_936184
50
John Tsichritzis13110b42018-08-22 10:40:33 +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