tizen 2.4 release
[profile/mobile/platform/kernel/linux-3.10-sc7730.git] / drivers / gpu / arm / mali400 / r5p0_rel0 / common / mali_executor.h
1 /*
2  * Copyright (C) 2012, 2014 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 #ifndef __MALI_EXECUTOR_H__
12 #define __MALI_EXECUTOR_H__
13
14 #include "mali_osk.h"
15 #include "mali_scheduler_types.h"
16 #include "mali_kernel_common.h"
17
18 typedef enum {
19         MALI_EXECUTOR_HINT_GP_BOUND = 0
20 #define MALI_EXECUTOR_HINT_MAX        1
21 } mali_executor_hint;
22
23 extern mali_bool mali_executor_hints[MALI_EXECUTOR_HINT_MAX];
24
25 /* forward declare struct instead of using include */
26 struct mali_session_data;
27 struct mali_group;
28 struct mali_pp_core;
29
30 extern _mali_osk_spinlock_irq_t *mali_executor_lock_obj;
31
32 #define MALI_DEBUG_ASSERT_EXECUTOR_LOCK_HELD() MALI_DEBUG_ASSERT_LOCK_HELD(mali_executor_lock_obj);
33
34 _mali_osk_errcode_t mali_executor_initialize(void);
35 void mali_executor_terminate(void);
36
37 void mali_executor_populate(void);
38 void mali_executor_depopulate(void);
39
40 void mali_executor_suspend(void);
41 void mali_executor_resume(void);
42
43 u32 mali_executor_get_num_cores_total(void);
44 u32 mali_executor_get_num_cores_enabled(void);
45 struct mali_pp_core *mali_executor_get_virtual_pp(void);
46 struct mali_group *mali_executor_get_virtual_group(void);
47
48 void mali_executor_zap_all_active(struct mali_session_data *session);
49
50 /**
51  * Schedule GP and PP according to bitmask.
52  *
53  * @param mask A scheduling bitmask.
54  * @param deferred_schedule MALI_TRUE if schedule should be deferred, MALI_FALSE if not.
55  */
56 void mali_executor_schedule_from_mask(mali_scheduler_mask mask, mali_bool deferred_schedule);
57
58 _mali_osk_errcode_t mali_executor_interrupt_gp(struct mali_group *group, mali_bool in_upper_half);
59 _mali_osk_errcode_t mali_executor_interrupt_pp(struct mali_group *group, mali_bool in_upper_half);
60 _mali_osk_errcode_t mali_executor_interrupt_mmu(struct mali_group *group, mali_bool in_upper_half);
61
62 void mali_executor_group_power_up(struct mali_group *groups[], u32 num_groups);
63 void mali_executor_group_power_down(struct mali_group *groups[], u32 num_groups);
64
65 void mali_executor_abort_session(struct mali_session_data *session);
66
67 void mali_executor_core_scaling_enable(void);
68 void mali_executor_core_scaling_disable(void);
69 mali_bool mali_executor_core_scaling_is_enabled(void);
70
71 void mali_executor_group_enable(struct mali_group *group);
72 void mali_executor_group_disable(struct mali_group *group);
73 mali_bool mali_executor_group_is_disabled(struct mali_group *group);
74
75 int mali_executor_set_perf_level(unsigned int target_core_nr, mali_bool override);
76
77 #if MALI_STATE_TRACKING
78 u32 mali_executor_dump_state(char *buf, u32 size);
79 #endif
80
81 MALI_STATIC_INLINE void mali_executor_hint_enable(mali_executor_hint hint)
82 {
83         MALI_DEBUG_ASSERT(hint < MALI_EXECUTOR_HINT_MAX);
84         mali_executor_hints[hint] = MALI_TRUE;
85 }
86
87 MALI_STATIC_INLINE void mali_executor_hint_disable(mali_executor_hint hint)
88 {
89         MALI_DEBUG_ASSERT(hint < MALI_EXECUTOR_HINT_MAX);
90         mali_executor_hints[hint] = MALI_FALSE;
91 }
92
93 MALI_STATIC_INLINE mali_bool mali_executor_hint_is_enabled(mali_executor_hint hint)
94 {
95         MALI_DEBUG_ASSERT(hint < MALI_EXECUTOR_HINT_MAX);
96         return mali_executor_hints[hint];
97 }
98
99 #endif /* __MALI_EXECUTOR_H__ */