errata_common.c 1.0 KB

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