heap_mem_ext_v01.h 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  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. #ifndef HEAP_MEM_EXT_SERVICE_01_H
  14. #define HEAP_MEM_EXT_SERVICE_01_H
  15. #include <soc/qcom/msm_qmi_interface.h>
  16. #define MEM_ALLOC_REQ_MAX_MSG_LEN_V01 255
  17. #define MEM_FREE_REQ_MAX_MSG_LEN_V01 255
  18. #define MAX_ARR_CNT_V01 64
  19. struct dhms_mem_alloc_addr_info_type_v01 {
  20. uint64_t phy_addr;
  21. uint32_t num_bytes;
  22. };
  23. enum dhms_mem_proc_id_v01 {
  24. /* To force a 32 bit signed enum. Do not change or use */
  25. DHMS_MEM_PROC_ID_MIN_ENUM_VAL_V01 = -2147483647,
  26. /* Request from MPSS processor */
  27. DHMS_MEM_PROC_MPSS_V01 = 0,
  28. /* Request from ADSP processor */
  29. DHMS_MEM_PROC_ADSP_V01 = 1,
  30. /* Request from WCNSS processor */
  31. DHMS_MEM_PROC_WCNSS_V01 = 2,
  32. /* To force a 32 bit signed enum. Do not change or use */
  33. DHMS_MEM_PROC_ID_MAX_ENUM_VAL_V01 = 2147483647
  34. };
  35. enum dhms_mem_client_id_v01 {
  36. /*To force a 32 bit signed enum. Do not change or use*/
  37. DHMS_MEM_CLIENT_ID_MIN_ENUM_VAL_V01 = -2147483647,
  38. /* Request from GPS Client */
  39. DHMS_MEM_CLIENT_GPS_V01 = 0,
  40. /* Invalid Client */
  41. DHMS_MEM_CLIENT_INVALID = 1000,
  42. /* To force a 32 bit signed enum. Do not change or use */
  43. DHMS_MEM_CLIENT_ID_MAX_ENUM_VAL_V01 = 2147483647
  44. };
  45. enum dhms_mem_block_align_enum_v01 {
  46. /* To force a 32 bit signed enum. Do not change or use
  47. */
  48. DHMS_MEM_BLOCK_ALIGN_ENUM_MIN_ENUM_VAL_V01 = -2147483647,
  49. /* Align allocated memory by 2 bytes */
  50. DHMS_MEM_BLOCK_ALIGN_2_V01 = 0,
  51. /* Align allocated memory by 4 bytes */
  52. DHMS_MEM_BLOCK_ALIGN_4_V01 = 1,
  53. /**< Align allocated memory by 8 bytes */
  54. DHMS_MEM_BLOCK_ALIGN_8_V01 = 2,
  55. /**< Align allocated memory by 16 bytes */
  56. DHMS_MEM_BLOCK_ALIGN_16_V01 = 3,
  57. /**< Align allocated memory by 32 bytes */
  58. DHMS_MEM_BLOCK_ALIGN_32_V01 = 4,
  59. /**< Align allocated memory by 64 bytes */
  60. DHMS_MEM_BLOCK_ALIGN_64_V01 = 5,
  61. /**< Align allocated memory by 128 bytes */
  62. DHMS_MEM_BLOCK_ALIGN_128_V01 = 6,
  63. /**< Align allocated memory by 256 bytes */
  64. DHMS_MEM_BLOCK_ALIGN_256_V01 = 7,
  65. /**< Align allocated memory by 512 bytes */
  66. DHMS_MEM_BLOCK_ALIGN_512_V01 = 8,
  67. /**< Align allocated memory by 1024 bytes */
  68. DHMS_MEM_BLOCK_ALIGN_1K_V01 = 9,
  69. /**< Align allocated memory by 2048 bytes */
  70. DHMS_MEM_BLOCK_ALIGN_2K_V01 = 10,
  71. /**< Align allocated memory by 4096 bytes */
  72. DHMS_MEM_BLOCK_ALIGN_4K_V01 = 11,
  73. DHMS_MEM_BLOCK_ALIGN_ENUM_MAX_ENUM_VAL_V01 = 2147483647
  74. /* To force a 32 bit signed enum. Do not change or use
  75. */
  76. };
  77. /* Request Message; This command is used for getting
  78. * the multiple physically contiguous
  79. * memory blocks from the server memory subsystem
  80. */
  81. struct mem_alloc_req_msg_v01 {
  82. /* Mandatory */
  83. /*requested size*/
  84. uint32_t num_bytes;
  85. /* Optional */
  86. /* Must be set to true if block_alignment
  87. * is being passed
  88. */
  89. uint8_t block_alignment_valid;
  90. /* The block alignment for the memory block to be allocated
  91. */
  92. enum dhms_mem_block_align_enum_v01 block_alignment;
  93. }; /* Message */
  94. /* Response Message; This command is used for getting
  95. * the multiple physically contiguous memory blocks
  96. * from the server memory subsystem
  97. */
  98. struct mem_alloc_resp_msg_v01 {
  99. /* Mandatory */
  100. /* Result Code */
  101. /* The result of the requested memory operation
  102. */
  103. enum qmi_result_type_v01 resp;
  104. /* Optional */
  105. /* Memory Block Handle
  106. */
  107. /* Must be set to true if handle is being passed
  108. */
  109. uint8_t handle_valid;
  110. /* The physical address of the memory allocated on the HLOS
  111. */
  112. uint64_t handle;
  113. /* Optional */
  114. /* Memory block size */
  115. /* Must be set to true if num_bytes is being passed
  116. */
  117. uint8_t num_bytes_valid;
  118. /* The number of bytes actually allocated for the request.
  119. * This value can be smaller than the size requested in
  120. * QMI_DHMS_MEM_ALLOC_REQ_MSG.
  121. */
  122. uint32_t num_bytes;
  123. }; /* Message */
  124. /* Request Message; This command is used for releasing
  125. * the multiple physically contiguous
  126. * memory blocks to the server memory subsystem
  127. */
  128. struct mem_free_req_msg_v01 {
  129. /* Mandatory */
  130. /* Physical address of memory to be freed
  131. */
  132. uint32_t handle;
  133. }; /* Message */
  134. /* Response Message; This command is used for releasing
  135. * the multiple physically contiguous
  136. * memory blocks to the server memory subsystem
  137. */
  138. struct mem_free_resp_msg_v01 {
  139. /* Mandatory */
  140. /* Result of the requested memory operation, todo,
  141. * need to check the async operation for free
  142. */
  143. enum qmi_result_type_v01 resp;
  144. }; /* Message */
  145. /* Request Message; This command is used for getting
  146. * the multiple physically contiguous
  147. * memory blocks from the server memory subsystem
  148. */
  149. struct mem_alloc_generic_req_msg_v01 {
  150. /* Mandatory */
  151. /*requested size*/
  152. uint32_t num_bytes;
  153. /* Mandatory */
  154. /* client id */
  155. enum dhms_mem_client_id_v01 client_id;
  156. /* Mandatory */
  157. /* Peripheral Id*/
  158. enum dhms_mem_proc_id_v01 proc_id;
  159. /* Mandatory */
  160. /* Sequence id */
  161. uint32_t sequence_id;
  162. /* Optional */
  163. /* alloc_contiguous */
  164. /* Must be set to true if alloc_contiguous is being passed */
  165. uint8_t alloc_contiguous_valid;
  166. /* Alloc_contiguous is used to identify that clients are requesting
  167. * for contiguous or non contiguous memory, default is contiguous
  168. * 0 = non contiguous else contiguous
  169. */
  170. uint8_t alloc_contiguous;
  171. /* Optional */
  172. /* Must be set to true if block_alignment
  173. * is being passed
  174. */
  175. uint8_t block_alignment_valid;
  176. /* The block alignment for the memory block to be allocated
  177. */
  178. enum dhms_mem_block_align_enum_v01 block_alignment;
  179. }; /* Message */
  180. /* Response Message; This command is used for getting
  181. * the multiple physically contiguous memory blocks
  182. * from the server memory subsystem
  183. */
  184. struct mem_alloc_generic_resp_msg_v01 {
  185. /* Mandatory */
  186. /* Result Code */
  187. /* The result of the requested memory operation
  188. */
  189. struct qmi_response_type_v01 resp;
  190. /* Optional */
  191. /* Sequence ID */
  192. /* Must be set to true if sequence_id is being passed */
  193. uint8_t sequence_id_valid;
  194. /* Mandatory */
  195. /* Sequence id */
  196. uint32_t sequence_id;
  197. /* Optional */
  198. /* Memory Block Handle
  199. */
  200. /* Must be set to true if handle is being passed
  201. */
  202. uint8_t dhms_mem_alloc_addr_info_valid;
  203. /* Optional */
  204. /* Handle Size */
  205. uint32_t dhms_mem_alloc_addr_info_len;
  206. /* Optional */
  207. /* The physical address of the memory allocated on the HLOS
  208. */
  209. struct dhms_mem_alloc_addr_info_type_v01
  210. dhms_mem_alloc_addr_info[MAX_ARR_CNT_V01];
  211. }; /* Message */
  212. /* Request Message; This command is used for releasing
  213. * the multiple physically contiguous
  214. * memory blocks to the server memory subsystem
  215. */
  216. struct mem_free_generic_req_msg_v01 {
  217. /* Mandatory */
  218. /* Must be set to # of elments in array*/
  219. uint32_t dhms_mem_alloc_addr_info_len;
  220. /* Mandatory */
  221. /* Physical address and size of the memory allocated
  222. * on the HLOS to be freed.
  223. */
  224. struct dhms_mem_alloc_addr_info_type_v01
  225. dhms_mem_alloc_addr_info[MAX_ARR_CNT_V01];
  226. /* Optional */
  227. /* Client ID */
  228. /* Must be set to true if client_id is being passed */
  229. uint8_t client_id_valid;
  230. /* Optional */
  231. /* Client Id */
  232. enum dhms_mem_client_id_v01 client_id;
  233. /* Optional */
  234. /* Proc ID */
  235. /* Must be set to true if proc_id is being passed */
  236. uint8_t proc_id_valid;
  237. /* Optional */
  238. /* Peripheral */
  239. enum dhms_mem_proc_id_v01 proc_id;
  240. }; /* Message */
  241. /* Response Message; This command is used for releasing
  242. * the multiple physically contiguous
  243. * memory blocks to the server memory subsystem
  244. */
  245. struct mem_free_generic_resp_msg_v01 {
  246. /*
  247. * Mandatory
  248. * Result of the requested memory operation, todo,
  249. * need to check the async operation for free
  250. */
  251. struct qmi_response_type_v01 resp;
  252. }; /* Message */
  253. struct mem_query_size_req_msg_v01 {
  254. /* Mandatory */
  255. enum dhms_mem_client_id_v01 client_id;
  256. /*
  257. * Optional
  258. * Proc ID
  259. * proc_id_valid must be set to true if proc_id is being passed
  260. */
  261. uint8_t proc_id_valid;
  262. enum dhms_mem_proc_id_v01 proc_id;
  263. }; /* Message */
  264. struct mem_query_size_rsp_msg_v01 {
  265. /*
  266. * Mandatory
  267. * Result Code
  268. */
  269. struct qmi_response_type_v01 resp;
  270. /*
  271. * Optional
  272. * size_valid must be set to true if size is being passed
  273. */
  274. uint8_t size_valid;
  275. uint32_t size;
  276. }; /* Message */
  277. extern struct elem_info mem_alloc_req_msg_data_v01_ei[];
  278. extern struct elem_info mem_alloc_resp_msg_data_v01_ei[];
  279. extern struct elem_info mem_free_req_msg_data_v01_ei[];
  280. extern struct elem_info mem_free_resp_msg_data_v01_ei[];
  281. extern struct elem_info mem_alloc_generic_req_msg_data_v01_ei[];
  282. extern struct elem_info mem_alloc_generic_resp_msg_data_v01_ei[];
  283. extern struct elem_info mem_free_generic_req_msg_data_v01_ei[];
  284. extern struct elem_info mem_free_generic_resp_msg_data_v01_ei[];
  285. extern struct elem_info mem_query_size_req_msg_data_v01_ei[];
  286. extern struct elem_info mem_query_size_resp_msg_data_v01_ei[];
  287. /*Service Message Definition*/
  288. #define MEM_ALLOC_REQ_MSG_V01 0x0020
  289. #define MEM_ALLOC_RESP_MSG_V01 0x0020
  290. #define MEM_FREE_REQ_MSG_V01 0x0021
  291. #define MEM_FREE_RESP_MSG_V01 0x0021
  292. #define MEM_ALLOC_GENERIC_REQ_MSG_V01 0x0022
  293. #define MEM_ALLOC_GENERIC_RESP_MSG_V01 0x0022
  294. #define MEM_FREE_GENERIC_REQ_MSG_V01 0x0023
  295. #define MEM_FREE_GENERIC_RESP_MSG_V01 0x0023
  296. #define MEM_QUERY_SIZE_REQ_MSG_V01 0x0024
  297. #define MEM_QUERY_SIZE_RESP_MSG_V01 0x0024
  298. #endif