t4fw_api.h 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695
  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. #define FW_T4VF_SGE_BASE_ADDR 0x0000
  37. #define FW_T4VF_MPS_BASE_ADDR 0x0100
  38. #define FW_T4VF_PL_BASE_ADDR 0x0200
  39. #define FW_T4VF_MBDATA_BASE_ADDR 0x0240
  40. #define FW_T4VF_CIM_BASE_ADDR 0x0300
  41. enum fw_wr_opcodes {
  42. FW_FILTER_WR = 0x02,
  43. FW_ULPTX_WR = 0x04,
  44. FW_TP_WR = 0x05,
  45. FW_ETH_TX_PKT_WR = 0x08,
  46. FW_FLOWC_WR = 0x0a,
  47. FW_OFLD_TX_DATA_WR = 0x0b,
  48. FW_CMD_WR = 0x10,
  49. FW_ETH_TX_PKT_VM_WR = 0x11,
  50. FW_RI_RES_WR = 0x0c,
  51. FW_RI_INIT_WR = 0x0d,
  52. FW_RI_RDMA_WRITE_WR = 0x14,
  53. FW_RI_SEND_WR = 0x15,
  54. FW_RI_RDMA_READ_WR = 0x16,
  55. FW_RI_RECV_WR = 0x17,
  56. FW_RI_BIND_MW_WR = 0x18,
  57. FW_RI_FR_NSMR_WR = 0x19,
  58. FW_RI_INV_LSTAG_WR = 0x1a,
  59. FW_LASTC2E_WR = 0x40
  60. };
  61. struct fw_wr_hdr {
  62. __be32 hi;
  63. __be32 lo;
  64. };
  65. #define FW_WR_OP(x) ((x) << 24)
  66. #define FW_WR_ATOMIC(x) ((x) << 23)
  67. #define FW_WR_FLUSH(x) ((x) << 22)
  68. #define FW_WR_COMPL(x) ((x) << 21)
  69. #define FW_WR_IMMDLEN_MASK 0xff
  70. #define FW_WR_IMMDLEN(x) ((x) << 0)
  71. #define FW_WR_EQUIQ (1U << 31)
  72. #define FW_WR_EQUEQ (1U << 30)
  73. #define FW_WR_FLOWID(x) ((x) << 8)
  74. #define FW_WR_LEN16(x) ((x) << 0)
  75. #define HW_TPL_FR_MT_PR_IV_P_FC 0X32B
  76. struct fw_ulptx_wr {
  77. __be32 op_to_compl;
  78. __be32 flowid_len16;
  79. u64 cookie;
  80. };
  81. struct fw_tp_wr {
  82. __be32 op_to_immdlen;
  83. __be32 flowid_len16;
  84. u64 cookie;
  85. };
  86. struct fw_eth_tx_pkt_wr {
  87. __be32 op_immdlen;
  88. __be32 equiq_to_len16;
  89. __be64 r3;
  90. };
  91. enum fw_flowc_mnem {
  92. FW_FLOWC_MNEM_PFNVFN, /* PFN [15:8] VFN [7:0] */
  93. FW_FLOWC_MNEM_CH,
  94. FW_FLOWC_MNEM_PORT,
  95. FW_FLOWC_MNEM_IQID,
  96. FW_FLOWC_MNEM_SNDNXT,
  97. FW_FLOWC_MNEM_RCVNXT,
  98. FW_FLOWC_MNEM_SNDBUF,
  99. FW_FLOWC_MNEM_MSS,
  100. };
  101. struct fw_flowc_mnemval {
  102. u8 mnemonic;
  103. u8 r4[3];
  104. __be32 val;
  105. };
  106. struct fw_flowc_wr {
  107. __be32 op_to_nparams;
  108. #define FW_FLOWC_WR_NPARAMS(x) ((x) << 0)
  109. __be32 flowid_len16;
  110. struct fw_flowc_mnemval mnemval[0];
  111. };
  112. struct fw_ofld_tx_data_wr {
  113. __be32 op_to_immdlen;
  114. __be32 flowid_len16;
  115. __be32 plen;
  116. __be32 tunnel_to_proxy;
  117. #define FW_OFLD_TX_DATA_WR_TUNNEL(x) ((x) << 19)
  118. #define FW_OFLD_TX_DATA_WR_SAVE(x) ((x) << 18)
  119. #define FW_OFLD_TX_DATA_WR_FLUSH(x) ((x) << 17)
  120. #define FW_OFLD_TX_DATA_WR_URGENT(x) ((x) << 16)
  121. #define FW_OFLD_TX_DATA_WR_MORE(x) ((x) << 15)
  122. #define FW_OFLD_TX_DATA_WR_SHOVE(x) ((x) << 14)
  123. #define FW_OFLD_TX_DATA_WR_ULPMODE(x) ((x) << 10)
  124. #define FW_OFLD_TX_DATA_WR_ULPSUBMODE(x) ((x) << 6)
  125. };
  126. struct fw_cmd_wr {
  127. __be32 op_dma;
  128. #define FW_CMD_WR_DMA (1U << 17)
  129. __be32 len16_pkd;
  130. __be64 cookie_daddr;
  131. };
  132. struct fw_eth_tx_pkt_vm_wr {
  133. __be32 op_immdlen;
  134. __be32 equiq_to_len16;
  135. __be32 r3[2];
  136. u8 ethmacdst[6];
  137. u8 ethmacsrc[6];
  138. __be16 ethtype;
  139. __be16 vlantci;
  140. };
  141. #define FW_CMD_MAX_TIMEOUT 3000
  142. /*
  143. * If a host driver does a HELLO and discovers that there's already a MASTER
  144. * selected, we may have to wait for that MASTER to finish issuing RESET,
  145. * configuration and INITIALIZE commands. Also, there's a possibility that
  146. * our own HELLO may get lost if it happens right as the MASTER is issuign a
  147. * RESET command, so we need to be willing to make a few retries of our HELLO.
  148. */
  149. #define FW_CMD_HELLO_TIMEOUT (3 * FW_CMD_MAX_TIMEOUT)
  150. #define FW_CMD_HELLO_RETRIES 3
  151. enum fw_cmd_opcodes {
  152. FW_LDST_CMD = 0x01,
  153. FW_RESET_CMD = 0x03,
  154. FW_HELLO_CMD = 0x04,
  155. FW_BYE_CMD = 0x05,
  156. FW_INITIALIZE_CMD = 0x06,
  157. FW_CAPS_CONFIG_CMD = 0x07,
  158. FW_PARAMS_CMD = 0x08,
  159. FW_PFVF_CMD = 0x09,
  160. FW_IQ_CMD = 0x10,
  161. FW_EQ_MNGT_CMD = 0x11,
  162. FW_EQ_ETH_CMD = 0x12,
  163. FW_EQ_CTRL_CMD = 0x13,
  164. FW_EQ_OFLD_CMD = 0x21,
  165. FW_VI_CMD = 0x14,
  166. FW_VI_MAC_CMD = 0x15,
  167. FW_VI_RXMODE_CMD = 0x16,
  168. FW_VI_ENABLE_CMD = 0x17,
  169. FW_ACL_MAC_CMD = 0x18,
  170. FW_ACL_VLAN_CMD = 0x19,
  171. FW_VI_STATS_CMD = 0x1a,
  172. FW_PORT_CMD = 0x1b,
  173. FW_PORT_STATS_CMD = 0x1c,
  174. FW_PORT_LB_STATS_CMD = 0x1d,
  175. FW_PORT_TRACE_CMD = 0x1e,
  176. FW_PORT_TRACE_MMAP_CMD = 0x1f,
  177. FW_RSS_IND_TBL_CMD = 0x20,
  178. FW_RSS_GLB_CONFIG_CMD = 0x22,
  179. FW_RSS_VI_CONFIG_CMD = 0x23,
  180. FW_LASTC2E_CMD = 0x40,
  181. FW_ERROR_CMD = 0x80,
  182. FW_DEBUG_CMD = 0x81,
  183. };
  184. enum fw_cmd_cap {
  185. FW_CMD_CAP_PF = 0x01,
  186. FW_CMD_CAP_DMAQ = 0x02,
  187. FW_CMD_CAP_PORT = 0x04,
  188. FW_CMD_CAP_PORTPROMISC = 0x08,
  189. FW_CMD_CAP_PORTSTATS = 0x10,
  190. FW_CMD_CAP_VF = 0x80,
  191. };
  192. /*
  193. * Generic command header flit0
  194. */
  195. struct fw_cmd_hdr {
  196. __be32 hi;
  197. __be32 lo;
  198. };
  199. #define FW_CMD_OP(x) ((x) << 24)
  200. #define FW_CMD_OP_GET(x) (((x) >> 24) & 0xff)
  201. #define FW_CMD_REQUEST (1U << 23)
  202. #define FW_CMD_READ (1U << 22)
  203. #define FW_CMD_WRITE (1U << 21)
  204. #define FW_CMD_EXEC (1U << 20)
  205. #define FW_CMD_RAMASK(x) ((x) << 20)
  206. #define FW_CMD_RETVAL(x) ((x) << 8)
  207. #define FW_CMD_RETVAL_GET(x) (((x) >> 8) & 0xff)
  208. #define FW_CMD_LEN16(x) ((x) << 0)
  209. enum fw_ldst_addrspc {
  210. FW_LDST_ADDRSPC_FIRMWARE = 0x0001,
  211. FW_LDST_ADDRSPC_SGE_EGRC = 0x0008,
  212. FW_LDST_ADDRSPC_SGE_INGC = 0x0009,
  213. FW_LDST_ADDRSPC_SGE_FLMC = 0x000a,
  214. FW_LDST_ADDRSPC_SGE_CONMC = 0x000b,
  215. FW_LDST_ADDRSPC_TP_PIO = 0x0010,
  216. FW_LDST_ADDRSPC_TP_TM_PIO = 0x0011,
  217. FW_LDST_ADDRSPC_TP_MIB = 0x0012,
  218. FW_LDST_ADDRSPC_MDIO = 0x0018,
  219. FW_LDST_ADDRSPC_MPS = 0x0020,
  220. FW_LDST_ADDRSPC_FUNC = 0x0028
  221. };
  222. enum fw_ldst_mps_fid {
  223. FW_LDST_MPS_ATRB,
  224. FW_LDST_MPS_RPLC
  225. };
  226. enum fw_ldst_func_access_ctl {
  227. FW_LDST_FUNC_ACC_CTL_VIID,
  228. FW_LDST_FUNC_ACC_CTL_FID
  229. };
  230. enum fw_ldst_func_mod_index {
  231. FW_LDST_FUNC_MPS
  232. };
  233. struct fw_ldst_cmd {
  234. __be32 op_to_addrspace;
  235. #define FW_LDST_CMD_ADDRSPACE(x) ((x) << 0)
  236. __be32 cycles_to_len16;
  237. union fw_ldst {
  238. struct fw_ldst_addrval {
  239. __be32 addr;
  240. __be32 val;
  241. } addrval;
  242. struct fw_ldst_idctxt {
  243. __be32 physid;
  244. __be32 msg_pkd;
  245. __be32 ctxt_data7;
  246. __be32 ctxt_data6;
  247. __be32 ctxt_data5;
  248. __be32 ctxt_data4;
  249. __be32 ctxt_data3;
  250. __be32 ctxt_data2;
  251. __be32 ctxt_data1;
  252. __be32 ctxt_data0;
  253. } idctxt;
  254. struct fw_ldst_mdio {
  255. __be16 paddr_mmd;
  256. __be16 raddr;
  257. __be16 vctl;
  258. __be16 rval;
  259. } mdio;
  260. struct fw_ldst_mps {
  261. __be16 fid_ctl;
  262. __be16 rplcpf_pkd;
  263. __be32 rplc127_96;
  264. __be32 rplc95_64;
  265. __be32 rplc63_32;
  266. __be32 rplc31_0;
  267. __be32 atrb;
  268. __be16 vlan[16];
  269. } mps;
  270. struct fw_ldst_func {
  271. u8 access_ctl;
  272. u8 mod_index;
  273. __be16 ctl_id;
  274. __be32 offset;
  275. __be64 data0;
  276. __be64 data1;
  277. } func;
  278. } u;
  279. };
  280. #define FW_LDST_CMD_MSG(x) ((x) << 31)
  281. #define FW_LDST_CMD_PADDR(x) ((x) << 8)
  282. #define FW_LDST_CMD_MMD(x) ((x) << 0)
  283. #define FW_LDST_CMD_FID(x) ((x) << 15)
  284. #define FW_LDST_CMD_CTL(x) ((x) << 0)
  285. #define FW_LDST_CMD_RPLCPF(x) ((x) << 0)
  286. struct fw_reset_cmd {
  287. __be32 op_to_write;
  288. __be32 retval_len16;
  289. __be32 val;
  290. __be32 halt_pkd;
  291. };
  292. #define FW_RESET_CMD_HALT_SHIFT 31
  293. #define FW_RESET_CMD_HALT_MASK 0x1
  294. #define FW_RESET_CMD_HALT(x) ((x) << FW_RESET_CMD_HALT_SHIFT)
  295. #define FW_RESET_CMD_HALT_GET(x) \
  296. (((x) >> FW_RESET_CMD_HALT_SHIFT) & FW_RESET_CMD_HALT_MASK)
  297. enum fw_hellow_cmd {
  298. fw_hello_cmd_stage_os = 0x0
  299. };
  300. struct fw_hello_cmd {
  301. __be32 op_to_write;
  302. __be32 retval_len16;
  303. __be32 err_to_mbasyncnot;
  304. #define FW_HELLO_CMD_ERR (1U << 31)
  305. #define FW_HELLO_CMD_INIT (1U << 30)
  306. #define FW_HELLO_CMD_MASTERDIS(x) ((x) << 29)
  307. #define FW_HELLO_CMD_MASTERFORCE(x) ((x) << 28)
  308. #define FW_HELLO_CMD_MBMASTER_MASK 0xfU
  309. #define FW_HELLO_CMD_MBMASTER_SHIFT 24
  310. #define FW_HELLO_CMD_MBMASTER(x) ((x) << FW_HELLO_CMD_MBMASTER_SHIFT)
  311. #define FW_HELLO_CMD_MBMASTER_GET(x) \
  312. (((x) >> FW_HELLO_CMD_MBMASTER_SHIFT) & FW_HELLO_CMD_MBMASTER_MASK)
  313. #define FW_HELLO_CMD_MBASYNCNOT(x) ((x) << 20)
  314. #define FW_HELLO_CMD_STAGE(x) ((x) << 17)
  315. #define FW_HELLO_CMD_CLEARINIT (1U << 16)
  316. __be32 fwrev;
  317. };
  318. struct fw_bye_cmd {
  319. __be32 op_to_write;
  320. __be32 retval_len16;
  321. __be64 r3;
  322. };
  323. struct fw_initialize_cmd {
  324. __be32 op_to_write;
  325. __be32 retval_len16;
  326. __be64 r3;
  327. };
  328. enum fw_caps_config_hm {
  329. FW_CAPS_CONFIG_HM_PCIE = 0x00000001,
  330. FW_CAPS_CONFIG_HM_PL = 0x00000002,
  331. FW_CAPS_CONFIG_HM_SGE = 0x00000004,
  332. FW_CAPS_CONFIG_HM_CIM = 0x00000008,
  333. FW_CAPS_CONFIG_HM_ULPTX = 0x00000010,
  334. FW_CAPS_CONFIG_HM_TP = 0x00000020,
  335. FW_CAPS_CONFIG_HM_ULPRX = 0x00000040,
  336. FW_CAPS_CONFIG_HM_PMRX = 0x00000080,
  337. FW_CAPS_CONFIG_HM_PMTX = 0x00000100,
  338. FW_CAPS_CONFIG_HM_MC = 0x00000200,
  339. FW_CAPS_CONFIG_HM_LE = 0x00000400,
  340. FW_CAPS_CONFIG_HM_MPS = 0x00000800,
  341. FW_CAPS_CONFIG_HM_XGMAC = 0x00001000,
  342. FW_CAPS_CONFIG_HM_CPLSWITCH = 0x00002000,
  343. FW_CAPS_CONFIG_HM_T4DBG = 0x00004000,
  344. FW_CAPS_CONFIG_HM_MI = 0x00008000,
  345. FW_CAPS_CONFIG_HM_I2CM = 0x00010000,
  346. FW_CAPS_CONFIG_HM_NCSI = 0x00020000,
  347. FW_CAPS_CONFIG_HM_SMB = 0x00040000,
  348. FW_CAPS_CONFIG_HM_MA = 0x00080000,
  349. FW_CAPS_CONFIG_HM_EDRAM = 0x00100000,
  350. FW_CAPS_CONFIG_HM_PMU = 0x00200000,
  351. FW_CAPS_CONFIG_HM_UART = 0x00400000,
  352. FW_CAPS_CONFIG_HM_SF = 0x00800000,
  353. };
  354. enum fw_caps_config_nbm {
  355. FW_CAPS_CONFIG_NBM_IPMI = 0x00000001,
  356. FW_CAPS_CONFIG_NBM_NCSI = 0x00000002,
  357. };
  358. enum fw_caps_config_link {
  359. FW_CAPS_CONFIG_LINK_PPP = 0x00000001,
  360. FW_CAPS_CONFIG_LINK_QFC = 0x00000002,
  361. FW_CAPS_CONFIG_LINK_DCBX = 0x00000004,
  362. };
  363. enum fw_caps_config_switch {
  364. FW_CAPS_CONFIG_SWITCH_INGRESS = 0x00000001,
  365. FW_CAPS_CONFIG_SWITCH_EGRESS = 0x00000002,
  366. };
  367. enum fw_caps_config_nic {
  368. FW_CAPS_CONFIG_NIC = 0x00000001,
  369. FW_CAPS_CONFIG_NIC_VM = 0x00000002,
  370. };
  371. enum fw_caps_config_ofld {
  372. FW_CAPS_CONFIG_OFLD = 0x00000001,
  373. };
  374. enum fw_caps_config_rdma {
  375. FW_CAPS_CONFIG_RDMA_RDDP = 0x00000001,
  376. FW_CAPS_CONFIG_RDMA_RDMAC = 0x00000002,
  377. };
  378. enum fw_caps_config_iscsi {
  379. FW_CAPS_CONFIG_ISCSI_INITIATOR_PDU = 0x00000001,
  380. FW_CAPS_CONFIG_ISCSI_TARGET_PDU = 0x00000002,
  381. FW_CAPS_CONFIG_ISCSI_INITIATOR_CNXOFLD = 0x00000004,
  382. FW_CAPS_CONFIG_ISCSI_TARGET_CNXOFLD = 0x00000008,
  383. };
  384. enum fw_caps_config_fcoe {
  385. FW_CAPS_CONFIG_FCOE_INITIATOR = 0x00000001,
  386. FW_CAPS_CONFIG_FCOE_TARGET = 0x00000002,
  387. };
  388. enum fw_memtype_cf {
  389. FW_MEMTYPE_CF_EDC0 = 0x0,
  390. FW_MEMTYPE_CF_EDC1 = 0x1,
  391. FW_MEMTYPE_CF_EXTMEM = 0x2,
  392. FW_MEMTYPE_CF_FLASH = 0x4,
  393. FW_MEMTYPE_CF_INTERNAL = 0x5,
  394. };
  395. struct fw_caps_config_cmd {
  396. __be32 op_to_write;
  397. __be32 retval_len16;
  398. __be32 r2;
  399. __be32 hwmbitmap;
  400. __be16 nbmcaps;
  401. __be16 linkcaps;
  402. __be16 switchcaps;
  403. __be16 r3;
  404. __be16 niccaps;
  405. __be16 ofldcaps;
  406. __be16 rdmacaps;
  407. __be16 r4;
  408. __be16 iscsicaps;
  409. __be16 fcoecaps;
  410. __be32 cfcsum;
  411. __be32 finiver;
  412. __be32 finicsum;
  413. };
  414. #define FW_CAPS_CONFIG_CMD_CFVALID (1U << 27)
  415. #define FW_CAPS_CONFIG_CMD_MEMTYPE_CF(x) ((x) << 24)
  416. #define FW_CAPS_CONFIG_CMD_MEMADDR64K_CF(x) ((x) << 16)
  417. /*
  418. * params command mnemonics
  419. */
  420. enum fw_params_mnem {
  421. FW_PARAMS_MNEM_DEV = 1, /* device params */
  422. FW_PARAMS_MNEM_PFVF = 2, /* function params */
  423. FW_PARAMS_MNEM_REG = 3, /* limited register access */
  424. FW_PARAMS_MNEM_DMAQ = 4, /* dma queue params */
  425. FW_PARAMS_MNEM_LAST
  426. };
  427. /*
  428. * device parameters
  429. */
  430. enum fw_params_param_dev {
  431. FW_PARAMS_PARAM_DEV_CCLK = 0x00, /* chip core clock in khz */
  432. FW_PARAMS_PARAM_DEV_PORTVEC = 0x01, /* the port vector */
  433. FW_PARAMS_PARAM_DEV_NTID = 0x02, /* reads the number of TIDs
  434. * allocated by the device's
  435. * Lookup Engine
  436. */
  437. FW_PARAMS_PARAM_DEV_FLOWC_BUFFIFO_SZ = 0x03,
  438. FW_PARAMS_PARAM_DEV_INTVER_NIC = 0x04,
  439. FW_PARAMS_PARAM_DEV_INTVER_VNIC = 0x05,
  440. FW_PARAMS_PARAM_DEV_INTVER_OFLD = 0x06,
  441. FW_PARAMS_PARAM_DEV_INTVER_RI = 0x07,
  442. FW_PARAMS_PARAM_DEV_INTVER_ISCSIPDU = 0x08,
  443. FW_PARAMS_PARAM_DEV_INTVER_ISCSI = 0x09,
  444. FW_PARAMS_PARAM_DEV_INTVER_FCOE = 0x0A,
  445. FW_PARAMS_PARAM_DEV_FWREV = 0x0B,
  446. FW_PARAMS_PARAM_DEV_TPREV = 0x0C,
  447. FW_PARAMS_PARAM_DEV_CF = 0x0D,
  448. };
  449. /*
  450. * physical and virtual function parameters
  451. */
  452. enum fw_params_param_pfvf {
  453. FW_PARAMS_PARAM_PFVF_RWXCAPS = 0x00,
  454. FW_PARAMS_PARAM_PFVF_ROUTE_START = 0x01,
  455. FW_PARAMS_PARAM_PFVF_ROUTE_END = 0x02,
  456. FW_PARAMS_PARAM_PFVF_CLIP_START = 0x03,
  457. FW_PARAMS_PARAM_PFVF_CLIP_END = 0x04,
  458. FW_PARAMS_PARAM_PFVF_FILTER_START = 0x05,
  459. FW_PARAMS_PARAM_PFVF_FILTER_END = 0x06,
  460. FW_PARAMS_PARAM_PFVF_SERVER_START = 0x07,
  461. FW_PARAMS_PARAM_PFVF_SERVER_END = 0x08,
  462. FW_PARAMS_PARAM_PFVF_TDDP_START = 0x09,
  463. FW_PARAMS_PARAM_PFVF_TDDP_END = 0x0A,
  464. FW_PARAMS_PARAM_PFVF_ISCSI_START = 0x0B,
  465. FW_PARAMS_PARAM_PFVF_ISCSI_END = 0x0C,
  466. FW_PARAMS_PARAM_PFVF_STAG_START = 0x0D,
  467. FW_PARAMS_PARAM_PFVF_STAG_END = 0x0E,
  468. FW_PARAMS_PARAM_PFVF_RQ_START = 0x1F,
  469. FW_PARAMS_PARAM_PFVF_RQ_END = 0x10,
  470. FW_PARAMS_PARAM_PFVF_PBL_START = 0x11,
  471. FW_PARAMS_PARAM_PFVF_PBL_END = 0x12,
  472. FW_PARAMS_PARAM_PFVF_L2T_START = 0x13,
  473. FW_PARAMS_PARAM_PFVF_L2T_END = 0x14,
  474. FW_PARAMS_PARAM_PFVF_SQRQ_START = 0x15,
  475. FW_PARAMS_PARAM_PFVF_SQRQ_END = 0x16,
  476. FW_PARAMS_PARAM_PFVF_CQ_START = 0x17,
  477. FW_PARAMS_PARAM_PFVF_CQ_END = 0x18,
  478. FW_PARAMS_PARAM_PFVF_SCHEDCLASS_ETH = 0x20,
  479. FW_PARAMS_PARAM_PFVF_VIID = 0x24,
  480. FW_PARAMS_PARAM_PFVF_CPMASK = 0x25,
  481. FW_PARAMS_PARAM_PFVF_OCQ_START = 0x26,
  482. FW_PARAMS_PARAM_PFVF_OCQ_END = 0x27,
  483. FW_PARAMS_PARAM_PFVF_CONM_MAP = 0x28,
  484. FW_PARAMS_PARAM_PFVF_IQFLINT_START = 0x29,
  485. FW_PARAMS_PARAM_PFVF_IQFLINT_END = 0x2A,
  486. FW_PARAMS_PARAM_PFVF_EQ_START = 0x2B,
  487. FW_PARAMS_PARAM_PFVF_EQ_END = 0x2C,
  488. FW_PARAMS_PARAM_PFVF_ACTIVE_FILTER_START = 0x2D,
  489. FW_PARAMS_PARAM_PFVF_ACTIVE_FILTER_END = 0x2E
  490. };
  491. /*
  492. * dma queue parameters
  493. */
  494. enum fw_params_param_dmaq {
  495. FW_PARAMS_PARAM_DMAQ_IQ_DCAEN_DCACPU = 0x00,
  496. FW_PARAMS_PARAM_DMAQ_IQ_INTCNTTHRESH = 0x01,
  497. FW_PARAMS_PARAM_DMAQ_EQ_CMPLIQID_MNGT = 0x10,
  498. FW_PARAMS_PARAM_DMAQ_EQ_CMPLIQID_CTRL = 0x11,
  499. FW_PARAMS_PARAM_DMAQ_EQ_SCHEDCLASS_ETH = 0x12,
  500. };
  501. #define FW_PARAMS_MNEM(x) ((x) << 24)
  502. #define FW_PARAMS_PARAM_X(x) ((x) << 16)
  503. #define FW_PARAMS_PARAM_Y_SHIFT 8
  504. #define FW_PARAMS_PARAM_Y_MASK 0xffU
  505. #define FW_PARAMS_PARAM_Y(x) ((x) << FW_PARAMS_PARAM_Y_SHIFT)
  506. #define FW_PARAMS_PARAM_Y_GET(x) (((x) >> FW_PARAMS_PARAM_Y_SHIFT) &\
  507. FW_PARAMS_PARAM_Y_MASK)
  508. #define FW_PARAMS_PARAM_Z_SHIFT 0
  509. #define FW_PARAMS_PARAM_Z_MASK 0xffu
  510. #define FW_PARAMS_PARAM_Z(x) ((x) << FW_PARAMS_PARAM_Z_SHIFT)
  511. #define FW_PARAMS_PARAM_Z_GET(x) (((x) >> FW_PARAMS_PARAM_Z_SHIFT) &\
  512. FW_PARAMS_PARAM_Z_MASK)
  513. #define FW_PARAMS_PARAM_XYZ(x) ((x) << 0)
  514. #define FW_PARAMS_PARAM_YZ(x) ((x) << 0)
  515. struct fw_params_cmd {
  516. __be32 op_to_vfn;
  517. __be32 retval_len16;
  518. struct fw_params_param {
  519. __be32 mnem;
  520. __be32 val;
  521. } param[7];
  522. };
  523. #define FW_PARAMS_CMD_PFN(x) ((x) << 8)
  524. #define FW_PARAMS_CMD_VFN(x) ((x) << 0)
  525. struct fw_pfvf_cmd {
  526. __be32 op_to_vfn;
  527. __be32 retval_len16;
  528. __be32 niqflint_niq;
  529. __be32 type_to_neq;
  530. __be32 tc_to_nexactf;
  531. __be32 r_caps_to_nethctrl;
  532. __be16 nricq;
  533. __be16 nriqp;
  534. __be32 r4;
  535. };
  536. #define FW_PFVF_CMD_PFN(x) ((x) << 8)
  537. #define FW_PFVF_CMD_VFN(x) ((x) << 0)
  538. #define FW_PFVF_CMD_NIQFLINT(x) ((x) << 20)
  539. #define FW_PFVF_CMD_NIQFLINT_GET(x) (((x) >> 20) & 0xfff)
  540. #define FW_PFVF_CMD_NIQ(x) ((x) << 0)
  541. #define FW_PFVF_CMD_NIQ_GET(x) (((x) >> 0) & 0xfffff)
  542. #define FW_PFVF_CMD_TYPE (1 << 31)
  543. #define FW_PFVF_CMD_TYPE_GET(x) (((x) >> 31) & 0x1)
  544. #define FW_PFVF_CMD_CMASK(x) ((x) << 24)
  545. #define FW_PFVF_CMD_CMASK_MASK 0xf
  546. #define FW_PFVF_CMD_CMASK_GET(x) (((x) >> 24) & FW_PFVF_CMD_CMASK_MASK)
  547. #define FW_PFVF_CMD_PMASK(x) ((x) << 20)
  548. #define FW_PFVF_CMD_PMASK_MASK 0xf
  549. #define FW_PFVF_CMD_PMASK_GET(x) (((x) >> 20) & FW_PFVF_CMD_PMASK_MASK)
  550. #define FW_PFVF_CMD_NEQ(x) ((x) << 0)
  551. #define FW_PFVF_CMD_NEQ_GET(x) (((x) >> 0) & 0xfffff)
  552. #define FW_PFVF_CMD_TC(x) ((x) << 24)
  553. #define FW_PFVF_CMD_TC_GET(x) (((x) >> 24) & 0xff)
  554. #define FW_PFVF_CMD_NVI(x) ((x) << 16)
  555. #define FW_PFVF_CMD_NVI_GET(x) (((x) >> 16) & 0xff)
  556. #define FW_PFVF_CMD_NEXACTF(x) ((x) << 0)
  557. #define FW_PFVF_CMD_NEXACTF_GET(x) (((x) >> 0) & 0xffff)
  558. #define FW_PFVF_CMD_R_CAPS(x) ((x) << 24)
  559. #define FW_PFVF_CMD_R_CAPS_GET(x) (((x) >> 24) & 0xff)
  560. #define FW_PFVF_CMD_WX_CAPS(x) ((x) << 16)
  561. #define FW_PFVF_CMD_WX_CAPS_GET(x) (((x) >> 16) & 0xff)
  562. #define FW_PFVF_CMD_NETHCTRL(x) ((x) << 0)
  563. #define FW_PFVF_CMD_NETHCTRL_GET(x) (((x) >> 0) & 0xffff)
  564. enum fw_iq_type {
  565. FW_IQ_TYPE_FL_INT_CAP,
  566. FW_IQ_TYPE_NO_FL_INT_CAP
  567. };
  568. struct fw_iq_cmd {
  569. __be32 op_to_vfn;
  570. __be32 alloc_to_len16;
  571. __be16 physiqid;
  572. __be16 iqid;
  573. __be16 fl0id;
  574. __be16 fl1id;
  575. __be32 type_to_iqandstindex;
  576. __be16 iqdroprss_to_iqesize;
  577. __be16 iqsize;
  578. __be64 iqaddr;
  579. __be32 iqns_to_fl0congen;
  580. __be16 fl0dcaen_to_fl0cidxfthresh;
  581. __be16 fl0size;
  582. __be64 fl0addr;
  583. __be32 fl1cngchmap_to_fl1congen;
  584. __be16 fl1dcaen_to_fl1cidxfthresh;
  585. __be16 fl1size;
  586. __be64 fl1addr;
  587. };
  588. #define FW_IQ_CMD_PFN(x) ((x) << 8)
  589. #define FW_IQ_CMD_VFN(x) ((x) << 0)
  590. #define FW_IQ_CMD_ALLOC (1U << 31)
  591. #define FW_IQ_CMD_FREE (1U << 30)
  592. #define FW_IQ_CMD_MODIFY (1U << 29)
  593. #define FW_IQ_CMD_IQSTART(x) ((x) << 28)
  594. #define FW_IQ_CMD_IQSTOP(x) ((x) << 27)
  595. #define FW_IQ_CMD_TYPE(x) ((x) << 29)
  596. #define FW_IQ_CMD_IQASYNCH(x) ((x) << 28)
  597. #define FW_IQ_CMD_VIID(x) ((x) << 16)
  598. #define FW_IQ_CMD_IQANDST(x) ((x) << 15)
  599. #define FW_IQ_CMD_IQANUS(x) ((x) << 14)
  600. #define FW_IQ_CMD_IQANUD(x) ((x) << 12)
  601. #define FW_IQ_CMD_IQANDSTINDEX(x) ((x) << 0)
  602. #define FW_IQ_CMD_IQDROPRSS (1U << 15)
  603. #define FW_IQ_CMD_IQGTSMODE (1U << 14)
  604. #define FW_IQ_CMD_IQPCIECH(x) ((x) << 12)
  605. #define FW_IQ_CMD_IQDCAEN(x) ((x) << 11)
  606. #define FW_IQ_CMD_IQDCACPU(x) ((x) << 6)
  607. #define FW_IQ_CMD_IQINTCNTTHRESH(x) ((x) << 4)
  608. #define FW_IQ_CMD_IQO (1U << 3)
  609. #define FW_IQ_CMD_IQCPRIO(x) ((x) << 2)
  610. #define FW_IQ_CMD_IQESIZE(x) ((x) << 0)
  611. #define FW_IQ_CMD_IQNS(x) ((x) << 31)
  612. #define FW_IQ_CMD_IQRO(x) ((x) << 30)
  613. #define FW_IQ_CMD_IQFLINTIQHSEN(x) ((x) << 28)
  614. #define FW_IQ_CMD_IQFLINTCONGEN(x) ((x) << 27)
  615. #define FW_IQ_CMD_IQFLINTISCSIC(x) ((x) << 26)
  616. #define FW_IQ_CMD_FL0CNGCHMAP(x) ((x) << 20)
  617. #define FW_IQ_CMD_FL0CACHELOCK(x) ((x) << 15)
  618. #define FW_IQ_CMD_FL0DBP(x) ((x) << 14)
  619. #define FW_IQ_CMD_FL0DATANS(x) ((x) << 13)
  620. #define FW_IQ_CMD_FL0DATARO(x) ((x) << 12)
  621. #define FW_IQ_CMD_FL0CONGCIF(x) ((x) << 11)
  622. #define FW_IQ_CMD_FL0ONCHIP(x) ((x) << 10)
  623. #define FW_IQ_CMD_FL0STATUSPGNS(x) ((x) << 9)
  624. #define FW_IQ_CMD_FL0STATUSPGRO(x) ((x) << 8)
  625. #define FW_IQ_CMD_FL0FETCHNS(x) ((x) << 7)
  626. #define FW_IQ_CMD_FL0FETCHRO(x) ((x) << 6)
  627. #define FW_IQ_CMD_FL0HOSTFCMODE(x) ((x) << 4)
  628. #define FW_IQ_CMD_FL0CPRIO(x) ((x) << 3)
  629. #define FW_IQ_CMD_FL0PADEN (1U << 2)
  630. #define FW_IQ_CMD_FL0PACKEN (1U << 1)
  631. #define FW_IQ_CMD_FL0CONGEN (1U << 0)
  632. #define FW_IQ_CMD_FL0DCAEN(x) ((x) << 15)
  633. #define FW_IQ_CMD_FL0DCACPU(x) ((x) << 10)
  634. #define FW_IQ_CMD_FL0FBMIN(x) ((x) << 7)
  635. #define FW_IQ_CMD_FL0FBMAX(x) ((x) << 4)
  636. #define FW_IQ_CMD_FL0CIDXFTHRESHO (1U << 3)
  637. #define FW_IQ_CMD_FL0CIDXFTHRESH(x) ((x) << 0)
  638. #define FW_IQ_CMD_FL1CNGCHMAP(x) ((x) << 20)
  639. #define FW_IQ_CMD_FL1CACHELOCK(x) ((x) << 15)
  640. #define FW_IQ_CMD_FL1DBP(x) ((x) << 14)
  641. #define FW_IQ_CMD_FL1DATANS(x) ((x) << 13)
  642. #define FW_IQ_CMD_FL1DATARO(x) ((x) << 12)
  643. #define FW_IQ_CMD_FL1CONGCIF(x) ((x) << 11)
  644. #define FW_IQ_CMD_FL1ONCHIP(x) ((x) << 10)
  645. #define FW_IQ_CMD_FL1STATUSPGNS(x) ((x) << 9)
  646. #define FW_IQ_CMD_FL1STATUSPGRO(x) ((x) << 8)
  647. #define FW_IQ_CMD_FL1FETCHNS(x) ((x) << 7)
  648. #define FW_IQ_CMD_FL1FETCHRO(x) ((x) << 6)
  649. #define FW_IQ_CMD_FL1HOSTFCMODE(x) ((x) << 4)
  650. #define FW_IQ_CMD_FL1CPRIO(x) ((x) << 3)
  651. #define FW_IQ_CMD_FL1PADEN (1U << 2)
  652. #define FW_IQ_CMD_FL1PACKEN (1U << 1)
  653. #define FW_IQ_CMD_FL1CONGEN (1U << 0)
  654. #define FW_IQ_CMD_FL1DCAEN(x) ((x) << 15)
  655. #define FW_IQ_CMD_FL1DCACPU(x) ((x) << 10)
  656. #define FW_IQ_CMD_FL1FBMIN(x) ((x) << 7)
  657. #define FW_IQ_CMD_FL1FBMAX(x) ((x) << 4)
  658. #define FW_IQ_CMD_FL1CIDXFTHRESHO (1U << 3)
  659. #define FW_IQ_CMD_FL1CIDXFTHRESH(x) ((x) << 0)
  660. struct fw_eq_eth_cmd {
  661. __be32 op_to_vfn;
  662. __be32 alloc_to_len16;
  663. __be32 eqid_pkd;
  664. __be32 physeqid_pkd;
  665. __be32 fetchszm_to_iqid;
  666. __be32 dcaen_to_eqsize;
  667. __be64 eqaddr;
  668. __be32 viid_pkd;
  669. __be32 r8_lo;
  670. __be64 r9;
  671. };
  672. #define FW_EQ_ETH_CMD_PFN(x) ((x) << 8)
  673. #define FW_EQ_ETH_CMD_VFN(x) ((x) << 0)
  674. #define FW_EQ_ETH_CMD_ALLOC (1U << 31)
  675. #define FW_EQ_ETH_CMD_FREE (1U << 30)
  676. #define FW_EQ_ETH_CMD_MODIFY (1U << 29)
  677. #define FW_EQ_ETH_CMD_EQSTART (1U << 28)
  678. #define FW_EQ_ETH_CMD_EQSTOP (1U << 27)
  679. #define FW_EQ_ETH_CMD_EQID(x) ((x) << 0)
  680. #define FW_EQ_ETH_CMD_EQID_GET(x) (((x) >> 0) & 0xfffff)
  681. #define FW_EQ_ETH_CMD_PHYSEQID(x) ((x) << 0)
  682. #define FW_EQ_ETH_CMD_PHYSEQID_GET(x) (((x) >> 0) & 0xfffff)
  683. #define FW_EQ_ETH_CMD_FETCHSZM(x) ((x) << 26)
  684. #define FW_EQ_ETH_CMD_STATUSPGNS(x) ((x) << 25)
  685. #define FW_EQ_ETH_CMD_STATUSPGRO(x) ((x) << 24)
  686. #define FW_EQ_ETH_CMD_FETCHNS(x) ((x) << 23)
  687. #define FW_EQ_ETH_CMD_FETCHRO(x) ((x) << 22)
  688. #define FW_EQ_ETH_CMD_HOSTFCMODE(x) ((x) << 20)
  689. #define FW_EQ_ETH_CMD_CPRIO(x) ((x) << 19)
  690. #define FW_EQ_ETH_CMD_ONCHIP(x) ((x) << 18)
  691. #define FW_EQ_ETH_CMD_PCIECHN(x) ((x) << 16)
  692. #define FW_EQ_ETH_CMD_IQID(x) ((x) << 0)
  693. #define FW_EQ_ETH_CMD_DCAEN(x) ((x) << 31)
  694. #define FW_EQ_ETH_CMD_DCACPU(x) ((x) << 26)
  695. #define FW_EQ_ETH_CMD_FBMIN(x) ((x) << 23)
  696. #define FW_EQ_ETH_CMD_FBMAX(x) ((x) << 20)
  697. #define FW_EQ_ETH_CMD_CIDXFTHRESHO(x) ((x) << 19)
  698. #define FW_EQ_ETH_CMD_CIDXFTHRESH(x) ((x) << 16)
  699. #define FW_EQ_ETH_CMD_EQSIZE(x) ((x) << 0)
  700. #define FW_EQ_ETH_CMD_VIID(x) ((x) << 16)
  701. struct fw_eq_ctrl_cmd {
  702. __be32 op_to_vfn;
  703. __be32 alloc_to_len16;
  704. __be32 cmpliqid_eqid;
  705. __be32 physeqid_pkd;
  706. __be32 fetchszm_to_iqid;
  707. __be32 dcaen_to_eqsize;
  708. __be64 eqaddr;
  709. };
  710. #define FW_EQ_CTRL_CMD_PFN(x) ((x) << 8)
  711. #define FW_EQ_CTRL_CMD_VFN(x) ((x) << 0)
  712. #define FW_EQ_CTRL_CMD_ALLOC (1U << 31)
  713. #define FW_EQ_CTRL_CMD_FREE (1U << 30)
  714. #define FW_EQ_CTRL_CMD_MODIFY (1U << 29)
  715. #define FW_EQ_CTRL_CMD_EQSTART (1U << 28)
  716. #define FW_EQ_CTRL_CMD_EQSTOP (1U << 27)
  717. #define FW_EQ_CTRL_CMD_CMPLIQID(x) ((x) << 20)
  718. #define FW_EQ_CTRL_CMD_EQID(x) ((x) << 0)
  719. #define FW_EQ_CTRL_CMD_EQID_GET(x) (((x) >> 0) & 0xfffff)
  720. #define FW_EQ_CTRL_CMD_PHYSEQID_GET(x) (((x) >> 0) & 0xfffff)
  721. #define FW_EQ_CTRL_CMD_FETCHSZM (1U << 26)
  722. #define FW_EQ_CTRL_CMD_STATUSPGNS (1U << 25)
  723. #define FW_EQ_CTRL_CMD_STATUSPGRO (1U << 24)
  724. #define FW_EQ_CTRL_CMD_FETCHNS (1U << 23)
  725. #define FW_EQ_CTRL_CMD_FETCHRO (1U << 22)
  726. #define FW_EQ_CTRL_CMD_HOSTFCMODE(x) ((x) << 20)
  727. #define FW_EQ_CTRL_CMD_CPRIO(x) ((x) << 19)
  728. #define FW_EQ_CTRL_CMD_ONCHIP(x) ((x) << 18)
  729. #define FW_EQ_CTRL_CMD_PCIECHN(x) ((x) << 16)
  730. #define FW_EQ_CTRL_CMD_IQID(x) ((x) << 0)
  731. #define FW_EQ_CTRL_CMD_DCAEN(x) ((x) << 31)
  732. #define FW_EQ_CTRL_CMD_DCACPU(x) ((x) << 26)
  733. #define FW_EQ_CTRL_CMD_FBMIN(x) ((x) << 23)
  734. #define FW_EQ_CTRL_CMD_FBMAX(x) ((x) << 20)
  735. #define FW_EQ_CTRL_CMD_CIDXFTHRESHO(x) ((x) << 19)
  736. #define FW_EQ_CTRL_CMD_CIDXFTHRESH(x) ((x) << 16)
  737. #define FW_EQ_CTRL_CMD_EQSIZE(x) ((x) << 0)
  738. struct fw_eq_ofld_cmd {
  739. __be32 op_to_vfn;
  740. __be32 alloc_to_len16;
  741. __be32 eqid_pkd;
  742. __be32 physeqid_pkd;
  743. __be32 fetchszm_to_iqid;
  744. __be32 dcaen_to_eqsize;
  745. __be64 eqaddr;
  746. };
  747. #define FW_EQ_OFLD_CMD_PFN(x) ((x) << 8)
  748. #define FW_EQ_OFLD_CMD_VFN(x) ((x) << 0)
  749. #define FW_EQ_OFLD_CMD_ALLOC (1U << 31)
  750. #define FW_EQ_OFLD_CMD_FREE (1U << 30)
  751. #define FW_EQ_OFLD_CMD_MODIFY (1U << 29)
  752. #define FW_EQ_OFLD_CMD_EQSTART (1U << 28)
  753. #define FW_EQ_OFLD_CMD_EQSTOP (1U << 27)
  754. #define FW_EQ_OFLD_CMD_EQID(x) ((x) << 0)
  755. #define FW_EQ_OFLD_CMD_EQID_GET(x) (((x) >> 0) & 0xfffff)
  756. #define FW_EQ_OFLD_CMD_PHYSEQID_GET(x) (((x) >> 0) & 0xfffff)
  757. #define FW_EQ_OFLD_CMD_FETCHSZM(x) ((x) << 26)
  758. #define FW_EQ_OFLD_CMD_STATUSPGNS(x) ((x) << 25)
  759. #define FW_EQ_OFLD_CMD_STATUSPGRO(x) ((x) << 24)
  760. #define FW_EQ_OFLD_CMD_FETCHNS(x) ((x) << 23)
  761. #define FW_EQ_OFLD_CMD_FETCHRO(x) ((x) << 22)
  762. #define FW_EQ_OFLD_CMD_HOSTFCMODE(x) ((x) << 20)
  763. #define FW_EQ_OFLD_CMD_CPRIO(x) ((x) << 19)
  764. #define FW_EQ_OFLD_CMD_ONCHIP(x) ((x) << 18)
  765. #define FW_EQ_OFLD_CMD_PCIECHN(x) ((x) << 16)
  766. #define FW_EQ_OFLD_CMD_IQID(x) ((x) << 0)
  767. #define FW_EQ_OFLD_CMD_DCAEN(x) ((x) << 31)
  768. #define FW_EQ_OFLD_CMD_DCACPU(x) ((x) << 26)
  769. #define FW_EQ_OFLD_CMD_FBMIN(x) ((x) << 23)
  770. #define FW_EQ_OFLD_CMD_FBMAX(x) ((x) << 20)
  771. #define FW_EQ_OFLD_CMD_CIDXFTHRESHO(x) ((x) << 19)
  772. #define FW_EQ_OFLD_CMD_CIDXFTHRESH(x) ((x) << 16)
  773. #define FW_EQ_OFLD_CMD_EQSIZE(x) ((x) << 0)
  774. /*
  775. * Macros for VIID parsing:
  776. * VIID - [10:8] PFN, [7] VI Valid, [6:0] VI number
  777. */
  778. #define FW_VIID_PFN_GET(x) (((x) >> 8) & 0x7)
  779. #define FW_VIID_VIVLD_GET(x) (((x) >> 7) & 0x1)
  780. #define FW_VIID_VIN_GET(x) (((x) >> 0) & 0x7F)
  781. struct fw_vi_cmd {
  782. __be32 op_to_vfn;
  783. __be32 alloc_to_len16;
  784. __be16 type_viid;
  785. u8 mac[6];
  786. u8 portid_pkd;
  787. u8 nmac;
  788. u8 nmac0[6];
  789. __be16 rsssize_pkd;
  790. u8 nmac1[6];
  791. __be16 idsiiq_pkd;
  792. u8 nmac2[6];
  793. __be16 idseiq_pkd;
  794. u8 nmac3[6];
  795. __be64 r9;
  796. __be64 r10;
  797. };
  798. #define FW_VI_CMD_PFN(x) ((x) << 8)
  799. #define FW_VI_CMD_VFN(x) ((x) << 0)
  800. #define FW_VI_CMD_ALLOC (1U << 31)
  801. #define FW_VI_CMD_FREE (1U << 30)
  802. #define FW_VI_CMD_VIID(x) ((x) << 0)
  803. #define FW_VI_CMD_VIID_GET(x) ((x) & 0xfff)
  804. #define FW_VI_CMD_PORTID(x) ((x) << 4)
  805. #define FW_VI_CMD_PORTID_GET(x) (((x) >> 4) & 0xf)
  806. #define FW_VI_CMD_RSSSIZE_GET(x) (((x) >> 0) & 0x7ff)
  807. /* Special VI_MAC command index ids */
  808. #define FW_VI_MAC_ADD_MAC 0x3FF
  809. #define FW_VI_MAC_ADD_PERSIST_MAC 0x3FE
  810. #define FW_VI_MAC_MAC_BASED_FREE 0x3FD
  811. #define FW_CLS_TCAM_NUM_ENTRIES 336
  812. enum fw_vi_mac_smac {
  813. FW_VI_MAC_MPS_TCAM_ENTRY,
  814. FW_VI_MAC_MPS_TCAM_ONLY,
  815. FW_VI_MAC_SMT_ONLY,
  816. FW_VI_MAC_SMT_AND_MPSTCAM
  817. };
  818. enum fw_vi_mac_result {
  819. FW_VI_MAC_R_SUCCESS,
  820. FW_VI_MAC_R_F_NONEXISTENT_NOMEM,
  821. FW_VI_MAC_R_SMAC_FAIL,
  822. FW_VI_MAC_R_F_ACL_CHECK
  823. };
  824. struct fw_vi_mac_cmd {
  825. __be32 op_to_viid;
  826. __be32 freemacs_to_len16;
  827. union fw_vi_mac {
  828. struct fw_vi_mac_exact {
  829. __be16 valid_to_idx;
  830. u8 macaddr[6];
  831. } exact[7];
  832. struct fw_vi_mac_hash {
  833. __be64 hashvec;
  834. } hash;
  835. } u;
  836. };
  837. #define FW_VI_MAC_CMD_VIID(x) ((x) << 0)
  838. #define FW_VI_MAC_CMD_FREEMACS(x) ((x) << 31)
  839. #define FW_VI_MAC_CMD_HASHVECEN (1U << 23)
  840. #define FW_VI_MAC_CMD_HASHUNIEN(x) ((x) << 22)
  841. #define FW_VI_MAC_CMD_VALID (1U << 15)
  842. #define FW_VI_MAC_CMD_PRIO(x) ((x) << 12)
  843. #define FW_VI_MAC_CMD_SMAC_RESULT(x) ((x) << 10)
  844. #define FW_VI_MAC_CMD_SMAC_RESULT_GET(x) (((x) >> 10) & 0x3)
  845. #define FW_VI_MAC_CMD_IDX(x) ((x) << 0)
  846. #define FW_VI_MAC_CMD_IDX_GET(x) (((x) >> 0) & 0x3ff)
  847. #define FW_RXMODE_MTU_NO_CHG 65535
  848. struct fw_vi_rxmode_cmd {
  849. __be32 op_to_viid;
  850. __be32 retval_len16;
  851. __be32 mtu_to_vlanexen;
  852. __be32 r4_lo;
  853. };
  854. #define FW_VI_RXMODE_CMD_VIID(x) ((x) << 0)
  855. #define FW_VI_RXMODE_CMD_MTU_MASK 0xffff
  856. #define FW_VI_RXMODE_CMD_MTU(x) ((x) << 16)
  857. #define FW_VI_RXMODE_CMD_PROMISCEN_MASK 0x3
  858. #define FW_VI_RXMODE_CMD_PROMISCEN(x) ((x) << 14)
  859. #define FW_VI_RXMODE_CMD_ALLMULTIEN_MASK 0x3
  860. #define FW_VI_RXMODE_CMD_ALLMULTIEN(x) ((x) << 12)
  861. #define FW_VI_RXMODE_CMD_BROADCASTEN_MASK 0x3
  862. #define FW_VI_RXMODE_CMD_BROADCASTEN(x) ((x) << 10)
  863. #define FW_VI_RXMODE_CMD_VLANEXEN_MASK 0x3
  864. #define FW_VI_RXMODE_CMD_VLANEXEN(x) ((x) << 8)
  865. struct fw_vi_enable_cmd {
  866. __be32 op_to_viid;
  867. __be32 ien_to_len16;
  868. __be16 blinkdur;
  869. __be16 r3;
  870. __be32 r4;
  871. };
  872. #define FW_VI_ENABLE_CMD_VIID(x) ((x) << 0)
  873. #define FW_VI_ENABLE_CMD_IEN(x) ((x) << 31)
  874. #define FW_VI_ENABLE_CMD_EEN(x) ((x) << 30)
  875. #define FW_VI_ENABLE_CMD_LED (1U << 29)
  876. /* VI VF stats offset definitions */
  877. #define VI_VF_NUM_STATS 16
  878. enum fw_vi_stats_vf_index {
  879. FW_VI_VF_STAT_TX_BCAST_BYTES_IX,
  880. FW_VI_VF_STAT_TX_BCAST_FRAMES_IX,
  881. FW_VI_VF_STAT_TX_MCAST_BYTES_IX,
  882. FW_VI_VF_STAT_TX_MCAST_FRAMES_IX,
  883. FW_VI_VF_STAT_TX_UCAST_BYTES_IX,
  884. FW_VI_VF_STAT_TX_UCAST_FRAMES_IX,
  885. FW_VI_VF_STAT_TX_DROP_FRAMES_IX,
  886. FW_VI_VF_STAT_TX_OFLD_BYTES_IX,
  887. FW_VI_VF_STAT_TX_OFLD_FRAMES_IX,
  888. FW_VI_VF_STAT_RX_BCAST_BYTES_IX,
  889. FW_VI_VF_STAT_RX_BCAST_FRAMES_IX,
  890. FW_VI_VF_STAT_RX_MCAST_BYTES_IX,
  891. FW_VI_VF_STAT_RX_MCAST_FRAMES_IX,
  892. FW_VI_VF_STAT_RX_UCAST_BYTES_IX,
  893. FW_VI_VF_STAT_RX_UCAST_FRAMES_IX,
  894. FW_VI_VF_STAT_RX_ERR_FRAMES_IX
  895. };
  896. /* VI PF stats offset definitions */
  897. #define VI_PF_NUM_STATS 17
  898. enum fw_vi_stats_pf_index {
  899. FW_VI_PF_STAT_TX_BCAST_BYTES_IX,
  900. FW_VI_PF_STAT_TX_BCAST_FRAMES_IX,
  901. FW_VI_PF_STAT_TX_MCAST_BYTES_IX,
  902. FW_VI_PF_STAT_TX_MCAST_FRAMES_IX,
  903. FW_VI_PF_STAT_TX_UCAST_BYTES_IX,
  904. FW_VI_PF_STAT_TX_UCAST_FRAMES_IX,
  905. FW_VI_PF_STAT_TX_OFLD_BYTES_IX,
  906. FW_VI_PF_STAT_TX_OFLD_FRAMES_IX,
  907. FW_VI_PF_STAT_RX_BYTES_IX,
  908. FW_VI_PF_STAT_RX_FRAMES_IX,
  909. FW_VI_PF_STAT_RX_BCAST_BYTES_IX,
  910. FW_VI_PF_STAT_RX_BCAST_FRAMES_IX,
  911. FW_VI_PF_STAT_RX_MCAST_BYTES_IX,
  912. FW_VI_PF_STAT_RX_MCAST_FRAMES_IX,
  913. FW_VI_PF_STAT_RX_UCAST_BYTES_IX,
  914. FW_VI_PF_STAT_RX_UCAST_FRAMES_IX,
  915. FW_VI_PF_STAT_RX_ERR_FRAMES_IX
  916. };
  917. struct fw_vi_stats_cmd {
  918. __be32 op_to_viid;
  919. __be32 retval_len16;
  920. union fw_vi_stats {
  921. struct fw_vi_stats_ctl {
  922. __be16 nstats_ix;
  923. __be16 r6;
  924. __be32 r7;
  925. __be64 stat0;
  926. __be64 stat1;
  927. __be64 stat2;
  928. __be64 stat3;
  929. __be64 stat4;
  930. __be64 stat5;
  931. } ctl;
  932. struct fw_vi_stats_pf {
  933. __be64 tx_bcast_bytes;
  934. __be64 tx_bcast_frames;
  935. __be64 tx_mcast_bytes;
  936. __be64 tx_mcast_frames;
  937. __be64 tx_ucast_bytes;
  938. __be64 tx_ucast_frames;
  939. __be64 tx_offload_bytes;
  940. __be64 tx_offload_frames;
  941. __be64 rx_pf_bytes;
  942. __be64 rx_pf_frames;
  943. __be64 rx_bcast_bytes;
  944. __be64 rx_bcast_frames;
  945. __be64 rx_mcast_bytes;
  946. __be64 rx_mcast_frames;
  947. __be64 rx_ucast_bytes;
  948. __be64 rx_ucast_frames;
  949. __be64 rx_err_frames;
  950. } pf;
  951. struct fw_vi_stats_vf {
  952. __be64 tx_bcast_bytes;
  953. __be64 tx_bcast_frames;
  954. __be64 tx_mcast_bytes;
  955. __be64 tx_mcast_frames;
  956. __be64 tx_ucast_bytes;
  957. __be64 tx_ucast_frames;
  958. __be64 tx_drop_frames;
  959. __be64 tx_offload_bytes;
  960. __be64 tx_offload_frames;
  961. __be64 rx_bcast_bytes;
  962. __be64 rx_bcast_frames;
  963. __be64 rx_mcast_bytes;
  964. __be64 rx_mcast_frames;
  965. __be64 rx_ucast_bytes;
  966. __be64 rx_ucast_frames;
  967. __be64 rx_err_frames;
  968. } vf;
  969. } u;
  970. };
  971. #define FW_VI_STATS_CMD_VIID(x) ((x) << 0)
  972. #define FW_VI_STATS_CMD_NSTATS(x) ((x) << 12)
  973. #define FW_VI_STATS_CMD_IX(x) ((x) << 0)
  974. struct fw_acl_mac_cmd {
  975. __be32 op_to_vfn;
  976. __be32 en_to_len16;
  977. u8 nmac;
  978. u8 r3[7];
  979. __be16 r4;
  980. u8 macaddr0[6];
  981. __be16 r5;
  982. u8 macaddr1[6];
  983. __be16 r6;
  984. u8 macaddr2[6];
  985. __be16 r7;
  986. u8 macaddr3[6];
  987. };
  988. #define FW_ACL_MAC_CMD_PFN(x) ((x) << 8)
  989. #define FW_ACL_MAC_CMD_VFN(x) ((x) << 0)
  990. #define FW_ACL_MAC_CMD_EN(x) ((x) << 31)
  991. struct fw_acl_vlan_cmd {
  992. __be32 op_to_vfn;
  993. __be32 en_to_len16;
  994. u8 nvlan;
  995. u8 dropnovlan_fm;
  996. u8 r3_lo[6];
  997. __be16 vlanid[16];
  998. };
  999. #define FW_ACL_VLAN_CMD_PFN(x) ((x) << 8)
  1000. #define FW_ACL_VLAN_CMD_VFN(x) ((x) << 0)
  1001. #define FW_ACL_VLAN_CMD_EN(x) ((x) << 31)
  1002. #define FW_ACL_VLAN_CMD_DROPNOVLAN(x) ((x) << 7)
  1003. #define FW_ACL_VLAN_CMD_FM(x) ((x) << 6)
  1004. enum fw_port_cap {
  1005. FW_PORT_CAP_SPEED_100M = 0x0001,
  1006. FW_PORT_CAP_SPEED_1G = 0x0002,
  1007. FW_PORT_CAP_SPEED_2_5G = 0x0004,
  1008. FW_PORT_CAP_SPEED_10G = 0x0008,
  1009. FW_PORT_CAP_SPEED_40G = 0x0010,
  1010. FW_PORT_CAP_SPEED_100G = 0x0020,
  1011. FW_PORT_CAP_FC_RX = 0x0040,
  1012. FW_PORT_CAP_FC_TX = 0x0080,
  1013. FW_PORT_CAP_ANEG = 0x0100,
  1014. FW_PORT_CAP_MDI_0 = 0x0200,
  1015. FW_PORT_CAP_MDI_1 = 0x0400,
  1016. FW_PORT_CAP_BEAN = 0x0800,
  1017. FW_PORT_CAP_PMA_LPBK = 0x1000,
  1018. FW_PORT_CAP_PCS_LPBK = 0x2000,
  1019. FW_PORT_CAP_PHYXS_LPBK = 0x4000,
  1020. FW_PORT_CAP_FAR_END_LPBK = 0x8000,
  1021. };
  1022. enum fw_port_mdi {
  1023. FW_PORT_MDI_UNCHANGED,
  1024. FW_PORT_MDI_AUTO,
  1025. FW_PORT_MDI_F_STRAIGHT,
  1026. FW_PORT_MDI_F_CROSSOVER
  1027. };
  1028. #define FW_PORT_MDI(x) ((x) << 9)
  1029. enum fw_port_action {
  1030. FW_PORT_ACTION_L1_CFG = 0x0001,
  1031. FW_PORT_ACTION_L2_CFG = 0x0002,
  1032. FW_PORT_ACTION_GET_PORT_INFO = 0x0003,
  1033. FW_PORT_ACTION_L2_PPP_CFG = 0x0004,
  1034. FW_PORT_ACTION_L2_DCB_CFG = 0x0005,
  1035. FW_PORT_ACTION_LOW_PWR_TO_NORMAL = 0x0010,
  1036. FW_PORT_ACTION_L1_LOW_PWR_EN = 0x0011,
  1037. FW_PORT_ACTION_L2_WOL_MODE_EN = 0x0012,
  1038. FW_PORT_ACTION_LPBK_TO_NORMAL = 0x0020,
  1039. FW_PORT_ACTION_L1_LPBK = 0x0021,
  1040. FW_PORT_ACTION_L1_PMA_LPBK = 0x0022,
  1041. FW_PORT_ACTION_L1_PCS_LPBK = 0x0023,
  1042. FW_PORT_ACTION_L1_PHYXS_CSIDE_LPBK = 0x0024,
  1043. FW_PORT_ACTION_L1_PHYXS_ESIDE_LPBK = 0x0025,
  1044. FW_PORT_ACTION_PHY_RESET = 0x0040,
  1045. FW_PORT_ACTION_PMA_RESET = 0x0041,
  1046. FW_PORT_ACTION_PCS_RESET = 0x0042,
  1047. FW_PORT_ACTION_PHYXS_RESET = 0x0043,
  1048. FW_PORT_ACTION_DTEXS_REEST = 0x0044,
  1049. FW_PORT_ACTION_AN_RESET = 0x0045
  1050. };
  1051. enum fw_port_l2cfg_ctlbf {
  1052. FW_PORT_L2_CTLBF_OVLAN0 = 0x01,
  1053. FW_PORT_L2_CTLBF_OVLAN1 = 0x02,
  1054. FW_PORT_L2_CTLBF_OVLAN2 = 0x04,
  1055. FW_PORT_L2_CTLBF_OVLAN3 = 0x08,
  1056. FW_PORT_L2_CTLBF_IVLAN = 0x10,
  1057. FW_PORT_L2_CTLBF_TXIPG = 0x20
  1058. };
  1059. enum fw_port_dcb_cfg {
  1060. FW_PORT_DCB_CFG_PG = 0x01,
  1061. FW_PORT_DCB_CFG_PFC = 0x02,
  1062. FW_PORT_DCB_CFG_APPL = 0x04
  1063. };
  1064. enum fw_port_dcb_cfg_rc {
  1065. FW_PORT_DCB_CFG_SUCCESS = 0x0,
  1066. FW_PORT_DCB_CFG_ERROR = 0x1
  1067. };
  1068. struct fw_port_cmd {
  1069. __be32 op_to_portid;
  1070. __be32 action_to_len16;
  1071. union fw_port {
  1072. struct fw_port_l1cfg {
  1073. __be32 rcap;
  1074. __be32 r;
  1075. } l1cfg;
  1076. struct fw_port_l2cfg {
  1077. __be16 ctlbf_to_ivlan0;
  1078. __be16 ivlantype;
  1079. __be32 txipg_pkd;
  1080. __be16 ovlan0mask;
  1081. __be16 ovlan0type;
  1082. __be16 ovlan1mask;
  1083. __be16 ovlan1type;
  1084. __be16 ovlan2mask;
  1085. __be16 ovlan2type;
  1086. __be16 ovlan3mask;
  1087. __be16 ovlan3type;
  1088. } l2cfg;
  1089. struct fw_port_info {
  1090. __be32 lstatus_to_modtype;
  1091. __be16 pcap;
  1092. __be16 acap;
  1093. __be16 mtu;
  1094. __u8 cbllen;
  1095. __u8 r9;
  1096. __be32 r10;
  1097. __be64 r11;
  1098. } info;
  1099. struct fw_port_ppp {
  1100. __be32 pppen_to_ncsich;
  1101. __be32 r11;
  1102. } ppp;
  1103. struct fw_port_dcb {
  1104. __be16 cfg;
  1105. u8 up_map;
  1106. u8 sf_cfgrc;
  1107. __be16 prot_ix;
  1108. u8 pe7_to_pe0;
  1109. u8 numTCPFCs;
  1110. __be32 pgid0_to_pgid7;
  1111. __be32 numTCs_oui;
  1112. u8 pgpc[8];
  1113. } dcb;
  1114. } u;
  1115. };
  1116. #define FW_PORT_CMD_READ (1U << 22)
  1117. #define FW_PORT_CMD_PORTID(x) ((x) << 0)
  1118. #define FW_PORT_CMD_PORTID_GET(x) (((x) >> 0) & 0xf)
  1119. #define FW_PORT_CMD_ACTION(x) ((x) << 16)
  1120. #define FW_PORT_CMD_ACTION_GET(x) (((x) >> 16) & 0xffff)
  1121. #define FW_PORT_CMD_CTLBF(x) ((x) << 10)
  1122. #define FW_PORT_CMD_OVLAN3(x) ((x) << 7)
  1123. #define FW_PORT_CMD_OVLAN2(x) ((x) << 6)
  1124. #define FW_PORT_CMD_OVLAN1(x) ((x) << 5)
  1125. #define FW_PORT_CMD_OVLAN0(x) ((x) << 4)
  1126. #define FW_PORT_CMD_IVLAN0(x) ((x) << 3)
  1127. #define FW_PORT_CMD_TXIPG(x) ((x) << 19)
  1128. #define FW_PORT_CMD_LSTATUS (1U << 31)
  1129. #define FW_PORT_CMD_LSPEED(x) ((x) << 24)
  1130. #define FW_PORT_CMD_LSPEED_GET(x) (((x) >> 24) & 0x3f)
  1131. #define FW_PORT_CMD_TXPAUSE (1U << 23)
  1132. #define FW_PORT_CMD_RXPAUSE (1U << 22)
  1133. #define FW_PORT_CMD_MDIOCAP (1U << 21)
  1134. #define FW_PORT_CMD_MDIOADDR_GET(x) (((x) >> 16) & 0x1f)
  1135. #define FW_PORT_CMD_LPTXPAUSE (1U << 15)
  1136. #define FW_PORT_CMD_LPRXPAUSE (1U << 14)
  1137. #define FW_PORT_CMD_PTYPE_MASK 0x1f
  1138. #define FW_PORT_CMD_PTYPE_GET(x) (((x) >> 8) & FW_PORT_CMD_PTYPE_MASK)
  1139. #define FW_PORT_CMD_MODTYPE_MASK 0x1f
  1140. #define FW_PORT_CMD_MODTYPE_GET(x) (((x) >> 0) & FW_PORT_CMD_MODTYPE_MASK)
  1141. #define FW_PORT_CMD_PPPEN(x) ((x) << 31)
  1142. #define FW_PORT_CMD_TPSRC(x) ((x) << 28)
  1143. #define FW_PORT_CMD_NCSISRC(x) ((x) << 24)
  1144. #define FW_PORT_CMD_CH0(x) ((x) << 20)
  1145. #define FW_PORT_CMD_CH1(x) ((x) << 16)
  1146. #define FW_PORT_CMD_CH2(x) ((x) << 12)
  1147. #define FW_PORT_CMD_CH3(x) ((x) << 8)
  1148. #define FW_PORT_CMD_NCSICH(x) ((x) << 4)
  1149. enum fw_port_type {
  1150. FW_PORT_TYPE_FIBER_XFI,
  1151. FW_PORT_TYPE_FIBER_XAUI,
  1152. FW_PORT_TYPE_BT_SGMII,
  1153. FW_PORT_TYPE_BT_XFI,
  1154. FW_PORT_TYPE_BT_XAUI,
  1155. FW_PORT_TYPE_KX4,
  1156. FW_PORT_TYPE_CX4,
  1157. FW_PORT_TYPE_KX,
  1158. FW_PORT_TYPE_KR,
  1159. FW_PORT_TYPE_SFP,
  1160. FW_PORT_TYPE_BP_AP,
  1161. FW_PORT_TYPE_BP4_AP,
  1162. FW_PORT_TYPE_NONE = FW_PORT_CMD_PTYPE_MASK
  1163. };
  1164. enum fw_port_module_type {
  1165. FW_PORT_MOD_TYPE_NA,
  1166. FW_PORT_MOD_TYPE_LR,
  1167. FW_PORT_MOD_TYPE_SR,
  1168. FW_PORT_MOD_TYPE_ER,
  1169. FW_PORT_MOD_TYPE_TWINAX_PASSIVE,
  1170. FW_PORT_MOD_TYPE_TWINAX_ACTIVE,
  1171. FW_PORT_MOD_TYPE_LRM,
  1172. FW_PORT_MOD_TYPE_NONE = FW_PORT_CMD_MODTYPE_MASK
  1173. };
  1174. /* port stats */
  1175. #define FW_NUM_PORT_STATS 50
  1176. #define FW_NUM_PORT_TX_STATS 23
  1177. #define FW_NUM_PORT_RX_STATS 27
  1178. enum fw_port_stats_tx_index {
  1179. FW_STAT_TX_PORT_BYTES_IX,
  1180. FW_STAT_TX_PORT_FRAMES_IX,
  1181. FW_STAT_TX_PORT_BCAST_IX,
  1182. FW_STAT_TX_PORT_MCAST_IX,
  1183. FW_STAT_TX_PORT_UCAST_IX,
  1184. FW_STAT_TX_PORT_ERROR_IX,
  1185. FW_STAT_TX_PORT_64B_IX,
  1186. FW_STAT_TX_PORT_65B_127B_IX,
  1187. FW_STAT_TX_PORT_128B_255B_IX,
  1188. FW_STAT_TX_PORT_256B_511B_IX,
  1189. FW_STAT_TX_PORT_512B_1023B_IX,
  1190. FW_STAT_TX_PORT_1024B_1518B_IX,
  1191. FW_STAT_TX_PORT_1519B_MAX_IX,
  1192. FW_STAT_TX_PORT_DROP_IX,
  1193. FW_STAT_TX_PORT_PAUSE_IX,
  1194. FW_STAT_TX_PORT_PPP0_IX,
  1195. FW_STAT_TX_PORT_PPP1_IX,
  1196. FW_STAT_TX_PORT_PPP2_IX,
  1197. FW_STAT_TX_PORT_PPP3_IX,
  1198. FW_STAT_TX_PORT_PPP4_IX,
  1199. FW_STAT_TX_PORT_PPP5_IX,
  1200. FW_STAT_TX_PORT_PPP6_IX,
  1201. FW_STAT_TX_PORT_PPP7_IX
  1202. };
  1203. enum fw_port_stat_rx_index {
  1204. FW_STAT_RX_PORT_BYTES_IX,
  1205. FW_STAT_RX_PORT_FRAMES_IX,
  1206. FW_STAT_RX_PORT_BCAST_IX,
  1207. FW_STAT_RX_PORT_MCAST_IX,
  1208. FW_STAT_RX_PORT_UCAST_IX,
  1209. FW_STAT_RX_PORT_MTU_ERROR_IX,
  1210. FW_STAT_RX_PORT_MTU_CRC_ERROR_IX,
  1211. FW_STAT_RX_PORT_CRC_ERROR_IX,
  1212. FW_STAT_RX_PORT_LEN_ERROR_IX,
  1213. FW_STAT_RX_PORT_SYM_ERROR_IX,
  1214. FW_STAT_RX_PORT_64B_IX,
  1215. FW_STAT_RX_PORT_65B_127B_IX,
  1216. FW_STAT_RX_PORT_128B_255B_IX,
  1217. FW_STAT_RX_PORT_256B_511B_IX,
  1218. FW_STAT_RX_PORT_512B_1023B_IX,
  1219. FW_STAT_RX_PORT_1024B_1518B_IX,
  1220. FW_STAT_RX_PORT_1519B_MAX_IX,
  1221. FW_STAT_RX_PORT_PAUSE_IX,
  1222. FW_STAT_RX_PORT_PPP0_IX,
  1223. FW_STAT_RX_PORT_PPP1_IX,
  1224. FW_STAT_RX_PORT_PPP2_IX,
  1225. FW_STAT_RX_PORT_PPP3_IX,
  1226. FW_STAT_RX_PORT_PPP4_IX,
  1227. FW_STAT_RX_PORT_PPP5_IX,
  1228. FW_STAT_RX_PORT_PPP6_IX,
  1229. FW_STAT_RX_PORT_PPP7_IX,
  1230. FW_STAT_RX_PORT_LESS_64B_IX
  1231. };
  1232. struct fw_port_stats_cmd {
  1233. __be32 op_to_portid;
  1234. __be32 retval_len16;
  1235. union fw_port_stats {
  1236. struct fw_port_stats_ctl {
  1237. u8 nstats_bg_bm;
  1238. u8 tx_ix;
  1239. __be16 r6;
  1240. __be32 r7;
  1241. __be64 stat0;
  1242. __be64 stat1;
  1243. __be64 stat2;
  1244. __be64 stat3;
  1245. __be64 stat4;
  1246. __be64 stat5;
  1247. } ctl;
  1248. struct fw_port_stats_all {
  1249. __be64 tx_bytes;
  1250. __be64 tx_frames;
  1251. __be64 tx_bcast;
  1252. __be64 tx_mcast;
  1253. __be64 tx_ucast;
  1254. __be64 tx_error;
  1255. __be64 tx_64b;
  1256. __be64 tx_65b_127b;
  1257. __be64 tx_128b_255b;
  1258. __be64 tx_256b_511b;
  1259. __be64 tx_512b_1023b;
  1260. __be64 tx_1024b_1518b;
  1261. __be64 tx_1519b_max;
  1262. __be64 tx_drop;
  1263. __be64 tx_pause;
  1264. __be64 tx_ppp0;
  1265. __be64 tx_ppp1;
  1266. __be64 tx_ppp2;
  1267. __be64 tx_ppp3;
  1268. __be64 tx_ppp4;
  1269. __be64 tx_ppp5;
  1270. __be64 tx_ppp6;
  1271. __be64 tx_ppp7;
  1272. __be64 rx_bytes;
  1273. __be64 rx_frames;
  1274. __be64 rx_bcast;
  1275. __be64 rx_mcast;
  1276. __be64 rx_ucast;
  1277. __be64 rx_mtu_error;
  1278. __be64 rx_mtu_crc_error;
  1279. __be64 rx_crc_error;
  1280. __be64 rx_len_error;
  1281. __be64 rx_sym_error;
  1282. __be64 rx_64b;
  1283. __be64 rx_65b_127b;
  1284. __be64 rx_128b_255b;
  1285. __be64 rx_256b_511b;
  1286. __be64 rx_512b_1023b;
  1287. __be64 rx_1024b_1518b;
  1288. __be64 rx_1519b_max;
  1289. __be64 rx_pause;
  1290. __be64 rx_ppp0;
  1291. __be64 rx_ppp1;
  1292. __be64 rx_ppp2;
  1293. __be64 rx_ppp3;
  1294. __be64 rx_ppp4;
  1295. __be64 rx_ppp5;
  1296. __be64 rx_ppp6;
  1297. __be64 rx_ppp7;
  1298. __be64 rx_less_64b;
  1299. __be64 rx_bg_drop;
  1300. __be64 rx_bg_trunc;
  1301. } all;
  1302. } u;
  1303. };
  1304. #define FW_PORT_STATS_CMD_NSTATS(x) ((x) << 4)
  1305. #define FW_PORT_STATS_CMD_BG_BM(x) ((x) << 0)
  1306. #define FW_PORT_STATS_CMD_TX(x) ((x) << 7)
  1307. #define FW_PORT_STATS_CMD_IX(x) ((x) << 0)
  1308. /* port loopback stats */
  1309. #define FW_NUM_LB_STATS 16
  1310. enum fw_port_lb_stats_index {
  1311. FW_STAT_LB_PORT_BYTES_IX,
  1312. FW_STAT_LB_PORT_FRAMES_IX,
  1313. FW_STAT_LB_PORT_BCAST_IX,
  1314. FW_STAT_LB_PORT_MCAST_IX,
  1315. FW_STAT_LB_PORT_UCAST_IX,
  1316. FW_STAT_LB_PORT_ERROR_IX,
  1317. FW_STAT_LB_PORT_64B_IX,
  1318. FW_STAT_LB_PORT_65B_127B_IX,
  1319. FW_STAT_LB_PORT_128B_255B_IX,
  1320. FW_STAT_LB_PORT_256B_511B_IX,
  1321. FW_STAT_LB_PORT_512B_1023B_IX,
  1322. FW_STAT_LB_PORT_1024B_1518B_IX,
  1323. FW_STAT_LB_PORT_1519B_MAX_IX,
  1324. FW_STAT_LB_PORT_DROP_FRAMES_IX
  1325. };
  1326. struct fw_port_lb_stats_cmd {
  1327. __be32 op_to_lbport;
  1328. __be32 retval_len16;
  1329. union fw_port_lb_stats {
  1330. struct fw_port_lb_stats_ctl {
  1331. u8 nstats_bg_bm;
  1332. u8 ix_pkd;
  1333. __be16 r6;
  1334. __be32 r7;
  1335. __be64 stat0;
  1336. __be64 stat1;
  1337. __be64 stat2;
  1338. __be64 stat3;
  1339. __be64 stat4;
  1340. __be64 stat5;
  1341. } ctl;
  1342. struct fw_port_lb_stats_all {
  1343. __be64 tx_bytes;
  1344. __be64 tx_frames;
  1345. __be64 tx_bcast;
  1346. __be64 tx_mcast;
  1347. __be64 tx_ucast;
  1348. __be64 tx_error;
  1349. __be64 tx_64b;
  1350. __be64 tx_65b_127b;
  1351. __be64 tx_128b_255b;
  1352. __be64 tx_256b_511b;
  1353. __be64 tx_512b_1023b;
  1354. __be64 tx_1024b_1518b;
  1355. __be64 tx_1519b_max;
  1356. __be64 rx_lb_drop;
  1357. __be64 rx_lb_trunc;
  1358. } all;
  1359. } u;
  1360. };
  1361. #define FW_PORT_LB_STATS_CMD_LBPORT(x) ((x) << 0)
  1362. #define FW_PORT_LB_STATS_CMD_NSTATS(x) ((x) << 4)
  1363. #define FW_PORT_LB_STATS_CMD_BG_BM(x) ((x) << 0)
  1364. #define FW_PORT_LB_STATS_CMD_IX(x) ((x) << 0)
  1365. struct fw_rss_ind_tbl_cmd {
  1366. __be32 op_to_viid;
  1367. #define FW_RSS_IND_TBL_CMD_VIID(x) ((x) << 0)
  1368. __be32 retval_len16;
  1369. __be16 niqid;
  1370. __be16 startidx;
  1371. __be32 r3;
  1372. __be32 iq0_to_iq2;
  1373. #define FW_RSS_IND_TBL_CMD_IQ0(x) ((x) << 20)
  1374. #define FW_RSS_IND_TBL_CMD_IQ1(x) ((x) << 10)
  1375. #define FW_RSS_IND_TBL_CMD_IQ2(x) ((x) << 0)
  1376. __be32 iq3_to_iq5;
  1377. __be32 iq6_to_iq8;
  1378. __be32 iq9_to_iq11;
  1379. __be32 iq12_to_iq14;
  1380. __be32 iq15_to_iq17;
  1381. __be32 iq18_to_iq20;
  1382. __be32 iq21_to_iq23;
  1383. __be32 iq24_to_iq26;
  1384. __be32 iq27_to_iq29;
  1385. __be32 iq30_iq31;
  1386. __be32 r15_lo;
  1387. };
  1388. struct fw_rss_glb_config_cmd {
  1389. __be32 op_to_write;
  1390. __be32 retval_len16;
  1391. union fw_rss_glb_config {
  1392. struct fw_rss_glb_config_manual {
  1393. __be32 mode_pkd;
  1394. __be32 r3;
  1395. __be64 r4;
  1396. __be64 r5;
  1397. } manual;
  1398. struct fw_rss_glb_config_basicvirtual {
  1399. __be32 mode_pkd;
  1400. __be32 synmapen_to_hashtoeplitz;
  1401. #define FW_RSS_GLB_CONFIG_CMD_SYNMAPEN (1U << 8)
  1402. #define FW_RSS_GLB_CONFIG_CMD_SYN4TUPENIPV6 (1U << 7)
  1403. #define FW_RSS_GLB_CONFIG_CMD_SYN2TUPENIPV6 (1U << 6)
  1404. #define FW_RSS_GLB_CONFIG_CMD_SYN4TUPENIPV4 (1U << 5)
  1405. #define FW_RSS_GLB_CONFIG_CMD_SYN2TUPENIPV4 (1U << 4)
  1406. #define FW_RSS_GLB_CONFIG_CMD_OFDMAPEN (1U << 3)
  1407. #define FW_RSS_GLB_CONFIG_CMD_TNLMAPEN (1U << 2)
  1408. #define FW_RSS_GLB_CONFIG_CMD_TNLALLLKP (1U << 1)
  1409. #define FW_RSS_GLB_CONFIG_CMD_HASHTOEPLITZ (1U << 0)
  1410. __be64 r8;
  1411. __be64 r9;
  1412. } basicvirtual;
  1413. } u;
  1414. };
  1415. #define FW_RSS_GLB_CONFIG_CMD_MODE(x) ((x) << 28)
  1416. #define FW_RSS_GLB_CONFIG_CMD_MODE_GET(x) (((x) >> 28) & 0xf)
  1417. #define FW_RSS_GLB_CONFIG_CMD_MODE_MANUAL 0
  1418. #define FW_RSS_GLB_CONFIG_CMD_MODE_BASICVIRTUAL 1
  1419. struct fw_rss_vi_config_cmd {
  1420. __be32 op_to_viid;
  1421. #define FW_RSS_VI_CONFIG_CMD_VIID(x) ((x) << 0)
  1422. __be32 retval_len16;
  1423. union fw_rss_vi_config {
  1424. struct fw_rss_vi_config_manual {
  1425. __be64 r3;
  1426. __be64 r4;
  1427. __be64 r5;
  1428. } manual;
  1429. struct fw_rss_vi_config_basicvirtual {
  1430. __be32 r6;
  1431. __be32 defaultq_to_udpen;
  1432. #define FW_RSS_VI_CONFIG_CMD_DEFAULTQ(x) ((x) << 16)
  1433. #define FW_RSS_VI_CONFIG_CMD_DEFAULTQ_GET(x) (((x) >> 16) & 0x3ff)
  1434. #define FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN (1U << 4)
  1435. #define FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN (1U << 3)
  1436. #define FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN (1U << 2)
  1437. #define FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN (1U << 1)
  1438. #define FW_RSS_VI_CONFIG_CMD_UDPEN (1U << 0)
  1439. __be64 r9;
  1440. __be64 r10;
  1441. } basicvirtual;
  1442. } u;
  1443. };
  1444. enum fw_error_type {
  1445. FW_ERROR_TYPE_EXCEPTION = 0x0,
  1446. FW_ERROR_TYPE_HWMODULE = 0x1,
  1447. FW_ERROR_TYPE_WR = 0x2,
  1448. FW_ERROR_TYPE_ACL = 0x3,
  1449. };
  1450. struct fw_error_cmd {
  1451. __be32 op_to_type;
  1452. __be32 len16_pkd;
  1453. union fw_error {
  1454. struct fw_error_exception {
  1455. __be32 info[6];
  1456. } exception;
  1457. struct fw_error_hwmodule {
  1458. __be32 regaddr;
  1459. __be32 regval;
  1460. } hwmodule;
  1461. struct fw_error_wr {
  1462. __be16 cidx;
  1463. __be16 pfn_vfn;
  1464. __be32 eqid;
  1465. u8 wrhdr[16];
  1466. } wr;
  1467. struct fw_error_acl {
  1468. __be16 cidx;
  1469. __be16 pfn_vfn;
  1470. __be32 eqid;
  1471. __be16 mv_pkd;
  1472. u8 val[6];
  1473. __be64 r4;
  1474. } acl;
  1475. } u;
  1476. };
  1477. struct fw_debug_cmd {
  1478. __be32 op_type;
  1479. #define FW_DEBUG_CMD_TYPE_GET(x) ((x) & 0xff)
  1480. __be32 len16_pkd;
  1481. union fw_debug {
  1482. struct fw_debug_assert {
  1483. __be32 fcid;
  1484. __be32 line;
  1485. __be32 x;
  1486. __be32 y;
  1487. u8 filename_0_7[8];
  1488. u8 filename_8_15[8];
  1489. __be64 r3;
  1490. } assert;
  1491. struct fw_debug_prt {
  1492. __be16 dprtstridx;
  1493. __be16 r3[3];
  1494. __be32 dprtstrparam0;
  1495. __be32 dprtstrparam1;
  1496. __be32 dprtstrparam2;
  1497. __be32 dprtstrparam3;
  1498. } prt;
  1499. } u;
  1500. };
  1501. #define FW_PCIE_FW_ERR (1U << 31)
  1502. #define FW_PCIE_FW_INIT (1U << 30)
  1503. #define FW_PCIE_FW_HALT (1U << 29)
  1504. #define FW_PCIE_FW_MASTER_VLD (1U << 15)
  1505. #define FW_PCIE_FW_MASTER_MASK 0x7
  1506. #define FW_PCIE_FW_MASTER_SHIFT 12
  1507. #define FW_PCIE_FW_MASTER(x) ((x) << FW_PCIE_FW_MASTER_SHIFT)
  1508. #define FW_PCIE_FW_MASTER_GET(x) (((x) >> FW_PCIE_FW_MASTER_SHIFT) & \
  1509. FW_PCIE_FW_MASTER_MASK)
  1510. struct fw_hdr {
  1511. u8 ver;
  1512. u8 reserved1;
  1513. __be16 len512; /* bin length in units of 512-bytes */
  1514. __be32 fw_ver; /* firmware version */
  1515. __be32 tp_microcode_ver;
  1516. u8 intfver_nic;
  1517. u8 intfver_vnic;
  1518. u8 intfver_ofld;
  1519. u8 intfver_ri;
  1520. u8 intfver_iscsipdu;
  1521. u8 intfver_iscsi;
  1522. u8 intfver_fcoe;
  1523. u8 reserved2;
  1524. __u32 reserved3;
  1525. __u32 reserved4;
  1526. __u32 reserved5;
  1527. __be32 flags;
  1528. __be32 reserved6[23];
  1529. };
  1530. #define FW_HDR_FW_VER_MAJOR_GET(x) (((x) >> 24) & 0xff)
  1531. #define FW_HDR_FW_VER_MINOR_GET(x) (((x) >> 16) & 0xff)
  1532. #define FW_HDR_FW_VER_MICRO_GET(x) (((x) >> 8) & 0xff)
  1533. #define FW_HDR_FW_VER_BUILD_GET(x) (((x) >> 0) & 0xff)
  1534. enum fw_hdr_flags {
  1535. FW_HDR_FLAGS_RESET_HALT = 0x00000001,
  1536. };
  1537. #endif /* _T4FW_INTERFACE_H_ */