t4fw_api.h 43 KB

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