platform_mp_stack.S 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (c) 2014-2020, 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 <assert_macros.S>
  9. #include <platform_def.h>
  10. .local platform_normal_stacks
  11. .weak plat_get_my_stack
  12. .weak plat_set_my_stack
  13. /* ---------------------------------------------------------------------
  14. * When the compatibility layer is disabled, the platform APIs
  15. * plat_get_my_stack() and plat_set_my_stack() are supported by the
  16. * platform and the previous APIs platform_get_stack() and
  17. * platform_set_stack() are defined in terms of new APIs making use of
  18. * the fact that they are only ever invoked for the current CPU. This
  19. * is to enable components of Trusted Firmware like SPDs using the old
  20. * platform APIs to continue to work.
  21. * --------------------------------------------------------------------
  22. */
  23. /* -----------------------------------------------------
  24. * uintptr_t plat_get_my_stack ()
  25. *
  26. * For the current CPU, this function returns the stack
  27. * pointer for a stack allocated in device memory.
  28. * -----------------------------------------------------
  29. */
  30. func plat_get_my_stack
  31. mov x10, x30
  32. get_my_mp_stack platform_normal_stacks, PLATFORM_STACK_SIZE
  33. ret x10
  34. endfunc plat_get_my_stack
  35. /* -----------------------------------------------------
  36. * void plat_set_my_stack ()
  37. *
  38. * For the current CPU, this function sets the stack
  39. * pointer to a stack allocated in normal memory.
  40. * -----------------------------------------------------
  41. */
  42. func plat_set_my_stack
  43. mov x9, x30
  44. bl plat_get_my_stack
  45. mov sp, x0
  46. ret x9
  47. endfunc plat_set_my_stack
  48. /* -----------------------------------------------------
  49. * Per-CPU stacks in normal memory. Each CPU gets a
  50. * stack of PLATFORM_STACK_SIZE bytes.
  51. * -----------------------------------------------------
  52. */
  53. declare_stack platform_normal_stacks, .tzfw_normal_stacks, \
  54. PLATFORM_STACK_SIZE, PLATFORM_CORE_COUNT, \
  55. CACHE_WRITEBACK_GRANULE