hif.h 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578
  1. /*
  2. * Copyright (c) 2013-2020 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. #include "cfg_ucfg_api.h"
  39. #include "qdf_dev.h"
  40. #define ENABLE_MBOX_DUMMY_SPACE_FEATURE 1
  41. typedef void __iomem *A_target_id_t;
  42. typedef void *hif_handle_t;
  43. #define HIF_TYPE_AR6002 2
  44. #define HIF_TYPE_AR6003 3
  45. #define HIF_TYPE_AR6004 5
  46. #define HIF_TYPE_AR9888 6
  47. #define HIF_TYPE_AR6320 7
  48. #define HIF_TYPE_AR6320V2 8
  49. /* For attaching Peregrine 2.0 board host_reg_tbl only */
  50. #define HIF_TYPE_AR9888V2 9
  51. #define HIF_TYPE_ADRASTEA 10
  52. #define HIF_TYPE_AR900B 11
  53. #define HIF_TYPE_QCA9984 12
  54. #define HIF_TYPE_IPQ4019 13
  55. #define HIF_TYPE_QCA9888 14
  56. #define HIF_TYPE_QCA8074 15
  57. #define HIF_TYPE_QCA6290 16
  58. #define HIF_TYPE_QCN7605 17
  59. #define HIF_TYPE_QCA6390 18
  60. #define HIF_TYPE_QCA8074V2 19
  61. #define HIF_TYPE_QCA6018 20
  62. #define HIF_TYPE_QCN9000 21
  63. #define HIF_TYPE_QCA6490 22
  64. #define HIF_TYPE_QCA6750 23
  65. #define HIF_TYPE_QCA5018 24
  66. #define DMA_COHERENT_MASK_DEFAULT 37
  67. #ifdef IPA_OFFLOAD
  68. #define DMA_COHERENT_MASK_BELOW_IPA_VER_3 32
  69. #endif
  70. /* enum hif_ic_irq - enum defining integrated chip irq numbers
  71. * defining irq nubers that can be used by external modules like datapath
  72. */
  73. enum hif_ic_irq {
  74. host2wbm_desc_feed = 16,
  75. host2reo_re_injection,
  76. host2reo_command,
  77. host2rxdma_monitor_ring3,
  78. host2rxdma_monitor_ring2,
  79. host2rxdma_monitor_ring1,
  80. reo2host_exception,
  81. wbm2host_rx_release,
  82. reo2host_status,
  83. reo2host_destination_ring4,
  84. reo2host_destination_ring3,
  85. reo2host_destination_ring2,
  86. reo2host_destination_ring1,
  87. rxdma2host_monitor_destination_mac3,
  88. rxdma2host_monitor_destination_mac2,
  89. rxdma2host_monitor_destination_mac1,
  90. ppdu_end_interrupts_mac3,
  91. ppdu_end_interrupts_mac2,
  92. ppdu_end_interrupts_mac1,
  93. rxdma2host_monitor_status_ring_mac3,
  94. rxdma2host_monitor_status_ring_mac2,
  95. rxdma2host_monitor_status_ring_mac1,
  96. host2rxdma_host_buf_ring_mac3,
  97. host2rxdma_host_buf_ring_mac2,
  98. host2rxdma_host_buf_ring_mac1,
  99. rxdma2host_destination_ring_mac3,
  100. rxdma2host_destination_ring_mac2,
  101. rxdma2host_destination_ring_mac1,
  102. host2tcl_input_ring4,
  103. host2tcl_input_ring3,
  104. host2tcl_input_ring2,
  105. host2tcl_input_ring1,
  106. wbm2host_tx_completions_ring3,
  107. wbm2host_tx_completions_ring2,
  108. wbm2host_tx_completions_ring1,
  109. tcl2host_status_ring,
  110. };
  111. struct CE_state;
  112. #define CE_COUNT_MAX 12
  113. #define HIF_MAX_GRP_IRQ 16
  114. #ifndef HIF_MAX_GROUP
  115. #define HIF_MAX_GROUP 7
  116. #endif
  117. #ifndef NAPI_YIELD_BUDGET_BASED
  118. #ifndef QCA_NAPI_DEF_SCALE_BIN_SHIFT
  119. #define QCA_NAPI_DEF_SCALE_BIN_SHIFT 4
  120. #endif
  121. #else /* NAPI_YIELD_BUDGET_BASED */
  122. #define QCA_NAPI_DEF_SCALE_BIN_SHIFT 2
  123. #endif /* NAPI_YIELD_BUDGET_BASED */
  124. #define QCA_NAPI_BUDGET 64
  125. #define QCA_NAPI_DEF_SCALE \
  126. (1 << QCA_NAPI_DEF_SCALE_BIN_SHIFT)
  127. #define HIF_NAPI_MAX_RECEIVES (QCA_NAPI_BUDGET * QCA_NAPI_DEF_SCALE)
  128. /* NOTE: "napi->scale" can be changed,
  129. * but this does not change the number of buckets
  130. */
  131. #define QCA_NAPI_NUM_BUCKETS 4
  132. /**
  133. * qca_napi_stat - stats structure for execution contexts
  134. * @napi_schedules - number of times the schedule function is called
  135. * @napi_polls - number of times the execution context runs
  136. * @napi_completes - number of times that the generating interrupt is reenabled
  137. * @napi_workdone - cumulative of all work done reported by handler
  138. * @cpu_corrected - incremented when execution context runs on a different core
  139. * than the one that its irq is affined to.
  140. * @napi_budget_uses - histogram of work done per execution run
  141. * @time_limit_reache - count of yields due to time limit threshholds
  142. * @rxpkt_thresh_reached - count of yields due to a work limit
  143. * @poll_time_buckets - histogram of poll times for the napi
  144. *
  145. */
  146. struct qca_napi_stat {
  147. uint32_t napi_schedules;
  148. uint32_t napi_polls;
  149. uint32_t napi_completes;
  150. uint32_t napi_workdone;
  151. uint32_t cpu_corrected;
  152. uint32_t napi_budget_uses[QCA_NAPI_NUM_BUCKETS];
  153. uint32_t time_limit_reached;
  154. uint32_t rxpkt_thresh_reached;
  155. unsigned long long napi_max_poll_time;
  156. #ifdef WLAN_FEATURE_RX_SOFTIRQ_TIME_LIMIT
  157. uint32_t poll_time_buckets[QCA_NAPI_NUM_BUCKETS];
  158. #endif
  159. };
  160. /**
  161. * per NAPI instance data structure
  162. * This data structure holds stuff per NAPI instance.
  163. * Note that, in the current implementation, though scale is
  164. * an instance variable, it is set to the same value for all
  165. * instances.
  166. */
  167. struct qca_napi_info {
  168. struct net_device netdev; /* dummy net_dev */
  169. void *hif_ctx;
  170. struct napi_struct napi;
  171. uint8_t scale; /* currently same on all instances */
  172. uint8_t id;
  173. uint8_t cpu;
  174. int irq;
  175. cpumask_t cpumask;
  176. struct qca_napi_stat stats[NR_CPUS];
  177. #ifdef RECEIVE_OFFLOAD
  178. /* will only be present for data rx CE's */
  179. void (*offld_flush_cb)(void *);
  180. struct napi_struct rx_thread_napi;
  181. struct net_device rx_thread_netdev;
  182. #endif /* RECEIVE_OFFLOAD */
  183. qdf_lro_ctx_t lro_ctx;
  184. };
  185. enum qca_napi_tput_state {
  186. QCA_NAPI_TPUT_UNINITIALIZED,
  187. QCA_NAPI_TPUT_LO,
  188. QCA_NAPI_TPUT_HI
  189. };
  190. enum qca_napi_cpu_state {
  191. QCA_NAPI_CPU_UNINITIALIZED,
  192. QCA_NAPI_CPU_DOWN,
  193. QCA_NAPI_CPU_UP };
  194. /**
  195. * struct qca_napi_cpu - an entry of the napi cpu table
  196. * @core_id: physical core id of the core
  197. * @cluster_id: cluster this core belongs to
  198. * @core_mask: mask to match all core of this cluster
  199. * @thread_mask: mask for this core within the cluster
  200. * @max_freq: maximum clock this core can be clocked at
  201. * same for all cpus of the same core.
  202. * @napis: bitmap of napi instances on this core
  203. * @execs: bitmap of execution contexts on this core
  204. * cluster_nxt: chain to link cores within the same cluster
  205. *
  206. * This structure represents a single entry in the napi cpu
  207. * table. The table is part of struct qca_napi_data.
  208. * This table is initialized by the init function, called while
  209. * the first napi instance is being created, updated by hotplug
  210. * notifier and when cpu affinity decisions are made (by throughput
  211. * detection), and deleted when the last napi instance is removed.
  212. */
  213. struct qca_napi_cpu {
  214. enum qca_napi_cpu_state state;
  215. int core_id;
  216. int cluster_id;
  217. cpumask_t core_mask;
  218. cpumask_t thread_mask;
  219. unsigned int max_freq;
  220. uint32_t napis;
  221. uint32_t execs;
  222. int cluster_nxt; /* index, not pointer */
  223. };
  224. /**
  225. * struct qca_napi_data - collection of napi data for a single hif context
  226. * @hif_softc: pointer to the hif context
  227. * @lock: spinlock used in the event state machine
  228. * @state: state variable used in the napi stat machine
  229. * @ce_map: bit map indicating which ce's have napis running
  230. * @exec_map: bit map of instanciated exec contexts
  231. * @user_cpu_affin_map: CPU affinity map from INI config.
  232. * @napi_cpu: cpu info for irq affinty
  233. * @lilcl_head:
  234. * @bigcl_head:
  235. * @napi_mode: irq affinity & clock voting mode
  236. * @cpuhp_handler: CPU hotplug event registration handle
  237. */
  238. struct qca_napi_data {
  239. struct hif_softc *hif_softc;
  240. qdf_spinlock_t lock;
  241. uint32_t state;
  242. /* bitmap of created/registered NAPI instances, indexed by pipe_id,
  243. * not used by clients (clients use an id returned by create)
  244. */
  245. uint32_t ce_map;
  246. uint32_t exec_map;
  247. uint32_t user_cpu_affin_mask;
  248. struct qca_napi_info *napis[CE_COUNT_MAX];
  249. struct qca_napi_cpu napi_cpu[NR_CPUS];
  250. int lilcl_head, bigcl_head;
  251. enum qca_napi_tput_state napi_mode;
  252. struct qdf_cpuhp_handler *cpuhp_handler;
  253. uint8_t flags;
  254. };
  255. /**
  256. * struct hif_config_info - Place Holder for HIF configuration
  257. * @enable_self_recovery: Self Recovery
  258. * @enable_runtime_pm: Enable Runtime PM
  259. * @runtime_pm_delay: Runtime PM Delay
  260. * @rx_softirq_max_yield_duration_ns: Max Yield time duration for RX Softirq
  261. *
  262. * Structure for holding HIF ini parameters.
  263. */
  264. struct hif_config_info {
  265. bool enable_self_recovery;
  266. #ifdef FEATURE_RUNTIME_PM
  267. uint8_t enable_runtime_pm;
  268. u_int32_t runtime_pm_delay;
  269. #endif
  270. uint64_t rx_softirq_max_yield_duration_ns;
  271. };
  272. /**
  273. * struct hif_target_info - Target Information
  274. * @target_version: Target Version
  275. * @target_type: Target Type
  276. * @target_revision: Target Revision
  277. * @soc_version: SOC Version
  278. * @hw_name: pointer to hardware name
  279. *
  280. * Structure to hold target information.
  281. */
  282. struct hif_target_info {
  283. uint32_t target_version;
  284. uint32_t target_type;
  285. uint32_t target_revision;
  286. uint32_t soc_version;
  287. char *hw_name;
  288. };
  289. struct hif_opaque_softc {
  290. };
  291. /**
  292. * enum hif_event_type - Type of DP events to be recorded
  293. * @HIF_EVENT_IRQ_TRIGGER: IRQ trigger event
  294. * @HIF_EVENT_TIMER_ENTRY: Monitor Timer entry event
  295. * @HIF_EVENT_TIMER_EXIT: Monitor Timer exit event
  296. * @HIF_EVENT_BH_SCHED: NAPI POLL scheduled event
  297. * @HIF_EVENT_SRNG_ACCESS_START: hal ring access start event
  298. * @HIF_EVENT_SRNG_ACCESS_END: hal ring access end event
  299. */
  300. enum hif_event_type {
  301. HIF_EVENT_IRQ_TRIGGER,
  302. HIF_EVENT_TIMER_ENTRY,
  303. HIF_EVENT_TIMER_EXIT,
  304. HIF_EVENT_BH_SCHED,
  305. HIF_EVENT_SRNG_ACCESS_START,
  306. HIF_EVENT_SRNG_ACCESS_END,
  307. /* Do check hif_hist_skip_event_record when adding new events */
  308. };
  309. #ifdef WLAN_FEATURE_DP_EVENT_HISTORY
  310. /* HIF_EVENT_HIST_MAX should always be power of 2 */
  311. #define HIF_EVENT_HIST_MAX 512
  312. #define HIF_NUM_INT_CONTEXTS HIF_MAX_GROUP
  313. #define HIF_EVENT_HIST_DISABLE_MASK 0
  314. /**
  315. * struct hif_event_record - an entry of the DP event history
  316. * @hal_ring_id: ring id for which event is recorded
  317. * @hp: head pointer of the ring (may not be applicable for all events)
  318. * @tp: tail pointer of the ring (may not be applicable for all events)
  319. * @cpu_id: cpu id on which the event occurred
  320. * @timestamp: timestamp when event occurred
  321. * @type: type of the event
  322. *
  323. * This structure represents the information stored for every datapath
  324. * event which is logged in the history.
  325. */
  326. struct hif_event_record {
  327. uint8_t hal_ring_id;
  328. uint32_t hp;
  329. uint32_t tp;
  330. int cpu_id;
  331. uint64_t timestamp;
  332. enum hif_event_type type;
  333. };
  334. /**
  335. * struct hif_event_misc - history related misc info
  336. * @last_irq_index: last irq event index in history
  337. * @last_irq_ts: last irq timestamp
  338. */
  339. struct hif_event_misc {
  340. int32_t last_irq_index;
  341. uint64_t last_irq_ts;
  342. };
  343. /**
  344. * struct hif_event_history - history for one interrupt group
  345. * @index: index to store new event
  346. * @event: event entry
  347. *
  348. * This structure represents the datapath history for one
  349. * interrupt group.
  350. */
  351. struct hif_event_history {
  352. qdf_atomic_t index;
  353. struct hif_event_misc misc;
  354. struct hif_event_record event[HIF_EVENT_HIST_MAX];
  355. };
  356. /**
  357. * hif_hist_record_event() - Record one datapath event in history
  358. * @hif_ctx: HIF opaque context
  359. * @event: DP event entry
  360. * @intr_grp_id: interrupt group ID registered with hif
  361. *
  362. * Return: None
  363. */
  364. void hif_hist_record_event(struct hif_opaque_softc *hif_ctx,
  365. struct hif_event_record *event,
  366. uint8_t intr_grp_id);
  367. /**
  368. * hif_event_history_init() - Initialize SRNG event history buffers
  369. * @hif_ctx: HIF opaque context
  370. * @id: context group ID for which history is recorded
  371. *
  372. * Returns: None
  373. */
  374. void hif_event_history_init(struct hif_opaque_softc *hif_ctx, uint8_t id);
  375. /**
  376. * hif_event_history_deinit() - De-initialize SRNG event history buffers
  377. * @hif_ctx: HIF opaque context
  378. * @id: context group ID for which history is recorded
  379. *
  380. * Returns: None
  381. */
  382. void hif_event_history_deinit(struct hif_opaque_softc *hif_ctx, uint8_t id);
  383. /**
  384. * hif_record_event() - Wrapper function to form and record DP event
  385. * @hif_ctx: HIF opaque context
  386. * @intr_grp_id: interrupt group ID registered with hif
  387. * @hal_ring_id: ring id for which event is recorded
  388. * @hp: head pointer index of the srng
  389. * @tp: tail pointer index of the srng
  390. * @type: type of the event to be logged in history
  391. *
  392. * Return: None
  393. */
  394. static inline void hif_record_event(struct hif_opaque_softc *hif_ctx,
  395. uint8_t intr_grp_id,
  396. uint8_t hal_ring_id,
  397. uint32_t hp,
  398. uint32_t tp,
  399. enum hif_event_type type)
  400. {
  401. struct hif_event_record event;
  402. event.hal_ring_id = hal_ring_id;
  403. event.hp = hp;
  404. event.tp = tp;
  405. event.type = type;
  406. hif_hist_record_event(hif_ctx, &event, intr_grp_id);
  407. return;
  408. }
  409. #else
  410. static inline void hif_record_event(struct hif_opaque_softc *hif_ctx,
  411. uint8_t intr_grp_id,
  412. uint8_t hal_ring_id,
  413. uint32_t hp,
  414. uint32_t tp,
  415. enum hif_event_type type)
  416. {
  417. }
  418. static inline void hif_event_history_init(struct hif_opaque_softc *hif_ctx,
  419. uint8_t id)
  420. {
  421. }
  422. static inline void hif_event_history_deinit(struct hif_opaque_softc *hif_ctx,
  423. uint8_t id)
  424. {
  425. }
  426. #endif /* WLAN_FEATURE_DP_EVENT_HISTORY */
  427. /**
  428. * enum HIF_DEVICE_POWER_CHANGE_TYPE: Device Power change type
  429. *
  430. * @HIF_DEVICE_POWER_UP: HIF layer should power up interface and/or module
  431. * @HIF_DEVICE_POWER_DOWN: HIF layer should initiate bus-specific measures to
  432. * minimize power
  433. * @HIF_DEVICE_POWER_CUT: HIF layer should initiate bus-specific AND/OR
  434. * platform-specific measures to completely power-off
  435. * the module and associated hardware (i.e. cut power
  436. * supplies)
  437. */
  438. enum HIF_DEVICE_POWER_CHANGE_TYPE {
  439. HIF_DEVICE_POWER_UP,
  440. HIF_DEVICE_POWER_DOWN,
  441. HIF_DEVICE_POWER_CUT
  442. };
  443. /**
  444. * enum hif_enable_type: what triggered the enabling of hif
  445. *
  446. * @HIF_ENABLE_TYPE_PROBE: probe triggered enable
  447. * @HIF_ENABLE_TYPE_REINIT: reinit triggered enable
  448. */
  449. enum hif_enable_type {
  450. HIF_ENABLE_TYPE_PROBE,
  451. HIF_ENABLE_TYPE_REINIT,
  452. HIF_ENABLE_TYPE_MAX
  453. };
  454. /**
  455. * enum hif_disable_type: what triggered the disabling of hif
  456. *
  457. * @HIF_DISABLE_TYPE_PROBE_ERROR: probe error triggered disable
  458. * @HIF_DISABLE_TYPE_REINIT_ERROR: reinit error triggered disable
  459. * @HIF_DISABLE_TYPE_REMOVE: remove triggered disable
  460. * @HIF_DISABLE_TYPE_SHUTDOWN: shutdown triggered disable
  461. */
  462. enum hif_disable_type {
  463. HIF_DISABLE_TYPE_PROBE_ERROR,
  464. HIF_DISABLE_TYPE_REINIT_ERROR,
  465. HIF_DISABLE_TYPE_REMOVE,
  466. HIF_DISABLE_TYPE_SHUTDOWN,
  467. HIF_DISABLE_TYPE_MAX
  468. };
  469. /**
  470. * enum hif_device_config_opcode: configure mode
  471. *
  472. * @HIF_DEVICE_POWER_STATE: device power state
  473. * @HIF_DEVICE_GET_BLOCK_SIZE: get block size
  474. * @HIF_DEVICE_GET_ADDR: get block address
  475. * @HIF_DEVICE_GET_PENDING_EVENTS_FUNC: get pending events functions
  476. * @HIF_DEVICE_GET_IRQ_PROC_MODE: get irq proc mode
  477. * @HIF_DEVICE_GET_RECV_EVENT_MASK_UNMASK_FUNC: receive event function
  478. * @HIF_DEVICE_POWER_STATE_CHANGE: change power state
  479. * @HIF_DEVICE_GET_IRQ_YIELD_PARAMS: get yield params
  480. * @HIF_CONFIGURE_QUERY_SCATTER_REQUEST_SUPPORT: configure scatter request
  481. * @HIF_DEVICE_GET_OS_DEVICE: get OS device
  482. * @HIF_DEVICE_DEBUG_BUS_STATE: debug bus state
  483. * @HIF_BMI_DONE: bmi done
  484. * @HIF_DEVICE_SET_TARGET_TYPE: set target type
  485. * @HIF_DEVICE_SET_HTC_CONTEXT: set htc context
  486. * @HIF_DEVICE_GET_HTC_CONTEXT: get htc context
  487. */
  488. enum hif_device_config_opcode {
  489. HIF_DEVICE_POWER_STATE = 0,
  490. HIF_DEVICE_GET_BLOCK_SIZE,
  491. HIF_DEVICE_GET_FIFO_ADDR,
  492. HIF_DEVICE_GET_PENDING_EVENTS_FUNC,
  493. HIF_DEVICE_GET_IRQ_PROC_MODE,
  494. HIF_DEVICE_GET_RECV_EVENT_MASK_UNMASK_FUNC,
  495. HIF_DEVICE_POWER_STATE_CHANGE,
  496. HIF_DEVICE_GET_IRQ_YIELD_PARAMS,
  497. HIF_CONFIGURE_QUERY_SCATTER_REQUEST_SUPPORT,
  498. HIF_DEVICE_GET_OS_DEVICE,
  499. HIF_DEVICE_DEBUG_BUS_STATE,
  500. HIF_BMI_DONE,
  501. HIF_DEVICE_SET_TARGET_TYPE,
  502. HIF_DEVICE_SET_HTC_CONTEXT,
  503. HIF_DEVICE_GET_HTC_CONTEXT,
  504. };
  505. #ifdef CONFIG_ATH_PCIE_ACCESS_DEBUG
  506. struct HID_ACCESS_LOG {
  507. uint32_t seqnum;
  508. bool is_write;
  509. void *addr;
  510. uint32_t value;
  511. };
  512. #endif
  513. void hif_reg_write(struct hif_opaque_softc *hif_ctx, uint32_t offset,
  514. uint32_t value);
  515. uint32_t hif_reg_read(struct hif_opaque_softc *hif_ctx, uint32_t offset);
  516. #define HIF_MAX_DEVICES 1
  517. /**
  518. * struct htc_callbacks - Structure for HTC Callbacks methods
  519. * @context: context to pass to the dsrhandler
  520. * note : rwCompletionHandler is provided the context
  521. * passed to hif_read_write
  522. * @rwCompletionHandler: Read / write completion handler
  523. * @dsrHandler: DSR Handler
  524. */
  525. struct htc_callbacks {
  526. void *context;
  527. QDF_STATUS(*rw_compl_handler)(void *rw_ctx, QDF_STATUS status);
  528. QDF_STATUS(*dsr_handler)(void *context);
  529. };
  530. /**
  531. * struct hif_driver_state_callbacks - Callbacks for HIF to query Driver state
  532. * @context: Private data context
  533. * @set_recovery_in_progress: To Set Driver state for recovery in progress
  534. * @is_recovery_in_progress: Query if driver state is recovery in progress
  535. * @is_load_unload_in_progress: Query if driver state Load/Unload in Progress
  536. * @is_driver_unloading: Query if driver is unloading.
  537. * @get_bandwidth_level: Query current bandwidth level for the driver
  538. * This Structure provides callback pointer for HIF to query hdd for driver
  539. * states.
  540. */
  541. struct hif_driver_state_callbacks {
  542. void *context;
  543. void (*set_recovery_in_progress)(void *context, uint8_t val);
  544. bool (*is_recovery_in_progress)(void *context);
  545. bool (*is_load_unload_in_progress)(void *context);
  546. bool (*is_driver_unloading)(void *context);
  547. bool (*is_target_ready)(void *context);
  548. int (*get_bandwidth_level)(void *context);
  549. };
  550. /* This API detaches the HTC layer from the HIF device */
  551. void hif_detach_htc(struct hif_opaque_softc *hif_ctx);
  552. /****************************************************************/
  553. /* BMI and Diag window abstraction */
  554. /****************************************************************/
  555. #define HIF_BMI_EXCHANGE_NO_TIMEOUT ((uint32_t)(0))
  556. #define DIAG_TRANSFER_LIMIT 2048U /* maximum number of bytes that can be
  557. * handled atomically by
  558. * DiagRead/DiagWrite
  559. */
  560. #ifdef WLAN_FEATURE_BMI
  561. /*
  562. * API to handle HIF-specific BMI message exchanges, this API is synchronous
  563. * and only allowed to be called from a context that can block (sleep)
  564. */
  565. QDF_STATUS hif_exchange_bmi_msg(struct hif_opaque_softc *hif_ctx,
  566. qdf_dma_addr_t cmd, qdf_dma_addr_t rsp,
  567. uint8_t *pSendMessage, uint32_t Length,
  568. uint8_t *pResponseMessage,
  569. uint32_t *pResponseLength, uint32_t TimeoutMS);
  570. void hif_register_bmi_callbacks(struct hif_opaque_softc *hif_ctx);
  571. bool hif_needs_bmi(struct hif_opaque_softc *hif_ctx);
  572. #else /* WLAN_FEATURE_BMI */
  573. static inline void
  574. hif_register_bmi_callbacks(struct hif_opaque_softc *hif_ctx)
  575. {
  576. }
  577. static inline bool
  578. hif_needs_bmi(struct hif_opaque_softc *hif_ctx)
  579. {
  580. return false;
  581. }
  582. #endif /* WLAN_FEATURE_BMI */
  583. /*
  584. * APIs to handle HIF specific diagnostic read accesses. These APIs are
  585. * synchronous and only allowed to be called from a context that
  586. * can block (sleep). They are not high performance APIs.
  587. *
  588. * hif_diag_read_access reads a 4 Byte aligned/length value from a
  589. * Target register or memory word.
  590. *
  591. * hif_diag_read_mem reads an arbitrary length of arbitrarily aligned memory.
  592. */
  593. QDF_STATUS hif_diag_read_access(struct hif_opaque_softc *hif_ctx,
  594. uint32_t address, uint32_t *data);
  595. QDF_STATUS hif_diag_read_mem(struct hif_opaque_softc *hif_ctx, uint32_t address,
  596. uint8_t *data, int nbytes);
  597. void hif_dump_target_memory(struct hif_opaque_softc *hif_ctx,
  598. void *ramdump_base, uint32_t address, uint32_t size);
  599. /*
  600. * APIs to handle HIF specific diagnostic write accesses. These APIs are
  601. * synchronous and only allowed to be called from a context that
  602. * can block (sleep).
  603. * They are not high performance APIs.
  604. *
  605. * hif_diag_write_access writes a 4 Byte aligned/length value to a
  606. * Target register or memory word.
  607. *
  608. * hif_diag_write_mem writes an arbitrary length of arbitrarily aligned memory.
  609. */
  610. QDF_STATUS hif_diag_write_access(struct hif_opaque_softc *hif_ctx,
  611. uint32_t address, uint32_t data);
  612. QDF_STATUS hif_diag_write_mem(struct hif_opaque_softc *hif_ctx,
  613. uint32_t address, uint8_t *data, int nbytes);
  614. typedef void (*fastpath_msg_handler)(void *, qdf_nbuf_t *, uint32_t);
  615. void hif_enable_polled_mode(struct hif_opaque_softc *hif_ctx);
  616. bool hif_is_polled_mode_enabled(struct hif_opaque_softc *hif_ctx);
  617. /*
  618. * Set the FASTPATH_mode_on flag in sc, for use by data path
  619. */
  620. #ifdef WLAN_FEATURE_FASTPATH
  621. void hif_enable_fastpath(struct hif_opaque_softc *hif_ctx);
  622. bool hif_is_fastpath_mode_enabled(struct hif_opaque_softc *hif_ctx);
  623. void *hif_get_ce_handle(struct hif_opaque_softc *hif_ctx, int ret);
  624. /**
  625. * hif_ce_fastpath_cb_register() - Register callback for fastpath msg handler
  626. * @handler: Callback funtcion
  627. * @context: handle for callback function
  628. *
  629. * Return: QDF_STATUS_SUCCESS on success or QDF_STATUS_E_FAILURE
  630. */
  631. QDF_STATUS hif_ce_fastpath_cb_register(
  632. struct hif_opaque_softc *hif_ctx,
  633. fastpath_msg_handler handler, void *context);
  634. #else
  635. static inline QDF_STATUS hif_ce_fastpath_cb_register(
  636. struct hif_opaque_softc *hif_ctx,
  637. fastpath_msg_handler handler, void *context)
  638. {
  639. return QDF_STATUS_E_FAILURE;
  640. }
  641. static inline void *hif_get_ce_handle(struct hif_opaque_softc *hif_ctx, int ret)
  642. {
  643. return NULL;
  644. }
  645. #endif
  646. /*
  647. * Enable/disable CDC max performance workaround
  648. * For max-performace set this to 0
  649. * To allow SoC to enter sleep set this to 1
  650. */
  651. #define CONFIG_DISABLE_CDC_MAX_PERF_WAR 0
  652. void hif_ipa_get_ce_resource(struct hif_opaque_softc *hif_ctx,
  653. qdf_shared_mem_t **ce_sr,
  654. uint32_t *ce_sr_ring_size,
  655. qdf_dma_addr_t *ce_reg_paddr);
  656. /**
  657. * @brief List of callbacks - filled in by HTC.
  658. */
  659. struct hif_msg_callbacks {
  660. void *Context;
  661. /**< context meaningful to HTC */
  662. QDF_STATUS (*txCompletionHandler)(void *Context, qdf_nbuf_t wbuf,
  663. uint32_t transferID,
  664. uint32_t toeplitz_hash_result);
  665. QDF_STATUS (*rxCompletionHandler)(void *Context, qdf_nbuf_t wbuf,
  666. uint8_t pipeID);
  667. void (*txResourceAvailHandler)(void *context, uint8_t pipe);
  668. void (*fwEventHandler)(void *context, QDF_STATUS status);
  669. void (*update_bundle_stats)(void *context, uint8_t no_of_pkt_in_bundle);
  670. };
  671. enum hif_target_status {
  672. TARGET_STATUS_CONNECTED = 0, /* target connected */
  673. TARGET_STATUS_RESET, /* target got reset */
  674. TARGET_STATUS_EJECT, /* target got ejected */
  675. TARGET_STATUS_SUSPEND /*target got suspend */
  676. };
  677. /**
  678. * enum hif_attribute_flags: configure hif
  679. *
  680. * @HIF_LOWDESC_CE_CFG: Configure HIF with Low descriptor CE
  681. * @HIF_LOWDESC_CE_NO_PKTLOG_CFG: Configure HIF with Low descriptor
  682. * + No pktlog CE
  683. */
  684. enum hif_attribute_flags {
  685. HIF_LOWDESC_CE_CFG = 1,
  686. HIF_LOWDESC_CE_NO_PKTLOG_CFG
  687. };
  688. #define HIF_DATA_ATTR_SET_TX_CLASSIFY(attr, v) \
  689. (attr |= (v & 0x01) << 5)
  690. #define HIF_DATA_ATTR_SET_ENCAPSULATION_TYPE(attr, v) \
  691. (attr |= (v & 0x03) << 6)
  692. #define HIF_DATA_ATTR_SET_ADDR_X_SEARCH_DISABLE(attr, v) \
  693. (attr |= (v & 0x01) << 13)
  694. #define HIF_DATA_ATTR_SET_ADDR_Y_SEARCH_DISABLE(attr, v) \
  695. (attr |= (v & 0x01) << 14)
  696. #define HIF_DATA_ATTR_SET_TOEPLITZ_HASH_ENABLE(attr, v) \
  697. (attr |= (v & 0x01) << 15)
  698. #define HIF_DATA_ATTR_SET_PACKET_OR_RESULT_OFFSET(attr, v) \
  699. (attr |= (v & 0x0FFF) << 16)
  700. #define HIF_DATA_ATTR_SET_ENABLE_11H(attr, v) \
  701. (attr |= (v & 0x01) << 30)
  702. struct hif_ul_pipe_info {
  703. unsigned int nentries;
  704. unsigned int nentries_mask;
  705. unsigned int sw_index;
  706. unsigned int write_index; /* cached copy */
  707. unsigned int hw_index; /* cached copy */
  708. void *base_addr_owner_space; /* Host address space */
  709. qdf_dma_addr_t base_addr_CE_space; /* CE address space */
  710. };
  711. struct hif_dl_pipe_info {
  712. unsigned int nentries;
  713. unsigned int nentries_mask;
  714. unsigned int sw_index;
  715. unsigned int write_index; /* cached copy */
  716. unsigned int hw_index; /* cached copy */
  717. void *base_addr_owner_space; /* Host address space */
  718. qdf_dma_addr_t base_addr_CE_space; /* CE address space */
  719. };
  720. struct hif_pipe_addl_info {
  721. uint32_t pci_mem;
  722. uint32_t ctrl_addr;
  723. struct hif_ul_pipe_info ul_pipe;
  724. struct hif_dl_pipe_info dl_pipe;
  725. };
  726. #ifdef CONFIG_SLUB_DEBUG_ON
  727. #define MSG_FLUSH_NUM 16
  728. #else /* PERF build */
  729. #define MSG_FLUSH_NUM 32
  730. #endif /* SLUB_DEBUG_ON */
  731. struct hif_bus_id;
  732. void hif_claim_device(struct hif_opaque_softc *hif_ctx);
  733. QDF_STATUS hif_get_config_item(struct hif_opaque_softc *hif_ctx,
  734. int opcode, void *config, uint32_t config_len);
  735. void hif_set_mailbox_swap(struct hif_opaque_softc *hif_ctx);
  736. void hif_mask_interrupt_call(struct hif_opaque_softc *hif_ctx);
  737. void hif_post_init(struct hif_opaque_softc *hif_ctx, void *hHTC,
  738. struct hif_msg_callbacks *callbacks);
  739. QDF_STATUS hif_start(struct hif_opaque_softc *hif_ctx);
  740. void hif_stop(struct hif_opaque_softc *hif_ctx);
  741. void hif_flush_surprise_remove(struct hif_opaque_softc *hif_ctx);
  742. void hif_dump(struct hif_opaque_softc *hif_ctx, uint8_t CmdId, bool start);
  743. void hif_trigger_dump(struct hif_opaque_softc *hif_ctx,
  744. uint8_t cmd_id, bool start);
  745. QDF_STATUS hif_send_head(struct hif_opaque_softc *hif_ctx, uint8_t PipeID,
  746. uint32_t transferID, uint32_t nbytes,
  747. qdf_nbuf_t wbuf, uint32_t data_attr);
  748. void hif_send_complete_check(struct hif_opaque_softc *hif_ctx, uint8_t PipeID,
  749. int force);
  750. void hif_shut_down_device(struct hif_opaque_softc *hif_ctx);
  751. void hif_get_default_pipe(struct hif_opaque_softc *hif_ctx, uint8_t *ULPipe,
  752. uint8_t *DLPipe);
  753. int hif_map_service_to_pipe(struct hif_opaque_softc *hif_ctx, uint16_t svc_id,
  754. uint8_t *ul_pipe, uint8_t *dl_pipe, int *ul_is_polled,
  755. int *dl_is_polled);
  756. uint16_t
  757. hif_get_free_queue_number(struct hif_opaque_softc *hif_ctx, uint8_t PipeID);
  758. void *hif_get_targetdef(struct hif_opaque_softc *hif_ctx);
  759. uint32_t hif_hia_item_address(uint32_t target_type, uint32_t item_offset);
  760. void hif_set_target_sleep(struct hif_opaque_softc *hif_ctx, bool sleep_ok,
  761. bool wait_for_it);
  762. int hif_check_fw_reg(struct hif_opaque_softc *hif_ctx);
  763. #ifndef HIF_PCI
  764. static inline int hif_check_soc_status(struct hif_opaque_softc *hif_ctx)
  765. {
  766. return 0;
  767. }
  768. #else
  769. int hif_check_soc_status(struct hif_opaque_softc *hif_ctx);
  770. #endif
  771. void hif_get_hw_info(struct hif_opaque_softc *hif_ctx, u32 *version,
  772. u32 *revision, const char **target_name);
  773. #ifdef RECEIVE_OFFLOAD
  774. /**
  775. * hif_offld_flush_cb_register() - Register the offld flush callback
  776. * @scn: HIF opaque context
  777. * @offld_flush_handler: Flush callback is either ol_flush, incase of rx_thread
  778. * Or GRO/LRO flush when RxThread is not enabled. Called
  779. * with corresponding context for flush.
  780. * Return: None
  781. */
  782. void hif_offld_flush_cb_register(struct hif_opaque_softc *scn,
  783. void (offld_flush_handler)(void *ol_ctx));
  784. /**
  785. * hif_offld_flush_cb_deregister() - deRegister the offld flush callback
  786. * @scn: HIF opaque context
  787. *
  788. * Return: None
  789. */
  790. void hif_offld_flush_cb_deregister(struct hif_opaque_softc *scn);
  791. #endif
  792. #ifdef WLAN_FEATURE_RX_SOFTIRQ_TIME_LIMIT
  793. /**
  794. * hif_exec_should_yield() - Check if hif napi context should yield
  795. * @hif_ctx - HIF opaque context
  796. * @grp_id - grp_id of the napi for which check needs to be done
  797. *
  798. * The function uses grp_id to look for NAPI and checks if NAPI needs to
  799. * yield. HIF_EXT_GROUP_MAX_YIELD_DURATION_NS is the duration used for
  800. * yield decision.
  801. *
  802. * Return: true if NAPI needs to yield, else false
  803. */
  804. bool hif_exec_should_yield(struct hif_opaque_softc *hif_ctx, uint grp_id);
  805. #else
  806. static inline bool hif_exec_should_yield(struct hif_opaque_softc *hif_ctx,
  807. uint grp_id)
  808. {
  809. return false;
  810. }
  811. #endif
  812. void hif_disable_isr(struct hif_opaque_softc *hif_ctx);
  813. void hif_reset_soc(struct hif_opaque_softc *hif_ctx);
  814. void hif_save_htc_htt_config_endpoint(struct hif_opaque_softc *hif_ctx,
  815. int htc_htt_tx_endpoint);
  816. /**
  817. * hif_open() - Create hif handle
  818. * @qdf_ctx: qdf context
  819. * @mode: Driver Mode
  820. * @bus_type: Bus Type
  821. * @cbk: CDS Callbacks
  822. * @psoc: psoc object manager
  823. *
  824. * API to open HIF Context
  825. *
  826. * Return: HIF Opaque Pointer
  827. */
  828. struct hif_opaque_softc *hif_open(qdf_device_t qdf_ctx,
  829. uint32_t mode,
  830. enum qdf_bus_type bus_type,
  831. struct hif_driver_state_callbacks *cbk,
  832. struct wlan_objmgr_psoc *psoc);
  833. void hif_close(struct hif_opaque_softc *hif_ctx);
  834. QDF_STATUS hif_enable(struct hif_opaque_softc *hif_ctx, struct device *dev,
  835. void *bdev, const struct hif_bus_id *bid,
  836. enum qdf_bus_type bus_type,
  837. enum hif_enable_type type);
  838. void hif_disable(struct hif_opaque_softc *hif_ctx, enum hif_disable_type type);
  839. #ifdef CE_TASKLET_DEBUG_ENABLE
  840. void hif_enable_ce_latency_stats(struct hif_opaque_softc *hif_ctx,
  841. uint8_t value);
  842. #endif
  843. void hif_display_stats(struct hif_opaque_softc *hif_ctx);
  844. void hif_clear_stats(struct hif_opaque_softc *hif_ctx);
  845. /**
  846. * enum wlan_rtpm_dbgid - runtime pm put/get debug id
  847. * @RTPM_ID_RESVERD: Reserved
  848. * @RTPM_ID_WMI: WMI sending msg, expect put happen at
  849. * tx completion from CE level directly.
  850. * @RTPM_ID_HTC: pkt sending by HTT_DATA_MSG_SVC, expect
  851. * put from fw response or just in
  852. * htc_issue_packets
  853. * @RTPM_ID_QOS_NOTIFY: pm qos notifer
  854. * @RTPM_ID_DP_TX_DESC_ALLOC_FREE: tx desc alloc/free
  855. * @RTPM_ID_CE_SEND_FAST: operation in ce_send_fast, not include
  856. * the pkt put happens outside this function
  857. * @RTPM_ID_SUSPEND_RESUME: suspend/resume in hdd
  858. * @RTPM_ID_DW_TX_HW_ENQUEUE: operation in functin dp_tx_hw_enqueue
  859. * @RTPM_ID_HAL_REO_CMD: HAL_REO_CMD operation
  860. * @RTPM_ID_DP_PRINT_RING_STATS: operation in dp_print_ring_stats
  861. */
  862. /* New value added to the enum must also be reflected in function
  863. * rtpm_string_from_dbgid()
  864. */
  865. typedef enum {
  866. RTPM_ID_RESVERD = 0,
  867. RTPM_ID_WMI = 1,
  868. RTPM_ID_HTC = 2,
  869. RTPM_ID_QOS_NOTIFY = 3,
  870. RTPM_ID_DP_TX_DESC_ALLOC_FREE = 4,
  871. RTPM_ID_CE_SEND_FAST = 5,
  872. RTPM_ID_SUSPEND_RESUME = 6,
  873. RTPM_ID_DW_TX_HW_ENQUEUE = 7,
  874. RTPM_ID_HAL_REO_CMD = 8,
  875. RTPM_ID_DP_PRINT_RING_STATS = 9,
  876. RTPM_ID_MAX,
  877. } wlan_rtpm_dbgid;
  878. /**
  879. * rtpm_string_from_dbgid() - Convert dbgid to respective string
  880. * @id - debug id
  881. *
  882. * Debug support function to convert dbgid to string.
  883. * Please note to add new string in the array at index equal to
  884. * its enum value in wlan_rtpm_dbgid.
  885. */
  886. static inline char *rtpm_string_from_dbgid(wlan_rtpm_dbgid id)
  887. {
  888. static const char *strings[] = { "RTPM_ID_RESVERD",
  889. "RTPM_ID_WMI",
  890. "RTPM_ID_HTC",
  891. "RTPM_ID_QOS_NOTIFY",
  892. "RTPM_ID_DP_TX_DESC_ALLOC_FREE",
  893. "RTPM_ID_CE_SEND_FAST",
  894. "RTPM_ID_SUSPEND_RESUME",
  895. "RTPM_ID_DW_TX_HW_ENQUEUE",
  896. "RTPM_ID_HAL_REO_CMD",
  897. "RTPM_ID_DP_PRINT_RING_STATS",
  898. "RTPM_ID_MAX"};
  899. return (char *)strings[id];
  900. }
  901. #ifdef FEATURE_RUNTIME_PM
  902. struct hif_pm_runtime_lock;
  903. void hif_fastpath_resume(struct hif_opaque_softc *hif_ctx);
  904. int hif_pm_runtime_get_sync(struct hif_opaque_softc *hif_ctx,
  905. wlan_rtpm_dbgid rtpm_dbgid);
  906. int hif_pm_runtime_put_sync_suspend(struct hif_opaque_softc *hif_ctx,
  907. wlan_rtpm_dbgid rtpm_dbgid);
  908. int hif_pm_runtime_request_resume(struct hif_opaque_softc *hif_ctx);
  909. int hif_pm_runtime_get(struct hif_opaque_softc *hif_ctx,
  910. wlan_rtpm_dbgid rtpm_dbgid);
  911. void hif_pm_runtime_get_noresume(struct hif_opaque_softc *hif_ctx,
  912. wlan_rtpm_dbgid rtpm_dbgid);
  913. int hif_pm_runtime_put(struct hif_opaque_softc *hif_ctx,
  914. wlan_rtpm_dbgid rtpm_dbgid);
  915. int hif_pm_runtime_put_noidle(struct hif_opaque_softc *hif_ctx,
  916. wlan_rtpm_dbgid rtpm_dbgid);
  917. void hif_pm_runtime_mark_last_busy(struct hif_opaque_softc *hif_ctx);
  918. int hif_runtime_lock_init(qdf_runtime_lock_t *lock, const char *name);
  919. void hif_runtime_lock_deinit(struct hif_opaque_softc *hif_ctx,
  920. struct hif_pm_runtime_lock *lock);
  921. int hif_pm_runtime_prevent_suspend(struct hif_opaque_softc *ol_sc,
  922. struct hif_pm_runtime_lock *lock);
  923. int hif_pm_runtime_allow_suspend(struct hif_opaque_softc *ol_sc,
  924. struct hif_pm_runtime_lock *lock);
  925. bool hif_pm_runtime_is_suspended(struct hif_opaque_softc *hif_ctx);
  926. int hif_pm_runtime_get_monitor_wake_intr(struct hif_opaque_softc *hif_ctx);
  927. void hif_pm_runtime_set_monitor_wake_intr(struct hif_opaque_softc *hif_ctx,
  928. int val);
  929. void hif_pm_runtime_check_and_request_resume(struct hif_opaque_softc *hif_ctx);
  930. void hif_pm_runtime_mark_dp_rx_busy(struct hif_opaque_softc *hif_ctx);
  931. int hif_pm_runtime_is_dp_rx_busy(struct hif_opaque_softc *hif_ctx);
  932. qdf_time_t hif_pm_runtime_get_dp_rx_busy_mark(struct hif_opaque_softc *hif_ctx);
  933. int hif_pm_runtime_sync_resume(struct hif_opaque_softc *hif_ctx);
  934. #else
  935. struct hif_pm_runtime_lock {
  936. const char *name;
  937. };
  938. static inline void hif_fastpath_resume(struct hif_opaque_softc *hif_ctx) {}
  939. static inline int
  940. hif_pm_runtime_get_sync(struct hif_opaque_softc *hif_ctx,
  941. wlan_rtpm_dbgid rtpm_dbgid)
  942. { return 0; }
  943. static inline int
  944. hif_pm_runtime_put_sync_suspend(struct hif_opaque_softc *hif_ctx,
  945. wlan_rtpm_dbgid rtpm_dbgid)
  946. { return 0; }
  947. static inline int
  948. hif_pm_runtime_request_resume(struct hif_opaque_softc *hif_ctx)
  949. { return 0; }
  950. static inline void
  951. hif_pm_runtime_get_noresume(struct hif_opaque_softc *hif_ctx,
  952. wlan_rtpm_dbgid rtpm_dbgid)
  953. {}
  954. static inline int
  955. hif_pm_runtime_get(struct hif_opaque_softc *hif_ctx, wlan_rtpm_dbgid rtpm_dbgid)
  956. { return 0; }
  957. static inline int
  958. hif_pm_runtime_put(struct hif_opaque_softc *hif_ctx, wlan_rtpm_dbgid rtpm_dbgid)
  959. { return 0; }
  960. static inline int
  961. hif_pm_runtime_put_noidle(struct hif_opaque_softc *hif_ctx,
  962. wlan_rtpm_dbgid rtpm_dbgid)
  963. { return 0; }
  964. static inline void
  965. hif_pm_runtime_mark_last_busy(struct hif_opaque_softc *hif_ctx) {};
  966. static inline int hif_runtime_lock_init(qdf_runtime_lock_t *lock,
  967. const char *name)
  968. { return 0; }
  969. static inline void
  970. hif_runtime_lock_deinit(struct hif_opaque_softc *hif_ctx,
  971. struct hif_pm_runtime_lock *lock) {}
  972. static inline int hif_pm_runtime_prevent_suspend(struct hif_opaque_softc *ol_sc,
  973. struct hif_pm_runtime_lock *lock)
  974. { return 0; }
  975. static inline int hif_pm_runtime_allow_suspend(struct hif_opaque_softc *ol_sc,
  976. struct hif_pm_runtime_lock *lock)
  977. { return 0; }
  978. static inline bool hif_pm_runtime_is_suspended(struct hif_opaque_softc *hif_ctx)
  979. { return false; }
  980. static inline int
  981. hif_pm_runtime_get_monitor_wake_intr(struct hif_opaque_softc *hif_ctx)
  982. { return 0; }
  983. static inline void
  984. hif_pm_runtime_set_monitor_wake_intr(struct hif_opaque_softc *hif_ctx, int val)
  985. { return; }
  986. static inline void
  987. hif_pm_runtime_check_and_request_resume(struct hif_opaque_softc *hif_ctx)
  988. { return; }
  989. static inline void
  990. hif_pm_runtime_mark_dp_rx_busy(struct hif_opaque_softc *hif_ctx) {};
  991. static inline int
  992. hif_pm_runtime_is_dp_rx_busy(struct hif_opaque_softc *hif_ctx)
  993. { return 0; }
  994. static inline qdf_time_t
  995. hif_pm_runtime_get_dp_rx_busy_mark(struct hif_opaque_softc *hif_ctx)
  996. { return 0; }
  997. static inline int hif_pm_runtime_sync_resume(struct hif_opaque_softc *hif_ctx)
  998. { return 0; }
  999. #endif
  1000. void hif_enable_power_management(struct hif_opaque_softc *hif_ctx,
  1001. bool is_packet_log_enabled);
  1002. void hif_disable_power_management(struct hif_opaque_softc *hif_ctx);
  1003. void hif_vote_link_down(struct hif_opaque_softc *hif_ctx);
  1004. void hif_vote_link_up(struct hif_opaque_softc *hif_ctx);
  1005. bool hif_can_suspend_link(struct hif_opaque_softc *hif_ctx);
  1006. #ifdef IPA_OFFLOAD
  1007. /**
  1008. * hif_get_ipa_hw_type() - get IPA hw type
  1009. *
  1010. * This API return the IPA hw type.
  1011. *
  1012. * Return: IPA hw type
  1013. */
  1014. static inline
  1015. enum ipa_hw_type hif_get_ipa_hw_type(void)
  1016. {
  1017. return ipa_get_hw_type();
  1018. }
  1019. /**
  1020. * hif_get_ipa_present() - get IPA hw status
  1021. *
  1022. * This API return the IPA hw status.
  1023. *
  1024. * Return: true if IPA is present or false otherwise
  1025. */
  1026. static inline
  1027. bool hif_get_ipa_present(void)
  1028. {
  1029. if (ipa_uc_reg_rdyCB(NULL) != -EPERM)
  1030. return true;
  1031. else
  1032. return false;
  1033. }
  1034. #endif
  1035. int hif_bus_resume(struct hif_opaque_softc *hif_ctx);
  1036. /**
  1037. * hif_bus_ealry_suspend() - stop non wmi tx traffic
  1038. * @context: hif context
  1039. */
  1040. int hif_bus_early_suspend(struct hif_opaque_softc *hif_ctx);
  1041. /**
  1042. * hif_bus_late_resume() - resume non wmi traffic
  1043. * @context: hif context
  1044. */
  1045. int hif_bus_late_resume(struct hif_opaque_softc *hif_ctx);
  1046. int hif_bus_suspend(struct hif_opaque_softc *hif_ctx);
  1047. int hif_bus_resume_noirq(struct hif_opaque_softc *hif_ctx);
  1048. int hif_bus_suspend_noirq(struct hif_opaque_softc *hif_ctx);
  1049. /**
  1050. * hif_apps_irqs_enable() - Enables all irqs from the APPS side
  1051. * @hif_ctx: an opaque HIF handle to use
  1052. *
  1053. * As opposed to the standard hif_irq_enable, this function always applies to
  1054. * the APPS side kernel interrupt handling.
  1055. *
  1056. * Return: errno
  1057. */
  1058. int hif_apps_irqs_enable(struct hif_opaque_softc *hif_ctx);
  1059. /**
  1060. * hif_apps_irqs_disable() - Disables all irqs from the APPS side
  1061. * @hif_ctx: an opaque HIF handle to use
  1062. *
  1063. * As opposed to the standard hif_irq_disable, this function always applies to
  1064. * the APPS side kernel interrupt handling.
  1065. *
  1066. * Return: errno
  1067. */
  1068. int hif_apps_irqs_disable(struct hif_opaque_softc *hif_ctx);
  1069. /**
  1070. * hif_apps_wake_irq_enable() - Enables the wake irq from the APPS side
  1071. * @hif_ctx: an opaque HIF handle to use
  1072. *
  1073. * As opposed to the standard hif_irq_enable, this function always applies to
  1074. * the APPS side kernel interrupt handling.
  1075. *
  1076. * Return: errno
  1077. */
  1078. int hif_apps_wake_irq_enable(struct hif_opaque_softc *hif_ctx);
  1079. /**
  1080. * hif_apps_wake_irq_disable() - Disables the wake irq from the APPS side
  1081. * @hif_ctx: an opaque HIF handle to use
  1082. *
  1083. * As opposed to the standard hif_irq_disable, this function always applies to
  1084. * the APPS side kernel interrupt handling.
  1085. *
  1086. * Return: errno
  1087. */
  1088. int hif_apps_wake_irq_disable(struct hif_opaque_softc *hif_ctx);
  1089. /**
  1090. * hif_apps_enable_irq_wake() - Enables the irq wake from the APPS side
  1091. * @hif_ctx: an opaque HIF handle to use
  1092. *
  1093. * This function always applies to the APPS side kernel interrupt handling
  1094. * to wake the system from suspend.
  1095. *
  1096. * Return: errno
  1097. */
  1098. int hif_apps_enable_irq_wake(struct hif_opaque_softc *hif_ctx);
  1099. /**
  1100. * hif_apps_disable_irq_wake() - Disables the wake irq from the APPS side
  1101. * @hif_ctx: an opaque HIF handle to use
  1102. *
  1103. * This function always applies to the APPS side kernel interrupt handling
  1104. * to disable the wake irq.
  1105. *
  1106. * Return: errno
  1107. */
  1108. int hif_apps_disable_irq_wake(struct hif_opaque_softc *hif_ctx);
  1109. #ifdef FEATURE_RUNTIME_PM
  1110. int hif_pre_runtime_suspend(struct hif_opaque_softc *hif_ctx);
  1111. void hif_pre_runtime_resume(struct hif_opaque_softc *hif_ctx);
  1112. int hif_runtime_suspend(struct hif_opaque_softc *hif_ctx);
  1113. int hif_runtime_resume(struct hif_opaque_softc *hif_ctx);
  1114. void hif_process_runtime_suspend_success(struct hif_opaque_softc *hif_ctx);
  1115. void hif_process_runtime_suspend_failure(struct hif_opaque_softc *hif_ctx);
  1116. void hif_process_runtime_resume_success(struct hif_opaque_softc *hif_ctx);
  1117. #endif
  1118. int hif_get_irq_num(struct hif_opaque_softc *scn, int *irq, uint32_t size);
  1119. int hif_dump_registers(struct hif_opaque_softc *scn);
  1120. int ol_copy_ramdump(struct hif_opaque_softc *scn);
  1121. void hif_crash_shutdown(struct hif_opaque_softc *hif_ctx);
  1122. void hif_get_hw_info(struct hif_opaque_softc *hif_ctx, u32 *version,
  1123. u32 *revision, const char **target_name);
  1124. enum qdf_bus_type hif_get_bus_type(struct hif_opaque_softc *hif_hdl);
  1125. struct hif_target_info *hif_get_target_info_handle(struct hif_opaque_softc *
  1126. scn);
  1127. struct hif_config_info *hif_get_ini_handle(struct hif_opaque_softc *hif_ctx);
  1128. struct ramdump_info *hif_get_ramdump_ctx(struct hif_opaque_softc *hif_ctx);
  1129. enum hif_target_status hif_get_target_status(struct hif_opaque_softc *hif_ctx);
  1130. void hif_set_target_status(struct hif_opaque_softc *hif_ctx, enum
  1131. hif_target_status);
  1132. void hif_init_ini_config(struct hif_opaque_softc *hif_ctx,
  1133. struct hif_config_info *cfg);
  1134. void hif_update_tx_ring(struct hif_opaque_softc *osc, u_int32_t num_htt_cmpls);
  1135. qdf_nbuf_t hif_batch_send(struct hif_opaque_softc *osc, qdf_nbuf_t msdu,
  1136. uint32_t transfer_id, u_int32_t len, uint32_t sendhead);
  1137. QDF_STATUS hif_send_single(struct hif_opaque_softc *osc, qdf_nbuf_t msdu,
  1138. uint32_t transfer_id, u_int32_t len);
  1139. int hif_send_fast(struct hif_opaque_softc *osc, qdf_nbuf_t nbuf,
  1140. uint32_t transfer_id, uint32_t download_len);
  1141. void hif_pkt_dl_len_set(void *hif_sc, unsigned int pkt_download_len);
  1142. void hif_ce_war_disable(void);
  1143. void hif_ce_war_enable(void);
  1144. void hif_disable_interrupt(struct hif_opaque_softc *osc, uint32_t pipe_num);
  1145. #ifdef QCA_NSS_WIFI_OFFLOAD_SUPPORT
  1146. struct hif_pipe_addl_info *hif_get_addl_pipe_info(struct hif_opaque_softc *osc,
  1147. struct hif_pipe_addl_info *hif_info, uint32_t pipe_number);
  1148. uint32_t hif_set_nss_wifiol_mode(struct hif_opaque_softc *osc,
  1149. uint32_t pipe_num);
  1150. int32_t hif_get_nss_wifiol_bypass_nw_process(struct hif_opaque_softc *osc);
  1151. #endif /* QCA_NSS_WIFI_OFFLOAD_SUPPORT */
  1152. void hif_set_bundle_mode(struct hif_opaque_softc *hif_ctx, bool enabled,
  1153. int rx_bundle_cnt);
  1154. int hif_bus_reset_resume(struct hif_opaque_softc *hif_ctx);
  1155. void hif_set_attribute(struct hif_opaque_softc *osc, uint8_t hif_attrib);
  1156. void *hif_get_lro_info(int ctx_id, struct hif_opaque_softc *hif_hdl);
  1157. enum hif_exec_type {
  1158. HIF_EXEC_NAPI_TYPE,
  1159. HIF_EXEC_TASKLET_TYPE,
  1160. };
  1161. typedef uint32_t (*ext_intr_handler)(void *, uint32_t);
  1162. /**
  1163. * hif_get_int_ctx_irq_num() - retrieve an irq num for an interrupt context id
  1164. * @softc: hif opaque context owning the exec context
  1165. * @id: the id of the interrupt context
  1166. *
  1167. * Return: IRQ number of the first (zero'th) IRQ within the interrupt context ID
  1168. * 'id' registered with the OS
  1169. */
  1170. int32_t hif_get_int_ctx_irq_num(struct hif_opaque_softc *softc,
  1171. uint8_t id);
  1172. /**
  1173. * hif_configure_ext_group_interrupts() - Congigure ext group intrrupts
  1174. * @hif_ctx: hif opaque context
  1175. *
  1176. * Return: QDF_STATUS
  1177. */
  1178. QDF_STATUS hif_configure_ext_group_interrupts(struct hif_opaque_softc *hif_ctx);
  1179. /**
  1180. * hif_register_ext_group() - API to register external group
  1181. * interrupt handler.
  1182. * @hif_ctx : HIF Context
  1183. * @numirq: number of irq's in the group
  1184. * @irq: array of irq values
  1185. * @handler: callback interrupt handler function
  1186. * @cb_ctx: context to passed in callback
  1187. * @type: napi vs tasklet
  1188. *
  1189. * Return: QDF_STATUS
  1190. */
  1191. QDF_STATUS hif_register_ext_group(struct hif_opaque_softc *hif_ctx,
  1192. uint32_t numirq, uint32_t irq[],
  1193. ext_intr_handler handler,
  1194. void *cb_ctx, const char *context_name,
  1195. enum hif_exec_type type, uint32_t scale);
  1196. void hif_deregister_exec_group(struct hif_opaque_softc *hif_ctx,
  1197. const char *context_name);
  1198. void hif_update_pipe_callback(struct hif_opaque_softc *osc,
  1199. u_int8_t pipeid,
  1200. struct hif_msg_callbacks *callbacks);
  1201. /**
  1202. * hif_print_napi_stats() - Display HIF NAPI stats
  1203. * @hif_ctx - HIF opaque context
  1204. *
  1205. * Return: None
  1206. */
  1207. void hif_print_napi_stats(struct hif_opaque_softc *hif_ctx);
  1208. /* hif_clear_napi_stats() - function clears the stats of the
  1209. * latency when called.
  1210. * @hif_ctx - the HIF context to assign the callback to
  1211. *
  1212. * Return: None
  1213. */
  1214. void hif_clear_napi_stats(struct hif_opaque_softc *hif_ctx);
  1215. #ifdef __cplusplus
  1216. }
  1217. #endif
  1218. #ifdef FORCE_WAKE
  1219. /**
  1220. * hif_force_wake_request() - Function to wake from power collapse
  1221. * @handle: HIF opaque handle
  1222. *
  1223. * Description: API to check if the device is awake or not before
  1224. * read/write to BAR + 4K registers. If device is awake return
  1225. * success otherwise write '1' to
  1226. * PCIE_PCIE_LOCAL_REG_PCIE_SOC_WAKE_PCIE_LOCAL_REG which will interrupt
  1227. * the device and does wakeup the PCI and MHI within 50ms
  1228. * and then the device writes a value to
  1229. * PCIE_SOC_PCIE_REG_PCIE_SCRATCH_0_SOC_PCIE_REG to complete the
  1230. * handshake process to let the host know the device is awake.
  1231. *
  1232. * Return: zero - success/non-zero - failure
  1233. */
  1234. int hif_force_wake_request(struct hif_opaque_softc *handle);
  1235. /**
  1236. * hif_force_wake_release() - API to release/reset the SOC wake register
  1237. * from interrupting the device.
  1238. * @handle: HIF opaque handle
  1239. *
  1240. * Description: API to set the
  1241. * PCIE_PCIE_LOCAL_REG_PCIE_SOC_WAKE_PCIE_LOCAL_REG to '0'
  1242. * to release the interrupt line.
  1243. *
  1244. * Return: zero - success/non-zero - failure
  1245. */
  1246. int hif_force_wake_release(struct hif_opaque_softc *handle);
  1247. #else
  1248. static inline
  1249. int hif_force_wake_request(struct hif_opaque_softc *handle)
  1250. {
  1251. return 0;
  1252. }
  1253. static inline
  1254. int hif_force_wake_release(struct hif_opaque_softc *handle)
  1255. {
  1256. return 0;
  1257. }
  1258. #endif /* FORCE_WAKE */
  1259. #ifdef FEATURE_HAL_DELAYED_REG_WRITE
  1260. /**
  1261. * hif_prevent_link_low_power_states() - Prevent from going to low power states
  1262. * @hif - HIF opaque context
  1263. *
  1264. * Return: 0 on success. Error code on failure.
  1265. */
  1266. int hif_prevent_link_low_power_states(struct hif_opaque_softc *hif);
  1267. /**
  1268. * hif_allow_link_low_power_states() - Allow link to go to low power states
  1269. * @hif - HIF opaque context
  1270. *
  1271. * Return: None
  1272. */
  1273. void hif_allow_link_low_power_states(struct hif_opaque_softc *hif);
  1274. #else
  1275. static inline
  1276. int hif_prevent_link_low_power_states(struct hif_opaque_softc *hif)
  1277. {
  1278. return 0;
  1279. }
  1280. static inline
  1281. void hif_allow_link_low_power_states(struct hif_opaque_softc *hif)
  1282. {
  1283. }
  1284. #endif
  1285. void *hif_get_dev_ba(struct hif_opaque_softc *hif_handle);
  1286. void *hif_get_dev_ba_ce(struct hif_opaque_softc *hif_handle);
  1287. /**
  1288. * hif_set_initial_wakeup_cb() - set the initial wakeup event handler function
  1289. * @hif_ctx - the HIF context to assign the callback to
  1290. * @callback - the callback to assign
  1291. * @priv - the private data to pass to the callback when invoked
  1292. *
  1293. * Return: None
  1294. */
  1295. void hif_set_initial_wakeup_cb(struct hif_opaque_softc *hif_ctx,
  1296. void (*callback)(void *),
  1297. void *priv);
  1298. /*
  1299. * Note: For MCL, #if defined (HIF_CONFIG_SLUB_DEBUG_ON) needs to be checked
  1300. * for defined here
  1301. */
  1302. #if defined(HIF_CONFIG_SLUB_DEBUG_ON) || defined(HIF_CE_DEBUG_DATA_BUF)
  1303. ssize_t hif_dump_desc_trace_buf(struct device *dev,
  1304. struct device_attribute *attr, char *buf);
  1305. ssize_t hif_input_desc_trace_buf_index(struct hif_softc *scn,
  1306. const char *buf, size_t size);
  1307. ssize_t hif_ce_en_desc_hist(struct hif_softc *scn,
  1308. const char *buf, size_t size);
  1309. ssize_t hif_disp_ce_enable_desc_data_hist(struct hif_softc *scn, char *buf);
  1310. ssize_t hif_dump_desc_event(struct hif_softc *scn, char *buf);
  1311. #endif/*#if defined(HIF_CONFIG_SLUB_DEBUG_ON)||defined(HIF_CE_DEBUG_DATA_BUF)*/
  1312. /**
  1313. * hif_set_ce_service_max_yield_time() - sets CE service max yield time
  1314. * @hif: hif context
  1315. * @ce_service_max_yield_time: CE service max yield time to set
  1316. *
  1317. * This API storess CE service max yield time in hif context based
  1318. * on ini value.
  1319. *
  1320. * Return: void
  1321. */
  1322. void hif_set_ce_service_max_yield_time(struct hif_opaque_softc *hif,
  1323. uint32_t ce_service_max_yield_time);
  1324. /**
  1325. * hif_get_ce_service_max_yield_time() - get CE service max yield time
  1326. * @hif: hif context
  1327. *
  1328. * This API returns CE service max yield time.
  1329. *
  1330. * Return: CE service max yield time
  1331. */
  1332. unsigned long long
  1333. hif_get_ce_service_max_yield_time(struct hif_opaque_softc *hif);
  1334. /**
  1335. * hif_set_ce_service_max_rx_ind_flush() - sets CE service max rx ind flush
  1336. * @hif: hif context
  1337. * @ce_service_max_rx_ind_flush: CE service max rx ind flush to set
  1338. *
  1339. * This API stores CE service max rx ind flush in hif context based
  1340. * on ini value.
  1341. *
  1342. * Return: void
  1343. */
  1344. void hif_set_ce_service_max_rx_ind_flush(struct hif_opaque_softc *hif,
  1345. uint8_t ce_service_max_rx_ind_flush);
  1346. #ifdef OL_ATH_SMART_LOGGING
  1347. /*
  1348. * hif_log_ce_dump() - Copy all the CE DEST ring to buf
  1349. * @scn : HIF handler
  1350. * @buf_cur: Current pointer in ring buffer
  1351. * @buf_init:Start of the ring buffer
  1352. * @buf_sz: Size of the ring buffer
  1353. * @ce: Copy Engine id
  1354. * @skb_sz: Max size of the SKB buffer to be copied
  1355. *
  1356. * Calls the respective function to dump all the CE SRC/DEST ring descriptors
  1357. * and buffers pointed by them in to the given buf
  1358. *
  1359. * Return: Current pointer in ring buffer
  1360. */
  1361. uint8_t *hif_log_dump_ce(struct hif_softc *scn, uint8_t *buf_cur,
  1362. uint8_t *buf_init, uint32_t buf_sz,
  1363. uint32_t ce, uint32_t skb_sz);
  1364. #endif /* OL_ATH_SMART_LOGGING */
  1365. /*
  1366. * hif_softc_to_hif_opaque_softc - API to convert hif_softc handle
  1367. * to hif_opaque_softc handle
  1368. * @hif_handle - hif_softc type
  1369. *
  1370. * Return: hif_opaque_softc type
  1371. */
  1372. static inline struct hif_opaque_softc *
  1373. hif_softc_to_hif_opaque_softc(struct hif_softc *hif_handle)
  1374. {
  1375. return (struct hif_opaque_softc *)hif_handle;
  1376. }
  1377. #ifdef FORCE_WAKE
  1378. /**
  1379. * hif_srng_init_phase(): Indicate srng initialization phase
  1380. * to avoid force wake as UMAC power collapse is not yet
  1381. * enabled
  1382. * @hif_ctx: hif opaque handle
  1383. * @init_phase: initialization phase
  1384. *
  1385. * Return: None
  1386. */
  1387. void hif_srng_init_phase(struct hif_opaque_softc *hif_ctx,
  1388. bool init_phase);
  1389. #else
  1390. static inline
  1391. void hif_srng_init_phase(struct hif_opaque_softc *hif_ctx,
  1392. bool init_phase)
  1393. {
  1394. }
  1395. #endif /* FORCE_WAKE */
  1396. #ifdef HIF_IPCI
  1397. /**
  1398. * hif_shutdown_notifier_cb - Call back for shutdown notifier
  1399. * @ctx: hif handle
  1400. *
  1401. * Return: None
  1402. */
  1403. void hif_shutdown_notifier_cb(void *ctx);
  1404. #else
  1405. static inline
  1406. void hif_shutdown_notifier_cb(void *ctx)
  1407. {
  1408. }
  1409. #endif /* HIF_IPCI */
  1410. #ifdef HIF_CE_LOG_INFO
  1411. /**
  1412. * hif_log_ce_info() - API to log ce info
  1413. * @scn: hif handle
  1414. * @data: hang event data buffer
  1415. * @offset: offset at which data needs to be written
  1416. *
  1417. * Return: None
  1418. */
  1419. void hif_log_ce_info(struct hif_softc *scn, uint8_t *data,
  1420. unsigned int *offset);
  1421. #else
  1422. static inline
  1423. void hif_log_ce_info(struct hif_softc *scn, uint8_t *data,
  1424. unsigned int *offset)
  1425. {
  1426. }
  1427. #endif
  1428. #ifdef HIF_CPU_PERF_AFFINE_MASK
  1429. /**
  1430. * hif_config_irq_set_perf_affinity_hint() - API to set affinity
  1431. * @hif_ctx: hif opaque handle
  1432. *
  1433. * This function is used to move the WLAN IRQs to perf cores in
  1434. * case of defconfig builds.
  1435. *
  1436. * Return: None
  1437. */
  1438. void hif_config_irq_set_perf_affinity_hint(
  1439. struct hif_opaque_softc *hif_ctx);
  1440. #else
  1441. static inline void hif_config_irq_set_perf_affinity_hint(
  1442. struct hif_opaque_softc *hif_ctx)
  1443. {
  1444. }
  1445. #endif
  1446. #endif /* _HIF_H_ */