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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
#ifndef __ION_DRV_H__
#define __ION_DRV_H__
#include <linux/version.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))
#include <ion.h>
#else
#include <linux/ion.h>
#endif
#include <linux/ion_debugger.h>
// Structure definitions
typedef enum
{
ION_CMD_SYSTEM,
ION_CMD_MULTIMEDIA
} ION_CMDS;
typedef enum
{
ION_MM_CONFIG_BUFFER,
ION_MM_SET_DEBUG_INFO,
ION_MM_GET_DEBUG_INFO,
ION_MM_SET_SF_BUF_INFO,
ION_MM_GET_SF_BUF_INFO
} ION_MM_CMDS;
typedef enum
{
ION_SYS_CACHE_SYNC,
ION_SYS_GET_PHYS,
ION_SYS_GET_CLIENT,
ION_SYS_RECORD,
ION_SYS_SET_HANDLE_BACKTRACE,
ION_SYS_SET_CLIENT_NAME,
} ION_SYS_CMDS;
typedef enum
{
ION_CACHE_CLEAN_BY_RANGE,
ION_CACHE_INVALID_BY_RANGE,
ION_CACHE_FLUSH_BY_RANGE,
ION_CACHE_CLEAN_BY_RANGE_USE_VA,
ION_CACHE_INVALID_BY_RANGE_USE_VA,
ION_CACHE_FLUSH_BY_RANGE_USE_VA,
ION_CACHE_CLEAN_ALL,
ION_CACHE_INVALID_ALL,
ION_CACHE_FLUSH_ALL
} ION_CACHE_SYNC_TYPE;
typedef enum
{
ION_ERROR_CONFIG_LOCKED = 0x10000
} ION_ERROR_E;
typedef struct ion_sys_cache_sync_param
{
union
{
ion_user_handle_t handle;
struct ion_handle* kernel_handle;
};
void* va;
unsigned int size;
ION_CACHE_SYNC_TYPE sync_type;
} ion_sys_cache_sync_param_t;
typedef struct ion_sys_get_phys_param
{
union
{
ion_user_handle_t handle;
struct ion_handle* kernel_handle;
};
unsigned int phy_addr;
unsigned int len;
} ion_sys_get_phys_param_t;
#define ION_MM_DBG_NAME_LEN 16
#define ION_MM_SF_BUF_INFO_LEN 16
typedef struct __ion_sys_client_name
{
char name[ION_MM_DBG_NAME_LEN];
}ion_sys_client_name_t;
typedef struct ion_sys_get_client_param
{
unsigned int client;
} ion_sys_get_client_param_t;
typedef struct ion_sys_data
{
ION_SYS_CMDS sys_cmd;
union
{
ion_sys_cache_sync_param_t cache_sync_param;
ion_sys_get_phys_param_t get_phys_param;
ion_sys_get_client_param_t get_client_param;
ion_sys_client_name_t client_name_param;
ion_sys_record_t record_param;
};
} ion_sys_data_t;
typedef struct ion_mm_config_buffer_param
{
union
{
ion_user_handle_t handle;
struct ion_handle* kernel_handle;
};
int eModuleID;
unsigned int security;
unsigned int coherent;
} ion_mm_config_buffer_param_t;
typedef struct __ion_mm_buf_debug_info
{
union
{
ion_user_handle_t handle;
struct ion_handle* kernel_handle;
};
char dbg_name[ION_MM_DBG_NAME_LEN];
unsigned int value1;
unsigned int value2;
unsigned int value3;
unsigned int value4;
}ion_mm_buf_debug_info_t;
typedef struct __ion_mm_sf_buf_info
{
union
{
ion_user_handle_t handle;
struct ion_handle* kernel_handle;
};
unsigned int info[ION_MM_SF_BUF_INFO_LEN];
}ion_mm_sf_buf_info_t;
typedef struct ion_mm_data
{
ION_MM_CMDS mm_cmd;
union
{
ion_mm_config_buffer_param_t config_buffer_param;
ion_mm_buf_debug_info_t buf_debug_info_param;
ion_mm_sf_buf_info_t sf_buf_info_param;
};
} ion_mm_data_t;
#ifdef __KERNEL__
#define ION_LOG_TAG "ion_dbg"
#include <linux/xlog.h>
#define IONMSG(string, args...) printk("[ION]"string,##args)
#define IONTMP(string, args...) printk("[ION]"string,##args)
#define ion_aee_print(string, args...) do{\
char ion_name[100];\
snprintf(ion_name,100, "["ION_LOG_TAG"]"string, ##args); \
aee_kernel_warning(ion_name, "["ION_LOG_TAG"]error:"string,##args); \
}while(0)
// Exported global variables
extern struct ion_device *g_ion_device;
// Exported functions
long ion_kernel_ioctl(struct ion_client *client, unsigned int cmd, unsigned long arg);
struct ion_handle* ion_drv_get_handle(struct ion_client* client, int user_handle, struct ion_handle* kernel_handle, int from_kernel);
int ion_drv_put_kernel_handle(void *kernel_handle);
/**
* ion_mm_heap_total_memory() - get mm heap total buffer size.
*/
size_t ion_mm_heap_total_memory(void);
/**
* ion_mm_heap_total_memory() - get mm heap buffer detail info.
*/
void ion_mm_heap_memory_detail(void);
int ion_drv_create_FB_heap(ion_phys_addr_t fb_base, size_t fb_size);
typedef int (ion_mm_buf_destroy_callback_t)(struct ion_buffer *buffer, unsigned int phyAddr);
int ion_mm_heap_register_buf_destroy_callback(struct ion_buffer *buffer, ion_mm_buf_destroy_callback_t *fn);
#endif
#endif
|