heap_mem_ext_v01.c 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. /* Copyright (c) 2013-2015, 2017, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. */
  13. #include <linux/qmi_encdec.h>
  14. #include <soc/qcom/msm_qmi_interface.h>
  15. #include "heap_mem_ext_v01.h"
  16. struct elem_info mem_alloc_req_msg_data_v01_ei[] = {
  17. {
  18. .data_type = QMI_UNSIGNED_4_BYTE,
  19. .elem_len = 1,
  20. .elem_size = sizeof(uint32_t),
  21. .is_array = NO_ARRAY,
  22. .tlv_type = 0x01,
  23. .offset = offsetof(struct mem_alloc_req_msg_v01,
  24. num_bytes),
  25. },
  26. {
  27. .data_type = QMI_OPT_FLAG,
  28. .elem_len = 1,
  29. .elem_size = sizeof(uint8_t),
  30. .is_array = NO_ARRAY,
  31. .tlv_type = 0x10,
  32. .offset = offsetof(struct mem_alloc_req_msg_v01,
  33. block_alignment_valid),
  34. },
  35. {
  36. .data_type = QMI_UNSIGNED_4_BYTE,
  37. .elem_len = 1,
  38. .elem_size = sizeof(uint32_t),
  39. .is_array = NO_ARRAY,
  40. .tlv_type = 0x10,
  41. .offset = offsetof(struct mem_alloc_req_msg_v01,
  42. block_alignment),
  43. },
  44. {
  45. .data_type = QMI_EOTI,
  46. .is_array = NO_ARRAY,
  47. .tlv_type = QMI_COMMON_TLV_TYPE,
  48. },
  49. };
  50. struct elem_info mem_alloc_resp_msg_data_v01_ei[] = {
  51. {
  52. .data_type = QMI_SIGNED_2_BYTE_ENUM,
  53. .elem_len = 1,
  54. .elem_size = sizeof(uint16_t),
  55. .is_array = NO_ARRAY,
  56. .tlv_type = 0x01,
  57. .offset = offsetof(struct mem_alloc_resp_msg_v01,
  58. resp),
  59. },
  60. {
  61. .data_type = QMI_OPT_FLAG,
  62. .elem_len = 1,
  63. .elem_size = sizeof(uint8_t),
  64. .is_array = NO_ARRAY,
  65. .tlv_type = 0x10,
  66. .offset = offsetof(struct mem_alloc_resp_msg_v01,
  67. handle_valid),
  68. },
  69. {
  70. .data_type = QMI_UNSIGNED_8_BYTE,
  71. .elem_len = 1,
  72. .elem_size = sizeof(uint64_t),
  73. .is_array = NO_ARRAY,
  74. .tlv_type = 0x10,
  75. .offset = offsetof(struct mem_alloc_resp_msg_v01,
  76. handle),
  77. },
  78. {
  79. .data_type = QMI_OPT_FLAG,
  80. .elem_len = 1,
  81. .elem_size = sizeof(uint8_t),
  82. .is_array = NO_ARRAY,
  83. .tlv_type = 0x11,
  84. .offset = offsetof(struct mem_alloc_resp_msg_v01,
  85. num_bytes_valid),
  86. },
  87. {
  88. .data_type = QMI_UNSIGNED_4_BYTE,
  89. .elem_len = 1,
  90. .elem_size = sizeof(uint32_t),
  91. .is_array = NO_ARRAY,
  92. .tlv_type = 0x11,
  93. .offset = offsetof(struct mem_alloc_resp_msg_v01,
  94. num_bytes),
  95. },
  96. {
  97. .data_type = QMI_EOTI,
  98. .is_array = NO_ARRAY,
  99. .tlv_type = QMI_COMMON_TLV_TYPE,
  100. },
  101. };
  102. struct elem_info mem_free_req_msg_data_v01_ei[] = {
  103. {
  104. .data_type = QMI_UNSIGNED_8_BYTE,
  105. .elem_len = 1,
  106. .elem_size = sizeof(uint64_t),
  107. .is_array = NO_ARRAY,
  108. .tlv_type = 0x01,
  109. .offset = offsetof(struct mem_free_req_msg_v01,
  110. handle),
  111. },
  112. {
  113. .data_type = QMI_EOTI,
  114. .is_array = NO_ARRAY,
  115. .tlv_type = QMI_COMMON_TLV_TYPE,
  116. },
  117. };
  118. struct elem_info mem_free_resp_msg_data_v01_ei[] = {
  119. {
  120. .data_type = QMI_SIGNED_2_BYTE_ENUM,
  121. .elem_len = 1,
  122. .elem_size = sizeof(uint16_t),
  123. .is_array = NO_ARRAY,
  124. .tlv_type = 0x01,
  125. .offset = offsetof(struct mem_free_resp_msg_v01,
  126. resp),
  127. },
  128. {
  129. .data_type = QMI_EOTI,
  130. .is_array = NO_ARRAY,
  131. .tlv_type = QMI_COMMON_TLV_TYPE,
  132. },
  133. };
  134. struct elem_info dhms_mem_alloc_addr_info_type_v01_ei[] = {
  135. {
  136. .data_type = QMI_UNSIGNED_8_BYTE,
  137. .elem_len = 1,
  138. .elem_size = sizeof(uint64_t),
  139. .is_array = NO_ARRAY,
  140. .tlv_type = QMI_COMMON_TLV_TYPE,
  141. .offset = offsetof(struct
  142. dhms_mem_alloc_addr_info_type_v01,
  143. phy_addr),
  144. },
  145. {
  146. .data_type = QMI_UNSIGNED_4_BYTE,
  147. .elem_len = 1,
  148. .elem_size = sizeof(uint32_t),
  149. .is_array = NO_ARRAY,
  150. .tlv_type = QMI_COMMON_TLV_TYPE,
  151. .offset = offsetof(struct
  152. dhms_mem_alloc_addr_info_type_v01,
  153. num_bytes),
  154. },
  155. {
  156. .data_type = QMI_EOTI,
  157. .is_array = NO_ARRAY,
  158. .tlv_type = QMI_COMMON_TLV_TYPE,
  159. },
  160. };
  161. struct elem_info mem_alloc_generic_req_msg_data_v01_ei[] = {
  162. {
  163. .data_type = QMI_UNSIGNED_4_BYTE,
  164. .elem_len = 1,
  165. .elem_size = sizeof(uint32_t),
  166. .is_array = NO_ARRAY,
  167. .tlv_type = 0x01,
  168. .offset = offsetof(struct mem_alloc_generic_req_msg_v01,
  169. num_bytes),
  170. },
  171. {
  172. .data_type = QMI_UNSIGNED_4_BYTE,
  173. .elem_len = 1,
  174. .elem_size = sizeof(uint32_t),
  175. .is_array = NO_ARRAY,
  176. .tlv_type = 0x02,
  177. .offset = offsetof(struct mem_alloc_generic_req_msg_v01,
  178. client_id),
  179. },
  180. {
  181. .data_type = QMI_UNSIGNED_4_BYTE,
  182. .elem_len = 1,
  183. .elem_size = sizeof(uint32_t),
  184. .is_array = NO_ARRAY,
  185. .tlv_type = 0x03,
  186. .offset = offsetof(struct mem_alloc_generic_req_msg_v01,
  187. proc_id),
  188. },
  189. {
  190. .data_type = QMI_UNSIGNED_4_BYTE,
  191. .elem_len = 1,
  192. .elem_size = sizeof(uint32_t),
  193. .is_array = NO_ARRAY,
  194. .tlv_type = 0x04,
  195. .offset = offsetof(struct mem_alloc_generic_req_msg_v01,
  196. sequence_id),
  197. },
  198. {
  199. .data_type = QMI_OPT_FLAG,
  200. .elem_len = 1,
  201. .elem_size = sizeof(uint8_t),
  202. .is_array = NO_ARRAY,
  203. .tlv_type = 0x10,
  204. .offset = offsetof(struct mem_alloc_generic_req_msg_v01,
  205. alloc_contiguous_valid),
  206. },
  207. {
  208. .data_type = QMI_UNSIGNED_1_BYTE,
  209. .elem_len = 1,
  210. .elem_size = sizeof(uint8_t),
  211. .is_array = NO_ARRAY,
  212. .tlv_type = 0x10,
  213. .offset = offsetof(struct mem_alloc_generic_req_msg_v01,
  214. alloc_contiguous),
  215. },
  216. {
  217. .data_type = QMI_OPT_FLAG,
  218. .elem_len = 1,
  219. .elem_size = sizeof(uint8_t),
  220. .is_array = NO_ARRAY,
  221. .tlv_type = 0x11,
  222. .offset = offsetof(struct mem_alloc_generic_req_msg_v01,
  223. block_alignment_valid),
  224. },
  225. {
  226. .data_type = QMI_UNSIGNED_4_BYTE,
  227. .elem_len = 1,
  228. .elem_size = sizeof(uint32_t),
  229. .is_array = NO_ARRAY,
  230. .tlv_type = 0x11,
  231. .offset = offsetof(struct mem_alloc_generic_req_msg_v01,
  232. block_alignment),
  233. },
  234. {
  235. .data_type = QMI_EOTI,
  236. .is_array = NO_ARRAY,
  237. .tlv_type = QMI_COMMON_TLV_TYPE,
  238. },
  239. };
  240. struct elem_info mem_alloc_generic_resp_msg_data_v01_ei[] = {
  241. {
  242. .data_type = QMI_STRUCT,
  243. .elem_len = 1,
  244. .elem_size = sizeof(struct qmi_response_type_v01),
  245. .is_array = NO_ARRAY,
  246. .tlv_type = 0x02,
  247. .offset = offsetof(struct
  248. mem_alloc_generic_resp_msg_v01,
  249. resp),
  250. .ei_array = get_qmi_response_type_v01_ei(),
  251. },
  252. {
  253. .data_type = QMI_OPT_FLAG,
  254. .elem_len = 1,
  255. .elem_size = sizeof(uint8_t),
  256. .is_array = NO_ARRAY,
  257. .tlv_type = 0x10,
  258. .offset = offsetof(struct
  259. mem_alloc_generic_resp_msg_v01,
  260. sequence_id_valid),
  261. },
  262. {
  263. .data_type = QMI_UNSIGNED_4_BYTE,
  264. .elem_len = 1,
  265. .elem_size = sizeof(uint32_t),
  266. .is_array = NO_ARRAY,
  267. .tlv_type = 0x10,
  268. .offset = offsetof(struct
  269. mem_alloc_generic_resp_msg_v01,
  270. sequence_id),
  271. },
  272. {
  273. .data_type = QMI_OPT_FLAG,
  274. .elem_len = 1,
  275. .elem_size = sizeof(uint8_t),
  276. .is_array = NO_ARRAY,
  277. .tlv_type = 0x11,
  278. .offset = offsetof(struct
  279. mem_alloc_generic_resp_msg_v01,
  280. dhms_mem_alloc_addr_info_valid),
  281. },
  282. {
  283. .data_type = QMI_DATA_LEN,
  284. .elem_len = 1,
  285. .elem_size = sizeof(uint8_t),
  286. .is_array = NO_ARRAY,
  287. .tlv_type = 0x11,
  288. .offset = offsetof(struct
  289. mem_alloc_generic_resp_msg_v01,
  290. dhms_mem_alloc_addr_info_len),
  291. },
  292. {
  293. .data_type = QMI_STRUCT,
  294. .elem_len = MAX_ARR_CNT_V01,
  295. .elem_size = sizeof(struct
  296. dhms_mem_alloc_addr_info_type_v01),
  297. .is_array = VAR_LEN_ARRAY,
  298. .tlv_type = 0x11,
  299. .offset = offsetof(struct
  300. mem_alloc_generic_resp_msg_v01,
  301. dhms_mem_alloc_addr_info),
  302. .ei_array = dhms_mem_alloc_addr_info_type_v01_ei,
  303. },
  304. {
  305. .data_type = QMI_EOTI,
  306. .is_array = NO_ARRAY,
  307. .tlv_type = QMI_COMMON_TLV_TYPE,
  308. },
  309. };
  310. struct elem_info mem_free_generic_req_msg_data_v01_ei[] = {
  311. {
  312. .data_type = QMI_DATA_LEN,
  313. .elem_len = 1,
  314. .elem_size = sizeof(uint8_t),
  315. .is_array = NO_ARRAY,
  316. .tlv_type = 0x01,
  317. .offset = offsetof(struct mem_free_generic_req_msg_v01,
  318. dhms_mem_alloc_addr_info_len),
  319. },
  320. {
  321. .data_type = QMI_STRUCT,
  322. .elem_len = MAX_ARR_CNT_V01,
  323. .elem_size = sizeof(struct
  324. dhms_mem_alloc_addr_info_type_v01),
  325. .is_array = VAR_LEN_ARRAY,
  326. .tlv_type = 0x01,
  327. .offset = offsetof(struct mem_free_generic_req_msg_v01,
  328. dhms_mem_alloc_addr_info),
  329. .ei_array = dhms_mem_alloc_addr_info_type_v01_ei,
  330. },
  331. {
  332. .data_type = QMI_OPT_FLAG,
  333. .elem_len = 1,
  334. .elem_size = sizeof(uint8_t),
  335. .is_array = NO_ARRAY,
  336. .tlv_type = 0x10,
  337. .offset = offsetof(struct mem_free_generic_req_msg_v01,
  338. client_id_valid),
  339. },
  340. {
  341. .data_type = QMI_UNSIGNED_4_BYTE,
  342. .elem_len = 1,
  343. .elem_size = sizeof(uint32_t),
  344. .is_array = NO_ARRAY,
  345. .tlv_type = 0x10,
  346. .offset = offsetof(struct mem_free_generic_req_msg_v01,
  347. client_id),
  348. },
  349. {
  350. .data_type = QMI_OPT_FLAG,
  351. .elem_len = 1,
  352. .elem_size = sizeof(uint8_t),
  353. .is_array = NO_ARRAY,
  354. .tlv_type = 0x11,
  355. .offset = offsetof(struct mem_free_generic_req_msg_v01,
  356. proc_id_valid),
  357. },
  358. {
  359. .data_type = QMI_UNSIGNED_4_BYTE,
  360. .elem_len = 1,
  361. .elem_size = sizeof(uint32_t),
  362. .is_array = NO_ARRAY,
  363. .tlv_type = 0x11,
  364. .offset = offsetof(struct mem_free_generic_req_msg_v01,
  365. proc_id),
  366. },
  367. {
  368. .data_type = QMI_EOTI,
  369. .is_array = NO_ARRAY,
  370. .tlv_type = QMI_COMMON_TLV_TYPE,
  371. },
  372. };
  373. struct elem_info mem_free_generic_resp_msg_data_v01_ei[] = {
  374. {
  375. .data_type = QMI_STRUCT,
  376. .elem_len = 1,
  377. .elem_size = sizeof(struct qmi_response_type_v01),
  378. .is_array = NO_ARRAY,
  379. .tlv_type = 0x02,
  380. .offset = offsetof(struct
  381. mem_free_generic_resp_msg_v01,
  382. resp),
  383. .ei_array = get_qmi_response_type_v01_ei(),
  384. },
  385. {
  386. .data_type = QMI_EOTI,
  387. .is_array = NO_ARRAY,
  388. .tlv_type = QMI_COMMON_TLV_TYPE,
  389. },
  390. };
  391. struct elem_info mem_query_size_req_msg_data_v01_ei[] = {
  392. {
  393. .data_type = QMI_UNSIGNED_4_BYTE,
  394. .elem_len = 1,
  395. .elem_size = sizeof(uint32_t),
  396. .is_array = NO_ARRAY,
  397. .tlv_type = 0x01,
  398. .offset = offsetof(struct mem_query_size_req_msg_v01,
  399. client_id),
  400. },
  401. {
  402. .data_type = QMI_OPT_FLAG,
  403. .elem_len = 1,
  404. .elem_size = sizeof(uint8_t),
  405. .is_array = NO_ARRAY,
  406. .tlv_type = 0x10,
  407. .offset = offsetof(struct mem_query_size_req_msg_v01,
  408. proc_id_valid),
  409. },
  410. {
  411. .data_type = QMI_UNSIGNED_4_BYTE,
  412. .elem_len = 1,
  413. .elem_size = sizeof(uint32_t),
  414. .is_array = NO_ARRAY,
  415. .tlv_type = 0x10,
  416. .offset = offsetof(struct mem_query_size_req_msg_v01,
  417. proc_id),
  418. },
  419. {
  420. .data_type = QMI_EOTI,
  421. .is_array = NO_ARRAY,
  422. .tlv_type = QMI_COMMON_TLV_TYPE,
  423. },
  424. };
  425. struct elem_info mem_query_size_resp_msg_data_v01_ei[] = {
  426. {
  427. .data_type = QMI_STRUCT,
  428. .elem_len = 1,
  429. .elem_size = sizeof(struct qmi_response_type_v01),
  430. .is_array = NO_ARRAY,
  431. .tlv_type = 0x02,
  432. .offset = offsetof(struct
  433. mem_query_size_rsp_msg_v01,
  434. resp),
  435. .ei_array = get_qmi_response_type_v01_ei(),
  436. },
  437. {
  438. .data_type = QMI_OPT_FLAG,
  439. .elem_len = 1,
  440. .elem_size = sizeof(uint8_t),
  441. .is_array = NO_ARRAY,
  442. .tlv_type = 0x10,
  443. .offset = offsetof(struct mem_query_size_rsp_msg_v01,
  444. size_valid),
  445. },
  446. {
  447. .data_type = QMI_UNSIGNED_4_BYTE,
  448. .elem_len = 1,
  449. .elem_size = sizeof(uint32_t),
  450. .is_array = NO_ARRAY,
  451. .tlv_type = 0x10,
  452. .offset = offsetof(struct mem_query_size_rsp_msg_v01,
  453. size),
  454. },
  455. {
  456. .data_type = QMI_EOTI,
  457. .is_array = NO_ARRAY,
  458. .tlv_type = QMI_COMMON_TLV_TYPE,
  459. },
  460. };