plat_helpers.S 815 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <arch.h>
  7. #include <asm_macros.S>
  8. #include <platform_def.h>
  9. .globl plat_is_my_cpu_primary
  10. .globl plat_my_core_pos
  11. func plat_is_my_cpu_primary
  12. mrs x0, mpidr_el1
  13. and x0, x0, #(MPIDR_CLUSTER_MASK | MPIDR_CPU_MASK)
  14. cmp x0, #PLAT_PRIMARY_CPU
  15. cset x0, eq
  16. ret
  17. endfunc plat_is_my_cpu_primary
  18. /* -----------------------------------------------------
  19. * unsigned int plat_my_core_pos(void);
  20. *
  21. * result: CorePos = CoreId + (ClusterId << 2)
  22. * -----------------------------------------------------
  23. */
  24. func plat_my_core_pos
  25. mrs x0, mpidr_el1
  26. and x1, x0, #MPIDR_CPU_MASK
  27. and x0, x0, #MPIDR_CLUSTER_MASK
  28. add x0, x1, x0, LSR #6
  29. ret
  30. endfunc plat_my_core_pos