t4fw_api.h 41 KB

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