plat_pm_trace.c 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * Copyright (C) 2018 Marvell International Ltd.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. * https://spdx.org/licenses
  6. */
  7. #include <lib/mmio.h>
  8. #include <plat/common/platform.h>
  9. #if MSS_SUPPORT
  10. #include <mss_mem.h>
  11. #ifdef PM_TRACE_ENABLE
  12. #include <plat_pm_trace.h>
  13. /* core trace APIs */
  14. core_trace_func funcTbl[PLATFORM_CORE_COUNT] = {
  15. pm_core_0_trace,
  16. pm_core_1_trace,
  17. pm_core_2_trace,
  18. pm_core_3_trace};
  19. /*****************************************************************************
  20. * pm_core0_trace
  21. * pm_core1_trace
  22. * pm_core2_trace
  23. * pm_core_3trace
  24. *
  25. * This functions set trace info into core cyclic trace queue in MSS SRAM
  26. * memory space
  27. *****************************************************************************
  28. */
  29. void pm_core_0_trace(unsigned int trace)
  30. {
  31. unsigned int current_position_core_0 =
  32. mmio_read_32(AP_MSS_ATF_CORE_0_CTRL_BASE);
  33. mmio_write_32((AP_MSS_ATF_CORE_0_INFO_BASE +
  34. (current_position_core_0 * AP_MSS_ATF_CORE_ENTRY_SIZE)),
  35. mmio_read_32(AP_MSS_TIMER_BASE));
  36. mmio_write_32((AP_MSS_ATF_CORE_0_INFO_TRACE +
  37. (current_position_core_0 * AP_MSS_ATF_CORE_ENTRY_SIZE)),
  38. trace);
  39. mmio_write_32(AP_MSS_ATF_CORE_0_CTRL_BASE,
  40. ((current_position_core_0 + 1) &
  41. AP_MSS_ATF_TRACE_SIZE_MASK));
  42. }
  43. void pm_core_1_trace(unsigned int trace)
  44. {
  45. unsigned int current_position_core_1 =
  46. mmio_read_32(AP_MSS_ATF_CORE_1_CTRL_BASE);
  47. mmio_write_32((AP_MSS_ATF_CORE_1_INFO_BASE +
  48. (current_position_core_1 * AP_MSS_ATF_CORE_ENTRY_SIZE)),
  49. mmio_read_32(AP_MSS_TIMER_BASE));
  50. mmio_write_32((AP_MSS_ATF_CORE_1_INFO_TRACE +
  51. (current_position_core_1 * AP_MSS_ATF_CORE_ENTRY_SIZE)),
  52. trace);
  53. mmio_write_32(AP_MSS_ATF_CORE_1_CTRL_BASE,
  54. ((current_position_core_1 + 1) &
  55. AP_MSS_ATF_TRACE_SIZE_MASK));
  56. }
  57. void pm_core_2_trace(unsigned int trace)
  58. {
  59. unsigned int current_position_core_2 =
  60. mmio_read_32(AP_MSS_ATF_CORE_2_CTRL_BASE);
  61. mmio_write_32((AP_MSS_ATF_CORE_2_INFO_BASE +
  62. (current_position_core_2 * AP_MSS_ATF_CORE_ENTRY_SIZE)),
  63. mmio_read_32(AP_MSS_TIMER_BASE));
  64. mmio_write_32((AP_MSS_ATF_CORE_2_INFO_TRACE +
  65. (current_position_core_2 * AP_MSS_ATF_CORE_ENTRY_SIZE)),
  66. trace);
  67. mmio_write_32(AP_MSS_ATF_CORE_2_CTRL_BASE,
  68. ((current_position_core_2 + 1) &
  69. AP_MSS_ATF_TRACE_SIZE_MASK));
  70. }
  71. void pm_core_3_trace(unsigned int trace)
  72. {
  73. unsigned int current_position_core_3 =
  74. mmio_read_32(AP_MSS_ATF_CORE_3_CTRL_BASE);
  75. mmio_write_32((AP_MSS_ATF_CORE_3_INFO_BASE +
  76. (current_position_core_3 * AP_MSS_ATF_CORE_ENTRY_SIZE)),
  77. mmio_read_32(AP_MSS_TIMER_BASE));
  78. mmio_write_32((AP_MSS_ATF_CORE_3_INFO_TRACE +
  79. (current_position_core_3 * AP_MSS_ATF_CORE_ENTRY_SIZE)),
  80. trace);
  81. mmio_write_32(AP_MSS_ATF_CORE_3_CTRL_BASE,
  82. ((current_position_core_3 + 1) &
  83. AP_MSS_ATF_TRACE_SIZE_MASK));
  84. }
  85. #endif /* PM_TRACE_ENABLE */
  86. #endif /* MSS_SUPPORT */