summaryrefslogtreecommitdiff
path: root/drivers/gpu/mali/mali400ko/driver/src/devicedrv/mali/common/mali_kernel_core.h
blob: 3819ecc5e1cf9f1f3a5490590d77f4780f928657 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
 * Copyright (C) 2010-2011 ARM Limited. All rights reserved.
 * 
 * This program is free software and is provided to you under the terms of the GNU General Public License version 2
 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
 * 
 * A copy of the licence is included with the program, and can also be obtained from Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#ifndef __MALI_KERNEL_CORE_H__
#define __MALI_KERNEL_CORE_H__

#include "mali_osk.h"

#if USING_MALI_PMM
#include "mali_ukk.h"
#include "mali_pmm.h"
#include "mali_pmm_system.h"
#endif

_mali_osk_errcode_t mali_kernel_constructor( void );
void mali_kernel_destructor( void );

/**
 * @brief Tranlate CPU physical to Mali physical addresses.
 *
 * This function is used to convert CPU physical addresses to Mali Physical
 * addresses, such that _mali_ukk_map_external_mem may be used to map them
 * into Mali. This will be used by _mali_ukk_va_to_mali_pa.
 *
 * This function only supports physically contiguous regions.
 *
 * A default implementation is provided, which uses a registered MEM_VALIDATION
 * resource to do a static translation. Only an address range which will lie
 * in the range specified by MEM_VALIDATION will be successfully translated.
 *
 * If a more complex, or non-static translation is required, then the
 * implementor has the following options:
 * - Rewrite this function to provide such a translation
 * - Integrate the provider of the memory with UMP.
 *
 * @param[in,out] phys_base pointer to the page-aligned base address of the
 * physical range to be translated
 *
 * @param[in] size size of the address range to be translated, which must be a
 * multiple of the physical page size.
 *
 * @return on success, _MALI_OSK_ERR_OK and *phys_base is translated. If the
 * cpu physical address range is not in the valid range, then a suitable
 * _mali_osk_errcode_t error.
 *
 */
_mali_osk_errcode_t mali_kernel_core_translate_cpu_to_mali_phys_range( u32 *phys_base, u32 size );


/**
 * @brief Validate a Mali physical address range.
 *
 * This function is used to ensure that an address range passed to
 * _mali_ukk_map_external_mem is allowed to be mapped into Mali.
 *
 * This function only supports physically contiguous regions.
 *
 * A default implementation is provided, which uses a registered MEM_VALIDATION
 * resource to do a static translation. Only an address range which will lie
 * in the range specified by MEM_VALIDATION will be successfully validated.
 *
 * If a more complex, or non-static validation is required, then the
 * implementor has the following options:
 * - Rewrite this function to provide such a validation
 * - Integrate the provider of the memory with UMP.
 *
 * @param phys_base page-aligned base address of the Mali physical range to be
 * validated.
 *
 * @param size size of the address range to be validated, which must be a
 * multiple of the physical page size.
 *
 * @return _MALI_OSK_ERR_OK if the Mali physical range is valid. Otherwise, a
 * suitable _mali_osk_errcode_t error.
 *
 */
_mali_osk_errcode_t mali_kernel_core_validate_mali_phys_range( u32 phys_base, u32 size );

#if USING_MALI_PMM
/**
 * @brief Signal a power up on a Mali core.
 *
 * This function flags a core as powered up.
 * For PP and GP cores it calls functions that move the core from a power off 
 * queue into the idle queue ready to run jobs. It also tries to schedule any
 * pending jobs to run on it. 
 *
 * This function will fail if the core is not powered off - either running or
 * already idle.
 *
 * @param core The PMM core id to power up.
 * @param queue_only When MALI_TRUE only re-queue the core - do not reset.
 *
 * @return _MALI_OSK_ERR_OK if the core has been powered up. Otherwise a
 * suitable _mali_osk_errcode_t error.
 */ 
_mali_osk_errcode_t mali_core_signal_power_up( mali_pmm_core_id core, mali_bool queue_only );

/**
 * @brief Signal a power down on a Mali core.
 *
 * This function flags a core as powered down.
 * For PP and GP cores it calls functions that move the core from an idle
 * queue into the power off queue. 
 *
 * This function will fail if the core is not idle - either running or 
 * already powered down.
 *
 * @param core The PMM core id to power up.
 * @param immediate_only Do not set the core to pending power down if it can't
 * power down immediately
 *
 * @return _MALI_OSK_ERR_OK if the core has been powered up. Otherwise a
 * suitable _mali_osk_errcode_t error.
 */ 
_mali_osk_errcode_t mali_core_signal_power_down( mali_pmm_core_id core, mali_bool immediate_only );

#endif

/**
 * Flag to indicate whether or not mali_benchmark is turned on.
 */
extern int mali_benchmark;


#endif /* __MALI_KERNEL_CORE_H__ */