2 * Copyright (C) 2010-2012 ARM Limited. All rights reserved.
4 * This program is free software and is provided to you under the terms of the GNU General Public License version 2
5 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
7 * A copy of the licence is included with the program, and can also be obtained from Free Software
8 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
12 * @file mali_platform.h
13 * Platform specific Mali driver functions
16 #ifndef __MALI_PMU_H__
17 #define __MALI_PMU_H__
21 #define MALI_GP_DOMAIN_INDEX 0
22 #define MALI_PP0_DOMAIN_INDEX 1
23 #define MALI_PP1_DOMAIN_INDEX 2
24 #define MALI_PP2_DOMAIN_INDEX 3
25 #define MALI_PP3_DOMAIN_INDEX 4
26 #define MALI_PP4_DOMAIN_INDEX 5
27 #define MALI_PP5_DOMAIN_INDEX 6
28 #define MALI_PP6_DOMAIN_INDEX 7
29 #define MALI_PP7_DOMAIN_INDEX 8
30 #define MALI_L20_DOMAIN_INDEX 9
31 #define MALI_L21_DOMAIN_INDEX 10
32 #define MALI_L22_DOMAIN_INDEX 11
34 #define MALI_MAX_NUMBER_OF_DOMAINS 12
36 /* Record the domain config from the customer or default config */
37 extern u16 mali_pmu_global_domain_config[];
39 static inline u16 mali_pmu_get_domain_mask(u32 index)
41 MALI_DEBUG_ASSERT(MALI_MAX_NUMBER_OF_DOMAINS > index);
43 return mali_pmu_global_domain_config[index];
46 static inline void mali_pmu_set_domain_mask(u32 index, u16 value)
48 MALI_DEBUG_ASSERT(MALI_MAX_NUMBER_OF_DOMAINS > index);
50 mali_pmu_global_domain_config[index] = value;
53 static inline void mali_pmu_copy_domain_mask(void *src, u32 len)
55 _mali_osk_memcpy(mali_pmu_global_domain_config, src, len);
60 /** @brief Initialisation of MALI PMU
62 * This is called from entry point of the driver in order to create and intialize the PMU resource
64 * @param resource it will be a pointer to a PMU resource
65 * @param number_of_pp_cores Number of found PP resources in configuration
66 * @param number_of_l2_caches Number of found L2 cache resources in configuration
67 * @return The created PMU object, or NULL in case of failure.
69 struct mali_pmu_core *mali_pmu_create(_mali_osk_resource_t *resource);
71 /** @brief It deallocates the PMU resource
73 * This is called on the exit of the driver to terminate the PMU resource
75 * @param pmu Pointer to PMU core object to delete
77 void mali_pmu_delete(struct mali_pmu_core *pmu);
79 /** @brief Reset PMU core
81 * @param pmu Pointer to PMU core object to reset
82 * @return _MALI_OSK_ERR_OK on success, otherwise failure.
84 _mali_osk_errcode_t mali_pmu_reset(struct mali_pmu_core *pmu);
86 /** @brief MALI GPU power down using MALI in-built PMU
88 * Called to power down the specified cores. The mask will be saved so that \a
89 * mali_pmu_power_up_all will bring the PMU back to the previous state set with
90 * this function or \a mali_pmu_power_up.
92 * @param pmu Pointer to PMU core object to power down
93 * @param mask Mask specifying which power domains to power down
94 * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
96 _mali_osk_errcode_t mali_pmu_power_down(struct mali_pmu_core *pmu, u32 mask);
98 /** @brief MALI GPU power up using MALI in-built PMU
100 * Called to power up the specified cores. The mask will be saved so that \a
101 * mali_pmu_power_up_all will bring the PMU back to the previous state set with
102 * this function or \a mali_pmu_power_down.
104 * @param pmu Pointer to PMU core object to power up
105 * @param mask Mask specifying which power domains to power up
106 * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
108 _mali_osk_errcode_t mali_pmu_power_up(struct mali_pmu_core *pmu, u32 mask);
110 /** @brief MALI GPU power down using MALI in-built PMU
112 * called to power down all cores
114 * @param pmu Pointer to PMU core object to power down
115 * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
117 _mali_osk_errcode_t mali_pmu_power_down_all(struct mali_pmu_core *pmu);
119 /** @brief MALI GPU power up using MALI in-built PMU
121 * called to power up all cores
123 * @param pmu Pointer to PMU core object to power up
124 * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
126 _mali_osk_errcode_t mali_pmu_power_up_all(struct mali_pmu_core *pmu);
128 /** @brief Retrieves the Mali PMU core object (if any)
130 * @return The Mali PMU object, or NULL if no PMU exists.
132 struct mali_pmu_core *mali_pmu_get_global_pmu_core(void);
134 #endif /* __MALI_PMU_H__ */