hal_api.h 32 KB

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