wlan_defs.h 70 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861
  1. /*
  2. * Copyright (c) 2013-2016, 2018-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  6. *
  7. *
  8. * Permission to use, copy, modify, and/or distribute this software for
  9. * any purpose with or without fee is hereby granted, provided that the
  10. * above copyright notice and this permission notice appear in all
  11. * copies.
  12. *
  13. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  14. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  15. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  16. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  17. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  18. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  19. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  20. * PERFORMANCE OF THIS SOFTWARE.
  21. */
  22. /*
  23. * This file was originally distributed by Qualcomm Atheros, Inc.
  24. * under proprietary terms before Copyright ownership was assigned
  25. * to the Linux Foundation.
  26. */
  27. #ifndef __WLAN_DEFS_H__
  28. #define __WLAN_DEFS_H__
  29. #include <a_osapi.h> /* A_COMPILE_TIME_ASSERT */
  30. /*
  31. * This file contains WLAN definitions that may be used across both
  32. * Host and Target software.
  33. */
  34. /*
  35. * MAX_SPATIAL_STREAM should be defined in a fwconfig_xxx.h file,
  36. * but for now provide a default value here in case it's not defined
  37. * in the fwconfig_xxx.h file.
  38. */
  39. #ifndef MAX_SPATIAL_STREAM
  40. #define MAX_SPATIAL_STREAM 3
  41. #endif
  42. /*
  43. * NOTE: The CONFIG_160MHZ_SUPPORT is not used consistently - some code
  44. * uses "#ifdef CONFIG_160MHZ_SUPPORT" while other code uses
  45. * "#if CONFIG_160MHZ_SUPPORT".
  46. * This use is being standardized in the recent versions of code to use
  47. * #ifdef, but is being left as is in the legacy code branches.
  48. * To minimize impact to legacy code branches, this file internally
  49. * converts CONFIG_160MHZ_SUPPORT=0 to having CONFIG_160MHZ_SUPPORT
  50. * undefined.
  51. * For builds that explicitly set CONFIG_160MHZ_SUPPORT=0, the bottom of
  52. * this file restores CONFIG_160MHZ_SUPPORT from being undefined to being 0.
  53. */
  54. // OLD:
  55. //#ifndef CONFIG_160MHZ_SUPPORT
  56. //#define CONFIG_160MHZ_SUPPORT 0 /* default: 160 MHz channels not supported */
  57. //#endif
  58. // NEW:
  59. #ifdef CONFIG_160MHZ_SUPPORT
  60. /* CONFIG_160MHZ_SUPPORT is explicitly enabled or explicitly disabled */
  61. #if !CONFIG_160MHZ_SUPPORT
  62. /* CONFIG_160MHZ_SUPPORT is explicitly disabled */
  63. /* Change from CONFIG_160MHZ_SUPPORT=0 to CONFIG_160MHZ_SUPPORT=<undef> */
  64. #undef CONFIG_160MHZ_SUPPORT
  65. /*
  66. * Set a flag to indicate this CONFIG_160MHZ_SUPPORT = 0 --> undef
  67. * change has been done, so we can undo the change at the bottom
  68. * of the file.
  69. */
  70. #define CONFIG_160MHZ_SUPPORT_UNDEF_WAR
  71. #endif
  72. #else
  73. /*
  74. * For backwards compatibility, if CONFIG_160MHZ_SUPPORT is not defined,
  75. * default it to 0, if this is either a host build or a Rome target build.
  76. * This maintains the prior behavior for the host and Rome target builds.
  77. */
  78. #if defined(AR6320) || !defined(ATH_TARGET)
  79. /*
  80. * Set a flag to indicate that at the end of the file,
  81. * CONFIG_160MHZ_SUPPORT should be set to 0.
  82. */
  83. #define CONFIG_160MHZ_SUPPORT_UNDEF_WAR
  84. #endif
  85. #endif
  86. #ifndef SUPPORT_11AX
  87. #define SUPPORT_11AX 0 /* 11ax not supported by default */
  88. #endif
  89. /*
  90. * MAX_SPATIAL_STREAM_ANY -
  91. * what is the largest number of spatial streams that any target supports
  92. */
  93. #define MAX_SPATIAL_STREAM_ANY_V2 4 /* pre-hawkeye */
  94. #define MAX_SPATIAL_STREAM_ANY_V3 8 /* includes hawkeye */
  95. /*
  96. * (temporarily) leave the old MAX_SPATIAL_STREAM_ANY name in place as an alias,
  97. * and in case some old code is using it
  98. */
  99. #define MAX_SPATIAL_STREAM_ANY MAX_SPATIAL_STREAM_ANY_V2 /* DEPRECATED */
  100. /* defines to set Packet extension values which can be 0, 8, or 16 usec */
  101. /* NOTE: Below values cannot be changed without breaking WMI Compatibility */
  102. #define MAX_HE_NSS 8
  103. #define MAX_HE_MODULATION 8
  104. #define MAX_HE_RU 4
  105. #define HE_MODULATION_NONE 7
  106. #define HE_PET_0_USEC 0
  107. #define HE_PET_8_USEC 1
  108. #define HE_PET_16_USEC 2
  109. #define DEFAULT_OFDMA_RU26_COUNT 0
  110. typedef enum {
  111. MODE_11A = 0, /* 11a Mode */
  112. MODE_11G = 1, /* 11b/g Mode */
  113. MODE_11B = 2, /* 11b Mode */
  114. MODE_11GONLY = 3, /* 11g only Mode */
  115. MODE_11NA_HT20 = 4, /* 11a HT20 mode */
  116. MODE_11NG_HT20 = 5, /* 11g HT20 mode */
  117. MODE_11NA_HT40 = 6, /* 11a HT40 mode */
  118. MODE_11NG_HT40 = 7, /* 11g HT40 mode */
  119. MODE_11AC_VHT20 = 8,
  120. MODE_11AC_VHT40 = 9,
  121. MODE_11AC_VHT80 = 10,
  122. MODE_11AC_VHT20_2G = 11,
  123. MODE_11AC_VHT40_2G = 12,
  124. MODE_11AC_VHT80_2G = 13,
  125. #ifdef CONFIG_160MHZ_SUPPORT
  126. MODE_11AC_VHT80_80 = 14,
  127. MODE_11AC_VHT160 = 15,
  128. #endif
  129. #if SUPPORT_11AX
  130. MODE_11AX_HE20 = 16,
  131. MODE_11AX_HE40 = 17,
  132. MODE_11AX_HE80 = 18,
  133. MODE_11AX_HE80_80 = 19,
  134. MODE_11AX_HE160 = 20,
  135. MODE_11AX_HE20_2G = 21,
  136. MODE_11AX_HE40_2G = 22,
  137. MODE_11AX_HE80_2G = 23,
  138. #endif
  139. #if (defined(SUPPORT_11BE) && SUPPORT_11BE) || defined(SUPPORT_11BE_ROM)
  140. MODE_11BE_EHT20 = 24,
  141. MODE_11BE_EHT40 = 25,
  142. MODE_11BE_EHT80 = 26,
  143. MODE_11BE_EHT80_80 = 27,
  144. MODE_11BE_EHT160 = 28,
  145. MODE_11BE_EHT160_160 = 29,
  146. MODE_11BE_EHT320 = 30,
  147. MODE_11BE_EHT20_2G = 31, /* For WIN */
  148. MODE_11BE_EHT40_2G = 32, /* For WIN */
  149. #endif
  150. /*
  151. * MODE_UNKNOWN should not be used within the host / target interface.
  152. * Thus, it is permissible for MODE_UNKNOWN to be conditionally-defined,
  153. * taking different values when compiling for different targets.
  154. */
  155. MODE_UNKNOWN,
  156. MODE_UNKNOWN_NO_160MHZ_SUPPORT = 14, /* not needed? */
  157. MODE_UNKNOWN_160MHZ_SUPPORT = MODE_UNKNOWN, /* not needed? */
  158. #ifdef ATHR_WIN_NWF
  159. PHY_MODE_MAX = MODE_UNKNOWN,
  160. PHY_MODE_MAX_NO_160_MHZ_SUPPORT = MODE_UNKNOWN_NO_160MHZ_SUPPORT,
  161. PHY_MODE_MAX_160_MHZ_SUPPORT = MODE_UNKNOWN_160MHZ_SUPPORT,
  162. #else
  163. MODE_MAX = MODE_UNKNOWN,
  164. MODE_MAX_NO_160_MHZ_SUPPORT = MODE_UNKNOWN_NO_160MHZ_SUPPORT,
  165. MODE_MAX_160_MHZ_SUPPORT = MODE_UNKNOWN_160MHZ_SUPPORT,
  166. #endif
  167. } WLAN_PHY_MODE;
  168. #if (!defined(CONFIG_160MHZ_SUPPORT)) && (!defined(SUPPORT_11AX))
  169. A_COMPILE_TIME_ASSERT(
  170. mode_unknown_value_consistency_Check,
  171. MODE_UNKNOWN == MODE_UNKNOWN_NO_160MHZ_SUPPORT);
  172. #else
  173. /*
  174. * If SUPPORT_11AX is defined but CONFIG_160MHZ_SUPPORT is not defined,
  175. * there will be a gap in the mode values, with 14 and 15 being unused.
  176. * But MODE_UNKNOWN_NO_160MHZ_SUPPORT will have an invalid value, since
  177. * mode values 16 through 23 will be used for 11AX modes.
  178. * Thus, MODE_UNKNOWN would still be MODE_UNKNOWN_160MHZ_SUPPORT, for
  179. * cases where 160 MHz is not supported by 11AX is supported.
  180. * (Ideally, MODE_UNKNOWN_160MHZ_SUPPORT and NO_160MHZ_SUPPORT should be
  181. * renamed to cover the 4 permutations of support or no support for
  182. * 11AX and 160 MHZ, but that is impractical, due to backwards
  183. * compatibility concerns.)
  184. */
  185. A_COMPILE_TIME_ASSERT(
  186. mode_unknown_value_consistency_Check,
  187. MODE_UNKNOWN == MODE_UNKNOWN_160MHZ_SUPPORT);
  188. #endif
  189. typedef enum {
  190. VHT_MODE_NONE = 0, /* NON VHT Mode, e.g., HT, DSSS, CCK */
  191. VHT_MODE_20M = 1,
  192. VHT_MODE_40M = 2,
  193. VHT_MODE_80M = 3,
  194. VHT_MODE_160M = 4
  195. } VHT_OPER_MODE;
  196. typedef enum {
  197. WLAN_11A_CAPABILITY = 1,
  198. WLAN_11G_CAPABILITY = 2,
  199. WLAN_11AG_CAPABILITY = 3,
  200. } WLAN_CAPABILITY;
  201. #ifdef CONFIG_160MHZ_SUPPORT
  202. #define IS_MODE_VHT(mode) (((mode) == MODE_11AC_VHT20) || \
  203. ((mode) == MODE_11AC_VHT40) || \
  204. ((mode) == MODE_11AC_VHT80) || \
  205. ((mode) == MODE_11AC_VHT80_80) || \
  206. ((mode) == MODE_11AC_VHT160))
  207. #else
  208. #define IS_MODE_VHT(mode) (((mode) == MODE_11AC_VHT20) || \
  209. ((mode) == MODE_11AC_VHT40) || \
  210. ((mode) == MODE_11AC_VHT80))
  211. #endif
  212. #if SUPPORT_11AX
  213. #define IS_MODE_HE(mode) (((mode) == MODE_11AX_HE20) || \
  214. ((mode) == MODE_11AX_HE40) || \
  215. ((mode) == MODE_11AX_HE80) || \
  216. ((mode) == MODE_11AX_HE80_80) || \
  217. ((mode) == MODE_11AX_HE160) || \
  218. ((mode) == MODE_11AX_HE20_2G) || \
  219. ((mode) == MODE_11AX_HE40_2G) || \
  220. ((mode) == MODE_11AX_HE80_2G))
  221. #define IS_MODE_HE_5G_6G(mode) (((mode) == MODE_11AX_HE20) || \
  222. ((mode) == MODE_11AX_HE40) || \
  223. ((mode) == MODE_11AX_HE80) || \
  224. ((mode) == MODE_11AX_HE80_80) || \
  225. ((mode) == MODE_11AX_HE160))
  226. #define IS_MODE_HE_2G(mode) (((mode) == MODE_11AX_HE20_2G) || \
  227. ((mode) == MODE_11AX_HE40_2G) || \
  228. ((mode) == MODE_11AX_HE80_2G))
  229. #endif /* SUPPORT_11AX */
  230. #if (defined(SUPPORT_11BE) && SUPPORT_11BE) || defined(SUPPORT_11BE_ROM)
  231. #define IS_MODE_EHT(mode) (((mode) == MODE_11BE_EHT20) || \
  232. ((mode) == MODE_11BE_EHT40) || \
  233. ((mode) == MODE_11BE_EHT80) || \
  234. ((mode) == MODE_11BE_EHT80_80) || \
  235. ((mode) == MODE_11BE_EHT160) || \
  236. ((mode) == MODE_11BE_EHT160_160)|| \
  237. ((mode) == MODE_11BE_EHT320) || \
  238. ((mode) == MODE_11BE_EHT20_2G) || \
  239. ((mode) == MODE_11BE_EHT40_2G))
  240. #define IS_MODE_EHT_2G(mode) (((mode) == MODE_11BE_EHT20_2G) || \
  241. ((mode) == MODE_11BE_EHT40_2G))
  242. #endif /* SUPPORT_11BE */
  243. #define IS_MODE_VHT_2G(mode) (((mode) == MODE_11AC_VHT20_2G) || \
  244. ((mode) == MODE_11AC_VHT40_2G) || \
  245. ((mode) == MODE_11AC_VHT80_2G))
  246. #define IS_MODE_11A(mode) (((mode) == MODE_11A) || \
  247. ((mode) == MODE_11NA_HT20) || \
  248. ((mode) == MODE_11NA_HT40) || \
  249. (IS_MODE_VHT(mode)))
  250. #define IS_MODE_11B(mode) ((mode) == MODE_11B)
  251. #define IS_MODE_11G(mode) (((mode) == MODE_11G) || \
  252. ((mode) == MODE_11GONLY) || \
  253. ((mode) == MODE_11NG_HT20) || \
  254. ((mode) == MODE_11NG_HT40) || \
  255. (IS_MODE_VHT_2G(mode)))
  256. #define IS_MODE_11GN(mode) (((mode) == MODE_11NG_HT20) || \
  257. ((mode) == MODE_11NG_HT40))
  258. #define IS_MODE_11GONLY(mode) ((mode) == MODE_11GONLY)
  259. #define IS_MODE_LEGACY(phymode) ((phymode == MODE_11A) || \
  260. (phymode == MODE_11G) || \
  261. (phymode == MODE_11B) || \
  262. (phymode == MODE_11GONLY))
  263. #define IS_MODE_11N(phymode) ((phymode >= MODE_11NA_HT20) && \
  264. (phymode <= MODE_11NG_HT40))
  265. #ifdef CONFIG_160MHZ_SUPPORT
  266. #define IS_MODE_11AC(phymode) ((phymode >= MODE_11AC_VHT20) && \
  267. (phymode <= MODE_11AC_VHT160))
  268. #define IS_MODE_11AC_5G(phymode) ((phymode == MODE_11AC_VHT20) || \
  269. (phymode == MODE_11AC_VHT40) || \
  270. (phymode == MODE_11AC_VHT80) || \
  271. (phymode == MODE_11AC_VHT80_80) || \
  272. (phymode == MODE_11AC_VHT160))
  273. #else
  274. #define IS_MODE_11AC(phymode) ((phymode >= MODE_11AC_VHT20) && \
  275. (phymode <= MODE_11AC_VHT80_2G))
  276. #define IS_MODE_11AC_5G(phymode) ((phymode == MODE_11AC_VHT20) || \
  277. (phymode == MODE_11AC_VHT40) || \
  278. (phymode == MODE_11AC_VHT80))
  279. #endif /* CONFIG_160MHZ_SUPPORT */
  280. #if SUPPORT_11AX
  281. #define IS_MODE_80MHZ(phymode) ((phymode == MODE_11AC_VHT80_2G) || \
  282. (phymode == MODE_11AC_VHT80) || \
  283. (phymode == MODE_11AX_HE80) || \
  284. (phymode == MODE_11AX_HE80_2G))
  285. #define IS_MODE_40MHZ(phymode) ((phymode == MODE_11AC_VHT40_2G) || \
  286. (phymode == MODE_11AC_VHT40) || \
  287. (phymode == MODE_11NG_HT40) || \
  288. (phymode == MODE_11NA_HT40) || \
  289. (phymode == MODE_11AX_HE40) || \
  290. (phymode == MODE_11AX_HE40_2G))
  291. #else
  292. #define IS_MODE_80MHZ(phymode) ((phymode == MODE_11AC_VHT80_2G) || \
  293. (phymode == MODE_11AC_VHT80))
  294. #define IS_MODE_40MHZ(phymode) ((phymode == MODE_11AC_VHT40_2G) || \
  295. (phymode == MODE_11AC_VHT40) || \
  296. (phymode == MODE_11NG_HT40) || \
  297. (phymode == MODE_11NA_HT40))
  298. #endif /* SUPPORT_11AX */
  299. enum {
  300. REGDMN_MODE_11A_BIT = 0, /* 11a channels */
  301. REGDMN_MODE_TURBO_BIT = 1, /* 11a turbo-only channels */
  302. REGDMN_MODE_11B_BIT = 2, /* 11b channels */
  303. REGDMN_MODE_PUREG_BIT = 3, /* 11g channels (OFDM only) */
  304. REGDMN_MODE_11G_BIT = 3, /* XXX historical */
  305. /* bit 4 is reserved */
  306. REGDMN_MODE_108G_BIT = 5, /* 11g+Turbo channels */
  307. REGDMN_MODE_108A_BIT = 6, /* 11a+Turbo channels */
  308. /* bit 7 is reserved */
  309. REGDMN_MODE_XR_BIT = 8, /* XR channels */
  310. REGDMN_MODE_11A_HALF_RATE_BIT = 9, /* 11A half rate channels */
  311. REGDMN_MODE_11A_QUARTER_RATE_BIT = 10, /* 11A quarter rate channels */
  312. REGDMN_MODE_11NG_HT20_BIT = 11, /* 11N-G HT20 channels */
  313. REGDMN_MODE_11NA_HT20_BIT = 12, /* 11N-A HT20 channels */
  314. REGDMN_MODE_11NG_HT40PLUS_BIT = 13, /* 11N-G HT40 + channels */
  315. REGDMN_MODE_11NG_HT40MINUS_BIT = 14, /* 11N-G HT40 - channels */
  316. REGDMN_MODE_11NA_HT40PLUS_BIT = 15, /* 11N-A HT40 + channels */
  317. REGDMN_MODE_11NA_HT40MINUS_BIT = 16, /* 11N-A HT40 - channels */
  318. REGDMN_MODE_11AC_VHT20_BIT = 17, /* 5Ghz, VHT20 */
  319. REGDMN_MODE_11AC_VHT40PLUS_BIT = 18, /* 5Ghz, VHT40 + channels */
  320. REGDMN_MODE_11AC_VHT40MINUS_BIT = 19, /* 5Ghz VHT40 - channels */
  321. REGDMN_MODE_11AC_VHT80_BIT = 20, /* 5Ghz, VHT80 channels */
  322. REGDMN_MODE_11AC_VHT20_2G_BIT = 21, /* 2Ghz, VHT20 */
  323. REGDMN_MODE_11AC_VHT40_2G_BIT = 22, /* 2Ghz, VHT40 */
  324. REGDMN_MODE_11AC_VHT80_2G_BIT = 23, /* 2Ghz, VHT80 */
  325. REGDMN_MODE_11AC_VHT160_BIT = 24, /* 5Ghz, VHT160 */
  326. REGDMN_MODE_11AC_VHT40_2GPLUS_BIT = 25, /* 2Ghz, VHT40+ */
  327. REGDMN_MODE_11AC_VHT40_2GMINUS_BIT = 26, /* 2Ghz, VHT40- */
  328. REGDMN_MODE_11AC_VHT80_80_BIT = 27, /* 5GHz, VHT80+80 */
  329. /* bits 28 to 31 are reserved */
  330. REGDMN_MODE_11AXG_HE20_BIT = 32, /* 2Ghz, HE20 */
  331. REGDMN_MODE_11AXA_HE20_BIT = 33, /* 5Ghz, HE20 */
  332. REGDMN_MODE_11AXG_HE40PLUS_BIT = 34, /* 2Ghz, HE40+ */
  333. REGDMN_MODE_11AXG_HE40MINUS_BIT = 35, /* 2Ghz, HE40- */
  334. REGDMN_MODE_11AXA_HE40PLUS_BIT = 36, /* 5Ghz, HE40+ */
  335. REGDMN_MODE_11AXA_HE40MINUS_BIT = 37, /* 5Ghz, HE40- */
  336. REGDMN_MODE_11AXA_HE80_BIT = 38, /* 5Ghz, HE80 */
  337. REGDMN_MODE_11AXA_HE160_BIT = 39, /* 5Ghz, HE160 */
  338. REGDMN_MODE_11AXA_HE80_80_BIT = 40, /* 5Ghz, HE80+80 */
  339. REGDMN_MODE_11BEG_EHT20_BIT = 41, /* 2Ghz, EHT20 */
  340. REGDMN_MODE_11BEA_EHT20_BIT = 42, /* 5Ghz, EHT20 */
  341. REGDMN_MODE_11BEG_EHT40PLUS_BIT = 43, /* 2Ghz, EHT40+ */
  342. REGDMN_MODE_11BEG_EHT40MINUS_BIT = 44, /* 2Ghz, EHT40- */
  343. REGDMN_MODE_11BEA_EHT40PLUS_BIT = 45, /* 5Ghz, EHT40+ */
  344. REGDMN_MODE_11BEA_EHT40MINUS_BIT = 46, /* 5Ghz, EHT40- */
  345. REGDMN_MODE_11BEA_EHT80_BIT = 47, /* 5Ghz, EHT80 */
  346. REGDMN_MODE_11BEA_EHT160_BIT = 48, /* 5Ghz, EHT160 */
  347. REGDMN_MODE_11BEA_EHT320_BIT = 49, /* 5Ghz, EHT320 */
  348. };
  349. enum {
  350. REGDMN_MODE_11A = 1 << REGDMN_MODE_11A_BIT, /* 11a channels */
  351. REGDMN_MODE_TURBO = 1 << REGDMN_MODE_TURBO_BIT, /* 11a turbo-only channels */
  352. REGDMN_MODE_11B = 1 << REGDMN_MODE_11B_BIT, /* 11b channels */
  353. REGDMN_MODE_PUREG = 1 << REGDMN_MODE_PUREG_BIT, /* 11g channels (OFDM only) */
  354. REGDMN_MODE_11G = 1 << REGDMN_MODE_11G_BIT, /* XXX historical */
  355. REGDMN_MODE_108G = 1 << REGDMN_MODE_108G_BIT, /* 11g+Turbo channels */
  356. REGDMN_MODE_108A = 1 << REGDMN_MODE_108A_BIT, /* 11a+Turbo channels */
  357. REGDMN_MODE_XR = 1 << REGDMN_MODE_XR_BIT, /* XR channels */
  358. REGDMN_MODE_11A_HALF_RATE = 1 << REGDMN_MODE_11A_HALF_RATE_BIT, /* 11A half rate channels */
  359. REGDMN_MODE_11A_QUARTER_RATE = 1 << REGDMN_MODE_11A_QUARTER_RATE_BIT, /* 11A quarter rate channels */
  360. REGDMN_MODE_11NG_HT20 = 1 << REGDMN_MODE_11NG_HT20_BIT, /* 11N-G HT20 channels */
  361. REGDMN_MODE_11NA_HT20 = 1 << REGDMN_MODE_11NA_HT20_BIT, /* 11N-A HT20 channels */
  362. REGDMN_MODE_11NG_HT40PLUS = 1 << REGDMN_MODE_11NG_HT40PLUS_BIT, /* 11N-G HT40 + channels */
  363. REGDMN_MODE_11NG_HT40MINUS = 1 << REGDMN_MODE_11NG_HT40MINUS_BIT, /* 11N-G HT40 - channels */
  364. REGDMN_MODE_11NA_HT40PLUS = 1 << REGDMN_MODE_11NA_HT40PLUS_BIT, /* 11N-A HT40 + channels */
  365. REGDMN_MODE_11NA_HT40MINUS = 1 << REGDMN_MODE_11NA_HT40MINUS_BIT, /* 11N-A HT40 - channels */
  366. REGDMN_MODE_11AC_VHT20 = 1 << REGDMN_MODE_11AC_VHT20_BIT, /* 5Ghz, VHT20 */
  367. REGDMN_MODE_11AC_VHT40PLUS = 1 << REGDMN_MODE_11AC_VHT40PLUS_BIT, /* 5Ghz, VHT40 + channels */
  368. REGDMN_MODE_11AC_VHT40MINUS = 1 << REGDMN_MODE_11AC_VHT40MINUS_BIT, /* 5Ghz VHT40 - channels */
  369. REGDMN_MODE_11AC_VHT80 = 1 << REGDMN_MODE_11AC_VHT80_BIT, /* 5Ghz, VHT80 channels */
  370. REGDMN_MODE_11AC_VHT20_2G = 1 << REGDMN_MODE_11AC_VHT20_2G_BIT, /* 2Ghz, VHT20 */
  371. REGDMN_MODE_11AC_VHT40_2G = 1 << REGDMN_MODE_11AC_VHT40_2G_BIT, /* 2Ghz, VHT40 */
  372. REGDMN_MODE_11AC_VHT80_2G = 1 << REGDMN_MODE_11AC_VHT80_2G_BIT, /* 2Ghz, VHT80 */
  373. REGDMN_MODE_11AC_VHT160 = 1 << REGDMN_MODE_11AC_VHT160_BIT, /* 5Ghz, VHT160 */
  374. REGDMN_MODE_11AC_VHT40_2GPLUS = 1 << REGDMN_MODE_11AC_VHT40_2GPLUS_BIT, /* 2Ghz, VHT40+ */
  375. REGDMN_MODE_11AC_VHT40_2GMINUS = 1 << REGDMN_MODE_11AC_VHT40_2GMINUS_BIT, /* 2Ghz, VHT40- */
  376. REGDMN_MODE_11AC_VHT80_80 = 1 << REGDMN_MODE_11AC_VHT80_80_BIT, /* 5GHz, VHT80+80 */
  377. };
  378. enum {
  379. REGDMN_MODE_U32_11AXG_HE20 = 1 << (REGDMN_MODE_11AXG_HE20_BIT - 32),
  380. REGDMN_MODE_U32_11AXA_HE20 = 1 << (REGDMN_MODE_11AXA_HE20_BIT - 32),
  381. REGDMN_MODE_U32_11AXG_HE40PLUS = 1 << (REGDMN_MODE_11AXG_HE40PLUS_BIT - 32),
  382. REGDMN_MODE_U32_11AXG_HE40MINUS = 1 << (REGDMN_MODE_11AXG_HE40MINUS_BIT - 32),
  383. REGDMN_MODE_U32_11AXA_HE40PLUS = 1 << (REGDMN_MODE_11AXA_HE40PLUS_BIT - 32),
  384. REGDMN_MODE_U32_11AXA_HE40MINUS = 1 << (REGDMN_MODE_11AXA_HE40MINUS_BIT - 32),
  385. REGDMN_MODE_U32_11AXA_HE80 = 1 << (REGDMN_MODE_11AXA_HE80_BIT - 32),
  386. REGDMN_MODE_U32_11AXA_HE160 = 1 << (REGDMN_MODE_11AXA_HE160_BIT - 32),
  387. REGDMN_MODE_U32_11AXA_HE80_80 = 1 << (REGDMN_MODE_11AXA_HE80_80_BIT - 32),
  388. REGDMN_MODE_U32_11BEG_EHT20 = 1 << (REGDMN_MODE_11BEG_EHT20_BIT - 32),
  389. REGDMN_MODE_U32_11BEA_EHT20 = 1 << (REGDMN_MODE_11BEA_EHT20_BIT - 32),
  390. REGDMN_MODE_U32_11BEG_EHT40PLUS = 1 << (REGDMN_MODE_11BEG_EHT40PLUS_BIT - 32),
  391. REGDMN_MODE_U32_11BEG_EHT40MINUS = 1 << (REGDMN_MODE_11BEG_EHT40MINUS_BIT - 32),
  392. REGDMN_MODE_U32_11BEA_EHT40PLUS = 1 << (REGDMN_MODE_11BEA_EHT40PLUS_BIT - 32),
  393. REGDMN_MODE_U32_11BEA_EHT40MINUS = 1 << (REGDMN_MODE_11BEA_EHT40MINUS_BIT - 32),
  394. REGDMN_MODE_U32_11BEA_EHT80 = 1 << (REGDMN_MODE_11BEA_EHT80_BIT - 32),
  395. REGDMN_MODE_U32_11BEA_EHT160 = 1 << (REGDMN_MODE_11BEA_EHT160_BIT - 32),
  396. REGDMN_MODE_U32_11BEA_EHT320 = 1 << (REGDMN_MODE_11BEA_EHT320_BIT - 32),
  397. };
  398. #define REGDMN_MODE_ALL (0xFFFFFFFF) /* REGDMN_MODE_ALL is defined out of the enum
  399. * to prevent the ARM compile "warning #66:
  400. * enumeration value is out of int range"
  401. * Anyway, this is a BIT-OR of all possible values.
  402. */
  403. #define REGDMN_CAP1_CHAN_HALF_RATE 0x00000001
  404. #define REGDMN_CAP1_CHAN_QUARTER_RATE 0x00000002
  405. #define REGDMN_CAP1_CHAN_HAL49GHZ 0x00000004
  406. /* regulatory capabilities */
  407. #define REGDMN_EEPROM_EEREGCAP_EN_FCC_MIDBAND 0x0040
  408. #define REGDMN_EEPROM_EEREGCAP_EN_KK_U1_EVEN 0x0080
  409. #define REGDMN_EEPROM_EEREGCAP_EN_KK_U2 0x0100
  410. #define REGDMN_EEPROM_EEREGCAP_EN_KK_MIDBAND 0x0200
  411. #define REGDMN_EEPROM_EEREGCAP_EN_KK_U1_ODD 0x0400
  412. #define REGDMN_EEPROM_EEREGCAP_EN_KK_NEW_11A 0x0800
  413. typedef struct {
  414. A_UINT32 tlv_header; /* TLV tag and len; tag equals WMI_TLVTAG_STRUC_HAL_REG_CAPABILITIES */
  415. A_UINT32 eeprom_rd; /* regdomain value specified in EEPROM */
  416. A_UINT32 eeprom_rd_ext; /* regdomain */
  417. A_UINT32 regcap1; /* CAP1 capabilities bit map. */
  418. A_UINT32 regcap2; /* REGDMN EEPROM CAP. */
  419. A_UINT32 wireless_modes; /* REGDMN MODE */
  420. A_UINT32 low_2ghz_chan;
  421. A_UINT32 high_2ghz_chan;
  422. A_UINT32 low_5ghz_chan;
  423. A_UINT32 high_5ghz_chan;
  424. A_UINT32 wireless_modes_ext; /* REGDMN MODE ext */
  425. A_UINT32 low_2ghz_chan_ext;
  426. A_UINT32 high_2ghz_chan_ext;
  427. A_UINT32 low_5ghz_chan_ext;
  428. A_UINT32 high_5ghz_chan_ext;
  429. } HAL_REG_CAPABILITIES;
  430. #ifdef NUM_SPATIAL_STREAM
  431. /*
  432. * The rate control definitions below are only used in the target.
  433. * (Host-based rate control is no longer applicable.)
  434. * Maintain the defs in wlanfw_cmn for the sake of existing Rome / Helium
  435. * targets, but for Lithium targets remove them from wlanfw_cmn and define
  436. * them in a target-only location instead.
  437. * SUPPORT_11AX is essentially used as a condition to identify Lithium targets.
  438. * Some host drivers would also have SUPPORT_11AX defined, and thus would lose
  439. * the definition of RATE_CODE, RC_TX_DONE_PARAMS, and related macros, but
  440. * that's okay because the host should have no references to these
  441. * target-only data structures.
  442. */
  443. #if !((NUM_SPATIAL_STREAM > 4) || SUPPORT_11AX) /* following N/A for Lithium */
  444. /*
  445. * Used to update rate-control logic with the status of the tx-completion.
  446. * In host-based implementation of the rate-control feature, this structure
  447. * is used to create the payload for HTT message/s from target to host.
  448. */
  449. #ifndef CONFIG_MOVE_RC_STRUCT_TO_MACCORE
  450. #if (NUM_SPATIAL_STREAM > 3)
  451. #define A_RATEMASK A_UINT64
  452. #else
  453. #define A_RATEMASK A_UINT32
  454. #endif
  455. #endif /* CONFIG_MOVE_RC_STRUCT_TO_MACCORE */
  456. typedef A_UINT8 A_RATE;
  457. typedef A_UINT8 A_RATECODE;
  458. #define A_RATEMASK_NUM_OCTET (sizeof (A_RATEMASK))
  459. #define A_RATEMASK_NUM_BITS ((sizeof (A_RATEMASK)) << 3)
  460. typedef struct {
  461. A_RATECODE rateCode;
  462. A_UINT8 flags;
  463. } RATE_CODE;
  464. typedef struct {
  465. RATE_CODE ptx_rc; /* rate code, bw, chain mask sgi */
  466. A_UINT8 reserved[2];
  467. A_UINT32 flags; /* Encodes information such as excessive
  468. retransmission, aggregate, some info
  469. from .11 frame control,
  470. STBC, LDPC, (SGI and Tx Chain Mask
  471. are encoded in ptx_rc->flags field),
  472. AMPDU truncation (BT/time based etc.),
  473. RTS/CTS attempt */
  474. A_UINT32 num_enqued; /* # of MPDUs (for non-AMPDU 1) for this rate */
  475. A_UINT32 num_retries; /* Total # of transmission attempt for this rate */
  476. A_UINT32 num_failed; /* # of failed MPDUs in A-MPDU, 0 otherwise */
  477. A_UINT32 ack_rssi; /* ACK RSSI: b'7..b'0 avg RSSI across all chain */
  478. A_UINT32 time_stamp ; /* ACK timestamp (helps determine age) */
  479. A_UINT32 is_probe; /* Valid if probing. Else, 0 */
  480. A_UINT32 ba_win_size; /* b'7..b0, block Ack Window size, b'31..b8 Resvd */
  481. A_UINT32 failed_ba_bmap_0_31; /* failed BA bitmap 0..31 */
  482. A_UINT32 failed_ba_bmap_32_63; /* failed BA bitmap 32..63 */
  483. A_UINT32 bmap_tried_0_31; /* enqued bitmap 0..31 */
  484. A_UINT32 bmap_tried_32_63; /* enqued bitmap 32..63 */
  485. } RC_TX_DONE_PARAMS;
  486. #define RC_SET_TX_DONE_INFO(_dst, _rc, _f, _nq, _nr, _nf, _rssi, _ts) \
  487. do { \
  488. (_dst).ptx_rc.rateCode = (_rc).rateCode; \
  489. (_dst).ptx_rc.flags = (_rc).flags; \
  490. (_dst).flags = (_f); \
  491. (_dst).num_enqued = (_nq); \
  492. (_dst).num_retries = (_nr); \
  493. (_dst).num_failed = (_nf); \
  494. (_dst).ack_rssi = (_rssi); \
  495. (_dst).time_stamp = (_ts); \
  496. } while (0)
  497. #define RC_SET_TXBF_DONE_INFO(_dst, _f) \
  498. do { \
  499. (_dst).flags |= (_f); \
  500. } while (0)
  501. /*
  502. * NOTE: NUM_SCHED_ENTRIES is not used in the host/target interface, but for
  503. * historical reasons has been defined in the host/target interface files.
  504. * The NUM_SCHED_ENTRIES definition is being moved into a target-only
  505. * header file for newer (Lithium) targets, but is being left here for
  506. * non-Lithium cases, to avoid having to rework legacy targets to move
  507. * the NUM_SCHED_ENTRIES definition into a target-only header file.
  508. * Moving the NUM_SCHED_ENTRIES definition into a non-Lithium conditional
  509. * block should have no impact on the host, since the host does not use
  510. * NUM_SCHED_ENTRIES.
  511. */
  512. #define NUM_SCHED_ENTRIES 2
  513. #endif /* !((NUM_SPATIAL_STREAM > 4) || SUPPORT_11AX) */ /* above N/A for Lithium */
  514. #endif /* NUM_SPATIAL_STREAM */
  515. /* NOTE: NUM_DYN_BW cannot be changed without breaking WMI Compatibility */
  516. #define NUM_DYN_BW_MAX 4
  517. /* Some products only use 20/40/80; some use 20/40/80/160 */
  518. #ifndef NUM_DYN_BW
  519. #define NUM_DYN_BW 3 /* default: support up through 80 MHz */
  520. #endif
  521. #define NUM_DYN_BW_MASK 0x3
  522. #define PROD_SCHED_BW_ENTRIES (NUM_SCHED_ENTRIES * NUM_DYN_BW)
  523. #if NUM_DYN_BW > 5
  524. /* Extend rate table module first */
  525. #error "Extend rate table module first"
  526. #endif
  527. #define MAX_IBSS_PEERS 32
  528. #ifdef NUM_SPATIAL_STREAM
  529. /*
  530. * RC_TX_RATE_SCHEDULE and RC_TX_RATE_INFO defs are used only in the target.
  531. * (Host-based rate control is no longer applicable.)
  532. * Maintain the defs in wlanfw_cmn for the sake of existing Rome / Helium
  533. * targets, but for Lithium targets remove them from wlanfw_cmn and define
  534. * them in a target-only location instead.
  535. * SUPPORT_11AX is essentially used as a condition to identify Lithium targets.
  536. * Some host drivers would also have SUPPORT_11AX defined, and thus would lose
  537. * the definition of RC_TX_RATE_SCHEDULE and RC_TX_RATE_INFO, but that's okay
  538. * because the host should have no references to these target-only data
  539. * structures.
  540. */
  541. #ifndef CONFIG_MOVE_RC_STRUCT_TO_MACCORE
  542. #if !((NUM_SPATIAL_STREAM > 4) || SUPPORT_11AX)
  543. #if defined(CONFIG_AR900B_SUPPORT) || defined(AR900B)
  544. typedef struct{
  545. A_UINT32 psdu_len[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  546. A_UINT16 flags[NUM_SCHED_ENTRIES][NUM_DYN_BW];
  547. A_RATE rix[NUM_SCHED_ENTRIES][NUM_DYN_BW];
  548. A_UINT8 tpc[NUM_SCHED_ENTRIES][NUM_DYN_BW];
  549. A_UINT32 antmask[NUM_SCHED_ENTRIES];
  550. A_UINT8 num_mpdus[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  551. A_UINT16 txbf_cv_len;
  552. A_UINT32 txbf_cv_ptr;
  553. A_UINT16 txbf_flags;
  554. A_UINT16 txbf_cv_size;
  555. A_UINT8 txbf_nc_idx;
  556. A_UINT8 tries[NUM_SCHED_ENTRIES];
  557. A_UINT8 bw_mask[NUM_SCHED_ENTRIES];
  558. A_UINT8 max_bw[NUM_SCHED_ENTRIES];
  559. A_UINT8 num_sched_entries;
  560. A_UINT8 paprd_mask;
  561. A_RATE rts_rix;
  562. A_UINT8 sh_pream;
  563. A_UINT8 min_spacing_1_4_us;
  564. A_UINT8 fixed_delims;
  565. A_UINT8 bw_in_service;
  566. A_RATE probe_rix;
  567. A_UINT8 num_valid_rates;
  568. A_UINT8 rtscts_tpc;
  569. A_UINT8 dd_profile;
  570. } RC_TX_RATE_SCHEDULE;
  571. #else
  572. typedef struct{
  573. A_UINT32 psdu_len[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  574. A_UINT16 flags[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  575. A_RATE rix[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  576. A_UINT8 tpc[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  577. A_UINT8 num_mpdus[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  578. A_UINT32 antmask[NUM_SCHED_ENTRIES];
  579. A_UINT32 txbf_cv_ptr;
  580. A_UINT16 txbf_cv_len;
  581. A_UINT8 tries[NUM_SCHED_ENTRIES];
  582. A_UINT8 num_valid_rates;
  583. A_UINT8 paprd_mask;
  584. A_RATE rts_rix;
  585. A_UINT8 sh_pream;
  586. A_UINT8 min_spacing_1_4_us;
  587. A_UINT8 fixed_delims;
  588. A_UINT8 bw_in_service;
  589. A_RATE probe_rix;
  590. } RC_TX_RATE_SCHEDULE;
  591. #endif
  592. typedef struct{
  593. A_UINT16 flags[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  594. A_RATE rix[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  595. #ifdef DYN_TPC_ENABLE
  596. A_UINT8 tpc[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  597. #endif
  598. #ifdef SECTORED_ANTENNA
  599. A_UINT32 antmask[NUM_SCHED_ENTRIES];
  600. #endif
  601. A_UINT8 tries[NUM_SCHED_ENTRIES];
  602. A_UINT8 num_valid_rates;
  603. A_RATE rts_rix;
  604. A_UINT8 sh_pream;
  605. A_UINT8 bw_in_service;
  606. A_RATE probe_rix;
  607. A_UINT8 dd_profile;
  608. } RC_TX_RATE_INFO;
  609. #endif /* !((NUM_SPATIAL_STREAM > 4) || SUPPORT_11AX) */
  610. #endif /* CONFIG_MOVE_RC_STRUCT_TO_MACCORE */
  611. #endif
  612. /*
  613. * Temporarily continue to provide the WHAL_RC_INIT_RC_MASKS def in wlan_defs.h
  614. * for older targets.
  615. * The WHAL_RX_INIT_RC_MASKS macro def needs to be moved into ratectrl_11ac.h
  616. * for all targets, but until this is complete, the WHAL_RC_INIT_RC_MASKS def
  617. * will be maintained here in its old location.
  618. */
  619. #ifndef CONFIG_160MHZ_SUPPORT
  620. #define WHAL_RC_INIT_RC_MASKS(_rm) do { \
  621. _rm[WHAL_RC_MASK_IDX_NON_HT] = A_RATEMASK_OFDM_CCK; \
  622. _rm[WHAL_RC_MASK_IDX_HT_20] = A_RATEMASK_HT_20; \
  623. _rm[WHAL_RC_MASK_IDX_HT_40] = A_RATEMASK_HT_40; \
  624. _rm[WHAL_RC_MASK_IDX_VHT_20] = A_RATEMASK_VHT_20; \
  625. _rm[WHAL_RC_MASK_IDX_VHT_40] = A_RATEMASK_VHT_40; \
  626. _rm[WHAL_RC_MASK_IDX_VHT_80] = A_RATEMASK_VHT_80; \
  627. } while (0)
  628. #endif
  629. /**
  630. * structure describing host memory chunk.
  631. */
  632. typedef struct {
  633. A_UINT32 tlv_header; /* TLV tag and len; tag equals WMITLV_TAG_STRUC_wlan_host_memory_chunk */
  634. /** id of the request that is passed up in service ready */
  635. A_UINT32 req_id;
  636. /** the physical address the memory chunk */
  637. A_UINT32 ptr;
  638. /** size of the chunk */
  639. A_UINT32 size;
  640. /** ptr_high
  641. * most significant bits of physical address of the memory chunk
  642. * Only applicable for addressing more than 32 bit.
  643. * This will only be non-zero if the target has set
  644. * WMI_SERVICE_SUPPORT_EXTEND_ADDRESS flag.
  645. */
  646. A_UINT32 ptr_high;
  647. } wlan_host_memory_chunk;
  648. #define NUM_UNITS_IS_NUM_VDEVS 0x1
  649. #define NUM_UNITS_IS_NUM_PEERS 0x2
  650. #define NUM_UNITS_IS_NUM_ACTIVE_PEERS 0x4
  651. /* request host to allocate memory contiguously */
  652. #define REQ_TO_HOST_FOR_CONT_MEMORY 0x8
  653. /**
  654. * structure used by FW for requesting host memory
  655. */
  656. typedef struct {
  657. A_UINT32 tlv_header; /* TLV tag and len; tag equals WMI_TLVTAG_STRUC_wlan_host_mem_req */
  658. /** ID of the request */
  659. A_UINT32 req_id;
  660. /** size of the of each unit */
  661. A_UINT32 unit_size;
  662. /**
  663. * flags to indicate that
  664. * the number units is dependent
  665. * on number of resources(num vdevs num peers .. etc)
  666. */
  667. A_UINT32 num_unit_info;
  668. /*
  669. * actual number of units to allocate . if flags in the num_unit_info
  670. * indicate that number of units is tied to number of a particular
  671. * resource to allocate then num_units filed is set to 0 and host
  672. * will derive the number units from number of the resources it is
  673. * requesting.
  674. */
  675. A_UINT32 num_units;
  676. } wlan_host_mem_req;
  677. typedef enum {
  678. IGNORE_DTIM = 0x01,
  679. NORMAL_DTIM = 0x02,
  680. STICK_DTIM = 0x03,
  681. AUTO_DTIM = 0x04,
  682. } BEACON_DTIM_POLICY;
  683. /* During test it is observed that 6 * 400 = 2400 can
  684. * be alloced in addition to CFG_TGT_NUM_MSDU_DESC.
  685. * If there is any change memory requirement, this number
  686. * needs to be revisited. */
  687. #define TOTAL_VOW_ALLOCABLE 2400
  688. #define VOW_DESC_GRAB_MAX 800
  689. #define VOW_GET_NUM_VI_STA(vow_config) (((vow_config) & 0xffff0000) >> 16)
  690. #define VOW_GET_DESC_PER_VI_STA(vow_config) ((vow_config) & 0x0000ffff)
  691. /***TODO!!! Get these values dynamically in WMI_READY event and use it to calculate the mem req*/
  692. /* size in bytes required for msdu descriptor. If it changes, this should be updated. LARGE_AP
  693. * case is not considered. LARGE_AP is disabled when VoW is enabled.*/
  694. #define MSDU_DESC_SIZE 20
  695. /* size in bytes required to support a peer in target.
  696. * This obtained by considering Two tids per peer.
  697. * peer structure = 168 bytes
  698. * tid = 96 bytes (per sta 2 means we need 192 bytes)
  699. * peer_cb = 16 * 2
  700. * key = 52 * 2
  701. * AST = 12 * 2
  702. * rate, reorder.. = 384
  703. * smart antenna = 50
  704. */
  705. #define MEMORY_REQ_FOR_PEER 800
  706. /*
  707. * NB: it is important to keep all the fields in the structure dword long
  708. * so that it is easy to handle the statistics in BE host.
  709. */
  710. /*
  711. * wlan_dbg_tx_stats_v1, _v2:
  712. * differing versions of the wlan_dbg_tx_stats struct used by different
  713. * targets
  714. */
  715. struct wlan_dbg_tx_stats_v1 {
  716. /* Num HTT cookies queued to dispatch list */
  717. A_INT32 comp_queued;
  718. /* Num HTT cookies dispatched */
  719. A_INT32 comp_delivered;
  720. /* Num MSDU queued to WAL */
  721. A_INT32 msdu_enqued;
  722. /* Num MPDU queue to WAL */
  723. A_INT32 mpdu_enqued;
  724. /* Num MSDUs dropped by WMM limit */
  725. A_INT32 wmm_drop;
  726. /* Num Local frames queued */
  727. A_INT32 local_enqued;
  728. /* Num Local frames done */
  729. A_INT32 local_freed;
  730. /* Num queued to HW */
  731. A_INT32 hw_queued;
  732. /* Num PPDU reaped from HW */
  733. A_INT32 hw_reaped;
  734. /* Num underruns */
  735. A_INT32 underrun;
  736. /* Num PPDUs cleaned up in TX abort */
  737. A_INT32 tx_abort;
  738. /* Num MPDUs requed by SW */
  739. A_INT32 mpdus_requed;
  740. /* excessive retries */
  741. A_UINT32 tx_ko;
  742. /* data hw rate code */
  743. A_UINT32 data_rc;
  744. /* Scheduler self triggers */
  745. A_UINT32 self_triggers;
  746. /* frames dropped due to excessive sw retries */
  747. A_UINT32 sw_retry_failure;
  748. /* illegal rate phy errors */
  749. A_UINT32 illgl_rate_phy_err;
  750. /* wal pdev continuous xretry */
  751. A_UINT32 pdev_cont_xretry;
  752. /* wal pdev continuous xretry */
  753. A_UINT32 pdev_tx_timeout;
  754. /* wal pdev resets */
  755. A_UINT32 pdev_resets;
  756. /* frames dropped due to non-availability of stateless TIDs */
  757. A_UINT32 stateless_tid_alloc_failure;
  758. /* PhY/BB underrun */
  759. A_UINT32 phy_underrun;
  760. /* MPDU is more than txop limit */
  761. A_UINT32 txop_ovf;
  762. };
  763. struct wlan_dbg_tx_stats_v2 {
  764. /* Num HTT cookies queued to dispatch list */
  765. A_INT32 comp_queued;
  766. /* Num HTT cookies dispatched */
  767. A_INT32 comp_delivered;
  768. /* Num MSDU queued to WAL */
  769. A_INT32 msdu_enqued;
  770. /* Num MPDU queue to WAL */
  771. A_INT32 mpdu_enqued;
  772. /* Num MSDUs dropped by WMM limit */
  773. A_INT32 wmm_drop;
  774. /* Num Local frames queued */
  775. A_INT32 local_enqued;
  776. /* Num Local frames done */
  777. A_INT32 local_freed;
  778. /* Num queued to HW */
  779. A_INT32 hw_queued;
  780. /* Num PPDU reaped from HW */
  781. A_INT32 hw_reaped;
  782. /* Num underruns */
  783. A_INT32 underrun;
  784. /* HW Paused. */
  785. A_UINT32 hw_paused;
  786. /* Num PPDUs cleaned up in TX abort */
  787. A_INT32 tx_abort;
  788. /* Num MPDUs requed by SW */
  789. A_INT32 mpdus_requed;
  790. /* excessive retries */
  791. A_UINT32 tx_ko;
  792. A_UINT32 tx_xretry;
  793. /* data hw rate code */
  794. A_UINT32 data_rc;
  795. /* Scheduler self triggers */
  796. A_UINT32 self_triggers;
  797. /* frames dropped due to excessive sw retries */
  798. A_UINT32 sw_retry_failure;
  799. /* illegal rate phy errors */
  800. A_UINT32 illgl_rate_phy_err;
  801. /* wal pdev continuous xretry */
  802. A_UINT32 pdev_cont_xretry;
  803. /* wal pdev continuous xretry */
  804. A_UINT32 pdev_tx_timeout;
  805. /* wal pdev resets */
  806. A_UINT32 pdev_resets;
  807. /* frames dropped due to non-availability of stateless TIDs */
  808. A_UINT32 stateless_tid_alloc_failure;
  809. /* PhY/BB underrun */
  810. A_UINT32 phy_underrun;
  811. /* MPDU is more than txop limit */
  812. A_UINT32 txop_ovf;
  813. /* Number of Sequences posted */
  814. A_UINT32 seq_posted;
  815. /* Number of Sequences failed queueing */
  816. A_UINT32 seq_failed_queueing;
  817. /* Number of Sequences completed */
  818. A_UINT32 seq_completed;
  819. /* Number of Sequences restarted */
  820. A_UINT32 seq_restarted;
  821. /* Number of MU Sequences posted */
  822. A_UINT32 mu_seq_posted;
  823. /* Num MPDUs flushed by SW, HWPAUSED, SW TXABORT (Reset,channel change) */
  824. A_INT32 mpdus_sw_flush;
  825. /* Num MPDUs filtered by HW, all filter condition (TTL expired) */
  826. A_INT32 mpdus_hw_filter;
  827. /* Num MPDUs truncated by PDG (TXOP, TBTT, PPDU_duration based on rate, dyn_bw) */
  828. A_INT32 mpdus_truncated;
  829. /* Num MPDUs that was tried but didn't receive ACK or BA */
  830. A_INT32 mpdus_ack_failed;
  831. /* Num MPDUs that was dropped du to expiry. */
  832. A_INT32 mpdus_expired;
  833. };
  834. #if defined(AR900B)
  835. #define wlan_dbg_tx_stats wlan_dbg_tx_stats_v2
  836. #else
  837. #define wlan_dbg_tx_stats wlan_dbg_tx_stats_v1
  838. #endif
  839. /*
  840. * wlan_dbg_rx_stats_v1, _v2:
  841. * differing versions of the wlan_dbg_rx_stats struct used by different
  842. * targets
  843. */
  844. struct wlan_dbg_rx_stats_v1 {
  845. /* Cnts any change in ring routing mid-ppdu */
  846. A_INT32 mid_ppdu_route_change;
  847. /* Total number of statuses processed */
  848. A_INT32 status_rcvd;
  849. /* Extra frags on rings 0-3 */
  850. A_INT32 r0_frags;
  851. A_INT32 r1_frags;
  852. A_INT32 r2_frags;
  853. A_INT32 r3_frags;
  854. /* MSDUs / MPDUs delivered to HTT */
  855. A_INT32 htt_msdus;
  856. A_INT32 htt_mpdus;
  857. /* MSDUs / MPDUs delivered to local stack */
  858. A_INT32 loc_msdus;
  859. A_INT32 loc_mpdus;
  860. /* AMSDUs that have more MSDUs than the status ring size */
  861. A_INT32 oversize_amsdu;
  862. /* Number of PHY errors */
  863. A_INT32 phy_errs;
  864. /* Number of PHY errors drops */
  865. A_INT32 phy_err_drop;
  866. /* Number of mpdu errors - FCS, MIC, ENC etc. */
  867. A_INT32 mpdu_errs;
  868. };
  869. struct wlan_dbg_rx_stats_v2 {
  870. /* Cnts any change in ring routing mid-ppdu */
  871. A_INT32 mid_ppdu_route_change;
  872. /* Total number of statuses processed */
  873. A_INT32 status_rcvd;
  874. /* Extra frags on rings 0-3 */
  875. A_INT32 r0_frags;
  876. A_INT32 r1_frags;
  877. A_INT32 r2_frags;
  878. A_INT32 r3_frags;
  879. /* MSDUs / MPDUs delivered to HTT */
  880. A_INT32 htt_msdus;
  881. A_INT32 htt_mpdus;
  882. /* MSDUs / MPDUs delivered to local stack */
  883. A_INT32 loc_msdus;
  884. A_INT32 loc_mpdus;
  885. /* AMSDUs that have more MSDUs than the status ring size */
  886. A_INT32 oversize_amsdu;
  887. /* Number of PHY errors */
  888. A_INT32 phy_errs;
  889. /* Number of PHY errors drops */
  890. A_INT32 phy_err_drop;
  891. /* Number of mpdu errors - FCS, MIC, ENC etc. */
  892. A_INT32 mpdu_errs;
  893. /* Number of rx overflow errors. */
  894. A_INT32 rx_ovfl_errs;
  895. };
  896. #if defined(AR900B)
  897. #define wlan_dbg_rx_stats wlan_dbg_rx_stats_v2
  898. #else
  899. #define wlan_dbg_rx_stats wlan_dbg_rx_stats_v1
  900. #endif
  901. struct wlan_dbg_mem_stats {
  902. A_UINT32 iram_free_size;
  903. A_UINT32 dram_free_size;
  904. };
  905. struct wlan_dbg_peer_stats {
  906. A_INT32 dummy; /* REMOVE THIS ONCE REAL PEER STAT COUNTERS ARE ADDED */
  907. };
  908. /*
  909. * wlan_dbg_rx_rate_info_v1a_t, _v1b_t:
  910. * differing versions of the wlan_dbg_rx_rate_info struct used by different
  911. * targets
  912. */
  913. typedef struct {
  914. A_UINT32 mcs[10];
  915. A_UINT32 sgi[10];
  916. A_UINT32 nss[4];
  917. A_UINT32 nsts;
  918. A_UINT32 stbc[10];
  919. A_UINT32 bw[3];
  920. A_UINT32 pream[6];
  921. A_UINT32 ldpc;
  922. A_UINT32 txbf;
  923. A_UINT32 mgmt_rssi;
  924. A_UINT32 data_rssi;
  925. A_UINT32 rssi_chain0;
  926. A_UINT32 rssi_chain1;
  927. A_UINT32 rssi_chain2;
  928. } wlan_dbg_rx_rate_info_v1a_t;
  929. typedef struct {
  930. A_UINT32 mcs[10];
  931. A_UINT32 sgi[10];
  932. A_UINT32 nss[4];
  933. A_UINT32 nsts;
  934. A_UINT32 stbc[10];
  935. A_UINT32 bw[3];
  936. A_UINT32 pream[6];
  937. A_UINT32 ldpc;
  938. A_UINT32 txbf;
  939. A_UINT32 mgmt_rssi;
  940. A_UINT32 data_rssi;
  941. A_UINT32 rssi_chain0;
  942. A_UINT32 rssi_chain1;
  943. A_UINT32 rssi_chain2;
  944. /*
  945. * TEMPORARY: leave rssi_chain3 in place for AR900B builds until code using
  946. * rssi_chain3 has been converted to use wlan_dbg_rx_rate_info_v2_t.
  947. */
  948. A_UINT32 rssi_chain3;
  949. } wlan_dbg_rx_rate_info_v1b_t;
  950. #if defined(AR900B)
  951. #define wlan_dbg_rx_rate_info_t wlan_dbg_rx_rate_info_v1b_t
  952. #else
  953. #define wlan_dbg_rx_rate_info_t wlan_dbg_rx_rate_info_v1a_t
  954. #endif
  955. typedef struct {
  956. A_UINT32 mcs[10];
  957. A_UINT32 sgi[10];
  958. /*
  959. * TEMPORARY: leave nss conditionally defined, until all code that
  960. * requires nss[4] is converted to use wlan_dbg_tx_rate_info_v2_t.
  961. * At that time, this nss array will be made length = 3 unconditionally.
  962. */
  963. #if defined(CONFIG_AR900B_SUPPORT) || defined(AR900B)
  964. A_UINT32 nss[4];
  965. #else
  966. A_UINT32 nss[3];
  967. #endif
  968. A_UINT32 stbc[10];
  969. A_UINT32 bw[3];
  970. A_UINT32 pream[4];
  971. A_UINT32 ldpc;
  972. A_UINT32 rts_cnt;
  973. A_UINT32 ack_rssi;
  974. } wlan_dbg_tx_rate_info_t ;
  975. #define WLAN_MAX_MCS 10
  976. typedef struct {
  977. A_UINT32 mcs[WLAN_MAX_MCS];
  978. A_UINT32 sgi[WLAN_MAX_MCS];
  979. A_UINT32 nss[MAX_SPATIAL_STREAM_ANY_V2];
  980. A_UINT32 nsts;
  981. A_UINT32 stbc[WLAN_MAX_MCS];
  982. A_UINT32 bw[NUM_DYN_BW_MAX];
  983. A_UINT32 pream[6];
  984. A_UINT32 ldpc;
  985. A_UINT32 txbf;
  986. A_UINT32 mgmt_rssi;
  987. A_UINT32 data_rssi;
  988. A_UINT32 rssi_chain0;
  989. A_UINT32 rssi_chain1;
  990. A_UINT32 rssi_chain2;
  991. A_UINT32 rssi_chain3;
  992. A_UINT32 reserved[8];
  993. } wlan_dbg_rx_rate_info_v2_t;
  994. typedef struct {
  995. A_UINT32 mcs[WLAN_MAX_MCS];
  996. A_UINT32 sgi[WLAN_MAX_MCS];
  997. A_UINT32 nss[MAX_SPATIAL_STREAM_ANY_V2];
  998. A_UINT32 stbc[WLAN_MAX_MCS];
  999. A_UINT32 bw[NUM_DYN_BW_MAX];
  1000. A_UINT32 pream[4];
  1001. A_UINT32 ldpc;
  1002. A_UINT32 rts_cnt;
  1003. A_UINT32 ack_rssi;
  1004. A_UINT32 reserved[8];
  1005. } wlan_dbg_tx_rate_info_v2_t;
  1006. typedef struct {
  1007. A_UINT32 mcs[WLAN_MAX_MCS];
  1008. A_UINT32 sgi[WLAN_MAX_MCS];
  1009. A_UINT32 nss[MAX_SPATIAL_STREAM_ANY_V3];
  1010. A_UINT32 nsts;
  1011. A_UINT32 stbc[WLAN_MAX_MCS];
  1012. A_UINT32 bw[NUM_DYN_BW_MAX];
  1013. A_UINT32 pream[6];
  1014. A_UINT32 ldpc;
  1015. A_UINT32 txbf;
  1016. A_UINT32 mgmt_rssi;
  1017. A_UINT32 data_rssi;
  1018. A_UINT32 rssi_chain0;
  1019. A_UINT32 rssi_chain1;
  1020. A_UINT32 rssi_chain2;
  1021. A_UINT32 rssi_chain3;
  1022. A_UINT32 reserved[8];
  1023. } wlan_dbg_rx_rate_info_v3_t;
  1024. typedef struct {
  1025. A_UINT32 mcs[WLAN_MAX_MCS];
  1026. A_UINT32 sgi[WLAN_MAX_MCS];
  1027. A_UINT32 nss[MAX_SPATIAL_STREAM_ANY_V3];
  1028. A_UINT32 stbc[WLAN_MAX_MCS];
  1029. A_UINT32 bw[NUM_DYN_BW_MAX];
  1030. A_UINT32 pream[4];
  1031. A_UINT32 ldpc;
  1032. A_UINT32 rts_cnt;
  1033. A_UINT32 ack_rssi;
  1034. A_UINT32 reserved[8];
  1035. } wlan_dbg_tx_rate_info_v3_t;
  1036. #define WHAL_DBG_PHY_ERR_MAXCNT 18
  1037. #define WHAL_DBG_SIFS_STATUS_MAXCNT 8
  1038. #define WHAL_DBG_SIFS_ERR_MAXCNT 8
  1039. #define WHAL_DBG_CMD_RESULT_MAXCNT 11
  1040. #define WHAL_DBG_CMD_STALL_ERR_MAXCNT 4
  1041. #define WHAL_DBG_FLUSH_REASON_MAXCNT 40
  1042. typedef enum {
  1043. WIFI_URRN_STATS_FIRST_PKT,
  1044. WIFI_URRN_STATS_BETWEEN_MPDU,
  1045. WIFI_URRN_STATS_WITHIN_MPDU,
  1046. WHAL_MAX_URRN_STATS
  1047. } wifi_urrn_type_t;
  1048. typedef struct wlan_dbg_txbf_snd_stats {
  1049. A_UINT32 cbf_20[4];
  1050. A_UINT32 cbf_40[4];
  1051. A_UINT32 cbf_80[4];
  1052. A_UINT32 sounding[9];
  1053. A_UINT32 cbf_160[4];
  1054. } wlan_dbg_txbf_snd_stats_t;
  1055. typedef struct wlan_dbg_wifi2_error_stats {
  1056. A_UINT32 urrn_stats[WHAL_MAX_URRN_STATS];
  1057. A_UINT32 flush_errs[WHAL_DBG_FLUSH_REASON_MAXCNT];
  1058. A_UINT32 schd_stall_errs[WHAL_DBG_CMD_STALL_ERR_MAXCNT];
  1059. A_UINT32 schd_cmd_result[WHAL_DBG_CMD_RESULT_MAXCNT];
  1060. A_UINT32 sifs_status[WHAL_DBG_SIFS_STATUS_MAXCNT];
  1061. A_UINT8 phy_errs[WHAL_DBG_PHY_ERR_MAXCNT];
  1062. A_UINT32 rx_rate_inval;
  1063. } wlan_dbg_wifi2_error_stats_t;
  1064. typedef struct wlan_dbg_wifi2_error2_stats {
  1065. A_UINT32 schd_errs[WHAL_DBG_CMD_STALL_ERR_MAXCNT];
  1066. A_UINT32 sifs_errs[WHAL_DBG_SIFS_ERR_MAXCNT];
  1067. } wlan_dbg_wifi2_error2_stats_t;
  1068. #define WLAN_DBG_STATS_SIZE_TXBF_VHT 10
  1069. #define WLAN_DBG_STATS_SIZE_TXBF_HT 8
  1070. #define WLAN_DBG_STATS_SIZE_TXBF_OFDM 8
  1071. #define WLAN_DBG_STATS_SIZE_TXBF_CCK 7
  1072. typedef struct wlan_dbg_txbf_data_stats {
  1073. A_UINT32 tx_txbf_vht[WLAN_DBG_STATS_SIZE_TXBF_VHT];
  1074. A_UINT32 rx_txbf_vht[WLAN_DBG_STATS_SIZE_TXBF_VHT];
  1075. A_UINT32 tx_txbf_ht[WLAN_DBG_STATS_SIZE_TXBF_HT];
  1076. A_UINT32 tx_txbf_ofdm[WLAN_DBG_STATS_SIZE_TXBF_OFDM];
  1077. A_UINT32 tx_txbf_cck[WLAN_DBG_STATS_SIZE_TXBF_CCK];
  1078. } wlan_dbg_txbf_data_stats_t;
  1079. struct wlan_dbg_tx_mu_stats {
  1080. A_UINT32 mu_sch_nusers_2;
  1081. A_UINT32 mu_sch_nusers_3;
  1082. A_UINT32 mu_mpdus_queued_usr[4];
  1083. A_UINT32 mu_mpdus_tried_usr[4];
  1084. A_UINT32 mu_mpdus_failed_usr[4];
  1085. A_UINT32 mu_mpdus_requeued_usr[4];
  1086. A_UINT32 mu_err_no_ba_usr[4];
  1087. A_UINT32 mu_mpdu_underrun_usr[4];
  1088. A_UINT32 mu_ampdu_underrun_usr[4];
  1089. };
  1090. struct wlan_dbg_tx_selfgen_stats {
  1091. A_UINT32 su_ndpa;
  1092. A_UINT32 su_ndp;
  1093. A_UINT32 mu_ndpa;
  1094. A_UINT32 mu_ndp;
  1095. A_UINT32 mu_brpoll_1;
  1096. A_UINT32 mu_brpoll_2;
  1097. A_UINT32 mu_bar_1;
  1098. A_UINT32 mu_bar_2;
  1099. A_UINT32 cts_burst;
  1100. A_UINT32 su_ndp_err;
  1101. A_UINT32 su_ndpa_err;
  1102. A_UINT32 mu_ndp_err;
  1103. A_UINT32 mu_brp1_err;
  1104. A_UINT32 mu_brp2_err;
  1105. };
  1106. typedef struct wlan_dbg_sifs_resp_stats {
  1107. A_UINT32 ps_poll_trigger; /* num ps-poll trigger frames */
  1108. A_UINT32 uapsd_trigger; /* num uapsd trigger frames */
  1109. A_UINT32 qb_data_trigger[2]; /* num data trigger frames; idx 0: explicit and idx 1: implicit */
  1110. A_UINT32 qb_bar_trigger[2]; /* num bar trigger frames; idx 0: explicit and idx 1: implicit */
  1111. A_UINT32 sifs_resp_data; /* num ppdus transmitted at SIFS interval */
  1112. A_UINT32 sifs_resp_err; /* num ppdus failed to meet SIFS resp timing */
  1113. } wlan_dgb_sifs_resp_stats_t;
  1114. /** wlan_dbg_wifi2_error_stats_t is not grouped with the
  1115. * following structure as it is allocated differently and only
  1116. * belongs to whal
  1117. */
  1118. typedef struct wlan_dbg_stats_wifi2 {
  1119. wlan_dbg_txbf_snd_stats_t txbf_snd_info;
  1120. wlan_dbg_txbf_data_stats_t txbf_data_info;
  1121. struct wlan_dbg_tx_selfgen_stats tx_selfgen;
  1122. struct wlan_dbg_tx_mu_stats tx_mu;
  1123. wlan_dgb_sifs_resp_stats_t sifs_resp_info;
  1124. } wlan_dbg_wifi2_stats_t;
  1125. /*
  1126. * wlan_dbg_rx_rate_info_v1a, _v1b:
  1127. * differing versions of the wlan_dbg_rx_rate_info struct used by different
  1128. * targets
  1129. */
  1130. typedef struct {
  1131. wlan_dbg_rx_rate_info_v1a_t rx_phy_info;
  1132. wlan_dbg_tx_rate_info_t tx_rate_info;
  1133. } wlan_dbg_rate_info_v1a_t;
  1134. typedef struct {
  1135. wlan_dbg_rx_rate_info_v1b_t rx_phy_info;
  1136. wlan_dbg_tx_rate_info_t tx_rate_info;
  1137. } wlan_dbg_rate_info_v1b_t;
  1138. #if defined(AR900B)
  1139. #define wlan_dbg_rate_info_t wlan_dbg_rate_info_v1b_t
  1140. #else
  1141. #define wlan_dbg_rate_info_t wlan_dbg_rate_info_v1a_t
  1142. #endif
  1143. typedef struct {
  1144. wlan_dbg_rx_rate_info_v2_t rx_phy_info;
  1145. wlan_dbg_tx_rate_info_v2_t tx_rate_info;
  1146. } wlan_dbg_rate_info_v2_t;
  1147. /*
  1148. * wlan_dbg_stats_v1, _v2:
  1149. * differing versions of the wlan_dbg_stats struct used by different
  1150. * targets
  1151. */
  1152. struct wlan_dbg_stats_v1 {
  1153. struct wlan_dbg_tx_stats_v1 tx;
  1154. struct wlan_dbg_rx_stats_v1 rx;
  1155. struct wlan_dbg_peer_stats peer;
  1156. };
  1157. struct wlan_dbg_stats_v2 {
  1158. struct wlan_dbg_tx_stats_v2 tx;
  1159. struct wlan_dbg_rx_stats_v2 rx;
  1160. struct wlan_dbg_mem_stats mem;
  1161. struct wlan_dbg_peer_stats peer;
  1162. };
  1163. #if defined(AR900B)
  1164. #define wlan_dbg_stats wlan_dbg_stats_v2
  1165. #else
  1166. #define wlan_dbg_stats wlan_dbg_stats_v1
  1167. #endif
  1168. #define DBG_STATS_MAX_HWQ_NUM 10
  1169. #define DBG_STATS_MAX_TID_NUM 20
  1170. #define DBG_STATS_MAX_CONG_NUM 16
  1171. struct wlan_dbg_txq_stats {
  1172. A_UINT16 num_pkts_queued[DBG_STATS_MAX_HWQ_NUM];
  1173. A_UINT16 tid_hw_qdepth[DBG_STATS_MAX_TID_NUM]; /* WAL_MAX_TID is 20 */
  1174. A_UINT16 tid_sw_qdepth[DBG_STATS_MAX_TID_NUM]; /* WAL_MAX_TID is 20 */
  1175. };
  1176. struct wlan_dbg_tidq_stats {
  1177. A_UINT32 wlan_dbg_tid_txq_status;
  1178. struct wlan_dbg_txq_stats txq_st;
  1179. };
  1180. typedef enum {
  1181. WLAN_DBG_DATA_STALL_NONE = 0,
  1182. WLAN_DBG_DATA_STALL_VDEV_PAUSE = 1,
  1183. WLAN_DBG_DATA_STALL_HWSCHED_CMD_FILTER = 2,
  1184. WLAN_DBG_DATA_STALL_HWSCHED_CMD_FLUSH = 3,
  1185. WLAN_DBG_DATA_STALL_RX_REFILL_FAILED = 4,
  1186. WLAN_DBG_DATA_STALL_RX_FCS_LEN_ERROR = 5,
  1187. WLAN_DBG_DATA_STALL_MAC_WDOG_ERRORS = 6, /* Mac watch dog */
  1188. WLAN_DBG_DATA_STALL_PHY_BB_WDOG_ERROR = 7, /* PHY watch dog */
  1189. WLAN_DBG_DATA_STALL_POST_TIM_NO_TXRX_ERROR = 8,
  1190. WLAN_DBG_DATA_STALL_CONSECUTIVE_NON_FLUSH = 9,
  1191. WLAN_DBG_DATA_STALL_CONSECUTIVE_NOACK = 10,
  1192. WLAN_DBG_DATA_STALL_CONSECUTIVE_LT_EXPIRY = 11,
  1193. WLAN_DBG_DATA_STALL_MAX,
  1194. } wlan_dbg_data_stall_type_e;
  1195. typedef enum {
  1196. WLAN_DBG_DATA_STALL_RECOVERY_NONE = 0,
  1197. WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_DISCONNECT,
  1198. WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_MAC_PHY_RESET,
  1199. WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_PDR,
  1200. WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_SSR,
  1201. } wlan_dbg_data_stall_recovery_type_e;
  1202. /*
  1203. * NOTE: If necessary, restore the explicit disabling of CONFIG_160MHZ_SUPPORT
  1204. * See the corresponding comment + pre-processor block at the top of the file.
  1205. */
  1206. #ifdef CONFIG_160MHZ_SUPPORT_UNDEF_WAR
  1207. #define CONFIG_160MHZ_SUPPORT 0
  1208. #undef CONFIG_160MHZ_SUPPORT_UNDEF_WAR
  1209. #endif
  1210. /** MGMT RX REO Changes */
  1211. /* Macros for having versioning info for compatibility check between host and firmware */
  1212. #define MLO_SHMEM_MAJOR_VERSION 2
  1213. #define MLO_SHMEM_MINOR_VERSION 1
  1214. /** Helper Macros for tlv header of the given tlv buffer */
  1215. /* Size of the TLV Header which is the Tag and Length fields */
  1216. #define MLO_SHMEM_TLV_HDR_SIZE (1 * sizeof(A_UINT32))
  1217. /* TLV Helper macro to get the TLV Header given the pointer to the TLV buffer. */
  1218. #define MLO_SHMEMTLV_GET_HDR(tlv_buf) (((A_UINT32 *) (tlv_buf))[0])
  1219. /* TLV Helper macro to set the TLV Header given the pointer to the TLV buffer. */
  1220. #define MLO_SHMEMTLV_SET_HDR(tlv_buf, tag, len) \
  1221. (((A_UINT32 *)(tlv_buf))[0]) = ((tag << 16) | (len & 0x0000FFFF))
  1222. /* TLV Helper macro to get the TLV Tag given the TLV header. */
  1223. #define MLO_SHMEMTLV_GET_TLVTAG(tlv_header) ((A_UINT32)((tlv_header) >> 16))
  1224. /*
  1225. * TLV Helper macro to get the TLV Buffer Length (minus TLV header size)
  1226. * given the TLV header.
  1227. */
  1228. #define MLO_SHMEMTLV_GET_TLVLEN(tlv_header) \
  1229. ((A_UINT32)((tlv_header) & 0x0000FFFF))
  1230. /*
  1231. * TLV Helper macro to get the TLV length from TLV structure size
  1232. * by removing TLV header size.
  1233. */
  1234. #define MLO_SHMEMTLV_GET_STRUCT_TLVLEN(tlv_struct) \
  1235. ((A_UINT32)(sizeof(tlv_struct)-MLO_SHMEM_TLV_HDR_SIZE))
  1236. /**
  1237. * Helper Macros for getting and setting the required number of bits
  1238. * from the TLV params.
  1239. */
  1240. #define MLO_SHMEM_GET_BITS(_val,_index,_num_bits) \
  1241. (((_val) >> (_index)) & ((1 << (_num_bits)) - 1))
  1242. #define MLO_SHMEM_SET_BITS(_var,_index,_num_bits,_val) \
  1243. do { \
  1244. (_var) &= ~(((1 << (_num_bits)) - 1) << (_index)); \
  1245. (_var) |= (((_val) & ((1 << (_num_bits)) - 1)) << (_index)); \
  1246. } while (0)
  1247. /**
  1248. * Enum which defines different versions of management Rx reorder snapshots.
  1249. */
  1250. typedef enum {
  1251. /**
  1252. * DWORD Lower:
  1253. * [15:0] : Management packet counter
  1254. * [30:16] : Redundant global time stamp = Global time stamp[14:0]
  1255. * [31] : Valid
  1256. *
  1257. * DWORD Upper:
  1258. * [31:0] : Global time stamp
  1259. *
  1260. */
  1261. MGMT_RX_REO_SNAPSHOT_VERSION_TIMESTAMP_REDUNDANCY = 0,
  1262. /**
  1263. * DWORD Lower:
  1264. * [14:0] : Global time stamp[14:0]
  1265. * [30:15] : Management packet counter
  1266. * [31] : Valid
  1267. *
  1268. * DWORD Upper:
  1269. * [14:0] : Redundant management packet counter = Management packet
  1270. * counter[14:0]
  1271. * [31:15] : Global time stamp[31:15]
  1272. */
  1273. MGMT_RX_REO_SNAPSHOT_VERSION_PKT_CTR_REDUNDANCY = 1,
  1274. } MGMT_RX_REO_SNAPSHOT_VERSION;
  1275. /** Definition of the GLB_H_SHMEM arena tlv structures */
  1276. typedef enum {
  1277. MLO_SHMEM_TLV_STRUCT_MGMT_RX_REO_SNAPSHOT,
  1278. MLO_SHMEM_TLV_STRUCT_MLO_GLB_RX_REO_PER_LINK_SNAPSHOT_INFO,
  1279. MLO_SHMEM_TLV_STRUCT_MLO_GLB_RX_REO_SNAPSHOT_INFO,
  1280. MLO_SHMEM_TLV_STRUCT_MLO_GLB_LINK,
  1281. MLO_SHMEM_TLV_STRUCT_MLO_GLB_LINK_INFO,
  1282. MLO_SHMEM_TLV_STRUCT_MLO_GLB_H_SHMEM,
  1283. MLO_SHMEM_TLV_STRUCT_MLO_GLB_CHIP_CRASH_INFO,
  1284. MLO_SHMEM_TLV_STRUCT_MLO_GLB_PER_CHIP_CRASH_INFO,
  1285. } MLO_SHMEM_TLV_TAG_ID;
  1286. /** Helper macro for params GET/SET of mgmt_rx_reo_snapshot */
  1287. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_VALID_GET(mgmt_rx_reo_snapshot_low) MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_low, 0, 1)
  1288. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_VALID_SET(mgmt_rx_reo_snapshot_low, value) MLO_SHMEM_SET_BITS(mgmt_rx_reo_snapshot_low, 0, 1, value)
  1289. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_MGMT_PKT_CTR_GET(mgmt_rx_reo_snapshot_low) MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_low, 1, 16)
  1290. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_MGMT_PKT_CTR_SET(mgmt_rx_reo_snapshot_low, value) MLO_SHMEM_SET_BITS(mgmt_rx_reo_snapshot_low, 1, 16, value)
  1291. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_GLOBAL_TIMESTAMP_GET(mgmt_rx_reo_snapshot) \
  1292. (MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot->mgmt_rx_reo_snapshot_high, 0, 17) << 15) | \
  1293. MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot->mgmt_rx_reo_snapshot_low, 17, 15)
  1294. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_GLOBAL_TIMESTAMP_SET(mgmt_rx_reo_snapshot, value) \
  1295. do { \
  1296. MLO_SHMEM_SET_BITS(mgmt_rx_reo_snapshot->mgmt_rx_reo_snapshot_high, 0, 17, ((value) >> 15)); \
  1297. MLO_SHMEM_SET_BITS(mgmt_rx_reo_snapshot->mgmt_rx_reo_snapshot_low, 17, 15, ((value) & 0x7fff)); \
  1298. } while (0)
  1299. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_MGMT_PKT_CTR_REDUNDANT_GET(mgmt_rx_reo_snapshot_high) MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_high, 17, 15)
  1300. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_MGMT_PKT_CTR_REDUNDANT_SET(mgmt_rx_reo_snapshot_high, value) MLO_SHMEM_SET_BITS(mgmt_rx_reo_snapshot_high, 17, 15, value)
  1301. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_IS_CONSISTENT(mgmt_pkt_ctr, mgmt_pkt_ctr_redundant) \
  1302. (MLO_SHMEM_GET_BITS(mgmt_pkt_ctr, 0, 15) == MLO_SHMEM_GET_BITS(mgmt_pkt_ctr_redundant, 0, 15))
  1303. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_GLOBAL_TIMESTAMP_GET_FROM_DWORDS(mgmt_rx_reo_snapshot_low,mgmt_rx_reo_snapshot_high) \
  1304. (MLO_SHMEM_GET_BITS((mgmt_rx_reo_snapshot_high), 0, 17) << 15) | \
  1305. MLO_SHMEM_GET_BITS((mgmt_rx_reo_snapshot_low), 17, 15)
  1306. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_GET_ADRESS(mgmt_rx_reo_snapshot) \
  1307. (&mgmt_rx_reo_snapshot->mgmt_rx_reo_snapshot_low)
  1308. /**
  1309. * Helper macros/functions for params GET/SET of different hw version
  1310. * of the mgmt_rx_reo_snapshot
  1311. */
  1312. static INLINE A_UINT8
  1313. MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_VALID_GET(
  1314. A_UINT32 mgmt_rx_reo_snapshot_low, A_UINT8 snapshot_ver)
  1315. {
  1316. if ((snapshot_ver != MGMT_RX_REO_SNAPSHOT_VERSION_TIMESTAMP_REDUNDANCY) &&
  1317. (snapshot_ver != MGMT_RX_REO_SNAPSHOT_VERSION_PKT_CTR_REDUNDANCY))
  1318. {
  1319. A_ASSERT(0);
  1320. }
  1321. return MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_low, 31, 1);
  1322. }
  1323. static INLINE void
  1324. MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_VALID_SET(
  1325. A_UINT32 *mgmt_rx_reo_snapshot_low, A_UINT8 value, A_UINT8 snapshot_ver)
  1326. {
  1327. if ((snapshot_ver != MGMT_RX_REO_SNAPSHOT_VERSION_TIMESTAMP_REDUNDANCY) &&
  1328. (snapshot_ver != MGMT_RX_REO_SNAPSHOT_VERSION_PKT_CTR_REDUNDANCY)) {
  1329. A_ASSERT(0);
  1330. }
  1331. MLO_SHMEM_SET_BITS(*mgmt_rx_reo_snapshot_low, 31, 1, value);
  1332. }
  1333. static INLINE A_UINT16
  1334. MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_MGMT_PKT_CTR_GET(
  1335. A_UINT32 mgmt_rx_reo_snapshot_low, A_UINT8 snapshot_ver)
  1336. {
  1337. if (snapshot_ver == MGMT_RX_REO_SNAPSHOT_VERSION_TIMESTAMP_REDUNDANCY) {
  1338. return MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_low, 0, 16);
  1339. } else if (snapshot_ver == MGMT_RX_REO_SNAPSHOT_VERSION_PKT_CTR_REDUNDANCY){
  1340. return MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_low, 15, 16);
  1341. } else {
  1342. A_ASSERT(0);
  1343. return 0;
  1344. }
  1345. }
  1346. static INLINE void
  1347. MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_MGMT_PKT_CTR_SET(
  1348. A_UINT32 *mgmt_rx_reo_snapshot_low, A_UINT16 value, A_UINT8 snapshot_ver)
  1349. {
  1350. if (snapshot_ver == MGMT_RX_REO_SNAPSHOT_VERSION_TIMESTAMP_REDUNDANCY) {
  1351. MLO_SHMEM_SET_BITS(*mgmt_rx_reo_snapshot_low, 0, 16, value);
  1352. } else if (snapshot_ver == MGMT_RX_REO_SNAPSHOT_VERSION_PKT_CTR_REDUNDANCY){
  1353. MLO_SHMEM_SET_BITS(*mgmt_rx_reo_snapshot_low, 15, 16, value);
  1354. } else {
  1355. A_ASSERT(0);
  1356. }
  1357. }
  1358. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_MGMT_PKT_CTR_REDUNDANT_GET( \
  1359. mgmt_rx_reo_snapshot_high) \
  1360. MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_high, 0, 15)
  1361. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_MGMT_PKT_CTR_REDUNDANT_SET( \
  1362. mgmt_rx_reo_snapshot_high, value) \
  1363. MLO_SHMEM_SET_BITS(mgmt_rx_reo_snapshot_high, 0, 15, value)
  1364. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_GLOBAL_TIMESTAMP_REDUNDANT_GET( \
  1365. mgmt_rx_reo_snapshot_low) \
  1366. MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_low, 16, 15)
  1367. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_GLOBAL_TIMESTAMP_REDUNDANT_SET( \
  1368. mgmt_rx_reo_snapshot_low, value) \
  1369. MLO_SHMEM_SET_BITS(mgmt_rx_reo_snapshot_low, 16, 15, value)
  1370. static INLINE A_UINT32
  1371. MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_GLOBAL_TIMESTAMP_GET(
  1372. A_UINT32 mgmt_rx_reo_snapshot_low,
  1373. A_UINT32 mgmt_rx_reo_snapshot_high,
  1374. A_UINT8 snapshot_ver)
  1375. {
  1376. if (snapshot_ver == MGMT_RX_REO_SNAPSHOT_VERSION_TIMESTAMP_REDUNDANCY) {
  1377. return mgmt_rx_reo_snapshot_high;
  1378. } else if (snapshot_ver == MGMT_RX_REO_SNAPSHOT_VERSION_PKT_CTR_REDUNDANCY){
  1379. return
  1380. ((MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_high, 15, 17) << 15) |
  1381. MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_low, 0, 15));
  1382. } else {
  1383. A_ASSERT(0);
  1384. return 0;
  1385. }
  1386. }
  1387. static INLINE void
  1388. MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_GLOBAL_TIMESTAMP_SET(
  1389. A_UINT32 *mgmt_rx_reo_snapshot_low,
  1390. A_UINT32 *mgmt_rx_reo_snapshot_high,
  1391. A_UINT32 value,
  1392. A_UINT8 snapshot_ver)
  1393. {
  1394. if (snapshot_ver == MGMT_RX_REO_SNAPSHOT_VERSION_TIMESTAMP_REDUNDANCY) {
  1395. *mgmt_rx_reo_snapshot_high = value;
  1396. } else if (snapshot_ver == MGMT_RX_REO_SNAPSHOT_VERSION_PKT_CTR_REDUNDANCY){
  1397. MLO_SHMEM_SET_BITS(
  1398. *mgmt_rx_reo_snapshot_high, 15, 17, ((value) >> 15));
  1399. MLO_SHMEM_SET_BITS(
  1400. *mgmt_rx_reo_snapshot_low, 0, 15, ((value) & 0x7fff));
  1401. } else {
  1402. A_ASSERT(0);
  1403. }
  1404. }
  1405. static INLINE A_BOOL
  1406. MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_CHECK_CONSISTENCY(
  1407. A_UINT32 mgmt_rx_reo_snapshot_low,
  1408. A_UINT32 mgmt_rx_reo_snapshot_high,
  1409. A_UINT8 snapshot_ver)
  1410. {
  1411. if (snapshot_ver == MGMT_RX_REO_SNAPSHOT_VERSION_TIMESTAMP_REDUNDANCY) {
  1412. A_UINT32 global_timestamp;
  1413. A_UINT32 global_timestamp_redundant;
  1414. global_timestamp = MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_GLOBAL_TIMESTAMP_GET(
  1415. mgmt_rx_reo_snapshot_low, mgmt_rx_reo_snapshot_high, snapshot_ver);
  1416. global_timestamp_redundant =
  1417. MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_GLOBAL_TIMESTAMP_REDUNDANT_GET(
  1418. mgmt_rx_reo_snapshot_low);
  1419. return
  1420. (MLO_SHMEM_GET_BITS(global_timestamp, 0, 15) ==
  1421. MLO_SHMEM_GET_BITS(global_timestamp_redundant, 0, 15));
  1422. } else if (snapshot_ver == MGMT_RX_REO_SNAPSHOT_VERSION_PKT_CTR_REDUNDANCY){
  1423. A_UINT16 mgmt_pkt_ctr;
  1424. A_UINT16 mgmt_pkt_ctr_redundant;
  1425. mgmt_pkt_ctr = MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_MGMT_PKT_CTR_GET(
  1426. mgmt_rx_reo_snapshot_low, snapshot_ver);
  1427. mgmt_pkt_ctr_redundant =
  1428. MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_MGMT_PKT_CTR_REDUNDANT_GET(
  1429. mgmt_rx_reo_snapshot_high);
  1430. return
  1431. (MLO_SHMEM_GET_BITS(mgmt_pkt_ctr, 0, 15) ==
  1432. MLO_SHMEM_GET_BITS(mgmt_pkt_ctr_redundant, 0, 15));
  1433. } else {
  1434. A_ASSERT(0);
  1435. return 0;
  1436. }
  1437. }
  1438. /* REO snapshot structure */
  1439. typedef struct {
  1440. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MGMT_RX_REO_SNAPSHOT */
  1441. A_UINT32 tlv_header;
  1442. A_UINT32 reserved_alignment_padding;
  1443. /**
  1444. * mgmt_rx_reo_snapshot_low
  1445. *
  1446. * [0]: valid
  1447. * [16:1]: mgmt_pkt_ctr
  1448. * [31:17]: global_timestamp_low
  1449. */
  1450. A_UINT32 mgmt_rx_reo_snapshot_low;
  1451. /**
  1452. * mgmt_rx_reo_snapshot_high
  1453. *
  1454. * [16:0]: global_timestamp_high
  1455. * [31:17]: mgmt_pkt_ctr_redundant
  1456. */
  1457. A_UINT32 mgmt_rx_reo_snapshot_high;
  1458. } mgmt_rx_reo_snapshot;
  1459. A_COMPILE_TIME_ASSERT(check_mgmt_rx_reo_snapshot_8byte_size_quantum,
  1460. (((sizeof(mgmt_rx_reo_snapshot) % sizeof(A_UINT64) == 0x0))));
  1461. A_COMPILE_TIME_ASSERT(verify_mgmt_rx_reo_snapshot_low_offset,
  1462. (A_OFFSETOF(mgmt_rx_reo_snapshot, mgmt_rx_reo_snapshot_low) % sizeof(A_UINT64) == 0));
  1463. typedef struct {
  1464. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_RX_REO_PER_LINK_SNAPSHOT_INFO */
  1465. A_UINT32 tlv_header;
  1466. A_UINT32 reserved_alignment_padding;
  1467. mgmt_rx_reo_snapshot fw_consumed;
  1468. mgmt_rx_reo_snapshot fw_forwarded;
  1469. mgmt_rx_reo_snapshot hw_forwarded;
  1470. } mlo_glb_rx_reo_per_link_snapshot_info;
  1471. A_COMPILE_TIME_ASSERT(check_mlo_glb_rx_reo_per_link_snapshot_info_8byte_size_quantum,
  1472. (((sizeof(mlo_glb_rx_reo_per_link_snapshot_info) % sizeof(A_UINT64) == 0x0))));
  1473. A_COMPILE_TIME_ASSERT(verify_mlo_glb_rx_reo_per_link_snapshot_fw_consumed_offset,
  1474. (A_OFFSETOF(mlo_glb_rx_reo_per_link_snapshot_info, fw_consumed) % sizeof(A_UINT64) == 0));
  1475. /** Helper macro for params GET/SET of mlo_glb_rx_reo_snapshot_info */
  1476. #define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_NO_OF_LINKS_GET(link_info) MLO_SHMEM_GET_BITS(link_info, 0, 4)
  1477. #define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_NO_OF_LINKS_SET(link_info, value) MLO_SHMEM_SET_BITS(link_info, 0, 4, value)
  1478. #define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_VALID_LINK_BMAP_GET(link_info) MLO_SHMEM_GET_BITS(link_info, 4, 16)
  1479. #define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_VALID_LINK_BMAP_SET(link_info, value) MLO_SHMEM_SET_BITS(link_info, 4, 16, value)
  1480. #define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_HW_FWD_SNAPSHOT_VER_GET(snapshot_ver_info) MLO_SHMEM_GET_BITS(snapshot_ver_info, 0, 3)
  1481. #define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_HW_FWD_SNAPSHOT_VER_SET(snapshot_ver_info, value) MLO_SHMEM_SET_BITS(snapshot_ver_info, 0, 3, value)
  1482. #define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_FW_FWD_SNAPSHOT_VER_GET(snapshot_ver_info) MLO_SHMEM_GET_BITS(snapshot_ver_info, 3, 3)
  1483. #define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_FW_FWD_SNAPSHOT_VER_SET(snapshot_ver_info, value) MLO_SHMEM_SET_BITS(snapshot_ver_info, 3, 3, value)
  1484. #define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_FW_CONSUMED_SNAPSHOT_VER_GET(snapshot_ver_info) MLO_SHMEM_GET_BITS(snapshot_ver_info, 6, 3)
  1485. #define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_FW_CONSUMED_SNAPSHOT_VER_SET(snapshot_ver_info, value) MLO_SHMEM_SET_BITS(snapshot_ver_info, 6, 3, value)
  1486. /* Definition of the complete REO snapshot info */
  1487. typedef struct {
  1488. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_RX_REO_SNAPSHOT_INFO */
  1489. A_UINT32 tlv_header;
  1490. /**
  1491. * link_info
  1492. *
  1493. * [3:0]: no_of_links
  1494. * [19:4]: valid_link_bmap
  1495. * [31:20]: reserved
  1496. */
  1497. A_UINT32 link_info;
  1498. /**
  1499. * snapshot_ver_info
  1500. *
  1501. * [2:0]: hw_forwarded snapshot version
  1502. * [5:3]: fw_forwarded snapshot version
  1503. * [8:6]: fw_consumed snapshot version
  1504. * [31:9]: reserved
  1505. */
  1506. A_UINT32 snapshot_ver_info;
  1507. A_UINT32 reserved_alignment_padding;
  1508. /* This TLV is followed by array of mlo_glb_rx_reo_per_link_snapshot_info:
  1509. * mlo_glb_rx_reo_per_link_snapshot_info will have multiple instances
  1510. * equal to num of hw links received by no_of_link
  1511. * mlo_glb_rx_reo_per_link_snapshot_info per_link_info[];
  1512. */
  1513. } mlo_glb_rx_reo_snapshot_info;
  1514. A_COMPILE_TIME_ASSERT(check_mlo_glb_rx_reo_snapshot_info_8byte_size_quantum,
  1515. (((sizeof(mlo_glb_rx_reo_snapshot_info) % sizeof(A_UINT64) == 0x0))));
  1516. /** Helper macro for params GET/SET of mlo_glb_link */
  1517. #define MLO_SHMEM_GLB_LINK_PARAM_LINK_STATUS_GET(link_status) MLO_SHMEM_GET_BITS(link_status, 0, 8)
  1518. #define MLO_SHMEM_GLB_LINK_PARAM_LINK_STATUS_SET(link_status, value) MLO_SHMEM_SET_BITS(link_status, 0, 8, value)
  1519. /*glb link info structures used for scratchpad memory (crash and recovery) */
  1520. typedef struct {
  1521. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_LINK */
  1522. A_UINT32 tlv_header;
  1523. /**
  1524. * link_status
  1525. *
  1526. * [7:0]: link_status
  1527. * [31:8]: reserved
  1528. */
  1529. A_UINT32 link_status;
  1530. /*
  1531. * Based on MLO timestamp, which is global across chips -
  1532. * this will be first updated when MLO sync is completed.
  1533. */
  1534. A_UINT32 boot_timestamp_low_us;
  1535. A_UINT32 boot_timestamp_high_us;
  1536. /*
  1537. * Based on MLO timestamp, will be updated with a configurable
  1538. * periodicity (default 1 sec)
  1539. */
  1540. A_UINT32 health_check_timestamp_low_us;
  1541. A_UINT32 health_check_timestamp_high_us;
  1542. } mlo_glb_link;
  1543. A_COMPILE_TIME_ASSERT(check_mlo_glb_link_8byte_size_quantum,
  1544. (((sizeof(mlo_glb_link) % sizeof(A_UINT64) == 0x0))));
  1545. A_COMPILE_TIME_ASSERT(verify_mlo_glb_link_boot_timestamp_low_offset,
  1546. (A_OFFSETOF(mlo_glb_link, boot_timestamp_low_us) % sizeof(A_UINT64) == 0));
  1547. A_COMPILE_TIME_ASSERT(verify_mlo_glb_link_health_check_timestamp_low_offset,
  1548. (A_OFFSETOF(mlo_glb_link, health_check_timestamp_low_us) % sizeof(A_UINT64) == 0));
  1549. /** Helper macro for params GET/SET of mlo_glb_link_info */
  1550. #define MLO_SHMEM_GLB_LINK_INFO_PARAM_NO_OF_LINKS_GET(link_info) MLO_SHMEM_GET_BITS(link_info, 0, 4)
  1551. #define MLO_SHMEM_GLB_LINK_INFO_PARAM_NO_OF_LINKS_SET(link_info, value) MLO_SHMEM_SET_BITS(link_info, 0, 4, value)
  1552. #define MLO_SHMEM_GLB_LINK_INFO_PARAM_VALID_LINK_BMAP_GET(link_info) MLO_SHMEM_GET_BITS(link_info, 4, 16)
  1553. #define MLO_SHMEM_GLB_LINK_INFO_PARAM_VALID_LINK_BMAP_SET(link_info, value) MLO_SHMEM_SET_BITS(link_info, 4, 16, value)
  1554. typedef struct {
  1555. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_LINK_INFO */
  1556. A_UINT32 tlv_header;
  1557. /**
  1558. * link_info
  1559. *
  1560. * [3:0]: no_of_links
  1561. * [19:4]: valid_link_bmap
  1562. * [31:20]: reserved
  1563. */
  1564. A_UINT32 link_info;
  1565. /* This TLV is followed by array of mlo_glb_link:
  1566. * mlo_glb_link will have multiple instances equal to num of hw links
  1567. * received by no_of_link
  1568. * mlo_glb_link glb_link_info[];
  1569. */
  1570. } mlo_glb_link_info;
  1571. A_COMPILE_TIME_ASSERT(check_mlo_glb_link_info_8byte_size_quantum,
  1572. (((sizeof(mlo_glb_link_info) % sizeof(A_UINT64) == 0x0))));
  1573. typedef enum {
  1574. MLO_SHMEM_CRASH_PARTNER_CHIPS = 1,
  1575. MLO_SHMEM_CRASH_SW_PANIC = 2,
  1576. MLO_SHMEM_CRASH_SW_ASSERT = 3,
  1577. } MLO_SHMEM_CHIP_CRASH_REASON;
  1578. typedef enum {
  1579. MLO_SHMEM_RECOVERY_CRASH_PARTNER_CHIPS = 1,
  1580. MLO_SHMEM_RECOVER_NON_MLO_MODE = 2,
  1581. MLO_SHMEM_RECOVER_NON_CRASH_MLO_MODE = 3,
  1582. } MLO_SHMEM_CHIP_RECOVERY_MODE;
  1583. /* glb link info structures used for scratchpad memory (crash and recovery) */
  1584. typedef struct {
  1585. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_PER_CHIP_CRASH_INFO */
  1586. A_UINT32 tlv_header;
  1587. /**
  1588. * crash reason, takes value in enum MLO_SHMEM_CHIP_CRASH_REASON
  1589. */
  1590. A_UINT32 crash_reason;
  1591. /**
  1592. * crash reason, takes value in enum MLO_SHMEM_CHIP_RECOVERY_MODE
  1593. */
  1594. A_UINT32 recovery_mode;
  1595. /* reserved: added for padding to A_UINT64 size, available for future use */
  1596. A_UINT32 reserved;
  1597. } mlo_glb_per_chip_crash_info;
  1598. A_COMPILE_TIME_ASSERT(check_mlo_glb_per_chip_crash_info,
  1599. (((sizeof(mlo_glb_per_chip_crash_info) % sizeof(A_UINT64) == 0x0))));
  1600. /** Helper macro for params GET/SET of mlo_glb_chip_crash_info */
  1601. #define MLO_SHMEM_CHIP_CRASH_INFO_PARAM_NO_OF_CHIPS_GET(chip_info) \
  1602. (MLO_SHMEM_GET_BITS(chip_info, 0, 2) + \
  1603. (MLO_SHMEM_GET_BITS(chip_info, 12, 4) << 2))
  1604. #define MLO_SHMEM_CHIP_CRASH_INFO_PARAM_NO_OF_CHIPS_SET(chip_info, value) \
  1605. do { \
  1606. MLO_SHMEM_SET_BITS(chip_info, 0, 2, ((value) & 0x03)); \
  1607. MLO_SHMEM_SET_BITS(chip_info, 12, 4, ((value) >> 2)); \
  1608. } while (0)
  1609. #define MLO_SHMEM_CHIP_CRASH_INFO_PARAM_VALID_CHIP_BMAP_GET(chip_info) MLO_SHMEM_GET_BITS(chip_info, 2, 8)
  1610. #define MLO_SHMEM_CHIP_CRASH_INFO_PARAM_VALID_CHIP_BMAP_SET(chip_info, value) MLO_SHMEM_SET_BITS(chip_info, 2, 8, value)
  1611. typedef struct {
  1612. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_CHIP_CRASH_INFO */
  1613. A_UINT32 tlv_header;
  1614. /**
  1615. * chip_info
  1616. *
  1617. * [1:0]: no_of_chips
  1618. * [4:2]: valid_chip_bmap
  1619. * For number of chips beyond 3, extension fields are added.
  1620. * To maintain backward compatibility, with 3 chip board and
  1621. * old host driver, valid chip bmap is extended in continuation from
  1622. * existing bit 4 onwards, while extending no_of_chips information
  1623. * would overlap with old valid_chip_bmap, hence extended from
  1624. * bit 12:15. Now no_of_chip will have two parts, lower 2 bits from 0-1 and
  1625. * upper 4 bits from 12-15. SET-GET macros are modified accordingly.
  1626. * This helps in no change in respective processing files and don't need
  1627. * to maintain two copy of information for backward compatibility.
  1628. * [9:5]: valid_chip_bmap_ext
  1629. * [15:12]: no_of_chips_ext
  1630. * [31:16]: reserved
  1631. */
  1632. A_UINT32 chip_info;
  1633. /* This TLV is followed by array of mlo_glb_per_chip_crash_info:
  1634. * mlo_glb_per_chip_crash_info will have multiple instances equal to num of partner chips
  1635. * received by no_of_chips
  1636. * mlo_glb_per_chip_crash_info per_chip_crash_info[];
  1637. */
  1638. } mlo_glb_chip_crash_info;
  1639. A_COMPILE_TIME_ASSERT(check_mlo_glb_chip_crash_info,
  1640. (((sizeof(mlo_glb_chip_crash_info) % sizeof(A_UINT64) == 0x0))));
  1641. /** Helper macro for params GET/SET of mlo_glb_h_shmem */
  1642. #define MLO_SHMEM_GLB_H_SHMEM_PARAM_MINOR_VERSION_GET(major_minor_version) MLO_SHMEM_GET_BITS(major_minor_version, 0, 16)
  1643. #define MLO_SHMEM_GLB_H_SHMEM_PARAM_MINOR_VERSION_SET(major_minor_version, value) MLO_SHMEM_SET_BITS(major_minor_version, 0, 16, value)
  1644. #define MLO_SHMEM_GLB_H_SHMEM_PARAM_MAJOR_VERSION_GET(major_minor_version) MLO_SHMEM_GET_BITS(major_minor_version, 16, 16)
  1645. #define MLO_SHMEM_GLB_H_SHMEM_PARAM_MAJOR_VERSION_SET(major_minor_version, value) MLO_SHMEM_SET_BITS(major_minor_version, 16, 16, value)
  1646. /* Definition of Global H SHMEM Arena */
  1647. typedef struct {
  1648. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_H_SHMEM */
  1649. A_UINT32 tlv_header;
  1650. /**
  1651. * major_minor_version
  1652. *
  1653. * [15:0]: minor version
  1654. * [31:16]: major version
  1655. */
  1656. A_UINT32 major_minor_version;
  1657. /* This TLV is followed by TLVs
  1658. * mlo_glb_rx_reo_snapshot_info reo_snapshot;
  1659. * mlo_glb_link_info glb_info;
  1660. * mlo_glb_chip_crash_info crash_info;
  1661. */
  1662. } mlo_glb_h_shmem;
  1663. A_COMPILE_TIME_ASSERT(check_mlo_glb_h_shmem_8byte_size_quantum,
  1664. (((sizeof(mlo_glb_h_shmem) % sizeof(A_UINT64) == 0x0))));
  1665. /** 2 word representation of MAC addr */
  1666. typedef struct _wmi_mac_addr {
  1667. /** upper 4 bytes of MAC address */
  1668. A_UINT32 mac_addr31to0;
  1669. /** lower 2 bytes of MAC address */
  1670. A_UINT32 mac_addr47to32;
  1671. } wmi_mac_addr;
  1672. #endif /* __WLANDEFS_H__ */