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_osk_mali.h
13 * Defines the OS abstraction layer which is specific for the Mali kernel device driver (OSK)
16 #ifndef __MALI_OSK_MALI_H__
17 #define __MALI_OSK_MALI_H__
19 #include <linux/mali/mali_utgard.h>
26 /** @addtogroup _mali_osk_miscellaneous
29 /** @brief Struct with device specific configuration data
31 struct _mali_osk_device_data {
32 /* Dedicated GPU memory range (physical). */
33 u32 dedicated_mem_start;
34 u32 dedicated_mem_size;
36 /* Shared GPU memory */
39 /* Frame buffer memory to be accessible by Mali GPU (physical) */
43 /* Max runtime [ms] for jobs */
46 /* Report GPU utilization in this interval (specified in ms) */
47 u32 utilization_interval;
49 /* Function that will receive periodic GPU utilization numbers */
50 void (*utilization_callback)(struct mali_gpu_utilization_data *data);
53 * Mali PMU switch delay.
54 * Only needed if the power gates are connected to the PMU in a high fanout
55 * network. This value is the number of Mali clock cycles it takes to
56 * enable the power gates and turn on the power mesh.
57 * This value will have no effect if a daisy chain implementation is used.
61 /* Mali Dynamic power domain configuration in sequence from 0-11
62 * GP PP0 PP1 PP2 PP3 PP4 PP5 PP6 PP7, L2$0 L2$1 L2$2
64 u16 pmu_domain_config[12];
66 /* Fuction that platform callback for freq tunning, needed when MALI400_POWER_PERFORMANCE_POLICY enabled */
67 int (*set_freq_callback)(unsigned int mhz);
70 /** @brief Find Mali GPU HW resource
72 * @param addr Address of Mali GPU resource to find
73 * @param res Storage for resource information if resource is found.
74 * @return _MALI_OSK_ERR_OK on success, _MALI_OSK_ERR_ITEM_NOT_FOUND if resource is not found
76 _mali_osk_errcode_t _mali_osk_resource_find(u32 addr, _mali_osk_resource_t *res);
79 /** @brief Find Mali GPU HW base address
81 * @return 0 if resources are found, otherwise the Mali GPU component with lowest address.
83 u32 _mali_osk_resource_base_address(void);
85 /** @brief Retrieve the Mali GPU specific data
87 * @return _MALI_OSK_ERR_OK on success, otherwise failure.
89 _mali_osk_errcode_t _mali_osk_device_data_get(struct _mali_osk_device_data *data);
91 /** @brief Determines if Mali GPU has been configured with shared interrupts.
93 * @return MALI_TRUE if shared interrupts, MALI_FALSE if not.
95 mali_bool _mali_osk_shared_interrupts(void);
97 /** @} */ /* end group _mali_osk_miscellaneous */
99 /** @addtogroup _mali_osk_low_level_memory
102 /** @brief Copy as much data as possible from src to dest, do not crash if src or dest isn't available.
104 * @param dest Destination buffer (limited to user space mapped Mali memory)
105 * @param src Source buffer
106 * @param size Number of bytes to copy
107 * @return Number of bytes actually copied
109 u32 _mali_osk_mem_write_safe(void *dest, const void *src, u32 size);
111 /** @} */ /* end group _mali_osk_low_level_memory */
118 #endif /* __MALI_OSK_MALI_H__ */