plat_helpers.S 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) 2013-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 <mt8173_def.h>
  9. .globl plat_secondary_cold_boot_setup
  10. .globl plat_report_exception
  11. .globl platform_is_primary_cpu
  12. .globl plat_my_core_pos
  13. /* -----------------------------------------------------
  14. * void plat_secondary_cold_boot_setup (void);
  15. *
  16. * This function performs any platform specific actions
  17. * needed for a secondary cpu after a cold reset e.g
  18. * mark the cpu's presence, mechanism to place it in a
  19. * holding pen etc.
  20. * -----------------------------------------------------
  21. */
  22. func plat_secondary_cold_boot_setup
  23. /* MT8173 Oak does not do cold boot for secondary CPU */
  24. cb_panic:
  25. b cb_panic
  26. endfunc plat_secondary_cold_boot_setup
  27. func platform_is_primary_cpu
  28. and x0, x0, #(MPIDR_CLUSTER_MASK | MPIDR_CPU_MASK)
  29. cmp x0, #MT8173_PRIMARY_CPU
  30. cset x0, eq
  31. ret
  32. endfunc platform_is_primary_cpu
  33. /* -----------------------------------------------------
  34. * unsigned int plat_my_core_pos(void);
  35. *
  36. * result: CorePos = CoreId + (ClusterId << 2)
  37. * -----------------------------------------------------
  38. */
  39. func plat_my_core_pos
  40. mrs x0, mpidr_el1
  41. and x1, x0, #MPIDR_CPU_MASK
  42. and x0, x0, #MPIDR_CLUSTER_MASK
  43. add x0, x1, x0, LSR #6
  44. ret
  45. endfunc plat_my_core_pos