mali_gp.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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_GP_H__
  11. #define __MALI_GP_H__
  12. #include "mali_osk.h"
  13. #include "mali_gp_job.h"
  14. #include "mali_hw_core.h"
  15. #include "regs/mali_gp_regs.h"
  16. struct mali_group;
  17. /**
  18. * Definition of the GP core struct
  19. * Used to track a GP core in the system.
  20. */
  21. struct mali_gp_core {
  22. struct mali_hw_core hw_core; /**< Common for all HW cores */
  23. _mali_osk_irq_t *irq; /**< IRQ handler */
  24. };
  25. _mali_osk_errcode_t mali_gp_initialize(void);
  26. void mali_gp_terminate(void);
  27. struct mali_gp_core *mali_gp_create(const _mali_osk_resource_t * resource, struct mali_group *group);
  28. void mali_gp_delete(struct mali_gp_core *core);
  29. void mali_gp_stop_bus(struct mali_gp_core *core);
  30. _mali_osk_errcode_t mali_gp_stop_bus_wait(struct mali_gp_core *core);
  31. void mali_gp_reset_async(struct mali_gp_core *core);
  32. _mali_osk_errcode_t mali_gp_reset_wait(struct mali_gp_core *core);
  33. void mali_gp_hard_reset(struct mali_gp_core *core);
  34. _mali_osk_errcode_t mali_gp_reset(struct mali_gp_core *core);
  35. void mali_gp_job_start(struct mali_gp_core *core, struct mali_gp_job *job);
  36. void mali_gp_resume_with_new_heap(struct mali_gp_core *core, u32 start_addr, u32 end_addr);
  37. u32 mali_gp_core_get_version(struct mali_gp_core *core);
  38. struct mali_gp_core *mali_gp_get_global_gp_core(void);
  39. u32 mali_gp_dump_state(struct mali_gp_core *core, char *buf, u32 size);
  40. void mali_gp_update_performance_counters(struct mali_gp_core *core, struct mali_gp_job *job, mali_bool suspend);
  41. /*** Accessor functions ***/
  42. MALI_STATIC_INLINE const char *mali_gp_get_hw_core_desc(struct mali_gp_core *core)
  43. {
  44. return core->hw_core.description;
  45. }
  46. /*** Register reading/writing functions ***/
  47. MALI_STATIC_INLINE u32 mali_gp_get_int_stat(struct mali_gp_core *core)
  48. {
  49. return mali_hw_core_register_read(&core->hw_core, MALIGP2_REG_ADDR_MGMT_INT_STAT);
  50. }
  51. MALI_STATIC_INLINE void mali_gp_mask_all_interrupts(struct mali_gp_core *core)
  52. {
  53. mali_hw_core_register_write(&core->hw_core, MALIGP2_REG_ADDR_MGMT_INT_MASK, MALIGP2_REG_VAL_IRQ_MASK_NONE);
  54. }
  55. MALI_STATIC_INLINE u32 mali_gp_read_rawstat(struct mali_gp_core *core)
  56. {
  57. return mali_hw_core_register_read(&core->hw_core, MALIGP2_REG_ADDR_MGMT_INT_RAWSTAT) & MALIGP2_REG_VAL_IRQ_MASK_USED;
  58. }
  59. MALI_STATIC_INLINE u32 mali_gp_read_core_status(struct mali_gp_core *core)
  60. {
  61. return mali_hw_core_register_read(&core->hw_core, MALIGP2_REG_ADDR_MGMT_STATUS);
  62. }
  63. MALI_STATIC_INLINE void mali_gp_enable_interrupts(struct mali_gp_core *core, u32 irq_exceptions)
  64. {
  65. /* Enable all interrupts, except those specified in irq_exceptions */
  66. mali_hw_core_register_write(&core->hw_core, MALIGP2_REG_ADDR_MGMT_INT_MASK,
  67. MALIGP2_REG_VAL_IRQ_MASK_USED & ~irq_exceptions);
  68. }
  69. MALI_STATIC_INLINE u32 mali_gp_read_plbu_alloc_start_addr(struct mali_gp_core *core)
  70. {
  71. return mali_hw_core_register_read(&core->hw_core, MALIGP2_REG_ADDR_MGMT_PLBU_ALLOC_START_ADDR);
  72. }
  73. #endif /* __MALI_GP_H__ */