hif.h 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075
  1. /*
  2. * Copyright (c) 2013-2019 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 _HIF_H_
  19. #define _HIF_H_
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif /* __cplusplus */
  23. /* Header files */
  24. #include <qdf_status.h>
  25. #include "qdf_nbuf.h"
  26. #include "qdf_lro.h"
  27. #include "ol_if_athvar.h"
  28. #include <linux/platform_device.h>
  29. #ifdef HIF_PCI
  30. #include <linux/pci.h>
  31. #endif /* HIF_PCI */
  32. #ifdef HIF_USB
  33. #include <linux/usb.h>
  34. #endif /* HIF_USB */
  35. #ifdef IPA_OFFLOAD
  36. #include <linux/ipa.h>
  37. #endif
  38. #define ENABLE_MBOX_DUMMY_SPACE_FEATURE 1
  39. typedef void __iomem *A_target_id_t;
  40. typedef void *hif_handle_t;
  41. #define HIF_TYPE_AR6002 2
  42. #define HIF_TYPE_AR6003 3
  43. #define HIF_TYPE_AR6004 5
  44. #define HIF_TYPE_AR9888 6
  45. #define HIF_TYPE_AR6320 7
  46. #define HIF_TYPE_AR6320V2 8
  47. /* For attaching Peregrine 2.0 board host_reg_tbl only */
  48. #define HIF_TYPE_AR9888V2 9
  49. #define HIF_TYPE_ADRASTEA 10
  50. #define HIF_TYPE_AR900B 11
  51. #define HIF_TYPE_QCA9984 12
  52. #define HIF_TYPE_IPQ4019 13
  53. #define HIF_TYPE_QCA9888 14
  54. #define HIF_TYPE_QCA8074 15
  55. #define HIF_TYPE_QCA6290 16
  56. #define HIF_TYPE_QCN7605 17
  57. #define HIF_TYPE_QCA6390 18
  58. #define HIF_TYPE_QCA8074V2 19
  59. #define HIF_TYPE_QCA6018 20
  60. #ifdef IPA_OFFLOAD
  61. #define DMA_COHERENT_MASK_IPA_VER_3_AND_ABOVE 37
  62. #define DMA_COHERENT_MASK_BELOW_IPA_VER_3 32
  63. #endif
  64. /* enum hif_ic_irq - enum defining integrated chip irq numbers
  65. * defining irq nubers that can be used by external modules like datapath
  66. */
  67. enum hif_ic_irq {
  68. host2wbm_desc_feed = 16,
  69. host2reo_re_injection,
  70. host2reo_command,
  71. host2rxdma_monitor_ring3,
  72. host2rxdma_monitor_ring2,
  73. host2rxdma_monitor_ring1,
  74. reo2host_exception,
  75. wbm2host_rx_release,
  76. reo2host_status,
  77. reo2host_destination_ring4,
  78. reo2host_destination_ring3,
  79. reo2host_destination_ring2,
  80. reo2host_destination_ring1,
  81. rxdma2host_monitor_destination_mac3,
  82. rxdma2host_monitor_destination_mac2,
  83. rxdma2host_monitor_destination_mac1,
  84. ppdu_end_interrupts_mac3,
  85. ppdu_end_interrupts_mac2,
  86. ppdu_end_interrupts_mac1,
  87. rxdma2host_monitor_status_ring_mac3,
  88. rxdma2host_monitor_status_ring_mac2,
  89. rxdma2host_monitor_status_ring_mac1,
  90. host2rxdma_host_buf_ring_mac3,
  91. host2rxdma_host_buf_ring_mac2,
  92. host2rxdma_host_buf_ring_mac1,
  93. rxdma2host_destination_ring_mac3,
  94. rxdma2host_destination_ring_mac2,
  95. rxdma2host_destination_ring_mac1,
  96. host2tcl_input_ring4,
  97. host2tcl_input_ring3,
  98. host2tcl_input_ring2,
  99. host2tcl_input_ring1,
  100. wbm2host_tx_completions_ring3,
  101. wbm2host_tx_completions_ring2,
  102. wbm2host_tx_completions_ring1,
  103. tcl2host_status_ring,
  104. };
  105. struct CE_state;
  106. #define CE_COUNT_MAX 12
  107. #define HIF_MAX_GRP_IRQ 16
  108. #ifdef CONFIG_WIN
  109. #define HIF_MAX_GROUP 12
  110. #else
  111. #define HIF_MAX_GROUP 8
  112. #endif
  113. #ifdef CONFIG_SLUB_DEBUG_ON
  114. #ifndef CONFIG_WIN
  115. #define HIF_CONFIG_SLUB_DEBUG_ON
  116. #endif
  117. #endif
  118. #ifndef NAPI_YIELD_BUDGET_BASED
  119. #ifdef HIF_CONFIG_SLUB_DEBUG_ON
  120. #define QCA_NAPI_DEF_SCALE_BIN_SHIFT 1
  121. #else
  122. #ifndef QCA_NAPI_DEF_SCALE_BIN_SHIFT
  123. #define QCA_NAPI_DEF_SCALE_BIN_SHIFT 4
  124. #endif
  125. #endif /* SLUB_DEBUG_ON */
  126. #else /* NAPI_YIELD_BUDGET_BASED */
  127. #define QCA_NAPI_DEF_SCALE_BIN_SHIFT 2
  128. #endif /* NAPI_YIELD_BUDGET_BASED */
  129. #define QCA_NAPI_BUDGET 64
  130. #define QCA_NAPI_DEF_SCALE \
  131. (1 << QCA_NAPI_DEF_SCALE_BIN_SHIFT)
  132. #define HIF_NAPI_MAX_RECEIVES (QCA_NAPI_BUDGET * QCA_NAPI_DEF_SCALE)
  133. /* NOTE: "napi->scale" can be changed,
  134. * but this does not change the number of buckets
  135. */
  136. #define QCA_NAPI_NUM_BUCKETS 4
  137. /**
  138. * qca_napi_stat - stats structure for execution contexts
  139. * @napi_schedules - number of times the schedule function is called
  140. * @napi_polls - number of times the execution context runs
  141. * @napi_completes - number of times that the generating interrupt is reenabled
  142. * @napi_workdone - cumulative of all work done reported by handler
  143. * @cpu_corrected - incremented when execution context runs on a different core
  144. * than the one that its irq is affined to.
  145. * @napi_budget_uses - histogram of work done per execution run
  146. * @time_limit_reache - count of yields due to time limit threshholds
  147. * @rxpkt_thresh_reached - count of yields due to a work limit
  148. * @poll_time_buckets - histogram of poll times for the napi
  149. *
  150. */
  151. struct qca_napi_stat {
  152. uint32_t napi_schedules;
  153. uint32_t napi_polls;
  154. uint32_t napi_completes;
  155. uint32_t napi_workdone;
  156. uint32_t cpu_corrected;
  157. uint32_t napi_budget_uses[QCA_NAPI_NUM_BUCKETS];
  158. uint32_t time_limit_reached;
  159. uint32_t rxpkt_thresh_reached;
  160. unsigned long long napi_max_poll_time;
  161. #ifdef WLAN_FEATURE_RX_SOFTIRQ_TIME_LIMIT
  162. uint32_t poll_time_buckets[QCA_NAPI_NUM_BUCKETS];
  163. #endif
  164. };
  165. /**
  166. * per NAPI instance data structure
  167. * This data structure holds stuff per NAPI instance.
  168. * Note that, in the current implementation, though scale is
  169. * an instance variable, it is set to the same value for all
  170. * instances.
  171. */
  172. struct qca_napi_info {
  173. struct net_device netdev; /* dummy net_dev */
  174. void *hif_ctx;
  175. struct napi_struct napi;
  176. uint8_t scale; /* currently same on all instances */
  177. uint8_t id;
  178. uint8_t cpu;
  179. int irq;
  180. cpumask_t cpumask;
  181. struct qca_napi_stat stats[NR_CPUS];
  182. #ifdef RECEIVE_OFFLOAD
  183. /* will only be present for data rx CE's */
  184. void (*offld_flush_cb)(void *);
  185. struct napi_struct rx_thread_napi;
  186. struct net_device rx_thread_netdev;
  187. #endif /* RECEIVE_OFFLOAD */
  188. qdf_lro_ctx_t lro_ctx;
  189. };
  190. enum qca_napi_tput_state {
  191. QCA_NAPI_TPUT_UNINITIALIZED,
  192. QCA_NAPI_TPUT_LO,
  193. QCA_NAPI_TPUT_HI
  194. };
  195. enum qca_napi_cpu_state {
  196. QCA_NAPI_CPU_UNINITIALIZED,
  197. QCA_NAPI_CPU_DOWN,
  198. QCA_NAPI_CPU_UP };
  199. /**
  200. * struct qca_napi_cpu - an entry of the napi cpu table
  201. * @core_id: physical core id of the core
  202. * @cluster_id: cluster this core belongs to
  203. * @core_mask: mask to match all core of this cluster
  204. * @thread_mask: mask for this core within the cluster
  205. * @max_freq: maximum clock this core can be clocked at
  206. * same for all cpus of the same core.
  207. * @napis: bitmap of napi instances on this core
  208. * @execs: bitmap of execution contexts on this core
  209. * cluster_nxt: chain to link cores within the same cluster
  210. *
  211. * This structure represents a single entry in the napi cpu
  212. * table. The table is part of struct qca_napi_data.
  213. * This table is initialized by the init function, called while
  214. * the first napi instance is being created, updated by hotplug
  215. * notifier and when cpu affinity decisions are made (by throughput
  216. * detection), and deleted when the last napi instance is removed.
  217. */
  218. struct qca_napi_cpu {
  219. enum qca_napi_cpu_state state;
  220. int core_id;
  221. int cluster_id;
  222. cpumask_t core_mask;
  223. cpumask_t thread_mask;
  224. unsigned int max_freq;
  225. uint32_t napis;
  226. uint32_t execs;
  227. int cluster_nxt; /* index, not pointer */
  228. };
  229. /**
  230. * struct qca_napi_data - collection of napi data for a single hif context
  231. * @hif_softc: pointer to the hif context
  232. * @lock: spinlock used in the event state machine
  233. * @state: state variable used in the napi stat machine
  234. * @ce_map: bit map indicating which ce's have napis running
  235. * @exec_map: bit map of instanciated exec contexts
  236. * @user_cpu_affin_map: CPU affinity map from INI config.
  237. * @napi_cpu: cpu info for irq affinty
  238. * @lilcl_head:
  239. * @bigcl_head:
  240. * @napi_mode: irq affinity & clock voting mode
  241. * @cpuhp_handler: CPU hotplug event registration handle
  242. */
  243. struct qca_napi_data {
  244. struct hif_softc *hif_softc;
  245. qdf_spinlock_t lock;
  246. uint32_t state;
  247. /* bitmap of created/registered NAPI instances, indexed by pipe_id,
  248. * not used by clients (clients use an id returned by create)
  249. */
  250. uint32_t ce_map;
  251. uint32_t exec_map;
  252. uint32_t user_cpu_affin_mask;
  253. struct qca_napi_info *napis[CE_COUNT_MAX];
  254. struct qca_napi_cpu napi_cpu[NR_CPUS];
  255. int lilcl_head, bigcl_head;
  256. enum qca_napi_tput_state napi_mode;
  257. struct qdf_cpuhp_handler *cpuhp_handler;
  258. uint8_t flags;
  259. };
  260. /**
  261. * struct hif_config_info - Place Holder for HIF configuration
  262. * @enable_self_recovery: Self Recovery
  263. * @enable_runtime_pm: Enable Runtime PM
  264. * @runtime_pm_delay: Runtime PM Delay
  265. * @rx_softirq_max_yield_duration_ns: Max Yield time duration for RX Softirq
  266. *
  267. * Structure for holding HIF ini parameters.
  268. */
  269. struct hif_config_info {
  270. bool enable_self_recovery;
  271. #ifdef FEATURE_RUNTIME_PM
  272. bool enable_runtime_pm;
  273. u_int32_t runtime_pm_delay;
  274. #endif
  275. uint64_t rx_softirq_max_yield_duration_ns;
  276. };
  277. /**
  278. * struct hif_target_info - Target Information
  279. * @target_version: Target Version
  280. * @target_type: Target Type
  281. * @target_revision: Target Revision
  282. * @soc_version: SOC Version
  283. * @hw_name: pointer to hardware name
  284. *
  285. * Structure to hold target information.
  286. */
  287. struct hif_target_info {
  288. uint32_t target_version;
  289. uint32_t target_type;
  290. uint32_t target_revision;
  291. uint32_t soc_version;
  292. char *hw_name;
  293. };
  294. struct hif_opaque_softc {
  295. };
  296. /**
  297. * enum HIF_DEVICE_POWER_CHANGE_TYPE: Device Power change type
  298. *
  299. * @HIF_DEVICE_POWER_UP: HIF layer should power up interface and/or module
  300. * @HIF_DEVICE_POWER_DOWN: HIF layer should initiate bus-specific measures to
  301. * minimize power
  302. * @HIF_DEVICE_POWER_CUT: HIF layer should initiate bus-specific AND/OR
  303. * platform-specific measures to completely power-off
  304. * the module and associated hardware (i.e. cut power
  305. * supplies)
  306. */
  307. enum HIF_DEVICE_POWER_CHANGE_TYPE {
  308. HIF_DEVICE_POWER_UP,
  309. HIF_DEVICE_POWER_DOWN,
  310. HIF_DEVICE_POWER_CUT
  311. };
  312. /**
  313. * enum hif_enable_type: what triggered the enabling of hif
  314. *
  315. * @HIF_ENABLE_TYPE_PROBE: probe triggered enable
  316. * @HIF_ENABLE_TYPE_REINIT: reinit triggered enable
  317. */
  318. enum hif_enable_type {
  319. HIF_ENABLE_TYPE_PROBE,
  320. HIF_ENABLE_TYPE_REINIT,
  321. HIF_ENABLE_TYPE_MAX
  322. };
  323. /**
  324. * enum hif_disable_type: what triggered the disabling of hif
  325. *
  326. * @HIF_DISABLE_TYPE_PROBE_ERROR: probe error triggered disable
  327. * @HIF_DISABLE_TYPE_REINIT_ERROR: reinit error triggered disable
  328. * @HIF_DISABLE_TYPE_REMOVE: remove triggered disable
  329. * @HIF_DISABLE_TYPE_SHUTDOWN: shutdown triggered disable
  330. */
  331. enum hif_disable_type {
  332. HIF_DISABLE_TYPE_PROBE_ERROR,
  333. HIF_DISABLE_TYPE_REINIT_ERROR,
  334. HIF_DISABLE_TYPE_REMOVE,
  335. HIF_DISABLE_TYPE_SHUTDOWN,
  336. HIF_DISABLE_TYPE_MAX
  337. };
  338. /**
  339. * enum hif_device_config_opcode: configure mode
  340. *
  341. * @HIF_DEVICE_POWER_STATE: device power state
  342. * @HIF_DEVICE_GET_MBOX_BLOCK_SIZE: get mbox block size
  343. * @HIF_DEVICE_GET_MBOX_ADDR: get mbox block address
  344. * @HIF_DEVICE_GET_PENDING_EVENTS_FUNC: get pending events functions
  345. * @HIF_DEVICE_GET_IRQ_PROC_MODE: get irq proc mode
  346. * @HIF_DEVICE_GET_RECV_EVENT_MASK_UNMASK_FUNC: receive event function
  347. * @HIF_DEVICE_POWER_STATE_CHANGE: change power state
  348. * @HIF_DEVICE_GET_IRQ_YIELD_PARAMS: get yield params
  349. * @HIF_CONFIGURE_QUERY_SCATTER_REQUEST_SUPPORT: configure scatter request
  350. * @HIF_DEVICE_GET_OS_DEVICE: get OS device
  351. * @HIF_DEVICE_DEBUG_BUS_STATE: debug bus state
  352. * @HIF_BMI_DONE: bmi done
  353. * @HIF_DEVICE_SET_TARGET_TYPE: set target type
  354. * @HIF_DEVICE_SET_HTC_CONTEXT: set htc context
  355. * @HIF_DEVICE_GET_HTC_CONTEXT: get htc context
  356. */
  357. enum hif_device_config_opcode {
  358. HIF_DEVICE_POWER_STATE = 0,
  359. HIF_DEVICE_GET_BLOCK_SIZE,
  360. HIF_DEVICE_GET_FIFO_ADDR,
  361. HIF_DEVICE_GET_PENDING_EVENTS_FUNC,
  362. HIF_DEVICE_GET_IRQ_PROC_MODE,
  363. HIF_DEVICE_GET_RECV_EVENT_MASK_UNMASK_FUNC,
  364. HIF_DEVICE_POWER_STATE_CHANGE,
  365. HIF_DEVICE_GET_IRQ_YIELD_PARAMS,
  366. HIF_CONFIGURE_QUERY_SCATTER_REQUEST_SUPPORT,
  367. HIF_DEVICE_GET_OS_DEVICE,
  368. HIF_DEVICE_DEBUG_BUS_STATE,
  369. HIF_BMI_DONE,
  370. HIF_DEVICE_SET_TARGET_TYPE,
  371. HIF_DEVICE_SET_HTC_CONTEXT,
  372. HIF_DEVICE_GET_HTC_CONTEXT,
  373. };
  374. #ifdef CONFIG_ATH_PCIE_ACCESS_DEBUG
  375. struct HID_ACCESS_LOG {
  376. uint32_t seqnum;
  377. bool is_write;
  378. void *addr;
  379. uint32_t value;
  380. };
  381. #endif
  382. void hif_reg_write(struct hif_opaque_softc *hif_ctx, uint32_t offset,
  383. uint32_t value);
  384. uint32_t hif_reg_read(struct hif_opaque_softc *hif_ctx, uint32_t offset);
  385. #define HIF_MAX_DEVICES 1
  386. /**
  387. * struct htc_callbacks - Structure for HTC Callbacks methods
  388. * @context: context to pass to the dsrhandler
  389. * note : rwCompletionHandler is provided the context
  390. * passed to hif_read_write
  391. * @rwCompletionHandler: Read / write completion handler
  392. * @dsrHandler: DSR Handler
  393. */
  394. struct htc_callbacks {
  395. void *context;
  396. QDF_STATUS(*rw_compl_handler)(void *rw_ctx, QDF_STATUS status);
  397. QDF_STATUS(*dsr_handler)(void *context);
  398. };
  399. /**
  400. * struct hif_driver_state_callbacks - Callbacks for HIF to query Driver state
  401. * @context: Private data context
  402. * @set_recovery_in_progress: To Set Driver state for recovery in progress
  403. * @is_recovery_in_progress: Query if driver state is recovery in progress
  404. * @is_load_unload_in_progress: Query if driver state Load/Unload in Progress
  405. * @is_driver_unloading: Query if driver is unloading.
  406. *
  407. * This Structure provides callback pointer for HIF to query hdd for driver
  408. * states.
  409. */
  410. struct hif_driver_state_callbacks {
  411. void *context;
  412. void (*set_recovery_in_progress)(void *context, uint8_t val);
  413. bool (*is_recovery_in_progress)(void *context);
  414. bool (*is_load_unload_in_progress)(void *context);
  415. bool (*is_driver_unloading)(void *context);
  416. bool (*is_target_ready)(void *context);
  417. };
  418. /* This API detaches the HTC layer from the HIF device */
  419. void hif_detach_htc(struct hif_opaque_softc *hif_ctx);
  420. /****************************************************************/
  421. /* BMI and Diag window abstraction */
  422. /****************************************************************/
  423. #define HIF_BMI_EXCHANGE_NO_TIMEOUT ((uint32_t)(0))
  424. #define DIAG_TRANSFER_LIMIT 2048U /* maximum number of bytes that can be
  425. * handled atomically by
  426. * DiagRead/DiagWrite
  427. */
  428. #ifdef WLAN_FEATURE_BMI
  429. /*
  430. * API to handle HIF-specific BMI message exchanges, this API is synchronous
  431. * and only allowed to be called from a context that can block (sleep)
  432. */
  433. QDF_STATUS hif_exchange_bmi_msg(struct hif_opaque_softc *hif_ctx,
  434. qdf_dma_addr_t cmd, qdf_dma_addr_t rsp,
  435. uint8_t *pSendMessage, uint32_t Length,
  436. uint8_t *pResponseMessage,
  437. uint32_t *pResponseLength, uint32_t TimeoutMS);
  438. void hif_register_bmi_callbacks(struct hif_opaque_softc *hif_ctx);
  439. bool hif_needs_bmi(struct hif_opaque_softc *hif_ctx);
  440. #else /* WLAN_FEATURE_BMI */
  441. static inline void
  442. hif_register_bmi_callbacks(struct hif_opaque_softc *hif_ctx)
  443. {
  444. }
  445. static inline bool
  446. hif_needs_bmi(struct hif_opaque_softc *hif_ctx)
  447. {
  448. return false;
  449. }
  450. #endif /* WLAN_FEATURE_BMI */
  451. /*
  452. * APIs to handle HIF specific diagnostic read accesses. These APIs are
  453. * synchronous and only allowed to be called from a context that
  454. * can block (sleep). They are not high performance APIs.
  455. *
  456. * hif_diag_read_access reads a 4 Byte aligned/length value from a
  457. * Target register or memory word.
  458. *
  459. * hif_diag_read_mem reads an arbitrary length of arbitrarily aligned memory.
  460. */
  461. QDF_STATUS hif_diag_read_access(struct hif_opaque_softc *hif_ctx,
  462. uint32_t address, uint32_t *data);
  463. QDF_STATUS hif_diag_read_mem(struct hif_opaque_softc *hif_ctx, uint32_t address,
  464. uint8_t *data, int nbytes);
  465. void hif_dump_target_memory(struct hif_opaque_softc *hif_ctx,
  466. void *ramdump_base, uint32_t address, uint32_t size);
  467. /*
  468. * APIs to handle HIF specific diagnostic write accesses. These APIs are
  469. * synchronous and only allowed to be called from a context that
  470. * can block (sleep).
  471. * They are not high performance APIs.
  472. *
  473. * hif_diag_write_access writes a 4 Byte aligned/length value to a
  474. * Target register or memory word.
  475. *
  476. * hif_diag_write_mem writes an arbitrary length of arbitrarily aligned memory.
  477. */
  478. QDF_STATUS hif_diag_write_access(struct hif_opaque_softc *hif_ctx,
  479. uint32_t address, uint32_t data);
  480. QDF_STATUS hif_diag_write_mem(struct hif_opaque_softc *hif_ctx,
  481. uint32_t address, uint8_t *data, int nbytes);
  482. typedef void (*fastpath_msg_handler)(void *, qdf_nbuf_t *, uint32_t);
  483. void hif_enable_polled_mode(struct hif_opaque_softc *hif_ctx);
  484. bool hif_is_polled_mode_enabled(struct hif_opaque_softc *hif_ctx);
  485. /*
  486. * Set the FASTPATH_mode_on flag in sc, for use by data path
  487. */
  488. #ifdef WLAN_FEATURE_FASTPATH
  489. void hif_enable_fastpath(struct hif_opaque_softc *hif_ctx);
  490. bool hif_is_fastpath_mode_enabled(struct hif_opaque_softc *hif_ctx);
  491. void *hif_get_ce_handle(struct hif_opaque_softc *hif_ctx, int ret);
  492. int hif_ce_fastpath_cb_register(struct hif_opaque_softc *hif_ctx,
  493. fastpath_msg_handler handler, void *context);
  494. #else
  495. static inline int hif_ce_fastpath_cb_register(struct hif_opaque_softc *hif_ctx,
  496. fastpath_msg_handler handler,
  497. void *context)
  498. {
  499. return QDF_STATUS_E_FAILURE;
  500. }
  501. static inline void *hif_get_ce_handle(struct hif_opaque_softc *hif_ctx, int ret)
  502. {
  503. return NULL;
  504. }
  505. #endif
  506. /*
  507. * Enable/disable CDC max performance workaround
  508. * For max-performace set this to 0
  509. * To allow SoC to enter sleep set this to 1
  510. */
  511. #define CONFIG_DISABLE_CDC_MAX_PERF_WAR 0
  512. void hif_ipa_get_ce_resource(struct hif_opaque_softc *hif_ctx,
  513. qdf_shared_mem_t **ce_sr,
  514. uint32_t *ce_sr_ring_size,
  515. qdf_dma_addr_t *ce_reg_paddr);
  516. /**
  517. * @brief List of callbacks - filled in by HTC.
  518. */
  519. struct hif_msg_callbacks {
  520. void *Context;
  521. /**< context meaningful to HTC */
  522. QDF_STATUS (*txCompletionHandler)(void *Context, qdf_nbuf_t wbuf,
  523. uint32_t transferID,
  524. uint32_t toeplitz_hash_result);
  525. QDF_STATUS (*rxCompletionHandler)(void *Context, qdf_nbuf_t wbuf,
  526. uint8_t pipeID);
  527. void (*txResourceAvailHandler)(void *context, uint8_t pipe);
  528. void (*fwEventHandler)(void *context, QDF_STATUS status);
  529. };
  530. enum hif_target_status {
  531. TARGET_STATUS_CONNECTED = 0, /* target connected */
  532. TARGET_STATUS_RESET, /* target got reset */
  533. TARGET_STATUS_EJECT, /* target got ejected */
  534. TARGET_STATUS_SUSPEND /*target got suspend */
  535. };
  536. /**
  537. * enum hif_attribute_flags: configure hif
  538. *
  539. * @HIF_LOWDESC_CE_CFG: Configure HIF with Low descriptor CE
  540. * @HIF_LOWDESC_CE_NO_PKTLOG_CFG: Configure HIF with Low descriptor
  541. * + No pktlog CE
  542. */
  543. enum hif_attribute_flags {
  544. HIF_LOWDESC_CE_CFG = 1,
  545. HIF_LOWDESC_CE_NO_PKTLOG_CFG
  546. };
  547. #define HIF_DATA_ATTR_SET_TX_CLASSIFY(attr, v) \
  548. (attr |= (v & 0x01) << 5)
  549. #define HIF_DATA_ATTR_SET_ENCAPSULATION_TYPE(attr, v) \
  550. (attr |= (v & 0x03) << 6)
  551. #define HIF_DATA_ATTR_SET_ADDR_X_SEARCH_DISABLE(attr, v) \
  552. (attr |= (v & 0x01) << 13)
  553. #define HIF_DATA_ATTR_SET_ADDR_Y_SEARCH_DISABLE(attr, v) \
  554. (attr |= (v & 0x01) << 14)
  555. #define HIF_DATA_ATTR_SET_TOEPLITZ_HASH_ENABLE(attr, v) \
  556. (attr |= (v & 0x01) << 15)
  557. #define HIF_DATA_ATTR_SET_PACKET_OR_RESULT_OFFSET(attr, v) \
  558. (attr |= (v & 0x0FFF) << 16)
  559. #define HIF_DATA_ATTR_SET_ENABLE_11H(attr, v) \
  560. (attr |= (v & 0x01) << 30)
  561. struct hif_ul_pipe_info {
  562. unsigned int nentries;
  563. unsigned int nentries_mask;
  564. unsigned int sw_index;
  565. unsigned int write_index; /* cached copy */
  566. unsigned int hw_index; /* cached copy */
  567. void *base_addr_owner_space; /* Host address space */
  568. qdf_dma_addr_t base_addr_CE_space; /* CE address space */
  569. };
  570. struct hif_dl_pipe_info {
  571. unsigned int nentries;
  572. unsigned int nentries_mask;
  573. unsigned int sw_index;
  574. unsigned int write_index; /* cached copy */
  575. unsigned int hw_index; /* cached copy */
  576. void *base_addr_owner_space; /* Host address space */
  577. qdf_dma_addr_t base_addr_CE_space; /* CE address space */
  578. };
  579. struct hif_pipe_addl_info {
  580. uint32_t pci_mem;
  581. uint32_t ctrl_addr;
  582. struct hif_ul_pipe_info ul_pipe;
  583. struct hif_dl_pipe_info dl_pipe;
  584. };
  585. #ifdef CONFIG_SLUB_DEBUG_ON
  586. #define MSG_FLUSH_NUM 16
  587. #else /* PERF build */
  588. #define MSG_FLUSH_NUM 32
  589. #endif /* SLUB_DEBUG_ON */
  590. struct hif_bus_id;
  591. void hif_claim_device(struct hif_opaque_softc *hif_ctx);
  592. QDF_STATUS hif_get_config_item(struct hif_opaque_softc *hif_ctx,
  593. int opcode, void *config, uint32_t config_len);
  594. void hif_set_mailbox_swap(struct hif_opaque_softc *hif_ctx);
  595. void hif_mask_interrupt_call(struct hif_opaque_softc *hif_ctx);
  596. void hif_post_init(struct hif_opaque_softc *hif_ctx, void *hHTC,
  597. struct hif_msg_callbacks *callbacks);
  598. QDF_STATUS hif_start(struct hif_opaque_softc *hif_ctx);
  599. void hif_stop(struct hif_opaque_softc *hif_ctx);
  600. void hif_flush_surprise_remove(struct hif_opaque_softc *hif_ctx);
  601. void hif_dump(struct hif_opaque_softc *hif_ctx, uint8_t CmdId, bool start);
  602. void hif_trigger_dump(struct hif_opaque_softc *hif_ctx,
  603. uint8_t cmd_id, bool start);
  604. QDF_STATUS hif_send_head(struct hif_opaque_softc *hif_ctx, uint8_t PipeID,
  605. uint32_t transferID, uint32_t nbytes,
  606. qdf_nbuf_t wbuf, uint32_t data_attr);
  607. void hif_send_complete_check(struct hif_opaque_softc *hif_ctx, uint8_t PipeID,
  608. int force);
  609. void hif_shut_down_device(struct hif_opaque_softc *hif_ctx);
  610. void hif_get_default_pipe(struct hif_opaque_softc *hif_ctx, uint8_t *ULPipe,
  611. uint8_t *DLPipe);
  612. int hif_map_service_to_pipe(struct hif_opaque_softc *hif_ctx, uint16_t svc_id,
  613. uint8_t *ul_pipe, uint8_t *dl_pipe, int *ul_is_polled,
  614. int *dl_is_polled);
  615. uint16_t
  616. hif_get_free_queue_number(struct hif_opaque_softc *hif_ctx, uint8_t PipeID);
  617. void *hif_get_targetdef(struct hif_opaque_softc *hif_ctx);
  618. uint32_t hif_hia_item_address(uint32_t target_type, uint32_t item_offset);
  619. void hif_set_target_sleep(struct hif_opaque_softc *hif_ctx, bool sleep_ok,
  620. bool wait_for_it);
  621. int hif_check_fw_reg(struct hif_opaque_softc *hif_ctx);
  622. #ifndef HIF_PCI
  623. static inline int hif_check_soc_status(struct hif_opaque_softc *hif_ctx)
  624. {
  625. return 0;
  626. }
  627. #else
  628. int hif_check_soc_status(struct hif_opaque_softc *hif_ctx);
  629. #endif
  630. void hif_get_hw_info(struct hif_opaque_softc *hif_ctx, u32 *version,
  631. u32 *revision, const char **target_name);
  632. #ifdef RECEIVE_OFFLOAD
  633. /**
  634. * hif_offld_flush_cb_register() - Register the offld flush callback
  635. * @scn: HIF opaque context
  636. * @offld_flush_handler: Flush callback is either ol_flush, incase of rx_thread
  637. * Or GRO/LRO flush when RxThread is not enabled. Called
  638. * with corresponding context for flush.
  639. * Return: None
  640. */
  641. void hif_offld_flush_cb_register(struct hif_opaque_softc *scn,
  642. void (offld_flush_handler)(void *ol_ctx));
  643. /**
  644. * hif_offld_flush_cb_deregister() - deRegister the offld flush callback
  645. * @scn: HIF opaque context
  646. *
  647. * Return: None
  648. */
  649. void hif_offld_flush_cb_deregister(struct hif_opaque_softc *scn);
  650. #endif
  651. #ifdef WLAN_FEATURE_RX_SOFTIRQ_TIME_LIMIT
  652. /**
  653. * hif_exec_should_yield() - Check if hif napi context should yield
  654. * @hif_ctx - HIF opaque context
  655. * @grp_id - grp_id of the napi for which check needs to be done
  656. *
  657. * The function uses grp_id to look for NAPI and checks if NAPI needs to
  658. * yield. HIF_EXT_GROUP_MAX_YIELD_DURATION_NS is the duration used for
  659. * yield decision.
  660. *
  661. * Return: true if NAPI needs to yield, else false
  662. */
  663. bool hif_exec_should_yield(struct hif_opaque_softc *hif_ctx, uint grp_id);
  664. #else
  665. static inline bool hif_exec_should_yield(struct hif_opaque_softc *hif_ctx,
  666. uint grp_id)
  667. {
  668. return false;
  669. }
  670. #endif
  671. void hif_disable_isr(struct hif_opaque_softc *hif_ctx);
  672. void hif_reset_soc(struct hif_opaque_softc *hif_ctx);
  673. void hif_save_htc_htt_config_endpoint(struct hif_opaque_softc *hif_ctx,
  674. int htc_htt_tx_endpoint);
  675. struct hif_opaque_softc *hif_open(qdf_device_t qdf_ctx, uint32_t mode,
  676. enum qdf_bus_type bus_type,
  677. struct hif_driver_state_callbacks *cbk);
  678. void hif_close(struct hif_opaque_softc *hif_ctx);
  679. QDF_STATUS hif_enable(struct hif_opaque_softc *hif_ctx, struct device *dev,
  680. void *bdev, const struct hif_bus_id *bid,
  681. enum qdf_bus_type bus_type,
  682. enum hif_enable_type type);
  683. void hif_disable(struct hif_opaque_softc *hif_ctx, enum hif_disable_type type);
  684. void hif_display_stats(struct hif_opaque_softc *hif_ctx);
  685. void hif_clear_stats(struct hif_opaque_softc *hif_ctx);
  686. #ifdef FEATURE_RUNTIME_PM
  687. struct hif_pm_runtime_lock;
  688. void hif_fastpath_resume(struct hif_opaque_softc *hif_ctx);
  689. int hif_pm_runtime_get(struct hif_opaque_softc *hif_ctx);
  690. void hif_pm_runtime_get_noresume(struct hif_opaque_softc *hif_ctx);
  691. int hif_pm_runtime_put(struct hif_opaque_softc *hif_ctx);
  692. int hif_runtime_lock_init(qdf_runtime_lock_t *lock, const char *name);
  693. void hif_runtime_lock_deinit(struct hif_opaque_softc *hif_ctx,
  694. struct hif_pm_runtime_lock *lock);
  695. int hif_pm_runtime_prevent_suspend(struct hif_opaque_softc *ol_sc,
  696. struct hif_pm_runtime_lock *lock);
  697. int hif_pm_runtime_allow_suspend(struct hif_opaque_softc *ol_sc,
  698. struct hif_pm_runtime_lock *lock);
  699. int hif_pm_runtime_prevent_suspend_timeout(struct hif_opaque_softc *ol_sc,
  700. struct hif_pm_runtime_lock *lock, unsigned int delay);
  701. #else
  702. struct hif_pm_runtime_lock {
  703. const char *name;
  704. };
  705. static inline void hif_fastpath_resume(struct hif_opaque_softc *hif_ctx) {}
  706. static inline void hif_pm_runtime_get_noresume(struct hif_opaque_softc *hif_ctx)
  707. {}
  708. static inline int hif_pm_runtime_get(struct hif_opaque_softc *hif_ctx)
  709. { return 0; }
  710. static inline int hif_pm_runtime_put(struct hif_opaque_softc *hif_ctx)
  711. { return 0; }
  712. static inline int hif_runtime_lock_init(qdf_runtime_lock_t *lock,
  713. const char *name)
  714. { return 0; }
  715. static inline void
  716. hif_runtime_lock_deinit(struct hif_opaque_softc *hif_ctx,
  717. struct hif_pm_runtime_lock *lock) {}
  718. static inline int hif_pm_runtime_prevent_suspend(struct hif_opaque_softc *ol_sc,
  719. struct hif_pm_runtime_lock *lock)
  720. { return 0; }
  721. static inline int hif_pm_runtime_allow_suspend(struct hif_opaque_softc *ol_sc,
  722. struct hif_pm_runtime_lock *lock)
  723. { return 0; }
  724. static inline int
  725. hif_pm_runtime_prevent_suspend_timeout(struct hif_opaque_softc *ol_sc,
  726. struct hif_pm_runtime_lock *lock, unsigned int delay)
  727. { return 0; }
  728. #endif
  729. void hif_enable_power_management(struct hif_opaque_softc *hif_ctx,
  730. bool is_packet_log_enabled);
  731. void hif_disable_power_management(struct hif_opaque_softc *hif_ctx);
  732. void hif_vote_link_down(struct hif_opaque_softc *hif_ctx);
  733. void hif_vote_link_up(struct hif_opaque_softc *hif_ctx);
  734. bool hif_can_suspend_link(struct hif_opaque_softc *hif_ctx);
  735. #ifdef IPA_OFFLOAD
  736. /**
  737. * hif_get_ipa_hw_type() - get IPA hw type
  738. *
  739. * This API return the IPA hw type.
  740. *
  741. * Return: IPA hw type
  742. */
  743. static inline
  744. enum ipa_hw_type hif_get_ipa_hw_type(void)
  745. {
  746. return ipa_get_hw_type();
  747. }
  748. /**
  749. * hif_get_ipa_present() - get IPA hw status
  750. *
  751. * This API return the IPA hw status.
  752. *
  753. * Return: true if IPA is present or false otherwise
  754. */
  755. static inline
  756. bool hif_get_ipa_present(void)
  757. {
  758. if (ipa_uc_reg_rdyCB(NULL) != -EPERM)
  759. return true;
  760. else
  761. return false;
  762. }
  763. #endif
  764. int hif_bus_resume(struct hif_opaque_softc *hif_ctx);
  765. /**
  766. * hif_bus_ealry_suspend() - stop non wmi tx traffic
  767. * @context: hif context
  768. */
  769. int hif_bus_early_suspend(struct hif_opaque_softc *hif_ctx);
  770. /**
  771. * hif_bus_late_resume() - resume non wmi traffic
  772. * @context: hif context
  773. */
  774. int hif_bus_late_resume(struct hif_opaque_softc *hif_ctx);
  775. int hif_bus_suspend(struct hif_opaque_softc *hif_ctx);
  776. int hif_bus_resume_noirq(struct hif_opaque_softc *hif_ctx);
  777. int hif_bus_suspend_noirq(struct hif_opaque_softc *hif_ctx);
  778. /**
  779. * hif_apps_irqs_enable() - Enables all irqs from the APPS side
  780. * @hif_ctx: an opaque HIF handle to use
  781. *
  782. * As opposed to the standard hif_irq_enable, this function always applies to
  783. * the APPS side kernel interrupt handling.
  784. *
  785. * Return: errno
  786. */
  787. int hif_apps_irqs_enable(struct hif_opaque_softc *hif_ctx);
  788. /**
  789. * hif_apps_irqs_disable() - Disables all irqs from the APPS side
  790. * @hif_ctx: an opaque HIF handle to use
  791. *
  792. * As opposed to the standard hif_irq_disable, this function always applies to
  793. * the APPS side kernel interrupt handling.
  794. *
  795. * Return: errno
  796. */
  797. int hif_apps_irqs_disable(struct hif_opaque_softc *hif_ctx);
  798. /**
  799. * hif_apps_wake_irq_enable() - Enables the wake irq from the APPS side
  800. * @hif_ctx: an opaque HIF handle to use
  801. *
  802. * As opposed to the standard hif_irq_enable, this function always applies to
  803. * the APPS side kernel interrupt handling.
  804. *
  805. * Return: errno
  806. */
  807. int hif_apps_wake_irq_enable(struct hif_opaque_softc *hif_ctx);
  808. /**
  809. * hif_apps_wake_irq_disable() - Disables the wake irq from the APPS side
  810. * @hif_ctx: an opaque HIF handle to use
  811. *
  812. * As opposed to the standard hif_irq_disable, this function always applies to
  813. * the APPS side kernel interrupt handling.
  814. *
  815. * Return: errno
  816. */
  817. int hif_apps_wake_irq_disable(struct hif_opaque_softc *hif_ctx);
  818. #ifdef FEATURE_RUNTIME_PM
  819. int hif_pre_runtime_suspend(struct hif_opaque_softc *hif_ctx);
  820. void hif_pre_runtime_resume(struct hif_opaque_softc *hif_ctx);
  821. int hif_runtime_suspend(struct hif_opaque_softc *hif_ctx);
  822. int hif_runtime_resume(struct hif_opaque_softc *hif_ctx);
  823. void hif_process_runtime_suspend_success(struct hif_opaque_softc *hif_ctx);
  824. void hif_process_runtime_suspend_failure(struct hif_opaque_softc *hif_ctx);
  825. void hif_process_runtime_resume_success(struct hif_opaque_softc *hif_ctx);
  826. #endif
  827. int hif_get_irq_num(struct hif_opaque_softc *scn, int *irq, uint32_t size);
  828. int hif_dump_registers(struct hif_opaque_softc *scn);
  829. int ol_copy_ramdump(struct hif_opaque_softc *scn);
  830. void hif_crash_shutdown(struct hif_opaque_softc *hif_ctx);
  831. void hif_get_hw_info(struct hif_opaque_softc *hif_ctx, u32 *version,
  832. u32 *revision, const char **target_name);
  833. enum qdf_bus_type hif_get_bus_type(struct hif_opaque_softc *hif_hdl);
  834. struct hif_target_info *hif_get_target_info_handle(struct hif_opaque_softc *
  835. scn);
  836. struct hif_config_info *hif_get_ini_handle(struct hif_opaque_softc *hif_ctx);
  837. struct ramdump_info *hif_get_ramdump_ctx(struct hif_opaque_softc *hif_ctx);
  838. enum hif_target_status hif_get_target_status(struct hif_opaque_softc *hif_ctx);
  839. void hif_set_target_status(struct hif_opaque_softc *hif_ctx, enum
  840. hif_target_status);
  841. void hif_init_ini_config(struct hif_opaque_softc *hif_ctx,
  842. struct hif_config_info *cfg);
  843. void hif_update_tx_ring(struct hif_opaque_softc *osc, u_int32_t num_htt_cmpls);
  844. qdf_nbuf_t hif_batch_send(struct hif_opaque_softc *osc, qdf_nbuf_t msdu,
  845. uint32_t transfer_id, u_int32_t len, uint32_t sendhead);
  846. int hif_send_single(struct hif_opaque_softc *osc, qdf_nbuf_t msdu, uint32_t
  847. transfer_id, u_int32_t len);
  848. int hif_send_fast(struct hif_opaque_softc *osc, qdf_nbuf_t nbuf,
  849. uint32_t transfer_id, uint32_t download_len);
  850. void hif_pkt_dl_len_set(void *hif_sc, unsigned int pkt_download_len);
  851. void hif_ce_war_disable(void);
  852. void hif_ce_war_enable(void);
  853. void hif_disable_interrupt(struct hif_opaque_softc *osc, uint32_t pipe_num);
  854. #ifdef QCA_NSS_WIFI_OFFLOAD_SUPPORT
  855. struct hif_pipe_addl_info *hif_get_addl_pipe_info(struct hif_opaque_softc *osc,
  856. struct hif_pipe_addl_info *hif_info, uint32_t pipe_number);
  857. uint32_t hif_set_nss_wifiol_mode(struct hif_opaque_softc *osc,
  858. uint32_t pipe_num);
  859. int32_t hif_get_nss_wifiol_bypass_nw_process(struct hif_opaque_softc *osc);
  860. #endif /* QCA_NSS_WIFI_OFFLOAD_SUPPORT */
  861. void hif_set_bundle_mode(struct hif_opaque_softc *hif_ctx, bool enabled,
  862. int rx_bundle_cnt);
  863. int hif_bus_reset_resume(struct hif_opaque_softc *hif_ctx);
  864. void hif_set_attribute(struct hif_opaque_softc *osc, uint8_t hif_attrib);
  865. void *hif_get_lro_info(int ctx_id, struct hif_opaque_softc *hif_hdl);
  866. enum hif_exec_type {
  867. HIF_EXEC_NAPI_TYPE,
  868. HIF_EXEC_TASKLET_TYPE,
  869. };
  870. typedef uint32_t (*ext_intr_handler)(void *, uint32_t);
  871. /**
  872. * hif_get_int_ctx_irq_num() - retrieve an irq num for an interrupt context id
  873. * @softc: hif opaque context owning the exec context
  874. * @id: the id of the interrupt context
  875. *
  876. * Return: IRQ number of the first (zero'th) IRQ within the interrupt context ID
  877. * 'id' registered with the OS
  878. */
  879. int32_t hif_get_int_ctx_irq_num(struct hif_opaque_softc *softc,
  880. uint8_t id);
  881. uint32_t hif_configure_ext_group_interrupts(struct hif_opaque_softc *hif_ctx);
  882. uint32_t hif_register_ext_group(struct hif_opaque_softc *hif_ctx,
  883. uint32_t numirq, uint32_t irq[], ext_intr_handler handler,
  884. void *cb_ctx, const char *context_name,
  885. enum hif_exec_type type, uint32_t scale);
  886. void hif_deregister_exec_group(struct hif_opaque_softc *hif_ctx,
  887. const char *context_name);
  888. void hif_update_pipe_callback(struct hif_opaque_softc *osc,
  889. u_int8_t pipeid,
  890. struct hif_msg_callbacks *callbacks);
  891. /**
  892. * hif_print_napi_stats() - Display HIF NAPI stats
  893. * @hif_ctx - HIF opaque context
  894. *
  895. * Return: None
  896. */
  897. void hif_print_napi_stats(struct hif_opaque_softc *hif_ctx);
  898. /* hif_clear_napi_stats() - function clears the stats of the
  899. * latency when called.
  900. * @hif_ctx - the HIF context to assign the callback to
  901. *
  902. * Return: None
  903. */
  904. void hif_clear_napi_stats(struct hif_opaque_softc *hif_ctx);
  905. #ifdef __cplusplus
  906. }
  907. #endif
  908. void *hif_get_dev_ba(struct hif_opaque_softc *hif_handle);
  909. /**
  910. * hif_set_initial_wakeup_cb() - set the initial wakeup event handler function
  911. * @hif_ctx - the HIF context to assign the callback to
  912. * @callback - the callback to assign
  913. * @priv - the private data to pass to the callback when invoked
  914. *
  915. * Return: None
  916. */
  917. void hif_set_initial_wakeup_cb(struct hif_opaque_softc *hif_ctx,
  918. void (*callback)(void *),
  919. void *priv);
  920. /*
  921. * Note: For MCL, #if defined (HIF_CONFIG_SLUB_DEBUG_ON) needs to be checked
  922. * for defined here
  923. */
  924. #if defined(HIF_CONFIG_SLUB_DEBUG_ON) || defined(HIF_CE_DEBUG_DATA_BUF)
  925. ssize_t hif_dump_desc_trace_buf(struct device *dev,
  926. struct device_attribute *attr, char *buf);
  927. ssize_t hif_input_desc_trace_buf_index(struct hif_softc *scn,
  928. const char *buf, size_t size);
  929. ssize_t hif_ce_en_desc_hist(struct hif_softc *scn,
  930. const char *buf, size_t size);
  931. ssize_t hif_disp_ce_enable_desc_data_hist(struct hif_softc *scn, char *buf);
  932. ssize_t hif_dump_desc_event(struct hif_softc *scn, char *buf);
  933. #endif/*#if defined(HIF_CONFIG_SLUB_DEBUG_ON)||defined(HIF_CE_DEBUG_DATA_BUF)*/
  934. /**
  935. * hif_set_ce_service_max_yield_time() - sets CE service max yield time
  936. * @hif: hif context
  937. * @ce_service_max_yield_time: CE service max yield time to set
  938. *
  939. * This API storess CE service max yield time in hif context based
  940. * on ini value.
  941. *
  942. * Return: void
  943. */
  944. void hif_set_ce_service_max_yield_time(struct hif_opaque_softc *hif,
  945. uint32_t ce_service_max_yield_time);
  946. /**
  947. * hif_get_ce_service_max_yield_time() - get CE service max yield time
  948. * @hif: hif context
  949. *
  950. * This API returns CE service max yield time.
  951. *
  952. * Return: CE service max yield time
  953. */
  954. unsigned long long
  955. hif_get_ce_service_max_yield_time(struct hif_opaque_softc *hif);
  956. /**
  957. * hif_set_ce_service_max_rx_ind_flush() - sets CE service max rx ind flush
  958. * @hif: hif context
  959. * @ce_service_max_rx_ind_flush: CE service max rx ind flush to set
  960. *
  961. * This API stores CE service max rx ind flush in hif context based
  962. * on ini value.
  963. *
  964. * Return: void
  965. */
  966. void hif_set_ce_service_max_rx_ind_flush(struct hif_opaque_softc *hif,
  967. uint8_t ce_service_max_rx_ind_flush);
  968. #ifdef OL_ATH_SMART_LOGGING
  969. /*
  970. * hif_log_ce_dump() - Copy all the CE DEST ring to buf
  971. * @scn : HIF handler
  972. * @buf_cur: Current pointer in ring buffer
  973. * @buf_init:Start of the ring buffer
  974. * @buf_sz: Size of the ring buffer
  975. * @ce: Copy Engine id
  976. * @skb_sz: Max size of the SKB buffer to be copied
  977. *
  978. * Calls the respective function to dump all the CE SRC/DEST ring descriptors
  979. * and buffers pointed by them in to the given buf
  980. *
  981. * Return: Current pointer in ring buffer
  982. */
  983. uint8_t *hif_log_dump_ce(struct hif_softc *scn, uint8_t *buf_cur,
  984. uint8_t *buf_init, uint32_t buf_sz,
  985. uint32_t ce, uint32_t skb_sz);
  986. #endif /* OL_ATH_SMART_LOGGING */
  987. #endif /* _HIF_H_ */