hal_api.h 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167
  1. /*
  2. * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. #ifndef _HAL_API_H_
  19. #define _HAL_API_H_
  20. #include "qdf_types.h"
  21. #include "qdf_util.h"
  22. #include "hal_internal.h"
  23. #define MAX_UNWINDOWED_ADDRESS 0x80000
  24. #ifdef QCA_WIFI_QCA6390
  25. #define WINDOW_ENABLE_BIT 0x40000000
  26. #else
  27. #define WINDOW_ENABLE_BIT 0x80000000
  28. #endif
  29. #define WINDOW_REG_ADDRESS 0x310C
  30. #define WINDOW_SHIFT 19
  31. #define WINDOW_VALUE_MASK 0x3F
  32. #define WINDOW_START MAX_UNWINDOWED_ADDRESS
  33. #define WINDOW_RANGE_MASK 0x7FFFF
  34. static inline void hal_select_window(struct hal_soc *hal_soc, uint32_t offset)
  35. {
  36. uint32_t window = (offset >> WINDOW_SHIFT) & WINDOW_VALUE_MASK;
  37. if (window != hal_soc->register_window) {
  38. qdf_iowrite32(hal_soc->dev_base_addr + WINDOW_REG_ADDRESS,
  39. WINDOW_ENABLE_BIT | window);
  40. hal_soc->register_window = window;
  41. }
  42. }
  43. /**
  44. * note1: WINDOW_RANGE_MASK = (1 << WINDOW_SHIFT) -1
  45. * note2: 1 << WINDOW_SHIFT = MAX_UNWINDOWED_ADDRESS
  46. * note3: WINDOW_VALUE_MASK = big enough that trying to write past that window
  47. * would be a bug
  48. */
  49. static inline void hal_write32_mb(struct hal_soc *hal_soc, uint32_t offset,
  50. uint32_t value)
  51. {
  52. if (!hal_soc->use_register_windowing ||
  53. offset < MAX_UNWINDOWED_ADDRESS) {
  54. qdf_iowrite32(hal_soc->dev_base_addr + offset, value);
  55. } else {
  56. qdf_spin_lock_irqsave(&hal_soc->register_access_lock);
  57. hal_select_window(hal_soc, offset);
  58. qdf_iowrite32(hal_soc->dev_base_addr + WINDOW_START +
  59. (offset & WINDOW_RANGE_MASK), value);
  60. qdf_spin_unlock_irqrestore(&hal_soc->register_access_lock);
  61. }
  62. }
  63. /**
  64. * hal_write_address_32_mb - write a value to a register
  65. *
  66. */
  67. static inline void hal_write_address_32_mb(struct hal_soc *hal_soc,
  68. void __iomem *addr, uint32_t value)
  69. {
  70. uint32_t offset;
  71. if (!hal_soc->use_register_windowing)
  72. return qdf_iowrite32(addr, value);
  73. offset = addr - hal_soc->dev_base_addr;
  74. hal_write32_mb(hal_soc, offset, value);
  75. }
  76. static inline uint32_t hal_read32_mb(struct hal_soc *hal_soc, uint32_t offset)
  77. {
  78. uint32_t ret;
  79. if (!hal_soc->use_register_windowing ||
  80. offset < MAX_UNWINDOWED_ADDRESS) {
  81. return qdf_ioread32(hal_soc->dev_base_addr + offset);
  82. }
  83. qdf_spin_lock_irqsave(&hal_soc->register_access_lock);
  84. hal_select_window(hal_soc, offset);
  85. ret = qdf_ioread32(hal_soc->dev_base_addr + WINDOW_START +
  86. (offset & WINDOW_RANGE_MASK));
  87. qdf_spin_unlock_irqrestore(&hal_soc->register_access_lock);
  88. return ret;
  89. }
  90. #include "hif_io32.h"
  91. /**
  92. * hal_attach - Initialize HAL layer
  93. * @hif_handle: Opaque HIF handle
  94. * @qdf_dev: QDF device
  95. *
  96. * Return: Opaque HAL SOC handle
  97. * NULL on failure (if given ring is not available)
  98. *
  99. * This function should be called as part of HIF initialization (for accessing
  100. * copy engines). DP layer will get hal_soc handle using hif_get_hal_handle()
  101. */
  102. extern void *hal_attach(void *hif_handle, qdf_device_t qdf_dev);
  103. /**
  104. * hal_detach - Detach HAL layer
  105. * @hal_soc: HAL SOC handle
  106. *
  107. * This function should be called as part of HIF detach
  108. *
  109. */
  110. extern void hal_detach(void *hal_soc);
  111. /* SRNG type to be passed in APIs hal_srng_get_entrysize and hal_srng_setup */
  112. enum hal_ring_type {
  113. REO_DST,
  114. REO_EXCEPTION,
  115. REO_REINJECT,
  116. REO_CMD,
  117. REO_STATUS,
  118. TCL_DATA,
  119. TCL_CMD,
  120. TCL_STATUS,
  121. CE_SRC,
  122. CE_DST,
  123. CE_DST_STATUS,
  124. WBM_IDLE_LINK,
  125. SW2WBM_RELEASE,
  126. WBM2SW_RELEASE,
  127. RXDMA_BUF,
  128. RXDMA_DST,
  129. RXDMA_MONITOR_BUF,
  130. RXDMA_MONITOR_STATUS,
  131. RXDMA_MONITOR_DST,
  132. RXDMA_MONITOR_DESC,
  133. DIR_BUF_RX_DMA_SRC,
  134. #ifdef WLAN_FEATURE_CIF_CFR
  135. WIFI_POS_SRC,
  136. #endif
  137. MAX_RING_TYPES
  138. };
  139. #define HAL_SRNG_LMAC_RING 0x80000000
  140. /* SRNG flags passed in hal_srng_params.flags */
  141. #define HAL_SRNG_MSI_SWAP 0x00000008
  142. #define HAL_SRNG_RING_PTR_SWAP 0x00000010
  143. #define HAL_SRNG_DATA_TLV_SWAP 0x00000020
  144. #define HAL_SRNG_LOW_THRES_INTR_ENABLE 0x00010000
  145. #define HAL_SRNG_MSI_INTR 0x00020000
  146. #define PN_SIZE_24 0
  147. #define PN_SIZE_48 1
  148. #define PN_SIZE_128 2
  149. /**
  150. * hal_srng_get_entrysize - Returns size of ring entry in bytes. Should be
  151. * used by callers for calculating the size of memory to be allocated before
  152. * calling hal_srng_setup to setup the ring
  153. *
  154. * @hal_soc: Opaque HAL SOC handle
  155. * @ring_type: one of the types from hal_ring_type
  156. *
  157. */
  158. extern uint32_t hal_srng_get_entrysize(void *hal_soc, int ring_type);
  159. /**
  160. * hal_srng_max_entries - Returns maximum possible number of ring entries
  161. * @hal_soc: Opaque HAL SOC handle
  162. * @ring_type: one of the types from hal_ring_type
  163. *
  164. * Return: Maximum number of entries for the given ring_type
  165. */
  166. uint32_t hal_srng_max_entries(void *hal_soc, int ring_type);
  167. /**
  168. * hal_srng_dump - Dump ring status
  169. * @srng: hal srng pointer
  170. */
  171. void hal_srng_dump(struct hal_srng *srng);
  172. /**
  173. * hal_srng_get_dir - Returns the direction of the ring
  174. * @hal_soc: Opaque HAL SOC handle
  175. * @ring_type: one of the types from hal_ring_type
  176. *
  177. * Return: Ring direction
  178. */
  179. enum hal_srng_dir hal_srng_get_dir(void *hal_soc, int ring_type);
  180. /* HAL memory information */
  181. struct hal_mem_info {
  182. /* dev base virutal addr */
  183. void *dev_base_addr;
  184. /* dev base physical addr */
  185. void *dev_base_paddr;
  186. /* Remote virtual pointer memory for HW/FW updates */
  187. void *shadow_rdptr_mem_vaddr;
  188. /* Remote physical pointer memory for HW/FW updates */
  189. void *shadow_rdptr_mem_paddr;
  190. /* Shared memory for ring pointer updates from host to FW */
  191. void *shadow_wrptr_mem_vaddr;
  192. /* Shared physical memory for ring pointer updates from host to FW */
  193. void *shadow_wrptr_mem_paddr;
  194. };
  195. /* SRNG parameters to be passed to hal_srng_setup */
  196. struct hal_srng_params {
  197. /* Physical base address of the ring */
  198. qdf_dma_addr_t ring_base_paddr;
  199. /* Virtual base address of the ring */
  200. void *ring_base_vaddr;
  201. /* Number of entries in ring */
  202. uint32_t num_entries;
  203. /* max transfer length */
  204. uint16_t max_buffer_length;
  205. /* MSI Address */
  206. qdf_dma_addr_t msi_addr;
  207. /* MSI data */
  208. uint32_t msi_data;
  209. /* Interrupt timer threshold – in micro seconds */
  210. uint32_t intr_timer_thres_us;
  211. /* Interrupt batch counter threshold – in number of ring entries */
  212. uint32_t intr_batch_cntr_thres_entries;
  213. /* Low threshold – in number of ring entries
  214. * (valid for src rings only)
  215. */
  216. uint32_t low_threshold;
  217. /* Misc flags */
  218. uint32_t flags;
  219. /* Unique ring id */
  220. uint8_t ring_id;
  221. /* Source or Destination ring */
  222. enum hal_srng_dir ring_dir;
  223. /* Size of ring entry */
  224. uint32_t entry_size;
  225. /* hw register base address */
  226. void *hwreg_base[MAX_SRNG_REG_GROUPS];
  227. };
  228. /* hal_construct_shadow_config() - initialize the shadow registers for dp rings
  229. * @hal_soc: hal handle
  230. *
  231. * Return: QDF_STATUS_OK on success
  232. */
  233. extern QDF_STATUS hal_construct_shadow_config(void *hal_soc);
  234. /* hal_set_one_shadow_config() - add a config for the specified ring
  235. * @hal_soc: hal handle
  236. * @ring_type: ring type
  237. * @ring_num: ring num
  238. *
  239. * The ring type and ring num uniquely specify the ring. After this call,
  240. * the hp/tp will be added as the next entry int the shadow register
  241. * configuration table. The hal code will use the shadow register address
  242. * in place of the hp/tp address.
  243. *
  244. * This function is exposed, so that the CE module can skip configuring shadow
  245. * registers for unused ring and rings assigned to the firmware.
  246. *
  247. * Return: QDF_STATUS_OK on success
  248. */
  249. extern QDF_STATUS hal_set_one_shadow_config(void *hal_soc, int ring_type,
  250. int ring_num);
  251. /**
  252. * hal_get_shadow_config() - retrieve the config table
  253. * @hal_soc: hal handle
  254. * @shadow_config: will point to the table after
  255. * @num_shadow_registers_configured: will contain the number of valid entries
  256. */
  257. extern void hal_get_shadow_config(void *hal_soc,
  258. struct pld_shadow_reg_v2_cfg **shadow_config,
  259. int *num_shadow_registers_configured);
  260. /**
  261. * hal_srng_setup - Initialize HW SRNG ring.
  262. *
  263. * @hal_soc: Opaque HAL SOC handle
  264. * @ring_type: one of the types from hal_ring_type
  265. * @ring_num: Ring number if there are multiple rings of
  266. * same type (staring from 0)
  267. * @mac_id: valid MAC Id should be passed if ring type is one of lmac rings
  268. * @ring_params: SRNG ring params in hal_srng_params structure.
  269. * Callers are expected to allocate contiguous ring memory of size
  270. * 'num_entries * entry_size' bytes and pass the physical and virtual base
  271. * addresses through 'ring_base_paddr' and 'ring_base_vaddr' in hal_srng_params
  272. * structure. Ring base address should be 8 byte aligned and size of each ring
  273. * entry should be queried using the API hal_srng_get_entrysize
  274. *
  275. * Return: Opaque pointer to ring on success
  276. * NULL on failure (if given ring is not available)
  277. */
  278. extern void *hal_srng_setup(void *hal_soc, int ring_type, int ring_num,
  279. int mac_id, struct hal_srng_params *ring_params);
  280. /* Remapping ids of REO rings */
  281. #define REO_REMAP_TCL 0
  282. #define REO_REMAP_SW1 1
  283. #define REO_REMAP_SW2 2
  284. #define REO_REMAP_SW3 3
  285. #define REO_REMAP_SW4 4
  286. #define REO_REMAP_RELEASE 5
  287. #define REO_REMAP_FW 6
  288. #define REO_REMAP_UNUSED 7
  289. /*
  290. * currently this macro only works for IX0 since all the rings we are remapping
  291. * can be remapped from HWIO_REO_R0_DESTINATION_RING_CTRL_IX_0
  292. */
  293. #define HAL_REO_REMAP_VAL(_ORIGINAL_DEST, _NEW_DEST) \
  294. HAL_REO_REMAP_VAL_(_ORIGINAL_DEST, _NEW_DEST)
  295. /* allow the destination macros to be expanded */
  296. #define HAL_REO_REMAP_VAL_(_ORIGINAL_DEST, _NEW_DEST) \
  297. (_NEW_DEST << \
  298. (HWIO_REO_R0_DESTINATION_RING_CTRL_IX_0_DEST_RING_MAPPING_ ## \
  299. _ORIGINAL_DEST ## _SHFT))
  300. /**
  301. * hal_reo_remap_IX0 - Remap REO ring destination
  302. * @hal: HAL SOC handle
  303. * @remap_val: Remap value
  304. */
  305. extern void hal_reo_remap_IX0(struct hal_soc *hal, uint32_t remap_val);
  306. /**
  307. * hal_srng_set_hp_paddr() - Set physical address to dest SRNG head pointer
  308. * @sring: sring pointer
  309. * @paddr: physical address
  310. */
  311. extern void hal_srng_dst_set_hp_paddr(struct hal_srng *sring, uint64_t paddr);
  312. /**
  313. * hal_srng_dst_init_hp() - Initilaize head pointer with cached head pointer
  314. * @srng: sring pointer
  315. * @vaddr: virtual address
  316. */
  317. extern void hal_srng_dst_init_hp(struct hal_srng *srng, uint32_t *vaddr);
  318. /**
  319. * hal_srng_cleanup - Deinitialize HW SRNG ring.
  320. * @hal_soc: Opaque HAL SOC handle
  321. * @hal_srng: Opaque HAL SRNG pointer
  322. */
  323. extern void hal_srng_cleanup(void *hal_soc, void *hal_srng);
  324. static inline bool hal_srng_initialized(void *hal_ring)
  325. {
  326. struct hal_srng *srng = (struct hal_srng *)hal_ring;
  327. return !!srng->initialized;
  328. }
  329. /**
  330. * hal_srng_access_start_unlocked - Start ring access (unlocked). Should use
  331. * hal_srng_access_start if locked access is required
  332. *
  333. * @hal_soc: Opaque HAL SOC handle
  334. * @hal_ring: Ring pointer (Source or Destination ring)
  335. *
  336. * Return: 0 on success; error on failire
  337. */
  338. static inline int hal_srng_access_start_unlocked(void *hal_soc, void *hal_ring)
  339. {
  340. struct hal_srng *srng = (struct hal_srng *)hal_ring;
  341. if (srng->ring_dir == HAL_SRNG_SRC_RING)
  342. srng->u.src_ring.cached_tp =
  343. *(volatile uint32_t *)(srng->u.src_ring.tp_addr);
  344. else
  345. srng->u.dst_ring.cached_hp =
  346. *(volatile uint32_t *)(srng->u.dst_ring.hp_addr);
  347. return 0;
  348. }
  349. /**
  350. * hal_srng_access_start - Start (locked) ring access
  351. *
  352. * @hal_soc: Opaque HAL SOC handle
  353. * @hal_ring: Ring pointer (Source or Destination ring)
  354. *
  355. * Return: 0 on success; error on failire
  356. */
  357. static inline int hal_srng_access_start(void *hal_soc, void *hal_ring)
  358. {
  359. struct hal_srng *srng = (struct hal_srng *)hal_ring;
  360. SRNG_LOCK(&(srng->lock));
  361. return hal_srng_access_start_unlocked(hal_soc, hal_ring);
  362. }
  363. /**
  364. * hal_srng_dst_get_next - Get next entry from a destination ring and move
  365. * cached tail pointer
  366. *
  367. * @hal_soc: Opaque HAL SOC handle
  368. * @hal_ring: Destination ring pointer
  369. *
  370. * Return: Opaque pointer for next ring entry; NULL on failire
  371. */
  372. static inline void *hal_srng_dst_get_next(void *hal_soc, void *hal_ring)
  373. {
  374. struct hal_srng *srng = (struct hal_srng *)hal_ring;
  375. uint32_t *desc;
  376. if (srng->u.dst_ring.tp != srng->u.dst_ring.cached_hp) {
  377. desc = &(srng->ring_base_vaddr[srng->u.dst_ring.tp]);
  378. /* TODO: Using % is expensive, but we have to do this since
  379. * size of some SRNG rings is not power of 2 (due to descriptor
  380. * sizes). Need to create separate API for rings used
  381. * per-packet, with sizes power of 2 (TCL2SW, REO2SW,
  382. * SW2RXDMA and CE rings)
  383. */
  384. srng->u.dst_ring.tp = (srng->u.dst_ring.tp + srng->entry_size) %
  385. srng->ring_size;
  386. return (void *)desc;
  387. }
  388. return NULL;
  389. }
  390. /**
  391. * hal_srng_dst_get_next_hp - Get next entry from a destination ring and move
  392. * cached head pointer
  393. *
  394. * @hal_soc: Opaque HAL SOC handle
  395. * @hal_ring: Destination ring pointer
  396. *
  397. * Return: Opaque pointer for next ring entry; NULL on failire
  398. */
  399. static inline void *hal_srng_dst_get_next_hp(void *hal_soc, void *hal_ring)
  400. {
  401. struct hal_srng *srng = (struct hal_srng *)hal_ring;
  402. uint32_t *desc;
  403. /* TODO: Using % is expensive, but we have to do this since
  404. * size of some SRNG rings is not power of 2 (due to descriptor
  405. * sizes). Need to create separate API for rings used
  406. * per-packet, with sizes power of 2 (TCL2SW, REO2SW,
  407. * SW2RXDMA and CE rings)
  408. */
  409. uint32_t next_hp = (srng->u.dst_ring.cached_hp + srng->entry_size) %
  410. srng->ring_size;
  411. if (next_hp != srng->u.dst_ring.tp) {
  412. desc = &(srng->ring_base_vaddr[srng->u.dst_ring.cached_hp]);
  413. srng->u.dst_ring.cached_hp = next_hp;
  414. return (void *)desc;
  415. }
  416. return NULL;
  417. }
  418. /**
  419. * hal_srng_dst_peek - Get next entry from a ring without moving tail pointer.
  420. * hal_srng_dst_get_next should be called subsequently to move the tail pointer
  421. * TODO: See if we need an optimized version of get_next that doesn't check for
  422. * loop_cnt
  423. *
  424. * @hal_soc: Opaque HAL SOC handle
  425. * @hal_ring: Destination ring pointer
  426. *
  427. * Return: Opaque pointer for next ring entry; NULL on failire
  428. */
  429. static inline void *hal_srng_dst_peek(void *hal_soc, void *hal_ring)
  430. {
  431. struct hal_srng *srng = (struct hal_srng *)hal_ring;
  432. if (srng->u.dst_ring.tp != srng->u.dst_ring.cached_hp)
  433. return (void *)(&(srng->ring_base_vaddr[srng->u.dst_ring.tp]));
  434. return NULL;
  435. }
  436. /**
  437. * hal_srng_dst_num_valid - Returns number of valid entries (to be processed
  438. * by SW) in destination ring
  439. *
  440. * @hal_soc: Opaque HAL SOC handle
  441. * @hal_ring: Destination ring pointer
  442. * @sync_hw_ptr: Sync cached head pointer with HW
  443. *
  444. */
  445. static inline uint32_t hal_srng_dst_num_valid(void *hal_soc, void *hal_ring,
  446. int sync_hw_ptr)
  447. {
  448. struct hal_srng *srng = (struct hal_srng *)hal_ring;
  449. uint32_t hp;
  450. uint32_t tp = srng->u.dst_ring.tp;
  451. if (sync_hw_ptr) {
  452. hp = *(srng->u.dst_ring.hp_addr);
  453. srng->u.dst_ring.cached_hp = hp;
  454. } else {
  455. hp = srng->u.dst_ring.cached_hp;
  456. }
  457. if (hp >= tp)
  458. return (hp - tp) / srng->entry_size;
  459. else
  460. return (srng->ring_size - tp + hp) / srng->entry_size;
  461. }
  462. /**
  463. * hal_srng_src_reap_next - Reap next entry from a source ring and move reap
  464. * pointer. This can be used to release any buffers associated with completed
  465. * ring entries. Note that this should not be used for posting new descriptor
  466. * entries. Posting of new entries should be done only using
  467. * hal_srng_src_get_next_reaped when this function is used for reaping.
  468. *
  469. * @hal_soc: Opaque HAL SOC handle
  470. * @hal_ring: Source ring pointer
  471. *
  472. * Return: Opaque pointer for next ring entry; NULL on failire
  473. */
  474. static inline void *hal_srng_src_reap_next(void *hal_soc, void *hal_ring)
  475. {
  476. struct hal_srng *srng = (struct hal_srng *)hal_ring;
  477. uint32_t *desc;
  478. /* TODO: Using % is expensive, but we have to do this since
  479. * size of some SRNG rings is not power of 2 (due to descriptor
  480. * sizes). Need to create separate API for rings used
  481. * per-packet, with sizes power of 2 (TCL2SW, REO2SW,
  482. * SW2RXDMA and CE rings)
  483. */
  484. uint32_t next_reap_hp = (srng->u.src_ring.reap_hp + srng->entry_size) %
  485. srng->ring_size;
  486. if (next_reap_hp != srng->u.src_ring.cached_tp) {
  487. desc = &(srng->ring_base_vaddr[next_reap_hp]);
  488. srng->u.src_ring.reap_hp = next_reap_hp;
  489. return (void *)desc;
  490. }
  491. return NULL;
  492. }
  493. /**
  494. * hal_srng_src_get_next_reaped - Get next entry from a source ring that is
  495. * already reaped using hal_srng_src_reap_next, for posting new entries to
  496. * the ring
  497. *
  498. * @hal_soc: Opaque HAL SOC handle
  499. * @hal_ring: Source ring pointer
  500. *
  501. * Return: Opaque pointer for next (reaped) source ring entry; NULL on failire
  502. */
  503. static inline void *hal_srng_src_get_next_reaped(void *hal_soc, void *hal_ring)
  504. {
  505. struct hal_srng *srng = (struct hal_srng *)hal_ring;
  506. uint32_t *desc;
  507. if (srng->u.src_ring.hp != srng->u.src_ring.reap_hp) {
  508. desc = &(srng->ring_base_vaddr[srng->u.src_ring.hp]);
  509. srng->u.src_ring.hp = (srng->u.src_ring.hp + srng->entry_size) %
  510. srng->ring_size;
  511. return (void *)desc;
  512. }
  513. return NULL;
  514. }
  515. /**
  516. * hal_srng_src_pending_reap_next - Reap next entry from a source ring and
  517. * move reap pointer. This API is used in detach path to release any buffers
  518. * associated with ring entries which are pending reap.
  519. *
  520. * @hal_soc: Opaque HAL SOC handle
  521. * @hal_ring: Source ring pointer
  522. *
  523. * Return: Opaque pointer for next ring entry; NULL on failire
  524. */
  525. static inline void *hal_srng_src_pending_reap_next(void *hal_soc, void *hal_ring)
  526. {
  527. struct hal_srng *srng = (struct hal_srng *)hal_ring;
  528. uint32_t *desc;
  529. uint32_t next_reap_hp = (srng->u.src_ring.reap_hp + srng->entry_size) %
  530. srng->ring_size;
  531. if (next_reap_hp != srng->u.src_ring.hp) {
  532. desc = &(srng->ring_base_vaddr[next_reap_hp]);
  533. srng->u.src_ring.reap_hp = next_reap_hp;
  534. return (void *)desc;
  535. }
  536. return NULL;
  537. }
  538. /**
  539. * hal_srng_src_done_val -
  540. *
  541. * @hal_soc: Opaque HAL SOC handle
  542. * @hal_ring: Source ring pointer
  543. *
  544. * Return: Opaque pointer for next ring entry; NULL on failire
  545. */
  546. static inline uint32_t hal_srng_src_done_val(void *hal_soc, void *hal_ring)
  547. {
  548. struct hal_srng *srng = (struct hal_srng *)hal_ring;
  549. /* TODO: Using % is expensive, but we have to do this since
  550. * size of some SRNG rings is not power of 2 (due to descriptor
  551. * sizes). Need to create separate API for rings used
  552. * per-packet, with sizes power of 2 (TCL2SW, REO2SW,
  553. * SW2RXDMA and CE rings)
  554. */
  555. uint32_t next_reap_hp = (srng->u.src_ring.reap_hp + srng->entry_size) %
  556. srng->ring_size;
  557. if (next_reap_hp == srng->u.src_ring.cached_tp)
  558. return 0;
  559. if (srng->u.src_ring.cached_tp > next_reap_hp)
  560. return (srng->u.src_ring.cached_tp - next_reap_hp) /
  561. srng->entry_size;
  562. else
  563. return ((srng->ring_size - next_reap_hp) +
  564. srng->u.src_ring.cached_tp) / srng->entry_size;
  565. }
  566. /**
  567. * hal_api_get_tphp - Get head and tail pointer location for any ring
  568. * @hal_soc: Opaque HAL SOC handle
  569. * @hal_ring: Source ring pointer
  570. * @tailp: Tail Pointer
  571. * @headp: Head Pointer
  572. *
  573. * Return: Update tail pointer and head pointer in arguments.
  574. */
  575. static inline void hal_api_get_tphp(void *hal_soc, void *hal_ring,
  576. uint32_t *tailp, uint32_t *headp)
  577. {
  578. struct hal_srng *srng = (struct hal_srng *)hal_ring;
  579. if (srng->ring_dir == HAL_SRNG_SRC_RING) {
  580. *headp = srng->u.src_ring.hp / srng->entry_size;
  581. *tailp = *(srng->u.src_ring.tp_addr) / srng->entry_size;
  582. } else {
  583. *tailp = srng->u.dst_ring.tp / srng->entry_size;
  584. *headp = *(srng->u.dst_ring.hp_addr) / srng->entry_size;
  585. }
  586. }
  587. /**
  588. * hal_srng_src_get_next - Get next entry from a source ring and move cached tail pointer
  589. *
  590. * @hal_soc: Opaque HAL SOC handle
  591. * @hal_ring: Source ring pointer
  592. *
  593. * Return: Opaque pointer for next ring entry; NULL on failire
  594. */
  595. static inline void *hal_srng_src_get_next(void *hal_soc, void *hal_ring)
  596. {
  597. struct hal_srng *srng = (struct hal_srng *)hal_ring;
  598. uint32_t *desc;
  599. /* TODO: Using % is expensive, but we have to do this since
  600. * size of some SRNG rings is not power of 2 (due to descriptor
  601. * sizes). Need to create separate API for rings used
  602. * per-packet, with sizes power of 2 (TCL2SW, REO2SW,
  603. * SW2RXDMA and CE rings)
  604. */
  605. uint32_t next_hp = (srng->u.src_ring.hp + srng->entry_size) %
  606. srng->ring_size;
  607. if (next_hp != srng->u.src_ring.cached_tp) {
  608. desc = &(srng->ring_base_vaddr[srng->u.src_ring.hp]);
  609. srng->u.src_ring.hp = next_hp;
  610. /* TODO: Since reap function is not used by all rings, we can
  611. * remove the following update of reap_hp in this function
  612. * if we can ensure that only hal_srng_src_get_next_reaped
  613. * is used for the rings requiring reap functionality
  614. */
  615. srng->u.src_ring.reap_hp = next_hp;
  616. return (void *)desc;
  617. }
  618. return NULL;
  619. }
  620. /**
  621. * hal_srng_src_peek - Get next entry from a ring without moving head pointer.
  622. * hal_srng_src_get_next should be called subsequently to move the head pointer
  623. *
  624. * @hal_soc: Opaque HAL SOC handle
  625. * @hal_ring: Source ring pointer
  626. *
  627. * Return: Opaque pointer for next ring entry; NULL on failire
  628. */
  629. static inline void *hal_srng_src_peek(void *hal_soc, void *hal_ring)
  630. {
  631. struct hal_srng *srng = (struct hal_srng *)hal_ring;
  632. uint32_t *desc;
  633. /* TODO: Using % is expensive, but we have to do this since
  634. * size of some SRNG rings is not power of 2 (due to descriptor
  635. * sizes). Need to create separate API for rings used
  636. * per-packet, with sizes power of 2 (TCL2SW, REO2SW,
  637. * SW2RXDMA and CE rings)
  638. */
  639. if (((srng->u.src_ring.hp + srng->entry_size) %
  640. srng->ring_size) != srng->u.src_ring.cached_tp) {
  641. desc = &(srng->ring_base_vaddr[srng->u.src_ring.hp]);
  642. return (void *)desc;
  643. }
  644. return NULL;
  645. }
  646. /**
  647. * hal_srng_src_num_avail - Returns number of available entries in src ring
  648. *
  649. * @hal_soc: Opaque HAL SOC handle
  650. * @hal_ring: Source ring pointer
  651. * @sync_hw_ptr: Sync cached tail pointer with HW
  652. *
  653. */
  654. static inline uint32_t hal_srng_src_num_avail(void *hal_soc,
  655. void *hal_ring, int sync_hw_ptr)
  656. {
  657. struct hal_srng *srng = (struct hal_srng *)hal_ring;
  658. uint32_t tp;
  659. uint32_t hp = srng->u.src_ring.hp;
  660. if (sync_hw_ptr) {
  661. tp = *(srng->u.src_ring.tp_addr);
  662. srng->u.src_ring.cached_tp = tp;
  663. } else {
  664. tp = srng->u.src_ring.cached_tp;
  665. }
  666. if (tp > hp)
  667. return ((tp - hp) / srng->entry_size) - 1;
  668. else
  669. return ((srng->ring_size - hp + tp) / srng->entry_size) - 1;
  670. }
  671. /**
  672. * hal_srng_access_end_unlocked - End ring access (unlocked) - update cached
  673. * ring head/tail pointers to HW.
  674. * This should be used only if hal_srng_access_start_unlocked to start ring
  675. * access
  676. *
  677. * @hal_soc: Opaque HAL SOC handle
  678. * @hal_ring: Ring pointer (Source or Destination ring)
  679. *
  680. * Return: 0 on success; error on failire
  681. */
  682. static inline void hal_srng_access_end_unlocked(void *hal_soc, void *hal_ring)
  683. {
  684. struct hal_srng *srng = (struct hal_srng *)hal_ring;
  685. /* TODO: See if we need a write memory barrier here */
  686. if (srng->flags & HAL_SRNG_LMAC_RING) {
  687. /* For LMAC rings, ring pointer updates are done through FW and
  688. * hence written to a shared memory location that is read by FW
  689. */
  690. if (srng->ring_dir == HAL_SRNG_SRC_RING) {
  691. *(srng->u.src_ring.hp_addr) = srng->u.src_ring.hp;
  692. } else {
  693. *(srng->u.dst_ring.tp_addr) = srng->u.dst_ring.tp;
  694. }
  695. } else {
  696. if (srng->ring_dir == HAL_SRNG_SRC_RING)
  697. hal_write_address_32_mb(hal_soc,
  698. srng->u.src_ring.hp_addr,
  699. srng->u.src_ring.hp);
  700. else
  701. hal_write_address_32_mb(hal_soc,
  702. srng->u.dst_ring.tp_addr,
  703. srng->u.dst_ring.tp);
  704. }
  705. }
  706. /**
  707. * hal_srng_access_end - Unlock ring access and update cached ring head/tail
  708. * pointers to HW
  709. * This should be used only if hal_srng_access_start to start ring access
  710. *
  711. * @hal_soc: Opaque HAL SOC handle
  712. * @hal_ring: Ring pointer (Source or Destination ring)
  713. *
  714. * Return: 0 on success; error on failire
  715. */
  716. static inline void hal_srng_access_end(void *hal_soc, void *hal_ring)
  717. {
  718. struct hal_srng *srng = (struct hal_srng *)hal_ring;
  719. hal_srng_access_end_unlocked(hal_soc, hal_ring);
  720. SRNG_UNLOCK(&(srng->lock));
  721. }
  722. /**
  723. * hal_srng_access_end_reap - Unlock ring access
  724. * This should be used only if hal_srng_access_start to start ring access
  725. * and should be used only while reaping SRC ring completions
  726. *
  727. * @hal_soc: Opaque HAL SOC handle
  728. * @hal_ring: Ring pointer (Source or Destination ring)
  729. *
  730. * Return: 0 on success; error on failire
  731. */
  732. static inline void hal_srng_access_end_reap(void *hal_soc, void *hal_ring)
  733. {
  734. struct hal_srng *srng = (struct hal_srng *)hal_ring;
  735. SRNG_UNLOCK(&(srng->lock));
  736. }
  737. /* TODO: Check if the following definitions is available in HW headers */
  738. #define WBM_IDLE_SCATTER_BUF_SIZE 32704
  739. #define NUM_MPDUS_PER_LINK_DESC 6
  740. #define NUM_MSDUS_PER_LINK_DESC 7
  741. #define REO_QUEUE_DESC_ALIGN 128
  742. #define LINK_DESC_ALIGN 128
  743. #define ADDRESS_MATCH_TAG_VAL 0x5
  744. /* Number of mpdu link pointers is 9 in case of TX_MPDU_QUEUE_HEAD and 14 in
  745. * of TX_MPDU_QUEUE_EXT. We are defining a common average count here
  746. */
  747. #define NUM_MPDU_LINKS_PER_QUEUE_DESC 12
  748. /* TODO: Check with HW team on the scatter buffer size supported. As per WBM
  749. * MLD, scatter_buffer_size in IDLE_LIST_CONTROL register is 9 bits and size
  750. * should be specified in 16 word units. But the number of bits defined for
  751. * this field in HW header files is 5.
  752. */
  753. #define WBM_IDLE_SCATTER_BUF_NEXT_PTR_SIZE 8
  754. /**
  755. * hal_idle_list_scatter_buf_size - Get the size of each scatter buffer
  756. * in an idle list
  757. *
  758. * @hal_soc: Opaque HAL SOC handle
  759. *
  760. */
  761. static inline uint32_t hal_idle_list_scatter_buf_size(void *hal_soc)
  762. {
  763. return WBM_IDLE_SCATTER_BUF_SIZE;
  764. }
  765. /**
  766. * hal_get_link_desc_size - Get the size of each link descriptor
  767. *
  768. * @hal_soc: Opaque HAL SOC handle
  769. *
  770. */
  771. static inline uint32_t hal_get_link_desc_size(struct hal_soc *hal_soc)
  772. {
  773. if (!hal_soc || !hal_soc->ops) {
  774. qdf_print("Error: Invalid ops\n");
  775. QDF_BUG(0);
  776. return -EINVAL;
  777. }
  778. if (!hal_soc->ops->hal_get_link_desc_size) {
  779. qdf_print("Error: Invalid function pointer\n");
  780. QDF_BUG(0);
  781. return -EINVAL;
  782. }
  783. return hal_soc->ops->hal_get_link_desc_size();
  784. }
  785. /**
  786. * hal_get_link_desc_align - Get the required start address alignment for
  787. * link descriptors
  788. *
  789. * @hal_soc: Opaque HAL SOC handle
  790. *
  791. */
  792. static inline uint32_t hal_get_link_desc_align(void *hal_soc)
  793. {
  794. return LINK_DESC_ALIGN;
  795. }
  796. /**
  797. * hal_num_mpdus_per_link_desc - Get number of mpdus each link desc can hold
  798. *
  799. * @hal_soc: Opaque HAL SOC handle
  800. *
  801. */
  802. static inline uint32_t hal_num_mpdus_per_link_desc(void *hal_soc)
  803. {
  804. return NUM_MPDUS_PER_LINK_DESC;
  805. }
  806. /**
  807. * hal_num_msdus_per_link_desc - Get number of msdus each link desc can hold
  808. *
  809. * @hal_soc: Opaque HAL SOC handle
  810. *
  811. */
  812. static inline uint32_t hal_num_msdus_per_link_desc(void *hal_soc)
  813. {
  814. return NUM_MSDUS_PER_LINK_DESC;
  815. }
  816. /**
  817. * hal_num_mpdu_links_per_queue_desc - Get number of mpdu links each queue
  818. * descriptor can hold
  819. *
  820. * @hal_soc: Opaque HAL SOC handle
  821. *
  822. */
  823. static inline uint32_t hal_num_mpdu_links_per_queue_desc(void *hal_soc)
  824. {
  825. return NUM_MPDU_LINKS_PER_QUEUE_DESC;
  826. }
  827. /**
  828. * hal_idle_list_scatter_buf_num_entries - Get the number of link desc entries
  829. * that the given buffer size
  830. *
  831. * @hal_soc: Opaque HAL SOC handle
  832. * @scatter_buf_size: Size of scatter buffer
  833. *
  834. */
  835. static inline uint32_t hal_idle_scatter_buf_num_entries(void *hal_soc,
  836. uint32_t scatter_buf_size)
  837. {
  838. return (scatter_buf_size - WBM_IDLE_SCATTER_BUF_NEXT_PTR_SIZE) /
  839. hal_srng_get_entrysize(hal_soc, WBM_IDLE_LINK);
  840. }
  841. /**
  842. * hal_idle_list_num_scatter_bufs - Get the number of sctater buffer
  843. * each given buffer size
  844. *
  845. * @hal_soc: Opaque HAL SOC handle
  846. * @total_mem: size of memory to be scattered
  847. * @scatter_buf_size: Size of scatter buffer
  848. *
  849. */
  850. static inline uint32_t hal_idle_list_num_scatter_bufs(void *hal_soc,
  851. uint32_t total_mem, uint32_t scatter_buf_size)
  852. {
  853. uint8_t rem = (total_mem % (scatter_buf_size -
  854. WBM_IDLE_SCATTER_BUF_NEXT_PTR_SIZE)) ? 1 : 0;
  855. uint32_t num_scatter_bufs = (total_mem / (scatter_buf_size -
  856. WBM_IDLE_SCATTER_BUF_NEXT_PTR_SIZE)) + rem;
  857. return num_scatter_bufs;
  858. }
  859. /* REO parameters to be passed to hal_reo_setup */
  860. struct hal_reo_params {
  861. /** rx hash steering enabled or disabled */
  862. bool rx_hash_enabled;
  863. /** reo remap 1 register */
  864. uint32_t remap1;
  865. /** reo remap 2 register */
  866. uint32_t remap2;
  867. /** fragment destination ring */
  868. uint8_t frag_dst_ring;
  869. /** padding */
  870. uint8_t padding[3];
  871. };
  872. enum hal_pn_type {
  873. HAL_PN_NONE,
  874. HAL_PN_WPA,
  875. HAL_PN_WAPI_EVEN,
  876. HAL_PN_WAPI_UNEVEN,
  877. };
  878. #define HAL_RX_MAX_BA_WINDOW 256
  879. /**
  880. * hal_get_reo_qdesc_align - Get start address alignment for reo
  881. * queue descriptors
  882. *
  883. * @hal_soc: Opaque HAL SOC handle
  884. *
  885. */
  886. static inline uint32_t hal_get_reo_qdesc_align(void *hal_soc)
  887. {
  888. return REO_QUEUE_DESC_ALIGN;
  889. }
  890. /**
  891. * hal_reo_qdesc_setup - Setup HW REO queue descriptor
  892. *
  893. * @hal_soc: Opaque HAL SOC handle
  894. * @ba_window_size: BlockAck window size
  895. * @start_seq: Starting sequence number
  896. * @hw_qdesc_vaddr: Virtual address of REO queue descriptor memory
  897. * @hw_qdesc_paddr: Physical address of REO queue descriptor memory
  898. * @pn_type: PN type (one of the types defined in 'enum hal_pn_type')
  899. *
  900. */
  901. extern void hal_reo_qdesc_setup(void *hal_soc, int tid, uint32_t ba_window_size,
  902. uint32_t start_seq, void *hw_qdesc_vaddr, qdf_dma_addr_t hw_qdesc_paddr,
  903. int pn_type);
  904. /**
  905. * hal_srng_get_hp_addr - Get head pointer physical address
  906. *
  907. * @hal_soc: Opaque HAL SOC handle
  908. * @hal_ring: Ring pointer (Source or Destination ring)
  909. *
  910. */
  911. static inline qdf_dma_addr_t hal_srng_get_hp_addr(void *hal_soc, void *hal_ring)
  912. {
  913. struct hal_srng *srng = (struct hal_srng *)hal_ring;
  914. struct hal_soc *hal = (struct hal_soc *)hal_soc;
  915. if (srng->ring_dir == HAL_SRNG_SRC_RING) {
  916. return hal->shadow_wrptr_mem_paddr +
  917. ((unsigned long)(srng->u.src_ring.hp_addr) -
  918. (unsigned long)(hal->shadow_wrptr_mem_vaddr));
  919. } else {
  920. return hal->shadow_rdptr_mem_paddr +
  921. ((unsigned long)(srng->u.dst_ring.hp_addr) -
  922. (unsigned long)(hal->shadow_rdptr_mem_vaddr));
  923. }
  924. }
  925. /**
  926. * hal_srng_get_tp_addr - Get tail pointer physical address
  927. *
  928. * @hal_soc: Opaque HAL SOC handle
  929. * @hal_ring: Ring pointer (Source or Destination ring)
  930. *
  931. */
  932. static inline qdf_dma_addr_t hal_srng_get_tp_addr(void *hal_soc, void *hal_ring)
  933. {
  934. struct hal_srng *srng = (struct hal_srng *)hal_ring;
  935. struct hal_soc *hal = (struct hal_soc *)hal_soc;
  936. if (srng->ring_dir == HAL_SRNG_SRC_RING) {
  937. return hal->shadow_rdptr_mem_paddr +
  938. ((unsigned long)(srng->u.src_ring.tp_addr) -
  939. (unsigned long)(hal->shadow_rdptr_mem_vaddr));
  940. } else {
  941. return hal->shadow_wrptr_mem_paddr +
  942. ((unsigned long)(srng->u.dst_ring.tp_addr) -
  943. (unsigned long)(hal->shadow_wrptr_mem_vaddr));
  944. }
  945. }
  946. /**
  947. * hal_get_srng_params - Retrieve SRNG parameters for a given ring from HAL
  948. *
  949. * @hal_soc: Opaque HAL SOC handle
  950. * @hal_ring: Ring pointer (Source or Destination ring)
  951. * @ring_params: SRNG parameters will be returned through this structure
  952. */
  953. extern void hal_get_srng_params(void *hal_soc, void *hal_ring,
  954. struct hal_srng_params *ring_params);
  955. /**
  956. * hal_mem_info - Retrieve hal memory base address
  957. *
  958. * @hal_soc: Opaque HAL SOC handle
  959. * @mem: pointer to structure to be updated with hal mem info
  960. */
  961. extern void hal_get_meminfo(void *hal_soc,struct hal_mem_info *mem );
  962. /**
  963. * hal_get_target_type - Return target type
  964. *
  965. * @hal_soc: Opaque HAL SOC handle
  966. */
  967. uint32_t hal_get_target_type(struct hal_soc *hal);
  968. /**
  969. * hal_get_ba_aging_timeout - Retrieve BA aging timeout
  970. *
  971. * @hal_soc: Opaque HAL SOC handle
  972. * @ac: Access category
  973. * @value: timeout duration in millisec
  974. */
  975. void hal_get_ba_aging_timeout(void *hal_soc, uint8_t ac,
  976. uint32_t *value);
  977. /**
  978. * hal_set_aging_timeout - Set BA aging timeout
  979. *
  980. * @hal_soc: Opaque HAL SOC handle
  981. * @ac: Access category in millisec
  982. * @value: timeout duration value
  983. */
  984. void hal_set_ba_aging_timeout(void *hal_soc, uint8_t ac,
  985. uint32_t value);
  986. /**
  987. * hal_srng_dst_hw_init - Private function to initialize SRNG
  988. * destination ring HW
  989. * @hal_soc: HAL SOC handle
  990. * @srng: SRNG ring pointer
  991. */
  992. static inline void hal_srng_dst_hw_init(struct hal_soc *hal,
  993. struct hal_srng *srng)
  994. {
  995. hal->ops->hal_srng_dst_hw_init(hal, srng);
  996. }
  997. /**
  998. * hal_srng_src_hw_init - Private function to initialize SRNG
  999. * source ring HW
  1000. * @hal_soc: HAL SOC handle
  1001. * @srng: SRNG ring pointer
  1002. */
  1003. static inline void hal_srng_src_hw_init(struct hal_soc *hal,
  1004. struct hal_srng *srng)
  1005. {
  1006. hal->ops->hal_srng_src_hw_init(hal, srng);
  1007. }
  1008. /**
  1009. * hal_reo_setup - Initialize HW REO block
  1010. *
  1011. * @hal_soc: Opaque HAL SOC handle
  1012. * @reo_params: parameters needed by HAL for REO config
  1013. */
  1014. static inline void hal_reo_setup(void *halsoc,
  1015. void *reoparams)
  1016. {
  1017. struct hal_soc *hal_soc = (struct hal_soc *)halsoc;
  1018. hal_soc->ops->hal_reo_setup(halsoc, reoparams);
  1019. }
  1020. /**
  1021. * hal_setup_link_idle_list - Setup scattered idle list using the
  1022. * buffer list provided
  1023. *
  1024. * @hal_soc: Opaque HAL SOC handle
  1025. * @scatter_bufs_base_paddr: Array of physical base addresses
  1026. * @scatter_bufs_base_vaddr: Array of virtual base addresses
  1027. * @num_scatter_bufs: Number of scatter buffers in the above lists
  1028. * @scatter_buf_size: Size of each scatter buffer
  1029. * @last_buf_end_offset: Offset to the last entry
  1030. * @num_entries: Total entries of all scatter bufs
  1031. *
  1032. */
  1033. static inline void hal_setup_link_idle_list(void *halsoc,
  1034. qdf_dma_addr_t scatter_bufs_base_paddr[],
  1035. void *scatter_bufs_base_vaddr[], uint32_t num_scatter_bufs,
  1036. uint32_t scatter_buf_size, uint32_t last_buf_end_offset,
  1037. uint32_t num_entries)
  1038. {
  1039. struct hal_soc *hal_soc = (struct hal_soc *)halsoc;
  1040. hal_soc->ops->hal_setup_link_idle_list(halsoc, scatter_bufs_base_paddr,
  1041. scatter_bufs_base_vaddr, num_scatter_bufs,
  1042. scatter_buf_size, last_buf_end_offset,
  1043. num_entries);
  1044. }
  1045. #endif /* _HAL_APIH_ */