blob: a4515a9e2a6bce9c15b6450103eeec2c7f5c4c07 [file] [log] [blame]
Arvind Ram Prakashdf0b4262024-08-05 16:11:42 -05001/*
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 Mathewef1b5d82024-07-10 18:04:40 -050013#include <cortex_a75.h>
Arvind Ram Prakashdf0b4262024-08-05 16:11:42 -050014#include <lib/cpus/cpu_ops.h>
15#include <lib/cpus/errata.h>
16
17#if ERRATA_A520_2938996 || ERRATA_X4_2726228
18unsigned 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 Mathewef1b5d82024-07-10 18:04:40 -050032
33#if ERRATA_A75_764081
34bool 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 */