tizen 2.4 release
[kernel/linux-3.0.git] / drivers / gpu / arm / mali400 / r4p0_rel0 / common / mali_osk_mali.h
1 /*
2  * Copyright (C) 2010-2012 ARM Limited. All rights reserved.
3  * 
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.
6  * 
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.
9  */
10
11 /**
12  * @file mali_osk_mali.h
13  * Defines the OS abstraction layer which is specific for the Mali kernel device driver (OSK)
14  */
15
16 #ifndef __MALI_OSK_MALI_H__
17 #define __MALI_OSK_MALI_H__
18
19 #include <linux/mali/mali_utgard.h>
20 #include <mali_osk.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 /** @addtogroup _mali_osk_miscellaneous
27  * @{ */
28
29 /** @brief Struct with device specific configuration data
30  */
31 struct _mali_osk_device_data {
32         /* Dedicated GPU memory range (physical). */
33         u32 dedicated_mem_start;
34         u32 dedicated_mem_size;
35
36         /* Shared GPU memory */
37         u32 shared_mem_size;
38
39         /* Frame buffer memory to be accessible by Mali GPU (physical) */
40         u32 fb_start;
41         u32 fb_size;
42
43         /* Max runtime [ms] for jobs */
44         int max_job_runtime;
45
46         /* Report GPU utilization in this interval (specified in ms) */
47         u32 utilization_interval;
48
49         /* Function that will receive periodic GPU utilization numbers */
50         void (*utilization_callback)(struct mali_gpu_utilization_data *data);
51
52         /*
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.
58          */
59         u32 pmu_switch_delay;
60
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
63          */
64         u16 pmu_domain_config[12];
65
66         /* Fuction that platform callback for freq tunning, needed when MALI400_POWER_PERFORMANCE_POLICY enabled */
67         int (*set_freq_callback)(unsigned int mhz);
68 };
69
70 /** @brief Find Mali GPU HW resource
71  *
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
75  */
76 _mali_osk_errcode_t _mali_osk_resource_find(u32 addr, _mali_osk_resource_t *res);
77
78
79 /** @brief Find Mali GPU HW base address
80  *
81  * @return 0 if resources are found, otherwise the Mali GPU component with lowest address.
82  */
83 u32 _mali_osk_resource_base_address(void);
84
85 /** @brief Retrieve the Mali GPU specific data
86  *
87  * @return _MALI_OSK_ERR_OK on success, otherwise failure.
88  */
89 _mali_osk_errcode_t _mali_osk_device_data_get(struct _mali_osk_device_data *data);
90
91 /** @brief Determines if Mali GPU has been configured with shared interrupts.
92  *
93  * @return MALI_TRUE if shared interrupts, MALI_FALSE if not.
94  */
95 mali_bool _mali_osk_shared_interrupts(void);
96
97 /** @} */ /* end group _mali_osk_miscellaneous */
98
99 /** @addtogroup _mali_osk_low_level_memory
100  * @{ */
101
102 /** @brief Copy as much data as possible from src to dest, do not crash if src or dest isn't available.
103  *
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
108  */
109 u32 _mali_osk_mem_write_safe(void *dest, const void *src, u32 size);
110
111 /** @} */ /* end group _mali_osk_low_level_memory */
112
113
114 #ifdef __cplusplus
115 }
116 #endif
117
118 #endif /* __MALI_OSK_MALI_H__ */