Arvind Ram Prakash | df0b426 | 2024-08-05 16:11:42 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | /* Runtime C routines for errata workarounds and common routines */ |
| 8 | |
| 9 | #include <arch.h> |
| 10 | #include <arch_helpers.h> |
| 11 | #include <cortex_a520.h> |
| 12 | #include <cortex_x4.h> |
Sona Mathew | ef1b5d8 | 2024-07-10 18:04:40 -0500 | [diff] [blame^] | 13 | #include <cortex_a75.h> |
Arvind Ram Prakash | df0b426 | 2024-08-05 16:11:42 -0500 | [diff] [blame] | 14 | #include <lib/cpus/cpu_ops.h> |
| 15 | #include <lib/cpus/errata.h> |
| 16 | |
| 17 | #if ERRATA_A520_2938996 || ERRATA_X4_2726228 |
| 18 | unsigned int check_if_affected_core(void) |
| 19 | { |
| 20 | uint32_t midr_val = read_midr(); |
| 21 | long rev_var = cpu_get_rev_var(); |
| 22 | |
| 23 | if (EXTRACT_PARTNUM(midr_val) == EXTRACT_PARTNUM(CORTEX_A520_MIDR)) { |
| 24 | return check_erratum_cortex_a520_2938996(rev_var); |
| 25 | } else if (EXTRACT_PARTNUM(midr_val) == EXTRACT_PARTNUM(CORTEX_X4_MIDR)) { |
| 26 | return check_erratum_cortex_x4_2726228(rev_var); |
| 27 | } |
| 28 | |
| 29 | return ERRATA_NOT_APPLIES; |
| 30 | } |
| 31 | #endif |
Sona Mathew | ef1b5d8 | 2024-07-10 18:04:40 -0500 | [diff] [blame^] | 32 | |
| 33 | #if ERRATA_A75_764081 |
| 34 | bool errata_a75_764081_applies(void) |
| 35 | { |
| 36 | long rev_var = cpu_get_rev_var(); |
| 37 | if (check_erratum_cortex_a75_764081(rev_var) == ERRATA_APPLIES) { |
| 38 | return true; |
| 39 | } |
| 40 | return false; |
| 41 | } |
| 42 | #endif /* ERRATA_A75_764081 */ |