John Tsichritzis | 4daa1de | 2018-07-23 09:11:59 +0100 | [diff] [blame] | 1 | /* |
| 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 Tsichritzis | 13110b4 | 2018-08-22 10:40:33 +0100 | [diff] [blame] | 11 | /* ----------------------------------------------------------------------- |
| 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 Tsichritzis | 4daa1de | 2018-07-23 09:11:59 +0100 | [diff] [blame] | 18 | * |
| 19 | * This function is called from both assembly and C environment. So it |
| 20 | * follows AAPCS. |
| 21 | * |
| 22 | * Clobbers: x0-x3 |
John Tsichritzis | 13110b4 | 2018-08-22 10:40:33 +0100 | [diff] [blame] | 23 | * ----------------------------------------------------------------------- |
John Tsichritzis | 4daa1de | 2018-07-23 09:11:59 +0100 | [diff] [blame] | 24 | */ |
| 25 | .globl check_errata_dsu_936184 |
| 26 | .globl errata_dsu_936184_wa |
| 27 | |
| 28 | func check_errata_dsu_936184 |
| 29 | mov x2, #ERRATA_NOT_APPLIES |
| 30 | mov x3, #ERRATA_APPLIES |
| 31 | |
John Tsichritzis | 13110b4 | 2018-08-22 10:40:33 +0100 | [diff] [blame] | 32 | /* Erratum applies only if DSU has the ACP interface */ |
John Tsichritzis | 4daa1de | 2018-07-23 09:11:59 +0100 | [diff] [blame] | 33 | 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 |
| 47 | 1: |
| 48 | ret |
| 49 | endfunc check_errata_dsu_936184 |
| 50 | |
John Tsichritzis | 13110b4 | 2018-08-22 10:40:33 +0100 | [diff] [blame] | 51 | /* -------------------------------------------------- |
| 52 | * Errata Workaround for DSU erratum #936184. |
| 53 | * |
| 54 | * Can clobber only: x0-x17 |
| 55 | * -------------------------------------------------- |
| 56 | */ |
John Tsichritzis | 4daa1de | 2018-07-23 09:11:59 +0100 | [diff] [blame] | 57 | func errata_dsu_936184_wa |
John Tsichritzis | 13110b4 | 2018-08-22 10:40:33 +0100 | [diff] [blame] | 58 | mov x17, x30 |
John Tsichritzis | 4daa1de | 2018-07-23 09:11:59 +0100 | [diff] [blame] | 59 | 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 |
| 68 | 1: |
John Tsichritzis | 13110b4 | 2018-08-22 10:40:33 +0100 | [diff] [blame] | 69 | ret x17 |
John Tsichritzis | 4daa1de | 2018-07-23 09:11:59 +0100 | [diff] [blame] | 70 | endfunc errata_dsu_936184_wa |