mali_pmu.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * This confidential and proprietary software may be used only as
  3. * authorised by a licensing agreement from ARM Limited
  4. * (C) COPYRIGHT 2009-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. /**
  11. * @file mali_platform.h
  12. * Platform specific Mali driver functions
  13. */
  14. #ifndef __MALI_PMU_H__
  15. #define __MALI_PMU_H__
  16. #include "mali_osk.h"
  17. #define MALI_GP_DOMAIN_INDEX 0
  18. #define MALI_PP0_DOMAIN_INDEX 1
  19. #define MALI_PP1_DOMAIN_INDEX 2
  20. #define MALI_PP2_DOMAIN_INDEX 3
  21. #define MALI_PP3_DOMAIN_INDEX 4
  22. #define MALI_PP4_DOMAIN_INDEX 5
  23. #define MALI_PP5_DOMAIN_INDEX 6
  24. #define MALI_PP6_DOMAIN_INDEX 7
  25. #define MALI_PP7_DOMAIN_INDEX 8
  26. #define MALI_L20_DOMAIN_INDEX 9
  27. #define MALI_L21_DOMAIN_INDEX 10
  28. #define MALI_L22_DOMAIN_INDEX 11
  29. #define MALI_MAX_NUMBER_OF_DOMAINS 12
  30. /* Record the domain config from the customer or default config */
  31. extern u16 mali_pmu_global_domain_config[];
  32. static inline u16 mali_pmu_get_domain_mask(u32 index)
  33. {
  34. MALI_DEBUG_ASSERT(MALI_MAX_NUMBER_OF_DOMAINS > index);
  35. return mali_pmu_global_domain_config[index];
  36. }
  37. static inline void mali_pmu_set_domain_mask(u32 index, u16 value)
  38. {
  39. MALI_DEBUG_ASSERT(MALI_MAX_NUMBER_OF_DOMAINS > index);
  40. mali_pmu_global_domain_config[index] = value;
  41. }
  42. static inline void mali_pmu_copy_domain_mask(void *src, u32 len)
  43. {
  44. _mali_osk_memcpy(mali_pmu_global_domain_config, src, len);
  45. }
  46. struct mali_pmu_core;
  47. /** @brief Initialisation of MALI PMU
  48. *
  49. * This is called from entry point of the driver in order to create and intialize the PMU resource
  50. *
  51. * @param resource it will be a pointer to a PMU resource
  52. * @param number_of_pp_cores Number of found PP resources in configuration
  53. * @param number_of_l2_caches Number of found L2 cache resources in configuration
  54. * @return The created PMU object, or NULL in case of failure.
  55. */
  56. struct mali_pmu_core *mali_pmu_create(_mali_osk_resource_t *resource);
  57. /** @brief It deallocates the PMU resource
  58. *
  59. * This is called on the exit of the driver to terminate the PMU resource
  60. *
  61. * @param pmu Pointer to PMU core object to delete
  62. */
  63. void mali_pmu_delete(struct mali_pmu_core *pmu);
  64. /** @brief Reset PMU core
  65. *
  66. * @param pmu Pointer to PMU core object to reset
  67. * @return _MALI_OSK_ERR_OK on success, otherwise failure.
  68. */
  69. _mali_osk_errcode_t mali_pmu_reset(struct mali_pmu_core *pmu);
  70. /** @brief MALI GPU power down using MALI in-built PMU
  71. *
  72. * Called to power down the specified cores. The mask will be saved so that \a
  73. * mali_pmu_power_up_all will bring the PMU back to the previous state set with
  74. * this function or \a mali_pmu_power_up.
  75. *
  76. * @param pmu Pointer to PMU core object to power down
  77. * @param mask Mask specifying which power domains to power down
  78. * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
  79. */
  80. _mali_osk_errcode_t mali_pmu_power_down(struct mali_pmu_core *pmu, u32 mask);
  81. /** @brief MALI GPU power up using MALI in-built PMU
  82. *
  83. * Called to power up the specified cores. The mask will be saved so that \a
  84. * mali_pmu_power_up_all will bring the PMU back to the previous state set with
  85. * this function or \a mali_pmu_power_down.
  86. *
  87. * @param pmu Pointer to PMU core object to power up
  88. * @param mask Mask specifying which power domains to power up
  89. * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
  90. */
  91. _mali_osk_errcode_t mali_pmu_power_up(struct mali_pmu_core *pmu, u32 mask);
  92. /** @brief MALI GPU power down using MALI in-built PMU
  93. *
  94. * called to power down all cores
  95. *
  96. * @param pmu Pointer to PMU core object to power down
  97. * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
  98. */
  99. _mali_osk_errcode_t mali_pmu_power_down_all(struct mali_pmu_core *pmu);
  100. /** @brief MALI GPU power up using MALI in-built PMU
  101. *
  102. * called to power up all cores
  103. *
  104. * @param pmu Pointer to PMU core object to power up
  105. * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
  106. */
  107. _mali_osk_errcode_t mali_pmu_power_up_all(struct mali_pmu_core *pmu);
  108. /** @brief Retrieves the Mali PMU core object (if any)
  109. *
  110. * @return The Mali PMU object, or NULL if no PMU exists.
  111. */
  112. struct mali_pmu_core *mali_pmu_get_global_pmu_core(void);
  113. #endif /* __MALI_PMU_H__ */