qdf_mem.h 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236
  1. /*
  2. * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. /**
  20. * DOC: qdf_mem
  21. * QCA driver framework (QDF) memory management APIs
  22. */
  23. #if !defined(__QDF_MEMORY_H)
  24. #define __QDF_MEMORY_H
  25. /* Include Files */
  26. #include <qdf_types.h>
  27. #include <i_qdf_mem.h>
  28. #include <i_qdf_trace.h>
  29. #include <qdf_atomic.h>
  30. #define QDF_CACHE_LINE_SZ __qdf_cache_line_sz
  31. /**
  32. * qdf_align() - align to the given size.
  33. * @a: input that needs to be aligned.
  34. * @align_size: boundary on which 'a' has to be alinged.
  35. *
  36. * Return: aligned value.
  37. */
  38. #define qdf_align(a, align_size) __qdf_align(a, align_size)
  39. #define qdf_page_size __page_size
  40. /**
  41. * struct qdf_mem_dma_page_t - Allocated dmaable page
  42. * @page_v_addr_start: Page start virtual address
  43. * @page_v_addr_end: Page end virtual address
  44. * @page_p_addr: Page start physical address
  45. */
  46. struct qdf_mem_dma_page_t {
  47. char *page_v_addr_start;
  48. char *page_v_addr_end;
  49. qdf_dma_addr_t page_p_addr;
  50. };
  51. /**
  52. * struct qdf_mem_multi_page_t - multiple page allocation information storage
  53. * @num_element_per_page: Number of element in single page
  54. * @num_pages: Number of allocation needed pages
  55. * @dma_pages: page information storage in case of coherent memory
  56. * @cacheable_pages: page information storage in case of cacheable memory
  57. * @is_mem_prealloc: flag for multiple pages pre-alloc or not
  58. */
  59. struct qdf_mem_multi_page_t {
  60. uint16_t num_element_per_page;
  61. uint16_t num_pages;
  62. struct qdf_mem_dma_page_t *dma_pages;
  63. void **cacheable_pages;
  64. qdf_size_t page_size;
  65. #ifdef DP_MEM_PRE_ALLOC
  66. uint8_t is_mem_prealloc;
  67. #endif
  68. };
  69. /* Preprocessor definitions and constants */
  70. typedef __qdf_mempool_t qdf_mempool_t;
  71. /**
  72. * qdf_mem_init() - Initialize QDF memory module
  73. *
  74. * Return: None
  75. *
  76. */
  77. void qdf_mem_init(void);
  78. /**
  79. * qdf_mem_exit() - Exit QDF memory module
  80. *
  81. * Return: None
  82. *
  83. */
  84. void qdf_mem_exit(void);
  85. #ifdef QCA_WIFI_MODULE_PARAMS_FROM_INI
  86. #define qdf_untracked_mem_malloc(size) \
  87. __qdf_untracked_mem_malloc(size, __func__, __LINE__)
  88. #define qdf_untracked_mem_free(ptr) \
  89. __qdf_untracked_mem_free(ptr)
  90. #endif
  91. #define QDF_MEM_FUNC_NAME_SIZE 48
  92. #ifdef MEMORY_DEBUG
  93. /**
  94. * qdf_mem_debug_config_get() - Get the user configuration of mem_debug_disabled
  95. *
  96. * Return: value of mem_debug_disabled qdf module argument
  97. */
  98. bool qdf_mem_debug_config_get(void);
  99. #ifdef QCA_WIFI_MODULE_PARAMS_FROM_INI
  100. /**
  101. * qdf_mem_debug_disabled_set() - Set mem_debug_disabled
  102. * @str_value: value of the module param
  103. *
  104. * This function will set qdf module param mem_debug_disabled
  105. *
  106. * Return: QDF_STATUS_SUCCESS on Success
  107. */
  108. QDF_STATUS qdf_mem_debug_disabled_config_set(const char *str_value);
  109. #endif
  110. /**
  111. * qdf_mem_malloc_debug() - debug version of QDF memory allocation API
  112. * @size: Number of bytes of memory to allocate.
  113. * @func: Function name of the call site
  114. * @line: Line number of the call site
  115. * @caller: Address of the caller function
  116. * @flag: GFP flag
  117. *
  118. * This function will dynamicallly allocate the specified number of bytes of
  119. * memory and add it to the qdf tracking list to check for memory leaks and
  120. * corruptions
  121. *
  122. * Return: A valid memory location on success, or NULL on failure
  123. */
  124. void *qdf_mem_malloc_debug(size_t size, const char *func, uint32_t line,
  125. void *caller, uint32_t flag);
  126. #define qdf_mem_malloc(size) \
  127. qdf_mem_malloc_debug(size, __func__, __LINE__, QDF_RET_IP, 0)
  128. #define qdf_mem_malloc_fl(size, func, line) \
  129. qdf_mem_malloc_debug(size, func, line, QDF_RET_IP, 0)
  130. #define qdf_mem_malloc_atomic(size) \
  131. qdf_mem_malloc_debug(size, __func__, __LINE__, QDF_RET_IP, GFP_ATOMIC)
  132. /**
  133. * qdf_mem_free_debug() - debug version of qdf_mem_free
  134. * @ptr: Pointer to the starting address of the memory to be freed.
  135. *
  136. * This function will free the memory pointed to by 'ptr'. It also checks for
  137. * memory corruption, underrun, overrun, double free, domain mismatch, etc.
  138. *
  139. * Return: none
  140. */
  141. void qdf_mem_free_debug(void *ptr, const char *file, uint32_t line);
  142. #define qdf_mem_free(ptr) \
  143. qdf_mem_free_debug(ptr, __func__, __LINE__)
  144. void qdf_mem_multi_pages_alloc_debug(qdf_device_t osdev,
  145. struct qdf_mem_multi_page_t *pages,
  146. size_t element_size, uint16_t element_num,
  147. qdf_dma_context_t memctxt, bool cacheable,
  148. const char *func, uint32_t line,
  149. void *caller);
  150. #define qdf_mem_multi_pages_alloc(osdev, pages, element_size, element_num,\
  151. memctxt, cacheable) \
  152. qdf_mem_multi_pages_alloc_debug(osdev, pages, element_size, \
  153. element_num, memctxt, cacheable, \
  154. __func__, __LINE__, QDF_RET_IP)
  155. void qdf_mem_multi_pages_free_debug(qdf_device_t osdev,
  156. struct qdf_mem_multi_page_t *pages,
  157. qdf_dma_context_t memctxt, bool cacheable,
  158. const char *func, uint32_t line);
  159. #define qdf_mem_multi_pages_free(osdev, pages, memctxt, cacheable) \
  160. qdf_mem_multi_pages_free_debug(osdev, pages, memctxt, cacheable, \
  161. __func__, __LINE__)
  162. /**
  163. * qdf_mem_check_for_leaks() - Assert that the current memory domain is empty
  164. *
  165. * Call this to ensure there are no active memory allocations being tracked
  166. * against the current debug domain. For example, one should call this function
  167. * immediately before a call to qdf_debug_domain_set() as a memory leak
  168. * detection mechanism.
  169. *
  170. * e.g.
  171. * qdf_debug_domain_set(QDF_DEBUG_DOMAIN_ACTIVE);
  172. *
  173. * ...
  174. *
  175. * // memory is allocated and freed
  176. *
  177. * ...
  178. *
  179. * // before transitioning back to inactive state,
  180. * // make sure all active memory has been freed
  181. * qdf_mem_check_for_leaks();
  182. * qdf_debug_domain_set(QDF_DEBUG_DOMAIN_INIT);
  183. *
  184. * ...
  185. *
  186. * // also, before program exit, make sure init time memory is freed
  187. * qdf_mem_check_for_leaks();
  188. * exit();
  189. *
  190. * Return: None
  191. */
  192. void qdf_mem_check_for_leaks(void);
  193. /**
  194. * qdf_mem_alloc_consistent_debug() - allocates consistent qdf memory
  195. * @osdev: OS device handle
  196. * @dev: Pointer to device handle
  197. * @size: Size to be allocated
  198. * @paddr: Physical address
  199. * @func: Function name of the call site
  200. * @line: line numbe rof the call site
  201. * @caller: Address of the caller function
  202. *
  203. * Return: pointer of allocated memory or null if memory alloc fails
  204. */
  205. void *qdf_mem_alloc_consistent_debug(qdf_device_t osdev, void *dev,
  206. qdf_size_t size, qdf_dma_addr_t *paddr,
  207. const char *func, uint32_t line,
  208. void *caller);
  209. #define qdf_mem_alloc_consistent(osdev, dev, size, paddr) \
  210. qdf_mem_alloc_consistent_debug(osdev, dev, size, paddr, \
  211. __func__, __LINE__, QDF_RET_IP)
  212. /**
  213. * qdf_mem_free_consistent_debug() - free consistent qdf memory
  214. * @osdev: OS device handle
  215. * @size: Size to be allocated
  216. * @vaddr: virtual address
  217. * @paddr: Physical address
  218. * @memctx: Pointer to DMA context
  219. * @func: Function name of the call site
  220. * @line: line numbe rof the call site
  221. *
  222. * Return: none
  223. */
  224. void qdf_mem_free_consistent_debug(qdf_device_t osdev, void *dev,
  225. qdf_size_t size, void *vaddr,
  226. qdf_dma_addr_t paddr,
  227. qdf_dma_context_t memctx,
  228. const char *func, uint32_t line);
  229. #define qdf_mem_free_consistent(osdev, dev, size, vaddr, paddr, memctx) \
  230. qdf_mem_free_consistent_debug(osdev, dev, size, vaddr, paddr, memctx, \
  231. __func__, __LINE__)
  232. #else
  233. static inline bool qdf_mem_debug_config_get(void)
  234. {
  235. return false;
  236. }
  237. static inline
  238. QDF_STATUS qdf_mem_debug_disabled_config_set(const char *str_value)
  239. {
  240. return QDF_STATUS_SUCCESS;
  241. }
  242. /**
  243. * qdf_mem_malloc() - allocation QDF memory
  244. * @size: Number of bytes of memory to allocate.
  245. *
  246. * This function will dynamicallly allocate the specified number of bytes of
  247. * memory.
  248. *
  249. * Return:
  250. * Upon successful allocate, returns a non-NULL pointer to the allocated
  251. * memory. If this function is unable to allocate the amount of memory
  252. * specified (for any reason) it returns NULL.
  253. */
  254. #define qdf_mem_malloc(size) \
  255. __qdf_mem_malloc(size, __func__, __LINE__)
  256. #define qdf_mem_malloc_fl(size, func, line) \
  257. __qdf_mem_malloc(size, func, line)
  258. /**
  259. * qdf_mem_malloc_atomic() - allocation QDF memory atomically
  260. * @size: Number of bytes of memory to allocate.
  261. *
  262. * This function will dynamicallly allocate the specified number of bytes of
  263. * memory.
  264. *
  265. * Return:
  266. * Upon successful allocate, returns a non-NULL pointer to the allocated
  267. * memory. If this function is unable to allocate the amount of memory
  268. * specified (for any reason) it returns NULL.
  269. */
  270. #define qdf_mem_malloc_atomic(size) \
  271. qdf_mem_malloc_atomic_fl(size, __func__, __LINE__)
  272. void *qdf_mem_malloc_atomic_fl(qdf_size_t size,
  273. const char *func,
  274. uint32_t line);
  275. #define qdf_mem_free(ptr) \
  276. __qdf_mem_free(ptr)
  277. static inline void qdf_mem_check_for_leaks(void) { }
  278. #define qdf_mem_alloc_consistent(osdev, dev, size, paddr) \
  279. __qdf_mem_alloc_consistent(osdev, dev, size, paddr, __func__, __LINE__)
  280. #define qdf_mem_free_consistent(osdev, dev, size, vaddr, paddr, memctx) \
  281. __qdf_mem_free_consistent(osdev, dev, size, vaddr, paddr, memctx)
  282. void qdf_mem_multi_pages_alloc(qdf_device_t osdev,
  283. struct qdf_mem_multi_page_t *pages,
  284. size_t element_size, uint16_t element_num,
  285. qdf_dma_context_t memctxt, bool cacheable);
  286. void qdf_mem_multi_pages_free(qdf_device_t osdev,
  287. struct qdf_mem_multi_page_t *pages,
  288. qdf_dma_context_t memctxt, bool cacheable);
  289. #endif /* MEMORY_DEBUG */
  290. /**
  291. * qdf_mem_malloc_flags: Get mem allocation flags
  292. *
  293. * Return the flag to be use for memory allocation
  294. * based on the context
  295. *
  296. * Returns: Based on the context, returns the GFP flag
  297. * for memory alloaction
  298. */
  299. int qdf_mem_malloc_flags(void);
  300. /**
  301. * qdf_prealloc_disabled_config_get() - Get the user configuration of
  302. * prealloc_disabled
  303. *
  304. * Return: value of prealloc_disabled qdf module argument
  305. */
  306. bool qdf_prealloc_disabled_config_get(void);
  307. #ifdef QCA_WIFI_MODULE_PARAMS_FROM_INI
  308. /**
  309. * qdf_prealloc_disabled_config_set() - Set prealloc_disabled
  310. * @str_value: value of the module param
  311. *
  312. * This function will set qdf module param prealloc_disabled
  313. *
  314. * Return: QDF_STATUS_SUCCESS on Success
  315. */
  316. QDF_STATUS qdf_prealloc_disabled_config_set(const char *str_value);
  317. #endif
  318. /**
  319. * qdf_mem_multi_pages_zero() - zero out each page memory
  320. * @pages: Multi page information storage
  321. * @cacheable: Coherent memory or cacheable memory
  322. *
  323. * This function will zero out each page memory
  324. *
  325. * Return: None
  326. */
  327. void qdf_mem_multi_pages_zero(struct qdf_mem_multi_page_t *pages,
  328. bool cacheable);
  329. /**
  330. * qdf_aligned_malloc() - allocates aligned QDF memory.
  331. * @size: Size to be allocated
  332. * @vaddr_unaligned: Unaligned virtual address.
  333. * @paddr_unaligned: Unaligned physical address.
  334. * @paddr_aligned: Aligned physical address.
  335. * @align: Base address alignment.
  336. * @func: Function name of the call site.
  337. * @line: Line number of the call site.
  338. *
  339. * This function will dynamically allocate the specified number of bytes of
  340. * memory. Checks if the allocated base address is aligned with base_align.
  341. * If not, it frees the allocated memory, adds base_align to alloc size and
  342. * re-allocates the memory.
  343. *
  344. * Return:
  345. * Upon successful allocate, returns an aligned base address of the allocated
  346. * memory. If this function is unable to allocate the amount of memory
  347. * specified (for any reason) it returns NULL.
  348. */
  349. #define qdf_aligned_malloc(size, vaddr_unaligned, paddr_unaligned, \
  350. paddr_aligned, align) \
  351. qdf_aligned_malloc_fl(size, vaddr_unaligned, paddr_unaligned, \
  352. paddr_aligned, align, __func__, __LINE__)
  353. void *qdf_aligned_malloc_fl(uint32_t *size, void **vaddr_unaligned,
  354. qdf_dma_addr_t *paddr_unaligned,
  355. qdf_dma_addr_t *paddr_aligned,
  356. uint32_t align,
  357. const char *func, uint32_t line);
  358. /**
  359. * qdf_aligned_mem_alloc_consistent() - allocates consistent qdf memory
  360. * @osdev: OS device handle
  361. * @size: Size to be allocated
  362. * @vaddr_unaligned: Unaligned virtual address.
  363. * @paddr_unaligned: Unaligned physical address.
  364. * @paddr_aligned: Aligned physical address.
  365. * @align: Base address alignment.
  366. * @func: Function name of the call site.
  367. * @line: Line number of the call site.
  368. *
  369. * Return: pointer of allocated memory or null if memory alloc fails.
  370. */
  371. #define qdf_aligned_mem_alloc_consistent(osdev, size, vaddr_unaligned, \
  372. paddr_unaligned, paddr_aligned, \
  373. align) \
  374. qdf_aligned_mem_alloc_consistent_fl(osdev, size, vaddr_unaligned, \
  375. paddr_unaligned, paddr_aligned, \
  376. align, __func__, __LINE__)
  377. void *qdf_aligned_mem_alloc_consistent_fl(qdf_device_t osdev, uint32_t *size,
  378. void **vaddr_unaligned,
  379. qdf_dma_addr_t *paddr_unaligned,
  380. qdf_dma_addr_t *paddr_aligned,
  381. uint32_t align, const char *func,
  382. uint32_t line);
  383. #define qdf_mem_virt_to_phys(vaddr) virt_to_phys(vaddr)
  384. void qdf_mem_set_io(void *ptr, uint32_t num_bytes, uint32_t value);
  385. void qdf_mem_copy_toio(void *dst_addr, const void *src_addr,
  386. uint32_t num_bytes);
  387. /**
  388. * qdf_mem_set() - set (fill) memory with a specified byte value.
  389. * @ptr: Pointer to memory that will be set
  390. * @num_bytes: Number of bytes to be set
  391. * @value: Byte set in memory
  392. *
  393. * WARNING: parameter @num_bytes and @value are swapped comparing with
  394. * standard C function "memset", please ensure correct usage of this function!
  395. *
  396. * Return: None
  397. */
  398. void qdf_mem_set(void *ptr, uint32_t num_bytes, uint32_t value);
  399. /**
  400. * qdf_mem_zero() - zero out memory
  401. * @ptr: pointer to memory that will be set to zero
  402. * @num_bytes: number of bytes zero
  403. *
  404. * This function sets the memory location to all zeros, essentially clearing
  405. * the memory.
  406. *
  407. * Return: None
  408. */
  409. static inline void qdf_mem_zero(void *ptr, uint32_t num_bytes)
  410. {
  411. qdf_mem_set(ptr, num_bytes, 0);
  412. }
  413. /**
  414. * qdf_mem_copy() - copy memory
  415. * @dst_addr: Pointer to destination memory location (to copy to)
  416. * @src_addr: Pointer to source memory location (to copy from)
  417. * @num_bytes: Number of bytes to copy.
  418. *
  419. * Copy host memory from one location to another, similar to memcpy in
  420. * standard C. Note this function does not specifically handle overlapping
  421. * source and destination memory locations. Calling this function with
  422. * overlapping source and destination memory locations will result in
  423. * unpredictable results. Use qdf_mem_move() if the memory locations
  424. * for the source and destination are overlapping (or could be overlapping!)
  425. *
  426. * Return: none
  427. */
  428. void qdf_mem_copy(void *dst_addr, const void *src_addr, uint32_t num_bytes);
  429. /**
  430. * qdf_mem_move() - move memory
  431. * @dst_addr: pointer to destination memory location (to move to)
  432. * @src_addr: pointer to source memory location (to move from)
  433. * @num_bytes: number of bytes to move.
  434. *
  435. * Move host memory from one location to another, similar to memmove in
  436. * standard C. Note this function *does* handle overlapping
  437. * source and destination memory locations.
  438. * Return: None
  439. */
  440. void qdf_mem_move(void *dst_addr, const void *src_addr, uint32_t num_bytes);
  441. /**
  442. * qdf_mem_cmp() - memory compare
  443. * @left: pointer to one location in memory to compare
  444. * @right: pointer to second location in memory to compare
  445. * @size: the number of bytes to compare
  446. *
  447. * Function to compare two pieces of memory, similar to memcmp function
  448. * in standard C.
  449. *
  450. * Return:
  451. * 0 -- equal
  452. * < 0 -- *memory1 is less than *memory2
  453. * > 0 -- *memory1 is bigger than *memory2
  454. */
  455. int qdf_mem_cmp(const void *left, const void *right, size_t size);
  456. void qdf_ether_addr_copy(void *dst_addr, const void *src_addr);
  457. /**
  458. * qdf_mem_map_nbytes_single - Map memory for DMA
  459. * @osdev: pomter OS device context
  460. * @buf: pointer to memory to be dma mapped
  461. * @dir: DMA map direction
  462. * @nbytes: number of bytes to be mapped.
  463. * @phy_addr: ponter to recive physical address.
  464. *
  465. * Return: success/failure
  466. */
  467. static inline uint32_t qdf_mem_map_nbytes_single(qdf_device_t osdev, void *buf,
  468. qdf_dma_dir_t dir, int nbytes,
  469. qdf_dma_addr_t *phy_addr)
  470. {
  471. #if defined(HIF_PCI) || defined(HIF_IPCI)
  472. return __qdf_mem_map_nbytes_single(osdev, buf, dir, nbytes, phy_addr);
  473. #else
  474. return 0;
  475. #endif
  476. }
  477. static inline void qdf_mem_dma_cache_sync(qdf_device_t osdev,
  478. qdf_dma_addr_t buf,
  479. qdf_dma_dir_t dir,
  480. int nbytes)
  481. {
  482. __qdf_mem_dma_cache_sync(osdev, buf, dir, nbytes);
  483. }
  484. /**
  485. * qdf_mem_unmap_nbytes_single() - un_map memory for DMA
  486. * @osdev: pomter OS device context
  487. * @phy_addr: physical address of memory to be dma unmapped
  488. * @dir: DMA unmap direction
  489. * @nbytes: number of bytes to be unmapped.
  490. *
  491. * Return: none
  492. */
  493. static inline void qdf_mem_unmap_nbytes_single(qdf_device_t osdev,
  494. qdf_dma_addr_t phy_addr,
  495. qdf_dma_dir_t dir,
  496. int nbytes)
  497. {
  498. #if defined(HIF_PCI) || defined(HIF_IPCI)
  499. __qdf_mem_unmap_nbytes_single(osdev, phy_addr, dir, nbytes);
  500. #endif
  501. }
  502. /**
  503. * qdf_mempool_init - Create and initialize memory pool
  504. * @osdev: platform device object
  505. * @pool_addr: address of the pool created
  506. * @elem_cnt: no. of elements in pool
  507. * @elem_size: size of each pool element in bytes
  508. * @flags: flags
  509. * Return: Handle to memory pool or NULL if allocation failed
  510. */
  511. static inline int qdf_mempool_init(qdf_device_t osdev,
  512. qdf_mempool_t *pool_addr, int elem_cnt,
  513. size_t elem_size, uint32_t flags)
  514. {
  515. return __qdf_mempool_init(osdev, pool_addr, elem_cnt, elem_size,
  516. flags);
  517. }
  518. /**
  519. * qdf_mempool_destroy - Destroy memory pool
  520. * @osdev: platform device object
  521. * @Handle: to memory pool
  522. * Return: none
  523. */
  524. static inline void qdf_mempool_destroy(qdf_device_t osdev, qdf_mempool_t pool)
  525. {
  526. __qdf_mempool_destroy(osdev, pool);
  527. }
  528. /**
  529. * qdf_mempool_alloc - Allocate an element memory pool
  530. * @osdev: platform device object
  531. * @Handle: to memory pool
  532. * Return: Pointer to the allocated element or NULL if the pool is empty
  533. */
  534. static inline void *qdf_mempool_alloc(qdf_device_t osdev, qdf_mempool_t pool)
  535. {
  536. return (void *)__qdf_mempool_alloc(osdev, pool);
  537. }
  538. /**
  539. * qdf_mempool_free - Free a memory pool element
  540. * @osdev: Platform device object
  541. * @pool: Handle to memory pool
  542. * @buf: Element to be freed
  543. * Return: none
  544. */
  545. static inline void qdf_mempool_free(qdf_device_t osdev, qdf_mempool_t pool,
  546. void *buf)
  547. {
  548. __qdf_mempool_free(osdev, pool, buf);
  549. }
  550. void qdf_mem_dma_sync_single_for_device(qdf_device_t osdev,
  551. qdf_dma_addr_t bus_addr,
  552. qdf_size_t size,
  553. __dma_data_direction direction);
  554. void qdf_mem_dma_sync_single_for_cpu(qdf_device_t osdev,
  555. qdf_dma_addr_t bus_addr,
  556. qdf_size_t size,
  557. __dma_data_direction direction);
  558. int qdf_mem_multi_page_link(qdf_device_t osdev,
  559. struct qdf_mem_multi_page_t *pages,
  560. uint32_t elem_size, uint32_t elem_count, uint8_t cacheable);
  561. /**
  562. * qdf_mem_kmalloc_inc() - increment kmalloc allocated bytes count
  563. * @size: number of bytes to increment by
  564. *
  565. * Return: None
  566. */
  567. void qdf_mem_kmalloc_inc(qdf_size_t size);
  568. /**
  569. * qdf_mem_kmalloc_dec() - decrement kmalloc allocated bytes count
  570. * @size: number of bytes to decrement by
  571. *
  572. * Return: None
  573. */
  574. void qdf_mem_kmalloc_dec(qdf_size_t size);
  575. #ifdef CONFIG_WLAN_SYSFS_MEM_STATS
  576. /**
  577. * qdf_mem_skb_inc() - increment total skb allocation size
  578. * @size: size to be added
  579. *
  580. * Return: none
  581. */
  582. void qdf_mem_skb_inc(qdf_size_t size);
  583. /**
  584. * qdf_mem_skb_dec() - decrement total skb allocation size
  585. * @size: size to be decremented
  586. *
  587. * Return: none
  588. */
  589. void qdf_mem_skb_dec(qdf_size_t size);
  590. /**
  591. * qdf_mem_skb_total_inc() - increment total skb allocation size
  592. * in host driver in both debug and perf builds
  593. * @size: size to be added
  594. *
  595. * Return: none
  596. */
  597. void qdf_mem_skb_total_inc(qdf_size_t size);
  598. /**
  599. * qdf_mem_skb_total_dec() - decrement total skb allocation size
  600. * in the host driver in debug and perf flavors
  601. * @size: size to be decremented
  602. *
  603. * Return: none
  604. */
  605. void qdf_mem_skb_total_dec(qdf_size_t size);
  606. /**
  607. * qdf_mem_dp_tx_skb_inc() - Increment Tx skb allocation size
  608. * @size: size to be added
  609. *
  610. * Return: none
  611. */
  612. void qdf_mem_dp_tx_skb_inc(qdf_size_t size);
  613. /**
  614. * qdf_mem_dp_tx_skb_dec() - Decrement Tx skb allocation size
  615. * @size: size to be decreased
  616. *
  617. * Return: none
  618. */
  619. void qdf_mem_dp_tx_skb_dec(qdf_size_t size);
  620. /**
  621. * qdf_mem_dp_rx_skb_inc() - Increment Rx skb allocation size
  622. * @size: size to be added
  623. *
  624. * Return: none
  625. */
  626. void qdf_mem_dp_rx_skb_inc(qdf_size_t size);
  627. /**
  628. * qdf_mem_dp_rx_skb_dec() - Decrement Rx skb allocation size
  629. * @size: size to be decreased
  630. *
  631. * Return: none
  632. */
  633. void qdf_mem_dp_rx_skb_dec(qdf_size_t size);
  634. /**
  635. * qdf_mem_dp_tx_skb_cnt_inc() - Increment Tx buffer count
  636. *
  637. * Return: none
  638. */
  639. void qdf_mem_dp_tx_skb_cnt_inc(void);
  640. /**
  641. * qdf_mem_dp_tx_skb_cnt_dec() - Decrement Tx buffer count
  642. *
  643. * Return: none
  644. */
  645. void qdf_mem_dp_tx_skb_cnt_dec(void);
  646. /**
  647. * qdf_mem_dp_rx_skb_cnt_inc() - Increment Rx buffer count
  648. *
  649. * Return: none
  650. */
  651. void qdf_mem_dp_rx_skb_cnt_inc(void);
  652. /**
  653. * qdf_mem_dp_rx_skb_cnt_dec() - Decrement Rx buffer count
  654. *
  655. * Return: none
  656. */
  657. void qdf_mem_dp_rx_skb_cnt_dec(void);
  658. #else
  659. static inline void qdf_mem_skb_inc(qdf_size_t size)
  660. {
  661. }
  662. static inline void qdf_mem_skb_dec(qdf_size_t size)
  663. {
  664. }
  665. static inline void qdf_mem_skb_total_inc(qdf_size_t size)
  666. {
  667. }
  668. static inline void qdf_mem_skb_total_dec(qdf_size_t size)
  669. {
  670. }
  671. static inline void qdf_mem_dp_tx_skb_inc(qdf_size_t size)
  672. {
  673. }
  674. static inline void qdf_mem_dp_tx_skb_dec(qdf_size_t size)
  675. {
  676. }
  677. static inline void qdf_mem_dp_rx_skb_inc(qdf_size_t size)
  678. {
  679. }
  680. static inline void qdf_mem_dp_rx_skb_dec(qdf_size_t size)
  681. {
  682. }
  683. static inline void qdf_mem_dp_tx_skb_cnt_inc(void)
  684. {
  685. }
  686. static inline void qdf_mem_dp_tx_skb_cnt_dec(void)
  687. {
  688. }
  689. static inline void qdf_mem_dp_rx_skb_cnt_inc(void)
  690. {
  691. }
  692. static inline void qdf_mem_dp_rx_skb_cnt_dec(void)
  693. {
  694. }
  695. #endif /* CONFIG_WLAN_SYSFS_MEM_STATS */
  696. /**
  697. * qdf_mem_map_table_alloc() - Allocate shared memory info structure
  698. * @num: number of required storage
  699. *
  700. * Allocate mapping table for DMA memory allocation. This is needed for
  701. * IPA-WLAN buffer sharing when SMMU Stage1 Translation is enabled.
  702. *
  703. * Return: shared memory info storage table pointer
  704. */
  705. static inline qdf_mem_info_t *qdf_mem_map_table_alloc(uint32_t num)
  706. {
  707. qdf_mem_info_t *mem_info_arr;
  708. mem_info_arr = qdf_mem_malloc(num * sizeof(mem_info_arr[0]));
  709. return mem_info_arr;
  710. }
  711. #ifdef ENHANCED_OS_ABSTRACTION
  712. /**
  713. * qdf_update_mem_map_table() - Update DMA memory map info
  714. * @osdev: Parent device instance
  715. * @mem_info: Pointer to shared memory information
  716. * @dma_addr: dma address
  717. * @mem_size: memory size allocated
  718. *
  719. * Store DMA shared memory information
  720. *
  721. * Return: none
  722. */
  723. void qdf_update_mem_map_table(qdf_device_t osdev,
  724. qdf_mem_info_t *mem_info,
  725. qdf_dma_addr_t dma_addr,
  726. uint32_t mem_size);
  727. /**
  728. * qdf_mem_paddr_from_dmaaddr() - get actual physical address from dma address
  729. * @osdev: Parent device instance
  730. * @dma_addr: DMA/IOVA address
  731. *
  732. * Get actual physical address from dma_addr based on SMMU enablement status.
  733. * IF SMMU Stage 1 tranlation is enabled, DMA APIs return IO virtual address
  734. * (IOVA) otherwise returns physical address. So get SMMU physical address
  735. * mapping from IOVA.
  736. *
  737. * Return: dmaable physical address
  738. */
  739. qdf_dma_addr_t qdf_mem_paddr_from_dmaaddr(qdf_device_t osdev,
  740. qdf_dma_addr_t dma_addr);
  741. #else
  742. static inline
  743. void qdf_update_mem_map_table(qdf_device_t osdev,
  744. qdf_mem_info_t *mem_info,
  745. qdf_dma_addr_t dma_addr,
  746. uint32_t mem_size)
  747. {
  748. if (!mem_info) {
  749. qdf_nofl_err("%s: NULL mem_info", __func__);
  750. return;
  751. }
  752. __qdf_update_mem_map_table(osdev, mem_info, dma_addr, mem_size);
  753. }
  754. static inline
  755. qdf_dma_addr_t qdf_mem_paddr_from_dmaaddr(qdf_device_t osdev,
  756. qdf_dma_addr_t dma_addr)
  757. {
  758. return __qdf_mem_paddr_from_dmaaddr(osdev, dma_addr);
  759. }
  760. #endif
  761. /**
  762. * qdf_mem_smmu_s1_enabled() - Return SMMU stage 1 translation enable status
  763. * @osdev parent device instance
  764. *
  765. * Return: true if smmu s1 enabled, false if smmu s1 is bypassed
  766. */
  767. static inline bool qdf_mem_smmu_s1_enabled(qdf_device_t osdev)
  768. {
  769. return __qdf_mem_smmu_s1_enabled(osdev);
  770. }
  771. /**
  772. * qdf_mem_dma_get_sgtable() - Returns DMA memory scatter gather table
  773. * @dev: device instace
  774. * @sgt: scatter gather table pointer
  775. * @cpu_addr: HLOS virtual address
  776. * @dma_addr: dma address
  777. * @size: allocated memory size
  778. *
  779. * Return: physical address
  780. */
  781. static inline int
  782. qdf_mem_dma_get_sgtable(struct device *dev, void *sgt, void *cpu_addr,
  783. qdf_dma_addr_t dma_addr, size_t size)
  784. {
  785. return __qdf_os_mem_dma_get_sgtable(dev, sgt, cpu_addr, dma_addr, size);
  786. }
  787. /**
  788. * qdf_mem_free_sgtable() - Free a previously allocated sg table
  789. * @sgt: the mapped sg table header
  790. *
  791. * Return: None
  792. */
  793. static inline void
  794. qdf_mem_free_sgtable(struct sg_table *sgt)
  795. {
  796. __qdf_os_mem_free_sgtable(sgt);
  797. }
  798. /**
  799. * qdf_dma_get_sgtable_dma_addr() - Assigns DMA address to scatterlist elements
  800. * @sgt: scatter gather table pointer
  801. *
  802. * Return: None
  803. */
  804. static inline void
  805. qdf_dma_get_sgtable_dma_addr(struct sg_table *sgt)
  806. {
  807. __qdf_dma_get_sgtable_dma_addr(sgt);
  808. }
  809. /**
  810. * qdf_mem_get_dma_addr() - Return dma address based on SMMU translation status.
  811. * @osdev: Parent device instance
  812. * @mem_info: Pointer to allocated memory information
  813. *
  814. * Get dma address based on SMMU enablement status. If SMMU Stage 1
  815. * tranlation is enabled, DMA APIs return IO virtual address otherwise
  816. * returns physical address.
  817. *
  818. * Return: dma address
  819. */
  820. static inline qdf_dma_addr_t qdf_mem_get_dma_addr(qdf_device_t osdev,
  821. qdf_mem_info_t *mem_info)
  822. {
  823. return __qdf_mem_get_dma_addr(osdev, mem_info);
  824. }
  825. /**
  826. * qdf_mem_get_dma_addr_ptr() - Return DMA address pointer from mem info struct
  827. * @osdev: Parent device instance
  828. * @mem_info: Pointer to allocated memory information
  829. *
  830. * Based on smmu stage 1 translation enablement, return corresponding dma
  831. * address storage pointer.
  832. *
  833. * Return: dma address storage pointer
  834. */
  835. static inline qdf_dma_addr_t *qdf_mem_get_dma_addr_ptr(qdf_device_t osdev,
  836. qdf_mem_info_t *mem_info)
  837. {
  838. return __qdf_mem_get_dma_addr_ptr(osdev, mem_info);
  839. }
  840. /**
  841. * qdf_mem_get_dma_size() - Return DMA memory size
  842. * @osdev: parent device instance
  843. * @mem_info: Pointer to allocated memory information
  844. *
  845. * Return: DMA memory size
  846. */
  847. static inline uint32_t
  848. qdf_mem_get_dma_size(qdf_device_t osdev,
  849. qdf_mem_info_t *mem_info)
  850. {
  851. return __qdf_mem_get_dma_size(osdev, mem_info);
  852. }
  853. /**
  854. * qdf_mem_set_dma_size() - Set DMA memory size
  855. * @osdev: parent device instance
  856. * @mem_info: Pointer to allocated memory information
  857. * @mem_size: memory size allocated
  858. *
  859. * Return: none
  860. */
  861. static inline void
  862. qdf_mem_set_dma_size(qdf_device_t osdev,
  863. qdf_mem_info_t *mem_info,
  864. uint32_t mem_size)
  865. {
  866. __qdf_mem_set_dma_size(osdev, mem_info, mem_size);
  867. }
  868. /**
  869. * qdf_mem_get_dma_size() - Return DMA physical address
  870. * @osdev: parent device instance
  871. * @mem_info: Pointer to allocated memory information
  872. *
  873. * Return: DMA physical address
  874. */
  875. static inline qdf_dma_addr_t
  876. qdf_mem_get_dma_pa(qdf_device_t osdev,
  877. qdf_mem_info_t *mem_info)
  878. {
  879. return __qdf_mem_get_dma_pa(osdev, mem_info);
  880. }
  881. /**
  882. * qdf_mem_set_dma_size() - Set DMA physical address
  883. * @osdev: parent device instance
  884. * @mem_info: Pointer to allocated memory information
  885. * @dma_pa: DMA phsical address
  886. *
  887. * Return: none
  888. */
  889. static inline void
  890. qdf_mem_set_dma_pa(qdf_device_t osdev,
  891. qdf_mem_info_t *mem_info,
  892. qdf_dma_addr_t dma_pa)
  893. {
  894. __qdf_mem_set_dma_pa(osdev, mem_info, dma_pa);
  895. }
  896. /**
  897. * qdf_mem_shared_mem_alloc() - Allocate DMA memory for shared resource
  898. * @osdev: parent device instance
  899. * @mem_info: Pointer to allocated memory information
  900. * @size: size to be allocated
  901. *
  902. * Allocate DMA memory which will be shared with external kernel module. This
  903. * information is needed for SMMU mapping.
  904. *
  905. * Return: 0 success
  906. */
  907. qdf_shared_mem_t *qdf_mem_shared_mem_alloc(qdf_device_t osdev, uint32_t size);
  908. /**
  909. * qdf_mem_shared_mem_free() - Free shared memory
  910. * @osdev: parent device instance
  911. * @shared_mem: shared memory information storage
  912. *
  913. * Free DMA shared memory resource
  914. *
  915. * Return: None
  916. */
  917. static inline void qdf_mem_shared_mem_free(qdf_device_t osdev,
  918. qdf_shared_mem_t *shared_mem)
  919. {
  920. if (!shared_mem) {
  921. qdf_nofl_err("%s: NULL shared mem struct passed",
  922. __func__);
  923. return;
  924. }
  925. if (shared_mem->vaddr) {
  926. qdf_mem_free_consistent(osdev, osdev->dev,
  927. qdf_mem_get_dma_size(osdev,
  928. &shared_mem->mem_info),
  929. shared_mem->vaddr,
  930. qdf_mem_get_dma_addr(osdev,
  931. &shared_mem->mem_info),
  932. qdf_get_dma_mem_context(shared_mem,
  933. memctx));
  934. }
  935. qdf_mem_free_sgtable(&shared_mem->sgtable);
  936. qdf_mem_free(shared_mem);
  937. }
  938. /**
  939. * qdf_dma_mem_stats_read() - Return the DMA memory allocated in
  940. * host driver
  941. *
  942. * Return: Total DMA memory allocated
  943. */
  944. int32_t qdf_dma_mem_stats_read(void);
  945. /**
  946. * qdf_heap_mem_stats_read() - Return the heap memory allocated
  947. * in host driver
  948. *
  949. * Return: Total heap memory allocated
  950. */
  951. int32_t qdf_heap_mem_stats_read(void);
  952. /**
  953. * qdf_skb_mem_stats_read() - Return the SKB memory allocated in
  954. * host driver
  955. *
  956. * Return: Total SKB memory allocated
  957. */
  958. int32_t qdf_skb_mem_stats_read(void);
  959. /**
  960. * qdf_skb_total_mem_stats_read() - Return the SKB memory allocated
  961. * in the host driver tracked in both debug and perf builds
  962. *
  963. * Return: Total SKB memory allocated
  964. */
  965. int32_t qdf_skb_total_mem_stats_read(void);
  966. /**
  967. * qdf_skb_max_mem_stats_read() - Return the max SKB memory
  968. * allocated in host driver. This is the high watermark for the
  969. * total SKB allocated in the host driver
  970. *
  971. * Return: None
  972. */
  973. int32_t qdf_skb_max_mem_stats_read(void);
  974. /**
  975. * qdf_mem_tx_desc_cnt_read() - Return the outstanding Tx descs
  976. * which are waiting on Tx completions
  977. *
  978. * Return: Outstanding Tx desc count
  979. */
  980. int32_t qdf_mem_tx_desc_cnt_read(void);
  981. /**
  982. * qdf_mem_tx_desc_max_read() - Return the max outstanding Tx
  983. * descs which are waiting on Tx completions. This is the high
  984. * watermark for the pending desc count
  985. *
  986. * Return: Max outstanding Tx desc count
  987. */
  988. int32_t qdf_mem_tx_desc_max_read(void);
  989. /**
  990. * qdf_mem_stats_init() - Initialize the qdf memstats fields on
  991. * creating the sysfs node
  992. *
  993. * Return: None
  994. */
  995. void qdf_mem_stats_init(void);
  996. /**
  997. * qdf_dp_tx_skb_mem_stats_read() - Return the SKB memory
  998. * allocated for Tx data path
  999. *
  1000. * Return: Tx SKB memory allocated
  1001. */
  1002. int32_t qdf_dp_tx_skb_mem_stats_read(void);
  1003. /**
  1004. * qdf_dp_rx_skb_mem_stats_read() - Return the SKB memory
  1005. * allocated for Rx data path
  1006. *
  1007. * Return: Rx SKB memory allocated
  1008. */
  1009. int32_t qdf_dp_rx_skb_mem_stats_read(void);
  1010. /**
  1011. * qdf_dp_tx_skb_max_mem_stats_read() - Return the high
  1012. * watermark for the SKB memory allocated for Tx data path
  1013. *
  1014. * Return: Max Tx SKB memory allocated
  1015. */
  1016. int32_t qdf_dp_tx_skb_max_mem_stats_read(void);
  1017. /**
  1018. * qdf_dp_rx_skb_max_mem_stats_read() - Return the high
  1019. * watermark for the SKB memory allocated for Rx data path
  1020. *
  1021. * Return: Max Rx SKB memory allocated
  1022. */
  1023. int32_t qdf_dp_rx_skb_max_mem_stats_read(void);
  1024. /**
  1025. * qdf_mem_dp_tx_skb_cnt_read() - Return number of buffers
  1026. * allocated in the Tx data path by the host driver or
  1027. * buffers coming from the n/w stack
  1028. *
  1029. * Return: Number of DP Tx buffers allocated
  1030. */
  1031. int32_t qdf_mem_dp_tx_skb_cnt_read(void);
  1032. /**
  1033. * qdf_mem_dp_tx_skb_max_cnt_read() - Return max number of
  1034. * buffers allocated in the Tx data path
  1035. *
  1036. * Return: Max number of DP Tx buffers allocated
  1037. */
  1038. int32_t qdf_mem_dp_tx_skb_max_cnt_read(void);
  1039. /**
  1040. * qdf_mem_dp_rx_skb_cnt_read() - Return number of buffers
  1041. * allocated in the Rx data path
  1042. *
  1043. * Return: Number of DP Rx buffers allocated
  1044. */
  1045. int32_t qdf_mem_dp_rx_skb_cnt_read(void);
  1046. /**
  1047. * qdf_mem_dp_rx_skb_max_cnt_read() - Return max number of
  1048. * buffers allocated in the Rx data path
  1049. *
  1050. * Return: Max number of DP Rx buffers allocated
  1051. */
  1052. int32_t qdf_mem_dp_rx_skb_max_cnt_read(void);
  1053. /**
  1054. * qdf_mem_tx_desc_cnt_update() - Update the pending tx desc
  1055. * count and the high watermark for pending tx desc count
  1056. *
  1057. * @pending_tx_descs: outstanding Tx desc count
  1058. * @tx_descs_max: high watermark for outstanding Tx desc count
  1059. *
  1060. * Return: None
  1061. */
  1062. void qdf_mem_tx_desc_cnt_update(qdf_atomic_t pending_tx_descs,
  1063. int32_t tx_descs_max);
  1064. /**
  1065. * qdf_mem_vfree() - Free the virtual memory pointed to by ptr
  1066. * @ptr: Pointer to the starting address of the memory to
  1067. * be freed.
  1068. *
  1069. * Return: None
  1070. */
  1071. #define qdf_mem_vfree(ptr) __qdf_mem_vfree(ptr)
  1072. /**
  1073. * qdf_mem_valloc() - Allocate virtual memory for the given
  1074. * size
  1075. * @size: Number of bytes of memory to be allocated
  1076. *
  1077. * Return: Pointer to the starting address of the allocated virtual memory
  1078. */
  1079. #define qdf_mem_valloc(size) __qdf_mem_valloc(size, __func__, __LINE__)
  1080. #if IS_ENABLED(CONFIG_ARM_SMMU) && defined(ENABLE_SMMU_S1_TRANSLATION)
  1081. /*
  1082. * typedef qdf_iommu_domain_t: Platform indepedent iommu domain
  1083. * abstraction
  1084. */
  1085. typedef __qdf_iommu_domain_t qdf_iommu_domain_t;
  1086. /**
  1087. * qdf_iommu_domain_get_attr() - API to get iommu domain attributes
  1088. * @domain: iommu domain
  1089. * @attr: iommu attribute
  1090. * @data: data pointer
  1091. *
  1092. * Return: 0 on success, else errno
  1093. */
  1094. int
  1095. qdf_iommu_domain_get_attr(qdf_iommu_domain_t *domain,
  1096. enum qdf_iommu_attr attr, void *data);
  1097. #endif
  1098. #endif /* __QDF_MEMORY_H */