wlan_defs.h 68 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820
  1. /*
  2. * Copyright (c) 2013-2016, 2018-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2022 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 whic can be 0 us, 8 usec 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
  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
  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. } HAL_REG_CAPABILITIES;
  426. #ifdef NUM_SPATIAL_STREAM
  427. /*
  428. * The rate control definitions below are only used in the target.
  429. * (Host-based rate control is no longer applicable.)
  430. * Maintain the defs in wlanfw_cmn for the sake of existing Rome / Helium
  431. * targets, but for Lithium targets remove them from wlanfw_cmn and define
  432. * them in a target-only location instead.
  433. * SUPPORT_11AX is essentially used as a condition to identify Lithium targets.
  434. * Some host drivers would also have SUPPORT_11AX defined, and thus would lose
  435. * the definition of RATE_CODE, RC_TX_DONE_PARAMS, and related macros, but
  436. * that's okay because the host should have no references to these
  437. * target-only data structures.
  438. */
  439. #if !((NUM_SPATIAL_STREAM > 4) || SUPPORT_11AX) /* following N/A for Lithium */
  440. /*
  441. * Used to update rate-control logic with the status of the tx-completion.
  442. * In host-based implementation of the rate-control feature, this struture is used to
  443. * create the payload for HTT message/s from target to host.
  444. */
  445. #ifndef CONFIG_MOVE_RC_STRUCT_TO_MACCORE
  446. #if (NUM_SPATIAL_STREAM > 3)
  447. #define A_RATEMASK A_UINT64
  448. #else
  449. #define A_RATEMASK A_UINT32
  450. #endif
  451. #endif /* CONFIG_MOVE_RC_STRUCT_TO_MACCORE */
  452. typedef A_UINT8 A_RATE;
  453. typedef A_UINT8 A_RATECODE;
  454. #define A_RATEMASK_NUM_OCTET (sizeof (A_RATEMASK))
  455. #define A_RATEMASK_NUM_BITS ((sizeof (A_RATEMASK)) << 3)
  456. typedef struct {
  457. A_RATECODE rateCode;
  458. A_UINT8 flags;
  459. } RATE_CODE;
  460. typedef struct {
  461. RATE_CODE ptx_rc; /* rate code, bw, chain mask sgi */
  462. A_UINT8 reserved[2];
  463. A_UINT32 flags; /* Encodes information such as excessive
  464. retransmission, aggregate, some info
  465. from .11 frame control,
  466. STBC, LDPC, (SGI and Tx Chain Mask
  467. are encoded in ptx_rc->flags field),
  468. AMPDU truncation (BT/time based etc.),
  469. RTS/CTS attempt */
  470. A_UINT32 num_enqued; /* # of MPDUs (for non-AMPDU 1) for this rate */
  471. A_UINT32 num_retries; /* Total # of transmission attempt for this rate */
  472. A_UINT32 num_failed; /* # of failed MPDUs in A-MPDU, 0 otherwise */
  473. A_UINT32 ack_rssi; /* ACK RSSI: b'7..b'0 avg RSSI across all chain */
  474. A_UINT32 time_stamp ; /* ACK timestamp (helps determine age) */
  475. A_UINT32 is_probe; /* Valid if probing. Else, 0 */
  476. A_UINT32 ba_win_size; /* b'7..b0, block Ack Window size, b'31..b8 Resvd */
  477. A_UINT32 failed_ba_bmap_0_31; /* failed BA bitmap 0..31 */
  478. A_UINT32 failed_ba_bmap_32_63; /* failed BA bitmap 32..63 */
  479. A_UINT32 bmap_tried_0_31; /* enqued bitmap 0..31 */
  480. A_UINT32 bmap_tried_32_63; /* enqued bitmap 32..63 */
  481. } RC_TX_DONE_PARAMS;
  482. #define RC_SET_TX_DONE_INFO(_dst, _rc, _f, _nq, _nr, _nf, _rssi, _ts) \
  483. do { \
  484. (_dst).ptx_rc.rateCode = (_rc).rateCode; \
  485. (_dst).ptx_rc.flags = (_rc).flags; \
  486. (_dst).flags = (_f); \
  487. (_dst).num_enqued = (_nq); \
  488. (_dst).num_retries = (_nr); \
  489. (_dst).num_failed = (_nf); \
  490. (_dst).ack_rssi = (_rssi); \
  491. (_dst).time_stamp = (_ts); \
  492. } while (0)
  493. #define RC_SET_TXBF_DONE_INFO(_dst, _f) \
  494. do { \
  495. (_dst).flags |= (_f); \
  496. } while (0)
  497. /*
  498. * NOTE: NUM_SCHED_ENTRIES is not used in the host/target interface, but for
  499. * historical reasons has been defined in the host/target interface files.
  500. * The NUM_SCHED_ENTRIES definition is being moved into a target-only
  501. * header file for newer (Lithium) targets, but is being left here for
  502. * non-Lithium cases, to avoid having to rework legacy targets to move
  503. * the NUM_SCHED_ENTRIES definition into a target-only header file.
  504. * Moving the NUM_SCHED_ENTRIES definition into a non-Lithium conditional
  505. * block should have no impact on the host, since the host does not use
  506. * NUM_SCHED_ENTRIES.
  507. */
  508. #define NUM_SCHED_ENTRIES 2
  509. #endif /* !((NUM_SPATIAL_STREAM > 4) || SUPPORT_11AX) */ /* above N/A for Lithium */
  510. #endif /* NUM_SPATIAL_STREAM */
  511. /* NOTE: NUM_DYN_BW cannot be changed without breaking WMI Compatibility */
  512. #define NUM_DYN_BW_MAX 4
  513. /* Some products only use 20/40/80; some use 20/40/80/160 */
  514. #ifndef NUM_DYN_BW
  515. #define NUM_DYN_BW 3 /* default: support up through 80 MHz */
  516. #endif
  517. #define NUM_DYN_BW_MASK 0x3
  518. #define PROD_SCHED_BW_ENTRIES (NUM_SCHED_ENTRIES * NUM_DYN_BW)
  519. #if NUM_DYN_BW > 5
  520. /* Extend rate table module first */
  521. #error "Extend rate table module first"
  522. #endif
  523. #define MAX_IBSS_PEERS 32
  524. #ifdef NUM_SPATIAL_STREAM
  525. /*
  526. * RC_TX_RATE_SCHEDULE and RC_TX_RATE_INFO defs are used only in the target.
  527. * (Host-based rate control is no longer applicable.)
  528. * Maintain the defs in wlanfw_cmn for the sake of existing Rome / Helium
  529. * targets, but for Lithium targets remove them from wlanfw_cmn and define
  530. * them in a target-only location instead.
  531. * SUPPORT_11AX is essentially used as a condition to identify Lithium targets.
  532. * Some host drivers would also have SUPPORT_11AX defined, and thus would lose
  533. * the definition of RC_TX_RATE_SCHEDULE and RC_TX_RATE_INFO, but that's okay
  534. * because the host should have no references to these target-only data
  535. * structures.
  536. */
  537. #ifndef CONFIG_MOVE_RC_STRUCT_TO_MACCORE
  538. #if !((NUM_SPATIAL_STREAM > 4) || SUPPORT_11AX)
  539. #if defined(CONFIG_AR900B_SUPPORT) || defined(AR900B)
  540. typedef struct{
  541. A_UINT32 psdu_len[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  542. A_UINT16 flags[NUM_SCHED_ENTRIES][NUM_DYN_BW];
  543. A_RATE rix[NUM_SCHED_ENTRIES][NUM_DYN_BW];
  544. A_UINT8 tpc[NUM_SCHED_ENTRIES][NUM_DYN_BW];
  545. A_UINT32 antmask[NUM_SCHED_ENTRIES];
  546. A_UINT8 num_mpdus[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  547. A_UINT16 txbf_cv_len;
  548. A_UINT32 txbf_cv_ptr;
  549. A_UINT16 txbf_flags;
  550. A_UINT16 txbf_cv_size;
  551. A_UINT8 txbf_nc_idx;
  552. A_UINT8 tries[NUM_SCHED_ENTRIES];
  553. A_UINT8 bw_mask[NUM_SCHED_ENTRIES];
  554. A_UINT8 max_bw[NUM_SCHED_ENTRIES];
  555. A_UINT8 num_sched_entries;
  556. A_UINT8 paprd_mask;
  557. A_RATE rts_rix;
  558. A_UINT8 sh_pream;
  559. A_UINT8 min_spacing_1_4_us;
  560. A_UINT8 fixed_delims;
  561. A_UINT8 bw_in_service;
  562. A_RATE probe_rix;
  563. A_UINT8 num_valid_rates;
  564. A_UINT8 rtscts_tpc;
  565. A_UINT8 dd_profile;
  566. } RC_TX_RATE_SCHEDULE;
  567. #else
  568. typedef struct{
  569. A_UINT32 psdu_len[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  570. A_UINT16 flags[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  571. A_RATE rix[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  572. A_UINT8 tpc[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  573. A_UINT8 num_mpdus[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  574. A_UINT32 antmask[NUM_SCHED_ENTRIES];
  575. A_UINT32 txbf_cv_ptr;
  576. A_UINT16 txbf_cv_len;
  577. A_UINT8 tries[NUM_SCHED_ENTRIES];
  578. A_UINT8 num_valid_rates;
  579. A_UINT8 paprd_mask;
  580. A_RATE rts_rix;
  581. A_UINT8 sh_pream;
  582. A_UINT8 min_spacing_1_4_us;
  583. A_UINT8 fixed_delims;
  584. A_UINT8 bw_in_service;
  585. A_RATE probe_rix;
  586. } RC_TX_RATE_SCHEDULE;
  587. #endif
  588. typedef struct{
  589. A_UINT16 flags[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  590. A_RATE rix[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  591. #ifdef DYN_TPC_ENABLE
  592. A_UINT8 tpc[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  593. #endif
  594. #ifdef SECTORED_ANTENNA
  595. A_UINT32 antmask[NUM_SCHED_ENTRIES];
  596. #endif
  597. A_UINT8 tries[NUM_SCHED_ENTRIES];
  598. A_UINT8 num_valid_rates;
  599. A_RATE rts_rix;
  600. A_UINT8 sh_pream;
  601. A_UINT8 bw_in_service;
  602. A_RATE probe_rix;
  603. A_UINT8 dd_profile;
  604. } RC_TX_RATE_INFO;
  605. #endif /* !((NUM_SPATIAL_STREAM > 4) || SUPPORT_11AX) */
  606. #endif /* CONFIG_MOVE_RC_STRUCT_TO_MACCORE */
  607. #endif
  608. /*
  609. * Temporarily continue to provide the WHAL_RC_INIT_RC_MASKS def in wlan_defs.h
  610. * for older targets.
  611. * The WHAL_RX_INIT_RC_MASKS macro def needs to be moved into ratectrl_11ac.h
  612. * for all targets, but until this is complete, the WHAL_RC_INIT_RC_MASKS def
  613. * will be maintained here in its old location.
  614. */
  615. #ifndef CONFIG_160MHZ_SUPPORT
  616. #define WHAL_RC_INIT_RC_MASKS(_rm) do { \
  617. _rm[WHAL_RC_MASK_IDX_NON_HT] = A_RATEMASK_OFDM_CCK; \
  618. _rm[WHAL_RC_MASK_IDX_HT_20] = A_RATEMASK_HT_20; \
  619. _rm[WHAL_RC_MASK_IDX_HT_40] = A_RATEMASK_HT_40; \
  620. _rm[WHAL_RC_MASK_IDX_VHT_20] = A_RATEMASK_VHT_20; \
  621. _rm[WHAL_RC_MASK_IDX_VHT_40] = A_RATEMASK_VHT_40; \
  622. _rm[WHAL_RC_MASK_IDX_VHT_80] = A_RATEMASK_VHT_80; \
  623. } while (0)
  624. #endif
  625. /**
  626. * strucutre describing host memory chunk.
  627. */
  628. typedef struct {
  629. A_UINT32 tlv_header; /* TLV tag and len; tag equals WMITLV_TAG_STRUC_wlan_host_memory_chunk */
  630. /** id of the request that is passed up in service ready */
  631. A_UINT32 req_id;
  632. /** the physical address the memory chunk */
  633. A_UINT32 ptr;
  634. /** size of the chunk */
  635. A_UINT32 size;
  636. /** ptr_high
  637. * most significant bits of physical address of the memory chunk
  638. * Only applicable for addressing more than 32 bit.
  639. * This will only be non-zero if the target has set
  640. * WMI_SERVICE_SUPPORT_EXTEND_ADDRESS flag.
  641. */
  642. A_UINT32 ptr_high;
  643. } wlan_host_memory_chunk;
  644. #define NUM_UNITS_IS_NUM_VDEVS 0x1
  645. #define NUM_UNITS_IS_NUM_PEERS 0x2
  646. #define NUM_UNITS_IS_NUM_ACTIVE_PEERS 0x4
  647. /* request host to allocate memory contiguously */
  648. #define REQ_TO_HOST_FOR_CONT_MEMORY 0x8
  649. /**
  650. * structure used by FW for requesting host memory
  651. */
  652. typedef struct {
  653. A_UINT32 tlv_header; /* TLV tag and len; tag equals WMI_TLVTAG_STRUC_wlan_host_mem_req */
  654. /** ID of the request */
  655. A_UINT32 req_id;
  656. /** size of the of each unit */
  657. A_UINT32 unit_size;
  658. /**
  659. * flags to indicate that
  660. * the number units is dependent
  661. * on number of resources(num vdevs num peers .. etc)
  662. */
  663. A_UINT32 num_unit_info;
  664. /*
  665. * actual number of units to allocate . if flags in the num_unit_info
  666. * indicate that number of units is tied to number of a particular
  667. * resource to allocate then num_units filed is set to 0 and host
  668. * will derive the number units from number of the resources it is
  669. * requesting.
  670. */
  671. A_UINT32 num_units;
  672. } wlan_host_mem_req;
  673. typedef enum {
  674. IGNORE_DTIM = 0x01,
  675. NORMAL_DTIM = 0x02,
  676. STICK_DTIM = 0x03,
  677. AUTO_DTIM = 0x04,
  678. } BEACON_DTIM_POLICY;
  679. /* During test it is observed that 6 * 400 = 2400 can
  680. * be alloced in addition to CFG_TGT_NUM_MSDU_DESC.
  681. * If there is any change memory requirement, this number
  682. * needs to be revisited. */
  683. #define TOTAL_VOW_ALLOCABLE 2400
  684. #define VOW_DESC_GRAB_MAX 800
  685. #define VOW_GET_NUM_VI_STA(vow_config) (((vow_config) & 0xffff0000) >> 16)
  686. #define VOW_GET_DESC_PER_VI_STA(vow_config) ((vow_config) & 0x0000ffff)
  687. /***TODO!!! Get these values dynamically in WMI_READY event and use it to calculate the mem req*/
  688. /* size in bytes required for msdu descriptor. If it changes, this should be updated. LARGE_AP
  689. * case is not considered. LARGE_AP is disabled when VoW is enabled.*/
  690. #define MSDU_DESC_SIZE 20
  691. /* size in bytes required to support a peer in target.
  692. * This obtained by considering Two tids per peer.
  693. * peer structure = 168 bytes
  694. * tid = 96 bytes (per sta 2 means we need 192 bytes)
  695. * peer_cb = 16 * 2
  696. * key = 52 * 2
  697. * AST = 12 * 2
  698. * rate, reorder.. = 384
  699. * smart antenna = 50
  700. */
  701. #define MEMORY_REQ_FOR_PEER 800
  702. /*
  703. * NB: it is important to keep all the fields in the structure dword long
  704. * so that it is easy to handle the statistics in BE host.
  705. */
  706. /*
  707. * wlan_dbg_tx_stats_v1, _v2:
  708. * differing versions of the wlan_dbg_tx_stats struct used by different
  709. * targets
  710. */
  711. struct wlan_dbg_tx_stats_v1 {
  712. /* Num HTT cookies queued to dispatch list */
  713. A_INT32 comp_queued;
  714. /* Num HTT cookies dispatched */
  715. A_INT32 comp_delivered;
  716. /* Num MSDU queued to WAL */
  717. A_INT32 msdu_enqued;
  718. /* Num MPDU queue to WAL */
  719. A_INT32 mpdu_enqued;
  720. /* Num MSDUs dropped by WMM limit */
  721. A_INT32 wmm_drop;
  722. /* Num Local frames queued */
  723. A_INT32 local_enqued;
  724. /* Num Local frames done */
  725. A_INT32 local_freed;
  726. /* Num queued to HW */
  727. A_INT32 hw_queued;
  728. /* Num PPDU reaped from HW */
  729. A_INT32 hw_reaped;
  730. /* Num underruns */
  731. A_INT32 underrun;
  732. /* Num PPDUs cleaned up in TX abort */
  733. A_INT32 tx_abort;
  734. /* Num MPDUs requed by SW */
  735. A_INT32 mpdus_requed;
  736. /* excessive retries */
  737. A_UINT32 tx_ko;
  738. /* data hw rate code */
  739. A_UINT32 data_rc;
  740. /* Scheduler self triggers */
  741. A_UINT32 self_triggers;
  742. /* frames dropped due to excessive sw retries */
  743. A_UINT32 sw_retry_failure;
  744. /* illegal rate phy errors */
  745. A_UINT32 illgl_rate_phy_err;
  746. /* wal pdev continous xretry */
  747. A_UINT32 pdev_cont_xretry;
  748. /* wal pdev continous xretry */
  749. A_UINT32 pdev_tx_timeout;
  750. /* wal pdev resets */
  751. A_UINT32 pdev_resets;
  752. /* frames dropped due to non-availability of stateless TIDs */
  753. A_UINT32 stateless_tid_alloc_failure;
  754. /* PhY/BB underrun */
  755. A_UINT32 phy_underrun;
  756. /* MPDU is more than txop limit */
  757. A_UINT32 txop_ovf;
  758. };
  759. struct wlan_dbg_tx_stats_v2 {
  760. /* Num HTT cookies queued to dispatch list */
  761. A_INT32 comp_queued;
  762. /* Num HTT cookies dispatched */
  763. A_INT32 comp_delivered;
  764. /* Num MSDU queued to WAL */
  765. A_INT32 msdu_enqued;
  766. /* Num MPDU queue to WAL */
  767. A_INT32 mpdu_enqued;
  768. /* Num MSDUs dropped by WMM limit */
  769. A_INT32 wmm_drop;
  770. /* Num Local frames queued */
  771. A_INT32 local_enqued;
  772. /* Num Local frames done */
  773. A_INT32 local_freed;
  774. /* Num queued to HW */
  775. A_INT32 hw_queued;
  776. /* Num PPDU reaped from HW */
  777. A_INT32 hw_reaped;
  778. /* Num underruns */
  779. A_INT32 underrun;
  780. /* HW Paused. */
  781. A_UINT32 hw_paused;
  782. /* Num PPDUs cleaned up in TX abort */
  783. A_INT32 tx_abort;
  784. /* Num MPDUs requed by SW */
  785. A_INT32 mpdus_requed;
  786. /* excessive retries */
  787. A_UINT32 tx_ko;
  788. A_UINT32 tx_xretry;
  789. /* data hw rate code */
  790. A_UINT32 data_rc;
  791. /* Scheduler self triggers */
  792. A_UINT32 self_triggers;
  793. /* frames dropped due to excessive sw retries */
  794. A_UINT32 sw_retry_failure;
  795. /* illegal rate phy errors */
  796. A_UINT32 illgl_rate_phy_err;
  797. /* wal pdev continous xretry */
  798. A_UINT32 pdev_cont_xretry;
  799. /* wal pdev continous xretry */
  800. A_UINT32 pdev_tx_timeout;
  801. /* wal pdev resets */
  802. A_UINT32 pdev_resets;
  803. /* frames dropped due to non-availability of stateless TIDs */
  804. A_UINT32 stateless_tid_alloc_failure;
  805. /* PhY/BB underrun */
  806. A_UINT32 phy_underrun;
  807. /* MPDU is more than txop limit */
  808. A_UINT32 txop_ovf;
  809. /* Number of Sequences posted */
  810. A_UINT32 seq_posted;
  811. /* Number of Sequences failed queueing */
  812. A_UINT32 seq_failed_queueing;
  813. /* Number of Sequences completed */
  814. A_UINT32 seq_completed;
  815. /* Number of Sequences restarted */
  816. A_UINT32 seq_restarted;
  817. /* Number of MU Sequences posted */
  818. A_UINT32 mu_seq_posted;
  819. /* Num MPDUs flushed by SW, HWPAUSED, SW TXABORT (Reset,channel change) */
  820. A_INT32 mpdus_sw_flush;
  821. /* Num MPDUs filtered by HW, all filter condition (TTL expired) */
  822. A_INT32 mpdus_hw_filter;
  823. /* Num MPDUs truncated by PDG (TXOP, TBTT, PPDU_duration based on rate, dyn_bw) */
  824. A_INT32 mpdus_truncated;
  825. /* Num MPDUs that was tried but didn't receive ACK or BA */
  826. A_INT32 mpdus_ack_failed;
  827. /* Num MPDUs that was dropped du to expiry. */
  828. A_INT32 mpdus_expired;
  829. };
  830. #if defined(AR900B)
  831. #define wlan_dbg_tx_stats wlan_dbg_tx_stats_v2
  832. #else
  833. #define wlan_dbg_tx_stats wlan_dbg_tx_stats_v1
  834. #endif
  835. /*
  836. * wlan_dbg_rx_stats_v1, _v2:
  837. * differing versions of the wlan_dbg_rx_stats struct used by different
  838. * targets
  839. */
  840. struct wlan_dbg_rx_stats_v1 {
  841. /* Cnts any change in ring routing mid-ppdu */
  842. A_INT32 mid_ppdu_route_change;
  843. /* Total number of statuses processed */
  844. A_INT32 status_rcvd;
  845. /* Extra frags on rings 0-3 */
  846. A_INT32 r0_frags;
  847. A_INT32 r1_frags;
  848. A_INT32 r2_frags;
  849. A_INT32 r3_frags;
  850. /* MSDUs / MPDUs delivered to HTT */
  851. A_INT32 htt_msdus;
  852. A_INT32 htt_mpdus;
  853. /* MSDUs / MPDUs delivered to local stack */
  854. A_INT32 loc_msdus;
  855. A_INT32 loc_mpdus;
  856. /* AMSDUs that have more MSDUs than the status ring size */
  857. A_INT32 oversize_amsdu;
  858. /* Number of PHY errors */
  859. A_INT32 phy_errs;
  860. /* Number of PHY errors drops */
  861. A_INT32 phy_err_drop;
  862. /* Number of mpdu errors - FCS, MIC, ENC etc. */
  863. A_INT32 mpdu_errs;
  864. };
  865. struct wlan_dbg_rx_stats_v2 {
  866. /* Cnts any change in ring routing mid-ppdu */
  867. A_INT32 mid_ppdu_route_change;
  868. /* Total number of statuses processed */
  869. A_INT32 status_rcvd;
  870. /* Extra frags on rings 0-3 */
  871. A_INT32 r0_frags;
  872. A_INT32 r1_frags;
  873. A_INT32 r2_frags;
  874. A_INT32 r3_frags;
  875. /* MSDUs / MPDUs delivered to HTT */
  876. A_INT32 htt_msdus;
  877. A_INT32 htt_mpdus;
  878. /* MSDUs / MPDUs delivered to local stack */
  879. A_INT32 loc_msdus;
  880. A_INT32 loc_mpdus;
  881. /* AMSDUs that have more MSDUs than the status ring size */
  882. A_INT32 oversize_amsdu;
  883. /* Number of PHY errors */
  884. A_INT32 phy_errs;
  885. /* Number of PHY errors drops */
  886. A_INT32 phy_err_drop;
  887. /* Number of mpdu errors - FCS, MIC, ENC etc. */
  888. A_INT32 mpdu_errs;
  889. /* Number of rx overflow errors. */
  890. A_INT32 rx_ovfl_errs;
  891. };
  892. #if defined(AR900B)
  893. #define wlan_dbg_rx_stats wlan_dbg_rx_stats_v2
  894. #else
  895. #define wlan_dbg_rx_stats wlan_dbg_rx_stats_v1
  896. #endif
  897. struct wlan_dbg_mem_stats {
  898. A_UINT32 iram_free_size;
  899. A_UINT32 dram_free_size;
  900. };
  901. struct wlan_dbg_peer_stats {
  902. A_INT32 dummy; /* REMOVE THIS ONCE REAL PEER STAT COUNTERS ARE ADDED */
  903. };
  904. /*
  905. * wlan_dbg_rx_rate_info_v1a_t, _v1b_t:
  906. * differing versions of the wlan_dbg_rx_rate_info struct used by different
  907. * targets
  908. */
  909. typedef struct {
  910. A_UINT32 mcs[10];
  911. A_UINT32 sgi[10];
  912. A_UINT32 nss[4];
  913. A_UINT32 nsts;
  914. A_UINT32 stbc[10];
  915. A_UINT32 bw[3];
  916. A_UINT32 pream[6];
  917. A_UINT32 ldpc;
  918. A_UINT32 txbf;
  919. A_UINT32 mgmt_rssi;
  920. A_UINT32 data_rssi;
  921. A_UINT32 rssi_chain0;
  922. A_UINT32 rssi_chain1;
  923. A_UINT32 rssi_chain2;
  924. } wlan_dbg_rx_rate_info_v1a_t;
  925. typedef struct {
  926. A_UINT32 mcs[10];
  927. A_UINT32 sgi[10];
  928. A_UINT32 nss[4];
  929. A_UINT32 nsts;
  930. A_UINT32 stbc[10];
  931. A_UINT32 bw[3];
  932. A_UINT32 pream[6];
  933. A_UINT32 ldpc;
  934. A_UINT32 txbf;
  935. A_UINT32 mgmt_rssi;
  936. A_UINT32 data_rssi;
  937. A_UINT32 rssi_chain0;
  938. A_UINT32 rssi_chain1;
  939. A_UINT32 rssi_chain2;
  940. /*
  941. * TEMPORARY: leave rssi_chain3 in place for AR900B builds until code using
  942. * rssi_chain3 has been converted to use wlan_dbg_rx_rate_info_v2_t.
  943. */
  944. A_UINT32 rssi_chain3;
  945. } wlan_dbg_rx_rate_info_v1b_t;
  946. #if defined(AR900B)
  947. #define wlan_dbg_rx_rate_info_t wlan_dbg_rx_rate_info_v1b_t
  948. #else
  949. #define wlan_dbg_rx_rate_info_t wlan_dbg_rx_rate_info_v1a_t
  950. #endif
  951. typedef struct {
  952. A_UINT32 mcs[10];
  953. A_UINT32 sgi[10];
  954. /*
  955. * TEMPORARY: leave nss conditionally defined, until all code that
  956. * requires nss[4] is converted to use wlan_dbg_tx_rate_info_v2_t.
  957. * At that time, this nss array will be made length = 3 unconditionally.
  958. */
  959. #if defined(CONFIG_AR900B_SUPPORT) || defined(AR900B)
  960. A_UINT32 nss[4];
  961. #else
  962. A_UINT32 nss[3];
  963. #endif
  964. A_UINT32 stbc[10];
  965. A_UINT32 bw[3];
  966. A_UINT32 pream[4];
  967. A_UINT32 ldpc;
  968. A_UINT32 rts_cnt;
  969. A_UINT32 ack_rssi;
  970. } wlan_dbg_tx_rate_info_t ;
  971. #define WLAN_MAX_MCS 10
  972. typedef struct {
  973. A_UINT32 mcs[WLAN_MAX_MCS];
  974. A_UINT32 sgi[WLAN_MAX_MCS];
  975. A_UINT32 nss[MAX_SPATIAL_STREAM_ANY_V2];
  976. A_UINT32 nsts;
  977. A_UINT32 stbc[WLAN_MAX_MCS];
  978. A_UINT32 bw[NUM_DYN_BW_MAX];
  979. A_UINT32 pream[6];
  980. A_UINT32 ldpc;
  981. A_UINT32 txbf;
  982. A_UINT32 mgmt_rssi;
  983. A_UINT32 data_rssi;
  984. A_UINT32 rssi_chain0;
  985. A_UINT32 rssi_chain1;
  986. A_UINT32 rssi_chain2;
  987. A_UINT32 rssi_chain3;
  988. A_UINT32 reserved[8];
  989. } wlan_dbg_rx_rate_info_v2_t;
  990. typedef struct {
  991. A_UINT32 mcs[WLAN_MAX_MCS];
  992. A_UINT32 sgi[WLAN_MAX_MCS];
  993. A_UINT32 nss[MAX_SPATIAL_STREAM_ANY_V2];
  994. A_UINT32 stbc[WLAN_MAX_MCS];
  995. A_UINT32 bw[NUM_DYN_BW_MAX];
  996. A_UINT32 pream[4];
  997. A_UINT32 ldpc;
  998. A_UINT32 rts_cnt;
  999. A_UINT32 ack_rssi;
  1000. A_UINT32 reserved[8];
  1001. } wlan_dbg_tx_rate_info_v2_t;
  1002. typedef struct {
  1003. A_UINT32 mcs[WLAN_MAX_MCS];
  1004. A_UINT32 sgi[WLAN_MAX_MCS];
  1005. A_UINT32 nss[MAX_SPATIAL_STREAM_ANY_V3];
  1006. A_UINT32 nsts;
  1007. A_UINT32 stbc[WLAN_MAX_MCS];
  1008. A_UINT32 bw[NUM_DYN_BW_MAX];
  1009. A_UINT32 pream[6];
  1010. A_UINT32 ldpc;
  1011. A_UINT32 txbf;
  1012. A_UINT32 mgmt_rssi;
  1013. A_UINT32 data_rssi;
  1014. A_UINT32 rssi_chain0;
  1015. A_UINT32 rssi_chain1;
  1016. A_UINT32 rssi_chain2;
  1017. A_UINT32 rssi_chain3;
  1018. A_UINT32 reserved[8];
  1019. } wlan_dbg_rx_rate_info_v3_t;
  1020. typedef struct {
  1021. A_UINT32 mcs[WLAN_MAX_MCS];
  1022. A_UINT32 sgi[WLAN_MAX_MCS];
  1023. A_UINT32 nss[MAX_SPATIAL_STREAM_ANY_V3];
  1024. A_UINT32 stbc[WLAN_MAX_MCS];
  1025. A_UINT32 bw[NUM_DYN_BW_MAX];
  1026. A_UINT32 pream[4];
  1027. A_UINT32 ldpc;
  1028. A_UINT32 rts_cnt;
  1029. A_UINT32 ack_rssi;
  1030. A_UINT32 reserved[8];
  1031. } wlan_dbg_tx_rate_info_v3_t;
  1032. #define WHAL_DBG_PHY_ERR_MAXCNT 18
  1033. #define WHAL_DBG_SIFS_STATUS_MAXCNT 8
  1034. #define WHAL_DBG_SIFS_ERR_MAXCNT 8
  1035. #define WHAL_DBG_CMD_RESULT_MAXCNT 11
  1036. #define WHAL_DBG_CMD_STALL_ERR_MAXCNT 4
  1037. #define WHAL_DBG_FLUSH_REASON_MAXCNT 40
  1038. typedef enum {
  1039. WIFI_URRN_STATS_FIRST_PKT,
  1040. WIFI_URRN_STATS_BETWEEN_MPDU,
  1041. WIFI_URRN_STATS_WITHIN_MPDU,
  1042. WHAL_MAX_URRN_STATS
  1043. } wifi_urrn_type_t;
  1044. typedef struct wlan_dbg_txbf_snd_stats {
  1045. A_UINT32 cbf_20[4];
  1046. A_UINT32 cbf_40[4];
  1047. A_UINT32 cbf_80[4];
  1048. A_UINT32 sounding[9];
  1049. A_UINT32 cbf_160[4];
  1050. } wlan_dbg_txbf_snd_stats_t;
  1051. typedef struct wlan_dbg_wifi2_error_stats {
  1052. A_UINT32 urrn_stats[WHAL_MAX_URRN_STATS];
  1053. A_UINT32 flush_errs[WHAL_DBG_FLUSH_REASON_MAXCNT];
  1054. A_UINT32 schd_stall_errs[WHAL_DBG_CMD_STALL_ERR_MAXCNT];
  1055. A_UINT32 schd_cmd_result[WHAL_DBG_CMD_RESULT_MAXCNT];
  1056. A_UINT32 sifs_status[WHAL_DBG_SIFS_STATUS_MAXCNT];
  1057. A_UINT8 phy_errs[WHAL_DBG_PHY_ERR_MAXCNT];
  1058. A_UINT32 rx_rate_inval;
  1059. } wlan_dbg_wifi2_error_stats_t;
  1060. typedef struct wlan_dbg_wifi2_error2_stats {
  1061. A_UINT32 schd_errs[WHAL_DBG_CMD_STALL_ERR_MAXCNT];
  1062. A_UINT32 sifs_errs[WHAL_DBG_SIFS_ERR_MAXCNT];
  1063. } wlan_dbg_wifi2_error2_stats_t;
  1064. #define WLAN_DBG_STATS_SIZE_TXBF_VHT 10
  1065. #define WLAN_DBG_STATS_SIZE_TXBF_HT 8
  1066. #define WLAN_DBG_STATS_SIZE_TXBF_OFDM 8
  1067. #define WLAN_DBG_STATS_SIZE_TXBF_CCK 7
  1068. typedef struct wlan_dbg_txbf_data_stats {
  1069. A_UINT32 tx_txbf_vht[WLAN_DBG_STATS_SIZE_TXBF_VHT];
  1070. A_UINT32 rx_txbf_vht[WLAN_DBG_STATS_SIZE_TXBF_VHT];
  1071. A_UINT32 tx_txbf_ht[WLAN_DBG_STATS_SIZE_TXBF_HT];
  1072. A_UINT32 tx_txbf_ofdm[WLAN_DBG_STATS_SIZE_TXBF_OFDM];
  1073. A_UINT32 tx_txbf_cck[WLAN_DBG_STATS_SIZE_TXBF_CCK];
  1074. } wlan_dbg_txbf_data_stats_t;
  1075. struct wlan_dbg_tx_mu_stats {
  1076. A_UINT32 mu_sch_nusers_2;
  1077. A_UINT32 mu_sch_nusers_3;
  1078. A_UINT32 mu_mpdus_queued_usr[4];
  1079. A_UINT32 mu_mpdus_tried_usr[4];
  1080. A_UINT32 mu_mpdus_failed_usr[4];
  1081. A_UINT32 mu_mpdus_requeued_usr[4];
  1082. A_UINT32 mu_err_no_ba_usr[4];
  1083. A_UINT32 mu_mpdu_underrun_usr[4];
  1084. A_UINT32 mu_ampdu_underrun_usr[4];
  1085. };
  1086. struct wlan_dbg_tx_selfgen_stats {
  1087. A_UINT32 su_ndpa;
  1088. A_UINT32 su_ndp;
  1089. A_UINT32 mu_ndpa;
  1090. A_UINT32 mu_ndp;
  1091. A_UINT32 mu_brpoll_1;
  1092. A_UINT32 mu_brpoll_2;
  1093. A_UINT32 mu_bar_1;
  1094. A_UINT32 mu_bar_2;
  1095. A_UINT32 cts_burst;
  1096. A_UINT32 su_ndp_err;
  1097. A_UINT32 su_ndpa_err;
  1098. A_UINT32 mu_ndp_err;
  1099. A_UINT32 mu_brp1_err;
  1100. A_UINT32 mu_brp2_err;
  1101. };
  1102. typedef struct wlan_dbg_sifs_resp_stats {
  1103. A_UINT32 ps_poll_trigger; /* num ps-poll trigger frames */
  1104. A_UINT32 uapsd_trigger; /* num uapsd trigger frames */
  1105. A_UINT32 qb_data_trigger[2]; /* num data trigger frames; idx 0: explicit and idx 1: implicit */
  1106. A_UINT32 qb_bar_trigger[2]; /* num bar trigger frames; idx 0: explicit and idx 1: implicit */
  1107. A_UINT32 sifs_resp_data; /* num ppdus transmitted at SIFS interval */
  1108. A_UINT32 sifs_resp_err; /* num ppdus failed to meet SIFS resp timing */
  1109. } wlan_dgb_sifs_resp_stats_t;
  1110. /** wlan_dbg_wifi2_error_stats_t is not grouped with the
  1111. * following structure as it is allocated differently and only
  1112. * belongs to whal
  1113. */
  1114. typedef struct wlan_dbg_stats_wifi2 {
  1115. wlan_dbg_txbf_snd_stats_t txbf_snd_info;
  1116. wlan_dbg_txbf_data_stats_t txbf_data_info;
  1117. struct wlan_dbg_tx_selfgen_stats tx_selfgen;
  1118. struct wlan_dbg_tx_mu_stats tx_mu;
  1119. wlan_dgb_sifs_resp_stats_t sifs_resp_info;
  1120. } wlan_dbg_wifi2_stats_t;
  1121. /*
  1122. * wlan_dbg_rx_rate_info_v1a, _v1b:
  1123. * differing versions of the wlan_dbg_rx_rate_info struct used by different
  1124. * targets
  1125. */
  1126. typedef struct {
  1127. wlan_dbg_rx_rate_info_v1a_t rx_phy_info;
  1128. wlan_dbg_tx_rate_info_t tx_rate_info;
  1129. } wlan_dbg_rate_info_v1a_t;
  1130. typedef struct {
  1131. wlan_dbg_rx_rate_info_v1b_t rx_phy_info;
  1132. wlan_dbg_tx_rate_info_t tx_rate_info;
  1133. } wlan_dbg_rate_info_v1b_t;
  1134. #if defined(AR900B)
  1135. #define wlan_dbg_rate_info_t wlan_dbg_rate_info_v1b_t
  1136. #else
  1137. #define wlan_dbg_rate_info_t wlan_dbg_rate_info_v1a_t
  1138. #endif
  1139. typedef struct {
  1140. wlan_dbg_rx_rate_info_v2_t rx_phy_info;
  1141. wlan_dbg_tx_rate_info_v2_t tx_rate_info;
  1142. } wlan_dbg_rate_info_v2_t;
  1143. /*
  1144. * wlan_dbg_stats_v1, _v2:
  1145. * differing versions of the wlan_dbg_stats struct used by different
  1146. * targets
  1147. */
  1148. struct wlan_dbg_stats_v1 {
  1149. struct wlan_dbg_tx_stats_v1 tx;
  1150. struct wlan_dbg_rx_stats_v1 rx;
  1151. struct wlan_dbg_peer_stats peer;
  1152. };
  1153. struct wlan_dbg_stats_v2 {
  1154. struct wlan_dbg_tx_stats_v2 tx;
  1155. struct wlan_dbg_rx_stats_v2 rx;
  1156. struct wlan_dbg_mem_stats mem;
  1157. struct wlan_dbg_peer_stats peer;
  1158. };
  1159. #if defined(AR900B)
  1160. #define wlan_dbg_stats wlan_dbg_stats_v2
  1161. #else
  1162. #define wlan_dbg_stats wlan_dbg_stats_v1
  1163. #endif
  1164. #define DBG_STATS_MAX_HWQ_NUM 10
  1165. #define DBG_STATS_MAX_TID_NUM 20
  1166. #define DBG_STATS_MAX_CONG_NUM 16
  1167. struct wlan_dbg_txq_stats {
  1168. A_UINT16 num_pkts_queued[DBG_STATS_MAX_HWQ_NUM];
  1169. A_UINT16 tid_hw_qdepth[DBG_STATS_MAX_TID_NUM]; /* WAL_MAX_TID is 20 */
  1170. A_UINT16 tid_sw_qdepth[DBG_STATS_MAX_TID_NUM]; /* WAL_MAX_TID is 20 */
  1171. };
  1172. struct wlan_dbg_tidq_stats {
  1173. A_UINT32 wlan_dbg_tid_txq_status;
  1174. struct wlan_dbg_txq_stats txq_st;
  1175. };
  1176. typedef enum {
  1177. WLAN_DBG_DATA_STALL_NONE = 0,
  1178. WLAN_DBG_DATA_STALL_VDEV_PAUSE = 1,
  1179. WLAN_DBG_DATA_STALL_HWSCHED_CMD_FILTER = 2,
  1180. WLAN_DBG_DATA_STALL_HWSCHED_CMD_FLUSH = 3,
  1181. WLAN_DBG_DATA_STALL_RX_REFILL_FAILED = 4,
  1182. WLAN_DBG_DATA_STALL_RX_FCS_LEN_ERROR = 5,
  1183. WLAN_DBG_DATA_STALL_MAC_WDOG_ERRORS = 6, /* Mac watch dog */
  1184. WLAN_DBG_DATA_STALL_PHY_BB_WDOG_ERROR = 7, /* PHY watch dog */
  1185. WLAN_DBG_DATA_STALL_POST_TIM_NO_TXRX_ERROR = 8,
  1186. WLAN_DBG_DATA_STALL_CONSECUTIVE_NON_FLUSH = 9,
  1187. WLAN_DBG_DATA_STALL_CONSECUTIVE_NOACK = 10,
  1188. WLAN_DBG_DATA_STALL_CONSECUTIVE_LT_EXPIRY = 11,
  1189. WLAN_DBG_DATA_STALL_MAX,
  1190. } wlan_dbg_data_stall_type_e;
  1191. typedef enum {
  1192. WLAN_DBG_DATA_STALL_RECOVERY_NONE = 0,
  1193. WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_DISCONNECT,
  1194. WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_MAC_PHY_RESET,
  1195. WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_PDR,
  1196. WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_SSR,
  1197. } wlan_dbg_data_stall_recovery_type_e;
  1198. /*
  1199. * NOTE: If necessary, restore the explicit disabling of CONFIG_160MHZ_SUPPORT
  1200. * See the corresponding comment + pre-processor block at the top of the file.
  1201. */
  1202. #ifdef CONFIG_160MHZ_SUPPORT_UNDEF_WAR
  1203. #define CONFIG_160MHZ_SUPPORT 0
  1204. #undef CONFIG_160MHZ_SUPPORT_UNDEF_WAR
  1205. #endif
  1206. /** MGMT RX REO Changes */
  1207. /* Macros for having versioning info for compatibility check between host and firmware */
  1208. #define MLO_SHMEM_MAJOR_VERSION 2
  1209. #define MLO_SHMEM_MINOR_VERSION 1
  1210. /** Helper Macros for tlv header of the given tlv buffer */
  1211. /* Size of the TLV Header which is the Tag and Length fields */
  1212. #define MLO_SHMEM_TLV_HDR_SIZE (1 * sizeof(A_UINT32))
  1213. /* TLV Helper macro to get the TLV Header given the pointer to the TLV buffer. */
  1214. #define MLO_SHMEMTLV_GET_HDR(tlv_buf) (((A_UINT32 *) (tlv_buf))[0])
  1215. /* TLV Helper macro to set the TLV Header given the pointer to the TLV buffer. */
  1216. #define MLO_SHMEMTLV_SET_HDR(tlv_buf, tag, len) \
  1217. (((A_UINT32 *)(tlv_buf))[0]) = ((tag << 16) | (len & 0x0000FFFF))
  1218. /* TLV Helper macro to get the TLV Tag given the TLV header. */
  1219. #define MLO_SHMEMTLV_GET_TLVTAG(tlv_header) ((A_UINT32)((tlv_header) >> 16))
  1220. /*
  1221. * TLV Helper macro to get the TLV Buffer Length (minus TLV header size)
  1222. * given the TLV header.
  1223. */
  1224. #define MLO_SHMEMTLV_GET_TLVLEN(tlv_header) \
  1225. ((A_UINT32)((tlv_header) & 0x0000FFFF))
  1226. /*
  1227. * TLV Helper macro to get the TLV length from TLV structure size
  1228. * by removing TLV header size.
  1229. */
  1230. #define MLO_SHMEMTLV_GET_STRUCT_TLVLEN(tlv_struct) \
  1231. ((A_UINT32)(sizeof(tlv_struct)-MLO_SHMEM_TLV_HDR_SIZE))
  1232. /**
  1233. * Helper Macros for getting and setting the required number of bits
  1234. * from the TLV params.
  1235. */
  1236. #define MLO_SHMEM_GET_BITS(_val,_index,_num_bits) \
  1237. (((_val) >> (_index)) & ((1 << (_num_bits)) - 1))
  1238. #define MLO_SHMEM_SET_BITS(_var,_index,_num_bits,_val) \
  1239. do { \
  1240. (_var) &= ~(((1 << (_num_bits)) - 1) << (_index)); \
  1241. (_var) |= (((_val) & ((1 << (_num_bits)) - 1)) << (_index)); \
  1242. } while (0)
  1243. /**
  1244. * Enum which defines different versions of management Rx reorder snapshots.
  1245. */
  1246. typedef enum {
  1247. /**
  1248. * DWORD Lower:
  1249. * [15:0] : Management packet counter
  1250. * [30:16] : Redundant global time stamp = Global time stamp[14:0]
  1251. * [31] : Valid
  1252. *
  1253. * DWORD Upper:
  1254. * [31:0] : Global time stamp
  1255. *
  1256. */
  1257. MGMT_RX_REO_SNAPSHOT_VERSION_TIMESTAMP_REDUNDANCY = 0,
  1258. /**
  1259. * DWORD Lower:
  1260. * [14:0] : Global time stamp[14:0]
  1261. * [30:15] : Management packet counter
  1262. * [31] : Valid
  1263. *
  1264. * DWORD Upper:
  1265. * [14:0] : Redundant management packet counter = Management packet
  1266. * counter[14:0]
  1267. * [31:15] : Global time stamp[31:15]
  1268. */
  1269. MGMT_RX_REO_SNAPSHOT_VERSION_PKT_CTR_REDUNDANCY = 1,
  1270. } MGMT_RX_REO_SNAPSHOT_VERSION;
  1271. /** Definition of the GLB_H_SHMEM arena tlv structures */
  1272. typedef enum {
  1273. MLO_SHMEM_TLV_STRUCT_MGMT_RX_REO_SNAPSHOT,
  1274. MLO_SHMEM_TLV_STRUCT_MLO_GLB_RX_REO_PER_LINK_SNAPSHOT_INFO,
  1275. MLO_SHMEM_TLV_STRUCT_MLO_GLB_RX_REO_SNAPSHOT_INFO,
  1276. MLO_SHMEM_TLV_STRUCT_MLO_GLB_LINK,
  1277. MLO_SHMEM_TLV_STRUCT_MLO_GLB_LINK_INFO,
  1278. MLO_SHMEM_TLV_STRUCT_MLO_GLB_H_SHMEM,
  1279. MLO_SHMEM_TLV_STRUCT_MLO_GLB_CHIP_CRASH_INFO,
  1280. MLO_SHMEM_TLV_STRUCT_MLO_GLB_PER_CHIP_CRASH_INFO,
  1281. } MLO_SHMEM_TLV_TAG_ID;
  1282. /** Helper macro for params GET/SET of mgmt_rx_reo_snapshot */
  1283. #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)
  1284. #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)
  1285. #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)
  1286. #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)
  1287. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_GLOBAL_TIMESTAMP_GET(mgmt_rx_reo_snapshot) \
  1288. (MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot->mgmt_rx_reo_snapshot_high, 0, 17) << 15) | \
  1289. MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot->mgmt_rx_reo_snapshot_low, 17, 15)
  1290. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_GLOBAL_TIMESTAMP_SET(mgmt_rx_reo_snapshot, value) \
  1291. do { \
  1292. MLO_SHMEM_SET_BITS(mgmt_rx_reo_snapshot->mgmt_rx_reo_snapshot_high, 0, 17, ((value) >> 15)); \
  1293. MLO_SHMEM_SET_BITS(mgmt_rx_reo_snapshot->mgmt_rx_reo_snapshot_low, 17, 15, ((value) & 0x7fff)); \
  1294. } while (0)
  1295. #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)
  1296. #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)
  1297. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_IS_CONSISTENT(mgmt_pkt_ctr, mgmt_pkt_ctr_redundant) \
  1298. (MLO_SHMEM_GET_BITS(mgmt_pkt_ctr, 0, 15) == MLO_SHMEM_GET_BITS(mgmt_pkt_ctr_redundant, 0, 15))
  1299. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_GLOBAL_TIMESTAMP_GET_FROM_DWORDS(mgmt_rx_reo_snapshot_low,mgmt_rx_reo_snapshot_high) \
  1300. (MLO_SHMEM_GET_BITS((mgmt_rx_reo_snapshot_high), 0, 17) << 15) | \
  1301. MLO_SHMEM_GET_BITS((mgmt_rx_reo_snapshot_low), 17, 15)
  1302. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_GET_ADRESS(mgmt_rx_reo_snapshot) \
  1303. (&mgmt_rx_reo_snapshot->mgmt_rx_reo_snapshot_low)
  1304. /**
  1305. * Helper macros/functions for params GET/SET of different hw version
  1306. * of the mgmt_rx_reo_snapshot
  1307. */
  1308. static INLINE A_UINT8
  1309. MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_VALID_GET(
  1310. A_UINT32 mgmt_rx_reo_snapshot_low, A_UINT8 snapshot_ver)
  1311. {
  1312. if ((snapshot_ver != MGMT_RX_REO_SNAPSHOT_VERSION_TIMESTAMP_REDUNDANCY) &&
  1313. (snapshot_ver != MGMT_RX_REO_SNAPSHOT_VERSION_PKT_CTR_REDUNDANCY))
  1314. {
  1315. A_ASSERT(0);
  1316. }
  1317. return MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_low, 31, 1);
  1318. }
  1319. static INLINE void
  1320. MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_VALID_SET(
  1321. A_UINT32 *mgmt_rx_reo_snapshot_low, A_UINT8 value, A_UINT8 snapshot_ver)
  1322. {
  1323. if ((snapshot_ver != MGMT_RX_REO_SNAPSHOT_VERSION_TIMESTAMP_REDUNDANCY) &&
  1324. (snapshot_ver != MGMT_RX_REO_SNAPSHOT_VERSION_PKT_CTR_REDUNDANCY)) {
  1325. A_ASSERT(0);
  1326. }
  1327. MLO_SHMEM_SET_BITS(*mgmt_rx_reo_snapshot_low, 31, 1, value);
  1328. }
  1329. static INLINE A_UINT16
  1330. MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_MGMT_PKT_CTR_GET(
  1331. A_UINT32 mgmt_rx_reo_snapshot_low, A_UINT8 snapshot_ver)
  1332. {
  1333. if (snapshot_ver == MGMT_RX_REO_SNAPSHOT_VERSION_TIMESTAMP_REDUNDANCY) {
  1334. return MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_low, 0, 16);
  1335. } else if (snapshot_ver == MGMT_RX_REO_SNAPSHOT_VERSION_PKT_CTR_REDUNDANCY){
  1336. return MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_low, 15, 16);
  1337. } else {
  1338. A_ASSERT(0);
  1339. return 0;
  1340. }
  1341. }
  1342. static INLINE void
  1343. MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_MGMT_PKT_CTR_SET(
  1344. A_UINT32 *mgmt_rx_reo_snapshot_low, A_UINT16 value, A_UINT8 snapshot_ver)
  1345. {
  1346. if (snapshot_ver == MGMT_RX_REO_SNAPSHOT_VERSION_TIMESTAMP_REDUNDANCY) {
  1347. MLO_SHMEM_SET_BITS(*mgmt_rx_reo_snapshot_low, 0, 16, value);
  1348. } else if (snapshot_ver == MGMT_RX_REO_SNAPSHOT_VERSION_PKT_CTR_REDUNDANCY){
  1349. MLO_SHMEM_SET_BITS(*mgmt_rx_reo_snapshot_low, 15, 16, value);
  1350. } else {
  1351. A_ASSERT(0);
  1352. }
  1353. }
  1354. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_MGMT_PKT_CTR_REDUNDANT_GET( \
  1355. mgmt_rx_reo_snapshot_high) \
  1356. MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_high, 0, 15)
  1357. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_MGMT_PKT_CTR_REDUNDANT_SET( \
  1358. mgmt_rx_reo_snapshot_high, value) \
  1359. MLO_SHMEM_SET_BITS(mgmt_rx_reo_snapshot_high, 0, 15, value)
  1360. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_GLOBAL_TIMESTAMP_REDUNDANT_GET( \
  1361. mgmt_rx_reo_snapshot_low) \
  1362. MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_low, 16, 15)
  1363. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_GLOBAL_TIMESTAMP_REDUNDANT_SET( \
  1364. mgmt_rx_reo_snapshot_low, value) \
  1365. MLO_SHMEM_SET_BITS(mgmt_rx_reo_snapshot_low, 16, 15, value)
  1366. static INLINE A_UINT32
  1367. MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_GLOBAL_TIMESTAMP_GET(
  1368. A_UINT32 mgmt_rx_reo_snapshot_low,
  1369. A_UINT32 mgmt_rx_reo_snapshot_high,
  1370. A_UINT8 snapshot_ver)
  1371. {
  1372. if (snapshot_ver == MGMT_RX_REO_SNAPSHOT_VERSION_TIMESTAMP_REDUNDANCY) {
  1373. return mgmt_rx_reo_snapshot_high;
  1374. } else if (snapshot_ver == MGMT_RX_REO_SNAPSHOT_VERSION_PKT_CTR_REDUNDANCY){
  1375. return
  1376. ((MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_high, 15, 17) << 15) |
  1377. MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_low, 0, 15));
  1378. } else {
  1379. A_ASSERT(0);
  1380. return 0;
  1381. }
  1382. }
  1383. static INLINE void
  1384. MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_GLOBAL_TIMESTAMP_SET(
  1385. A_UINT32 *mgmt_rx_reo_snapshot_low,
  1386. A_UINT32 *mgmt_rx_reo_snapshot_high,
  1387. A_UINT32 value,
  1388. A_UINT8 snapshot_ver)
  1389. {
  1390. if (snapshot_ver == MGMT_RX_REO_SNAPSHOT_VERSION_TIMESTAMP_REDUNDANCY) {
  1391. *mgmt_rx_reo_snapshot_high = value;
  1392. } else if (snapshot_ver == MGMT_RX_REO_SNAPSHOT_VERSION_PKT_CTR_REDUNDANCY){
  1393. MLO_SHMEM_SET_BITS(
  1394. *mgmt_rx_reo_snapshot_high, 15, 17, ((value) >> 15));
  1395. MLO_SHMEM_SET_BITS(
  1396. *mgmt_rx_reo_snapshot_low, 0, 15, ((value) & 0x7fff));
  1397. } else {
  1398. A_ASSERT(0);
  1399. }
  1400. }
  1401. static INLINE A_BOOL
  1402. MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_CHECK_CONSISTENCY(
  1403. A_UINT32 mgmt_rx_reo_snapshot_low,
  1404. A_UINT32 mgmt_rx_reo_snapshot_high,
  1405. A_UINT8 snapshot_ver)
  1406. {
  1407. if (snapshot_ver == MGMT_RX_REO_SNAPSHOT_VERSION_TIMESTAMP_REDUNDANCY) {
  1408. A_UINT32 global_timestamp;
  1409. A_UINT32 global_timestamp_redundant;
  1410. global_timestamp = MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_GLOBAL_TIMESTAMP_GET(
  1411. mgmt_rx_reo_snapshot_low, mgmt_rx_reo_snapshot_high, snapshot_ver);
  1412. global_timestamp_redundant =
  1413. MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_GLOBAL_TIMESTAMP_REDUNDANT_GET(
  1414. mgmt_rx_reo_snapshot_low);
  1415. return
  1416. (MLO_SHMEM_GET_BITS(global_timestamp, 0, 15) ==
  1417. MLO_SHMEM_GET_BITS(global_timestamp_redundant, 0, 15));
  1418. } else if (snapshot_ver == MGMT_RX_REO_SNAPSHOT_VERSION_PKT_CTR_REDUNDANCY){
  1419. A_UINT16 mgmt_pkt_ctr;
  1420. A_UINT16 mgmt_pkt_ctr_redundant;
  1421. mgmt_pkt_ctr = MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_MGMT_PKT_CTR_GET(
  1422. mgmt_rx_reo_snapshot_low, snapshot_ver);
  1423. mgmt_pkt_ctr_redundant =
  1424. MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_MGMT_PKT_CTR_REDUNDANT_GET(
  1425. mgmt_rx_reo_snapshot_high);
  1426. return
  1427. (MLO_SHMEM_GET_BITS(mgmt_pkt_ctr, 0, 15) ==
  1428. MLO_SHMEM_GET_BITS(mgmt_pkt_ctr_redundant, 0, 15));
  1429. } else {
  1430. A_ASSERT(0);
  1431. return 0;
  1432. }
  1433. }
  1434. /* REO snapshot structure */
  1435. typedef struct {
  1436. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MGMT_RX_REO_SNAPSHOT */
  1437. A_UINT32 tlv_header;
  1438. A_UINT32 reserved_alignment_padding;
  1439. /**
  1440. * mgmt_rx_reo_snapshot_low
  1441. *
  1442. * [0]: valid
  1443. * [16:1]: mgmt_pkt_ctr
  1444. * [31:17]: global_timestamp_low
  1445. */
  1446. A_UINT32 mgmt_rx_reo_snapshot_low;
  1447. /**
  1448. * mgmt_rx_reo_snapshot_high
  1449. *
  1450. * [16:0]: global_timestamp_high
  1451. * [31:17]: mgmt_pkt_ctr_redundant
  1452. */
  1453. A_UINT32 mgmt_rx_reo_snapshot_high;
  1454. } mgmt_rx_reo_snapshot;
  1455. A_COMPILE_TIME_ASSERT(check_mgmt_rx_reo_snapshot_8byte_size_quantum,
  1456. (((sizeof(mgmt_rx_reo_snapshot) % sizeof(A_UINT64) == 0x0))));
  1457. A_COMPILE_TIME_ASSERT(verify_mgmt_rx_reo_snapshot_low_offset,
  1458. (A_OFFSETOF(mgmt_rx_reo_snapshot, mgmt_rx_reo_snapshot_low) % sizeof(A_UINT64) == 0));
  1459. typedef struct {
  1460. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_RX_REO_PER_LINK_SNAPSHOT_INFO */
  1461. A_UINT32 tlv_header;
  1462. A_UINT32 reserved_alignment_padding;
  1463. mgmt_rx_reo_snapshot fw_consumed;
  1464. mgmt_rx_reo_snapshot fw_forwarded;
  1465. mgmt_rx_reo_snapshot hw_forwarded;
  1466. } mlo_glb_rx_reo_per_link_snapshot_info;
  1467. A_COMPILE_TIME_ASSERT(check_mlo_glb_rx_reo_per_link_snapshot_info_8byte_size_quantum,
  1468. (((sizeof(mlo_glb_rx_reo_per_link_snapshot_info) % sizeof(A_UINT64) == 0x0))));
  1469. A_COMPILE_TIME_ASSERT(verify_mlo_glb_rx_reo_per_link_snapshot_fw_consumed_offset,
  1470. (A_OFFSETOF(mlo_glb_rx_reo_per_link_snapshot_info, fw_consumed) % sizeof(A_UINT64) == 0));
  1471. /** Helper macro for params GET/SET of mlo_glb_rx_reo_snapshot_info */
  1472. #define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_NO_OF_LINKS_GET(link_info) MLO_SHMEM_GET_BITS(link_info, 0, 4)
  1473. #define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_NO_OF_LINKS_SET(link_info, value) MLO_SHMEM_SET_BITS(link_info, 0, 4, value)
  1474. #define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_VALID_LINK_BMAP_GET(link_info) MLO_SHMEM_GET_BITS(link_info, 4, 16)
  1475. #define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_VALID_LINK_BMAP_SET(link_info, value) MLO_SHMEM_SET_BITS(link_info, 4, 16, value)
  1476. #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)
  1477. #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)
  1478. #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)
  1479. #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)
  1480. #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)
  1481. #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)
  1482. /* Definition of the complete REO snapshot info */
  1483. typedef struct {
  1484. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_RX_REO_SNAPSHOT_INFO */
  1485. A_UINT32 tlv_header;
  1486. /**
  1487. * link_info
  1488. *
  1489. * [3:0]: no_of_links
  1490. * [19:4]: valid_link_bmap
  1491. * [31:20]: reserved
  1492. */
  1493. A_UINT32 link_info;
  1494. /**
  1495. * snapshot_ver_info
  1496. *
  1497. * [2:0]: hw_forwarded snapshot version
  1498. * [5:3]: fw_forwarded snapshot version
  1499. * [8:6]: fw_consumed snapshot version
  1500. * [31:9]: reserved
  1501. */
  1502. A_UINT32 snapshot_ver_info;
  1503. A_UINT32 reserved_alignment_padding;
  1504. /* This TLV is followed by array of mlo_glb_rx_reo_per_link_snapshot_info:
  1505. * mlo_glb_rx_reo_per_link_snapshot_info will have multiple instances
  1506. * equal to num of hw links received by no_of_link
  1507. * mlo_glb_rx_reo_per_link_snapshot_info per_link_info[];
  1508. */
  1509. } mlo_glb_rx_reo_snapshot_info;
  1510. A_COMPILE_TIME_ASSERT(check_mlo_glb_rx_reo_snapshot_info_8byte_size_quantum,
  1511. (((sizeof(mlo_glb_rx_reo_snapshot_info) % sizeof(A_UINT64) == 0x0))));
  1512. /** Helper macro for params GET/SET of mlo_glb_link */
  1513. #define MLO_SHMEM_GLB_LINK_PARAM_LINK_STATUS_GET(link_status) MLO_SHMEM_GET_BITS(link_status, 0, 8)
  1514. #define MLO_SHMEM_GLB_LINK_PARAM_LINK_STATUS_SET(link_status, value) MLO_SHMEM_SET_BITS(link_status, 0, 8, value)
  1515. /*glb link info structures used for scratchpad memory (crash and recovery) */
  1516. typedef struct {
  1517. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_LINK */
  1518. A_UINT32 tlv_header;
  1519. /**
  1520. * link_status
  1521. *
  1522. * [7:0]: link_status
  1523. * [31:8]: reserved
  1524. */
  1525. A_UINT32 link_status;
  1526. /*
  1527. * Based on MLO timestamp, which is global across chips -
  1528. * this will be first updated when MLO sync is completed.
  1529. */
  1530. A_UINT32 boot_timestamp_low_us;
  1531. A_UINT32 boot_timestamp_high_us;
  1532. /*
  1533. * Based on MLO timestamp, will be updated with a configurable
  1534. * periodicity (default 1 sec)
  1535. */
  1536. A_UINT32 health_check_timestamp_low_us;
  1537. A_UINT32 health_check_timestamp_high_us;
  1538. } mlo_glb_link;
  1539. A_COMPILE_TIME_ASSERT(check_mlo_glb_link_8byte_size_quantum,
  1540. (((sizeof(mlo_glb_link) % sizeof(A_UINT64) == 0x0))));
  1541. A_COMPILE_TIME_ASSERT(verify_mlo_glb_link_boot_timestamp_low_offset,
  1542. (A_OFFSETOF(mlo_glb_link, boot_timestamp_low_us) % sizeof(A_UINT64) == 0));
  1543. A_COMPILE_TIME_ASSERT(verify_mlo_glb_link_health_check_timestamp_low_offset,
  1544. (A_OFFSETOF(mlo_glb_link, health_check_timestamp_low_us) % sizeof(A_UINT64) == 0));
  1545. /** Helper macro for params GET/SET of mlo_glb_link_info */
  1546. #define MLO_SHMEM_GLB_LINK_INFO_PARAM_NO_OF_LINKS_GET(link_info) MLO_SHMEM_GET_BITS(link_info, 0, 4)
  1547. #define MLO_SHMEM_GLB_LINK_INFO_PARAM_NO_OF_LINKS_SET(link_info, value) MLO_SHMEM_SET_BITS(link_info, 0, 4, value)
  1548. #define MLO_SHMEM_GLB_LINK_INFO_PARAM_VALID_LINK_BMAP_GET(link_info) MLO_SHMEM_GET_BITS(link_info, 4, 16)
  1549. #define MLO_SHMEM_GLB_LINK_INFO_PARAM_VALID_LINK_BMAP_SET(link_info, value) MLO_SHMEM_SET_BITS(link_info, 4, 16, value)
  1550. typedef struct {
  1551. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_LINK_INFO */
  1552. A_UINT32 tlv_header;
  1553. /**
  1554. * link_info
  1555. *
  1556. * [3:0]: no_of_links
  1557. * [19:4]: valid_link_bmap
  1558. * [31:20]: reserved
  1559. */
  1560. A_UINT32 link_info;
  1561. /* This TLV is followed by array of mlo_glb_link:
  1562. * mlo_glb_link will have mutiple instances equal to num of hw links
  1563. * received by no_of_link
  1564. * mlo_glb_link glb_link_info[];
  1565. */
  1566. } mlo_glb_link_info;
  1567. A_COMPILE_TIME_ASSERT(check_mlo_glb_link_info_8byte_size_quantum,
  1568. (((sizeof(mlo_glb_link_info) % sizeof(A_UINT64) == 0x0))));
  1569. typedef enum {
  1570. MLO_SHMEM_CRASH_PARTNER_CHIPS = 1,
  1571. } MLO_SHMEM_CHIP_CRASH_REASON;
  1572. /* glb link info structures used for scratchpad memory (crash and recovery) */
  1573. typedef struct {
  1574. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_PER_CHIP_CRASH_INFO */
  1575. A_UINT32 tlv_header;
  1576. /**
  1577. * crash reason, takes value in enum MLO_SHMEM_CHIP_CRASH_REASON
  1578. */
  1579. A_UINT32 crash_reason;
  1580. } mlo_glb_per_chip_crash_info;
  1581. A_COMPILE_TIME_ASSERT(check_mlo_glb_per_chip_crash_info,
  1582. (((sizeof(mlo_glb_per_chip_crash_info) % sizeof(A_UINT64) == 0x0))));
  1583. /** Helper macro for params GET/SET of mlo_glb_chip_crash_info */
  1584. #define MLO_SHMEM_CHIP_CRASH_INFO_PARAM_NO_OF_CHIPS_GET(chip_info) MLO_SHMEM_GET_BITS(chip_info, 0, 2)
  1585. #define MLO_SHMEM_CHIP_CRASH_INFO_PARAM_NO_OF_CHIPS_SET(chip_info, value) MLO_SHMEM_SET_BITS(chip_info, 0, 2, value)
  1586. #define MLO_SHMEM_CHIP_CRASH_INFO_PARAM_VALID_CHIP_BMAP_GET(chip_info) MLO_SHMEM_GET_BITS(chip_info, 2, 3)
  1587. #define MLO_SHMEM_CHIP_CRASH_INFO_PARAM_VALID_CHIP_BMAP_SET(chip_info, value) MLO_SHMEM_SET_BITS(chip_info, 2, 3, value)
  1588. typedef struct {
  1589. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_CHIP_CRASH_INFO */
  1590. A_UINT32 tlv_header;
  1591. /**
  1592. * chip_info
  1593. *
  1594. * [1:0]: no_of_chips
  1595. * [4:2]: valid_chip_bmap
  1596. * [31:6]: reserved
  1597. */
  1598. A_UINT32 chip_info;
  1599. /* This TLV is followed by array of mlo_glb_per_chip_crash_info:
  1600. * mlo_glb_per_chip_crash_info will have mutiple instances equal to num of partner chips
  1601. * received by no_of_chips
  1602. * mlo_glb_per_chip_crash_info per_chip_crash_info[];
  1603. */
  1604. } mlo_glb_chip_crash_info;
  1605. A_COMPILE_TIME_ASSERT(check_mlo_glb_chip_crash_info,
  1606. (((sizeof(mlo_glb_chip_crash_info) % sizeof(A_UINT64) == 0x0))));
  1607. /** Helper macro for params GET/SET of mlo_glb_h_shmem */
  1608. #define MLO_SHMEM_GLB_H_SHMEM_PARAM_MINOR_VERSION_GET(major_minor_version) MLO_SHMEM_GET_BITS(major_minor_version, 0, 16)
  1609. #define MLO_SHMEM_GLB_H_SHMEM_PARAM_MINOR_VERSION_SET(major_minor_version, value) MLO_SHMEM_SET_BITS(major_minor_version, 0, 16, value)
  1610. #define MLO_SHMEM_GLB_H_SHMEM_PARAM_MAJOR_VERSION_GET(major_minor_version) MLO_SHMEM_GET_BITS(major_minor_version, 16, 16)
  1611. #define MLO_SHMEM_GLB_H_SHMEM_PARAM_MAJOR_VERSION_SET(major_minor_version, value) MLO_SHMEM_SET_BITS(major_minor_version, 16, 16, value)
  1612. /* Definition of Global H SHMEM Arena */
  1613. typedef struct {
  1614. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_H_SHMEM */
  1615. A_UINT32 tlv_header;
  1616. /**
  1617. * major_minor_version
  1618. *
  1619. * [15:0]: minor version
  1620. * [31:16]: major version
  1621. */
  1622. A_UINT32 major_minor_version;
  1623. /* This TLV is followed by TLVs
  1624. * mlo_glb_rx_reo_snapshot_info reo_snapshot;
  1625. * mlo_glb_link_info glb_info;
  1626. * mlo_glb_chip_crash_info crash_info;
  1627. */
  1628. } mlo_glb_h_shmem;
  1629. A_COMPILE_TIME_ASSERT(check_mlo_glb_h_shmem_8byte_size_quantum,
  1630. (((sizeof(mlo_glb_h_shmem) % sizeof(A_UINT64) == 0x0))));
  1631. #endif /* __WLANDEFS_H__ */