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 | |
| 11 | /* |
| 12 | * DSU erratum 936184 |
| 13 | * Check the DSU variant, revision and configuration to determine if the |
| 14 | * erratum applies. This erratum was fixed in r2p0. |
| 15 | * |
| 16 | * This function is called from both assembly and C environment. So it |
| 17 | * follows AAPCS. |
| 18 | * |
| 19 | * Clobbers: x0-x3 |
| 20 | */ |
| 21 | .globl check_errata_dsu_936184 |
| 22 | .globl errata_dsu_936184_wa |
| 23 | |
| 24 | func check_errata_dsu_936184 |
| 25 | mov x2, #ERRATA_NOT_APPLIES |
| 26 | mov x3, #ERRATA_APPLIES |
| 27 | |
| 28 | /* Erratum applies only if ACP interface is present in DSU */ |
| 29 | mov x0, x2 |
| 30 | mrs x1, CLUSTERCFR_EL1 |
| 31 | ubfx x1, x1, #CLUSTERCFR_ACP_SHIFT, #1 |
| 32 | cbz x1, 1f |
| 33 | |
| 34 | /* If ACP is present, check if DSU is older than r2p0 */ |
| 35 | mrs x1, CLUSTERIDR_EL1 |
| 36 | |
| 37 | /* DSU variant and revision bitfields in CLUSTERIDR are adjacent */ |
| 38 | ubfx x0, x1, #CLUSTERIDR_REV_SHIFT,\ |
| 39 | #(CLUSTERIDR_REV_BITS + CLUSTERIDR_VAR_BITS) |
| 40 | mov x1, #(0x2 << CLUSTERIDR_REV_BITS) |
| 41 | cmp x0, x1 |
| 42 | csel x0, x2, x3, hs |
| 43 | 1: |
| 44 | ret |
| 45 | endfunc check_errata_dsu_936184 |
| 46 | |
| 47 | func errata_dsu_936184_wa |
| 48 | mov x20, x30 |
| 49 | bl check_errata_dsu_936184 |
| 50 | cbz x0, 1f |
| 51 | |
| 52 | /* If erratum applies, we set a mask to a DSU control register */ |
| 53 | mrs x0, CLUSTERACTLR_EL1 |
| 54 | ldr x1, =DSU_ERRATA_936184_MASK |
| 55 | orr x0, x0, x1 |
| 56 | msr CLUSTERACTLR_EL1, x0 |
| 57 | isb |
| 58 | 1: |
| 59 | ret x20 |
| 60 | endfunc errata_dsu_936184_wa |