fvp_cpu_pwr.c 974 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (c) 2024, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #if __aarch64__
  7. #include <aem_generic.h>
  8. #include <arch_helpers.h>
  9. #include <cortex_a35.h>
  10. #include <cortex_a53.h>
  11. #include <cortex_a57.h>
  12. #include <cortex_a72.h>
  13. #include <cortex_a73.h>
  14. #include <cortex_a78_ae.h>
  15. #include <drivers/arm/fvp/fvp_cpu_pwr.h>
  16. #include <lib/utils_def.h>
  17. #include <neoverse_e1.h>
  18. bool check_cpupwrctrl_el1_is_available(void)
  19. {
  20. /* Poupulate list of CPU midr that doesn't support CPUPWRCTL_EL1 */
  21. const unsigned int midr_no_cpupwrctl[] = {
  22. BASE_AEM_MIDR,
  23. CORTEX_A35_MIDR,
  24. CORTEX_A53_MIDR,
  25. CORTEX_A57_MIDR,
  26. CORTEX_A72_MIDR,
  27. CORTEX_A73_MIDR,
  28. CORTEX_A78_AE_MIDR,
  29. NEOVERSE_E1_MIDR
  30. };
  31. unsigned int midr = (unsigned int)read_midr();
  32. for (unsigned int i = 0U; i < ARRAY_SIZE(midr_no_cpupwrctl); i++) {
  33. if (midr_no_cpupwrctl[i] == midr) {
  34. return false;
  35. }
  36. }
  37. return true;
  38. }
  39. #endif /* __arch64__ */