tizen 2.4 release
[kernel/linux-3.0.git] / drivers / gpu / arm / mali400 / mali / common / mali_l2_cache.h
1 /*
2  * Copyright (C) 2011-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 #ifndef __MALI_KERNEL_L2_CACHE_H__
12 #define __MALI_KERNEL_L2_CACHE_H__
13
14 #include "mali_osk.h"
15
16 #define MALI_MAX_NUMBER_OF_L2_CACHE_CORES  3
17 /* Maximum 1 GP and 4 PP for an L2 cache core (Mali-400 Quad-core) */
18 #define MALI_MAX_NUMBER_OF_GROUPS_PER_L2_CACHE 5
19
20 struct mali_l2_cache_core;
21 struct mali_group;
22
23 _mali_osk_errcode_t mali_l2_cache_initialize(void);
24 void mali_l2_cache_terminate(void);
25
26 struct mali_l2_cache_core *mali_l2_cache_create(_mali_osk_resource_t * resource);
27 void mali_l2_cache_delete(struct mali_l2_cache_core *cache);
28
29 void mali_l2_cache_power_is_enabled_set(struct mali_l2_cache_core *core, mali_bool power_is_enabled);
30 mali_bool mali_l2_cache_power_is_enabled_get(struct mali_l2_cache_core * core);
31
32 u32 mali_l2_cache_get_id(struct mali_l2_cache_core *cache);
33
34 mali_bool mali_l2_cache_core_set_counter_src0(struct mali_l2_cache_core *cache, u32 counter);
35 mali_bool mali_l2_cache_core_set_counter_src1(struct mali_l2_cache_core *cache, u32 counter);
36 u32 mali_l2_cache_core_get_counter_src0(struct mali_l2_cache_core *cache);
37 u32 mali_l2_cache_core_get_counter_src1(struct mali_l2_cache_core *cache);
38 void mali_l2_cache_core_get_counter_values(struct mali_l2_cache_core *cache, u32 *src0, u32 *value0, u32 *src1, u32 *value1);
39 struct mali_l2_cache_core *mali_l2_cache_core_get_glob_l2_core(u32 index);
40 u32 mali_l2_cache_core_get_glob_num_l2_cores(void);
41
42 void mali_l2_cache_reset(struct mali_l2_cache_core *cache);
43 void mali_l2_cache_reset_all(void);
44
45 struct mali_group *mali_l2_cache_get_group(struct mali_l2_cache_core *cache, u32 index);
46
47 _mali_osk_errcode_t mali_l2_cache_invalidate_all(struct mali_l2_cache_core *cache);
48 mali_bool mali_l2_cache_invalidate_all_conditional(struct mali_l2_cache_core *cache, u32 id);
49 void mali_l2_cache_invalidate_all_force(struct mali_l2_cache_core *cache);
50 _mali_osk_errcode_t mali_l2_cache_invalidate_pages(struct mali_l2_cache_core *cache, u32 *pages, u32 num_pages);
51 void mali_l2_cache_invalidate_pages_conditional(u32 *pages, u32 num_pages);
52
53 mali_bool mali_l2_cache_lock_power_state(struct mali_l2_cache_core *cache);
54 void mali_l2_cache_unlock_power_state(struct mali_l2_cache_core *cache);
55
56 #endif /* __MALI_KERNEL_L2_CACHE_H__ */