hif.h 62 KB

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