hif.h 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082
  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_request_resume(struct hif_opaque_softc *hif_ctx);
  690. int hif_pm_runtime_get(struct hif_opaque_softc *hif_ctx);
  691. void hif_pm_runtime_get_noresume(struct hif_opaque_softc *hif_ctx);
  692. int hif_pm_runtime_put(struct hif_opaque_softc *hif_ctx);
  693. void hif_pm_runtime_mark_last_busy(struct hif_opaque_softc *hif_ctx);
  694. int hif_runtime_lock_init(qdf_runtime_lock_t *lock, const char *name);
  695. void hif_runtime_lock_deinit(struct hif_opaque_softc *hif_ctx,
  696. struct hif_pm_runtime_lock *lock);
  697. int hif_pm_runtime_prevent_suspend(struct hif_opaque_softc *ol_sc,
  698. struct hif_pm_runtime_lock *lock);
  699. int hif_pm_runtime_allow_suspend(struct hif_opaque_softc *ol_sc,
  700. struct hif_pm_runtime_lock *lock);
  701. int hif_pm_runtime_prevent_suspend_timeout(struct hif_opaque_softc *ol_sc,
  702. struct hif_pm_runtime_lock *lock, unsigned int delay);
  703. #else
  704. struct hif_pm_runtime_lock {
  705. const char *name;
  706. };
  707. static inline void hif_fastpath_resume(struct hif_opaque_softc *hif_ctx) {}
  708. static inline int
  709. hif_pm_runtime_request_resume(struct hif_opaque_softc *hif_ctx)
  710. { return 0; }
  711. static inline void hif_pm_runtime_get_noresume(struct hif_opaque_softc *hif_ctx)
  712. {}
  713. static inline int hif_pm_runtime_get(struct hif_opaque_softc *hif_ctx)
  714. { return 0; }
  715. static inline int hif_pm_runtime_put(struct hif_opaque_softc *hif_ctx)
  716. { return 0; }
  717. static inline void
  718. hif_pm_runtime_mark_last_busy(struct hif_opaque_softc *hif_ctx) {};
  719. static inline int hif_runtime_lock_init(qdf_runtime_lock_t *lock,
  720. const char *name)
  721. { return 0; }
  722. static inline void
  723. hif_runtime_lock_deinit(struct hif_opaque_softc *hif_ctx,
  724. struct hif_pm_runtime_lock *lock) {}
  725. static inline int hif_pm_runtime_prevent_suspend(struct hif_opaque_softc *ol_sc,
  726. struct hif_pm_runtime_lock *lock)
  727. { return 0; }
  728. static inline int hif_pm_runtime_allow_suspend(struct hif_opaque_softc *ol_sc,
  729. struct hif_pm_runtime_lock *lock)
  730. { return 0; }
  731. static inline int
  732. hif_pm_runtime_prevent_suspend_timeout(struct hif_opaque_softc *ol_sc,
  733. struct hif_pm_runtime_lock *lock, unsigned int delay)
  734. { return 0; }
  735. #endif
  736. void hif_enable_power_management(struct hif_opaque_softc *hif_ctx,
  737. bool is_packet_log_enabled);
  738. void hif_disable_power_management(struct hif_opaque_softc *hif_ctx);
  739. void hif_vote_link_down(struct hif_opaque_softc *hif_ctx);
  740. void hif_vote_link_up(struct hif_opaque_softc *hif_ctx);
  741. bool hif_can_suspend_link(struct hif_opaque_softc *hif_ctx);
  742. #ifdef IPA_OFFLOAD
  743. /**
  744. * hif_get_ipa_hw_type() - get IPA hw type
  745. *
  746. * This API return the IPA hw type.
  747. *
  748. * Return: IPA hw type
  749. */
  750. static inline
  751. enum ipa_hw_type hif_get_ipa_hw_type(void)
  752. {
  753. return ipa_get_hw_type();
  754. }
  755. /**
  756. * hif_get_ipa_present() - get IPA hw status
  757. *
  758. * This API return the IPA hw status.
  759. *
  760. * Return: true if IPA is present or false otherwise
  761. */
  762. static inline
  763. bool hif_get_ipa_present(void)
  764. {
  765. if (ipa_uc_reg_rdyCB(NULL) != -EPERM)
  766. return true;
  767. else
  768. return false;
  769. }
  770. #endif
  771. int hif_bus_resume(struct hif_opaque_softc *hif_ctx);
  772. /**
  773. * hif_bus_ealry_suspend() - stop non wmi tx traffic
  774. * @context: hif context
  775. */
  776. int hif_bus_early_suspend(struct hif_opaque_softc *hif_ctx);
  777. /**
  778. * hif_bus_late_resume() - resume non wmi traffic
  779. * @context: hif context
  780. */
  781. int hif_bus_late_resume(struct hif_opaque_softc *hif_ctx);
  782. int hif_bus_suspend(struct hif_opaque_softc *hif_ctx);
  783. int hif_bus_resume_noirq(struct hif_opaque_softc *hif_ctx);
  784. int hif_bus_suspend_noirq(struct hif_opaque_softc *hif_ctx);
  785. /**
  786. * hif_apps_irqs_enable() - Enables all irqs from the APPS side
  787. * @hif_ctx: an opaque HIF handle to use
  788. *
  789. * As opposed to the standard hif_irq_enable, this function always applies to
  790. * the APPS side kernel interrupt handling.
  791. *
  792. * Return: errno
  793. */
  794. int hif_apps_irqs_enable(struct hif_opaque_softc *hif_ctx);
  795. /**
  796. * hif_apps_irqs_disable() - Disables all irqs from the APPS side
  797. * @hif_ctx: an opaque HIF handle to use
  798. *
  799. * As opposed to the standard hif_irq_disable, this function always applies to
  800. * the APPS side kernel interrupt handling.
  801. *
  802. * Return: errno
  803. */
  804. int hif_apps_irqs_disable(struct hif_opaque_softc *hif_ctx);
  805. /**
  806. * hif_apps_wake_irq_enable() - Enables the wake irq from the APPS side
  807. * @hif_ctx: an opaque HIF handle to use
  808. *
  809. * As opposed to the standard hif_irq_enable, this function always applies to
  810. * the APPS side kernel interrupt handling.
  811. *
  812. * Return: errno
  813. */
  814. int hif_apps_wake_irq_enable(struct hif_opaque_softc *hif_ctx);
  815. /**
  816. * hif_apps_wake_irq_disable() - Disables the wake irq from the APPS side
  817. * @hif_ctx: an opaque HIF handle to use
  818. *
  819. * As opposed to the standard hif_irq_disable, this function always applies to
  820. * the APPS side kernel interrupt handling.
  821. *
  822. * Return: errno
  823. */
  824. int hif_apps_wake_irq_disable(struct hif_opaque_softc *hif_ctx);
  825. #ifdef FEATURE_RUNTIME_PM
  826. int hif_pre_runtime_suspend(struct hif_opaque_softc *hif_ctx);
  827. void hif_pre_runtime_resume(struct hif_opaque_softc *hif_ctx);
  828. int hif_runtime_suspend(struct hif_opaque_softc *hif_ctx);
  829. int hif_runtime_resume(struct hif_opaque_softc *hif_ctx);
  830. void hif_process_runtime_suspend_success(struct hif_opaque_softc *hif_ctx);
  831. void hif_process_runtime_suspend_failure(struct hif_opaque_softc *hif_ctx);
  832. void hif_process_runtime_resume_success(struct hif_opaque_softc *hif_ctx);
  833. #endif
  834. int hif_get_irq_num(struct hif_opaque_softc *scn, int *irq, uint32_t size);
  835. int hif_dump_registers(struct hif_opaque_softc *scn);
  836. int ol_copy_ramdump(struct hif_opaque_softc *scn);
  837. void hif_crash_shutdown(struct hif_opaque_softc *hif_ctx);
  838. void hif_get_hw_info(struct hif_opaque_softc *hif_ctx, u32 *version,
  839. u32 *revision, const char **target_name);
  840. enum qdf_bus_type hif_get_bus_type(struct hif_opaque_softc *hif_hdl);
  841. struct hif_target_info *hif_get_target_info_handle(struct hif_opaque_softc *
  842. scn);
  843. struct hif_config_info *hif_get_ini_handle(struct hif_opaque_softc *hif_ctx);
  844. struct ramdump_info *hif_get_ramdump_ctx(struct hif_opaque_softc *hif_ctx);
  845. enum hif_target_status hif_get_target_status(struct hif_opaque_softc *hif_ctx);
  846. void hif_set_target_status(struct hif_opaque_softc *hif_ctx, enum
  847. hif_target_status);
  848. void hif_init_ini_config(struct hif_opaque_softc *hif_ctx,
  849. struct hif_config_info *cfg);
  850. void hif_update_tx_ring(struct hif_opaque_softc *osc, u_int32_t num_htt_cmpls);
  851. qdf_nbuf_t hif_batch_send(struct hif_opaque_softc *osc, qdf_nbuf_t msdu,
  852. uint32_t transfer_id, u_int32_t len, uint32_t sendhead);
  853. int hif_send_single(struct hif_opaque_softc *osc, qdf_nbuf_t msdu, uint32_t
  854. transfer_id, u_int32_t len);
  855. int hif_send_fast(struct hif_opaque_softc *osc, qdf_nbuf_t nbuf,
  856. uint32_t transfer_id, uint32_t download_len);
  857. void hif_pkt_dl_len_set(void *hif_sc, unsigned int pkt_download_len);
  858. void hif_ce_war_disable(void);
  859. void hif_ce_war_enable(void);
  860. void hif_disable_interrupt(struct hif_opaque_softc *osc, uint32_t pipe_num);
  861. #ifdef QCA_NSS_WIFI_OFFLOAD_SUPPORT
  862. struct hif_pipe_addl_info *hif_get_addl_pipe_info(struct hif_opaque_softc *osc,
  863. struct hif_pipe_addl_info *hif_info, uint32_t pipe_number);
  864. uint32_t hif_set_nss_wifiol_mode(struct hif_opaque_softc *osc,
  865. uint32_t pipe_num);
  866. int32_t hif_get_nss_wifiol_bypass_nw_process(struct hif_opaque_softc *osc);
  867. #endif /* QCA_NSS_WIFI_OFFLOAD_SUPPORT */
  868. void hif_set_bundle_mode(struct hif_opaque_softc *hif_ctx, bool enabled,
  869. int rx_bundle_cnt);
  870. int hif_bus_reset_resume(struct hif_opaque_softc *hif_ctx);
  871. void hif_set_attribute(struct hif_opaque_softc *osc, uint8_t hif_attrib);
  872. void *hif_get_lro_info(int ctx_id, struct hif_opaque_softc *hif_hdl);
  873. enum hif_exec_type {
  874. HIF_EXEC_NAPI_TYPE,
  875. HIF_EXEC_TASKLET_TYPE,
  876. };
  877. typedef uint32_t (*ext_intr_handler)(void *, uint32_t);
  878. /**
  879. * hif_get_int_ctx_irq_num() - retrieve an irq num for an interrupt context id
  880. * @softc: hif opaque context owning the exec context
  881. * @id: the id of the interrupt context
  882. *
  883. * Return: IRQ number of the first (zero'th) IRQ within the interrupt context ID
  884. * 'id' registered with the OS
  885. */
  886. int32_t hif_get_int_ctx_irq_num(struct hif_opaque_softc *softc,
  887. uint8_t id);
  888. uint32_t hif_configure_ext_group_interrupts(struct hif_opaque_softc *hif_ctx);
  889. uint32_t hif_register_ext_group(struct hif_opaque_softc *hif_ctx,
  890. uint32_t numirq, uint32_t irq[], ext_intr_handler handler,
  891. void *cb_ctx, const char *context_name,
  892. enum hif_exec_type type, uint32_t scale);
  893. void hif_deregister_exec_group(struct hif_opaque_softc *hif_ctx,
  894. const char *context_name);
  895. void hif_update_pipe_callback(struct hif_opaque_softc *osc,
  896. u_int8_t pipeid,
  897. struct hif_msg_callbacks *callbacks);
  898. /**
  899. * hif_print_napi_stats() - Display HIF NAPI stats
  900. * @hif_ctx - HIF opaque context
  901. *
  902. * Return: None
  903. */
  904. void hif_print_napi_stats(struct hif_opaque_softc *hif_ctx);
  905. /* hif_clear_napi_stats() - function clears the stats of the
  906. * latency when called.
  907. * @hif_ctx - the HIF context to assign the callback to
  908. *
  909. * Return: None
  910. */
  911. void hif_clear_napi_stats(struct hif_opaque_softc *hif_ctx);
  912. #ifdef __cplusplus
  913. }
  914. #endif
  915. void *hif_get_dev_ba(struct hif_opaque_softc *hif_handle);
  916. /**
  917. * hif_set_initial_wakeup_cb() - set the initial wakeup event handler function
  918. * @hif_ctx - the HIF context to assign the callback to
  919. * @callback - the callback to assign
  920. * @priv - the private data to pass to the callback when invoked
  921. *
  922. * Return: None
  923. */
  924. void hif_set_initial_wakeup_cb(struct hif_opaque_softc *hif_ctx,
  925. void (*callback)(void *),
  926. void *priv);
  927. /*
  928. * Note: For MCL, #if defined (HIF_CONFIG_SLUB_DEBUG_ON) needs to be checked
  929. * for defined here
  930. */
  931. #if defined(HIF_CONFIG_SLUB_DEBUG_ON) || defined(HIF_CE_DEBUG_DATA_BUF)
  932. ssize_t hif_dump_desc_trace_buf(struct device *dev,
  933. struct device_attribute *attr, char *buf);
  934. ssize_t hif_input_desc_trace_buf_index(struct hif_softc *scn,
  935. const char *buf, size_t size);
  936. ssize_t hif_ce_en_desc_hist(struct hif_softc *scn,
  937. const char *buf, size_t size);
  938. ssize_t hif_disp_ce_enable_desc_data_hist(struct hif_softc *scn, char *buf);
  939. ssize_t hif_dump_desc_event(struct hif_softc *scn, char *buf);
  940. #endif/*#if defined(HIF_CONFIG_SLUB_DEBUG_ON)||defined(HIF_CE_DEBUG_DATA_BUF)*/
  941. /**
  942. * hif_set_ce_service_max_yield_time() - sets CE service max yield time
  943. * @hif: hif context
  944. * @ce_service_max_yield_time: CE service max yield time to set
  945. *
  946. * This API storess CE service max yield time in hif context based
  947. * on ini value.
  948. *
  949. * Return: void
  950. */
  951. void hif_set_ce_service_max_yield_time(struct hif_opaque_softc *hif,
  952. uint32_t ce_service_max_yield_time);
  953. /**
  954. * hif_get_ce_service_max_yield_time() - get CE service max yield time
  955. * @hif: hif context
  956. *
  957. * This API returns CE service max yield time.
  958. *
  959. * Return: CE service max yield time
  960. */
  961. unsigned long long
  962. hif_get_ce_service_max_yield_time(struct hif_opaque_softc *hif);
  963. /**
  964. * hif_set_ce_service_max_rx_ind_flush() - sets CE service max rx ind flush
  965. * @hif: hif context
  966. * @ce_service_max_rx_ind_flush: CE service max rx ind flush to set
  967. *
  968. * This API stores CE service max rx ind flush in hif context based
  969. * on ini value.
  970. *
  971. * Return: void
  972. */
  973. void hif_set_ce_service_max_rx_ind_flush(struct hif_opaque_softc *hif,
  974. uint8_t ce_service_max_rx_ind_flush);
  975. #ifdef OL_ATH_SMART_LOGGING
  976. /*
  977. * hif_log_ce_dump() - Copy all the CE DEST ring to buf
  978. * @scn : HIF handler
  979. * @buf_cur: Current pointer in ring buffer
  980. * @buf_init:Start of the ring buffer
  981. * @buf_sz: Size of the ring buffer
  982. * @ce: Copy Engine id
  983. * @skb_sz: Max size of the SKB buffer to be copied
  984. *
  985. * Calls the respective function to dump all the CE SRC/DEST ring descriptors
  986. * and buffers pointed by them in to the given buf
  987. *
  988. * Return: Current pointer in ring buffer
  989. */
  990. uint8_t *hif_log_dump_ce(struct hif_softc *scn, uint8_t *buf_cur,
  991. uint8_t *buf_init, uint32_t buf_sz,
  992. uint32_t ce, uint32_t skb_sz);
  993. #endif /* OL_ATH_SMART_LOGGING */
  994. #endif /* _HIF_H_ */