mali_pp.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * This confidential and proprietary software may be used only as
  3. * authorised by a licensing agreement from ARM Limited
  4. * (C) COPYRIGHT 2011-2013 ARM Limited
  5. * ALL RIGHTS RESERVED
  6. * The entire notice above must be reproduced on all authorised
  7. * copies and copies may only be made to the extent permitted
  8. * by a licensing agreement from ARM Limited.
  9. */
  10. #ifndef __MALI_PP_H__
  11. #define __MALI_PP_H__
  12. #include "mali_osk.h"
  13. #include "mali_pp_job.h"
  14. #include "mali_hw_core.h"
  15. #include "mali_dma.h"
  16. struct mali_group;
  17. #define MALI_MAX_NUMBER_OF_PP_CORES 9
  18. /**
  19. * Definition of the PP core struct
  20. * Used to track a PP core in the system.
  21. */
  22. struct mali_pp_core {
  23. struct mali_hw_core hw_core; /**< Common for all HW cores */
  24. _mali_osk_irq_t *irq; /**< IRQ handler */
  25. u32 core_id; /**< Unique core ID */
  26. u32 bcast_id; /**< The "flag" value used by the Mali-450 broadcast and DLBU unit */
  27. };
  28. _mali_osk_errcode_t mali_pp_initialize(void);
  29. void mali_pp_terminate(void);
  30. struct mali_pp_core *mali_pp_create(const _mali_osk_resource_t * resource, struct mali_group *group, mali_bool is_virtual, u32 bcast_id);
  31. void mali_pp_delete(struct mali_pp_core *core);
  32. void mali_pp_stop_bus(struct mali_pp_core *core);
  33. _mali_osk_errcode_t mali_pp_stop_bus_wait(struct mali_pp_core *core);
  34. void mali_pp_reset_async(struct mali_pp_core *core);
  35. _mali_osk_errcode_t mali_pp_reset_wait(struct mali_pp_core *core);
  36. _mali_osk_errcode_t mali_pp_reset(struct mali_pp_core *core);
  37. _mali_osk_errcode_t mali_pp_hard_reset(struct mali_pp_core *core);
  38. void mali_pp_job_start(struct mali_pp_core *core, struct mali_pp_job *job, u32 sub_job, mali_bool restart_virtual);
  39. /**
  40. * @brief Add commands to DMA command buffer to start PP job on core.
  41. */
  42. void mali_pp_job_dma_cmd_prepare(struct mali_pp_core *core, struct mali_pp_job *job, u32 sub_job,
  43. mali_bool restart_virtual, mali_dma_cmd_buf *buf);
  44. u32 mali_pp_core_get_version(struct mali_pp_core *core);
  45. MALI_STATIC_INLINE u32 mali_pp_core_get_id(struct mali_pp_core *core)
  46. {
  47. MALI_DEBUG_ASSERT_POINTER(core);
  48. return core->core_id;
  49. }
  50. MALI_STATIC_INLINE u32 mali_pp_core_get_bcast_id(struct mali_pp_core *core)
  51. {
  52. MALI_DEBUG_ASSERT_POINTER(core);
  53. return core->bcast_id;
  54. }
  55. struct mali_pp_core* mali_pp_get_global_pp_core(u32 index);
  56. u32 mali_pp_get_glob_num_pp_cores(void);
  57. /* Debug */
  58. u32 mali_pp_dump_state(struct mali_pp_core *core, char *buf, u32 size);
  59. /**
  60. * Put instrumented HW counters from the core(s) to the job object (if enabled)
  61. *
  62. * parent and child is always the same, except for virtual jobs on Mali-450.
  63. * In this case, the counters will be enabled on the virtual core (parent),
  64. * but values need to be read from the child cores.
  65. *
  66. * @param parent The core used to see if the counters was enabled
  67. * @param child The core to actually read the values from
  68. * @job Job object to update with counter values (if enabled)
  69. * @subjob Which subjob the counters are applicable for (core ID for virtual jobs)
  70. */
  71. void mali_pp_update_performance_counters(struct mali_pp_core *parent, struct mali_pp_core *child, struct mali_pp_job *job, u32 subjob);
  72. MALI_STATIC_INLINE const char *mali_pp_get_hw_core_desc(struct mali_pp_core *core)
  73. {
  74. return core->hw_core.description;
  75. }
  76. /*** Register reading/writing functions ***/
  77. MALI_STATIC_INLINE u32 mali_pp_get_int_stat(struct mali_pp_core *core)
  78. {
  79. return mali_hw_core_register_read(&core->hw_core, MALI200_REG_ADDR_MGMT_INT_STATUS);
  80. }
  81. MALI_STATIC_INLINE u32 mali_pp_read_rawstat(struct mali_pp_core *core)
  82. {
  83. return mali_hw_core_register_read(&core->hw_core, MALI200_REG_ADDR_MGMT_INT_RAWSTAT) & MALI200_REG_VAL_IRQ_MASK_USED;
  84. }
  85. MALI_STATIC_INLINE u32 mali_pp_read_status(struct mali_pp_core *core)
  86. {
  87. return mali_hw_core_register_read(&core->hw_core, MALI200_REG_ADDR_MGMT_STATUS);
  88. }
  89. MALI_STATIC_INLINE void mali_pp_mask_all_interrupts(struct mali_pp_core *core)
  90. {
  91. mali_hw_core_register_write(&core->hw_core, MALI200_REG_ADDR_MGMT_INT_MASK, MALI200_REG_VAL_IRQ_MASK_NONE);
  92. }
  93. MALI_STATIC_INLINE void mali_pp_clear_hang_interrupt(struct mali_pp_core *core)
  94. {
  95. mali_hw_core_register_write(&core->hw_core, MALI200_REG_ADDR_MGMT_INT_CLEAR, MALI200_REG_VAL_IRQ_HANG);
  96. }
  97. MALI_STATIC_INLINE void mali_pp_enable_interrupts(struct mali_pp_core *core)
  98. {
  99. mali_hw_core_register_write(&core->hw_core, MALI200_REG_ADDR_MGMT_INT_MASK, MALI200_REG_VAL_IRQ_MASK_USED);
  100. }
  101. MALI_STATIC_INLINE void mali_pp_write_addr_stack(struct mali_pp_core *core, struct mali_pp_job *job)
  102. {
  103. u32 addr = mali_pp_job_get_addr_stack(job, core->core_id);
  104. mali_hw_core_register_write_relaxed(&core->hw_core, MALI200_REG_ADDR_STACK, addr);
  105. }
  106. #endif /* __MALI_PP_H__ */