t4fw_api.h 63 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199
  1. /*
  2. * This file is part of the Chelsio T4 Ethernet driver for Linux.
  3. *
  4. * Copyright (c) 2009-2010 Chelsio Communications, Inc. All rights reserved.
  5. *
  6. * This software is available to you under a choice of one of two
  7. * licenses. You may choose to be licensed under the terms of the GNU
  8. * General Public License (GPL) Version 2, available from the file
  9. * COPYING in the main directory of this source tree, or the
  10. * OpenIB.org BSD license below:
  11. *
  12. * Redistribution and use in source and binary forms, with or
  13. * without modification, are permitted provided that the following
  14. * conditions are met:
  15. *
  16. * - Redistributions of source code must retain the above
  17. * copyright notice, this list of conditions and the following
  18. * disclaimer.
  19. *
  20. * - Redistributions in binary form must reproduce the above
  21. * copyright notice, this list of conditions and the following
  22. * disclaimer in the documentation and/or other materials
  23. * provided with the distribution.
  24. *
  25. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  26. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  28. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  29. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  30. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  31. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  32. * SOFTWARE.
  33. */
  34. #ifndef _T4FW_INTERFACE_H_
  35. #define _T4FW_INTERFACE_H_
  36. enum fw_retval {
  37. FW_SUCCESS = 0, /* completed sucessfully */
  38. FW_EPERM = 1, /* operation not permitted */
  39. FW_ENOENT = 2, /* no such file or directory */
  40. FW_EIO = 5, /* input/output error; hw bad */
  41. FW_ENOEXEC = 8, /* exec format error; inv microcode */
  42. FW_EAGAIN = 11, /* try again */
  43. FW_ENOMEM = 12, /* out of memory */
  44. FW_EFAULT = 14, /* bad address; fw bad */
  45. FW_EBUSY = 16, /* resource busy */
  46. FW_EEXIST = 17, /* file exists */
  47. FW_EINVAL = 22, /* invalid argument */
  48. FW_ENOSPC = 28, /* no space left on device */
  49. FW_ENOSYS = 38, /* functionality not implemented */
  50. FW_EPROTO = 71, /* protocol error */
  51. FW_EADDRINUSE = 98, /* address already in use */
  52. FW_EADDRNOTAVAIL = 99, /* cannot assigned requested address */
  53. FW_ENETDOWN = 100, /* network is down */
  54. FW_ENETUNREACH = 101, /* network is unreachable */
  55. FW_ENOBUFS = 105, /* no buffer space available */
  56. FW_ETIMEDOUT = 110, /* timeout */
  57. FW_EINPROGRESS = 115, /* fw internal */
  58. FW_SCSI_ABORT_REQUESTED = 128, /* */
  59. FW_SCSI_ABORT_TIMEDOUT = 129, /* */
  60. FW_SCSI_ABORTED = 130, /* */
  61. FW_SCSI_CLOSE_REQUESTED = 131, /* */
  62. FW_ERR_LINK_DOWN = 132, /* */
  63. FW_RDEV_NOT_READY = 133, /* */
  64. FW_ERR_RDEV_LOST = 134, /* */
  65. FW_ERR_RDEV_LOGO = 135, /* */
  66. FW_FCOE_NO_XCHG = 136, /* */
  67. FW_SCSI_RSP_ERR = 137, /* */
  68. FW_ERR_RDEV_IMPL_LOGO = 138, /* */
  69. FW_SCSI_UNDER_FLOW_ERR = 139, /* */
  70. FW_SCSI_OVER_FLOW_ERR = 140, /* */
  71. FW_SCSI_DDP_ERR = 141, /* DDP error*/
  72. FW_SCSI_TASK_ERR = 142, /* No SCSI tasks available */
  73. };
  74. #define FW_T4VF_SGE_BASE_ADDR 0x0000
  75. #define FW_T4VF_MPS_BASE_ADDR 0x0100
  76. #define FW_T4VF_PL_BASE_ADDR 0x0200
  77. #define FW_T4VF_MBDATA_BASE_ADDR 0x0240
  78. #define FW_T4VF_CIM_BASE_ADDR 0x0300
  79. enum fw_wr_opcodes {
  80. FW_FILTER_WR = 0x02,
  81. FW_ULPTX_WR = 0x04,
  82. FW_TP_WR = 0x05,
  83. FW_ETH_TX_PKT_WR = 0x08,
  84. FW_OFLD_CONNECTION_WR = 0x2f,
  85. FW_FLOWC_WR = 0x0a,
  86. FW_OFLD_TX_DATA_WR = 0x0b,
  87. FW_CMD_WR = 0x10,
  88. FW_ETH_TX_PKT_VM_WR = 0x11,
  89. FW_RI_RES_WR = 0x0c,
  90. FW_RI_INIT_WR = 0x0d,
  91. FW_RI_RDMA_WRITE_WR = 0x14,
  92. FW_RI_SEND_WR = 0x15,
  93. FW_RI_RDMA_READ_WR = 0x16,
  94. FW_RI_RECV_WR = 0x17,
  95. FW_RI_BIND_MW_WR = 0x18,
  96. FW_RI_FR_NSMR_WR = 0x19,
  97. FW_RI_INV_LSTAG_WR = 0x1a,
  98. FW_LASTC2E_WR = 0x40
  99. };
  100. struct fw_wr_hdr {
  101. __be32 hi;
  102. __be32 lo;
  103. };
  104. #define FW_WR_OP(x) ((x) << 24)
  105. #define FW_WR_OP_GET(x) (((x) >> 24) & 0xff)
  106. #define FW_WR_ATOMIC(x) ((x) << 23)
  107. #define FW_WR_FLUSH(x) ((x) << 22)
  108. #define FW_WR_COMPL(x) ((x) << 21)
  109. #define FW_WR_IMMDLEN_MASK 0xff
  110. #define FW_WR_IMMDLEN(x) ((x) << 0)
  111. #define FW_WR_EQUIQ (1U << 31)
  112. #define FW_WR_EQUEQ (1U << 30)
  113. #define FW_WR_FLOWID(x) ((x) << 8)
  114. #define FW_WR_LEN16(x) ((x) << 0)
  115. #define HW_TPL_FR_MT_PR_IV_P_FC 0X32B
  116. #define HW_TPL_FR_MT_PR_OV_P_FC 0X327
  117. /* filter wr reply code in cookie in CPL_SET_TCB_RPL */
  118. enum fw_filter_wr_cookie {
  119. FW_FILTER_WR_SUCCESS,
  120. FW_FILTER_WR_FLT_ADDED,
  121. FW_FILTER_WR_FLT_DELETED,
  122. FW_FILTER_WR_SMT_TBL_FULL,
  123. FW_FILTER_WR_EINVAL,
  124. };
  125. struct fw_filter_wr {
  126. __be32 op_pkd;
  127. __be32 len16_pkd;
  128. __be64 r3;
  129. __be32 tid_to_iq;
  130. __be32 del_filter_to_l2tix;
  131. __be16 ethtype;
  132. __be16 ethtypem;
  133. __u8 frag_to_ovlan_vldm;
  134. __u8 smac_sel;
  135. __be16 rx_chan_rx_rpl_iq;
  136. __be32 maci_to_matchtypem;
  137. __u8 ptcl;
  138. __u8 ptclm;
  139. __u8 ttyp;
  140. __u8 ttypm;
  141. __be16 ivlan;
  142. __be16 ivlanm;
  143. __be16 ovlan;
  144. __be16 ovlanm;
  145. __u8 lip[16];
  146. __u8 lipm[16];
  147. __u8 fip[16];
  148. __u8 fipm[16];
  149. __be16 lp;
  150. __be16 lpm;
  151. __be16 fp;
  152. __be16 fpm;
  153. __be16 r7;
  154. __u8 sma[6];
  155. };
  156. #define S_FW_FILTER_WR_TID 12
  157. #define M_FW_FILTER_WR_TID 0xfffff
  158. #define V_FW_FILTER_WR_TID(x) ((x) << S_FW_FILTER_WR_TID)
  159. #define G_FW_FILTER_WR_TID(x) \
  160. (((x) >> S_FW_FILTER_WR_TID) & M_FW_FILTER_WR_TID)
  161. #define S_FW_FILTER_WR_RQTYPE 11
  162. #define M_FW_FILTER_WR_RQTYPE 0x1
  163. #define V_FW_FILTER_WR_RQTYPE(x) ((x) << S_FW_FILTER_WR_RQTYPE)
  164. #define G_FW_FILTER_WR_RQTYPE(x) \
  165. (((x) >> S_FW_FILTER_WR_RQTYPE) & M_FW_FILTER_WR_RQTYPE)
  166. #define F_FW_FILTER_WR_RQTYPE V_FW_FILTER_WR_RQTYPE(1U)
  167. #define S_FW_FILTER_WR_NOREPLY 10
  168. #define M_FW_FILTER_WR_NOREPLY 0x1
  169. #define V_FW_FILTER_WR_NOREPLY(x) ((x) << S_FW_FILTER_WR_NOREPLY)
  170. #define G_FW_FILTER_WR_NOREPLY(x) \
  171. (((x) >> S_FW_FILTER_WR_NOREPLY) & M_FW_FILTER_WR_NOREPLY)
  172. #define F_FW_FILTER_WR_NOREPLY V_FW_FILTER_WR_NOREPLY(1U)
  173. #define S_FW_FILTER_WR_IQ 0
  174. #define M_FW_FILTER_WR_IQ 0x3ff
  175. #define V_FW_FILTER_WR_IQ(x) ((x) << S_FW_FILTER_WR_IQ)
  176. #define G_FW_FILTER_WR_IQ(x) \
  177. (((x) >> S_FW_FILTER_WR_IQ) & M_FW_FILTER_WR_IQ)
  178. #define S_FW_FILTER_WR_DEL_FILTER 31
  179. #define M_FW_FILTER_WR_DEL_FILTER 0x1
  180. #define V_FW_FILTER_WR_DEL_FILTER(x) ((x) << S_FW_FILTER_WR_DEL_FILTER)
  181. #define G_FW_FILTER_WR_DEL_FILTER(x) \
  182. (((x) >> S_FW_FILTER_WR_DEL_FILTER) & M_FW_FILTER_WR_DEL_FILTER)
  183. #define F_FW_FILTER_WR_DEL_FILTER V_FW_FILTER_WR_DEL_FILTER(1U)
  184. #define S_FW_FILTER_WR_RPTTID 25
  185. #define M_FW_FILTER_WR_RPTTID 0x1
  186. #define V_FW_FILTER_WR_RPTTID(x) ((x) << S_FW_FILTER_WR_RPTTID)
  187. #define G_FW_FILTER_WR_RPTTID(x) \
  188. (((x) >> S_FW_FILTER_WR_RPTTID) & M_FW_FILTER_WR_RPTTID)
  189. #define F_FW_FILTER_WR_RPTTID V_FW_FILTER_WR_RPTTID(1U)
  190. #define S_FW_FILTER_WR_DROP 24
  191. #define M_FW_FILTER_WR_DROP 0x1
  192. #define V_FW_FILTER_WR_DROP(x) ((x) << S_FW_FILTER_WR_DROP)
  193. #define G_FW_FILTER_WR_DROP(x) \
  194. (((x) >> S_FW_FILTER_WR_DROP) & M_FW_FILTER_WR_DROP)
  195. #define F_FW_FILTER_WR_DROP V_FW_FILTER_WR_DROP(1U)
  196. #define S_FW_FILTER_WR_DIRSTEER 23
  197. #define M_FW_FILTER_WR_DIRSTEER 0x1
  198. #define V_FW_FILTER_WR_DIRSTEER(x) ((x) << S_FW_FILTER_WR_DIRSTEER)
  199. #define G_FW_FILTER_WR_DIRSTEER(x) \
  200. (((x) >> S_FW_FILTER_WR_DIRSTEER) & M_FW_FILTER_WR_DIRSTEER)
  201. #define F_FW_FILTER_WR_DIRSTEER V_FW_FILTER_WR_DIRSTEER(1U)
  202. #define S_FW_FILTER_WR_MASKHASH 22
  203. #define M_FW_FILTER_WR_MASKHASH 0x1
  204. #define V_FW_FILTER_WR_MASKHASH(x) ((x) << S_FW_FILTER_WR_MASKHASH)
  205. #define G_FW_FILTER_WR_MASKHASH(x) \
  206. (((x) >> S_FW_FILTER_WR_MASKHASH) & M_FW_FILTER_WR_MASKHASH)
  207. #define F_FW_FILTER_WR_MASKHASH V_FW_FILTER_WR_MASKHASH(1U)
  208. #define S_FW_FILTER_WR_DIRSTEERHASH 21
  209. #define M_FW_FILTER_WR_DIRSTEERHASH 0x1
  210. #define V_FW_FILTER_WR_DIRSTEERHASH(x) ((x) << S_FW_FILTER_WR_DIRSTEERHASH)
  211. #define G_FW_FILTER_WR_DIRSTEERHASH(x) \
  212. (((x) >> S_FW_FILTER_WR_DIRSTEERHASH) & M_FW_FILTER_WR_DIRSTEERHASH)
  213. #define F_FW_FILTER_WR_DIRSTEERHASH V_FW_FILTER_WR_DIRSTEERHASH(1U)
  214. #define S_FW_FILTER_WR_LPBK 20
  215. #define M_FW_FILTER_WR_LPBK 0x1
  216. #define V_FW_FILTER_WR_LPBK(x) ((x) << S_FW_FILTER_WR_LPBK)
  217. #define G_FW_FILTER_WR_LPBK(x) \
  218. (((x) >> S_FW_FILTER_WR_LPBK) & M_FW_FILTER_WR_LPBK)
  219. #define F_FW_FILTER_WR_LPBK V_FW_FILTER_WR_LPBK(1U)
  220. #define S_FW_FILTER_WR_DMAC 19
  221. #define M_FW_FILTER_WR_DMAC 0x1
  222. #define V_FW_FILTER_WR_DMAC(x) ((x) << S_FW_FILTER_WR_DMAC)
  223. #define G_FW_FILTER_WR_DMAC(x) \
  224. (((x) >> S_FW_FILTER_WR_DMAC) & M_FW_FILTER_WR_DMAC)
  225. #define F_FW_FILTER_WR_DMAC V_FW_FILTER_WR_DMAC(1U)
  226. #define S_FW_FILTER_WR_SMAC 18
  227. #define M_FW_FILTER_WR_SMAC 0x1
  228. #define V_FW_FILTER_WR_SMAC(x) ((x) << S_FW_FILTER_WR_SMAC)
  229. #define G_FW_FILTER_WR_SMAC(x) \
  230. (((x) >> S_FW_FILTER_WR_SMAC) & M_FW_FILTER_WR_SMAC)
  231. #define F_FW_FILTER_WR_SMAC V_FW_FILTER_WR_SMAC(1U)
  232. #define S_FW_FILTER_WR_INSVLAN 17
  233. #define M_FW_FILTER_WR_INSVLAN 0x1
  234. #define V_FW_FILTER_WR_INSVLAN(x) ((x) << S_FW_FILTER_WR_INSVLAN)
  235. #define G_FW_FILTER_WR_INSVLAN(x) \
  236. (((x) >> S_FW_FILTER_WR_INSVLAN) & M_FW_FILTER_WR_INSVLAN)
  237. #define F_FW_FILTER_WR_INSVLAN V_FW_FILTER_WR_INSVLAN(1U)
  238. #define S_FW_FILTER_WR_RMVLAN 16
  239. #define M_FW_FILTER_WR_RMVLAN 0x1
  240. #define V_FW_FILTER_WR_RMVLAN(x) ((x) << S_FW_FILTER_WR_RMVLAN)
  241. #define G_FW_FILTER_WR_RMVLAN(x) \
  242. (((x) >> S_FW_FILTER_WR_RMVLAN) & M_FW_FILTER_WR_RMVLAN)
  243. #define F_FW_FILTER_WR_RMVLAN V_FW_FILTER_WR_RMVLAN(1U)
  244. #define S_FW_FILTER_WR_HITCNTS 15
  245. #define M_FW_FILTER_WR_HITCNTS 0x1
  246. #define V_FW_FILTER_WR_HITCNTS(x) ((x) << S_FW_FILTER_WR_HITCNTS)
  247. #define G_FW_FILTER_WR_HITCNTS(x) \
  248. (((x) >> S_FW_FILTER_WR_HITCNTS) & M_FW_FILTER_WR_HITCNTS)
  249. #define F_FW_FILTER_WR_HITCNTS V_FW_FILTER_WR_HITCNTS(1U)
  250. #define S_FW_FILTER_WR_TXCHAN 13
  251. #define M_FW_FILTER_WR_TXCHAN 0x3
  252. #define V_FW_FILTER_WR_TXCHAN(x) ((x) << S_FW_FILTER_WR_TXCHAN)
  253. #define G_FW_FILTER_WR_TXCHAN(x) \
  254. (((x) >> S_FW_FILTER_WR_TXCHAN) & M_FW_FILTER_WR_TXCHAN)
  255. #define S_FW_FILTER_WR_PRIO 12
  256. #define M_FW_FILTER_WR_PRIO 0x1
  257. #define V_FW_FILTER_WR_PRIO(x) ((x) << S_FW_FILTER_WR_PRIO)
  258. #define G_FW_FILTER_WR_PRIO(x) \
  259. (((x) >> S_FW_FILTER_WR_PRIO) & M_FW_FILTER_WR_PRIO)
  260. #define F_FW_FILTER_WR_PRIO V_FW_FILTER_WR_PRIO(1U)
  261. #define S_FW_FILTER_WR_L2TIX 0
  262. #define M_FW_FILTER_WR_L2TIX 0xfff
  263. #define V_FW_FILTER_WR_L2TIX(x) ((x) << S_FW_FILTER_WR_L2TIX)
  264. #define G_FW_FILTER_WR_L2TIX(x) \
  265. (((x) >> S_FW_FILTER_WR_L2TIX) & M_FW_FILTER_WR_L2TIX)
  266. #define S_FW_FILTER_WR_FRAG 7
  267. #define M_FW_FILTER_WR_FRAG 0x1
  268. #define V_FW_FILTER_WR_FRAG(x) ((x) << S_FW_FILTER_WR_FRAG)
  269. #define G_FW_FILTER_WR_FRAG(x) \
  270. (((x) >> S_FW_FILTER_WR_FRAG) & M_FW_FILTER_WR_FRAG)
  271. #define F_FW_FILTER_WR_FRAG V_FW_FILTER_WR_FRAG(1U)
  272. #define S_FW_FILTER_WR_FRAGM 6
  273. #define M_FW_FILTER_WR_FRAGM 0x1
  274. #define V_FW_FILTER_WR_FRAGM(x) ((x) << S_FW_FILTER_WR_FRAGM)
  275. #define G_FW_FILTER_WR_FRAGM(x) \
  276. (((x) >> S_FW_FILTER_WR_FRAGM) & M_FW_FILTER_WR_FRAGM)
  277. #define F_FW_FILTER_WR_FRAGM V_FW_FILTER_WR_FRAGM(1U)
  278. #define S_FW_FILTER_WR_IVLAN_VLD 5
  279. #define M_FW_FILTER_WR_IVLAN_VLD 0x1
  280. #define V_FW_FILTER_WR_IVLAN_VLD(x) ((x) << S_FW_FILTER_WR_IVLAN_VLD)
  281. #define G_FW_FILTER_WR_IVLAN_VLD(x) \
  282. (((x) >> S_FW_FILTER_WR_IVLAN_VLD) & M_FW_FILTER_WR_IVLAN_VLD)
  283. #define F_FW_FILTER_WR_IVLAN_VLD V_FW_FILTER_WR_IVLAN_VLD(1U)
  284. #define S_FW_FILTER_WR_OVLAN_VLD 4
  285. #define M_FW_FILTER_WR_OVLAN_VLD 0x1
  286. #define V_FW_FILTER_WR_OVLAN_VLD(x) ((x) << S_FW_FILTER_WR_OVLAN_VLD)
  287. #define G_FW_FILTER_WR_OVLAN_VLD(x) \
  288. (((x) >> S_FW_FILTER_WR_OVLAN_VLD) & M_FW_FILTER_WR_OVLAN_VLD)
  289. #define F_FW_FILTER_WR_OVLAN_VLD V_FW_FILTER_WR_OVLAN_VLD(1U)
  290. #define S_FW_FILTER_WR_IVLAN_VLDM 3
  291. #define M_FW_FILTER_WR_IVLAN_VLDM 0x1
  292. #define V_FW_FILTER_WR_IVLAN_VLDM(x) ((x) << S_FW_FILTER_WR_IVLAN_VLDM)
  293. #define G_FW_FILTER_WR_IVLAN_VLDM(x) \
  294. (((x) >> S_FW_FILTER_WR_IVLAN_VLDM) & M_FW_FILTER_WR_IVLAN_VLDM)
  295. #define F_FW_FILTER_WR_IVLAN_VLDM V_FW_FILTER_WR_IVLAN_VLDM(1U)
  296. #define S_FW_FILTER_WR_OVLAN_VLDM 2
  297. #define M_FW_FILTER_WR_OVLAN_VLDM 0x1
  298. #define V_FW_FILTER_WR_OVLAN_VLDM(x) ((x) << S_FW_FILTER_WR_OVLAN_VLDM)
  299. #define G_FW_FILTER_WR_OVLAN_VLDM(x) \
  300. (((x) >> S_FW_FILTER_WR_OVLAN_VLDM) & M_FW_FILTER_WR_OVLAN_VLDM)
  301. #define F_FW_FILTER_WR_OVLAN_VLDM V_FW_FILTER_WR_OVLAN_VLDM(1U)
  302. #define S_FW_FILTER_WR_RX_CHAN 15
  303. #define M_FW_FILTER_WR_RX_CHAN 0x1
  304. #define V_FW_FILTER_WR_RX_CHAN(x) ((x) << S_FW_FILTER_WR_RX_CHAN)
  305. #define G_FW_FILTER_WR_RX_CHAN(x) \
  306. (((x) >> S_FW_FILTER_WR_RX_CHAN) & M_FW_FILTER_WR_RX_CHAN)
  307. #define F_FW_FILTER_WR_RX_CHAN V_FW_FILTER_WR_RX_CHAN(1U)
  308. #define S_FW_FILTER_WR_RX_RPL_IQ 0
  309. #define M_FW_FILTER_WR_RX_RPL_IQ 0x3ff
  310. #define V_FW_FILTER_WR_RX_RPL_IQ(x) ((x) << S_FW_FILTER_WR_RX_RPL_IQ)
  311. #define G_FW_FILTER_WR_RX_RPL_IQ(x) \
  312. (((x) >> S_FW_FILTER_WR_RX_RPL_IQ) & M_FW_FILTER_WR_RX_RPL_IQ)
  313. #define S_FW_FILTER_WR_MACI 23
  314. #define M_FW_FILTER_WR_MACI 0x1ff
  315. #define V_FW_FILTER_WR_MACI(x) ((x) << S_FW_FILTER_WR_MACI)
  316. #define G_FW_FILTER_WR_MACI(x) \
  317. (((x) >> S_FW_FILTER_WR_MACI) & M_FW_FILTER_WR_MACI)
  318. #define S_FW_FILTER_WR_MACIM 14
  319. #define M_FW_FILTER_WR_MACIM 0x1ff
  320. #define V_FW_FILTER_WR_MACIM(x) ((x) << S_FW_FILTER_WR_MACIM)
  321. #define G_FW_FILTER_WR_MACIM(x) \
  322. (((x) >> S_FW_FILTER_WR_MACIM) & M_FW_FILTER_WR_MACIM)
  323. #define S_FW_FILTER_WR_FCOE 13
  324. #define M_FW_FILTER_WR_FCOE 0x1
  325. #define V_FW_FILTER_WR_FCOE(x) ((x) << S_FW_FILTER_WR_FCOE)
  326. #define G_FW_FILTER_WR_FCOE(x) \
  327. (((x) >> S_FW_FILTER_WR_FCOE) & M_FW_FILTER_WR_FCOE)
  328. #define F_FW_FILTER_WR_FCOE V_FW_FILTER_WR_FCOE(1U)
  329. #define S_FW_FILTER_WR_FCOEM 12
  330. #define M_FW_FILTER_WR_FCOEM 0x1
  331. #define V_FW_FILTER_WR_FCOEM(x) ((x) << S_FW_FILTER_WR_FCOEM)
  332. #define G_FW_FILTER_WR_FCOEM(x) \
  333. (((x) >> S_FW_FILTER_WR_FCOEM) & M_FW_FILTER_WR_FCOEM)
  334. #define F_FW_FILTER_WR_FCOEM V_FW_FILTER_WR_FCOEM(1U)
  335. #define S_FW_FILTER_WR_PORT 9
  336. #define M_FW_FILTER_WR_PORT 0x7
  337. #define V_FW_FILTER_WR_PORT(x) ((x) << S_FW_FILTER_WR_PORT)
  338. #define G_FW_FILTER_WR_PORT(x) \
  339. (((x) >> S_FW_FILTER_WR_PORT) & M_FW_FILTER_WR_PORT)
  340. #define S_FW_FILTER_WR_PORTM 6
  341. #define M_FW_FILTER_WR_PORTM 0x7
  342. #define V_FW_FILTER_WR_PORTM(x) ((x) << S_FW_FILTER_WR_PORTM)
  343. #define G_FW_FILTER_WR_PORTM(x) \
  344. (((x) >> S_FW_FILTER_WR_PORTM) & M_FW_FILTER_WR_PORTM)
  345. #define S_FW_FILTER_WR_MATCHTYPE 3
  346. #define M_FW_FILTER_WR_MATCHTYPE 0x7
  347. #define V_FW_FILTER_WR_MATCHTYPE(x) ((x) << S_FW_FILTER_WR_MATCHTYPE)
  348. #define G_FW_FILTER_WR_MATCHTYPE(x) \
  349. (((x) >> S_FW_FILTER_WR_MATCHTYPE) & M_FW_FILTER_WR_MATCHTYPE)
  350. #define S_FW_FILTER_WR_MATCHTYPEM 0
  351. #define M_FW_FILTER_WR_MATCHTYPEM 0x7
  352. #define V_FW_FILTER_WR_MATCHTYPEM(x) ((x) << S_FW_FILTER_WR_MATCHTYPEM)
  353. #define G_FW_FILTER_WR_MATCHTYPEM(x) \
  354. (((x) >> S_FW_FILTER_WR_MATCHTYPEM) & M_FW_FILTER_WR_MATCHTYPEM)
  355. struct fw_ulptx_wr {
  356. __be32 op_to_compl;
  357. __be32 flowid_len16;
  358. u64 cookie;
  359. };
  360. struct fw_tp_wr {
  361. __be32 op_to_immdlen;
  362. __be32 flowid_len16;
  363. u64 cookie;
  364. };
  365. struct fw_eth_tx_pkt_wr {
  366. __be32 op_immdlen;
  367. __be32 equiq_to_len16;
  368. __be64 r3;
  369. };
  370. struct fw_ofld_connection_wr {
  371. __be32 op_compl;
  372. __be32 len16_pkd;
  373. __u64 cookie;
  374. __be64 r2;
  375. __be64 r3;
  376. struct fw_ofld_connection_le {
  377. __be32 version_cpl;
  378. __be32 filter;
  379. __be32 r1;
  380. __be16 lport;
  381. __be16 pport;
  382. union fw_ofld_connection_leip {
  383. struct fw_ofld_connection_le_ipv4 {
  384. __be32 pip;
  385. __be32 lip;
  386. __be64 r0;
  387. __be64 r1;
  388. __be64 r2;
  389. } ipv4;
  390. struct fw_ofld_connection_le_ipv6 {
  391. __be64 pip_hi;
  392. __be64 pip_lo;
  393. __be64 lip_hi;
  394. __be64 lip_lo;
  395. } ipv6;
  396. } u;
  397. } le;
  398. struct fw_ofld_connection_tcb {
  399. __be32 t_state_to_astid;
  400. __be16 cplrxdataack_cplpassacceptrpl;
  401. __be16 rcv_adv;
  402. __be32 rcv_nxt;
  403. __be32 tx_max;
  404. __be64 opt0;
  405. __be32 opt2;
  406. __be32 r1;
  407. __be64 r2;
  408. __be64 r3;
  409. } tcb;
  410. };
  411. #define S_FW_OFLD_CONNECTION_WR_VERSION 31
  412. #define M_FW_OFLD_CONNECTION_WR_VERSION 0x1
  413. #define V_FW_OFLD_CONNECTION_WR_VERSION(x) \
  414. ((x) << S_FW_OFLD_CONNECTION_WR_VERSION)
  415. #define G_FW_OFLD_CONNECTION_WR_VERSION(x) \
  416. (((x) >> S_FW_OFLD_CONNECTION_WR_VERSION) & \
  417. M_FW_OFLD_CONNECTION_WR_VERSION)
  418. #define F_FW_OFLD_CONNECTION_WR_VERSION \
  419. V_FW_OFLD_CONNECTION_WR_VERSION(1U)
  420. #define S_FW_OFLD_CONNECTION_WR_CPL 30
  421. #define M_FW_OFLD_CONNECTION_WR_CPL 0x1
  422. #define V_FW_OFLD_CONNECTION_WR_CPL(x) ((x) << S_FW_OFLD_CONNECTION_WR_CPL)
  423. #define G_FW_OFLD_CONNECTION_WR_CPL(x) \
  424. (((x) >> S_FW_OFLD_CONNECTION_WR_CPL) & M_FW_OFLD_CONNECTION_WR_CPL)
  425. #define F_FW_OFLD_CONNECTION_WR_CPL V_FW_OFLD_CONNECTION_WR_CPL(1U)
  426. #define S_FW_OFLD_CONNECTION_WR_T_STATE 28
  427. #define M_FW_OFLD_CONNECTION_WR_T_STATE 0xf
  428. #define V_FW_OFLD_CONNECTION_WR_T_STATE(x) \
  429. ((x) << S_FW_OFLD_CONNECTION_WR_T_STATE)
  430. #define G_FW_OFLD_CONNECTION_WR_T_STATE(x) \
  431. (((x) >> S_FW_OFLD_CONNECTION_WR_T_STATE) & \
  432. M_FW_OFLD_CONNECTION_WR_T_STATE)
  433. #define S_FW_OFLD_CONNECTION_WR_RCV_SCALE 24
  434. #define M_FW_OFLD_CONNECTION_WR_RCV_SCALE 0xf
  435. #define V_FW_OFLD_CONNECTION_WR_RCV_SCALE(x) \
  436. ((x) << S_FW_OFLD_CONNECTION_WR_RCV_SCALE)
  437. #define G_FW_OFLD_CONNECTION_WR_RCV_SCALE(x) \
  438. (((x) >> S_FW_OFLD_CONNECTION_WR_RCV_SCALE) & \
  439. M_FW_OFLD_CONNECTION_WR_RCV_SCALE)
  440. #define S_FW_OFLD_CONNECTION_WR_ASTID 0
  441. #define M_FW_OFLD_CONNECTION_WR_ASTID 0xffffff
  442. #define V_FW_OFLD_CONNECTION_WR_ASTID(x) \
  443. ((x) << S_FW_OFLD_CONNECTION_WR_ASTID)
  444. #define G_FW_OFLD_CONNECTION_WR_ASTID(x) \
  445. (((x) >> S_FW_OFLD_CONNECTION_WR_ASTID) & M_FW_OFLD_CONNECTION_WR_ASTID)
  446. #define S_FW_OFLD_CONNECTION_WR_CPLRXDATAACK 15
  447. #define M_FW_OFLD_CONNECTION_WR_CPLRXDATAACK 0x1
  448. #define V_FW_OFLD_CONNECTION_WR_CPLRXDATAACK(x) \
  449. ((x) << S_FW_OFLD_CONNECTION_WR_CPLRXDATAACK)
  450. #define G_FW_OFLD_CONNECTION_WR_CPLRXDATAACK(x) \
  451. (((x) >> S_FW_OFLD_CONNECTION_WR_CPLRXDATAACK) & \
  452. M_FW_OFLD_CONNECTION_WR_CPLRXDATAACK)
  453. #define F_FW_OFLD_CONNECTION_WR_CPLRXDATAACK \
  454. V_FW_OFLD_CONNECTION_WR_CPLRXDATAACK(1U)
  455. #define S_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL 14
  456. #define M_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL 0x1
  457. #define V_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL(x) \
  458. ((x) << S_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL)
  459. #define G_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL(x) \
  460. (((x) >> S_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL) & \
  461. M_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL)
  462. #define F_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL \
  463. V_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL(1U)
  464. enum fw_flowc_mnem {
  465. FW_FLOWC_MNEM_PFNVFN, /* PFN [15:8] VFN [7:0] */
  466. FW_FLOWC_MNEM_CH,
  467. FW_FLOWC_MNEM_PORT,
  468. FW_FLOWC_MNEM_IQID,
  469. FW_FLOWC_MNEM_SNDNXT,
  470. FW_FLOWC_MNEM_RCVNXT,
  471. FW_FLOWC_MNEM_SNDBUF,
  472. FW_FLOWC_MNEM_MSS,
  473. };
  474. struct fw_flowc_mnemval {
  475. u8 mnemonic;
  476. u8 r4[3];
  477. __be32 val;
  478. };
  479. struct fw_flowc_wr {
  480. __be32 op_to_nparams;
  481. #define FW_FLOWC_WR_NPARAMS(x) ((x) << 0)
  482. __be32 flowid_len16;
  483. struct fw_flowc_mnemval mnemval[0];
  484. };
  485. struct fw_ofld_tx_data_wr {
  486. __be32 op_to_immdlen;
  487. __be32 flowid_len16;
  488. __be32 plen;
  489. __be32 tunnel_to_proxy;
  490. #define FW_OFLD_TX_DATA_WR_TUNNEL(x) ((x) << 19)
  491. #define FW_OFLD_TX_DATA_WR_SAVE(x) ((x) << 18)
  492. #define FW_OFLD_TX_DATA_WR_FLUSH(x) ((x) << 17)
  493. #define FW_OFLD_TX_DATA_WR_URGENT(x) ((x) << 16)
  494. #define FW_OFLD_TX_DATA_WR_MORE(x) ((x) << 15)
  495. #define FW_OFLD_TX_DATA_WR_SHOVE(x) ((x) << 14)
  496. #define FW_OFLD_TX_DATA_WR_ULPMODE(x) ((x) << 10)
  497. #define FW_OFLD_TX_DATA_WR_ULPSUBMODE(x) ((x) << 6)
  498. };
  499. struct fw_cmd_wr {
  500. __be32 op_dma;
  501. #define FW_CMD_WR_DMA (1U << 17)
  502. __be32 len16_pkd;
  503. __be64 cookie_daddr;
  504. };
  505. struct fw_eth_tx_pkt_vm_wr {
  506. __be32 op_immdlen;
  507. __be32 equiq_to_len16;
  508. __be32 r3[2];
  509. u8 ethmacdst[6];
  510. u8 ethmacsrc[6];
  511. __be16 ethtype;
  512. __be16 vlantci;
  513. };
  514. #define FW_CMD_MAX_TIMEOUT 10000
  515. /*
  516. * If a host driver does a HELLO and discovers that there's already a MASTER
  517. * selected, we may have to wait for that MASTER to finish issuing RESET,
  518. * configuration and INITIALIZE commands. Also, there's a possibility that
  519. * our own HELLO may get lost if it happens right as the MASTER is issuign a
  520. * RESET command, so we need to be willing to make a few retries of our HELLO.
  521. */
  522. #define FW_CMD_HELLO_TIMEOUT (3 * FW_CMD_MAX_TIMEOUT)
  523. #define FW_CMD_HELLO_RETRIES 3
  524. enum fw_cmd_opcodes {
  525. FW_LDST_CMD = 0x01,
  526. FW_RESET_CMD = 0x03,
  527. FW_HELLO_CMD = 0x04,
  528. FW_BYE_CMD = 0x05,
  529. FW_INITIALIZE_CMD = 0x06,
  530. FW_CAPS_CONFIG_CMD = 0x07,
  531. FW_PARAMS_CMD = 0x08,
  532. FW_PFVF_CMD = 0x09,
  533. FW_IQ_CMD = 0x10,
  534. FW_EQ_MNGT_CMD = 0x11,
  535. FW_EQ_ETH_CMD = 0x12,
  536. FW_EQ_CTRL_CMD = 0x13,
  537. FW_EQ_OFLD_CMD = 0x21,
  538. FW_VI_CMD = 0x14,
  539. FW_VI_MAC_CMD = 0x15,
  540. FW_VI_RXMODE_CMD = 0x16,
  541. FW_VI_ENABLE_CMD = 0x17,
  542. FW_ACL_MAC_CMD = 0x18,
  543. FW_ACL_VLAN_CMD = 0x19,
  544. FW_VI_STATS_CMD = 0x1a,
  545. FW_PORT_CMD = 0x1b,
  546. FW_PORT_STATS_CMD = 0x1c,
  547. FW_PORT_LB_STATS_CMD = 0x1d,
  548. FW_PORT_TRACE_CMD = 0x1e,
  549. FW_PORT_TRACE_MMAP_CMD = 0x1f,
  550. FW_RSS_IND_TBL_CMD = 0x20,
  551. FW_RSS_GLB_CONFIG_CMD = 0x22,
  552. FW_RSS_VI_CONFIG_CMD = 0x23,
  553. FW_CLIP_CMD = 0x28,
  554. FW_LASTC2E_CMD = 0x40,
  555. FW_ERROR_CMD = 0x80,
  556. FW_DEBUG_CMD = 0x81,
  557. };
  558. enum fw_cmd_cap {
  559. FW_CMD_CAP_PF = 0x01,
  560. FW_CMD_CAP_DMAQ = 0x02,
  561. FW_CMD_CAP_PORT = 0x04,
  562. FW_CMD_CAP_PORTPROMISC = 0x08,
  563. FW_CMD_CAP_PORTSTATS = 0x10,
  564. FW_CMD_CAP_VF = 0x80,
  565. };
  566. /*
  567. * Generic command header flit0
  568. */
  569. struct fw_cmd_hdr {
  570. __be32 hi;
  571. __be32 lo;
  572. };
  573. #define FW_CMD_OP(x) ((x) << 24)
  574. #define FW_CMD_OP_GET(x) (((x) >> 24) & 0xff)
  575. #define FW_CMD_REQUEST (1U << 23)
  576. #define FW_CMD_REQUEST_GET(x) (((x) >> 23) & 0x1)
  577. #define FW_CMD_READ (1U << 22)
  578. #define FW_CMD_WRITE (1U << 21)
  579. #define FW_CMD_EXEC (1U << 20)
  580. #define FW_CMD_RAMASK(x) ((x) << 20)
  581. #define FW_CMD_RETVAL(x) ((x) << 8)
  582. #define FW_CMD_RETVAL_GET(x) (((x) >> 8) & 0xff)
  583. #define FW_CMD_LEN16(x) ((x) << 0)
  584. #define FW_LEN16(fw_struct) FW_CMD_LEN16(sizeof(fw_struct) / 16)
  585. enum fw_ldst_addrspc {
  586. FW_LDST_ADDRSPC_FIRMWARE = 0x0001,
  587. FW_LDST_ADDRSPC_SGE_EGRC = 0x0008,
  588. FW_LDST_ADDRSPC_SGE_INGC = 0x0009,
  589. FW_LDST_ADDRSPC_SGE_FLMC = 0x000a,
  590. FW_LDST_ADDRSPC_SGE_CONMC = 0x000b,
  591. FW_LDST_ADDRSPC_TP_PIO = 0x0010,
  592. FW_LDST_ADDRSPC_TP_TM_PIO = 0x0011,
  593. FW_LDST_ADDRSPC_TP_MIB = 0x0012,
  594. FW_LDST_ADDRSPC_MDIO = 0x0018,
  595. FW_LDST_ADDRSPC_MPS = 0x0020,
  596. FW_LDST_ADDRSPC_FUNC = 0x0028,
  597. FW_LDST_ADDRSPC_FUNC_PCIE = 0x0029,
  598. };
  599. enum fw_ldst_mps_fid {
  600. FW_LDST_MPS_ATRB,
  601. FW_LDST_MPS_RPLC
  602. };
  603. enum fw_ldst_func_access_ctl {
  604. FW_LDST_FUNC_ACC_CTL_VIID,
  605. FW_LDST_FUNC_ACC_CTL_FID
  606. };
  607. enum fw_ldst_func_mod_index {
  608. FW_LDST_FUNC_MPS
  609. };
  610. struct fw_ldst_cmd {
  611. __be32 op_to_addrspace;
  612. #define FW_LDST_CMD_ADDRSPACE(x) ((x) << 0)
  613. __be32 cycles_to_len16;
  614. union fw_ldst {
  615. struct fw_ldst_addrval {
  616. __be32 addr;
  617. __be32 val;
  618. } addrval;
  619. struct fw_ldst_idctxt {
  620. __be32 physid;
  621. __be32 msg_pkd;
  622. __be32 ctxt_data7;
  623. __be32 ctxt_data6;
  624. __be32 ctxt_data5;
  625. __be32 ctxt_data4;
  626. __be32 ctxt_data3;
  627. __be32 ctxt_data2;
  628. __be32 ctxt_data1;
  629. __be32 ctxt_data0;
  630. } idctxt;
  631. struct fw_ldst_mdio {
  632. __be16 paddr_mmd;
  633. __be16 raddr;
  634. __be16 vctl;
  635. __be16 rval;
  636. } mdio;
  637. struct fw_ldst_mps {
  638. __be16 fid_ctl;
  639. __be16 rplcpf_pkd;
  640. __be32 rplc127_96;
  641. __be32 rplc95_64;
  642. __be32 rplc63_32;
  643. __be32 rplc31_0;
  644. __be32 atrb;
  645. __be16 vlan[16];
  646. } mps;
  647. struct fw_ldst_func {
  648. u8 access_ctl;
  649. u8 mod_index;
  650. __be16 ctl_id;
  651. __be32 offset;
  652. __be64 data0;
  653. __be64 data1;
  654. } func;
  655. struct fw_ldst_pcie {
  656. u8 ctrl_to_fn;
  657. u8 bnum;
  658. u8 r;
  659. u8 ext_r;
  660. u8 select_naccess;
  661. u8 pcie_fn;
  662. __be16 nset_pkd;
  663. __be32 data[12];
  664. } pcie;
  665. } u;
  666. };
  667. #define FW_LDST_CMD_MSG(x) ((x) << 31)
  668. #define FW_LDST_CMD_PADDR(x) ((x) << 8)
  669. #define FW_LDST_CMD_MMD(x) ((x) << 0)
  670. #define FW_LDST_CMD_FID(x) ((x) << 15)
  671. #define FW_LDST_CMD_CTL(x) ((x) << 0)
  672. #define FW_LDST_CMD_RPLCPF(x) ((x) << 0)
  673. #define FW_LDST_CMD_LC (1U << 4)
  674. #define FW_LDST_CMD_NACCESS(x) ((x) << 0)
  675. #define FW_LDST_CMD_FN(x) ((x) << 0)
  676. struct fw_reset_cmd {
  677. __be32 op_to_write;
  678. __be32 retval_len16;
  679. __be32 val;
  680. __be32 halt_pkd;
  681. };
  682. #define FW_RESET_CMD_HALT_SHIFT 31
  683. #define FW_RESET_CMD_HALT_MASK 0x1
  684. #define FW_RESET_CMD_HALT(x) ((x) << FW_RESET_CMD_HALT_SHIFT)
  685. #define FW_RESET_CMD_HALT_GET(x) \
  686. (((x) >> FW_RESET_CMD_HALT_SHIFT) & FW_RESET_CMD_HALT_MASK)
  687. enum fw_hellow_cmd {
  688. fw_hello_cmd_stage_os = 0x0
  689. };
  690. struct fw_hello_cmd {
  691. __be32 op_to_write;
  692. __be32 retval_len16;
  693. __be32 err_to_clearinit;
  694. #define FW_HELLO_CMD_ERR (1U << 31)
  695. #define FW_HELLO_CMD_INIT (1U << 30)
  696. #define FW_HELLO_CMD_MASTERDIS(x) ((x) << 29)
  697. #define FW_HELLO_CMD_MASTERFORCE(x) ((x) << 28)
  698. #define FW_HELLO_CMD_MBMASTER_MASK 0xfU
  699. #define FW_HELLO_CMD_MBMASTER_SHIFT 24
  700. #define FW_HELLO_CMD_MBMASTER(x) ((x) << FW_HELLO_CMD_MBMASTER_SHIFT)
  701. #define FW_HELLO_CMD_MBMASTER_GET(x) \
  702. (((x) >> FW_HELLO_CMD_MBMASTER_SHIFT) & FW_HELLO_CMD_MBMASTER_MASK)
  703. #define FW_HELLO_CMD_MBASYNCNOTINT(x) ((x) << 23)
  704. #define FW_HELLO_CMD_MBASYNCNOT(x) ((x) << 20)
  705. #define FW_HELLO_CMD_STAGE(x) ((x) << 17)
  706. #define FW_HELLO_CMD_CLEARINIT (1U << 16)
  707. __be32 fwrev;
  708. };
  709. struct fw_bye_cmd {
  710. __be32 op_to_write;
  711. __be32 retval_len16;
  712. __be64 r3;
  713. };
  714. struct fw_initialize_cmd {
  715. __be32 op_to_write;
  716. __be32 retval_len16;
  717. __be64 r3;
  718. };
  719. enum fw_caps_config_hm {
  720. FW_CAPS_CONFIG_HM_PCIE = 0x00000001,
  721. FW_CAPS_CONFIG_HM_PL = 0x00000002,
  722. FW_CAPS_CONFIG_HM_SGE = 0x00000004,
  723. FW_CAPS_CONFIG_HM_CIM = 0x00000008,
  724. FW_CAPS_CONFIG_HM_ULPTX = 0x00000010,
  725. FW_CAPS_CONFIG_HM_TP = 0x00000020,
  726. FW_CAPS_CONFIG_HM_ULPRX = 0x00000040,
  727. FW_CAPS_CONFIG_HM_PMRX = 0x00000080,
  728. FW_CAPS_CONFIG_HM_PMTX = 0x00000100,
  729. FW_CAPS_CONFIG_HM_MC = 0x00000200,
  730. FW_CAPS_CONFIG_HM_LE = 0x00000400,
  731. FW_CAPS_CONFIG_HM_MPS = 0x00000800,
  732. FW_CAPS_CONFIG_HM_XGMAC = 0x00001000,
  733. FW_CAPS_CONFIG_HM_CPLSWITCH = 0x00002000,
  734. FW_CAPS_CONFIG_HM_T4DBG = 0x00004000,
  735. FW_CAPS_CONFIG_HM_MI = 0x00008000,
  736. FW_CAPS_CONFIG_HM_I2CM = 0x00010000,
  737. FW_CAPS_CONFIG_HM_NCSI = 0x00020000,
  738. FW_CAPS_CONFIG_HM_SMB = 0x00040000,
  739. FW_CAPS_CONFIG_HM_MA = 0x00080000,
  740. FW_CAPS_CONFIG_HM_EDRAM = 0x00100000,
  741. FW_CAPS_CONFIG_HM_PMU = 0x00200000,
  742. FW_CAPS_CONFIG_HM_UART = 0x00400000,
  743. FW_CAPS_CONFIG_HM_SF = 0x00800000,
  744. };
  745. enum fw_caps_config_nbm {
  746. FW_CAPS_CONFIG_NBM_IPMI = 0x00000001,
  747. FW_CAPS_CONFIG_NBM_NCSI = 0x00000002,
  748. };
  749. enum fw_caps_config_link {
  750. FW_CAPS_CONFIG_LINK_PPP = 0x00000001,
  751. FW_CAPS_CONFIG_LINK_QFC = 0x00000002,
  752. FW_CAPS_CONFIG_LINK_DCBX = 0x00000004,
  753. };
  754. enum fw_caps_config_switch {
  755. FW_CAPS_CONFIG_SWITCH_INGRESS = 0x00000001,
  756. FW_CAPS_CONFIG_SWITCH_EGRESS = 0x00000002,
  757. };
  758. enum fw_caps_config_nic {
  759. FW_CAPS_CONFIG_NIC = 0x00000001,
  760. FW_CAPS_CONFIG_NIC_VM = 0x00000002,
  761. };
  762. enum fw_caps_config_ofld {
  763. FW_CAPS_CONFIG_OFLD = 0x00000001,
  764. };
  765. enum fw_caps_config_rdma {
  766. FW_CAPS_CONFIG_RDMA_RDDP = 0x00000001,
  767. FW_CAPS_CONFIG_RDMA_RDMAC = 0x00000002,
  768. };
  769. enum fw_caps_config_iscsi {
  770. FW_CAPS_CONFIG_ISCSI_INITIATOR_PDU = 0x00000001,
  771. FW_CAPS_CONFIG_ISCSI_TARGET_PDU = 0x00000002,
  772. FW_CAPS_CONFIG_ISCSI_INITIATOR_CNXOFLD = 0x00000004,
  773. FW_CAPS_CONFIG_ISCSI_TARGET_CNXOFLD = 0x00000008,
  774. };
  775. enum fw_caps_config_fcoe {
  776. FW_CAPS_CONFIG_FCOE_INITIATOR = 0x00000001,
  777. FW_CAPS_CONFIG_FCOE_TARGET = 0x00000002,
  778. FW_CAPS_CONFIG_FCOE_CTRL_OFLD = 0x00000004,
  779. };
  780. enum fw_memtype_cf {
  781. FW_MEMTYPE_CF_EDC0 = 0x0,
  782. FW_MEMTYPE_CF_EDC1 = 0x1,
  783. FW_MEMTYPE_CF_EXTMEM = 0x2,
  784. FW_MEMTYPE_CF_FLASH = 0x4,
  785. FW_MEMTYPE_CF_INTERNAL = 0x5,
  786. };
  787. struct fw_caps_config_cmd {
  788. __be32 op_to_write;
  789. __be32 cfvalid_to_len16;
  790. __be32 r2;
  791. __be32 hwmbitmap;
  792. __be16 nbmcaps;
  793. __be16 linkcaps;
  794. __be16 switchcaps;
  795. __be16 r3;
  796. __be16 niccaps;
  797. __be16 ofldcaps;
  798. __be16 rdmacaps;
  799. __be16 r4;
  800. __be16 iscsicaps;
  801. __be16 fcoecaps;
  802. __be32 cfcsum;
  803. __be32 finiver;
  804. __be32 finicsum;
  805. };
  806. #define FW_CAPS_CONFIG_CMD_CFVALID (1U << 27)
  807. #define FW_CAPS_CONFIG_CMD_MEMTYPE_CF(x) ((x) << 24)
  808. #define FW_CAPS_CONFIG_CMD_MEMADDR64K_CF(x) ((x) << 16)
  809. /*
  810. * params command mnemonics
  811. */
  812. enum fw_params_mnem {
  813. FW_PARAMS_MNEM_DEV = 1, /* device params */
  814. FW_PARAMS_MNEM_PFVF = 2, /* function params */
  815. FW_PARAMS_MNEM_REG = 3, /* limited register access */
  816. FW_PARAMS_MNEM_DMAQ = 4, /* dma queue params */
  817. FW_PARAMS_MNEM_LAST
  818. };
  819. /*
  820. * device parameters
  821. */
  822. enum fw_params_param_dev {
  823. FW_PARAMS_PARAM_DEV_CCLK = 0x00, /* chip core clock in khz */
  824. FW_PARAMS_PARAM_DEV_PORTVEC = 0x01, /* the port vector */
  825. FW_PARAMS_PARAM_DEV_NTID = 0x02, /* reads the number of TIDs
  826. * allocated by the device's
  827. * Lookup Engine
  828. */
  829. FW_PARAMS_PARAM_DEV_FLOWC_BUFFIFO_SZ = 0x03,
  830. FW_PARAMS_PARAM_DEV_INTVER_NIC = 0x04,
  831. FW_PARAMS_PARAM_DEV_INTVER_VNIC = 0x05,
  832. FW_PARAMS_PARAM_DEV_INTVER_OFLD = 0x06,
  833. FW_PARAMS_PARAM_DEV_INTVER_RI = 0x07,
  834. FW_PARAMS_PARAM_DEV_INTVER_ISCSIPDU = 0x08,
  835. FW_PARAMS_PARAM_DEV_INTVER_ISCSI = 0x09,
  836. FW_PARAMS_PARAM_DEV_INTVER_FCOE = 0x0A,
  837. FW_PARAMS_PARAM_DEV_FWREV = 0x0B,
  838. FW_PARAMS_PARAM_DEV_TPREV = 0x0C,
  839. FW_PARAMS_PARAM_DEV_CF = 0x0D,
  840. };
  841. /*
  842. * physical and virtual function parameters
  843. */
  844. enum fw_params_param_pfvf {
  845. FW_PARAMS_PARAM_PFVF_RWXCAPS = 0x00,
  846. FW_PARAMS_PARAM_PFVF_ROUTE_START = 0x01,
  847. FW_PARAMS_PARAM_PFVF_ROUTE_END = 0x02,
  848. FW_PARAMS_PARAM_PFVF_CLIP_START = 0x03,
  849. FW_PARAMS_PARAM_PFVF_CLIP_END = 0x04,
  850. FW_PARAMS_PARAM_PFVF_FILTER_START = 0x05,
  851. FW_PARAMS_PARAM_PFVF_FILTER_END = 0x06,
  852. FW_PARAMS_PARAM_PFVF_SERVER_START = 0x07,
  853. FW_PARAMS_PARAM_PFVF_SERVER_END = 0x08,
  854. FW_PARAMS_PARAM_PFVF_TDDP_START = 0x09,
  855. FW_PARAMS_PARAM_PFVF_TDDP_END = 0x0A,
  856. FW_PARAMS_PARAM_PFVF_ISCSI_START = 0x0B,
  857. FW_PARAMS_PARAM_PFVF_ISCSI_END = 0x0C,
  858. FW_PARAMS_PARAM_PFVF_STAG_START = 0x0D,
  859. FW_PARAMS_PARAM_PFVF_STAG_END = 0x0E,
  860. FW_PARAMS_PARAM_PFVF_RQ_START = 0x1F,
  861. FW_PARAMS_PARAM_PFVF_RQ_END = 0x10,
  862. FW_PARAMS_PARAM_PFVF_PBL_START = 0x11,
  863. FW_PARAMS_PARAM_PFVF_PBL_END = 0x12,
  864. FW_PARAMS_PARAM_PFVF_L2T_START = 0x13,
  865. FW_PARAMS_PARAM_PFVF_L2T_END = 0x14,
  866. FW_PARAMS_PARAM_PFVF_SQRQ_START = 0x15,
  867. FW_PARAMS_PARAM_PFVF_SQRQ_END = 0x16,
  868. FW_PARAMS_PARAM_PFVF_CQ_START = 0x17,
  869. FW_PARAMS_PARAM_PFVF_CQ_END = 0x18,
  870. FW_PARAMS_PARAM_PFVF_SCHEDCLASS_ETH = 0x20,
  871. FW_PARAMS_PARAM_PFVF_VIID = 0x24,
  872. FW_PARAMS_PARAM_PFVF_CPMASK = 0x25,
  873. FW_PARAMS_PARAM_PFVF_OCQ_START = 0x26,
  874. FW_PARAMS_PARAM_PFVF_OCQ_END = 0x27,
  875. FW_PARAMS_PARAM_PFVF_CONM_MAP = 0x28,
  876. FW_PARAMS_PARAM_PFVF_IQFLINT_START = 0x29,
  877. FW_PARAMS_PARAM_PFVF_IQFLINT_END = 0x2A,
  878. FW_PARAMS_PARAM_PFVF_EQ_START = 0x2B,
  879. FW_PARAMS_PARAM_PFVF_EQ_END = 0x2C,
  880. FW_PARAMS_PARAM_PFVF_ACTIVE_FILTER_START = 0x2D,
  881. FW_PARAMS_PARAM_PFVF_ACTIVE_FILTER_END = 0x2E,
  882. FW_PARAMS_PARAM_PFVF_ETHOFLD_END = 0x30,
  883. FW_PARAMS_PARAM_PFVF_CPLFW4MSG_ENCAP = 0x31
  884. };
  885. /*
  886. * dma queue parameters
  887. */
  888. enum fw_params_param_dmaq {
  889. FW_PARAMS_PARAM_DMAQ_IQ_DCAEN_DCACPU = 0x00,
  890. FW_PARAMS_PARAM_DMAQ_IQ_INTCNTTHRESH = 0x01,
  891. FW_PARAMS_PARAM_DMAQ_EQ_CMPLIQID_MNGT = 0x10,
  892. FW_PARAMS_PARAM_DMAQ_EQ_CMPLIQID_CTRL = 0x11,
  893. FW_PARAMS_PARAM_DMAQ_EQ_SCHEDCLASS_ETH = 0x12,
  894. };
  895. #define FW_PARAMS_MNEM(x) ((x) << 24)
  896. #define FW_PARAMS_PARAM_X(x) ((x) << 16)
  897. #define FW_PARAMS_PARAM_Y_SHIFT 8
  898. #define FW_PARAMS_PARAM_Y_MASK 0xffU
  899. #define FW_PARAMS_PARAM_Y(x) ((x) << FW_PARAMS_PARAM_Y_SHIFT)
  900. #define FW_PARAMS_PARAM_Y_GET(x) (((x) >> FW_PARAMS_PARAM_Y_SHIFT) &\
  901. FW_PARAMS_PARAM_Y_MASK)
  902. #define FW_PARAMS_PARAM_Z_SHIFT 0
  903. #define FW_PARAMS_PARAM_Z_MASK 0xffu
  904. #define FW_PARAMS_PARAM_Z(x) ((x) << FW_PARAMS_PARAM_Z_SHIFT)
  905. #define FW_PARAMS_PARAM_Z_GET(x) (((x) >> FW_PARAMS_PARAM_Z_SHIFT) &\
  906. FW_PARAMS_PARAM_Z_MASK)
  907. #define FW_PARAMS_PARAM_XYZ(x) ((x) << 0)
  908. #define FW_PARAMS_PARAM_YZ(x) ((x) << 0)
  909. struct fw_params_cmd {
  910. __be32 op_to_vfn;
  911. __be32 retval_len16;
  912. struct fw_params_param {
  913. __be32 mnem;
  914. __be32 val;
  915. } param[7];
  916. };
  917. #define FW_PARAMS_CMD_PFN(x) ((x) << 8)
  918. #define FW_PARAMS_CMD_VFN(x) ((x) << 0)
  919. struct fw_pfvf_cmd {
  920. __be32 op_to_vfn;
  921. __be32 retval_len16;
  922. __be32 niqflint_niq;
  923. __be32 type_to_neq;
  924. __be32 tc_to_nexactf;
  925. __be32 r_caps_to_nethctrl;
  926. __be16 nricq;
  927. __be16 nriqp;
  928. __be32 r4;
  929. };
  930. #define FW_PFVF_CMD_PFN(x) ((x) << 8)
  931. #define FW_PFVF_CMD_VFN(x) ((x) << 0)
  932. #define FW_PFVF_CMD_NIQFLINT(x) ((x) << 20)
  933. #define FW_PFVF_CMD_NIQFLINT_GET(x) (((x) >> 20) & 0xfff)
  934. #define FW_PFVF_CMD_NIQ(x) ((x) << 0)
  935. #define FW_PFVF_CMD_NIQ_GET(x) (((x) >> 0) & 0xfffff)
  936. #define FW_PFVF_CMD_TYPE (1 << 31)
  937. #define FW_PFVF_CMD_TYPE_GET(x) (((x) >> 31) & 0x1)
  938. #define FW_PFVF_CMD_CMASK(x) ((x) << 24)
  939. #define FW_PFVF_CMD_CMASK_MASK 0xf
  940. #define FW_PFVF_CMD_CMASK_GET(x) (((x) >> 24) & FW_PFVF_CMD_CMASK_MASK)
  941. #define FW_PFVF_CMD_PMASK(x) ((x) << 20)
  942. #define FW_PFVF_CMD_PMASK_MASK 0xf
  943. #define FW_PFVF_CMD_PMASK_GET(x) (((x) >> 20) & FW_PFVF_CMD_PMASK_MASK)
  944. #define FW_PFVF_CMD_NEQ(x) ((x) << 0)
  945. #define FW_PFVF_CMD_NEQ_GET(x) (((x) >> 0) & 0xfffff)
  946. #define FW_PFVF_CMD_TC(x) ((x) << 24)
  947. #define FW_PFVF_CMD_TC_GET(x) (((x) >> 24) & 0xff)
  948. #define FW_PFVF_CMD_NVI(x) ((x) << 16)
  949. #define FW_PFVF_CMD_NVI_GET(x) (((x) >> 16) & 0xff)
  950. #define FW_PFVF_CMD_NEXACTF(x) ((x) << 0)
  951. #define FW_PFVF_CMD_NEXACTF_GET(x) (((x) >> 0) & 0xffff)
  952. #define FW_PFVF_CMD_R_CAPS(x) ((x) << 24)
  953. #define FW_PFVF_CMD_R_CAPS_GET(x) (((x) >> 24) & 0xff)
  954. #define FW_PFVF_CMD_WX_CAPS(x) ((x) << 16)
  955. #define FW_PFVF_CMD_WX_CAPS_GET(x) (((x) >> 16) & 0xff)
  956. #define FW_PFVF_CMD_NETHCTRL(x) ((x) << 0)
  957. #define FW_PFVF_CMD_NETHCTRL_GET(x) (((x) >> 0) & 0xffff)
  958. enum fw_iq_type {
  959. FW_IQ_TYPE_FL_INT_CAP,
  960. FW_IQ_TYPE_NO_FL_INT_CAP
  961. };
  962. struct fw_iq_cmd {
  963. __be32 op_to_vfn;
  964. __be32 alloc_to_len16;
  965. __be16 physiqid;
  966. __be16 iqid;
  967. __be16 fl0id;
  968. __be16 fl1id;
  969. __be32 type_to_iqandstindex;
  970. __be16 iqdroprss_to_iqesize;
  971. __be16 iqsize;
  972. __be64 iqaddr;
  973. __be32 iqns_to_fl0congen;
  974. __be16 fl0dcaen_to_fl0cidxfthresh;
  975. __be16 fl0size;
  976. __be64 fl0addr;
  977. __be32 fl1cngchmap_to_fl1congen;
  978. __be16 fl1dcaen_to_fl1cidxfthresh;
  979. __be16 fl1size;
  980. __be64 fl1addr;
  981. };
  982. #define FW_IQ_CMD_PFN(x) ((x) << 8)
  983. #define FW_IQ_CMD_VFN(x) ((x) << 0)
  984. #define FW_IQ_CMD_ALLOC (1U << 31)
  985. #define FW_IQ_CMD_FREE (1U << 30)
  986. #define FW_IQ_CMD_MODIFY (1U << 29)
  987. #define FW_IQ_CMD_IQSTART(x) ((x) << 28)
  988. #define FW_IQ_CMD_IQSTOP(x) ((x) << 27)
  989. #define FW_IQ_CMD_TYPE(x) ((x) << 29)
  990. #define FW_IQ_CMD_IQASYNCH(x) ((x) << 28)
  991. #define FW_IQ_CMD_VIID(x) ((x) << 16)
  992. #define FW_IQ_CMD_IQANDST(x) ((x) << 15)
  993. #define FW_IQ_CMD_IQANUS(x) ((x) << 14)
  994. #define FW_IQ_CMD_IQANUD(x) ((x) << 12)
  995. #define FW_IQ_CMD_IQANDSTINDEX(x) ((x) << 0)
  996. #define FW_IQ_CMD_IQDROPRSS (1U << 15)
  997. #define FW_IQ_CMD_IQGTSMODE (1U << 14)
  998. #define FW_IQ_CMD_IQPCIECH(x) ((x) << 12)
  999. #define FW_IQ_CMD_IQDCAEN(x) ((x) << 11)
  1000. #define FW_IQ_CMD_IQDCACPU(x) ((x) << 6)
  1001. #define FW_IQ_CMD_IQINTCNTTHRESH(x) ((x) << 4)
  1002. #define FW_IQ_CMD_IQO (1U << 3)
  1003. #define FW_IQ_CMD_IQCPRIO(x) ((x) << 2)
  1004. #define FW_IQ_CMD_IQESIZE(x) ((x) << 0)
  1005. #define FW_IQ_CMD_IQNS(x) ((x) << 31)
  1006. #define FW_IQ_CMD_IQRO(x) ((x) << 30)
  1007. #define FW_IQ_CMD_IQFLINTIQHSEN(x) ((x) << 28)
  1008. #define FW_IQ_CMD_IQFLINTCONGEN(x) ((x) << 27)
  1009. #define FW_IQ_CMD_IQFLINTISCSIC(x) ((x) << 26)
  1010. #define FW_IQ_CMD_FL0CNGCHMAP(x) ((x) << 20)
  1011. #define FW_IQ_CMD_FL0CACHELOCK(x) ((x) << 15)
  1012. #define FW_IQ_CMD_FL0DBP(x) ((x) << 14)
  1013. #define FW_IQ_CMD_FL0DATANS(x) ((x) << 13)
  1014. #define FW_IQ_CMD_FL0DATARO(x) ((x) << 12)
  1015. #define FW_IQ_CMD_FL0CONGCIF(x) ((x) << 11)
  1016. #define FW_IQ_CMD_FL0ONCHIP(x) ((x) << 10)
  1017. #define FW_IQ_CMD_FL0STATUSPGNS(x) ((x) << 9)
  1018. #define FW_IQ_CMD_FL0STATUSPGRO(x) ((x) << 8)
  1019. #define FW_IQ_CMD_FL0FETCHNS(x) ((x) << 7)
  1020. #define FW_IQ_CMD_FL0FETCHRO(x) ((x) << 6)
  1021. #define FW_IQ_CMD_FL0HOSTFCMODE(x) ((x) << 4)
  1022. #define FW_IQ_CMD_FL0CPRIO(x) ((x) << 3)
  1023. #define FW_IQ_CMD_FL0PADEN(x) ((x) << 2)
  1024. #define FW_IQ_CMD_FL0PACKEN(x) ((x) << 1)
  1025. #define FW_IQ_CMD_FL0CONGEN (1U << 0)
  1026. #define FW_IQ_CMD_FL0DCAEN(x) ((x) << 15)
  1027. #define FW_IQ_CMD_FL0DCACPU(x) ((x) << 10)
  1028. #define FW_IQ_CMD_FL0FBMIN(x) ((x) << 7)
  1029. #define FW_IQ_CMD_FL0FBMAX(x) ((x) << 4)
  1030. #define FW_IQ_CMD_FL0CIDXFTHRESHO (1U << 3)
  1031. #define FW_IQ_CMD_FL0CIDXFTHRESH(x) ((x) << 0)
  1032. #define FW_IQ_CMD_FL1CNGCHMAP(x) ((x) << 20)
  1033. #define FW_IQ_CMD_FL1CACHELOCK(x) ((x) << 15)
  1034. #define FW_IQ_CMD_FL1DBP(x) ((x) << 14)
  1035. #define FW_IQ_CMD_FL1DATANS(x) ((x) << 13)
  1036. #define FW_IQ_CMD_FL1DATARO(x) ((x) << 12)
  1037. #define FW_IQ_CMD_FL1CONGCIF(x) ((x) << 11)
  1038. #define FW_IQ_CMD_FL1ONCHIP(x) ((x) << 10)
  1039. #define FW_IQ_CMD_FL1STATUSPGNS(x) ((x) << 9)
  1040. #define FW_IQ_CMD_FL1STATUSPGRO(x) ((x) << 8)
  1041. #define FW_IQ_CMD_FL1FETCHNS(x) ((x) << 7)
  1042. #define FW_IQ_CMD_FL1FETCHRO(x) ((x) << 6)
  1043. #define FW_IQ_CMD_FL1HOSTFCMODE(x) ((x) << 4)
  1044. #define FW_IQ_CMD_FL1CPRIO(x) ((x) << 3)
  1045. #define FW_IQ_CMD_FL1PADEN (1U << 2)
  1046. #define FW_IQ_CMD_FL1PACKEN (1U << 1)
  1047. #define FW_IQ_CMD_FL1CONGEN (1U << 0)
  1048. #define FW_IQ_CMD_FL1DCAEN(x) ((x) << 15)
  1049. #define FW_IQ_CMD_FL1DCACPU(x) ((x) << 10)
  1050. #define FW_IQ_CMD_FL1FBMIN(x) ((x) << 7)
  1051. #define FW_IQ_CMD_FL1FBMAX(x) ((x) << 4)
  1052. #define FW_IQ_CMD_FL1CIDXFTHRESHO (1U << 3)
  1053. #define FW_IQ_CMD_FL1CIDXFTHRESH(x) ((x) << 0)
  1054. struct fw_eq_eth_cmd {
  1055. __be32 op_to_vfn;
  1056. __be32 alloc_to_len16;
  1057. __be32 eqid_pkd;
  1058. __be32 physeqid_pkd;
  1059. __be32 fetchszm_to_iqid;
  1060. __be32 dcaen_to_eqsize;
  1061. __be64 eqaddr;
  1062. __be32 viid_pkd;
  1063. __be32 r8_lo;
  1064. __be64 r9;
  1065. };
  1066. #define FW_EQ_ETH_CMD_PFN(x) ((x) << 8)
  1067. #define FW_EQ_ETH_CMD_VFN(x) ((x) << 0)
  1068. #define FW_EQ_ETH_CMD_ALLOC (1U << 31)
  1069. #define FW_EQ_ETH_CMD_FREE (1U << 30)
  1070. #define FW_EQ_ETH_CMD_MODIFY (1U << 29)
  1071. #define FW_EQ_ETH_CMD_EQSTART (1U << 28)
  1072. #define FW_EQ_ETH_CMD_EQSTOP (1U << 27)
  1073. #define FW_EQ_ETH_CMD_EQID(x) ((x) << 0)
  1074. #define FW_EQ_ETH_CMD_EQID_GET(x) (((x) >> 0) & 0xfffff)
  1075. #define FW_EQ_ETH_CMD_PHYSEQID(x) ((x) << 0)
  1076. #define FW_EQ_ETH_CMD_PHYSEQID_GET(x) (((x) >> 0) & 0xfffff)
  1077. #define FW_EQ_ETH_CMD_FETCHSZM(x) ((x) << 26)
  1078. #define FW_EQ_ETH_CMD_STATUSPGNS(x) ((x) << 25)
  1079. #define FW_EQ_ETH_CMD_STATUSPGRO(x) ((x) << 24)
  1080. #define FW_EQ_ETH_CMD_FETCHNS(x) ((x) << 23)
  1081. #define FW_EQ_ETH_CMD_FETCHRO(x) ((x) << 22)
  1082. #define FW_EQ_ETH_CMD_HOSTFCMODE(x) ((x) << 20)
  1083. #define FW_EQ_ETH_CMD_CPRIO(x) ((x) << 19)
  1084. #define FW_EQ_ETH_CMD_ONCHIP(x) ((x) << 18)
  1085. #define FW_EQ_ETH_CMD_PCIECHN(x) ((x) << 16)
  1086. #define FW_EQ_ETH_CMD_IQID(x) ((x) << 0)
  1087. #define FW_EQ_ETH_CMD_DCAEN(x) ((x) << 31)
  1088. #define FW_EQ_ETH_CMD_DCACPU(x) ((x) << 26)
  1089. #define FW_EQ_ETH_CMD_FBMIN(x) ((x) << 23)
  1090. #define FW_EQ_ETH_CMD_FBMAX(x) ((x) << 20)
  1091. #define FW_EQ_ETH_CMD_CIDXFTHRESHO(x) ((x) << 19)
  1092. #define FW_EQ_ETH_CMD_CIDXFTHRESH(x) ((x) << 16)
  1093. #define FW_EQ_ETH_CMD_EQSIZE(x) ((x) << 0)
  1094. #define FW_EQ_ETH_CMD_VIID(x) ((x) << 16)
  1095. struct fw_eq_ctrl_cmd {
  1096. __be32 op_to_vfn;
  1097. __be32 alloc_to_len16;
  1098. __be32 cmpliqid_eqid;
  1099. __be32 physeqid_pkd;
  1100. __be32 fetchszm_to_iqid;
  1101. __be32 dcaen_to_eqsize;
  1102. __be64 eqaddr;
  1103. };
  1104. #define FW_EQ_CTRL_CMD_PFN(x) ((x) << 8)
  1105. #define FW_EQ_CTRL_CMD_VFN(x) ((x) << 0)
  1106. #define FW_EQ_CTRL_CMD_ALLOC (1U << 31)
  1107. #define FW_EQ_CTRL_CMD_FREE (1U << 30)
  1108. #define FW_EQ_CTRL_CMD_MODIFY (1U << 29)
  1109. #define FW_EQ_CTRL_CMD_EQSTART (1U << 28)
  1110. #define FW_EQ_CTRL_CMD_EQSTOP (1U << 27)
  1111. #define FW_EQ_CTRL_CMD_CMPLIQID(x) ((x) << 20)
  1112. #define FW_EQ_CTRL_CMD_EQID(x) ((x) << 0)
  1113. #define FW_EQ_CTRL_CMD_EQID_GET(x) (((x) >> 0) & 0xfffff)
  1114. #define FW_EQ_CTRL_CMD_PHYSEQID_GET(x) (((x) >> 0) & 0xfffff)
  1115. #define FW_EQ_CTRL_CMD_FETCHSZM (1U << 26)
  1116. #define FW_EQ_CTRL_CMD_STATUSPGNS (1U << 25)
  1117. #define FW_EQ_CTRL_CMD_STATUSPGRO (1U << 24)
  1118. #define FW_EQ_CTRL_CMD_FETCHNS (1U << 23)
  1119. #define FW_EQ_CTRL_CMD_FETCHRO (1U << 22)
  1120. #define FW_EQ_CTRL_CMD_HOSTFCMODE(x) ((x) << 20)
  1121. #define FW_EQ_CTRL_CMD_CPRIO(x) ((x) << 19)
  1122. #define FW_EQ_CTRL_CMD_ONCHIP(x) ((x) << 18)
  1123. #define FW_EQ_CTRL_CMD_PCIECHN(x) ((x) << 16)
  1124. #define FW_EQ_CTRL_CMD_IQID(x) ((x) << 0)
  1125. #define FW_EQ_CTRL_CMD_DCAEN(x) ((x) << 31)
  1126. #define FW_EQ_CTRL_CMD_DCACPU(x) ((x) << 26)
  1127. #define FW_EQ_CTRL_CMD_FBMIN(x) ((x) << 23)
  1128. #define FW_EQ_CTRL_CMD_FBMAX(x) ((x) << 20)
  1129. #define FW_EQ_CTRL_CMD_CIDXFTHRESHO(x) ((x) << 19)
  1130. #define FW_EQ_CTRL_CMD_CIDXFTHRESH(x) ((x) << 16)
  1131. #define FW_EQ_CTRL_CMD_EQSIZE(x) ((x) << 0)
  1132. struct fw_eq_ofld_cmd {
  1133. __be32 op_to_vfn;
  1134. __be32 alloc_to_len16;
  1135. __be32 eqid_pkd;
  1136. __be32 physeqid_pkd;
  1137. __be32 fetchszm_to_iqid;
  1138. __be32 dcaen_to_eqsize;
  1139. __be64 eqaddr;
  1140. };
  1141. #define FW_EQ_OFLD_CMD_PFN(x) ((x) << 8)
  1142. #define FW_EQ_OFLD_CMD_VFN(x) ((x) << 0)
  1143. #define FW_EQ_OFLD_CMD_ALLOC (1U << 31)
  1144. #define FW_EQ_OFLD_CMD_FREE (1U << 30)
  1145. #define FW_EQ_OFLD_CMD_MODIFY (1U << 29)
  1146. #define FW_EQ_OFLD_CMD_EQSTART (1U << 28)
  1147. #define FW_EQ_OFLD_CMD_EQSTOP (1U << 27)
  1148. #define FW_EQ_OFLD_CMD_EQID(x) ((x) << 0)
  1149. #define FW_EQ_OFLD_CMD_EQID_GET(x) (((x) >> 0) & 0xfffff)
  1150. #define FW_EQ_OFLD_CMD_PHYSEQID_GET(x) (((x) >> 0) & 0xfffff)
  1151. #define FW_EQ_OFLD_CMD_FETCHSZM(x) ((x) << 26)
  1152. #define FW_EQ_OFLD_CMD_STATUSPGNS(x) ((x) << 25)
  1153. #define FW_EQ_OFLD_CMD_STATUSPGRO(x) ((x) << 24)
  1154. #define FW_EQ_OFLD_CMD_FETCHNS(x) ((x) << 23)
  1155. #define FW_EQ_OFLD_CMD_FETCHRO(x) ((x) << 22)
  1156. #define FW_EQ_OFLD_CMD_HOSTFCMODE(x) ((x) << 20)
  1157. #define FW_EQ_OFLD_CMD_CPRIO(x) ((x) << 19)
  1158. #define FW_EQ_OFLD_CMD_ONCHIP(x) ((x) << 18)
  1159. #define FW_EQ_OFLD_CMD_PCIECHN(x) ((x) << 16)
  1160. #define FW_EQ_OFLD_CMD_IQID(x) ((x) << 0)
  1161. #define FW_EQ_OFLD_CMD_DCAEN(x) ((x) << 31)
  1162. #define FW_EQ_OFLD_CMD_DCACPU(x) ((x) << 26)
  1163. #define FW_EQ_OFLD_CMD_FBMIN(x) ((x) << 23)
  1164. #define FW_EQ_OFLD_CMD_FBMAX(x) ((x) << 20)
  1165. #define FW_EQ_OFLD_CMD_CIDXFTHRESHO(x) ((x) << 19)
  1166. #define FW_EQ_OFLD_CMD_CIDXFTHRESH(x) ((x) << 16)
  1167. #define FW_EQ_OFLD_CMD_EQSIZE(x) ((x) << 0)
  1168. /*
  1169. * Macros for VIID parsing:
  1170. * VIID - [10:8] PFN, [7] VI Valid, [6:0] VI number
  1171. */
  1172. #define FW_VIID_PFN_GET(x) (((x) >> 8) & 0x7)
  1173. #define FW_VIID_VIVLD_GET(x) (((x) >> 7) & 0x1)
  1174. #define FW_VIID_VIN_GET(x) (((x) >> 0) & 0x7F)
  1175. struct fw_vi_cmd {
  1176. __be32 op_to_vfn;
  1177. __be32 alloc_to_len16;
  1178. __be16 type_viid;
  1179. u8 mac[6];
  1180. u8 portid_pkd;
  1181. u8 nmac;
  1182. u8 nmac0[6];
  1183. __be16 rsssize_pkd;
  1184. u8 nmac1[6];
  1185. __be16 idsiiq_pkd;
  1186. u8 nmac2[6];
  1187. __be16 idseiq_pkd;
  1188. u8 nmac3[6];
  1189. __be64 r9;
  1190. __be64 r10;
  1191. };
  1192. #define FW_VI_CMD_PFN(x) ((x) << 8)
  1193. #define FW_VI_CMD_VFN(x) ((x) << 0)
  1194. #define FW_VI_CMD_ALLOC (1U << 31)
  1195. #define FW_VI_CMD_FREE (1U << 30)
  1196. #define FW_VI_CMD_VIID(x) ((x) << 0)
  1197. #define FW_VI_CMD_VIID_GET(x) ((x) & 0xfff)
  1198. #define FW_VI_CMD_PORTID(x) ((x) << 4)
  1199. #define FW_VI_CMD_PORTID_GET(x) (((x) >> 4) & 0xf)
  1200. #define FW_VI_CMD_RSSSIZE_GET(x) (((x) >> 0) & 0x7ff)
  1201. /* Special VI_MAC command index ids */
  1202. #define FW_VI_MAC_ADD_MAC 0x3FF
  1203. #define FW_VI_MAC_ADD_PERSIST_MAC 0x3FE
  1204. #define FW_VI_MAC_MAC_BASED_FREE 0x3FD
  1205. #define FW_CLS_TCAM_NUM_ENTRIES 336
  1206. enum fw_vi_mac_smac {
  1207. FW_VI_MAC_MPS_TCAM_ENTRY,
  1208. FW_VI_MAC_MPS_TCAM_ONLY,
  1209. FW_VI_MAC_SMT_ONLY,
  1210. FW_VI_MAC_SMT_AND_MPSTCAM
  1211. };
  1212. enum fw_vi_mac_result {
  1213. FW_VI_MAC_R_SUCCESS,
  1214. FW_VI_MAC_R_F_NONEXISTENT_NOMEM,
  1215. FW_VI_MAC_R_SMAC_FAIL,
  1216. FW_VI_MAC_R_F_ACL_CHECK
  1217. };
  1218. struct fw_vi_mac_cmd {
  1219. __be32 op_to_viid;
  1220. __be32 freemacs_to_len16;
  1221. union fw_vi_mac {
  1222. struct fw_vi_mac_exact {
  1223. __be16 valid_to_idx;
  1224. u8 macaddr[6];
  1225. } exact[7];
  1226. struct fw_vi_mac_hash {
  1227. __be64 hashvec;
  1228. } hash;
  1229. } u;
  1230. };
  1231. #define FW_VI_MAC_CMD_VIID(x) ((x) << 0)
  1232. #define FW_VI_MAC_CMD_FREEMACS(x) ((x) << 31)
  1233. #define FW_VI_MAC_CMD_HASHVECEN (1U << 23)
  1234. #define FW_VI_MAC_CMD_HASHUNIEN(x) ((x) << 22)
  1235. #define FW_VI_MAC_CMD_VALID (1U << 15)
  1236. #define FW_VI_MAC_CMD_PRIO(x) ((x) << 12)
  1237. #define FW_VI_MAC_CMD_SMAC_RESULT(x) ((x) << 10)
  1238. #define FW_VI_MAC_CMD_SMAC_RESULT_GET(x) (((x) >> 10) & 0x3)
  1239. #define FW_VI_MAC_CMD_IDX(x) ((x) << 0)
  1240. #define FW_VI_MAC_CMD_IDX_GET(x) (((x) >> 0) & 0x3ff)
  1241. #define FW_RXMODE_MTU_NO_CHG 65535
  1242. struct fw_vi_rxmode_cmd {
  1243. __be32 op_to_viid;
  1244. __be32 retval_len16;
  1245. __be32 mtu_to_vlanexen;
  1246. __be32 r4_lo;
  1247. };
  1248. #define FW_VI_RXMODE_CMD_VIID(x) ((x) << 0)
  1249. #define FW_VI_RXMODE_CMD_MTU_MASK 0xffff
  1250. #define FW_VI_RXMODE_CMD_MTU(x) ((x) << 16)
  1251. #define FW_VI_RXMODE_CMD_PROMISCEN_MASK 0x3
  1252. #define FW_VI_RXMODE_CMD_PROMISCEN(x) ((x) << 14)
  1253. #define FW_VI_RXMODE_CMD_ALLMULTIEN_MASK 0x3
  1254. #define FW_VI_RXMODE_CMD_ALLMULTIEN(x) ((x) << 12)
  1255. #define FW_VI_RXMODE_CMD_BROADCASTEN_MASK 0x3
  1256. #define FW_VI_RXMODE_CMD_BROADCASTEN(x) ((x) << 10)
  1257. #define FW_VI_RXMODE_CMD_VLANEXEN_MASK 0x3
  1258. #define FW_VI_RXMODE_CMD_VLANEXEN(x) ((x) << 8)
  1259. struct fw_vi_enable_cmd {
  1260. __be32 op_to_viid;
  1261. __be32 ien_to_len16;
  1262. __be16 blinkdur;
  1263. __be16 r3;
  1264. __be32 r4;
  1265. };
  1266. #define FW_VI_ENABLE_CMD_VIID(x) ((x) << 0)
  1267. #define FW_VI_ENABLE_CMD_IEN(x) ((x) << 31)
  1268. #define FW_VI_ENABLE_CMD_EEN(x) ((x) << 30)
  1269. #define FW_VI_ENABLE_CMD_LED (1U << 29)
  1270. /* VI VF stats offset definitions */
  1271. #define VI_VF_NUM_STATS 16
  1272. enum fw_vi_stats_vf_index {
  1273. FW_VI_VF_STAT_TX_BCAST_BYTES_IX,
  1274. FW_VI_VF_STAT_TX_BCAST_FRAMES_IX,
  1275. FW_VI_VF_STAT_TX_MCAST_BYTES_IX,
  1276. FW_VI_VF_STAT_TX_MCAST_FRAMES_IX,
  1277. FW_VI_VF_STAT_TX_UCAST_BYTES_IX,
  1278. FW_VI_VF_STAT_TX_UCAST_FRAMES_IX,
  1279. FW_VI_VF_STAT_TX_DROP_FRAMES_IX,
  1280. FW_VI_VF_STAT_TX_OFLD_BYTES_IX,
  1281. FW_VI_VF_STAT_TX_OFLD_FRAMES_IX,
  1282. FW_VI_VF_STAT_RX_BCAST_BYTES_IX,
  1283. FW_VI_VF_STAT_RX_BCAST_FRAMES_IX,
  1284. FW_VI_VF_STAT_RX_MCAST_BYTES_IX,
  1285. FW_VI_VF_STAT_RX_MCAST_FRAMES_IX,
  1286. FW_VI_VF_STAT_RX_UCAST_BYTES_IX,
  1287. FW_VI_VF_STAT_RX_UCAST_FRAMES_IX,
  1288. FW_VI_VF_STAT_RX_ERR_FRAMES_IX
  1289. };
  1290. /* VI PF stats offset definitions */
  1291. #define VI_PF_NUM_STATS 17
  1292. enum fw_vi_stats_pf_index {
  1293. FW_VI_PF_STAT_TX_BCAST_BYTES_IX,
  1294. FW_VI_PF_STAT_TX_BCAST_FRAMES_IX,
  1295. FW_VI_PF_STAT_TX_MCAST_BYTES_IX,
  1296. FW_VI_PF_STAT_TX_MCAST_FRAMES_IX,
  1297. FW_VI_PF_STAT_TX_UCAST_BYTES_IX,
  1298. FW_VI_PF_STAT_TX_UCAST_FRAMES_IX,
  1299. FW_VI_PF_STAT_TX_OFLD_BYTES_IX,
  1300. FW_VI_PF_STAT_TX_OFLD_FRAMES_IX,
  1301. FW_VI_PF_STAT_RX_BYTES_IX,
  1302. FW_VI_PF_STAT_RX_FRAMES_IX,
  1303. FW_VI_PF_STAT_RX_BCAST_BYTES_IX,
  1304. FW_VI_PF_STAT_RX_BCAST_FRAMES_IX,
  1305. FW_VI_PF_STAT_RX_MCAST_BYTES_IX,
  1306. FW_VI_PF_STAT_RX_MCAST_FRAMES_IX,
  1307. FW_VI_PF_STAT_RX_UCAST_BYTES_IX,
  1308. FW_VI_PF_STAT_RX_UCAST_FRAMES_IX,
  1309. FW_VI_PF_STAT_RX_ERR_FRAMES_IX
  1310. };
  1311. struct fw_vi_stats_cmd {
  1312. __be32 op_to_viid;
  1313. __be32 retval_len16;
  1314. union fw_vi_stats {
  1315. struct fw_vi_stats_ctl {
  1316. __be16 nstats_ix;
  1317. __be16 r6;
  1318. __be32 r7;
  1319. __be64 stat0;
  1320. __be64 stat1;
  1321. __be64 stat2;
  1322. __be64 stat3;
  1323. __be64 stat4;
  1324. __be64 stat5;
  1325. } ctl;
  1326. struct fw_vi_stats_pf {
  1327. __be64 tx_bcast_bytes;
  1328. __be64 tx_bcast_frames;
  1329. __be64 tx_mcast_bytes;
  1330. __be64 tx_mcast_frames;
  1331. __be64 tx_ucast_bytes;
  1332. __be64 tx_ucast_frames;
  1333. __be64 tx_offload_bytes;
  1334. __be64 tx_offload_frames;
  1335. __be64 rx_pf_bytes;
  1336. __be64 rx_pf_frames;
  1337. __be64 rx_bcast_bytes;
  1338. __be64 rx_bcast_frames;
  1339. __be64 rx_mcast_bytes;
  1340. __be64 rx_mcast_frames;
  1341. __be64 rx_ucast_bytes;
  1342. __be64 rx_ucast_frames;
  1343. __be64 rx_err_frames;
  1344. } pf;
  1345. struct fw_vi_stats_vf {
  1346. __be64 tx_bcast_bytes;
  1347. __be64 tx_bcast_frames;
  1348. __be64 tx_mcast_bytes;
  1349. __be64 tx_mcast_frames;
  1350. __be64 tx_ucast_bytes;
  1351. __be64 tx_ucast_frames;
  1352. __be64 tx_drop_frames;
  1353. __be64 tx_offload_bytes;
  1354. __be64 tx_offload_frames;
  1355. __be64 rx_bcast_bytes;
  1356. __be64 rx_bcast_frames;
  1357. __be64 rx_mcast_bytes;
  1358. __be64 rx_mcast_frames;
  1359. __be64 rx_ucast_bytes;
  1360. __be64 rx_ucast_frames;
  1361. __be64 rx_err_frames;
  1362. } vf;
  1363. } u;
  1364. };
  1365. #define FW_VI_STATS_CMD_VIID(x) ((x) << 0)
  1366. #define FW_VI_STATS_CMD_NSTATS(x) ((x) << 12)
  1367. #define FW_VI_STATS_CMD_IX(x) ((x) << 0)
  1368. struct fw_acl_mac_cmd {
  1369. __be32 op_to_vfn;
  1370. __be32 en_to_len16;
  1371. u8 nmac;
  1372. u8 r3[7];
  1373. __be16 r4;
  1374. u8 macaddr0[6];
  1375. __be16 r5;
  1376. u8 macaddr1[6];
  1377. __be16 r6;
  1378. u8 macaddr2[6];
  1379. __be16 r7;
  1380. u8 macaddr3[6];
  1381. };
  1382. #define FW_ACL_MAC_CMD_PFN(x) ((x) << 8)
  1383. #define FW_ACL_MAC_CMD_VFN(x) ((x) << 0)
  1384. #define FW_ACL_MAC_CMD_EN(x) ((x) << 31)
  1385. struct fw_acl_vlan_cmd {
  1386. __be32 op_to_vfn;
  1387. __be32 en_to_len16;
  1388. u8 nvlan;
  1389. u8 dropnovlan_fm;
  1390. u8 r3_lo[6];
  1391. __be16 vlanid[16];
  1392. };
  1393. #define FW_ACL_VLAN_CMD_PFN(x) ((x) << 8)
  1394. #define FW_ACL_VLAN_CMD_VFN(x) ((x) << 0)
  1395. #define FW_ACL_VLAN_CMD_EN(x) ((x) << 31)
  1396. #define FW_ACL_VLAN_CMD_DROPNOVLAN(x) ((x) << 7)
  1397. #define FW_ACL_VLAN_CMD_FM(x) ((x) << 6)
  1398. enum fw_port_cap {
  1399. FW_PORT_CAP_SPEED_100M = 0x0001,
  1400. FW_PORT_CAP_SPEED_1G = 0x0002,
  1401. FW_PORT_CAP_SPEED_2_5G = 0x0004,
  1402. FW_PORT_CAP_SPEED_10G = 0x0008,
  1403. FW_PORT_CAP_SPEED_40G = 0x0010,
  1404. FW_PORT_CAP_SPEED_100G = 0x0020,
  1405. FW_PORT_CAP_FC_RX = 0x0040,
  1406. FW_PORT_CAP_FC_TX = 0x0080,
  1407. FW_PORT_CAP_ANEG = 0x0100,
  1408. FW_PORT_CAP_MDI_0 = 0x0200,
  1409. FW_PORT_CAP_MDI_1 = 0x0400,
  1410. FW_PORT_CAP_BEAN = 0x0800,
  1411. FW_PORT_CAP_PMA_LPBK = 0x1000,
  1412. FW_PORT_CAP_PCS_LPBK = 0x2000,
  1413. FW_PORT_CAP_PHYXS_LPBK = 0x4000,
  1414. FW_PORT_CAP_FAR_END_LPBK = 0x8000,
  1415. };
  1416. enum fw_port_mdi {
  1417. FW_PORT_MDI_UNCHANGED,
  1418. FW_PORT_MDI_AUTO,
  1419. FW_PORT_MDI_F_STRAIGHT,
  1420. FW_PORT_MDI_F_CROSSOVER
  1421. };
  1422. #define FW_PORT_MDI(x) ((x) << 9)
  1423. enum fw_port_action {
  1424. FW_PORT_ACTION_L1_CFG = 0x0001,
  1425. FW_PORT_ACTION_L2_CFG = 0x0002,
  1426. FW_PORT_ACTION_GET_PORT_INFO = 0x0003,
  1427. FW_PORT_ACTION_L2_PPP_CFG = 0x0004,
  1428. FW_PORT_ACTION_L2_DCB_CFG = 0x0005,
  1429. FW_PORT_ACTION_LOW_PWR_TO_NORMAL = 0x0010,
  1430. FW_PORT_ACTION_L1_LOW_PWR_EN = 0x0011,
  1431. FW_PORT_ACTION_L2_WOL_MODE_EN = 0x0012,
  1432. FW_PORT_ACTION_LPBK_TO_NORMAL = 0x0020,
  1433. FW_PORT_ACTION_L1_LPBK = 0x0021,
  1434. FW_PORT_ACTION_L1_PMA_LPBK = 0x0022,
  1435. FW_PORT_ACTION_L1_PCS_LPBK = 0x0023,
  1436. FW_PORT_ACTION_L1_PHYXS_CSIDE_LPBK = 0x0024,
  1437. FW_PORT_ACTION_L1_PHYXS_ESIDE_LPBK = 0x0025,
  1438. FW_PORT_ACTION_PHY_RESET = 0x0040,
  1439. FW_PORT_ACTION_PMA_RESET = 0x0041,
  1440. FW_PORT_ACTION_PCS_RESET = 0x0042,
  1441. FW_PORT_ACTION_PHYXS_RESET = 0x0043,
  1442. FW_PORT_ACTION_DTEXS_REEST = 0x0044,
  1443. FW_PORT_ACTION_AN_RESET = 0x0045
  1444. };
  1445. enum fw_port_l2cfg_ctlbf {
  1446. FW_PORT_L2_CTLBF_OVLAN0 = 0x01,
  1447. FW_PORT_L2_CTLBF_OVLAN1 = 0x02,
  1448. FW_PORT_L2_CTLBF_OVLAN2 = 0x04,
  1449. FW_PORT_L2_CTLBF_OVLAN3 = 0x08,
  1450. FW_PORT_L2_CTLBF_IVLAN = 0x10,
  1451. FW_PORT_L2_CTLBF_TXIPG = 0x20
  1452. };
  1453. enum fw_port_dcb_cfg {
  1454. FW_PORT_DCB_CFG_PG = 0x01,
  1455. FW_PORT_DCB_CFG_PFC = 0x02,
  1456. FW_PORT_DCB_CFG_APPL = 0x04
  1457. };
  1458. enum fw_port_dcb_cfg_rc {
  1459. FW_PORT_DCB_CFG_SUCCESS = 0x0,
  1460. FW_PORT_DCB_CFG_ERROR = 0x1
  1461. };
  1462. enum fw_port_dcb_type {
  1463. FW_PORT_DCB_TYPE_PGID = 0x00,
  1464. FW_PORT_DCB_TYPE_PGRATE = 0x01,
  1465. FW_PORT_DCB_TYPE_PRIORATE = 0x02,
  1466. FW_PORT_DCB_TYPE_PFC = 0x03,
  1467. FW_PORT_DCB_TYPE_APP_ID = 0x04,
  1468. };
  1469. struct fw_port_cmd {
  1470. __be32 op_to_portid;
  1471. __be32 action_to_len16;
  1472. union fw_port {
  1473. struct fw_port_l1cfg {
  1474. __be32 rcap;
  1475. __be32 r;
  1476. } l1cfg;
  1477. struct fw_port_l2cfg {
  1478. __be16 ctlbf_to_ivlan0;
  1479. __be16 ivlantype;
  1480. __be32 txipg_pkd;
  1481. __be16 ovlan0mask;
  1482. __be16 ovlan0type;
  1483. __be16 ovlan1mask;
  1484. __be16 ovlan1type;
  1485. __be16 ovlan2mask;
  1486. __be16 ovlan2type;
  1487. __be16 ovlan3mask;
  1488. __be16 ovlan3type;
  1489. } l2cfg;
  1490. struct fw_port_info {
  1491. __be32 lstatus_to_modtype;
  1492. __be16 pcap;
  1493. __be16 acap;
  1494. __be16 mtu;
  1495. __u8 cbllen;
  1496. __u8 r9;
  1497. __be32 r10;
  1498. __be64 r11;
  1499. } info;
  1500. struct fw_port_ppp {
  1501. __be32 pppen_to_ncsich;
  1502. __be32 r11;
  1503. } ppp;
  1504. struct fw_port_dcb {
  1505. __be16 cfg;
  1506. u8 up_map;
  1507. u8 sf_cfgrc;
  1508. __be16 prot_ix;
  1509. u8 pe7_to_pe0;
  1510. u8 numTCPFCs;
  1511. __be32 pgid0_to_pgid7;
  1512. __be32 numTCs_oui;
  1513. u8 pgpc[8];
  1514. } dcb;
  1515. } u;
  1516. };
  1517. #define FW_PORT_CMD_READ (1U << 22)
  1518. #define FW_PORT_CMD_PORTID(x) ((x) << 0)
  1519. #define FW_PORT_CMD_PORTID_GET(x) (((x) >> 0) & 0xf)
  1520. #define FW_PORT_CMD_ACTION(x) ((x) << 16)
  1521. #define FW_PORT_CMD_ACTION_GET(x) (((x) >> 16) & 0xffff)
  1522. #define FW_PORT_CMD_CTLBF(x) ((x) << 10)
  1523. #define FW_PORT_CMD_OVLAN3(x) ((x) << 7)
  1524. #define FW_PORT_CMD_OVLAN2(x) ((x) << 6)
  1525. #define FW_PORT_CMD_OVLAN1(x) ((x) << 5)
  1526. #define FW_PORT_CMD_OVLAN0(x) ((x) << 4)
  1527. #define FW_PORT_CMD_IVLAN0(x) ((x) << 3)
  1528. #define FW_PORT_CMD_TXIPG(x) ((x) << 19)
  1529. #define FW_PORT_CMD_LSTATUS (1U << 31)
  1530. #define FW_PORT_CMD_LSTATUS_GET(x) (((x) >> 31) & 0x1)
  1531. #define FW_PORT_CMD_LSPEED(x) ((x) << 24)
  1532. #define FW_PORT_CMD_LSPEED_GET(x) (((x) >> 24) & 0x3f)
  1533. #define FW_PORT_CMD_TXPAUSE (1U << 23)
  1534. #define FW_PORT_CMD_RXPAUSE (1U << 22)
  1535. #define FW_PORT_CMD_MDIOCAP (1U << 21)
  1536. #define FW_PORT_CMD_MDIOADDR_GET(x) (((x) >> 16) & 0x1f)
  1537. #define FW_PORT_CMD_LPTXPAUSE (1U << 15)
  1538. #define FW_PORT_CMD_LPRXPAUSE (1U << 14)
  1539. #define FW_PORT_CMD_PTYPE_MASK 0x1f
  1540. #define FW_PORT_CMD_PTYPE_GET(x) (((x) >> 8) & FW_PORT_CMD_PTYPE_MASK)
  1541. #define FW_PORT_CMD_MODTYPE_MASK 0x1f
  1542. #define FW_PORT_CMD_MODTYPE_GET(x) (((x) >> 0) & FW_PORT_CMD_MODTYPE_MASK)
  1543. #define FW_PORT_CMD_PPPEN(x) ((x) << 31)
  1544. #define FW_PORT_CMD_TPSRC(x) ((x) << 28)
  1545. #define FW_PORT_CMD_NCSISRC(x) ((x) << 24)
  1546. #define FW_PORT_CMD_CH0(x) ((x) << 20)
  1547. #define FW_PORT_CMD_CH1(x) ((x) << 16)
  1548. #define FW_PORT_CMD_CH2(x) ((x) << 12)
  1549. #define FW_PORT_CMD_CH3(x) ((x) << 8)
  1550. #define FW_PORT_CMD_NCSICH(x) ((x) << 4)
  1551. enum fw_port_type {
  1552. FW_PORT_TYPE_FIBER_XFI,
  1553. FW_PORT_TYPE_FIBER_XAUI,
  1554. FW_PORT_TYPE_BT_SGMII,
  1555. FW_PORT_TYPE_BT_XFI,
  1556. FW_PORT_TYPE_BT_XAUI,
  1557. FW_PORT_TYPE_KX4,
  1558. FW_PORT_TYPE_CX4,
  1559. FW_PORT_TYPE_KX,
  1560. FW_PORT_TYPE_KR,
  1561. FW_PORT_TYPE_SFP,
  1562. FW_PORT_TYPE_BP_AP,
  1563. FW_PORT_TYPE_BP4_AP,
  1564. FW_PORT_TYPE_NONE = FW_PORT_CMD_PTYPE_MASK
  1565. };
  1566. enum fw_port_module_type {
  1567. FW_PORT_MOD_TYPE_NA,
  1568. FW_PORT_MOD_TYPE_LR,
  1569. FW_PORT_MOD_TYPE_SR,
  1570. FW_PORT_MOD_TYPE_ER,
  1571. FW_PORT_MOD_TYPE_TWINAX_PASSIVE,
  1572. FW_PORT_MOD_TYPE_TWINAX_ACTIVE,
  1573. FW_PORT_MOD_TYPE_LRM,
  1574. FW_PORT_MOD_TYPE_ERROR = FW_PORT_CMD_MODTYPE_MASK - 3,
  1575. FW_PORT_MOD_TYPE_UNKNOWN = FW_PORT_CMD_MODTYPE_MASK - 2,
  1576. FW_PORT_MOD_TYPE_NOTSUPPORTED = FW_PORT_CMD_MODTYPE_MASK - 1,
  1577. FW_PORT_MOD_TYPE_NONE = FW_PORT_CMD_MODTYPE_MASK
  1578. };
  1579. enum fw_port_mod_sub_type {
  1580. FW_PORT_MOD_SUB_TYPE_NA,
  1581. FW_PORT_MOD_SUB_TYPE_MV88E114X = 0x1,
  1582. FW_PORT_MOD_SUB_TYPE_TN8022 = 0x2,
  1583. FW_PORT_MOD_SUB_TYPE_AQ1202 = 0x3,
  1584. FW_PORT_MOD_SUB_TYPE_88x3120 = 0x4,
  1585. FW_PORT_MOD_SUB_TYPE_BCM84834 = 0x5,
  1586. FW_PORT_MOD_SUB_TYPE_BT_VSC8634 = 0x8,
  1587. /* The following will never been in the VPD. They are TWINAX cable
  1588. * lengths decoded from SFP+ module i2c PROMs. These should
  1589. * almost certainly go somewhere else ...
  1590. */
  1591. FW_PORT_MOD_SUB_TYPE_TWINAX_1 = 0x9,
  1592. FW_PORT_MOD_SUB_TYPE_TWINAX_3 = 0xA,
  1593. FW_PORT_MOD_SUB_TYPE_TWINAX_5 = 0xB,
  1594. FW_PORT_MOD_SUB_TYPE_TWINAX_7 = 0xC,
  1595. };
  1596. /* port stats */
  1597. #define FW_NUM_PORT_STATS 50
  1598. #define FW_NUM_PORT_TX_STATS 23
  1599. #define FW_NUM_PORT_RX_STATS 27
  1600. enum fw_port_stats_tx_index {
  1601. FW_STAT_TX_PORT_BYTES_IX,
  1602. FW_STAT_TX_PORT_FRAMES_IX,
  1603. FW_STAT_TX_PORT_BCAST_IX,
  1604. FW_STAT_TX_PORT_MCAST_IX,
  1605. FW_STAT_TX_PORT_UCAST_IX,
  1606. FW_STAT_TX_PORT_ERROR_IX,
  1607. FW_STAT_TX_PORT_64B_IX,
  1608. FW_STAT_TX_PORT_65B_127B_IX,
  1609. FW_STAT_TX_PORT_128B_255B_IX,
  1610. FW_STAT_TX_PORT_256B_511B_IX,
  1611. FW_STAT_TX_PORT_512B_1023B_IX,
  1612. FW_STAT_TX_PORT_1024B_1518B_IX,
  1613. FW_STAT_TX_PORT_1519B_MAX_IX,
  1614. FW_STAT_TX_PORT_DROP_IX,
  1615. FW_STAT_TX_PORT_PAUSE_IX,
  1616. FW_STAT_TX_PORT_PPP0_IX,
  1617. FW_STAT_TX_PORT_PPP1_IX,
  1618. FW_STAT_TX_PORT_PPP2_IX,
  1619. FW_STAT_TX_PORT_PPP3_IX,
  1620. FW_STAT_TX_PORT_PPP4_IX,
  1621. FW_STAT_TX_PORT_PPP5_IX,
  1622. FW_STAT_TX_PORT_PPP6_IX,
  1623. FW_STAT_TX_PORT_PPP7_IX
  1624. };
  1625. enum fw_port_stat_rx_index {
  1626. FW_STAT_RX_PORT_BYTES_IX,
  1627. FW_STAT_RX_PORT_FRAMES_IX,
  1628. FW_STAT_RX_PORT_BCAST_IX,
  1629. FW_STAT_RX_PORT_MCAST_IX,
  1630. FW_STAT_RX_PORT_UCAST_IX,
  1631. FW_STAT_RX_PORT_MTU_ERROR_IX,
  1632. FW_STAT_RX_PORT_MTU_CRC_ERROR_IX,
  1633. FW_STAT_RX_PORT_CRC_ERROR_IX,
  1634. FW_STAT_RX_PORT_LEN_ERROR_IX,
  1635. FW_STAT_RX_PORT_SYM_ERROR_IX,
  1636. FW_STAT_RX_PORT_64B_IX,
  1637. FW_STAT_RX_PORT_65B_127B_IX,
  1638. FW_STAT_RX_PORT_128B_255B_IX,
  1639. FW_STAT_RX_PORT_256B_511B_IX,
  1640. FW_STAT_RX_PORT_512B_1023B_IX,
  1641. FW_STAT_RX_PORT_1024B_1518B_IX,
  1642. FW_STAT_RX_PORT_1519B_MAX_IX,
  1643. FW_STAT_RX_PORT_PAUSE_IX,
  1644. FW_STAT_RX_PORT_PPP0_IX,
  1645. FW_STAT_RX_PORT_PPP1_IX,
  1646. FW_STAT_RX_PORT_PPP2_IX,
  1647. FW_STAT_RX_PORT_PPP3_IX,
  1648. FW_STAT_RX_PORT_PPP4_IX,
  1649. FW_STAT_RX_PORT_PPP5_IX,
  1650. FW_STAT_RX_PORT_PPP6_IX,
  1651. FW_STAT_RX_PORT_PPP7_IX,
  1652. FW_STAT_RX_PORT_LESS_64B_IX
  1653. };
  1654. struct fw_port_stats_cmd {
  1655. __be32 op_to_portid;
  1656. __be32 retval_len16;
  1657. union fw_port_stats {
  1658. struct fw_port_stats_ctl {
  1659. u8 nstats_bg_bm;
  1660. u8 tx_ix;
  1661. __be16 r6;
  1662. __be32 r7;
  1663. __be64 stat0;
  1664. __be64 stat1;
  1665. __be64 stat2;
  1666. __be64 stat3;
  1667. __be64 stat4;
  1668. __be64 stat5;
  1669. } ctl;
  1670. struct fw_port_stats_all {
  1671. __be64 tx_bytes;
  1672. __be64 tx_frames;
  1673. __be64 tx_bcast;
  1674. __be64 tx_mcast;
  1675. __be64 tx_ucast;
  1676. __be64 tx_error;
  1677. __be64 tx_64b;
  1678. __be64 tx_65b_127b;
  1679. __be64 tx_128b_255b;
  1680. __be64 tx_256b_511b;
  1681. __be64 tx_512b_1023b;
  1682. __be64 tx_1024b_1518b;
  1683. __be64 tx_1519b_max;
  1684. __be64 tx_drop;
  1685. __be64 tx_pause;
  1686. __be64 tx_ppp0;
  1687. __be64 tx_ppp1;
  1688. __be64 tx_ppp2;
  1689. __be64 tx_ppp3;
  1690. __be64 tx_ppp4;
  1691. __be64 tx_ppp5;
  1692. __be64 tx_ppp6;
  1693. __be64 tx_ppp7;
  1694. __be64 rx_bytes;
  1695. __be64 rx_frames;
  1696. __be64 rx_bcast;
  1697. __be64 rx_mcast;
  1698. __be64 rx_ucast;
  1699. __be64 rx_mtu_error;
  1700. __be64 rx_mtu_crc_error;
  1701. __be64 rx_crc_error;
  1702. __be64 rx_len_error;
  1703. __be64 rx_sym_error;
  1704. __be64 rx_64b;
  1705. __be64 rx_65b_127b;
  1706. __be64 rx_128b_255b;
  1707. __be64 rx_256b_511b;
  1708. __be64 rx_512b_1023b;
  1709. __be64 rx_1024b_1518b;
  1710. __be64 rx_1519b_max;
  1711. __be64 rx_pause;
  1712. __be64 rx_ppp0;
  1713. __be64 rx_ppp1;
  1714. __be64 rx_ppp2;
  1715. __be64 rx_ppp3;
  1716. __be64 rx_ppp4;
  1717. __be64 rx_ppp5;
  1718. __be64 rx_ppp6;
  1719. __be64 rx_ppp7;
  1720. __be64 rx_less_64b;
  1721. __be64 rx_bg_drop;
  1722. __be64 rx_bg_trunc;
  1723. } all;
  1724. } u;
  1725. };
  1726. #define FW_PORT_STATS_CMD_NSTATS(x) ((x) << 4)
  1727. #define FW_PORT_STATS_CMD_BG_BM(x) ((x) << 0)
  1728. #define FW_PORT_STATS_CMD_TX(x) ((x) << 7)
  1729. #define FW_PORT_STATS_CMD_IX(x) ((x) << 0)
  1730. /* port loopback stats */
  1731. #define FW_NUM_LB_STATS 16
  1732. enum fw_port_lb_stats_index {
  1733. FW_STAT_LB_PORT_BYTES_IX,
  1734. FW_STAT_LB_PORT_FRAMES_IX,
  1735. FW_STAT_LB_PORT_BCAST_IX,
  1736. FW_STAT_LB_PORT_MCAST_IX,
  1737. FW_STAT_LB_PORT_UCAST_IX,
  1738. FW_STAT_LB_PORT_ERROR_IX,
  1739. FW_STAT_LB_PORT_64B_IX,
  1740. FW_STAT_LB_PORT_65B_127B_IX,
  1741. FW_STAT_LB_PORT_128B_255B_IX,
  1742. FW_STAT_LB_PORT_256B_511B_IX,
  1743. FW_STAT_LB_PORT_512B_1023B_IX,
  1744. FW_STAT_LB_PORT_1024B_1518B_IX,
  1745. FW_STAT_LB_PORT_1519B_MAX_IX,
  1746. FW_STAT_LB_PORT_DROP_FRAMES_IX
  1747. };
  1748. struct fw_port_lb_stats_cmd {
  1749. __be32 op_to_lbport;
  1750. __be32 retval_len16;
  1751. union fw_port_lb_stats {
  1752. struct fw_port_lb_stats_ctl {
  1753. u8 nstats_bg_bm;
  1754. u8 ix_pkd;
  1755. __be16 r6;
  1756. __be32 r7;
  1757. __be64 stat0;
  1758. __be64 stat1;
  1759. __be64 stat2;
  1760. __be64 stat3;
  1761. __be64 stat4;
  1762. __be64 stat5;
  1763. } ctl;
  1764. struct fw_port_lb_stats_all {
  1765. __be64 tx_bytes;
  1766. __be64 tx_frames;
  1767. __be64 tx_bcast;
  1768. __be64 tx_mcast;
  1769. __be64 tx_ucast;
  1770. __be64 tx_error;
  1771. __be64 tx_64b;
  1772. __be64 tx_65b_127b;
  1773. __be64 tx_128b_255b;
  1774. __be64 tx_256b_511b;
  1775. __be64 tx_512b_1023b;
  1776. __be64 tx_1024b_1518b;
  1777. __be64 tx_1519b_max;
  1778. __be64 rx_lb_drop;
  1779. __be64 rx_lb_trunc;
  1780. } all;
  1781. } u;
  1782. };
  1783. #define FW_PORT_LB_STATS_CMD_LBPORT(x) ((x) << 0)
  1784. #define FW_PORT_LB_STATS_CMD_NSTATS(x) ((x) << 4)
  1785. #define FW_PORT_LB_STATS_CMD_BG_BM(x) ((x) << 0)
  1786. #define FW_PORT_LB_STATS_CMD_IX(x) ((x) << 0)
  1787. struct fw_rss_ind_tbl_cmd {
  1788. __be32 op_to_viid;
  1789. #define FW_RSS_IND_TBL_CMD_VIID(x) ((x) << 0)
  1790. __be32 retval_len16;
  1791. __be16 niqid;
  1792. __be16 startidx;
  1793. __be32 r3;
  1794. __be32 iq0_to_iq2;
  1795. #define FW_RSS_IND_TBL_CMD_IQ0(x) ((x) << 20)
  1796. #define FW_RSS_IND_TBL_CMD_IQ1(x) ((x) << 10)
  1797. #define FW_RSS_IND_TBL_CMD_IQ2(x) ((x) << 0)
  1798. __be32 iq3_to_iq5;
  1799. __be32 iq6_to_iq8;
  1800. __be32 iq9_to_iq11;
  1801. __be32 iq12_to_iq14;
  1802. __be32 iq15_to_iq17;
  1803. __be32 iq18_to_iq20;
  1804. __be32 iq21_to_iq23;
  1805. __be32 iq24_to_iq26;
  1806. __be32 iq27_to_iq29;
  1807. __be32 iq30_iq31;
  1808. __be32 r15_lo;
  1809. };
  1810. struct fw_rss_glb_config_cmd {
  1811. __be32 op_to_write;
  1812. __be32 retval_len16;
  1813. union fw_rss_glb_config {
  1814. struct fw_rss_glb_config_manual {
  1815. __be32 mode_pkd;
  1816. __be32 r3;
  1817. __be64 r4;
  1818. __be64 r5;
  1819. } manual;
  1820. struct fw_rss_glb_config_basicvirtual {
  1821. __be32 mode_pkd;
  1822. __be32 synmapen_to_hashtoeplitz;
  1823. #define FW_RSS_GLB_CONFIG_CMD_SYNMAPEN (1U << 8)
  1824. #define FW_RSS_GLB_CONFIG_CMD_SYN4TUPENIPV6 (1U << 7)
  1825. #define FW_RSS_GLB_CONFIG_CMD_SYN2TUPENIPV6 (1U << 6)
  1826. #define FW_RSS_GLB_CONFIG_CMD_SYN4TUPENIPV4 (1U << 5)
  1827. #define FW_RSS_GLB_CONFIG_CMD_SYN2TUPENIPV4 (1U << 4)
  1828. #define FW_RSS_GLB_CONFIG_CMD_OFDMAPEN (1U << 3)
  1829. #define FW_RSS_GLB_CONFIG_CMD_TNLMAPEN (1U << 2)
  1830. #define FW_RSS_GLB_CONFIG_CMD_TNLALLLKP (1U << 1)
  1831. #define FW_RSS_GLB_CONFIG_CMD_HASHTOEPLITZ (1U << 0)
  1832. __be64 r8;
  1833. __be64 r9;
  1834. } basicvirtual;
  1835. } u;
  1836. };
  1837. #define FW_RSS_GLB_CONFIG_CMD_MODE(x) ((x) << 28)
  1838. #define FW_RSS_GLB_CONFIG_CMD_MODE_GET(x) (((x) >> 28) & 0xf)
  1839. #define FW_RSS_GLB_CONFIG_CMD_MODE_MANUAL 0
  1840. #define FW_RSS_GLB_CONFIG_CMD_MODE_BASICVIRTUAL 1
  1841. struct fw_rss_vi_config_cmd {
  1842. __be32 op_to_viid;
  1843. #define FW_RSS_VI_CONFIG_CMD_VIID(x) ((x) << 0)
  1844. __be32 retval_len16;
  1845. union fw_rss_vi_config {
  1846. struct fw_rss_vi_config_manual {
  1847. __be64 r3;
  1848. __be64 r4;
  1849. __be64 r5;
  1850. } manual;
  1851. struct fw_rss_vi_config_basicvirtual {
  1852. __be32 r6;
  1853. __be32 defaultq_to_udpen;
  1854. #define FW_RSS_VI_CONFIG_CMD_DEFAULTQ(x) ((x) << 16)
  1855. #define FW_RSS_VI_CONFIG_CMD_DEFAULTQ_GET(x) (((x) >> 16) & 0x3ff)
  1856. #define FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN (1U << 4)
  1857. #define FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN (1U << 3)
  1858. #define FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN (1U << 2)
  1859. #define FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN (1U << 1)
  1860. #define FW_RSS_VI_CONFIG_CMD_UDPEN (1U << 0)
  1861. __be64 r9;
  1862. __be64 r10;
  1863. } basicvirtual;
  1864. } u;
  1865. };
  1866. struct fw_clip_cmd {
  1867. __be32 op_to_write;
  1868. __be32 alloc_to_len16;
  1869. __be64 ip_hi;
  1870. __be64 ip_lo;
  1871. __be32 r4[2];
  1872. };
  1873. #define S_FW_CLIP_CMD_ALLOC 31
  1874. #define M_FW_CLIP_CMD_ALLOC 0x1
  1875. #define V_FW_CLIP_CMD_ALLOC(x) ((x) << S_FW_CLIP_CMD_ALLOC)
  1876. #define G_FW_CLIP_CMD_ALLOC(x) \
  1877. (((x) >> S_FW_CLIP_CMD_ALLOC) & M_FW_CLIP_CMD_ALLOC)
  1878. #define F_FW_CLIP_CMD_ALLOC V_FW_CLIP_CMD_ALLOC(1U)
  1879. #define S_FW_CLIP_CMD_FREE 30
  1880. #define M_FW_CLIP_CMD_FREE 0x1
  1881. #define V_FW_CLIP_CMD_FREE(x) ((x) << S_FW_CLIP_CMD_FREE)
  1882. #define G_FW_CLIP_CMD_FREE(x) \
  1883. (((x) >> S_FW_CLIP_CMD_FREE) & M_FW_CLIP_CMD_FREE)
  1884. #define F_FW_CLIP_CMD_FREE V_FW_CLIP_CMD_FREE(1U)
  1885. enum fw_error_type {
  1886. FW_ERROR_TYPE_EXCEPTION = 0x0,
  1887. FW_ERROR_TYPE_HWMODULE = 0x1,
  1888. FW_ERROR_TYPE_WR = 0x2,
  1889. FW_ERROR_TYPE_ACL = 0x3,
  1890. };
  1891. struct fw_error_cmd {
  1892. __be32 op_to_type;
  1893. __be32 len16_pkd;
  1894. union fw_error {
  1895. struct fw_error_exception {
  1896. __be32 info[6];
  1897. } exception;
  1898. struct fw_error_hwmodule {
  1899. __be32 regaddr;
  1900. __be32 regval;
  1901. } hwmodule;
  1902. struct fw_error_wr {
  1903. __be16 cidx;
  1904. __be16 pfn_vfn;
  1905. __be32 eqid;
  1906. u8 wrhdr[16];
  1907. } wr;
  1908. struct fw_error_acl {
  1909. __be16 cidx;
  1910. __be16 pfn_vfn;
  1911. __be32 eqid;
  1912. __be16 mv_pkd;
  1913. u8 val[6];
  1914. __be64 r4;
  1915. } acl;
  1916. } u;
  1917. };
  1918. struct fw_debug_cmd {
  1919. __be32 op_type;
  1920. #define FW_DEBUG_CMD_TYPE_GET(x) ((x) & 0xff)
  1921. __be32 len16_pkd;
  1922. union fw_debug {
  1923. struct fw_debug_assert {
  1924. __be32 fcid;
  1925. __be32 line;
  1926. __be32 x;
  1927. __be32 y;
  1928. u8 filename_0_7[8];
  1929. u8 filename_8_15[8];
  1930. __be64 r3;
  1931. } assert;
  1932. struct fw_debug_prt {
  1933. __be16 dprtstridx;
  1934. __be16 r3[3];
  1935. __be32 dprtstrparam0;
  1936. __be32 dprtstrparam1;
  1937. __be32 dprtstrparam2;
  1938. __be32 dprtstrparam3;
  1939. } prt;
  1940. } u;
  1941. };
  1942. #define FW_PCIE_FW_ERR (1U << 31)
  1943. #define FW_PCIE_FW_INIT (1U << 30)
  1944. #define FW_PCIE_FW_HALT (1U << 29)
  1945. #define FW_PCIE_FW_MASTER_VLD (1U << 15)
  1946. #define FW_PCIE_FW_MASTER_MASK 0x7
  1947. #define FW_PCIE_FW_MASTER_SHIFT 12
  1948. #define FW_PCIE_FW_MASTER(x) ((x) << FW_PCIE_FW_MASTER_SHIFT)
  1949. #define FW_PCIE_FW_MASTER_GET(x) (((x) >> FW_PCIE_FW_MASTER_SHIFT) & \
  1950. FW_PCIE_FW_MASTER_MASK)
  1951. struct fw_hdr {
  1952. u8 ver;
  1953. u8 reserved1;
  1954. __be16 len512; /* bin length in units of 512-bytes */
  1955. __be32 fw_ver; /* firmware version */
  1956. __be32 tp_microcode_ver;
  1957. u8 intfver_nic;
  1958. u8 intfver_vnic;
  1959. u8 intfver_ofld;
  1960. u8 intfver_ri;
  1961. u8 intfver_iscsipdu;
  1962. u8 intfver_iscsi;
  1963. u8 intfver_fcoepdu;
  1964. u8 intfver_fcoe;
  1965. __u32 reserved2;
  1966. __u32 reserved3;
  1967. __u32 reserved4;
  1968. __be32 flags;
  1969. __be32 reserved6[23];
  1970. };
  1971. #define FW_HDR_FW_VER_MAJOR_GET(x) (((x) >> 24) & 0xff)
  1972. #define FW_HDR_FW_VER_MINOR_GET(x) (((x) >> 16) & 0xff)
  1973. #define FW_HDR_FW_VER_MICRO_GET(x) (((x) >> 8) & 0xff)
  1974. #define FW_HDR_FW_VER_BUILD_GET(x) (((x) >> 0) & 0xff)
  1975. enum fw_hdr_intfver {
  1976. FW_HDR_INTFVER_NIC = 0x00,
  1977. FW_HDR_INTFVER_VNIC = 0x00,
  1978. FW_HDR_INTFVER_OFLD = 0x00,
  1979. FW_HDR_INTFVER_RI = 0x00,
  1980. FW_HDR_INTFVER_ISCSIPDU = 0x00,
  1981. FW_HDR_INTFVER_ISCSI = 0x00,
  1982. FW_HDR_INTFVER_FCOEPDU = 0x00,
  1983. FW_HDR_INTFVER_FCOE = 0x00,
  1984. };
  1985. enum fw_hdr_flags {
  1986. FW_HDR_FLAGS_RESET_HALT = 0x00000001,
  1987. };
  1988. #endif /* _T4FW_INTERFACE_H_ */