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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
|
/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef HEAP_MEM_EXT_SERVICE_01_H
#define HEAP_MEM_EXT_SERVICE_01_H
#include <soc/qcom/msm_qmi_interface.h>
#define MEM_ALLOC_REQ_MAX_MSG_LEN_V01 255
#define MEM_FREE_REQ_MAX_MSG_LEN_V01 255
#define MAX_ARR_CNT_V01 64
struct dhms_mem_alloc_addr_info_type_v01 {
uint64_t phy_addr;
uint32_t num_bytes;
};
enum dhms_mem_proc_id_v01 {
/* To force a 32 bit signed enum. Do not change or use */
DHMS_MEM_PROC_ID_MIN_ENUM_VAL_V01 = -2147483647,
/* Request from MPSS processor */
DHMS_MEM_PROC_MPSS_V01 = 0,
/* Request from ADSP processor */
DHMS_MEM_PROC_ADSP_V01 = 1,
/* Request from WCNSS processor */
DHMS_MEM_PROC_WCNSS_V01 = 2,
/* To force a 32 bit signed enum. Do not change or use */
DHMS_MEM_PROC_ID_MAX_ENUM_VAL_V01 = 2147483647
};
enum dhms_mem_client_id_v01 {
/*To force a 32 bit signed enum. Do not change or use*/
DHMS_MEM_CLIENT_ID_MIN_ENUM_VAL_V01 = -2147483647,
/* Request from GPS Client */
DHMS_MEM_CLIENT_GPS_V01 = 0,
/* Invalid Client */
DHMS_MEM_CLIENT_INVALID = 1000,
/* To force a 32 bit signed enum. Do not change or use */
DHMS_MEM_CLIENT_ID_MAX_ENUM_VAL_V01 = 2147483647
};
enum dhms_mem_block_align_enum_v01 {
/* To force a 32 bit signed enum. Do not change or use
*/
DHMS_MEM_BLOCK_ALIGN_ENUM_MIN_ENUM_VAL_V01 = -2147483647,
/* Align allocated memory by 2 bytes */
DHMS_MEM_BLOCK_ALIGN_2_V01 = 0,
/* Align allocated memory by 4 bytes */
DHMS_MEM_BLOCK_ALIGN_4_V01 = 1,
/**< Align allocated memory by 8 bytes */
DHMS_MEM_BLOCK_ALIGN_8_V01 = 2,
/**< Align allocated memory by 16 bytes */
DHMS_MEM_BLOCK_ALIGN_16_V01 = 3,
/**< Align allocated memory by 32 bytes */
DHMS_MEM_BLOCK_ALIGN_32_V01 = 4,
/**< Align allocated memory by 64 bytes */
DHMS_MEM_BLOCK_ALIGN_64_V01 = 5,
/**< Align allocated memory by 128 bytes */
DHMS_MEM_BLOCK_ALIGN_128_V01 = 6,
/**< Align allocated memory by 256 bytes */
DHMS_MEM_BLOCK_ALIGN_256_V01 = 7,
/**< Align allocated memory by 512 bytes */
DHMS_MEM_BLOCK_ALIGN_512_V01 = 8,
/**< Align allocated memory by 1024 bytes */
DHMS_MEM_BLOCK_ALIGN_1K_V01 = 9,
/**< Align allocated memory by 2048 bytes */
DHMS_MEM_BLOCK_ALIGN_2K_V01 = 10,
/**< Align allocated memory by 4096 bytes */
DHMS_MEM_BLOCK_ALIGN_4K_V01 = 11,
DHMS_MEM_BLOCK_ALIGN_ENUM_MAX_ENUM_VAL_V01 = 2147483647
/* To force a 32 bit signed enum. Do not change or use
*/
};
/* Request Message; This command is used for getting
* the multiple physically contiguous
* memory blocks from the server memory subsystem
*/
struct mem_alloc_req_msg_v01 {
/* Mandatory */
/*requested size*/
uint32_t num_bytes;
/* Optional */
/* Must be set to true if block_alignment
* is being passed
*/
uint8_t block_alignment_valid;
/* The block alignment for the memory block to be allocated
*/
enum dhms_mem_block_align_enum_v01 block_alignment;
}; /* Message */
/* Response Message; This command is used for getting
* the multiple physically contiguous memory blocks
* from the server memory subsystem
*/
struct mem_alloc_resp_msg_v01 {
/* Mandatory */
/* Result Code */
/* The result of the requested memory operation
*/
enum qmi_result_type_v01 resp;
/* Optional */
/* Memory Block Handle
*/
/* Must be set to true if handle is being passed
*/
uint8_t handle_valid;
/* The physical address of the memory allocated on the HLOS
*/
uint64_t handle;
/* Optional */
/* Memory block size */
/* Must be set to true if num_bytes is being passed
*/
uint8_t num_bytes_valid;
/* The number of bytes actually allocated for the request.
* This value can be smaller than the size requested in
* QMI_DHMS_MEM_ALLOC_REQ_MSG.
*/
uint32_t num_bytes;
}; /* Message */
/* Request Message; This command is used for releasing
* the multiple physically contiguous
* memory blocks to the server memory subsystem
*/
struct mem_free_req_msg_v01 {
/* Mandatory */
/* Physical address of memory to be freed
*/
uint32_t handle;
}; /* Message */
/* Response Message; This command is used for releasing
* the multiple physically contiguous
* memory blocks to the server memory subsystem
*/
struct mem_free_resp_msg_v01 {
/* Mandatory */
/* Result of the requested memory operation, todo,
* need to check the async operation for free
*/
enum qmi_result_type_v01 resp;
}; /* Message */
/* Request Message; This command is used for getting
* the multiple physically contiguous
* memory blocks from the server memory subsystem
*/
struct mem_alloc_generic_req_msg_v01 {
/* Mandatory */
/*requested size*/
uint32_t num_bytes;
/* Mandatory */
/* client id */
enum dhms_mem_client_id_v01 client_id;
/* Mandatory */
/* Peripheral Id*/
enum dhms_mem_proc_id_v01 proc_id;
/* Mandatory */
/* Sequence id */
uint32_t sequence_id;
/* Optional */
/* alloc_contiguous */
/* Must be set to true if alloc_contiguous is being passed */
uint8_t alloc_contiguous_valid;
/* Alloc_contiguous is used to identify that clients are requesting
* for contiguous or non contiguous memory, default is contiguous
* 0 = non contiguous else contiguous
*/
uint8_t alloc_contiguous;
/* Optional */
/* Must be set to true if block_alignment
* is being passed
*/
uint8_t block_alignment_valid;
/* The block alignment for the memory block to be allocated
*/
enum dhms_mem_block_align_enum_v01 block_alignment;
}; /* Message */
/* Response Message; This command is used for getting
* the multiple physically contiguous memory blocks
* from the server memory subsystem
*/
struct mem_alloc_generic_resp_msg_v01 {
/* Mandatory */
/* Result Code */
/* The result of the requested memory operation
*/
struct qmi_response_type_v01 resp;
/* Optional */
/* Sequence ID */
/* Must be set to true if sequence_id is being passed */
uint8_t sequence_id_valid;
/* Mandatory */
/* Sequence id */
uint32_t sequence_id;
/* Optional */
/* Memory Block Handle
*/
/* Must be set to true if handle is being passed
*/
uint8_t dhms_mem_alloc_addr_info_valid;
/* Optional */
/* Handle Size */
uint32_t dhms_mem_alloc_addr_info_len;
/* Optional */
/* The physical address of the memory allocated on the HLOS
*/
struct dhms_mem_alloc_addr_info_type_v01
dhms_mem_alloc_addr_info[MAX_ARR_CNT_V01];
}; /* Message */
/* Request Message; This command is used for releasing
* the multiple physically contiguous
* memory blocks to the server memory subsystem
*/
struct mem_free_generic_req_msg_v01 {
/* Mandatory */
/* Must be set to # of elments in array*/
uint32_t dhms_mem_alloc_addr_info_len;
/* Mandatory */
/* Physical address and size of the memory allocated
* on the HLOS to be freed.
*/
struct dhms_mem_alloc_addr_info_type_v01
dhms_mem_alloc_addr_info[MAX_ARR_CNT_V01];
/* Optional */
/* Client ID */
/* Must be set to true if client_id is being passed */
uint8_t client_id_valid;
/* Optional */
/* Client Id */
enum dhms_mem_client_id_v01 client_id;
/* Optional */
/* Proc ID */
/* Must be set to true if proc_id is being passed */
uint8_t proc_id_valid;
/* Optional */
/* Peripheral */
enum dhms_mem_proc_id_v01 proc_id;
}; /* Message */
/* Response Message; This command is used for releasing
* the multiple physically contiguous
* memory blocks to the server memory subsystem
*/
struct mem_free_generic_resp_msg_v01 {
/*
* Mandatory
* Result of the requested memory operation, todo,
* need to check the async operation for free
*/
struct qmi_response_type_v01 resp;
}; /* Message */
struct mem_query_size_req_msg_v01 {
/* Mandatory */
enum dhms_mem_client_id_v01 client_id;
/*
* Optional
* Proc ID
* proc_id_valid must be set to true if proc_id is being passed
*/
uint8_t proc_id_valid;
enum dhms_mem_proc_id_v01 proc_id;
}; /* Message */
struct mem_query_size_rsp_msg_v01 {
/*
* Mandatory
* Result Code
*/
struct qmi_response_type_v01 resp;
/*
* Optional
* size_valid must be set to true if size is being passed
*/
uint8_t size_valid;
uint32_t size;
}; /* Message */
extern struct elem_info mem_alloc_req_msg_data_v01_ei[];
extern struct elem_info mem_alloc_resp_msg_data_v01_ei[];
extern struct elem_info mem_free_req_msg_data_v01_ei[];
extern struct elem_info mem_free_resp_msg_data_v01_ei[];
extern struct elem_info mem_alloc_generic_req_msg_data_v01_ei[];
extern struct elem_info mem_alloc_generic_resp_msg_data_v01_ei[];
extern struct elem_info mem_free_generic_req_msg_data_v01_ei[];
extern struct elem_info mem_free_generic_resp_msg_data_v01_ei[];
extern struct elem_info mem_query_size_req_msg_data_v01_ei[];
extern struct elem_info mem_query_size_resp_msg_data_v01_ei[];
/*Service Message Definition*/
#define MEM_ALLOC_REQ_MSG_V01 0x0020
#define MEM_ALLOC_RESP_MSG_V01 0x0020
#define MEM_FREE_REQ_MSG_V01 0x0021
#define MEM_FREE_RESP_MSG_V01 0x0021
#define MEM_ALLOC_GENERIC_REQ_MSG_V01 0x0022
#define MEM_ALLOC_GENERIC_RESP_MSG_V01 0x0022
#define MEM_FREE_GENERIC_REQ_MSG_V01 0x0023
#define MEM_FREE_GENERIC_RESP_MSG_V01 0x0023
#define MEM_QUERY_SIZE_REQ_MSG_V01 0x0024
#define MEM_QUERY_SIZE_RESP_MSG_V01 0x0024
#endif
|